Socket
Socket
Sign inDemoInstall

bullet-train-client

Package Overview
Dependencies
0
Maintainers
1
Versions
50
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 0.0.83 to 0.0.84

isomorphic-es6.js

3

index.js

@@ -1,2 +0,1 @@

!function(t,e){if("object"==typeof exports&&"object"==typeof module)module.exports=e();else if("function"==typeof define&&define.amd)define([],e);else{var n=e();for(var r in n)("object"==typeof exports?exports:t)[r]=n[r]}}(this,(function(){return function(t){var e={};function n(r){if(e[r])return e[r].exports;var i=e[r]={i:r,l:!1,exports:{}};return t[r].call(i.exports,i,i.exports,n),i.l=!0,i.exports}return n.m=t,n.c=e,n.d=function(t,e,r){n.o(t,e)||Object.defineProperty(t,e,{enumerable:!0,get:r})},n.r=function(t){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},n.t=function(t,e){if(1&e&&(t=n(t)),8&e)return t;if(4&e&&"object"==typeof t&&t&&t.__esModule)return t;var r=Object.create(null);if(n.r(r),Object.defineProperty(r,"default",{enumerable:!0,value:t}),2&e&&"string"!=typeof t)for(var i in t)n.d(r,i,function(e){return t[e]}.bind(null,i));return r},n.n=function(t){var e=t&&t.__esModule?function(){return t.default}:function(){return t};return n.d(e,"a",e),e},n.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},n.p="",n(n.s=1)}([function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var r,i=function(t,e){if(Array.isArray(t))return t;if(Symbol.iterator in Object(t))return function(t,e){var n=[],r=!0,i=!1,o=void 0;try{for(var a,u=t[Symbol.iterator]();!(r=(a=u.next()).done)&&(n.push(a.value),!e||n.length!==e);r=!0);}catch(t){i=!0,o=t}finally{try{!r&&u.return&&u.return()}finally{if(i)throw o}}return n}(t,e);throw new TypeError("Invalid attempt to destructure non-iterable instance")},o=n(3),a=(r=o)&&r.__esModule?r:{default:r};var u={getItem:function(t,e){return u.multiGet([t]).then((function(t){return t[0][1]})).then((function(t){return e&&e(null,t),t})).catch((function(t){return e&&e(t,null),t}))},setItem:function(t,e,n){return u.multiSet([[t,e]]).then((function(t){return n&&n(null,t),t})).catch((function(t){return n&&n(t,null),t}))},getAllKeys:function(t){return Promise.resolve(Object.keys(localStorage)).then((function(e){return t&&t(null,e),e})).catch((function(e){return t&&t(e,null),e}))},removeItem:function(t,e){return u.multiRemove([t]).then((function(){e&&e(null)})).catch((function(t){e&&e(t,null)}))},clear:function(){return new Promise((function(t){window.localStorage.clear(),t()}))},mergeItem:function(t,e){return u.multiMerge([[t,e]])},multiGet:function(t){return new Promise((function(e){e(t.reduce((function(t,e){return t.concat([[e,localStorage.getItem(e)]])}),[]))}))},multiSet:function(t){return new Promise((function(e,n){var r=[];return t.forEach((function(t){var e=i(t,2),n=e[0],o=e[1];try{localStorage.setItem(n,o)}catch(t){r.push(t)}})),r.length>0?n(r):e()}))},multiMerge:function(t){return new Promise((function(e,n){var r=[];return t.forEach((function(t){var e=i(t,2),n=e[0],o=e[1],u=localStorage.getItem(n);if(u)try{localStorage.setItem(n,JSON.stringify((0,a.default)(JSON.parse(u),JSON.parse(o))))}catch(t){r.push(t)}})),r.length>0?n(r):e()}))},multiRemove:function(t){return new Promise((function(e){t.forEach((function(t){return window.localStorage.removeItem(t)})),e()}))},flushGetRequests:function(){console.warn("AsyncStorage.flushGetRequests: Not supported on `web`")}};e.default=u},function(t,e,n){"use strict";n.r(e);var r=n(0),i=n.n(r),o=n(2).default,a=n(5)({AsyncStorage:i.a,fetch:o});"undefined"!=typeof window&&(window.bulletTrain=a),e.default=a},function(t,e,n){"use strict";n.r(e),e.default=function(t,e){return e=e||{},new Promise((function(n,r){var i=new XMLHttpRequest,o=[],a=[],u={},c=function(){return{ok:2==(i.status/100|0),statusText:i.statusText,status:i.status,url:i.responseURL,text:function(){return Promise.resolve(i.responseText)},json:function(){return Promise.resolve(JSON.parse(i.responseText))},blob:function(){return Promise.resolve(new Blob([i.response]))},clone:c,headers:{keys:function(){return o},entries:function(){return a},get:function(t){return u[t.toLowerCase()]},has:function(t){return t.toLowerCase()in u}}}};for(var s in i.open(e.method||"get",t,!0),i.onload=function(){i.getAllResponseHeaders().replace(/^(.*?):[^\S\n]*([\s\S]*?)$/gm,(function(t,e,n){o.push(e=e.toLowerCase()),a.push([e,n]),u[e]=u[e]?u[e]+","+n:n})),n(c())},i.onerror=r,i.withCredentials="include"==e.credentials,e.headers)i.setRequestHeader(s,e.headers[s]);i.send(e.body||null)}))}},function(t,e,n){(function(t){var n=200,r="__lodash_hash_undefined__",i=800,o=16,a=9007199254740991,u="[object Arguments]",c="[object AsyncFunction]",s="[object Function]",l="[object GeneratorFunction]",f="[object Null]",h="[object Object]",v="[object Proxy]",p="[object Undefined]",d=/^\[object .+?Constructor\]$/,y=/^(?:0|[1-9]\d*)$/,g={};g["[object Float32Array]"]=g["[object Float64Array]"]=g["[object Int8Array]"]=g["[object Int16Array]"]=g["[object Int32Array]"]=g["[object Uint8Array]"]=g["[object Uint8ClampedArray]"]=g["[object Uint16Array]"]=g["[object Uint32Array]"]=!0,g[u]=g["[object Array]"]=g["[object ArrayBuffer]"]=g["[object Boolean]"]=g["[object DataView]"]=g["[object Date]"]=g["[object Error]"]=g[s]=g["[object Map]"]=g["[object Number]"]=g[h]=g["[object RegExp]"]=g["[object Set]"]=g["[object String]"]=g["[object WeakMap]"]=!1;var b="object"==typeof global&&global&&global.Object===Object&&global,_="object"==typeof self&&self&&self.Object===Object&&self,m=b||_||Function("return this")(),j=e&&!e.nodeType&&e,w=j&&"object"==typeof t&&t&&!t.nodeType&&t,O=w&&w.exports===j,S=O&&b.process,P=function(){try{return S&&S.binding&&S.binding("util")}catch(t){}}(),A=P&&P.isTypedArray;function I(t,e,n){switch(n.length){case 0:return t.call(e);case 1:return t.call(e,n[0]);case 2:return t.call(e,n[0],n[1]);case 3:return t.call(e,n[0],n[1],n[2])}return t.apply(e,n)}function x(t,e){return"__proto__"==e?void 0:t[e]}var T,k,F,z=Array.prototype,C=Function.prototype,E=Object.prototype,N=m["__core-js_shared__"],J=C.toString,L=E.hasOwnProperty,M=(T=/[^.]+$/.exec(N&&N.keys&&N.keys.IE_PROTO||""))?"Symbol(src)_1."+T:"",R=E.toString,D=J.call(Object),U=RegExp("^"+J.call(L).replace(/[\\^$.*+?()[\]{}|]/g,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),$=O?m.Buffer:void 0,B=m.Symbol,G=m.Uint8Array,q=$?$.allocUnsafe:void 0,H=(k=Object.getPrototypeOf,F=Object,function(t){return k(F(t))}),V=Object.create,K=E.propertyIsEnumerable,W=z.splice,X=B?B.toStringTag:void 0,Q=function(){try{var t=wt(Object,"defineProperty");return t({},"",{}),t}catch(t){}}(),Y=$?$.isBuffer:void 0,Z=Math.max,tt=Date.now,et=wt(m,"Map"),nt=wt(Object,"create"),rt=function(){function t(){}return function(e){if(!Ct(e))return{};if(V)return V(e);t.prototype=e;var n=new t;return t.prototype=void 0,n}}();function it(t){var e=-1,n=null==t?0:t.length;for(this.clear();++e<n;){var r=t[e];this.set(r[0],r[1])}}function ot(t){var e=-1,n=null==t?0:t.length;for(this.clear();++e<n;){var r=t[e];this.set(r[0],r[1])}}function at(t){var e=-1,n=null==t?0:t.length;for(this.clear();++e<n;){var r=t[e];this.set(r[0],r[1])}}function ut(t){var e=this.__data__=new ot(t);this.size=e.size}function ct(t,e){var n=xt(t),r=!n&&It(t),i=!n&&!r&&kt(t),o=!n&&!r&&!i&&Nt(t),a=n||r||i||o,u=a?function(t,e){for(var n=-1,r=Array(t);++n<t;)r[n]=e(n);return r}(t.length,String):[],c=u.length;for(var s in t)!e&&!L.call(t,s)||a&&("length"==s||i&&("offset"==s||"parent"==s)||o&&("buffer"==s||"byteLength"==s||"byteOffset"==s)||Ot(s,c))||u.push(s);return u}function st(t,e,n){(void 0===n||At(t[e],n))&&(void 0!==n||e in t)||ht(t,e,n)}function lt(t,e,n){var r=t[e];L.call(t,e)&&At(r,n)&&(void 0!==n||e in t)||ht(t,e,n)}function ft(t,e){for(var n=t.length;n--;)if(At(t[n][0],e))return n;return-1}function ht(t,e,n){"__proto__"==e&&Q?Q(t,e,{configurable:!0,enumerable:!0,value:n,writable:!0}):t[e]=n}it.prototype.clear=function(){this.__data__=nt?nt(null):{},this.size=0},it.prototype.delete=function(t){var e=this.has(t)&&delete this.__data__[t];return this.size-=e?1:0,e},it.prototype.get=function(t){var e=this.__data__;if(nt){var n=e[t];return n===r?void 0:n}return L.call(e,t)?e[t]:void 0},it.prototype.has=function(t){var e=this.__data__;return nt?void 0!==e[t]:L.call(e,t)},it.prototype.set=function(t,e){var n=this.__data__;return this.size+=this.has(t)?0:1,n[t]=nt&&void 0===e?r:e,this},ot.prototype.clear=function(){this.__data__=[],this.size=0},ot.prototype.delete=function(t){var e=this.__data__,n=ft(e,t);return!(n<0)&&(n==e.length-1?e.pop():W.call(e,n,1),--this.size,!0)},ot.prototype.get=function(t){var e=this.__data__,n=ft(e,t);return n<0?void 0:e[n][1]},ot.prototype.has=function(t){return ft(this.__data__,t)>-1},ot.prototype.set=function(t,e){var n=this.__data__,r=ft(n,t);return r<0?(++this.size,n.push([t,e])):n[r][1]=e,this},at.prototype.clear=function(){this.size=0,this.__data__={hash:new it,map:new(et||ot),string:new it}},at.prototype.delete=function(t){var e=jt(this,t).delete(t);return this.size-=e?1:0,e},at.prototype.get=function(t){return jt(this,t).get(t)},at.prototype.has=function(t){return jt(this,t).has(t)},at.prototype.set=function(t,e){var n=jt(this,t),r=n.size;return n.set(t,e),this.size+=n.size==r?0:1,this},ut.prototype.clear=function(){this.__data__=new ot,this.size=0},ut.prototype.delete=function(t){var e=this.__data__,n=e.delete(t);return this.size=e.size,n},ut.prototype.get=function(t){return this.__data__.get(t)},ut.prototype.has=function(t){return this.__data__.has(t)},ut.prototype.set=function(t,e){var r=this.__data__;if(r instanceof ot){var i=r.__data__;if(!et||i.length<n-1)return i.push([t,e]),this.size=++r.size,this;r=this.__data__=new at(i)}return r.set(t,e),this.size=r.size,this};var vt,pt=function(t,e,n){for(var r=-1,i=Object(t),o=n(t),a=o.length;a--;){var u=o[vt?a:++r];if(!1===e(i[u],u,i))break}return t};function dt(t){return null==t?void 0===t?p:f:X&&X in Object(t)?function(t){var e=L.call(t,X),n=t[X];try{t[X]=void 0;var r=!0}catch(t){}var i=R.call(t);r&&(e?t[X]=n:delete t[X]);return i}(t):function(t){return R.call(t)}(t)}function yt(t){return Et(t)&&dt(t)==u}function gt(t){return!(!Ct(t)||function(t){return!!M&&M in t}(t))&&(Ft(t)?U:d).test(function(t){if(null!=t){try{return J.call(t)}catch(t){}try{return t+""}catch(t){}}return""}(t))}function bt(t){if(!Ct(t))return function(t){var e=[];if(null!=t)for(var n in Object(t))e.push(n);return e}(t);var e=St(t),n=[];for(var r in t)("constructor"!=r||!e&&L.call(t,r))&&n.push(r);return n}function _t(t,e,n,r,i){t!==e&&pt(e,(function(o,a){if(Ct(o))i||(i=new ut),function(t,e,n,r,i,o,a){var u=x(t,n),c=x(e,n),s=a.get(c);if(s)return void st(t,n,s);var l=o?o(u,c,n+"",t,e,a):void 0,f=void 0===l;if(f){var v=xt(c),p=!v&&kt(c),d=!v&&!p&&Nt(c);l=c,v||p||d?xt(u)?l=u:Et(m=u)&&Tt(m)?l=function(t,e){var n=-1,r=t.length;e||(e=Array(r));for(;++n<r;)e[n]=t[n];return e}(u):p?(f=!1,l=function(t,e){if(e)return t.slice();var n=t.length,r=q?q(n):new t.constructor(n);return t.copy(r),r}(c,!0)):d?(f=!1,y=c,g=!0?(b=y.buffer,_=new b.constructor(b.byteLength),new G(_).set(new G(b)),_):y.buffer,l=new y.constructor(g,y.byteOffset,y.length)):l=[]:function(t){if(!Et(t)||dt(t)!=h)return!1;var e=H(t);if(null===e)return!0;var n=L.call(e,"constructor")&&e.constructor;return"function"==typeof n&&n instanceof n&&J.call(n)==D}(c)||It(c)?(l=u,It(u)?l=function(t){return function(t,e,n,r){var i=!n;n||(n={});var o=-1,a=e.length;for(;++o<a;){var u=e[o],c=r?r(n[u],t[u],u,n,t):void 0;void 0===c&&(c=t[u]),i?ht(n,u,c):lt(n,u,c)}return n}(t,Jt(t))}(u):(!Ct(u)||r&&Ft(u))&&(l=function(t){return"function"!=typeof t.constructor||St(t)?{}:rt(H(t))}(c))):f=!1}var y,g,b,_;var m;f&&(a.set(c,l),i(l,c,r,o,a),a.delete(c));st(t,n,l)}(t,e,a,n,_t,r,i);else{var u=r?r(x(t,a),o,a+"",t,e,i):void 0;void 0===u&&(u=o),st(t,a,u)}}),Jt)}function mt(t,e){return Pt(function(t,e,n){return e=Z(void 0===e?t.length-1:e,0),function(){for(var r=arguments,i=-1,o=Z(r.length-e,0),a=Array(o);++i<o;)a[i]=r[e+i];i=-1;for(var u=Array(e+1);++i<e;)u[i]=r[i];return u[e]=n(a),I(t,this,u)}}(t,e,Rt),t+"")}function jt(t,e){var n,r,i=t.__data__;return("string"==(r=typeof(n=e))||"number"==r||"symbol"==r||"boolean"==r?"__proto__"!==n:null===n)?i["string"==typeof e?"string":"hash"]:i.map}function wt(t,e){var n=function(t,e){return null==t?void 0:t[e]}(t,e);return gt(n)?n:void 0}function Ot(t,e){var n=typeof t;return!!(e=null==e?a:e)&&("number"==n||"symbol"!=n&&y.test(t))&&t>-1&&t%1==0&&t<e}function St(t){var e=t&&t.constructor;return t===("function"==typeof e&&e.prototype||E)}var Pt=function(t){var e=0,n=0;return function(){var r=tt(),a=o-(r-n);if(n=r,a>0){if(++e>=i)return arguments[0]}else e=0;return t.apply(void 0,arguments)}}(Q?function(t,e){return Q(t,"toString",{configurable:!0,enumerable:!1,value:(n=e,function(){return n}),writable:!0});var n}:Rt);function At(t,e){return t===e||t!=t&&e!=e}var It=yt(function(){return arguments}())?yt:function(t){return Et(t)&&L.call(t,"callee")&&!K.call(t,"callee")},xt=Array.isArray;function Tt(t){return null!=t&&zt(t.length)&&!Ft(t)}var kt=Y||function(){return!1};function Ft(t){if(!Ct(t))return!1;var e=dt(t);return e==s||e==l||e==c||e==v}function zt(t){return"number"==typeof t&&t>-1&&t%1==0&&t<=a}function Ct(t){var e=typeof t;return null!=t&&("object"==e||"function"==e)}function Et(t){return null!=t&&"object"==typeof t}var Nt=A?function(t){return function(e){return t(e)}}(A):function(t){return Et(t)&&zt(t.length)&&!!g[dt(t)]};function Jt(t){return Tt(t)?ct(t,!0):bt(t)}var Lt,Mt=(Lt=function(t,e,n){_t(t,e,n)},mt((function(t,e){var n=-1,r=e.length,i=r>1?e[r-1]:void 0,o=r>2?e[2]:void 0;for(i=Lt.length>3&&"function"==typeof i?(r--,i):void 0,o&&function(t,e,n){if(!Ct(n))return!1;var r=typeof e;return!!("number"==r?Tt(n)&&Ot(e,n.length):"string"==r&&e in n)&&At(n[e],t)}(e[0],e[1],o)&&(i=r<3?void 0:i,r=1),t=Object(t);++n<r;){var a=e[n];a&&Lt(t,a,n,i)}return t})));function Rt(t){return t}t.exports=Mt}).call(this,n(4)(t))},function(t,e){t.exports=function(t){return t.webpackPolyfill||(t.deprecate=function(){},t.paths=[],t.children||(t.children=[]),Object.defineProperty(t,"loaded",{enumerable:!0,get:function(){return t.l}}),Object.defineProperty(t,"id",{enumerable:!0,get:function(){return t.i}}),t.webpackPolyfill=1),t}},function(t,e){var n,r;function i(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,r.key,r)}}function o(t,e,n){return e in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}var a="https://api.bullet-train.io/api/v1/",u=function(){function t(e){var i=this;!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),o(this,"getJSON",(function(t,e,r){var o={method:e||"GET",body:r,headers:{"x-environment-key":i.environmentID}};return"GET"!==e&&(o.headers["Content-Type"]="application/json; charset=utf-8"),n(t,o).then((function(t){return t.status>=200&&t.status<300?t:t.text().then((function(t){var e=t;try{e=JSON.parse(t)}catch(t){}return Promise.reject(e)}))})).then((function(t){return t.json()}))})),o(this,"getFlags",(function(t,e){var n=i.onChange,r=i.onError,o=i.identity,a=i.api,u=(i.disableCache,!1),c=function(t,e){var r=t.flags,o=t.traits,a={},u={};if(o=o||[],(r=r||[]).forEach((function(t){a[t.feature.name.toLowerCase().replace(/ /g,"_")]={enabled:t.enabled,value:t.feature_state_value}})),o.forEach((function(t){u[t.trait_key.toLowerCase().replace(/ /g,"_")]=t.trait_value})),i.oldFlags=a,i.flags=a,i.traits=u,e){var c={};e.map((function(t){c[t.name]=t})),i.segments=c}n&&n(i.oldFlags,{isFromServer:!0})};return o?Promise.all([i.getJSON(a+"identities/?identifier="+encodeURIComponent(o))]).then((function(t){c(t[0],t[1])})).catch((function(t){var e=t.message;r&&r({message:e})})):Promise.all([i.getJSON(a+"flags/")]).then((function(e){c({flags:e[0]},null),t&&!u&&(u=!0,t())})).catch((function(t){e&&!u&&(u=!0,e(t)),r&&r(t)}))})),o(this,"getValue",(function(t){var e=i.flags&&i.flags[t],n=null;return e&&(n=e.value),n})),o(this,"getTrait",(function(t){return i.traits&&i.traits[t]})),o(this,"setTrait",(function(t,e){var n=i.getJSON,r=i.identity,o=i.api,a={identity:{identifier:r},trait_key:t,trait_value:e};return n("".concat(o,"traits/"),"POST",JSON.stringify(a)).then(i.getFlags)})),o(this,"incrementTrait",(function(t,e){var n=i.getJSON,r=i.identity,o=i.api;return n("".concat(o,"traits/increment-value/"),"POST",JSON.stringify({trait_key:t,increment_by:e,identifier:r})).then(i.getFlags)})),o(this,"hasFeature",(function(t){var e=i.flags&&i.flags[t],n=!1;return e&&e.enabled&&(n=!0),n})),n=e.fetch?e.fetch:global.fetch,r=e.AsyncStorage}var e,u,c;return e=t,(u=[{key:"init",value:function(t){var e=this,n=t.environmentID,i=t.api,o=void 0===i?a:i,u=t.onChange,c=t.disableCache,s=t.onError,l=t.defaultFlags,f=t.preventFetch,h=t.state;return new Promise((function(t,i){if(e.environmentID=n,e.api=o,e.interval=null,e.disableCache=c,e.onChange=u,e.onError=s,e.flags=Object.assign({},l)||{},e.initialised=!0,e.setState(h),!n)throw i("Please specify a environment id"),"Please specify a environment id";c||r.getItem("BULLET_TRAIN_DB",(function(n,r){e.flags=r?JSON.parse(r):l,e.flags&&e.onChange&&e.onChange(null,{isFromServer:!1}),f||e.getFlags(t,i)}))}))}},{key:"getAllFlags",value:function(){return this.flags}},{key:"identify",value:function(t){this.identity=t,this.initialised&&!this.interval&&this.getFlags()}},{key:"getState",value:function(){return{api:this.api,environmentID:this.environmentID,flags:this.flags,identity:this.identity,segments:this.segments,traits:this.traits}}},{key:"setState",value:function(t){t&&(this.initialised=!0,this.api=t.api||this.api||a,this.environmentID=t.environmentID||this.environmentID,this.flags=t.flags||this.flags,this.identity=t.identity||this.identity,this.segments=t.segments||this.segments,this.traits=t.traits||this.traits)}},{key:"logout",value:function(){this.identity=null,this.segments=null,this.traits=null,this.initialised&&!this.interval&&this.getFlags()}},{key:"startListening",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:1e3;this.interval||(this.interval=setInterval(this.getFlags,t))}},{key:"getSegments",value:function(){}},{key:"stopListening",value:function(){clearInterval(this.interval)}}])&&i(e.prototype,u),c&&i(e,c),t}();t.exports=function(t){var e=t.fetch,n=t.AsyncStorage;return new u({fetch:e,AsyncStorage:n})}}])}));
//# sourceMappingURL=index.js.map
!function(t,e){if("object"==typeof exports&&"object"==typeof module)module.exports=e();else if("function"==typeof define&&define.amd)define([],e);else{var n=e();for(var r in n)("object"==typeof exports?exports:t)[r]=n[r]}}(this,(function(){return function(t){var e={};function n(r){if(e[r])return e[r].exports;var i=e[r]={i:r,l:!1,exports:{}};return t[r].call(i.exports,i,i.exports,n),i.l=!0,i.exports}return n.m=t,n.c=e,n.d=function(t,e,r){n.o(t,e)||Object.defineProperty(t,e,{enumerable:!0,get:r})},n.r=function(t){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},n.t=function(t,e){if(1&e&&(t=n(t)),8&e)return t;if(4&e&&"object"==typeof t&&t&&t.__esModule)return t;var r=Object.create(null);if(n.r(r),Object.defineProperty(r,"default",{enumerable:!0,value:t}),2&e&&"string"!=typeof t)for(var i in t)n.d(r,i,function(e){return t[e]}.bind(null,i));return r},n.n=function(t){var e=t&&t.__esModule?function(){return t.default}:function(){return t};return n.d(e,"a",e),e},n.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},n.p="",n(n.s=1)}([function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var r,i=function(t,e){if(Array.isArray(t))return t;if(Symbol.iterator in Object(t))return function(t,e){var n=[],r=!0,i=!1,o=void 0;try{for(var a,u=t[Symbol.iterator]();!(r=(a=u.next()).done)&&(n.push(a.value),!e||n.length!==e);r=!0);}catch(t){i=!0,o=t}finally{try{!r&&u.return&&u.return()}finally{if(i)throw o}}return n}(t,e);throw new TypeError("Invalid attempt to destructure non-iterable instance")},o=n(3),a=(r=o)&&r.__esModule?r:{default:r};var u={getItem:function(t,e){return u.multiGet([t]).then((function(t){return t[0][1]})).then((function(t){return e&&e(null,t),t})).catch((function(t){return e&&e(t,null),t}))},setItem:function(t,e,n){return u.multiSet([[t,e]]).then((function(t){return n&&n(null,t),t})).catch((function(t){return n&&n(t,null),t}))},getAllKeys:function(t){return Promise.resolve(Object.keys(localStorage)).then((function(e){return t&&t(null,e),e})).catch((function(e){return t&&t(e,null),e}))},removeItem:function(t,e){return u.multiRemove([t]).then((function(){e&&e(null)})).catch((function(t){e&&e(t,null)}))},clear:function(){return new Promise((function(t){window.localStorage.clear(),t()}))},mergeItem:function(t,e){return u.multiMerge([[t,e]])},multiGet:function(t){return new Promise((function(e){e(t.reduce((function(t,e){return t.concat([[e,localStorage.getItem(e)]])}),[]))}))},multiSet:function(t){return new Promise((function(e,n){var r=[];return t.forEach((function(t){var e=i(t,2),n=e[0],o=e[1];try{localStorage.setItem(n,o)}catch(t){r.push(t)}})),r.length>0?n(r):e()}))},multiMerge:function(t){return new Promise((function(e,n){var r=[];return t.forEach((function(t){var e=i(t,2),n=e[0],o=e[1],u=localStorage.getItem(n);if(u)try{localStorage.setItem(n,JSON.stringify((0,a.default)(JSON.parse(u),JSON.parse(o))))}catch(t){r.push(t)}})),r.length>0?n(r):e()}))},multiRemove:function(t){return new Promise((function(e){t.forEach((function(t){return window.localStorage.removeItem(t)})),e()}))},flushGetRequests:function(){console.warn("AsyncStorage.flushGetRequests: Not supported on `web`")}};e.default=u},function(t,e,n){"use strict";n.r(e);var r=n(0),i=n.n(r),o=n(2).default,a=n(5)({AsyncStorage:i.a,fetch:o});"undefined"!=typeof window&&(window.bulletTrain=a),e.default=a},function(t,e,n){"use strict";n.r(e),e.default=function(t,e){return e=e||{},new Promise((function(n,r){var i=new XMLHttpRequest,o=[],a=[],u={},c=function(){return{ok:2==(i.status/100|0),statusText:i.statusText,status:i.status,url:i.responseURL,text:function(){return Promise.resolve(i.responseText)},json:function(){return Promise.resolve(JSON.parse(i.responseText))},blob:function(){return Promise.resolve(new Blob([i.response]))},clone:c,headers:{keys:function(){return o},entries:function(){return a},get:function(t){return u[t.toLowerCase()]},has:function(t){return t.toLowerCase()in u}}}};for(var s in i.open(e.method||"get",t,!0),i.onload=function(){i.getAllResponseHeaders().replace(/^(.*?):[^\S\n]*([\s\S]*?)$/gm,(function(t,e,n){o.push(e=e.toLowerCase()),a.push([e,n]),u[e]=u[e]?u[e]+","+n:n})),n(c())},i.onerror=r,i.withCredentials="include"==e.credentials,e.headers)i.setRequestHeader(s,e.headers[s]);i.send(e.body||null)}))}},function(t,e,n){(function(t){var n=200,r="__lodash_hash_undefined__",i=800,o=16,a=9007199254740991,u="[object Arguments]",c="[object AsyncFunction]",s="[object Function]",l="[object GeneratorFunction]",f="[object Null]",h="[object Object]",v="[object Proxy]",p="[object Undefined]",d=/^\[object .+?Constructor\]$/,y=/^(?:0|[1-9]\d*)$/,g={};g["[object Float32Array]"]=g["[object Float64Array]"]=g["[object Int8Array]"]=g["[object Int16Array]"]=g["[object Int32Array]"]=g["[object Uint8Array]"]=g["[object Uint8ClampedArray]"]=g["[object Uint16Array]"]=g["[object Uint32Array]"]=!0,g[u]=g["[object Array]"]=g["[object ArrayBuffer]"]=g["[object Boolean]"]=g["[object DataView]"]=g["[object Date]"]=g["[object Error]"]=g[s]=g["[object Map]"]=g["[object Number]"]=g[h]=g["[object RegExp]"]=g["[object Set]"]=g["[object String]"]=g["[object WeakMap]"]=!1;var b="object"==typeof global&&global&&global.Object===Object&&global,_="object"==typeof self&&self&&self.Object===Object&&self,m=b||_||Function("return this")(),j=e&&!e.nodeType&&e,w=j&&"object"==typeof t&&t&&!t.nodeType&&t,O=w&&w.exports===j,S=O&&b.process,P=function(){try{var t=w&&w.require&&w.require("util").types;return t||S&&S.binding&&S.binding("util")}catch(t){}}(),A=P&&P.isTypedArray;function I(t,e,n){switch(n.length){case 0:return t.call(e);case 1:return t.call(e,n[0]);case 2:return t.call(e,n[0],n[1]);case 3:return t.call(e,n[0],n[1],n[2])}return t.apply(e,n)}var x,T,k,F=Array.prototype,z=Function.prototype,C=Object.prototype,E=m["__core-js_shared__"],N=z.toString,J=C.hasOwnProperty,L=(x=/[^.]+$/.exec(E&&E.keys&&E.keys.IE_PROTO||""))?"Symbol(src)_1."+x:"",M=C.toString,R=N.call(Object),D=RegExp("^"+N.call(J).replace(/[\\^$.*+?()[\]{}|]/g,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),U=O?m.Buffer:void 0,$=m.Symbol,B=m.Uint8Array,G=U?U.allocUnsafe:void 0,q=(T=Object.getPrototypeOf,k=Object,function(t){return T(k(t))}),H=Object.create,V=C.propertyIsEnumerable,K=F.splice,W=$?$.toStringTag:void 0,X=function(){try{var t=jt(Object,"defineProperty");return t({},"",{}),t}catch(t){}}(),Q=U?U.isBuffer:void 0,Y=Math.max,Z=Date.now,tt=jt(m,"Map"),et=jt(Object,"create"),nt=function(){function t(){}return function(e){if(!Ct(e))return{};if(H)return H(e);t.prototype=e;var n=new t;return t.prototype=void 0,n}}();function rt(t){var e=-1,n=null==t?0:t.length;for(this.clear();++e<n;){var r=t[e];this.set(r[0],r[1])}}function it(t){var e=-1,n=null==t?0:t.length;for(this.clear();++e<n;){var r=t[e];this.set(r[0],r[1])}}function ot(t){var e=-1,n=null==t?0:t.length;for(this.clear();++e<n;){var r=t[e];this.set(r[0],r[1])}}function at(t){var e=this.__data__=new it(t);this.size=e.size}function ut(t,e){var n=xt(t),r=!n&&It(t),i=!n&&!r&&kt(t),o=!n&&!r&&!i&&Nt(t),a=n||r||i||o,u=a?function(t,e){for(var n=-1,r=Array(t);++n<t;)r[n]=e(n);return r}(t.length,String):[],c=u.length;for(var s in t)!e&&!J.call(t,s)||a&&("length"==s||i&&("offset"==s||"parent"==s)||o&&("buffer"==s||"byteLength"==s||"byteOffset"==s)||wt(s,c))||u.push(s);return u}function ct(t,e,n){(void 0===n||At(t[e],n))&&(void 0!==n||e in t)||ft(t,e,n)}function st(t,e,n){var r=t[e];J.call(t,e)&&At(r,n)&&(void 0!==n||e in t)||ft(t,e,n)}function lt(t,e){for(var n=t.length;n--;)if(At(t[n][0],e))return n;return-1}function ft(t,e,n){"__proto__"==e&&X?X(t,e,{configurable:!0,enumerable:!0,value:n,writable:!0}):t[e]=n}rt.prototype.clear=function(){this.__data__=et?et(null):{},this.size=0},rt.prototype.delete=function(t){var e=this.has(t)&&delete this.__data__[t];return this.size-=e?1:0,e},rt.prototype.get=function(t){var e=this.__data__;if(et){var n=e[t];return n===r?void 0:n}return J.call(e,t)?e[t]:void 0},rt.prototype.has=function(t){var e=this.__data__;return et?void 0!==e[t]:J.call(e,t)},rt.prototype.set=function(t,e){var n=this.__data__;return this.size+=this.has(t)?0:1,n[t]=et&&void 0===e?r:e,this},it.prototype.clear=function(){this.__data__=[],this.size=0},it.prototype.delete=function(t){var e=this.__data__,n=lt(e,t);return!(n<0)&&(n==e.length-1?e.pop():K.call(e,n,1),--this.size,!0)},it.prototype.get=function(t){var e=this.__data__,n=lt(e,t);return n<0?void 0:e[n][1]},it.prototype.has=function(t){return lt(this.__data__,t)>-1},it.prototype.set=function(t,e){var n=this.__data__,r=lt(n,t);return r<0?(++this.size,n.push([t,e])):n[r][1]=e,this},ot.prototype.clear=function(){this.size=0,this.__data__={hash:new rt,map:new(tt||it),string:new rt}},ot.prototype.delete=function(t){var e=mt(this,t).delete(t);return this.size-=e?1:0,e},ot.prototype.get=function(t){return mt(this,t).get(t)},ot.prototype.has=function(t){return mt(this,t).has(t)},ot.prototype.set=function(t,e){var n=mt(this,t),r=n.size;return n.set(t,e),this.size+=n.size==r?0:1,this},at.prototype.clear=function(){this.__data__=new it,this.size=0},at.prototype.delete=function(t){var e=this.__data__,n=e.delete(t);return this.size=e.size,n},at.prototype.get=function(t){return this.__data__.get(t)},at.prototype.has=function(t){return this.__data__.has(t)},at.prototype.set=function(t,e){var r=this.__data__;if(r instanceof it){var i=r.__data__;if(!tt||i.length<n-1)return i.push([t,e]),this.size=++r.size,this;r=this.__data__=new ot(i)}return r.set(t,e),this.size=r.size,this};var ht,vt=function(t,e,n){for(var r=-1,i=Object(t),o=n(t),a=o.length;a--;){var u=o[ht?a:++r];if(!1===e(i[u],u,i))break}return t};function pt(t){return null==t?void 0===t?p:f:W&&W in Object(t)?function(t){var e=J.call(t,W),n=t[W];try{t[W]=void 0;var r=!0}catch(t){}var i=M.call(t);r&&(e?t[W]=n:delete t[W]);return i}(t):function(t){return M.call(t)}(t)}function dt(t){return Et(t)&&pt(t)==u}function yt(t){return!(!Ct(t)||function(t){return!!L&&L in t}(t))&&(Ft(t)?D:d).test(function(t){if(null!=t){try{return N.call(t)}catch(t){}try{return t+""}catch(t){}}return""}(t))}function gt(t){if(!Ct(t))return function(t){var e=[];if(null!=t)for(var n in Object(t))e.push(n);return e}(t);var e=Ot(t),n=[];for(var r in t)("constructor"!=r||!e&&J.call(t,r))&&n.push(r);return n}function bt(t,e,n,r,i){t!==e&&vt(e,(function(o,a){if(i||(i=new at),Ct(o))!function(t,e,n,r,i,o,a){var u=St(t,n),c=St(e,n),s=a.get(c);if(s)return void ct(t,n,s);var l=o?o(u,c,n+"",t,e,a):void 0,f=void 0===l;if(f){var v=xt(c),p=!v&&kt(c),d=!v&&!p&&Nt(c);l=c,v||p||d?xt(u)?l=u:Et(m=u)&&Tt(m)?l=function(t,e){var n=-1,r=t.length;e||(e=Array(r));for(;++n<r;)e[n]=t[n];return e}(u):p?(f=!1,l=function(t,e){if(e)return t.slice();var n=t.length,r=G?G(n):new t.constructor(n);return t.copy(r),r}(c,!0)):d?(f=!1,y=c,g=!0?(b=y.buffer,_=new b.constructor(b.byteLength),new B(_).set(new B(b)),_):y.buffer,l=new y.constructor(g,y.byteOffset,y.length)):l=[]:function(t){if(!Et(t)||pt(t)!=h)return!1;var e=q(t);if(null===e)return!0;var n=J.call(e,"constructor")&&e.constructor;return"function"==typeof n&&n instanceof n&&N.call(n)==R}(c)||It(c)?(l=u,It(u)?l=function(t){return function(t,e,n,r){var i=!n;n||(n={});var o=-1,a=e.length;for(;++o<a;){var u=e[o],c=r?r(n[u],t[u],u,n,t):void 0;void 0===c&&(c=t[u]),i?ft(n,u,c):st(n,u,c)}return n}(t,Jt(t))}(u):Ct(u)&&!Ft(u)||(l=function(t){return"function"!=typeof t.constructor||Ot(t)?{}:nt(q(t))}(c))):f=!1}var y,g,b,_;var m;f&&(a.set(c,l),i(l,c,r,o,a),a.delete(c));ct(t,n,l)}(t,e,a,n,bt,r,i);else{var u=r?r(St(t,a),o,a+"",t,e,i):void 0;void 0===u&&(u=o),ct(t,a,u)}}),Jt)}function _t(t,e){return Pt(function(t,e,n){return e=Y(void 0===e?t.length-1:e,0),function(){for(var r=arguments,i=-1,o=Y(r.length-e,0),a=Array(o);++i<o;)a[i]=r[e+i];i=-1;for(var u=Array(e+1);++i<e;)u[i]=r[i];return u[e]=n(a),I(t,this,u)}}(t,e,Rt),t+"")}function mt(t,e){var n,r,i=t.__data__;return("string"==(r=typeof(n=e))||"number"==r||"symbol"==r||"boolean"==r?"__proto__"!==n:null===n)?i["string"==typeof e?"string":"hash"]:i.map}function jt(t,e){var n=function(t,e){return null==t?void 0:t[e]}(t,e);return yt(n)?n:void 0}function wt(t,e){var n=typeof t;return!!(e=null==e?a:e)&&("number"==n||"symbol"!=n&&y.test(t))&&t>-1&&t%1==0&&t<e}function Ot(t){var e=t&&t.constructor;return t===("function"==typeof e&&e.prototype||C)}function St(t,e){if(("constructor"!==e||"function"!=typeof t[e])&&"__proto__"!=e)return t[e]}var Pt=function(t){var e=0,n=0;return function(){var r=Z(),a=o-(r-n);if(n=r,a>0){if(++e>=i)return arguments[0]}else e=0;return t.apply(void 0,arguments)}}(X?function(t,e){return X(t,"toString",{configurable:!0,enumerable:!1,value:(n=e,function(){return n}),writable:!0});var n}:Rt);function At(t,e){return t===e||t!=t&&e!=e}var It=dt(function(){return arguments}())?dt:function(t){return Et(t)&&J.call(t,"callee")&&!V.call(t,"callee")},xt=Array.isArray;function Tt(t){return null!=t&&zt(t.length)&&!Ft(t)}var kt=Q||function(){return!1};function Ft(t){if(!Ct(t))return!1;var e=pt(t);return e==s||e==l||e==c||e==v}function zt(t){return"number"==typeof t&&t>-1&&t%1==0&&t<=a}function Ct(t){var e=typeof t;return null!=t&&("object"==e||"function"==e)}function Et(t){return null!=t&&"object"==typeof t}var Nt=A?function(t){return function(e){return t(e)}}(A):function(t){return Et(t)&&zt(t.length)&&!!g[pt(t)]};function Jt(t){return Tt(t)?ut(t,!0):gt(t)}var Lt,Mt=(Lt=function(t,e,n){bt(t,e,n)},_t((function(t,e){var n=-1,r=e.length,i=r>1?e[r-1]:void 0,o=r>2?e[2]:void 0;for(i=Lt.length>3&&"function"==typeof i?(r--,i):void 0,o&&function(t,e,n){if(!Ct(n))return!1;var r=typeof e;return!!("number"==r?Tt(n)&&wt(e,n.length):"string"==r&&e in n)&&At(n[e],t)}(e[0],e[1],o)&&(i=r<3?void 0:i,r=1),t=Object(t);++n<r;){var a=e[n];a&&Lt(t,a,n,i)}return t})));function Rt(t){return t}t.exports=Mt}).call(this,n(4)(t))},function(t,e){t.exports=function(t){return t.webpackPolyfill||(t.deprecate=function(){},t.paths=[],t.children||(t.children=[]),Object.defineProperty(t,"loaded",{enumerable:!0,get:function(){return t.l}}),Object.defineProperty(t,"id",{enumerable:!0,get:function(){return t.i}}),t.webpackPolyfill=1),t}},function(t,e){function n(t,e){for(var n,r=0;r<e.length;r++)(n=e[r]).enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,n.key,n)}function r(t,e,n){return e in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}var i,o,a="https://api.bullet-train.io/api/v1/",u=function(){function t(e){var n=this;(function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")})(this,t),r(this,"getJSON",(function(t,e,r){var o={method:e||"GET",body:r,headers:{"x-environment-key":n.environmentID}};return"GET"!==e&&(o.headers["Content-Type"]="application/json; charset=utf-8"),i(t,o).then((function(t){return 200<=t.status&&300>t.status?t:t.text().then((function(t){var e=t;try{e=JSON.parse(t)}catch(t){}return Promise.reject(e)}))})).then((function(t){return t.json()}))})),r(this,"getFlags",(function(t,e){var r=n.onChange,i=n.onError,o=n.identity,a=n.api,u=(n.disableCache,!1),c=function(t,e){var i=t.flags,o=t.traits,a={},u={};if(o=o||[],(i=i||[]).forEach((function(t){a[t.feature.name.toLowerCase().replace(/ /g,"_")]={enabled:t.enabled,value:t.feature_state_value}})),o.forEach((function(t){u[t.trait_key.toLowerCase().replace(/ /g,"_")]=t.trait_value})),n.oldFlags=a,n.flags=a,n.traits=u,e){var c={};e.map((function(t){c[t.name]=t})),n.segments=c}r&&r(n.oldFlags,{isFromServer:!0})};return o?Promise.all([n.getJSON(a+"identities/?identifier="+encodeURIComponent(o))]).then((function(t){c(t[0],t[1])})).catch((function(t){var e=t.message;i&&i({message:e})})):Promise.all([n.getJSON(a+"flags/")]).then((function(e){c({flags:e[0]},null),t&&!u&&(u=!0,t())})).catch((function(t){e&&!u&&(u=!0,e(t)),i&&i(t)}))})),r(this,"getValue",(function(t){var e=n.flags&&n.flags[t],r=null;return e&&(r=e.value),r})),r(this,"getTrait",(function(t){return n.traits&&n.traits[t]})),r(this,"setTrait",(function(t,e){var r=n.getJSON,i=n.identity,o=n.api;return r("".concat(o,"traits/"),"POST",JSON.stringify({identity:{identifier:i},trait_key:t,trait_value:e})).then(n.getFlags)})),r(this,"incrementTrait",(function(t,e){var r=n.getJSON,i=n.identity,o=n.api;return r("".concat(o,"traits/increment-value/"),"POST",JSON.stringify({trait_key:t,increment_by:e,identifier:i})).then(n.getFlags)})),r(this,"hasFeature",(function(t){var e=n.flags&&n.flags[t],r=!1;return e&&e.enabled&&(r=!0),r})),i=e.fetch?e.fetch:global.fetch,o=e.AsyncStorage}return function(t,e,r){e&&n(t.prototype,e),r&&n(t,r)}(t,[{key:"init",value:function(t){var e=this,n=t.environmentID,r=t.api,i=void 0===r?a:r,u=t.onChange,c=t.disableCache,s=t.onError,l=t.defaultFlags,f=t.preventFetch,h=t.state;return new Promise((function(t,r){if(e.environmentID=n,e.api=i,e.interval=null,e.disableCache=c,e.onChange=u,e.onError=s,e.flags=Object.assign({},l)||{},e.initialised=!0,e.setState(h),!n)throw r("Please specify a environment id"),"Please specify a environment id";c||o.getItem("BULLET_TRAIN_DB",(function(n,i){e.flags=i?JSON.parse(i):l,e.flags&&e.onChange&&e.onChange(null,{isFromServer:!1}),f||e.getFlags(t,r)}))}))}},{key:"getAllFlags",value:function(){return this.flags}},{key:"identify",value:function(t){this.identity=t,this.initialised&&!this.interval&&this.getFlags()}},{key:"getState",value:function(){return{api:this.api,environmentID:this.environmentID,flags:this.flags,identity:this.identity,segments:this.segments,traits:this.traits}}},{key:"setState",value:function(t){t&&(this.initialised=!0,this.api=t.api||this.api||a,this.environmentID=t.environmentID||this.environmentID,this.flags=t.flags||this.flags,this.identity=t.identity||this.identity,this.segments=t.segments||this.segments,this.traits=t.traits||this.traits)}},{key:"logout",value:function(){this.identity=null,this.segments=null,this.traits=null,this.initialised&&!this.interval&&this.getFlags()}},{key:"startListening",value:function(){var t=0<arguments.length&&void 0!==arguments[0]?arguments[0]:1e3;this.interval||(this.interval=setInterval(this.getFlags,t))}},{key:"getSegments",value:function(){}},{key:"stopListening",value:function(){clearInterval(this.interval)}}]),t}();t.exports=function(t){var e=t.fetch,n=t.AsyncStorage;return new u({fetch:e,AsyncStorage:n})}}])}));

@@ -1,2 +0,1816 @@

!function(e,t){if("object"==typeof exports&&"object"==typeof module)module.exports=t();else if("function"==typeof define&&define.amd)define([],t);else{var r=t();for(var n in r)("object"==typeof exports?exports:e)[n]=r[n]}}(this,(function(){return function(e){var t={};function r(n){if(t[n])return t[n].exports;var o=t[n]={i:n,l:!1,exports:{}};return e[n].call(o.exports,o,o.exports,r),o.l=!0,o.exports}return r.m=e,r.c=t,r.d=function(e,t,n){r.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:n})},r.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},r.t=function(e,t){if(1&t&&(e=r(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var n=Object.create(null);if(r.r(n),Object.defineProperty(n,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var o in e)r.d(n,o,function(t){return e[t]}.bind(null,o));return n},r.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return r.d(t,"a",t),t},r.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},r.p="",r(r.s=6)}([function(e,t){e.exports=require("stream")},function(e,t){e.exports=require("zlib")},function(e,t){e.exports=require("url")},function(e,t){e.exports=require("http")},function(e,t){e.exports=require("https")},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var n,o=function(e,t){if(Array.isArray(e))return e;if(Symbol.iterator in Object(e))return function(e,t){var r=[],n=!0,o=!1,i=void 0;try{for(var s,u=e[Symbol.iterator]();!(n=(s=u.next()).done)&&(r.push(s.value),!t||r.length!==t);n=!0);}catch(e){o=!0,i=e}finally{try{!n&&u.return&&u.return()}finally{if(o)throw i}}return r}(e,t);throw new TypeError("Invalid attempt to destructure non-iterable instance")},i=r(9),s=(n=i)&&n.__esModule?n:{default:n};var u={getItem:function(e,t){return u.multiGet([e]).then((function(e){return e[0][1]})).then((function(e){return t&&t(null,e),e})).catch((function(e){return t&&t(e,null),e}))},setItem:function(e,t,r){return u.multiSet([[e,t]]).then((function(e){return r&&r(null,e),e})).catch((function(e){return r&&r(e,null),e}))},getAllKeys:function(e){return Promise.resolve(Object.keys(localStorage)).then((function(t){return e&&e(null,t),t})).catch((function(t){return e&&e(t,null),t}))},removeItem:function(e,t){return u.multiRemove([e]).then((function(){t&&t(null)})).catch((function(e){t&&t(e,null)}))},clear:function(){return new Promise((function(e){window.localStorage.clear(),e()}))},mergeItem:function(e,t){return u.multiMerge([[e,t]])},multiGet:function(e){return new Promise((function(t){t(e.reduce((function(e,t){return e.concat([[t,localStorage.getItem(t)]])}),[]))}))},multiSet:function(e){return new Promise((function(t,r){var n=[];return e.forEach((function(e){var t=o(e,2),r=t[0],i=t[1];try{localStorage.setItem(r,i)}catch(e){n.push(e)}})),n.length>0?r(n):t()}))},multiMerge:function(e){return new Promise((function(t,r){var n=[];return e.forEach((function(e){var t=o(e,2),r=t[0],i=t[1],u=localStorage.getItem(r);if(u)try{localStorage.setItem(r,JSON.stringify((0,s.default)(JSON.parse(u),JSON.parse(i))))}catch(e){n.push(e)}})),n.length>0?r(n):t()}))},multiRemove:function(e){return new Promise((function(t){e.forEach((function(e){return window.localStorage.removeItem(e)})),t()}))},flushGetRequests:function(){console.warn("AsyncStorage.flushGetRequests: Not supported on `web`")}};t.default=u},function(e,t,r){"use strict";r.r(t);var n=r(5),o=r.n(n),i=r(7).default;"undefined"==typeof window&&(i=r(8).default);var s=r(11)({AsyncStorage:o.a,fetch:i});"undefined"!=typeof window&&(window.bulletTrain=s),t.default=s},function(e,t,r){"use strict";r.r(t),t.default=function(e,t){return t=t||{},new Promise((function(r,n){var o=new XMLHttpRequest,i=[],s=[],u={},a=function(){return{ok:2==(o.status/100|0),statusText:o.statusText,status:o.status,url:o.responseURL,text:function(){return Promise.resolve(o.responseText)},json:function(){return Promise.resolve(JSON.parse(o.responseText))},blob:function(){return Promise.resolve(new Blob([o.response]))},clone:a,headers:{keys:function(){return i},entries:function(){return s},get:function(e){return u[e.toLowerCase()]},has:function(e){return e.toLowerCase()in u}}}};for(var c in o.open(t.method||"get",e,!0),o.onload=function(){o.getAllResponseHeaders().replace(/^(.*?):[^\S\n]*([\s\S]*?)$/gm,(function(e,t,r){i.push(t=t.toLowerCase()),s.push([t,r]),u[t]=u[t]?u[t]+","+r:r})),r(a())},o.onerror=n,o.withCredentials="include"==t.credentials,t.headers)o.setRequestHeader(c,t.headers[c]);o.send(t.body||null)}))}},function(e,t,r){"use strict";r.r(t),r.d(t,"Headers",(function(){return A})),r.d(t,"Request",(function(){return M})),r.d(t,"Response",(function(){return R})),r.d(t,"FetchError",(function(){return h}));var n=r(0),o=r(3),i=r(2),s=r(4),u=r(1);const a=n.Readable,c=Symbol("buffer"),l=Symbol("type");class f{constructor(){this[l]="";const e=arguments[0],t=arguments[1],r=[];let n=0;if(e){const t=e,o=Number(t.length);for(let e=0;e<o;e++){const o=t[e];let i;n+=(i=o instanceof Buffer?o:ArrayBuffer.isView(o)?Buffer.from(o.buffer,o.byteOffset,o.byteLength):o instanceof ArrayBuffer?Buffer.from(o):o instanceof f?o[c]:Buffer.from("string"==typeof o?o:String(o))).length,r.push(i)}}this[c]=Buffer.concat(r);let o=t&&void 0!==t.type&&String(t.type).toLowerCase();o&&!/[^\u0020-\u007E]/.test(o)&&(this[l]=o)}get size(){return this[c].length}get type(){return this[l]}text(){return Promise.resolve(this[c].toString())}arrayBuffer(){const e=this[c],t=e.buffer.slice(e.byteOffset,e.byteOffset+e.byteLength);return Promise.resolve(t)}stream(){const e=new a;return e._read=function(){},e.push(this[c]),e.push(null),e}toString(){return"[object Blob]"}slice(){const e=this.size,t=arguments[0],r=arguments[1];let n,o;n=void 0===t?0:t<0?Math.max(e+t,0):Math.min(t,e),o=void 0===r?e:r<0?Math.max(e+r,0):Math.min(r,e);const i=Math.max(o-n,0),s=this[c].slice(n,n+i),u=new f([],{type:arguments[2]});return u[c]=s,u}}function h(e,t,r){Error.call(this,e),this.message=e,this.type=t,r&&(this.code=this.errno=r.code),Error.captureStackTrace(this,this.constructor)}let p;Object.defineProperties(f.prototype,{size:{enumerable:!0},type:{enumerable:!0},slice:{enumerable:!0}}),Object.defineProperty(f.prototype,Symbol.toStringTag,{value:"Blob",writable:!1,enumerable:!1,configurable:!0}),h.prototype=Object.create(Error.prototype),h.prototype.constructor=h,h.prototype.name="FetchError";try{p=require("encoding").convert}catch(e){}const d=Symbol("Body internals"),y=n.PassThrough;function b(e){var t=this,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},o=r.size;let i=void 0===o?0:o;var s=r.timeout;let u=void 0===s?0:s;null==e?e=null:m(e)?e=Buffer.from(e.toString()):v(e)||Buffer.isBuffer(e)||("[object ArrayBuffer]"===Object.prototype.toString.call(e)?e=Buffer.from(e):ArrayBuffer.isView(e)?e=Buffer.from(e.buffer,e.byteOffset,e.byteLength):e instanceof n||(e=Buffer.from(String(e)))),this[d]={body:e,disturbed:!1,error:null},this.size=i,this.timeout=u,e instanceof n&&e.on("error",(function(e){const r="AbortError"===e.name?e:new h(`Invalid response body while trying to fetch ${t.url}: ${e.message}`,"system",e);t[d].error=r}))}function g(){var e=this;if(this[d].disturbed)return b.Promise.reject(new TypeError(`body used already for: ${this.url}`));if(this[d].disturbed=!0,this[d].error)return b.Promise.reject(this[d].error);let t=this.body;if(null===t)return b.Promise.resolve(Buffer.alloc(0));if(v(t)&&(t=t.stream()),Buffer.isBuffer(t))return b.Promise.resolve(t);if(!(t instanceof n))return b.Promise.resolve(Buffer.alloc(0));let r=[],o=0,i=!1;return new b.Promise((function(n,s){let u;e.timeout&&(u=setTimeout((function(){i=!0,s(new h(`Response timeout while trying to fetch ${e.url} (over ${e.timeout}ms)`,"body-timeout"))}),e.timeout)),t.on("error",(function(t){"AbortError"===t.name?(i=!0,s(t)):s(new h(`Invalid response body while trying to fetch ${e.url}: ${t.message}`,"system",t))})),t.on("data",(function(t){if(!i&&null!==t){if(e.size&&o+t.length>e.size)return i=!0,void s(new h(`content size at ${e.url} over limit: ${e.size}`,"max-size"));o+=t.length,r.push(t)}})),t.on("end",(function(){if(!i){clearTimeout(u);try{n(Buffer.concat(r,o))}catch(t){s(new h(`Could not create Buffer from response body for ${e.url}: ${t.message}`,"system",t))}}}))}))}function m(e){return"object"==typeof e&&"function"==typeof e.append&&"function"==typeof e.delete&&"function"==typeof e.get&&"function"==typeof e.getAll&&"function"==typeof e.has&&"function"==typeof e.set&&("URLSearchParams"===e.constructor.name||"[object URLSearchParams]"===Object.prototype.toString.call(e)||"function"==typeof e.sort)}function v(e){return"object"==typeof e&&"function"==typeof e.arrayBuffer&&"string"==typeof e.type&&"function"==typeof e.stream&&"function"==typeof e.constructor&&"string"==typeof e.constructor.name&&/^(Blob|File)$/.test(e.constructor.name)&&/^(Blob|File)$/.test(e[Symbol.toStringTag])}function w(e){let t,r,o=e.body;if(e.bodyUsed)throw new Error("cannot clone body after it is used");return o instanceof n&&"function"!=typeof o.getBoundary&&(t=new y,r=new y,o.pipe(t),o.pipe(r),e[d].body=t,o=r),o}function _(e){return null===e?null:"string"==typeof e?"text/plain;charset=UTF-8":m(e)?"application/x-www-form-urlencoded;charset=UTF-8":v(e)?e.type||null:Buffer.isBuffer(e)?null:"[object ArrayBuffer]"===Object.prototype.toString.call(e)?null:ArrayBuffer.isView(e)?null:"function"==typeof e.getBoundary?`multipart/form-data;boundary=${e.getBoundary()}`:e instanceof n?null:"text/plain;charset=UTF-8"}function j(e){const t=e.body;return null===t?0:v(t)?t.size:Buffer.isBuffer(t)?t.length:t&&"function"==typeof t.getLengthSync&&(t._lengthRetrievers&&0==t._lengthRetrievers.length||t.hasKnownLength&&t.hasKnownLength())?t.getLengthSync():null}b.prototype={get body(){return this[d].body},get bodyUsed(){return this[d].disturbed},arrayBuffer(){return g.call(this).then((function(e){return e.buffer.slice(e.byteOffset,e.byteOffset+e.byteLength)}))},blob(){let e=this.headers&&this.headers.get("content-type")||"";return g.call(this).then((function(t){return Object.assign(new f([],{type:e.toLowerCase()}),{[c]:t})}))},json(){var e=this;return g.call(this).then((function(t){try{return JSON.parse(t.toString())}catch(t){return b.Promise.reject(new h(`invalid json response body at ${e.url} reason: ${t.message}`,"invalid-json"))}}))},text(){return g.call(this).then((function(e){return e.toString()}))},buffer(){return g.call(this)},textConverted(){var e=this;return g.call(this).then((function(t){return function(e,t){if("function"!=typeof p)throw new Error("The package `encoding` must be installed to use the textConverted() function");const r=t.get("content-type");let n,o,i="utf-8";r&&(n=/charset=([^;]*)/i.exec(r));o=e.slice(0,1024).toString(),!n&&o&&(n=/<meta.+?charset=(['"])(.+?)\1/i.exec(o));!n&&o&&(n=/<meta[\s]+?http-equiv=(['"])content-type\1[\s]+?content=(['"])(.+?)\2/i.exec(o))&&(n=/charset=(.*)/i.exec(n.pop()));!n&&o&&(n=/<\?xml.+?encoding=(['"])(.+?)\1/i.exec(o));n&&("gb2312"!==(i=n.pop())&&"gbk"!==i||(i="gb18030"));return p(e,"UTF-8",i).toString()}(t,e.headers)}))}},Object.defineProperties(b.prototype,{body:{enumerable:!0},bodyUsed:{enumerable:!0},arrayBuffer:{enumerable:!0},blob:{enumerable:!0},json:{enumerable:!0},text:{enumerable:!0}}),b.mixIn=function(e){for(const t of Object.getOwnPropertyNames(b.prototype))if(!(t in e)){const r=Object.getOwnPropertyDescriptor(b.prototype,t);Object.defineProperty(e,t,r)}},b.Promise=global.Promise;const S=/[^\^_`a-zA-Z\-0-9!#$%&'*+.|~]/,O=/[^\t\x20-\x7e\x80-\xff]/;function T(e){if(e=`${e}`,S.test(e)||""===e)throw new TypeError(`${e} is not a legal HTTP header name`)}function P(e){if(e=`${e}`,O.test(e))throw new TypeError(`${e} is not a legal HTTP header value`)}function x(e,t){t=t.toLowerCase();for(const r in e)if(r.toLowerCase()===t)return r}const E=Symbol("map");class A{constructor(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:void 0;if(this[E]=Object.create(null),e instanceof A){const t=e.raw(),r=Object.keys(t);for(const e of r)for(const r of t[e])this.append(e,r)}else if(null==e);else{if("object"!=typeof e)throw new TypeError("Provided initializer must be an object");{const t=e[Symbol.iterator];if(null!=t){if("function"!=typeof t)throw new TypeError("Header pairs must be iterable");const r=[];for(const t of e){if("object"!=typeof t||"function"!=typeof t[Symbol.iterator])throw new TypeError("Each header pair must be iterable");r.push(Array.from(t))}for(const e of r){if(2!==e.length)throw new TypeError("Each header pair must be a name/value tuple");this.append(e[0],e[1])}}else for(const t of Object.keys(e)){const r=e[t];this.append(t,r)}}}}get(e){T(e=`${e}`);const t=x(this[E],e);return void 0===t?null:this[E][t].join(", ")}forEach(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:void 0,r=B(this),n=0;for(;n<r.length;){var o=r[n];const i=o[0],s=o[1];e.call(t,s,i,this),r=B(this),n++}}set(e,t){t=`${t}`,T(e=`${e}`),P(t);const r=x(this[E],e);this[E][void 0!==r?r:e]=[t]}append(e,t){t=`${t}`,T(e=`${e}`),P(t);const r=x(this[E],e);void 0!==r?this[E][r].push(t):this[E][e]=[t]}has(e){return T(e=`${e}`),void 0!==x(this[E],e)}delete(e){T(e=`${e}`);const t=x(this[E],e);void 0!==t&&delete this[E][t]}raw(){return this[E]}keys(){return k(this,"key")}values(){return k(this,"value")}[Symbol.iterator](){return k(this,"key+value")}}function B(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"key+value";return Object.keys(e[E]).sort().map("key"===t?function(e){return e.toLowerCase()}:"value"===t?function(t){return e[E][t].join(", ")}:function(t){return[t.toLowerCase(),e[E][t].join(", ")]})}A.prototype.entries=A.prototype[Symbol.iterator],Object.defineProperty(A.prototype,Symbol.toStringTag,{value:"Headers",writable:!1,enumerable:!1,configurable:!0}),Object.defineProperties(A.prototype,{get:{enumerable:!0},forEach:{enumerable:!0},set:{enumerable:!0},append:{enumerable:!0},has:{enumerable:!0},delete:{enumerable:!0},keys:{enumerable:!0},values:{enumerable:!0},entries:{enumerable:!0}});const C=Symbol("internal");function k(e,t){const r=Object.create($);return r[C]={target:e,kind:t,index:0},r}const $=Object.setPrototypeOf({next(){if(!this||Object.getPrototypeOf(this)!==$)throw new TypeError("Value of `this` is not a HeadersIterator");var e=this[C];const t=e.target,r=e.kind,n=e.index,o=B(t,r);return n>=o.length?{value:void 0,done:!0}:(this[C].index=n+1,{value:o[n],done:!1})}},Object.getPrototypeOf(Object.getPrototypeOf([][Symbol.iterator]())));function z(e){const t=Object.assign({__proto__:null},e[E]),r=x(e[E],"Host");return void 0!==r&&(t[r]=t[r][0]),t}Object.defineProperty($,Symbol.toStringTag,{value:"HeadersIterator",writable:!1,enumerable:!1,configurable:!0});const L=Symbol("Response internals"),I=o.STATUS_CODES;class R{constructor(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:null,t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};b.call(this,e,t);const r=t.status||200,n=new A(t.headers);if(null!=e&&!n.has("Content-Type")){const t=_(e);t&&n.append("Content-Type",t)}this[L]={url:t.url,status:r,statusText:t.statusText||I[r],headers:n,counter:t.counter}}get url(){return this[L].url||""}get status(){return this[L].status}get ok(){return this[L].status>=200&&this[L].status<300}get redirected(){return this[L].counter>0}get statusText(){return this[L].statusText}get headers(){return this[L].headers}clone(){return new R(w(this),{url:this.url,status:this.status,statusText:this.statusText,headers:this.headers,ok:this.ok,redirected:this.redirected})}}b.mixIn(R.prototype),Object.defineProperties(R.prototype,{url:{enumerable:!0},status:{enumerable:!0},ok:{enumerable:!0},redirected:{enumerable:!0},statusText:{enumerable:!0},headers:{enumerable:!0},clone:{enumerable:!0}}),Object.defineProperty(R.prototype,Symbol.toStringTag,{value:"Response",writable:!1,enumerable:!1,configurable:!0});const F=Symbol("Request internals"),U=i.parse,N=i.format,q="destroy"in n.Readable.prototype;function D(e){return"object"==typeof e&&"object"==typeof e[F]}class M{constructor(e){let t,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};D(e)?t=U(e.url):(t=e&&e.href?U(e.href):U(`${e}`),e={});let n=r.method||e.method||"GET";if(n=n.toUpperCase(),(null!=r.body||D(e)&&null!==e.body)&&("GET"===n||"HEAD"===n))throw new TypeError("Request with GET/HEAD method cannot have body");let o=null!=r.body?r.body:D(e)&&null!==e.body?w(e):null;b.call(this,o,{timeout:r.timeout||e.timeout||0,size:r.size||e.size||0});const i=new A(r.headers||e.headers||{});if(null!=o&&!i.has("Content-Type")){const e=_(o);e&&i.append("Content-Type",e)}let s=D(e)?e.signal:null;if("signal"in r&&(s=r.signal),null!=s&&!function(e){const t=e&&"object"==typeof e&&Object.getPrototypeOf(e);return!(!t||"AbortSignal"!==t.constructor.name)}(s))throw new TypeError("Expected signal to be an instanceof AbortSignal");this[F]={method:n,redirect:r.redirect||e.redirect||"follow",headers:i,parsedURL:t,signal:s},this.follow=void 0!==r.follow?r.follow:void 0!==e.follow?e.follow:20,this.compress=void 0!==r.compress?r.compress:void 0===e.compress||e.compress,this.counter=r.counter||e.counter||0,this.agent=r.agent||e.agent}get method(){return this[F].method}get url(){return N(this[F].parsedURL)}get headers(){return this[F].headers}get redirect(){return this[F].redirect}get signal(){return this[F].signal}clone(){return new M(this)}}function H(e){Error.call(this,e),this.type="aborted",this.message=e,Error.captureStackTrace(this,this.constructor)}b.mixIn(M.prototype),Object.defineProperty(M.prototype,Symbol.toStringTag,{value:"Request",writable:!1,enumerable:!1,configurable:!0}),Object.defineProperties(M.prototype,{method:{enumerable:!0},url:{enumerable:!0},headers:{enumerable:!0},redirect:{enumerable:!0},clone:{enumerable:!0},signal:{enumerable:!0}}),H.prototype=Object.create(Error.prototype),H.prototype.constructor=H,H.prototype.name="AbortError";const J=n.PassThrough,G=i.resolve;function V(e,t){if(!V.Promise)throw new Error("native promise missing, set fetch.Promise to your favorite alternative");return b.Promise=V.Promise,new V.Promise((function(r,i){const a=new M(e,t),c=function(e){const t=e[F].parsedURL,r=new A(e[F].headers);if(r.has("Accept")||r.set("Accept","*/*"),!t.protocol||!t.hostname)throw new TypeError("Only absolute URLs are supported");if(!/^https?:$/.test(t.protocol))throw new TypeError("Only HTTP(S) protocols are supported");if(e.signal&&e.body instanceof n.Readable&&!q)throw new Error("Cancellation of streamed requests with AbortSignal is not supported in node < 8");let o=null;if(null==e.body&&/^(POST|PUT)$/i.test(e.method)&&(o="0"),null!=e.body){const t=j(e);"number"==typeof t&&(o=String(t))}o&&r.set("Content-Length",o),r.has("User-Agent")||r.set("User-Agent","node-fetch/1.0 (+https://github.com/bitinn/node-fetch)"),e.compress&&!r.has("Accept-Encoding")&&r.set("Accept-Encoding","gzip,deflate");let i=e.agent;return"function"==typeof i&&(i=i(t)),r.has("Connection")||i||r.set("Connection","close"),Object.assign({},t,{method:e.method,headers:z(r),agent:i})}(a),l=("https:"===c.protocol?s:o).request,f=a.signal;let p=null;const d=function(){let e=new H("The user aborted a request.");i(e),a.body&&a.body instanceof n.Readable&&a.body.destroy(e),p&&p.body&&p.body.emit("error",e)};if(f&&f.aborted)return void d();const y=function(){d(),m()},b=l(c);let g;function m(){b.abort(),f&&f.removeEventListener("abort",y),clearTimeout(g)}f&&f.addEventListener("abort",y),a.timeout&&b.once("socket",(function(e){g=setTimeout((function(){i(new h(`network timeout at: ${a.url}`,"request-timeout")),m()}),a.timeout)})),b.on("error",(function(e){i(new h(`request to ${a.url} failed, reason: ${e.message}`,"system",e)),m()})),b.on("response",(function(e){clearTimeout(g);const t=function(e){const t=new A;for(const r of Object.keys(e))if(!S.test(r))if(Array.isArray(e[r]))for(const n of e[r])O.test(n)||(void 0===t[E][r]?t[E][r]=[n]:t[E][r].push(n));else O.test(e[r])||(t[E][r]=[e[r]]);return t}(e.headers);if(V.isRedirect(e.statusCode)){const n=t.get("Location"),o=null===n?null:G(a.url,n);switch(a.redirect){case"error":return i(new h(`redirect mode is set to error: ${a.url}`,"no-redirect")),void m();case"manual":if(null!==o)try{t.set("Location",o)}catch(e){i(e)}break;case"follow":if(null===o)break;if(a.counter>=a.follow)return i(new h(`maximum redirect reached at: ${a.url}`,"max-redirect")),void m();const n={headers:new A(a.headers),follow:a.follow,counter:a.counter+1,agent:a.agent,compress:a.compress,method:a.method,body:a.body,signal:a.signal,timeout:a.timeout};return 303!==e.statusCode&&a.body&&null===j(a)?(i(new h("Cannot follow redirect with body being a readable stream","unsupported-redirect")),void m()):(303!==e.statusCode&&(301!==e.statusCode&&302!==e.statusCode||"POST"!==a.method)||(n.method="GET",n.body=void 0,n.headers.delete("content-length")),r(V(new M(o,n))),void m())}}e.once("end",(function(){f&&f.removeEventListener("abort",y)}));let n=e.pipe(new J);const o={url:a.url,status:e.statusCode,statusText:e.statusMessage,headers:t,size:a.size,timeout:a.timeout,counter:a.counter},s=t.get("Content-Encoding");if(!a.compress||"HEAD"===a.method||null===s||204===e.statusCode||304===e.statusCode)return p=new R(n,o),void r(p);const c={flush:u.Z_SYNC_FLUSH,finishFlush:u.Z_SYNC_FLUSH};if("gzip"==s||"x-gzip"==s)return n=n.pipe(u.createGunzip(c)),p=new R(n,o),void r(p);if("deflate"!=s&&"x-deflate"!=s){if("br"==s&&"function"==typeof u.createBrotliDecompress)return n=n.pipe(u.createBrotliDecompress()),p=new R(n,o),void r(p);p=new R(n,o),r(p)}else{e.pipe(new J).once("data",(function(e){n=8==(15&e[0])?n.pipe(u.createInflate()):n.pipe(u.createInflateRaw()),p=new R(n,o),r(p)}))}})),function(e,t){const r=t.body;null===r?e.end():v(r)?r.stream().pipe(e):Buffer.isBuffer(r)?(e.write(r),e.end()):r.pipe(e)}(b,a)}))}V.isRedirect=function(e){return 301===e||302===e||303===e||307===e||308===e},V.Promise=global.Promise,t.default=V},function(e,t,r){(function(e){var r=200,n="__lodash_hash_undefined__",o=800,i=16,s=9007199254740991,u="[object Arguments]",a="[object AsyncFunction]",c="[object Function]",l="[object GeneratorFunction]",f="[object Null]",h="[object Object]",p="[object Proxy]",d="[object Undefined]",y=/^\[object .+?Constructor\]$/,b=/^(?:0|[1-9]\d*)$/,g={};g["[object Float32Array]"]=g["[object Float64Array]"]=g["[object Int8Array]"]=g["[object Int16Array]"]=g["[object Int32Array]"]=g["[object Uint8Array]"]=g["[object Uint8ClampedArray]"]=g["[object Uint16Array]"]=g["[object Uint32Array]"]=!0,g[u]=g["[object Array]"]=g["[object ArrayBuffer]"]=g["[object Boolean]"]=g["[object DataView]"]=g["[object Date]"]=g["[object Error]"]=g[c]=g["[object Map]"]=g["[object Number]"]=g[h]=g["[object RegExp]"]=g["[object Set]"]=g["[object String]"]=g["[object WeakMap]"]=!1;var m="object"==typeof global&&global&&global.Object===Object&&global,v="object"==typeof self&&self&&self.Object===Object&&self,w=m||v||Function("return this")(),_=t&&!t.nodeType&&t,j=_&&"object"==typeof e&&e&&!e.nodeType&&e,S=j&&j.exports===_,O=S&&m.process,T=function(){try{return O&&O.binding&&O.binding("util")}catch(e){}}(),P=T&&T.isTypedArray;function x(e,t,r){switch(r.length){case 0:return e.call(t);case 1:return e.call(t,r[0]);case 2:return e.call(t,r[0],r[1]);case 3:return e.call(t,r[0],r[1],r[2])}return e.apply(t,r)}function E(e,t){return"__proto__"==t?void 0:e[t]}var A,B,C,k=Array.prototype,$=Function.prototype,z=Object.prototype,L=w["__core-js_shared__"],I=$.toString,R=z.hasOwnProperty,F=(A=/[^.]+$/.exec(L&&L.keys&&L.keys.IE_PROTO||""))?"Symbol(src)_1."+A:"",U=z.toString,N=I.call(Object),q=RegExp("^"+I.call(R).replace(/[\\^$.*+?()[\]{}|]/g,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),D=S?w.Buffer:void 0,M=w.Symbol,H=w.Uint8Array,J=D?D.allocUnsafe:void 0,G=(B=Object.getPrototypeOf,C=Object,function(e){return B(C(e))}),V=Object.create,K=z.propertyIsEnumerable,Z=k.splice,Y=M?M.toStringTag:void 0,W=function(){try{var e=je(Object,"defineProperty");return e({},"",{}),e}catch(e){}}(),X=D?D.isBuffer:void 0,Q=Math.max,ee=Date.now,te=je(w,"Map"),re=je(Object,"create"),ne=function(){function e(){}return function(t){if(!$e(t))return{};if(V)return V(t);e.prototype=t;var r=new e;return e.prototype=void 0,r}}();function oe(e){var t=-1,r=null==e?0:e.length;for(this.clear();++t<r;){var n=e[t];this.set(n[0],n[1])}}function ie(e){var t=-1,r=null==e?0:e.length;for(this.clear();++t<r;){var n=e[t];this.set(n[0],n[1])}}function se(e){var t=-1,r=null==e?0:e.length;for(this.clear();++t<r;){var n=e[t];this.set(n[0],n[1])}}function ue(e){var t=this.__data__=new ie(e);this.size=t.size}function ae(e,t){var r=Ee(e),n=!r&&xe(e),o=!r&&!n&&Be(e),i=!r&&!n&&!o&&Le(e),s=r||n||o||i,u=s?function(e,t){for(var r=-1,n=Array(e);++r<e;)n[r]=t(r);return n}(e.length,String):[],a=u.length;for(var c in e)!t&&!R.call(e,c)||s&&("length"==c||o&&("offset"==c||"parent"==c)||i&&("buffer"==c||"byteLength"==c||"byteOffset"==c)||Se(c,a))||u.push(c);return u}function ce(e,t,r){(void 0===r||Pe(e[t],r))&&(void 0!==r||t in e)||he(e,t,r)}function le(e,t,r){var n=e[t];R.call(e,t)&&Pe(n,r)&&(void 0!==r||t in e)||he(e,t,r)}function fe(e,t){for(var r=e.length;r--;)if(Pe(e[r][0],t))return r;return-1}function he(e,t,r){"__proto__"==t&&W?W(e,t,{configurable:!0,enumerable:!0,value:r,writable:!0}):e[t]=r}oe.prototype.clear=function(){this.__data__=re?re(null):{},this.size=0},oe.prototype.delete=function(e){var t=this.has(e)&&delete this.__data__[e];return this.size-=t?1:0,t},oe.prototype.get=function(e){var t=this.__data__;if(re){var r=t[e];return r===n?void 0:r}return R.call(t,e)?t[e]:void 0},oe.prototype.has=function(e){var t=this.__data__;return re?void 0!==t[e]:R.call(t,e)},oe.prototype.set=function(e,t){var r=this.__data__;return this.size+=this.has(e)?0:1,r[e]=re&&void 0===t?n:t,this},ie.prototype.clear=function(){this.__data__=[],this.size=0},ie.prototype.delete=function(e){var t=this.__data__,r=fe(t,e);return!(r<0)&&(r==t.length-1?t.pop():Z.call(t,r,1),--this.size,!0)},ie.prototype.get=function(e){var t=this.__data__,r=fe(t,e);return r<0?void 0:t[r][1]},ie.prototype.has=function(e){return fe(this.__data__,e)>-1},ie.prototype.set=function(e,t){var r=this.__data__,n=fe(r,e);return n<0?(++this.size,r.push([e,t])):r[n][1]=t,this},se.prototype.clear=function(){this.size=0,this.__data__={hash:new oe,map:new(te||ie),string:new oe}},se.prototype.delete=function(e){var t=_e(this,e).delete(e);return this.size-=t?1:0,t},se.prototype.get=function(e){return _e(this,e).get(e)},se.prototype.has=function(e){return _e(this,e).has(e)},se.prototype.set=function(e,t){var r=_e(this,e),n=r.size;return r.set(e,t),this.size+=r.size==n?0:1,this},ue.prototype.clear=function(){this.__data__=new ie,this.size=0},ue.prototype.delete=function(e){var t=this.__data__,r=t.delete(e);return this.size=t.size,r},ue.prototype.get=function(e){return this.__data__.get(e)},ue.prototype.has=function(e){return this.__data__.has(e)},ue.prototype.set=function(e,t){var n=this.__data__;if(n instanceof ie){var o=n.__data__;if(!te||o.length<r-1)return o.push([e,t]),this.size=++n.size,this;n=this.__data__=new se(o)}return n.set(e,t),this.size=n.size,this};var pe,de=function(e,t,r){for(var n=-1,o=Object(e),i=r(e),s=i.length;s--;){var u=i[pe?s:++n];if(!1===t(o[u],u,o))break}return e};function ye(e){return null==e?void 0===e?d:f:Y&&Y in Object(e)?function(e){var t=R.call(e,Y),r=e[Y];try{e[Y]=void 0;var n=!0}catch(e){}var o=U.call(e);n&&(t?e[Y]=r:delete e[Y]);return o}(e):function(e){return U.call(e)}(e)}function be(e){return ze(e)&&ye(e)==u}function ge(e){return!(!$e(e)||function(e){return!!F&&F in e}(e))&&(Ce(e)?q:y).test(function(e){if(null!=e){try{return I.call(e)}catch(e){}try{return e+""}catch(e){}}return""}(e))}function me(e){if(!$e(e))return function(e){var t=[];if(null!=e)for(var r in Object(e))t.push(r);return t}(e);var t=Oe(e),r=[];for(var n in e)("constructor"!=n||!t&&R.call(e,n))&&r.push(n);return r}function ve(e,t,r,n,o){e!==t&&de(t,(function(i,s){if($e(i))o||(o=new ue),function(e,t,r,n,o,i,s){var u=E(e,r),a=E(t,r),c=s.get(a);if(c)return void ce(e,r,c);var l=i?i(u,a,r+"",e,t,s):void 0,f=void 0===l;if(f){var p=Ee(a),d=!p&&Be(a),y=!p&&!d&&Le(a);l=a,p||d||y?Ee(u)?l=u:ze(w=u)&&Ae(w)?l=function(e,t){var r=-1,n=e.length;t||(t=Array(n));for(;++r<n;)t[r]=e[r];return t}(u):d?(f=!1,l=function(e,t){if(t)return e.slice();var r=e.length,n=J?J(r):new e.constructor(r);return e.copy(n),n}(a,!0)):y?(f=!1,b=a,g=!0?(m=b.buffer,v=new m.constructor(m.byteLength),new H(v).set(new H(m)),v):b.buffer,l=new b.constructor(g,b.byteOffset,b.length)):l=[]:function(e){if(!ze(e)||ye(e)!=h)return!1;var t=G(e);if(null===t)return!0;var r=R.call(t,"constructor")&&t.constructor;return"function"==typeof r&&r instanceof r&&I.call(r)==N}(a)||xe(a)?(l=u,xe(u)?l=function(e){return function(e,t,r,n){var o=!r;r||(r={});var i=-1,s=t.length;for(;++i<s;){var u=t[i],a=n?n(r[u],e[u],u,r,e):void 0;void 0===a&&(a=e[u]),o?he(r,u,a):le(r,u,a)}return r}(e,Ie(e))}(u):(!$e(u)||n&&Ce(u))&&(l=function(e){return"function"!=typeof e.constructor||Oe(e)?{}:ne(G(e))}(a))):f=!1}var b,g,m,v;var w;f&&(s.set(a,l),o(l,a,n,i,s),s.delete(a));ce(e,r,l)}(e,t,s,r,ve,n,o);else{var u=n?n(E(e,s),i,s+"",e,t,o):void 0;void 0===u&&(u=i),ce(e,s,u)}}),Ie)}function we(e,t){return Te(function(e,t,r){return t=Q(void 0===t?e.length-1:t,0),function(){for(var n=arguments,o=-1,i=Q(n.length-t,0),s=Array(i);++o<i;)s[o]=n[t+o];o=-1;for(var u=Array(t+1);++o<t;)u[o]=n[o];return u[t]=r(s),x(e,this,u)}}(e,t,Ue),e+"")}function _e(e,t){var r,n,o=e.__data__;return("string"==(n=typeof(r=t))||"number"==n||"symbol"==n||"boolean"==n?"__proto__"!==r:null===r)?o["string"==typeof t?"string":"hash"]:o.map}function je(e,t){var r=function(e,t){return null==e?void 0:e[t]}(e,t);return ge(r)?r:void 0}function Se(e,t){var r=typeof e;return!!(t=null==t?s:t)&&("number"==r||"symbol"!=r&&b.test(e))&&e>-1&&e%1==0&&e<t}function Oe(e){var t=e&&e.constructor;return e===("function"==typeof t&&t.prototype||z)}var Te=function(e){var t=0,r=0;return function(){var n=ee(),s=i-(n-r);if(r=n,s>0){if(++t>=o)return arguments[0]}else t=0;return e.apply(void 0,arguments)}}(W?function(e,t){return W(e,"toString",{configurable:!0,enumerable:!1,value:(r=t,function(){return r}),writable:!0});var r}:Ue);function Pe(e,t){return e===t||e!=e&&t!=t}var xe=be(function(){return arguments}())?be:function(e){return ze(e)&&R.call(e,"callee")&&!K.call(e,"callee")},Ee=Array.isArray;function Ae(e){return null!=e&&ke(e.length)&&!Ce(e)}var Be=X||function(){return!1};function Ce(e){if(!$e(e))return!1;var t=ye(e);return t==c||t==l||t==a||t==p}function ke(e){return"number"==typeof e&&e>-1&&e%1==0&&e<=s}function $e(e){var t=typeof e;return null!=e&&("object"==t||"function"==t)}function ze(e){return null!=e&&"object"==typeof e}var Le=P?function(e){return function(t){return e(t)}}(P):function(e){return ze(e)&&ke(e.length)&&!!g[ye(e)]};function Ie(e){return Ae(e)?ae(e,!0):me(e)}var Re,Fe=(Re=function(e,t,r){ve(e,t,r)},we((function(e,t){var r=-1,n=t.length,o=n>1?t[n-1]:void 0,i=n>2?t[2]:void 0;for(o=Re.length>3&&"function"==typeof o?(n--,o):void 0,i&&function(e,t,r){if(!$e(r))return!1;var n=typeof t;return!!("number"==n?Ae(r)&&Se(t,r.length):"string"==n&&t in r)&&Pe(r[t],e)}(t[0],t[1],i)&&(o=n<3?void 0:o,n=1),e=Object(e);++r<n;){var s=t[r];s&&Re(e,s,r,o)}return e})));function Ue(e){return e}e.exports=Fe}).call(this,r(10)(e))},function(e,t){e.exports=function(e){return e.webpackPolyfill||(e.deprecate=function(){},e.paths=[],e.children||(e.children=[]),Object.defineProperty(e,"loaded",{enumerable:!0,get:function(){return e.l}}),Object.defineProperty(e,"id",{enumerable:!0,get:function(){return e.i}}),e.webpackPolyfill=1),e}},function(e,t){var r,n;function o(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}function i(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}var s="https://api.bullet-train.io/api/v1/",u=function(){function e(t){var o=this;!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),i(this,"getJSON",(function(e,t,n){var i={method:t||"GET",body:n,headers:{"x-environment-key":o.environmentID}};return"GET"!==t&&(i.headers["Content-Type"]="application/json; charset=utf-8"),r(e,i).then((function(e){return e.status>=200&&e.status<300?e:e.text().then((function(e){var t=e;try{t=JSON.parse(e)}catch(e){}return Promise.reject(t)}))})).then((function(e){return e.json()}))})),i(this,"getFlags",(function(e,t){var r=o.onChange,n=o.onError,i=o.identity,s=o.api,u=(o.disableCache,!1),a=function(e,t){var n=e.flags,i=e.traits,s={},u={};if(i=i||[],(n=n||[]).forEach((function(e){s[e.feature.name.toLowerCase().replace(/ /g,"_")]={enabled:e.enabled,value:e.feature_state_value}})),i.forEach((function(e){u[e.trait_key.toLowerCase().replace(/ /g,"_")]=e.trait_value})),o.oldFlags=s,o.flags=s,o.traits=u,t){var a={};t.map((function(e){a[e.name]=e})),o.segments=a}r&&r(o.oldFlags,{isFromServer:!0})};return i?Promise.all([o.getJSON(s+"identities/?identifier="+encodeURIComponent(i))]).then((function(e){a(e[0],e[1])})).catch((function(e){var t=e.message;n&&n({message:t})})):Promise.all([o.getJSON(s+"flags/")]).then((function(t){a({flags:t[0]},null),e&&!u&&(u=!0,e())})).catch((function(e){t&&!u&&(u=!0,t(e)),n&&n(e)}))})),i(this,"getValue",(function(e){var t=o.flags&&o.flags[e],r=null;return t&&(r=t.value),r})),i(this,"getTrait",(function(e){return o.traits&&o.traits[e]})),i(this,"setTrait",(function(e,t){var r=o.getJSON,n=o.identity,i=o.api,s={identity:{identifier:n},trait_key:e,trait_value:t};return r("".concat(i,"traits/"),"POST",JSON.stringify(s)).then(o.getFlags)})),i(this,"incrementTrait",(function(e,t){var r=o.getJSON,n=o.identity,i=o.api;return r("".concat(i,"traits/increment-value/"),"POST",JSON.stringify({trait_key:e,increment_by:t,identifier:n})).then(o.getFlags)})),i(this,"hasFeature",(function(e){var t=o.flags&&o.flags[e],r=!1;return t&&t.enabled&&(r=!0),r})),r=t.fetch?t.fetch:global.fetch,n=t.AsyncStorage}var t,u,a;return t=e,(u=[{key:"init",value:function(e){var t=this,r=e.environmentID,o=e.api,i=void 0===o?s:o,u=e.onChange,a=e.disableCache,c=e.onError,l=e.defaultFlags,f=e.preventFetch,h=e.state;return new Promise((function(e,o){if(t.environmentID=r,t.api=i,t.interval=null,t.disableCache=a,t.onChange=u,t.onError=c,t.flags=Object.assign({},l)||{},t.initialised=!0,t.setState(h),!r)throw o("Please specify a environment id"),"Please specify a environment id";a||n.getItem("BULLET_TRAIN_DB",(function(r,n){t.flags=n?JSON.parse(n):l,t.flags&&t.onChange&&t.onChange(null,{isFromServer:!1}),f||t.getFlags(e,o)}))}))}},{key:"getAllFlags",value:function(){return this.flags}},{key:"identify",value:function(e){this.identity=e,this.initialised&&!this.interval&&this.getFlags()}},{key:"getState",value:function(){return{api:this.api,environmentID:this.environmentID,flags:this.flags,identity:this.identity,segments:this.segments,traits:this.traits}}},{key:"setState",value:function(e){e&&(this.initialised=!0,this.api=e.api||this.api||s,this.environmentID=e.environmentID||this.environmentID,this.flags=e.flags||this.flags,this.identity=e.identity||this.identity,this.segments=e.segments||this.segments,this.traits=e.traits||this.traits)}},{key:"logout",value:function(){this.identity=null,this.segments=null,this.traits=null,this.initialised&&!this.interval&&this.getFlags()}},{key:"startListening",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:1e3;this.interval||(this.interval=setInterval(this.getFlags,e))}},{key:"getSegments",value:function(){}},{key:"stopListening",value:function(){clearInterval(this.interval)}}])&&o(t.prototype,u),a&&o(t,a),e}();e.exports=function(e){var t=e.fetch,r=e.AsyncStorage;return new u({fetch:t,AsyncStorage:r})}}])}));
//# sourceMappingURL=isomorphic.js.map
!function (e, t) {
if ("object" == typeof exports && "object" == typeof module) module.exports = t();else if ("function" == typeof define && define.amd) define([], t);else {
var r = t();
for (var n in r) ("object" == typeof exports ? exports : e)[n] = r[n];
}
}(this, function () {
return function (e) {
var t = {};
function r(n) {
if (t[n]) return t[n].exports;
var o = t[n] = {
i: n,
l: !1,
exports: {}
};
return e[n].call(o.exports, o, o.exports, r), o.l = !0, o.exports;
}
return r.m = e, r.c = t, r.d = function (e, t, n) {
r.o(e, t) || Object.defineProperty(e, t, {
enumerable: !0,
get: n
});
}, r.r = function (e) {
"undefined" != typeof Symbol && Symbol.toStringTag && Object.defineProperty(e, Symbol.toStringTag, {
value: "Module"
}), Object.defineProperty(e, "__esModule", {
value: !0
});
}, r.t = function (e, t) {
if (1 & t && (e = r(e)), 8 & t) return e;
if (4 & t && "object" == typeof e && e && e.__esModule) return e;
var n = Object.create(null);
if (r.r(n), Object.defineProperty(n, "default", {
enumerable: !0,
value: e
}), 2 & t && "string" != typeof e) for (var o in e) r.d(n, o, function (t) {
return e[t];
}.bind(null, o));
return n;
}, r.n = function (e) {
var t = e && e.__esModule ? function () {
return e.default;
} : function () {
return e;
};
return r.d(t, "a", t), t;
}, r.o = function (e, t) {
return Object.prototype.hasOwnProperty.call(e, t);
}, r.p = "", r(r.s = 6);
}([function (e, t) {
e.exports = require("stream");
}, function (e, t) {
e.exports = require("zlib");
}, function (e, t) {
e.exports = require("url");
}, function (e, t) {
e.exports = require("http");
}, function (e, t) {
e.exports = require("https");
}, function (e, t, r) {
"use strict";
Object.defineProperty(t, "__esModule", {
value: !0
});
var n,
o = function (e, t) {
if (Array.isArray(e)) return e;
if (Symbol.iterator in Object(e)) return function (e, t) {
var r = [],
n = !0,
o = !1,
i = void 0;
try {
for (var s, u = e[Symbol.iterator](); !(n = (s = u.next()).done) && (r.push(s.value), !t || r.length !== t); n = !0);
} catch (e) {
o = !0, i = e;
} finally {
try {
!n && u.return && u.return();
} finally {
if (o) throw i;
}
}
return r;
}(e, t);
throw new TypeError("Invalid attempt to destructure non-iterable instance");
},
i = r(9),
s = (n = i) && n.__esModule ? n : {
default: n
};
var u = {
getItem: function (e, t) {
return u.multiGet([e]).then(function (e) {
return e[0][1];
}).then(function (e) {
return t && t(null, e), e;
}).catch(function (e) {
return t && t(e, null), e;
});
},
setItem: function (e, t, r) {
return u.multiSet([[e, t]]).then(function (e) {
return r && r(null, e), e;
}).catch(function (e) {
return r && r(e, null), e;
});
},
getAllKeys: function (e) {
return Promise.resolve(Object.keys(localStorage)).then(function (t) {
return e && e(null, t), t;
}).catch(function (t) {
return e && e(t, null), t;
});
},
removeItem: function (e, t) {
return u.multiRemove([e]).then(function () {
t && t(null);
}).catch(function (e) {
t && t(e, null);
});
},
clear: function () {
return new Promise(function (e) {
window.localStorage.clear(), e();
});
},
mergeItem: function (e, t) {
return u.multiMerge([[e, t]]);
},
multiGet: function (e) {
return new Promise(function (t) {
t(e.reduce(function (e, t) {
return e.concat([[t, localStorage.getItem(t)]]);
}, []));
});
},
multiSet: function (e) {
return new Promise(function (t, r) {
var n = [];
return e.forEach(function (e) {
var t = o(e, 2),
r = t[0],
i = t[1];
try {
localStorage.setItem(r, i);
} catch (e) {
n.push(e);
}
}), n.length > 0 ? r(n) : t();
});
},
multiMerge: function (e) {
return new Promise(function (t, r) {
var n = [];
return e.forEach(function (e) {
var t = o(e, 2),
r = t[0],
i = t[1],
u = localStorage.getItem(r);
if (u) try {
localStorage.setItem(r, JSON.stringify((0, s.default)(JSON.parse(u), JSON.parse(i))));
} catch (e) {
n.push(e);
}
}), n.length > 0 ? r(n) : t();
});
},
multiRemove: function (e) {
return new Promise(function (t) {
e.forEach(function (e) {
return window.localStorage.removeItem(e);
}), t();
});
},
flushGetRequests: function () {
console.warn("AsyncStorage.flushGetRequests: Not supported on `web`");
}
};
t.default = u;
}, function (e, t, r) {
"use strict";
r.r(t);
var n = r(5),
o = r.n(n),
i = r(7).default;
"undefined" == typeof window && (i = r(8).default);
var s = r(11)({
AsyncStorage: o.a,
fetch: i
});
"undefined" != typeof window && (window.bulletTrain = s), t.default = s;
}, function (e, t, r) {
"use strict";
r.r(t), t.default = function (e, t) {
return t = t || {}, new Promise(function (r, n) {
var o = new XMLHttpRequest(),
i = [],
s = [],
u = {},
a = function () {
return {
ok: 2 == (o.status / 100 | 0),
statusText: o.statusText,
status: o.status,
url: o.responseURL,
text: function () {
return Promise.resolve(o.responseText);
},
json: function () {
return Promise.resolve(JSON.parse(o.responseText));
},
blob: function () {
return Promise.resolve(new Blob([o.response]));
},
clone: a,
headers: {
keys: function () {
return i;
},
entries: function () {
return s;
},
get: function (e) {
return u[e.toLowerCase()];
},
has: function (e) {
return e.toLowerCase() in u;
}
}
};
};
for (var c in o.open(t.method || "get", e, !0), o.onload = function () {
o.getAllResponseHeaders().replace(/^(.*?):[^\S\n]*([\s\S]*?)$/gm, function (e, t, r) {
i.push(t = t.toLowerCase()), s.push([t, r]), u[t] = u[t] ? u[t] + "," + r : r;
}), r(a());
}, o.onerror = n, o.withCredentials = "include" == t.credentials, t.headers) o.setRequestHeader(c, t.headers[c]);
o.send(t.body || null);
});
};
}, function (e, t, r) {
"use strict";
r.r(t), r.d(t, "Headers", function () {
return A;
}), r.d(t, "Request", function () {
return M;
}), r.d(t, "Response", function () {
return R;
}), r.d(t, "FetchError", function () {
return h;
});
var n = r(0),
o = r(3),
i = r(2),
s = r(4),
u = r(1);
const a = n.Readable,
c = Symbol("buffer"),
l = Symbol("type");
class f {
constructor() {
this[l] = "";
const e = arguments[0],
t = arguments[1],
r = [];
let n = 0;
if (e) {
const t = e,
o = Number(t.length);
for (let e = 0; e < o; e++) {
const o = t[e];
let i;
n += (i = o instanceof Buffer ? o : ArrayBuffer.isView(o) ? Buffer.from(o.buffer, o.byteOffset, o.byteLength) : o instanceof ArrayBuffer ? Buffer.from(o) : o instanceof f ? o[c] : Buffer.from("string" == typeof o ? o : String(o))).length, r.push(i);
}
}
this[c] = Buffer.concat(r);
let o = t && void 0 !== t.type && String(t.type).toLowerCase();
o && !/[^\u0020-\u007E]/.test(o) && (this[l] = o);
}
get size() {
return this[c].length;
}
get type() {
return this[l];
}
text() {
return Promise.resolve(this[c].toString());
}
arrayBuffer() {
const e = this[c],
t = e.buffer.slice(e.byteOffset, e.byteOffset + e.byteLength);
return Promise.resolve(t);
}
stream() {
const e = new a();
return e._read = function () {}, e.push(this[c]), e.push(null), e;
}
toString() {
return "[object Blob]";
}
slice() {
const e = this.size,
t = arguments[0],
r = arguments[1];
let n, o;
n = void 0 === t ? 0 : t < 0 ? Math.max(e + t, 0) : Math.min(t, e), o = void 0 === r ? e : r < 0 ? Math.max(e + r, 0) : Math.min(r, e);
const i = Math.max(o - n, 0),
s = this[c].slice(n, n + i),
u = new f([], {
type: arguments[2]
});
return u[c] = s, u;
}
}
function h(e, t, r) {
Error.call(this, e), this.message = e, this.type = t, r && (this.code = this.errno = r.code), Error.captureStackTrace(this, this.constructor);
}
let p;
Object.defineProperties(f.prototype, {
size: {
enumerable: !0
},
type: {
enumerable: !0
},
slice: {
enumerable: !0
}
}), Object.defineProperty(f.prototype, Symbol.toStringTag, {
value: "Blob",
writable: !1,
enumerable: !1,
configurable: !0
}), h.prototype = Object.create(Error.prototype), h.prototype.constructor = h, h.prototype.name = "FetchError";
try {
p = require("encoding").convert;
} catch (e) {}
const d = Symbol("Body internals"),
y = n.PassThrough;
function b(e) {
var t = this,
r = arguments.length > 1 && void 0 !== arguments[1] ? arguments[1] : {},
o = r.size;
let i = void 0 === o ? 0 : o;
var s = r.timeout;
let u = void 0 === s ? 0 : s;
null == e ? e = null : m(e) ? e = Buffer.from(e.toString()) : v(e) || Buffer.isBuffer(e) || ("[object ArrayBuffer]" === Object.prototype.toString.call(e) ? e = Buffer.from(e) : ArrayBuffer.isView(e) ? e = Buffer.from(e.buffer, e.byteOffset, e.byteLength) : e instanceof n || (e = Buffer.from(String(e)))), this[d] = {
body: e,
disturbed: !1,
error: null
}, this.size = i, this.timeout = u, e instanceof n && e.on("error", function (e) {
const r = "AbortError" === e.name ? e : new h(`Invalid response body while trying to fetch ${t.url}: ${e.message}`, "system", e);
t[d].error = r;
});
}
function g() {
var e = this;
if (this[d].disturbed) return b.Promise.reject(new TypeError(`body used already for: ${this.url}`));
if (this[d].disturbed = !0, this[d].error) return b.Promise.reject(this[d].error);
let t = this.body;
if (null === t) return b.Promise.resolve(Buffer.alloc(0));
if (v(t) && (t = t.stream()), Buffer.isBuffer(t)) return b.Promise.resolve(t);
if (!(t instanceof n)) return b.Promise.resolve(Buffer.alloc(0));
let r = [],
o = 0,
i = !1;
return new b.Promise(function (n, s) {
let u;
e.timeout && (u = setTimeout(function () {
i = !0, s(new h(`Response timeout while trying to fetch ${e.url} (over ${e.timeout}ms)`, "body-timeout"));
}, e.timeout)), t.on("error", function (t) {
"AbortError" === t.name ? (i = !0, s(t)) : s(new h(`Invalid response body while trying to fetch ${e.url}: ${t.message}`, "system", t));
}), t.on("data", function (t) {
if (!i && null !== t) {
if (e.size && o + t.length > e.size) return i = !0, void s(new h(`content size at ${e.url} over limit: ${e.size}`, "max-size"));
o += t.length, r.push(t);
}
}), t.on("end", function () {
if (!i) {
clearTimeout(u);
try {
n(Buffer.concat(r, o));
} catch (t) {
s(new h(`Could not create Buffer from response body for ${e.url}: ${t.message}`, "system", t));
}
}
});
});
}
function m(e) {
return "object" == typeof e && "function" == typeof e.append && "function" == typeof e.delete && "function" == typeof e.get && "function" == typeof e.getAll && "function" == typeof e.has && "function" == typeof e.set && ("URLSearchParams" === e.constructor.name || "[object URLSearchParams]" === Object.prototype.toString.call(e) || "function" == typeof e.sort);
}
function v(e) {
return "object" == typeof e && "function" == typeof e.arrayBuffer && "string" == typeof e.type && "function" == typeof e.stream && "function" == typeof e.constructor && "string" == typeof e.constructor.name && /^(Blob|File)$/.test(e.constructor.name) && /^(Blob|File)$/.test(e[Symbol.toStringTag]);
}
function w(e) {
let t,
r,
o = e.body;
if (e.bodyUsed) throw new Error("cannot clone body after it is used");
return o instanceof n && "function" != typeof o.getBoundary && (t = new y(), r = new y(), o.pipe(t), o.pipe(r), e[d].body = t, o = r), o;
}
function _(e) {
return null === e ? null : "string" == typeof e ? "text/plain;charset=UTF-8" : m(e) ? "application/x-www-form-urlencoded;charset=UTF-8" : v(e) ? e.type || null : Buffer.isBuffer(e) ? null : "[object ArrayBuffer]" === Object.prototype.toString.call(e) ? null : ArrayBuffer.isView(e) ? null : "function" == typeof e.getBoundary ? `multipart/form-data;boundary=${e.getBoundary()}` : e instanceof n ? null : "text/plain;charset=UTF-8";
}
function j(e) {
const t = e.body;
return null === t ? 0 : v(t) ? t.size : Buffer.isBuffer(t) ? t.length : t && "function" == typeof t.getLengthSync && (t._lengthRetrievers && 0 == t._lengthRetrievers.length || t.hasKnownLength && t.hasKnownLength()) ? t.getLengthSync() : null;
}
b.prototype = {
get body() {
return this[d].body;
},
get bodyUsed() {
return this[d].disturbed;
},
arrayBuffer() {
return g.call(this).then(function (e) {
return e.buffer.slice(e.byteOffset, e.byteOffset + e.byteLength);
});
},
blob() {
let e = this.headers && this.headers.get("content-type") || "";
return g.call(this).then(function (t) {
return Object.assign(new f([], {
type: e.toLowerCase()
}), {
[c]: t
});
});
},
json() {
var e = this;
return g.call(this).then(function (t) {
try {
return JSON.parse(t.toString());
} catch (t) {
return b.Promise.reject(new h(`invalid json response body at ${e.url} reason: ${t.message}`, "invalid-json"));
}
});
},
text() {
return g.call(this).then(function (e) {
return e.toString();
});
},
buffer() {
return g.call(this);
},
textConverted() {
var e = this;
return g.call(this).then(function (t) {
return function (e, t) {
if ("function" != typeof p) throw new Error("The package `encoding` must be installed to use the textConverted() function");
const r = t.get("content-type");
let n,
o,
i = "utf-8";
r && (n = /charset=([^;]*)/i.exec(r));
o = e.slice(0, 1024).toString(), !n && o && (n = /<meta.+?charset=(['"])(.+?)\1/i.exec(o));
!n && o && (n = /<meta[\s]+?http-equiv=(['"])content-type\1[\s]+?content=(['"])(.+?)\2/i.exec(o)) && (n = /charset=(.*)/i.exec(n.pop()));
!n && o && (n = /<\?xml.+?encoding=(['"])(.+?)\1/i.exec(o));
n && ("gb2312" !== (i = n.pop()) && "gbk" !== i || (i = "gb18030"));
return p(e, "UTF-8", i).toString();
}(t, e.headers);
});
}
}, Object.defineProperties(b.prototype, {
body: {
enumerable: !0
},
bodyUsed: {
enumerable: !0
},
arrayBuffer: {
enumerable: !0
},
blob: {
enumerable: !0
},
json: {
enumerable: !0
},
text: {
enumerable: !0
}
}), b.mixIn = function (e) {
for (const t of Object.getOwnPropertyNames(b.prototype)) if (!(t in e)) {
const r = Object.getOwnPropertyDescriptor(b.prototype, t);
Object.defineProperty(e, t, r);
}
}, b.Promise = global.Promise;
const S = /[^\^_`a-zA-Z\-0-9!#$%&'*+.|~]/,
O = /[^\t\x20-\x7e\x80-\xff]/;
function T(e) {
if (e = `${e}`, S.test(e) || "" === e) throw new TypeError(`${e} is not a legal HTTP header name`);
}
function P(e) {
if (e = `${e}`, O.test(e)) throw new TypeError(`${e} is not a legal HTTP header value`);
}
function x(e, t) {
t = t.toLowerCase();
for (const r in e) if (r.toLowerCase() === t) return r;
}
const E = Symbol("map");
class A {
constructor() {
let e = arguments.length > 0 && void 0 !== arguments[0] ? arguments[0] : void 0;
if (this[E] = Object.create(null), e instanceof A) {
const t = e.raw(),
r = Object.keys(t);
for (const e of r) for (const r of t[e]) this.append(e, r);
} else if (null == e) ;else {
if ("object" != typeof e) throw new TypeError("Provided initializer must be an object");
{
const t = e[Symbol.iterator];
if (null != t) {
if ("function" != typeof t) throw new TypeError("Header pairs must be iterable");
const r = [];
for (const t of e) {
if ("object" != typeof t || "function" != typeof t[Symbol.iterator]) throw new TypeError("Each header pair must be iterable");
r.push(Array.from(t));
}
for (const e of r) {
if (2 !== e.length) throw new TypeError("Each header pair must be a name/value tuple");
this.append(e[0], e[1]);
}
} else for (const t of Object.keys(e)) {
const r = e[t];
this.append(t, r);
}
}
}
}
get(e) {
T(e = `${e}`);
const t = x(this[E], e);
return void 0 === t ? null : this[E][t].join(", ");
}
forEach(e) {
let t = arguments.length > 1 && void 0 !== arguments[1] ? arguments[1] : void 0,
r = B(this),
n = 0;
for (; n < r.length;) {
var o = r[n];
const i = o[0],
s = o[1];
e.call(t, s, i, this), r = B(this), n++;
}
}
set(e, t) {
t = `${t}`, T(e = `${e}`), P(t);
const r = x(this[E], e);
this[E][void 0 !== r ? r : e] = [t];
}
append(e, t) {
t = `${t}`, T(e = `${e}`), P(t);
const r = x(this[E], e);
void 0 !== r ? this[E][r].push(t) : this[E][e] = [t];
}
has(e) {
return T(e = `${e}`), void 0 !== x(this[E], e);
}
delete(e) {
T(e = `${e}`);
const t = x(this[E], e);
void 0 !== t && delete this[E][t];
}
raw() {
return this[E];
}
keys() {
return k(this, "key");
}
values() {
return k(this, "value");
}
[Symbol.iterator]() {
return k(this, "key+value");
}
}
function B(e) {
let t = arguments.length > 1 && void 0 !== arguments[1] ? arguments[1] : "key+value";
return Object.keys(e[E]).sort().map("key" === t ? function (e) {
return e.toLowerCase();
} : "value" === t ? function (t) {
return e[E][t].join(", ");
} : function (t) {
return [t.toLowerCase(), e[E][t].join(", ")];
});
}
A.prototype.entries = A.prototype[Symbol.iterator], Object.defineProperty(A.prototype, Symbol.toStringTag, {
value: "Headers",
writable: !1,
enumerable: !1,
configurable: !0
}), Object.defineProperties(A.prototype, {
get: {
enumerable: !0
},
forEach: {
enumerable: !0
},
set: {
enumerable: !0
},
append: {
enumerable: !0
},
has: {
enumerable: !0
},
delete: {
enumerable: !0
},
keys: {
enumerable: !0
},
values: {
enumerable: !0
},
entries: {
enumerable: !0
}
});
const C = Symbol("internal");
function k(e, t) {
const r = Object.create($);
return r[C] = {
target: e,
kind: t,
index: 0
}, r;
}
const $ = Object.setPrototypeOf({
next() {
if (!this || Object.getPrototypeOf(this) !== $) throw new TypeError("Value of `this` is not a HeadersIterator");
var e = this[C];
const t = e.target,
r = e.kind,
n = e.index,
o = B(t, r);
return n >= o.length ? {
value: void 0,
done: !0
} : (this[C].index = n + 1, {
value: o[n],
done: !1
});
}
}, Object.getPrototypeOf(Object.getPrototypeOf([][Symbol.iterator]())));
function z(e) {
const t = Object.assign({
__proto__: null
}, e[E]),
r = x(e[E], "Host");
return void 0 !== r && (t[r] = t[r][0]), t;
}
Object.defineProperty($, Symbol.toStringTag, {
value: "HeadersIterator",
writable: !1,
enumerable: !1,
configurable: !0
});
const L = Symbol("Response internals"),
I = o.STATUS_CODES;
class R {
constructor() {
let e = arguments.length > 0 && void 0 !== arguments[0] ? arguments[0] : null,
t = arguments.length > 1 && void 0 !== arguments[1] ? arguments[1] : {};
b.call(this, e, t);
const r = t.status || 200,
n = new A(t.headers);
if (null != e && !n.has("Content-Type")) {
const t = _(e);
t && n.append("Content-Type", t);
}
this[L] = {
url: t.url,
status: r,
statusText: t.statusText || I[r],
headers: n,
counter: t.counter
};
}
get url() {
return this[L].url || "";
}
get status() {
return this[L].status;
}
get ok() {
return this[L].status >= 200 && this[L].status < 300;
}
get redirected() {
return this[L].counter > 0;
}
get statusText() {
return this[L].statusText;
}
get headers() {
return this[L].headers;
}
clone() {
return new R(w(this), {
url: this.url,
status: this.status,
statusText: this.statusText,
headers: this.headers,
ok: this.ok,
redirected: this.redirected
});
}
}
b.mixIn(R.prototype), Object.defineProperties(R.prototype, {
url: {
enumerable: !0
},
status: {
enumerable: !0
},
ok: {
enumerable: !0
},
redirected: {
enumerable: !0
},
statusText: {
enumerable: !0
},
headers: {
enumerable: !0
},
clone: {
enumerable: !0
}
}), Object.defineProperty(R.prototype, Symbol.toStringTag, {
value: "Response",
writable: !1,
enumerable: !1,
configurable: !0
});
const F = Symbol("Request internals"),
U = i.parse,
q = i.format,
N = "destroy" in n.Readable.prototype;
function D(e) {
return "object" == typeof e && "object" == typeof e[F];
}
class M {
constructor(e) {
let t,
r = arguments.length > 1 && void 0 !== arguments[1] ? arguments[1] : {};
D(e) ? t = U(e.url) : (t = e && e.href ? U(e.href) : U(`${e}`), e = {});
let n = r.method || e.method || "GET";
if (n = n.toUpperCase(), (null != r.body || D(e) && null !== e.body) && ("GET" === n || "HEAD" === n)) throw new TypeError("Request with GET/HEAD method cannot have body");
let o = null != r.body ? r.body : D(e) && null !== e.body ? w(e) : null;
b.call(this, o, {
timeout: r.timeout || e.timeout || 0,
size: r.size || e.size || 0
});
const i = new A(r.headers || e.headers || {});
if (null != o && !i.has("Content-Type")) {
const e = _(o);
e && i.append("Content-Type", e);
}
let s = D(e) ? e.signal : null;
if ("signal" in r && (s = r.signal), null != s && !function (e) {
const t = e && "object" == typeof e && Object.getPrototypeOf(e);
return !(!t || "AbortSignal" !== t.constructor.name);
}(s)) throw new TypeError("Expected signal to be an instanceof AbortSignal");
this[F] = {
method: n,
redirect: r.redirect || e.redirect || "follow",
headers: i,
parsedURL: t,
signal: s
}, this.follow = void 0 !== r.follow ? r.follow : void 0 !== e.follow ? e.follow : 20, this.compress = void 0 !== r.compress ? r.compress : void 0 === e.compress || e.compress, this.counter = r.counter || e.counter || 0, this.agent = r.agent || e.agent;
}
get method() {
return this[F].method;
}
get url() {
return q(this[F].parsedURL);
}
get headers() {
return this[F].headers;
}
get redirect() {
return this[F].redirect;
}
get signal() {
return this[F].signal;
}
clone() {
return new M(this);
}
}
function H(e) {
Error.call(this, e), this.type = "aborted", this.message = e, Error.captureStackTrace(this, this.constructor);
}
b.mixIn(M.prototype), Object.defineProperty(M.prototype, Symbol.toStringTag, {
value: "Request",
writable: !1,
enumerable: !1,
configurable: !0
}), Object.defineProperties(M.prototype, {
method: {
enumerable: !0
},
url: {
enumerable: !0
},
headers: {
enumerable: !0
},
redirect: {
enumerable: !0
},
clone: {
enumerable: !0
},
signal: {
enumerable: !0
}
}), H.prototype = Object.create(Error.prototype), H.prototype.constructor = H, H.prototype.name = "AbortError";
const J = n.PassThrough,
G = i.resolve;
function V(e, t) {
if (!V.Promise) throw new Error("native promise missing, set fetch.Promise to your favorite alternative");
return b.Promise = V.Promise, new V.Promise(function (r, i) {
const a = new M(e, t),
c = function (e) {
const t = e[F].parsedURL,
r = new A(e[F].headers);
if (r.has("Accept") || r.set("Accept", "*/*"), !t.protocol || !t.hostname) throw new TypeError("Only absolute URLs are supported");
if (!/^https?:$/.test(t.protocol)) throw new TypeError("Only HTTP(S) protocols are supported");
if (e.signal && e.body instanceof n.Readable && !N) throw new Error("Cancellation of streamed requests with AbortSignal is not supported in node < 8");
let o = null;
if (null == e.body && /^(POST|PUT)$/i.test(e.method) && (o = "0"), null != e.body) {
const t = j(e);
"number" == typeof t && (o = String(t));
}
o && r.set("Content-Length", o), r.has("User-Agent") || r.set("User-Agent", "node-fetch/1.0 (+https://github.com/bitinn/node-fetch)"), e.compress && !r.has("Accept-Encoding") && r.set("Accept-Encoding", "gzip,deflate");
let i = e.agent;
return "function" == typeof i && (i = i(t)), r.has("Connection") || i || r.set("Connection", "close"), Object.assign({}, t, {
method: e.method,
headers: z(r),
agent: i
});
}(a),
l = ("https:" === c.protocol ? s : o).request,
f = a.signal;
let p = null;
const d = function () {
let e = new H("The user aborted a request.");
i(e), a.body && a.body instanceof n.Readable && a.body.destroy(e), p && p.body && p.body.emit("error", e);
};
if (f && f.aborted) return void d();
const y = function () {
d(), m();
},
b = l(c);
let g;
function m() {
b.abort(), f && f.removeEventListener("abort", y), clearTimeout(g);
}
f && f.addEventListener("abort", y), a.timeout && b.once("socket", function (e) {
g = setTimeout(function () {
i(new h(`network timeout at: ${a.url}`, "request-timeout")), m();
}, a.timeout);
}), b.on("error", function (e) {
i(new h(`request to ${a.url} failed, reason: ${e.message}`, "system", e)), m();
}), b.on("response", function (e) {
clearTimeout(g);
const t = function (e) {
const t = new A();
for (const r of Object.keys(e)) if (!S.test(r)) if (Array.isArray(e[r])) for (const n of e[r]) O.test(n) || (void 0 === t[E][r] ? t[E][r] = [n] : t[E][r].push(n));else O.test(e[r]) || (t[E][r] = [e[r]]);
return t;
}(e.headers);
if (V.isRedirect(e.statusCode)) {
const n = t.get("Location"),
o = null === n ? null : G(a.url, n);
switch (a.redirect) {
case "error":
return i(new h(`redirect mode is set to error: ${a.url}`, "no-redirect")), void m();
case "manual":
if (null !== o) try {
t.set("Location", o);
} catch (e) {
i(e);
}
break;
case "follow":
if (null === o) break;
if (a.counter >= a.follow) return i(new h(`maximum redirect reached at: ${a.url}`, "max-redirect")), void m();
const n = {
headers: new A(a.headers),
follow: a.follow,
counter: a.counter + 1,
agent: a.agent,
compress: a.compress,
method: a.method,
body: a.body,
signal: a.signal,
timeout: a.timeout
};
return 303 !== e.statusCode && a.body && null === j(a) ? (i(new h("Cannot follow redirect with body being a readable stream", "unsupported-redirect")), void m()) : (303 !== e.statusCode && (301 !== e.statusCode && 302 !== e.statusCode || "POST" !== a.method) || (n.method = "GET", n.body = void 0, n.headers.delete("content-length")), r(V(new M(o, n))), void m());
}
}
e.once("end", function () {
f && f.removeEventListener("abort", y);
});
let n = e.pipe(new J());
const o = {
url: a.url,
status: e.statusCode,
statusText: e.statusMessage,
headers: t,
size: a.size,
timeout: a.timeout,
counter: a.counter
},
s = t.get("Content-Encoding");
if (!a.compress || "HEAD" === a.method || null === s || 204 === e.statusCode || 304 === e.statusCode) return p = new R(n, o), void r(p);
const c = {
flush: u.Z_SYNC_FLUSH,
finishFlush: u.Z_SYNC_FLUSH
};
if ("gzip" == s || "x-gzip" == s) return n = n.pipe(u.createGunzip(c)), p = new R(n, o), void r(p);
if ("deflate" != s && "x-deflate" != s) {
if ("br" == s && "function" == typeof u.createBrotliDecompress) return n = n.pipe(u.createBrotliDecompress()), p = new R(n, o), void r(p);
p = new R(n, o), r(p);
} else {
e.pipe(new J()).once("data", function (e) {
n = 8 == (15 & e[0]) ? n.pipe(u.createInflate()) : n.pipe(u.createInflateRaw()), p = new R(n, o), r(p);
});
}
}), function (e, t) {
const r = t.body;
null === r ? e.end() : v(r) ? r.stream().pipe(e) : Buffer.isBuffer(r) ? (e.write(r), e.end()) : r.pipe(e);
}(b, a);
});
}
V.isRedirect = function (e) {
return 301 === e || 302 === e || 303 === e || 307 === e || 308 === e;
}, V.Promise = global.Promise, t.default = V;
}, function (e, t, r) {
(function (e) {
var r = 200,
n = "__lodash_hash_undefined__",
o = 800,
i = 16,
s = 9007199254740991,
u = "[object Arguments]",
a = "[object AsyncFunction]",
c = "[object Function]",
l = "[object GeneratorFunction]",
f = "[object Null]",
h = "[object Object]",
p = "[object Proxy]",
d = "[object Undefined]",
y = /^\[object .+?Constructor\]$/,
b = /^(?:0|[1-9]\d*)$/,
g = {};
g["[object Float32Array]"] = g["[object Float64Array]"] = g["[object Int8Array]"] = g["[object Int16Array]"] = g["[object Int32Array]"] = g["[object Uint8Array]"] = g["[object Uint8ClampedArray]"] = g["[object Uint16Array]"] = g["[object Uint32Array]"] = !0, g[u] = g["[object Array]"] = g["[object ArrayBuffer]"] = g["[object Boolean]"] = g["[object DataView]"] = g["[object Date]"] = g["[object Error]"] = g[c] = g["[object Map]"] = g["[object Number]"] = g[h] = g["[object RegExp]"] = g["[object Set]"] = g["[object String]"] = g["[object WeakMap]"] = !1;
var m = "object" == typeof global && global && global.Object === Object && global,
v = "object" == typeof self && self && self.Object === Object && self,
w = m || v || Function("return this")(),
_ = t && !t.nodeType && t,
j = _ && "object" == typeof e && e && !e.nodeType && e,
S = j && j.exports === _,
O = S && m.process,
T = function () {
try {
var e = j && j.require && j.require("util").types;
return e || O && O.binding && O.binding("util");
} catch (e) {}
}(),
P = T && T.isTypedArray;
function x(e, t, r) {
switch (r.length) {
case 0:
return e.call(t);
case 1:
return e.call(t, r[0]);
case 2:
return e.call(t, r[0], r[1]);
case 3:
return e.call(t, r[0], r[1], r[2]);
}
return e.apply(t, r);
}
var E,
A,
B,
C = Array.prototype,
k = Function.prototype,
$ = Object.prototype,
z = w["__core-js_shared__"],
L = k.toString,
I = $.hasOwnProperty,
R = (E = /[^.]+$/.exec(z && z.keys && z.keys.IE_PROTO || "")) ? "Symbol(src)_1." + E : "",
F = $.toString,
U = L.call(Object),
q = RegExp("^" + L.call(I).replace(/[\\^$.*+?()[\]{}|]/g, "\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g, "$1.*?") + "$"),
N = S ? w.Buffer : void 0,
D = w.Symbol,
M = w.Uint8Array,
H = N ? N.allocUnsafe : void 0,
J = (A = Object.getPrototypeOf, B = Object, function (e) {
return A(B(e));
}),
G = Object.create,
V = $.propertyIsEnumerable,
K = C.splice,
Z = D ? D.toStringTag : void 0,
Y = function () {
try {
var e = _e(Object, "defineProperty");
return e({}, "", {}), e;
} catch (e) {}
}(),
W = N ? N.isBuffer : void 0,
X = Math.max,
Q = Date.now,
ee = _e(w, "Map"),
te = _e(Object, "create"),
re = function () {
function e() {}
return function (t) {
if (!$e(t)) return {};
if (G) return G(t);
e.prototype = t;
var r = new e();
return e.prototype = void 0, r;
};
}();
function ne(e) {
var t = -1,
r = null == e ? 0 : e.length;
for (this.clear(); ++t < r;) {
var n = e[t];
this.set(n[0], n[1]);
}
}
function oe(e) {
var t = -1,
r = null == e ? 0 : e.length;
for (this.clear(); ++t < r;) {
var n = e[t];
this.set(n[0], n[1]);
}
}
function ie(e) {
var t = -1,
r = null == e ? 0 : e.length;
for (this.clear(); ++t < r;) {
var n = e[t];
this.set(n[0], n[1]);
}
}
function se(e) {
var t = this.__data__ = new oe(e);
this.size = t.size;
}
function ue(e, t) {
var r = Ee(e),
n = !r && xe(e),
o = !r && !n && Be(e),
i = !r && !n && !o && Le(e),
s = r || n || o || i,
u = s ? function (e, t) {
for (var r = -1, n = Array(e); ++r < e;) n[r] = t(r);
return n;
}(e.length, String) : [],
a = u.length;
for (var c in e) !t && !I.call(e, c) || s && ("length" == c || o && ("offset" == c || "parent" == c) || i && ("buffer" == c || "byteLength" == c || "byteOffset" == c) || je(c, a)) || u.push(c);
return u;
}
function ae(e, t, r) {
(void 0 === r || Pe(e[t], r)) && (void 0 !== r || t in e) || fe(e, t, r);
}
function ce(e, t, r) {
var n = e[t];
I.call(e, t) && Pe(n, r) && (void 0 !== r || t in e) || fe(e, t, r);
}
function le(e, t) {
for (var r = e.length; r--;) if (Pe(e[r][0], t)) return r;
return -1;
}
function fe(e, t, r) {
"__proto__" == t && Y ? Y(e, t, {
configurable: !0,
enumerable: !0,
value: r,
writable: !0
}) : e[t] = r;
}
ne.prototype.clear = function () {
this.__data__ = te ? te(null) : {}, this.size = 0;
}, ne.prototype.delete = function (e) {
var t = this.has(e) && delete this.__data__[e];
return this.size -= t ? 1 : 0, t;
}, ne.prototype.get = function (e) {
var t = this.__data__;
if (te) {
var r = t[e];
return r === n ? void 0 : r;
}
return I.call(t, e) ? t[e] : void 0;
}, ne.prototype.has = function (e) {
var t = this.__data__;
return te ? void 0 !== t[e] : I.call(t, e);
}, ne.prototype.set = function (e, t) {
var r = this.__data__;
return this.size += this.has(e) ? 0 : 1, r[e] = te && void 0 === t ? n : t, this;
}, oe.prototype.clear = function () {
this.__data__ = [], this.size = 0;
}, oe.prototype.delete = function (e) {
var t = this.__data__,
r = le(t, e);
return !(r < 0) && (r == t.length - 1 ? t.pop() : K.call(t, r, 1), --this.size, !0);
}, oe.prototype.get = function (e) {
var t = this.__data__,
r = le(t, e);
return r < 0 ? void 0 : t[r][1];
}, oe.prototype.has = function (e) {
return le(this.__data__, e) > -1;
}, oe.prototype.set = function (e, t) {
var r = this.__data__,
n = le(r, e);
return n < 0 ? (++this.size, r.push([e, t])) : r[n][1] = t, this;
}, ie.prototype.clear = function () {
this.size = 0, this.__data__ = {
hash: new ne(),
map: new (ee || oe)(),
string: new ne()
};
}, ie.prototype.delete = function (e) {
var t = we(this, e).delete(e);
return this.size -= t ? 1 : 0, t;
}, ie.prototype.get = function (e) {
return we(this, e).get(e);
}, ie.prototype.has = function (e) {
return we(this, e).has(e);
}, ie.prototype.set = function (e, t) {
var r = we(this, e),
n = r.size;
return r.set(e, t), this.size += r.size == n ? 0 : 1, this;
}, se.prototype.clear = function () {
this.__data__ = new oe(), this.size = 0;
}, se.prototype.delete = function (e) {
var t = this.__data__,
r = t.delete(e);
return this.size = t.size, r;
}, se.prototype.get = function (e) {
return this.__data__.get(e);
}, se.prototype.has = function (e) {
return this.__data__.has(e);
}, se.prototype.set = function (e, t) {
var n = this.__data__;
if (n instanceof oe) {
var o = n.__data__;
if (!ee || o.length < r - 1) return o.push([e, t]), this.size = ++n.size, this;
n = this.__data__ = new ie(o);
}
return n.set(e, t), this.size = n.size, this;
};
var he,
pe = function (e, t, r) {
for (var n = -1, o = Object(e), i = r(e), s = i.length; s--;) {
var u = i[he ? s : ++n];
if (!1 === t(o[u], u, o)) break;
}
return e;
};
function de(e) {
return null == e ? void 0 === e ? d : f : Z && Z in Object(e) ? function (e) {
var t = I.call(e, Z),
r = e[Z];
try {
e[Z] = void 0;
var n = !0;
} catch (e) {}
var o = F.call(e);
n && (t ? e[Z] = r : delete e[Z]);
return o;
}(e) : function (e) {
return F.call(e);
}(e);
}
function ye(e) {
return ze(e) && de(e) == u;
}
function be(e) {
return !(!$e(e) || function (e) {
return !!R && R in e;
}(e)) && (Ce(e) ? q : y).test(function (e) {
if (null != e) {
try {
return L.call(e);
} catch (e) {}
try {
return e + "";
} catch (e) {}
}
return "";
}(e));
}
function ge(e) {
if (!$e(e)) return function (e) {
var t = [];
if (null != e) for (var r in Object(e)) t.push(r);
return t;
}(e);
var t = Se(e),
r = [];
for (var n in e) ("constructor" != n || !t && I.call(e, n)) && r.push(n);
return r;
}
function me(e, t, r, n, o) {
e !== t && pe(t, function (i, s) {
if (o || (o = new se()), $e(i)) !function (e, t, r, n, o, i, s) {
var u = Oe(e, r),
a = Oe(t, r),
c = s.get(a);
if (c) return void ae(e, r, c);
var l = i ? i(u, a, r + "", e, t, s) : void 0,
f = void 0 === l;
if (f) {
var p = Ee(a),
d = !p && Be(a),
y = !p && !d && Le(a);
l = a, p || d || y ? Ee(u) ? l = u : ze(w = u) && Ae(w) ? l = function (e, t) {
var r = -1,
n = e.length;
t || (t = Array(n));
for (; ++r < n;) t[r] = e[r];
return t;
}(u) : d ? (f = !1, l = function (e, t) {
if (t) return e.slice();
var r = e.length,
n = H ? H(r) : new e.constructor(r);
return e.copy(n), n;
}(a, !0)) : y ? (f = !1, b = a, g = !0 ? (m = b.buffer, v = new m.constructor(m.byteLength), new M(v).set(new M(m)), v) : b.buffer, l = new b.constructor(g, b.byteOffset, b.length)) : l = [] : function (e) {
if (!ze(e) || de(e) != h) return !1;
var t = J(e);
if (null === t) return !0;
var r = I.call(t, "constructor") && t.constructor;
return "function" == typeof r && r instanceof r && L.call(r) == U;
}(a) || xe(a) ? (l = u, xe(u) ? l = function (e) {
return function (e, t, r, n) {
var o = !r;
r || (r = {});
var i = -1,
s = t.length;
for (; ++i < s;) {
var u = t[i],
a = n ? n(r[u], e[u], u, r, e) : void 0;
void 0 === a && (a = e[u]), o ? fe(r, u, a) : ce(r, u, a);
}
return r;
}(e, Ie(e));
}(u) : $e(u) && !Ce(u) || (l = function (e) {
return "function" != typeof e.constructor || Se(e) ? {} : re(J(e));
}(a))) : f = !1;
}
var b, g, m, v;
var w;
f && (s.set(a, l), o(l, a, n, i, s), s.delete(a));
ae(e, r, l);
}(e, t, s, r, me, n, o);else {
var u = n ? n(Oe(e, s), i, s + "", e, t, o) : void 0;
void 0 === u && (u = i), ae(e, s, u);
}
}, Ie);
}
function ve(e, t) {
return Te(function (e, t, r) {
return t = X(void 0 === t ? e.length - 1 : t, 0), function () {
for (var n = arguments, o = -1, i = X(n.length - t, 0), s = Array(i); ++o < i;) s[o] = n[t + o];
o = -1;
for (var u = Array(t + 1); ++o < t;) u[o] = n[o];
return u[t] = r(s), x(e, this, u);
};
}(e, t, Ue), e + "");
}
function we(e, t) {
var r,
n,
o = e.__data__;
return ("string" == (n = typeof (r = t)) || "number" == n || "symbol" == n || "boolean" == n ? "__proto__" !== r : null === r) ? o["string" == typeof t ? "string" : "hash"] : o.map;
}
function _e(e, t) {
var r = function (e, t) {
return null == e ? void 0 : e[t];
}(e, t);
return be(r) ? r : void 0;
}
function je(e, t) {
var r = typeof e;
return !!(t = null == t ? s : t) && ("number" == r || "symbol" != r && b.test(e)) && e > -1 && e % 1 == 0 && e < t;
}
function Se(e) {
var t = e && e.constructor;
return e === ("function" == typeof t && t.prototype || $);
}
function Oe(e, t) {
if (("constructor" !== t || "function" != typeof e[t]) && "__proto__" != t) return e[t];
}
var Te = function (e) {
var t = 0,
r = 0;
return function () {
var n = Q(),
s = i - (n - r);
if (r = n, s > 0) {
if (++t >= o) return arguments[0];
} else t = 0;
return e.apply(void 0, arguments);
};
}(Y ? function (e, t) {
return Y(e, "toString", {
configurable: !0,
enumerable: !1,
value: (r = t, function () {
return r;
}),
writable: !0
});
var r;
} : Ue);
function Pe(e, t) {
return e === t || e != e && t != t;
}
var xe = ye(function () {
return arguments;
}()) ? ye : function (e) {
return ze(e) && I.call(e, "callee") && !V.call(e, "callee");
},
Ee = Array.isArray;
function Ae(e) {
return null != e && ke(e.length) && !Ce(e);
}
var Be = W || function () {
return !1;
};
function Ce(e) {
if (!$e(e)) return !1;
var t = de(e);
return t == c || t == l || t == a || t == p;
}
function ke(e) {
return "number" == typeof e && e > -1 && e % 1 == 0 && e <= s;
}
function $e(e) {
var t = typeof e;
return null != e && ("object" == t || "function" == t);
}
function ze(e) {
return null != e && "object" == typeof e;
}
var Le = P ? function (e) {
return function (t) {
return e(t);
};
}(P) : function (e) {
return ze(e) && ke(e.length) && !!g[de(e)];
};
function Ie(e) {
return Ae(e) ? ue(e, !0) : ge(e);
}
var Re,
Fe = (Re = function (e, t, r) {
me(e, t, r);
}, ve(function (e, t) {
var r = -1,
n = t.length,
o = n > 1 ? t[n - 1] : void 0,
i = n > 2 ? t[2] : void 0;
for (o = Re.length > 3 && "function" == typeof o ? (n--, o) : void 0, i && function (e, t, r) {
if (!$e(r)) return !1;
var n = typeof t;
return !!("number" == n ? Ae(r) && je(t, r.length) : "string" == n && (t in r)) && Pe(r[t], e);
}(t[0], t[1], i) && (o = n < 3 ? void 0 : o, n = 1), e = Object(e); ++r < n;) {
var s = t[r];
s && Re(e, s, r, o);
}
return e;
}));
function Ue(e) {
return e;
}
e.exports = Fe;
}).call(this, r(10)(e));
}, function (e, t) {
e.exports = function (e) {
return e.webpackPolyfill || (e.deprecate = function () {}, e.paths = [], e.children || (e.children = []), Object.defineProperty(e, "loaded", {
enumerable: !0,
get: function () {
return e.l;
}
}), Object.defineProperty(e, "id", {
enumerable: !0,
get: function () {
return e.i;
}
}), e.webpackPolyfill = 1), e;
};
}, function (e, t) {
function r(e, t) {
for (var r, n = 0; n < t.length; n++) (r = t[n]).enumerable = r.enumerable || !1, r.configurable = !0, "value" in r && (r.writable = !0), Object.defineProperty(e, r.key, r);
}
function n(e, t, r) {
return t in e ? Object.defineProperty(e, t, {
value: r,
enumerable: !0,
configurable: !0,
writable: !0
}) : e[t] = r, e;
}
var o,
i,
s = "https://api.bullet-train.io/api/v1/",
u = function () {
function e(t) {
var r = this;
(function (e, t) {
if (!(e instanceof t)) throw new TypeError("Cannot call a class as a function");
})(this, e), n(this, "getJSON", function (e, t, n) {
var i = {
method: t || "GET",
body: n,
headers: {
"x-environment-key": r.environmentID
}
};
return "GET" !== t && (i.headers["Content-Type"] = "application/json; charset=utf-8"), o(e, i).then(function (e) {
return 200 <= e.status && 300 > e.status ? e : e.text().then(function (e) {
var t = e;
try {
t = JSON.parse(e);
} catch (e) {}
return Promise.reject(t);
});
}).then(function (e) {
return e.json();
});
}), n(this, "getFlags", function (e, t) {
var n = r.onChange,
o = r.onError,
i = r.identity,
s = r.api,
u = (r.disableCache, !1),
a = function (e, t) {
var o = e.flags,
i = e.traits,
s = {},
u = {};
if (i = i || [], (o = o || []).forEach(function (e) {
s[e.feature.name.toLowerCase().replace(/ /g, "_")] = {
enabled: e.enabled,
value: e.feature_state_value
};
}), i.forEach(function (e) {
u[e.trait_key.toLowerCase().replace(/ /g, "_")] = e.trait_value;
}), r.oldFlags = s, r.flags = s, r.traits = u, t) {
var a = {};
t.map(function (e) {
a[e.name] = e;
}), r.segments = a;
}
n && n(r.oldFlags, {
isFromServer: !0
});
};
return i ? Promise.all([r.getJSON(s + "identities/?identifier=" + encodeURIComponent(i))]).then(function (e) {
a(e[0], e[1]);
}).catch(function (e) {
var t = e.message;
o && o({
message: t
});
}) : Promise.all([r.getJSON(s + "flags/")]).then(function (t) {
a({
flags: t[0]
}, null), e && !u && (u = !0, e());
}).catch(function (e) {
t && !u && (u = !0, t(e)), o && o(e);
});
}), n(this, "getValue", function (e) {
var t = r.flags && r.flags[e],
n = null;
return t && (n = t.value), n;
}), n(this, "getTrait", function (e) {
return r.traits && r.traits[e];
}), n(this, "setTrait", function (e, t) {
var n = r.getJSON,
o = r.identity,
i = r.api;
return n("".concat(i, "traits/"), "POST", JSON.stringify({
identity: {
identifier: o
},
trait_key: e,
trait_value: t
})).then(r.getFlags);
}), n(this, "incrementTrait", function (e, t) {
var n = r.getJSON,
o = r.identity,
i = r.api;
return n("".concat(i, "traits/increment-value/"), "POST", JSON.stringify({
trait_key: e,
increment_by: t,
identifier: o
})).then(r.getFlags);
}), n(this, "hasFeature", function (e) {
var t = r.flags && r.flags[e],
n = !1;
return t && t.enabled && (n = !0), n;
}), o = t.fetch ? t.fetch : global.fetch, i = t.AsyncStorage;
}
return function (e, t, n) {
t && r(e.prototype, t), n && r(e, n);
}(e, [{
key: "init",
value: function (e) {
var t = this,
r = e.environmentID,
n = e.api,
o = void 0 === n ? s : n,
u = e.onChange,
a = e.disableCache,
c = e.onError,
l = e.defaultFlags,
f = e.preventFetch,
h = e.state;
return new Promise(function (e, n) {
if (t.environmentID = r, t.api = o, t.interval = null, t.disableCache = a, t.onChange = u, t.onError = c, t.flags = Object.assign({}, l) || {}, t.initialised = !0, t.setState(h), !r) throw n("Please specify a environment id"), "Please specify a environment id";
a || i.getItem("BULLET_TRAIN_DB", function (r, o) {
t.flags = o ? JSON.parse(o) : l, t.flags && t.onChange && t.onChange(null, {
isFromServer: !1
}), f || t.getFlags(e, n);
});
});
}
}, {
key: "getAllFlags",
value: function () {
return this.flags;
}
}, {
key: "identify",
value: function (e) {
this.identity = e, this.initialised && !this.interval && this.getFlags();
}
}, {
key: "getState",
value: function () {
return {
api: this.api,
environmentID: this.environmentID,
flags: this.flags,
identity: this.identity,
segments: this.segments,
traits: this.traits
};
}
}, {
key: "setState",
value: function (e) {
e && (this.initialised = !0, this.api = e.api || this.api || s, this.environmentID = e.environmentID || this.environmentID, this.flags = e.flags || this.flags, this.identity = e.identity || this.identity, this.segments = e.segments || this.segments, this.traits = e.traits || this.traits);
}
}, {
key: "logout",
value: function () {
this.identity = null, this.segments = null, this.traits = null, this.initialised && !this.interval && this.getFlags();
}
}, {
key: "startListening",
value: function () {
var e = 0 < arguments.length && void 0 !== arguments[0] ? arguments[0] : 1e3;
this.interval || (this.interval = setInterval(this.getFlags, e));
}
}, {
key: "getSegments",
value: function () {}
}, {
key: "stopListening",
value: function () {
clearInterval(this.interval);
}
}]), e;
}();
e.exports = function (e) {
var t = e.fetch,
r = e.AsyncStorage;
return new u({
fetch: t,
AsyncStorage: r
});
};
}]);
});
{
"name": "bullet-train-client",
"version": "0.0.83",
"version": "0.0.84",
"description": "Feature flagging to support continuous development",

@@ -5,0 +5,0 @@ "main": "./index.js",

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc