beaver-logger
Advanced tools
Comparing version 4.0.5 to 4.0.6
@@ -1,3 +0,3 @@ | ||
!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define("beaver",[],t):"object"==typeof exports?exports.beaver=t():e.beaver=t()}("undefined"!=typeof self?self:this,function(){return function(e){var t={};function n(r){if(t[r])return t[r].exports;var o=t[r]={i:r,l:!1,exports:{}};return e[r].call(o.exports,o,o.exports,n),o.l=!0,o.exports}return n.m=e,n.c=t,n.d=function(e,t,r){n.o(e,t)||Object.defineProperty(e,t,{configurable:!1,enumerable:!0,get:r})},n.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return n.d(t,"a",t),t},n.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},n.p="",n(n.s=5)}([function(e,t,n){"use strict";t.a=function(){if("undefined"!=typeof window)return window;if("undefined"!=typeof window)return window;if("undefined"!=typeof global)return global;throw new Error("No global found")},t.b=function(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:[];if(e.__memoized__||(e.__memoized__=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n={};function r(){for(var o=arguments.length,i=Array(o),u=0;u<o;u++)i[u]=arguments[u];var s=void 0;try{s=JSON.stringify(Array.prototype.slice.call(arguments))}catch(e){throw new Error("Arguments not serializable -- can not be used to memoize")}var c=t.time;if(n[s]&&c&&Date.now()-n[s].time<c&&delete n[s],n[s])return n[s].value;r.__calling__=!0;var a=Date.now(),f=e.apply(this,arguments);return r.__calling__=!1,n[s]={time:a,value:f},n[s].value}return r.reset=function(){n={}},r}(t)),e.__memoized__&&e.__memoized__.__calling__)throw new Error("Can not call memoized method recursively");return e.__memoized__.apply(e,n)},t.c=function(){},t.j=function(){var e="0123456789abcdef";return"xxxxxxxxxx".replace(/./g,function(){return e.charAt(Math.floor(Math.random()*e.length))})+"_"+o((new Date).toISOString().slice(11,19).replace("T",".")).replace(/[^a-zA-Z0-9]/g,"").toLowerCase()},t.f=function(e,t,n){var r=[];return e.replace(t,function(e){r.push(n?n.apply(null,arguments):e)}),r},t.i=function(e){return"data:image/svg+xml;base64,"+o(e)},t.d=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:Boolean,n={};for(var r in e)e.hasOwnProperty(r)&&t(e[r],r)&&(n[r]=e[r]);return n},t.g=function(e,t){var n=[];return e.replace(t,function(e){return n.push(e),""}),n},t.e=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:50,n=void 0,o=void 0;return function(){o&&clearTimeout(o);var i=n=n||new r.a;return o=setTimeout(function(){n=null,o=null,r.a.try(e).then(function(e){i.resolve(e)},function(e){i.reject(e)})},t),i}},t.h=function(e,t){var n=void 0;return function r(){n=setTimeout(function(){e(),r()},t)}(),{cancel:function(){clearTimeout(n)}}};var r=n(1);function o(e){return window.btoa(e)}"function"==typeof Symbol&&Symbol.iterator},function(e,t,n){"use strict";function r(e){try{if(!e)return!1;if("undefined"!=typeof Promise&&e instanceof Promise)return!0;if("undefined"!=typeof window&&window.Window&&e instanceof window.Window)return!1;if("undefined"!=typeof window&&window.constructor&&e instanceof window.constructor)return!1;var t={}.toString;if(t){var n=t.call(e);if("[object Window]"===n||"[object global]"===n||"[object DOMWindow]"===n)return!1}if("function"==typeof e.then)return!0}catch(e){return!1}return!1}function o(){var e=void 0;if("undefined"!=typeof window)e=window;else{if("undefined"==typeof window)throw new TypeError("Can not find global");e=window}var t=e.__zalgopromise__=e.__zalgopromise__||{};return t.flushPromises=t.flushPromises||[],t.activeCount=t.activeCount||0,t.possiblyUnhandledPromiseHandlers=t.possiblyUnhandledPromiseHandlers||[],t.dispatchedErrors=t.dispatchedErrors||[],t}var i=function(){function e(t){var n=this;if(function(t,n){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this),this.resolved=!1,this.rejected=!1,this.errorHandled=!1,this.handlers=[],t){var r=void 0,o=void 0,i=!1,u=!1,s=!1;try{t(function(e){s?n.resolve(e):(i=!0,r=e)},function(e){s?n.reject(e):(u=!0,o=e)})}catch(e){return void this.reject(e)}s=!0,i?this.resolve(r):u&&this.reject(o)}}return e.prototype.resolve=function(e){if(this.resolved||this.rejected)return this;if(r(e))throw new Error("Can not resolve promise with another promise");return this.resolved=!0,this.value=e,this.dispatch(),this},e.prototype.reject=function(e){var t=this;if(this.resolved||this.rejected)return this;if(r(e))throw new Error("Can not reject promise with another promise");if(!e){var n=e&&"function"==typeof e.toString?e.toString():Object.prototype.toString.call(e);e=new Error("Expected reject to be called with Error, got "+n)}return this.rejected=!0,this.error=e,this.errorHandled||setTimeout(function(){t.errorHandled||function(e,t){if(-1===o().dispatchedErrors.indexOf(e)){o().dispatchedErrors.push(e),setTimeout(function(){throw e},1);for(var n=0;n<o().possiblyUnhandledPromiseHandlers.length;n++)o().possiblyUnhandledPromiseHandlers[n](e,t)}}(e,t)},1),this.dispatch(),this},e.prototype.asyncReject=function(e){this.errorHandled=!0,this.reject(e)},e.prototype.dispatch=function(){var t=this,n=this.dispatching,i=this.resolved,u=this.rejected,s=this.handlers;if(!n&&(i||u)){this.dispatching=!0,o().activeCount+=1;for(var c=function(n){var o=s[n],c=o.onSuccess,a=o.onError,f=o.promise,l=void 0;if(i)try{l=c?c(t.value):t.value}catch(e){return f.reject(e),"continue"}else if(u){if(!a)return f.reject(t.error),"continue";try{l=a(t.error)}catch(e){return f.reject(e),"continue"}}l instanceof e&&(l.resolved||l.rejected)?(l.resolved?f.resolve(l.value):f.reject(l.error),l.errorHandled=!0):r(l)?l instanceof e&&(l.resolved||l.rejected)?l.resolved?f.resolve(l.value):f.reject(l.error):l.then(function(e){f.resolve(e)},function(e){f.reject(e)}):f.resolve(l)},a=0;a<s.length;a++)c(a);s.length=0,this.dispatching=!1,o().activeCount-=1,0===o().activeCount&&e.flushQueue()}},e.prototype.then=function(t,n){if(t&&"function"!=typeof t&&!t.call)throw new Error("Promise.then expected a function for success handler");if(n&&"function"!=typeof n&&!n.call)throw new Error("Promise.then expected a function for error handler");var r=new e;return this.handlers.push({promise:r,onSuccess:t,onError:n}),this.errorHandled=!0,this.dispatch(),r},e.prototype.catch=function(e){return this.then(void 0,e)},e.prototype.finally=function(t){if(t&&"function"!=typeof t&&!t.call)throw new Error("Promise.finally expected a function");return this.then(function(n){return e.try(t).then(function(){return n})},function(n){return e.try(t).then(function(){throw n})})},e.prototype.timeout=function(e,t){var n=this;if(this.resolved||this.rejected)return this;var r=setTimeout(function(){n.resolved||n.rejected||n.reject(t||new Error("Promise timed out after "+e+"ms"))},e);return this.then(function(e){return clearTimeout(r),e})},e.prototype.toPromise=function(){if("undefined"==typeof Promise)throw new TypeError("Could not find Promise");return Promise.resolve(this)},e.resolve=function(t){return t instanceof e?t:r(t)?new e(function(e,n){return t.then(e,n)}):(new e).resolve(t)},e.reject=function(t){return(new e).reject(t)},e.all=function(t){var n=new e,o=t.length,i=[];if(!o)return n.resolve(i),n;for(var u=function(u){var s=t[u];if(s instanceof e){if(s.resolved)return i[u]=s.value,o-=1,"continue"}else if(!r(s))return i[u]=s,o-=1,"continue";e.resolve(s).then(function(e){i[u]=e,0==(o-=1)&&n.resolve(i)},function(e){n.reject(e)})},s=0;s<t.length;s++)u(s);return 0===o&&n.resolve(i),n},e.hash=function(t){var n={};return e.all(Object.keys(t).map(function(r){return e.resolve(t[r]).then(function(e){n[r]=e})})).then(function(){return n})},e.map=function(t,n){return e.all(t.map(n))},e.onPossiblyUnhandledException=function(e){return function(e){return o().possiblyUnhandledPromiseHandlers.push(e),{cancel:function(){o().possiblyUnhandledPromiseHandlers.splice(o().possiblyUnhandledPromiseHandlers.indexOf(e),1)}}}(e)},e.try=function(t,n,r){if(t&&"function"!=typeof t&&!t.call)throw new Error("Promise.try expected a function");var o=void 0;try{o=t.apply(n,r||[])}catch(t){return e.reject(t)}return e.resolve(o)},e.delay=function(t){return new e(function(e){setTimeout(e,t)})},e.isPromise=function(t){return!!(t&&t instanceof e)||r(t)},e.flush=function(){var t=new e;return o().flushPromises.push(t),0===o().activeCount&&e.flushQueue(),t},e.flushQueue=function(){var e=o().flushPromises;o().flushPromises=[];for(var t=0,n=null==e?0:e.length;t<n;t++)e[t].resolve()},e}();n.d(t,"a",function(){return i})},function(e,t,n){"use strict";t.a=function(){return!!(window.navigator.mockUserAgent||window.navigator.userAgent).match(/Android|webOS|iPhone|iPad|iPod|bada|Symbian|Palm|CriOS|BlackBerry|IEMobile|WindowsMobile|Opera Mini/i)}},function(e,t,n){"use strict";n(1);var r=n(0);n(2),t.a=function(){return"undefined"!=typeof window},t.b=function e(){return Object(r.b)(e,function(){try{if("undefined"==typeof window)return!1;if(window.localStorage){var e=Math.random().toString();window.localStorage.setItem("__test__localStorage__",e);var t=window.localStorage.getItem("__test__localStorage__");if(window.localStorage.removeItem("__test__localStorage__"),e===t)return!0}}catch(e){}return!1})}},function(e,t,n){"use strict";t.a=function e(t){var n=t.name,i=t.version,u=void 0===i?"latest":i,s=t.lifetime,c=void 0===s?3e5:s;return Object(r.b)(e,function(){var e="__"+n+"_"+u+"_storage__",t=void 0;function i(n){var i=Object(o.b)(),u=void 0;if(t&&(u=t),!u&&i){var s=window.localStorage.getItem(e);s&&(u=JSON.parse(s))}u||(u=Object(r.a)()[e]),u||(u={id:Object(r.j)()}),u.id||(u.id=Object(r.j)()),t=u;var c=n(u);return i?window.localStorage.setItem(e,JSON.stringify(u)):Object(r.a)()[e]=u,t=null,c}function s(e){return i(function(t){var n=t.__session__,o=Date.now();return n&&o-n.created>c&&(n=null),n||(n={guid:Object(r.j)(),created:o}),t.__session__=n,e(n)})}return{getState:i,getID:function(){return i(function(e){return e.id})},getSessionState:function(e){return s(function(t){return t.state=t.state||{},e(t.state)})},getSessionID:function(){return s(function(e){return e.guid})}}},[{name:n,version:u,lifetime:c}])};var r=n(0),o=n(3)},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=n(1),o=n(6),i={DEBUG:"debug",INFO:"info",WARN:"warn",ERROR:"error"},u=[i.WARN,i.ERROR],s=[i.ERROR,i.WARN,i.INFO,i.DEBUG],c=6e4,a=i.WARN,f=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e};function l(e){var t=e.url,n=e.method,r=e.headers,i=e.json;return Object(o.request)({url:t,method:n,headers:r,json:i}).then(o.noop)}function d(e,t){for(var n in t)t.hasOwnProperty(n)&&t[n]&&(e[n]=t[n])}function h(e){var t=e.url,n=e.prefix,h=e.logLevel,p=void 0===h?a:h,v=e.transport,w=void 0===v?l:v,y=e.flushInterval,g=void 0===y?c:y,m=[],b=[],_=[],j=[],O=[],E=[];function P(e,t,n){if(Object(o.isBrowser)()&&window.console&&window.console.log){var r=p;if(window.LOG_LEVEL&&-1!==s.indexOf(window.LOG_LEVEL)&&(r=window.LOG_LEVEL),!(s.indexOf(e)>s.indexOf(r))){var i=[t];i.push(n),(n.error||n.warning)&&i.push("\n\n",n.error||n.warning);try{window.console[e]&&window.console[e].apply?window.console[e].apply(window.console,i):window.console.log&&window.console.log.apply&&window.console.log.apply(window.console,i)}catch(e){}}}}function T(){return r.a.try(function(){if(Object(o.isBrowser)()&&(m.length||b.length)){for(var e={},n=0,r=null==j?0:j.length;n<r;n++)d(e,(0,j[n])(e));for(var i={},u=0,s=null==E?0:E.length;u<s;u++)d(i,(0,E[u])(i));var c=w({method:"POST",url:t,headers:i,json:{events:m,meta:e,tracking:b}});return m=[],b=[],c.then(o.noop)}})}var S=Object(o.promiseDebounce)(T);function x(e,t){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};if(Object(o.isBrowser)()){n&&(t=n+"_"+t);for(var i=f({},Object(o.objFilter)(r),{timestamp:Date.now().toString()}),s=0,c=null==_?0:_.length;s<c;s++)d(i,(0,_[s])(i));!function(e,t,n){m.push({level:e,event:t,payload:n}),-1!==u.indexOf(e)&&S()}(e,t,i),P(e,t,i)}}return Object(o.isBrowser)()&&Object(o.safeInterval)(S,g),{debug:function(e,t){x(i.DEBUG,e,t)},info:function(e,t){x(i.INFO,e,t)},warn:function(e,t){x(i.WARN,e,t)},error:function(e,t){x(i.ERROR,e,t)},track:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};if(Object(o.isBrowser)()){for(var t=Object(o.objFilter)(e),n=0,r=null==O?0:O.length;n<r;n++)d(t,(0,O[n])(t));P(i.DEBUG,"track",t),b.push(t)}},flush:S,immediateFlush:T,addPayloadBuilder:function(e){_.push(e)},addMetaBuilder:function(e){j.push(e)},addTrackingBuilder:function(e){O.push(e)},addHeaderBuilder:function(e){E.push(e)},setTransport:function(e){w=e}}}n.d(t,"Logger",function(){return h}),n.d(t,"LOG_LEVEL",function(){return i})},function(e,t,n){"use strict";n(2);var r=n(3);n.d(t,"isBrowser",function(){return r.a}),n(7),n(8),n(9),n(4);var o=n(0);n.d(t,"noop",function(){return o.c}),n.d(t,"objFilter",function(){return o.d}),n.d(t,"promiseDebounce",function(){return o.e}),n.d(t,"safeInterval",function(){return o.h});var i=n(10);n.d(t,"request",function(){return i.a});var u=n(14);n.n(u)},function(e,t,n){"use strict";n(0),n(4)},function(e,t,n){"use strict";n(0)},function(e,t,n){"use strict";function r(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function o(){return(arguments.length>0&&void 0!==arguments[0]?arguments[0]:"").toString().replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""").replace(/'/g,"'").replace(/\//g,"/")}n(0),Object.assign,function(e){function t(n){return r(this,t),function(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}(this,e.call(this,"",{},n))}(function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)})(t,e),t.prototype.toString=function(){return this.childrenToString()}}(function(){function e(t,n,o){r(this,e),this.name=t,this.props=n,this.children=o}return e.prototype.toString=function(){var e=this.name,t=this.propsToString(),n=this.childrenToString();return"<"+e+(t?" ":"")+t+">"+n+"</"+e+">"},e.prototype.propsToString=function(){var e=this.props;return e?Object.keys(e).filter(function(t){return"innerHTML"!==t&&e&&!1!==e[t]}).map(function(t){if(e){var n=e[t];if(!0===n)return""+o(t);if("string"==typeof n)return o(t)+'="'+o(n)+'"'}return""}).filter(Boolean).join(" "):""},e.prototype.childrenToString=function(){if(this.props&&this.props.innerHTML)return this.props.innerHTML;if(!this.children)return"";var t="";return function n(r){for(var i=0,u=null==r?0:r.length;i<u;i++){var s=r[i];null!==s&&void 0!==s&&(Array.isArray(s)?n(s):t+=s instanceof e?s.toString():o(s))}}(this.children),t},e}())},function(e,t,n){"use strict";t.a=function(e){var t=e.url,n=e.method,u=void 0===n?"get":n,s=e.headers,c=void 0===s?{}:s,a=e.json,f=e.data,l=e.body,d=e.win,h=void 0===d?window:d,p=e.timeout,v=void 0===p?0:p;return new r.a(function(e,n){if(a&&f||a&&l||f&&a)throw new Error("Only options.json or options.data or options.body should be passed");for(var r={},s=0,d=Object.keys(c),p=null==d?0:d.length;s<p;s++){var w=d[s];r[w.toLowerCase()]=c[w]}a?r[o.CONTENT_TYPE]=r[o.CONTENT_TYPE]||"application/json":(f||l)&&(r[o.CONTENT_TYPE]=r[o.CONTENT_TYPE]||"application/x-www-form-urlencoded; charset=utf-8"),r[o.ACCEPT]=r[o.ACCEPT]||"application/json";for(var y=0,g=null==i?0:i.length;y<g;y++)for(var m=(0,i[y])(),b=0,_=Object.keys(m),j=null==_?0:_.length;b<j;b++){var O=_[b];r[O.toLowerCase()]=m[O]}var E=new h.XMLHttpRequest;for(var P in E.addEventListener("load",function(){var r=function(){for(var e={},t=0,n=(arguments.length>0&&void 0!==arguments[0]?arguments[0]:"").trim().split("\n"),r=null==n?0:n.length;t<r;t++){var o=n[t].split(":"),i=o[0],u=o.slice(1);e[i.toLowerCase()]=u.join(":").trim()}return e}(this.getAllResponseHeaders());if(!this.status)return n(new Error("Request to "+u.toLowerCase()+" "+t+" failed: no response status code."));var o=r["content-type"],i=o&&(0===o.indexOf("application/json")||0===o.indexOf("text/json")),s=this.responseText;try{s=JSON.parse(s)}catch(e){if(i)return n(new Error("Invalid json: "+this.responseText+"."))}var c={status:this.status,headers:r,body:s};return e(c)},!1),E.addEventListener("error",function(e){n(new Error("Request to "+u.toLowerCase()+" "+t+" failed: "+e.toString()+"."))},!1),E.open(u,t,!0),r)r.hasOwnProperty(P)&&E.setRequestHeader(P,r[P]);a?l=JSON.stringify(a):f&&(l=Object.keys(f).map(function(e){return encodeURIComponent(e)+"="+(f?encodeURIComponent(f[e]):"")}).join("&")),E.timeout=v,E.ontimeout=function(){n(new Error("Request to "+u.toLowerCase()+" "+t+" has timed out"))},E.send(l)})};var r=n(1),o=(n(11),{CONTENT_TYPE:"content-type",ACCEPT:"accept"}),i=[]},function(e,t,n){"use strict";n(12);var r=n(13);n.n(r)},function(e,t,n){"use strict"},function(e,t){},function(e,t){}])}); | ||
!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define("beaver",[],t):"object"==typeof exports?exports.beaver=t():e.beaver=t()}("undefined"!=typeof self?self:this,function(){return function(e){var t={};function n(r){if(t[r])return t[r].exports;var o=t[r]={i:r,l:!1,exports:{}};return e[r].call(o.exports,o,o.exports,n),o.l=!0,o.exports}return n.m=e,n.c=t,n.d=function(e,t,r){n.o(e,t)||Object.defineProperty(e,t,{configurable:!1,enumerable:!0,get:r})},n.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return n.d(t,"a",t),t},n.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},n.p="",n(n.s=7)}([function(e,t,n){"use strict";t.q=c,t.d=function(){if("undefined"!=typeof window)return window;if("undefined"!=typeof window)return window;if("undefined"!=typeof global)return global;throw new Error("No global found")},t.f=function(e){var t=this,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},r=new o.a;function i(){for(var t=arguments.length,o=Array(t),a=0;a<t;a++)o[a]=arguments[a];var c=r.getOrSet(n.thisNamespace?this:e,function(){return{}}),u=s(o),f=n.time;if(c[u]&&f&&Date.now()-c[u].time<f&&delete c[u],c[u])return c[u].value;i.__calling__=!0;var l=Date.now(),d=e.apply(this,arguments);return i.__calling__=!1,c[u]={time:l,value:d},c[u].value}return i.reset=function(){r.delete(n.thisNamespace?t:e)},n.name&&(i.displayName=n.name+":memoized"),i},t.k=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};function n(){return r.a.try(e,this,arguments)}return t.name&&(n.displayName=t.name+":promisified"),n},t.e=function(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:[],r=e.__inline_memoize_cache__=e.__inline_memoize_cache__||{},o=s(n);return r.hasOwnProperty(o)?r[o]:r[o]=t.apply(void 0,n)},t.g=function(){},t.i=function(e){var t=!1;return function(){if(!t)return t=!0,e.apply(this,arguments)}},t.o=function(e){return"string"==typeof e?e:e&&"function"==typeof e.toString?e.toString():Object.prototype.toString.call(e)},t.c=function(e,t){if(!t)return e;if(Object.assign)return Object.assign(e,t);for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n]);return e},t.l=function(e,t,n){var r=[];return e.replace(t,function(e){r.push(n?n.apply(null,arguments):e)}),r},t.p=function(e){return"data:image/svg+xml;base64,"+a(e)},t.h=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:Boolean,n={};for(var r in e)e.hasOwnProperty(r)&&t(e[r],r)&&(n[r]=e[r]);return n},t.m=function(e,t){var n=[];return e.replace(t,function(e){return n.push(e),""}),n},t.j=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:50,n=void 0,o=void 0;return function(){o&&clearTimeout(o);var i=n=n||new r.a;return o=setTimeout(function(){n=null,o=null,r.a.try(e).then(function(e){i.resolve(e)},function(e){i.reject(e)})},t),i}},t.n=function(e,t){var n=void 0;return function r(){n=setTimeout(function(){e(),r()},t)}(),{cancel:function(){clearTimeout(n)}}},t.a=function(e){return e.charAt(0).toUpperCase()+e.slice(1).toLowerCase()},t.b=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:100,n=void 0;return function(){var r=this,o=arguments;clearTimeout(n),n=setTimeout(function(){return e.apply(r,o)},t)}};var r=n(1),o=n(5),i="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e};function a(e){return window.btoa(e)}function c(){var e="0123456789abcdef";return"xxxxxxxxxx".replace(/./g,function(){return e.charAt(Math.floor(Math.random()*e.length))})+"_"+a((new Date).toISOString().slice(11,19).replace("T",".")).replace(/[^a-zA-Z0-9]/g,"").toLowerCase()}var u=void 0;function s(e){try{return JSON.stringify(Array.prototype.slice.call(e),function(e,t){return"function"==typeof t?"memoize["+function(e){if(u=u||new o.a,null===e||void 0===e||"object"!==(void 0===e?"undefined":i(e))&&"function"!=typeof e)throw new Error("Invalid object");var t=u.get(e);return t||(t=(void 0===e?"undefined":i(e))+":"+c(),u.set(e,t)),t}(t)+"]":t})}catch(e){throw new Error("Arguments not serializable -- can not be used to memoize")}}},function(e,t,n){"use strict";function r(e){try{if(!e)return!1;if("undefined"!=typeof Promise&&e instanceof Promise)return!0;if("undefined"!=typeof window&&window.Window&&e instanceof window.Window)return!1;if("undefined"!=typeof window&&window.constructor&&e instanceof window.constructor)return!1;var t={}.toString;if(t){var n=t.call(e);if("[object Window]"===n||"[object global]"===n||"[object DOMWindow]"===n)return!1}if("function"==typeof e.then)return!0}catch(e){return!1}return!1}function o(){var e=void 0;if("undefined"!=typeof window)e=window;else{if("undefined"==typeof window)throw new TypeError("Can not find global");e=window}var t=e.__zalgopromise__=e.__zalgopromise__||{};return t.flushPromises=t.flushPromises||[],t.activeCount=t.activeCount||0,t.possiblyUnhandledPromiseHandlers=t.possiblyUnhandledPromiseHandlers||[],t.dispatchedErrors=t.dispatchedErrors||[],t}var i=function(){function e(t){var n=this;if(function(t,n){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this),this.resolved=!1,this.rejected=!1,this.errorHandled=!1,this.handlers=[],t){var r=void 0,o=void 0,i=!1,a=!1,c=!1;try{t(function(e){c?n.resolve(e):(i=!0,r=e)},function(e){c?n.reject(e):(a=!0,o=e)})}catch(e){return void this.reject(e)}c=!0,i?this.resolve(r):a&&this.reject(o)}}return e.prototype.resolve=function(e){if(this.resolved||this.rejected)return this;if(r(e))throw new Error("Can not resolve promise with another promise");return this.resolved=!0,this.value=e,this.dispatch(),this},e.prototype.reject=function(e){var t=this;if(this.resolved||this.rejected)return this;if(r(e))throw new Error("Can not reject promise with another promise");if(!e){var n=e&&"function"==typeof e.toString?e.toString():Object.prototype.toString.call(e);e=new Error("Expected reject to be called with Error, got "+n)}return this.rejected=!0,this.error=e,this.errorHandled||setTimeout(function(){t.errorHandled||function(e,t){if(-1===o().dispatchedErrors.indexOf(e)){o().dispatchedErrors.push(e),setTimeout(function(){throw e},1);for(var n=0;n<o().possiblyUnhandledPromiseHandlers.length;n++)o().possiblyUnhandledPromiseHandlers[n](e,t)}}(e,t)},1),this.dispatch(),this},e.prototype.asyncReject=function(e){this.errorHandled=!0,this.reject(e)},e.prototype.dispatch=function(){var t=this,n=this.dispatching,i=this.resolved,a=this.rejected,c=this.handlers;if(!n&&(i||a)){this.dispatching=!0,o().activeCount+=1;for(var u=function(n){var o=c[n],u=o.onSuccess,s=o.onError,f=o.promise,l=void 0;if(i)try{l=u?u(t.value):t.value}catch(e){return f.reject(e),"continue"}else if(a){if(!s)return f.reject(t.error),"continue";try{l=s(t.error)}catch(e){return f.reject(e),"continue"}}l instanceof e&&(l.resolved||l.rejected)?(l.resolved?f.resolve(l.value):f.reject(l.error),l.errorHandled=!0):r(l)?l instanceof e&&(l.resolved||l.rejected)?l.resolved?f.resolve(l.value):f.reject(l.error):l.then(function(e){f.resolve(e)},function(e){f.reject(e)}):f.resolve(l)},s=0;s<c.length;s++)u(s);c.length=0,this.dispatching=!1,o().activeCount-=1,0===o().activeCount&&e.flushQueue()}},e.prototype.then=function(t,n){if(t&&"function"!=typeof t&&!t.call)throw new Error("Promise.then expected a function for success handler");if(n&&"function"!=typeof n&&!n.call)throw new Error("Promise.then expected a function for error handler");var r=new e;return this.handlers.push({promise:r,onSuccess:t,onError:n}),this.errorHandled=!0,this.dispatch(),r},e.prototype.catch=function(e){return this.then(void 0,e)},e.prototype.finally=function(t){if(t&&"function"!=typeof t&&!t.call)throw new Error("Promise.finally expected a function");return this.then(function(n){return e.try(t).then(function(){return n})},function(n){return e.try(t).then(function(){throw n})})},e.prototype.timeout=function(e,t){var n=this;if(this.resolved||this.rejected)return this;var r=setTimeout(function(){n.resolved||n.rejected||n.reject(t||new Error("Promise timed out after "+e+"ms"))},e);return this.then(function(e){return clearTimeout(r),e})},e.prototype.toPromise=function(){if("undefined"==typeof Promise)throw new TypeError("Could not find Promise");return Promise.resolve(this)},e.resolve=function(t){return t instanceof e?t:r(t)?new e(function(e,n){return t.then(e,n)}):(new e).resolve(t)},e.reject=function(t){return(new e).reject(t)},e.all=function(t){var n=new e,o=t.length,i=[];if(!o)return n.resolve(i),n;for(var a=function(a){var c=t[a];if(c instanceof e){if(c.resolved)return i[a]=c.value,o-=1,"continue"}else if(!r(c))return i[a]=c,o-=1,"continue";e.resolve(c).then(function(e){i[a]=e,0==(o-=1)&&n.resolve(i)},function(e){n.reject(e)})},c=0;c<t.length;c++)a(c);return 0===o&&n.resolve(i),n},e.hash=function(t){var n={};return e.all(Object.keys(t).map(function(r){return e.resolve(t[r]).then(function(e){n[r]=e})})).then(function(){return n})},e.map=function(t,n){return e.all(t.map(n))},e.onPossiblyUnhandledException=function(e){return function(e){return o().possiblyUnhandledPromiseHandlers.push(e),{cancel:function(){o().possiblyUnhandledPromiseHandlers.splice(o().possiblyUnhandledPromiseHandlers.indexOf(e),1)}}}(e)},e.try=function(t,n,r){if(t&&"function"!=typeof t&&!t.call)throw new Error("Promise.try expected a function");var o=void 0;try{o=t.apply(n,r||[])}catch(t){return e.reject(t)}return e.resolve(o)},e.delay=function(t){return new e(function(e){setTimeout(e,t)})},e.isPromise=function(t){return!!(t&&t instanceof e)||r(t)},e.flush=function(){var t=new e;return o().flushPromises.push(t),0===o().activeCount&&e.flushQueue(),t},e.flushQueue=function(){var e=o().flushPromises;o().flushPromises=[];for(var t=0,n=null==e?0:e.length;t<n;t++)e[t].resolve()},e}();n.d(t,"a",function(){return i})},function(e,t,n){"use strict";n(1),n(3),n(5);var r=n(0);n(4),t.c=function(){return"undefined"!=typeof window},t.d=function e(){return Object(r.e)(e,function(){try{if("undefined"==typeof window)return!1;if(window.localStorage){var e=Math.random().toString();window.localStorage.setItem("__test__localStorage__",e);var t=window.localStorage.getItem("__test__localStorage__");if(window.localStorage.removeItem("__test__localStorage__"),e===t)return!0}}catch(e){}return!1})},t.a=function(e,t){e.appendChild(t)},t.g=function(e,t){try{e.document.open(),e.document.write(t),e.document.close()}catch(n){try{e.location="javascript: document.open(); document.write("+JSON.stringify(t)+"); document.close();"}catch(e){}}},t.f=function(e,t){var n=t.tagName.toLowerCase();if("html"!==n)throw new Error("Expected element to be html, got "+n);for(var r=e.document.documentElement;r.children&&r.children.length;)r.removeChild(r.children[0]);for(;t.children.length;)r.appendChild(t.children[0])},t.e=function(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:window.document;e.styleSheet?e.styleSheet.cssText=t:e.appendChild(n.createTextNode(t))},t.b=function(e){for(var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:window.document,n=0,r=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:window.document;return Array.prototype.slice.call(t.querySelectorAll(e))}("script",e),o=null==r?0:r.length;n<o;n++){var i=r[n],a=i.parentNode;if(a){var c=t.createElement("script");c.text=i.textContent,a.replaceChild(c,i)}}},"function"==typeof Symbol&&Symbol.iterator,Object.assign,Object.create(Error.prototype)},function(e,t,n){"use strict";var r=n(9);n.d(t,"isWindow",function(){return r.a}),n.d(t,"isWindowClosed",function(){return r.b}),n.d(t,"linkFrameWindow",function(){return r.c});var o=n(10);n.n(o)},function(e,t,n){"use strict";t.a=function(){return!!(window.navigator.mockUserAgent||window.navigator.userAgent).match(/Android|webOS|iPhone|iPad|iPod|bada|Symbian|Palm|CriOS|BlackBerry|IEMobile|WindowsMobile|Opera Mini/i)}},function(e,t,n){"use strict";n.d({},"WeakMap",function(){return c});var r=n(3);function o(e,t){for(var n=0;n<e.length;n++)try{if(e[n]===t)return n}catch(e){}return-1}var i=Object.defineProperty,a=Date.now()%1e9,c=function(){function e(){if(function(t,n){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this),a+=1,this.name="__weakmap_"+(1e9*Math.random()>>>0)+"__"+a,function(){if("undefined"==typeof WeakMap)return!1;if(void 0===Object.freeze)return!1;try{var e=new WeakMap,t={};return Object.freeze(t),e.set(t,"__testvalue__"),"__testvalue__"===e.get(t)}catch(e){return!1}}())try{this.weakmap=new WeakMap}catch(e){}this.keys=[],this.values=[]}return e.prototype._cleanupClosedWindows=function(){for(var e=this.weakmap,t=this.keys,n=0;n<t.length;n++){var o=t[n];if(Object(r.isWindow)(o)&&Object(r.isWindowClosed)(o)){if(e)try{e.delete(o)}catch(e){}t.splice(n,1),this.values.splice(n,1),n-=1}}},e.prototype.isSafeToReadWrite=function(e){if(Object(r.isWindow)(e))return!1;try{e&&e.self,e&&e[this.name]}catch(e){return!1}return!0},e.prototype.set=function(e,t){if(!e)throw new Error("WeakMap expected key");var n=this.weakmap;if(n)try{n.set(e,t)}catch(e){delete this.weakmap}if(this.isSafeToReadWrite(e)){var r=this.name,a=e[r];a&&a[0]===e?a[1]=t:i(e,r,{value:[e,t],writable:!0})}else{this._cleanupClosedWindows();var c=this.keys,u=this.values,s=o(c,e);-1===s?(c.push(e),u.push(t)):u[s]=t}},e.prototype.get=function(e){if(!e)throw new Error("WeakMap expected key");var t=this.weakmap;if(t)try{if(t.has(e))return t.get(e)}catch(e){delete this.weakmap}if(!this.isSafeToReadWrite(e)){this._cleanupClosedWindows();var n=o(this.keys,e);if(-1===n)return;return this.values[n]}var r=e[this.name];if(r&&r[0]===e)return r[1]},e.prototype.delete=function(e){if(!e)throw new Error("WeakMap expected key");var t=this.weakmap;if(t)try{t.delete(e)}catch(e){delete this.weakmap}if(this.isSafeToReadWrite(e)){var n=e[this.name];n&&n[0]===e&&(n[0]=n[1]=void 0)}else{this._cleanupClosedWindows();var r=this.keys,i=o(r,e);-1!==i&&(r.splice(i,1),this.values.splice(i,1))}},e.prototype.has=function(e){if(!e)throw new Error("WeakMap expected key");var t=this.weakmap;if(t)try{return t.has(e)}catch(e){delete this.weakmap}if(this.isSafeToReadWrite(e)){var n=e[this.name];return!(!n||n[0]!==e)}return this._cleanupClosedWindows(),-1!==o(this.keys,e)},e.prototype.getOrSet=function(e,t){if(this.has(e))return this.get(e);var n=t();return this.set(e,n),n},e}();n.d(t,"a",function(){return c})},function(e,t,n){"use strict";t.a=function e(t){var n=t.name,i=t.version,a=void 0===i?"latest":i,c=t.lifetime,u=void 0===c?3e5:c;return Object(r.e)(e,function(){var e="__"+n+"_"+a+"_storage__",t=void 0;function i(n){var i=Object(o.d)(),a=void 0;if(t&&(a=t),!a&&i){var c=window.localStorage.getItem(e);c&&(a=JSON.parse(c))}a||(a=Object(r.d)()[e]),a||(a={id:Object(r.q)()}),a.id||(a.id=Object(r.q)()),t=a;var u=n(a);return i?window.localStorage.setItem(e,JSON.stringify(a)):Object(r.d)()[e]=a,t=null,u}function c(e){return i(function(t){var n=t.__session__,o=Date.now();return n&&o-n.created>u&&(n=null),n||(n={guid:Object(r.q)(),created:o}),t.__session__=n,e(n)})}return{getState:i,getID:function(){return i(function(e){return e.id})},getSessionState:function(e){return c(function(t){return t.state=t.state||{},e(t.state)})},getSessionID:function(){return c(function(e){return e.guid})}}},[{name:n,version:a,lifetime:u}])};var r=n(0),o=n(2)},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=n(1),o=n(8),i={DEBUG:"debug",INFO:"info",WARN:"warn",ERROR:"error"},a=[i.WARN,i.ERROR],c=[i.ERROR,i.WARN,i.INFO,i.DEBUG],u=6e4,s=i.WARN,f=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e};function l(e){var t=e.url,n=e.method,r=e.headers,i=e.json;return Object(o.request)({url:t,method:n,headers:r,json:i}).then(o.noop)}function d(e,t){for(var n in t)t.hasOwnProperty(n)&&t[n]&&(e[n]=t[n])}function h(e){var t=e.url,n=e.prefix,h=e.logLevel,p=void 0===h?s:h,w=e.transport,v=void 0===w?l:w,y=e.flushInterval,m=void 0===y?u:y,g=[],O=[],b=[],_=[],j=[],E=[];function T(e,t,n){if(Object(o.isBrowser)()&&window.console&&window.console.log){var r=p;if(window.LOG_LEVEL&&-1!==c.indexOf(window.LOG_LEVEL)&&(r=window.LOG_LEVEL),!(c.indexOf(e)>c.indexOf(r))){var i=[t];i.push(n),(n.error||n.warning)&&i.push("\n\n",n.error||n.warning);try{window.console[e]&&window.console[e].apply?window.console[e].apply(window.console,i):window.console.log&&window.console.log.apply&&window.console.log.apply(window.console,i)}catch(e){}}}}function S(){return r.a.try(function(){if(Object(o.isBrowser)()&&(g.length||O.length)){for(var e={},n=0,r=null==_?0:_.length;n<r;n++)d(e,(0,_[n])(e));for(var i={},a=0,c=null==E?0:E.length;a<c;a++)d(i,(0,E[a])(i));var u=v({method:"POST",url:t,headers:i,json:{events:g,meta:e,tracking:O}});return g=[],O=[],u.then(o.noop)}})}var C=Object(o.promiseDebounce)(S);function P(e,t){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};if(Object(o.isBrowser)()){n&&(t=n+"_"+t);for(var i=f({},Object(o.objFilter)(r),{timestamp:Date.now().toString()}),c=0,u=null==b?0:b.length;c<u;c++)d(i,(0,b[c])(i));!function(e,t,n){g.push({level:e,event:t,payload:n}),-1!==a.indexOf(e)&&C()}(e,t,i),T(e,t,i)}}return Object(o.isBrowser)()&&Object(o.safeInterval)(C,m),{debug:function(e,t){P(i.DEBUG,e,t)},info:function(e,t){P(i.INFO,e,t)},warn:function(e,t){P(i.WARN,e,t)},error:function(e,t){P(i.ERROR,e,t)},track:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};if(Object(o.isBrowser)()){for(var t=Object(o.objFilter)(e),n=0,r=null==j?0:j.length;n<r;n++)d(t,(0,j[n])(t));T(i.DEBUG,"track",t),O.push(t)}},flush:C,immediateFlush:S,addPayloadBuilder:function(e){b.push(e)},addMetaBuilder:function(e){_.push(e)},addTrackingBuilder:function(e){j.push(e)},addHeaderBuilder:function(e){E.push(e)},setTransport:function(e){v=e}}}n.d(t,"Logger",function(){return h}),n.d(t,"LOG_LEVEL",function(){return i})},function(e,t,n){"use strict";n(4);var r=n(2);n.d(t,"isBrowser",function(){return r.c}),n(11),n(12),n(13),n(6);var o=n(0);n.d(t,"noop",function(){return o.g}),n.d(t,"objFilter",function(){return o.h}),n.d(t,"promiseDebounce",function(){return o.j}),n.d(t,"safeInterval",function(){return o.n});var i=n(14);n.d(t,"request",function(){return i.a});var a=n(15);n.n(a),n(16),n(17)},function(e,t,n){"use strict";t.b=d,t.c=function(e){if(function(){for(var e=0;e<l.length;e++)s(l[e])&&(l.splice(e,1),f.splice(e,1));for(var t=0;t<f.length;t++)d(f[t])&&(l.splice(t,1),f.splice(t,1))}(),e&&e.contentWindow)try{f.push(e.contentWindow),l.push(e)}catch(e){}},t.a=function(e){try{if(e===window)return!0}catch(e){if(e&&e.message===o)return!0}try{if("[object Window]"===Object.prototype.toString.call(e))return!0}catch(e){if(e&&e.message===o)return!0}try{if(window.Window&&e instanceof window.Window)return!0}catch(e){if(e&&e.message===o)return!0}try{if(e&&e.self===e)return!0}catch(e){if(e&&e.message===o)return!0}try{if(e&&e.parent===e)return!0}catch(e){if(e&&e.message===o)return!0}try{if(e&&e.top===e)return!0}catch(e){if(e&&e.message===o)return!0}try{e&&e.__cross_domain_utils_window_check__}catch(e){return!0}return!1};var r={MOCK_PROTOCOL:"mock:",FILE_PROTOCOL:"file:",ABOUT_PROTOCOL:"about:",WILDCARD:"*"},o="Call was rejected by callee.\r\n";function i(){return(arguments.length>0&&void 0!==arguments[0]?arguments[0]:window).location.protocol===r.ABOUT_PROTOCOL}function a(e){try{return e&&e.location&&e.location.href,!0}catch(e){}return!1}function c(e){var t=(e=e||window).location;if(!t)throw new Error("Can not read window location");var n=t.protocol;if(!n)throw new Error("Can not read window protocol");if(n===r.FILE_PROTOCOL)return r.FILE_PROTOCOL+"//";if(n===r.ABOUT_PROTOCOL){var o=function(e){if(e)try{if(e.parent&&e.parent!==e)return e.parent}catch(e){}}(e);return o&&a(o)?c(o):r.ABOUT_PROTOCOL+"//"}var i=t.host;if(!i)throw new Error("Can not read window host");return n+"//"+i}function u(e){var t=c(e=e||window);return t&&e.mockDomain&&0===e.mockDomain.indexOf(r.MOCK_PROTOCOL)?e.mockDomain:t}function s(e){if(!e.contentWindow)return!0;if(!e.parentNode)return!0;var t=e.ownerDocument;return!(!t||!t.documentElement||t.documentElement.contains(e))}var f=[],l=[];function d(e){var t=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];try{if(e===window)return!1}catch(e){return!0}try{if(!e)return!0}catch(e){return!0}try{if(e.closed)return!0}catch(e){return!e||e.message!==o}if(t&&function(e){if(!function(e){try{if(e===window)return!0}catch(e){}try{var t=Object.getOwnPropertyDescriptor(e,"location");if(t&&!1===t.enumerable)return!1}catch(e){}try{if(i(e)&&a(e))return!0}catch(e){}try{if(c(e)===c(window))return!0}catch(e){}return!1}(e))return!1;try{if(e===window)return!0;if(i(e)&&a(e))return!0;if(u(window)===u(e))return!0}catch(e){}return!1}(e))try{if(e.mockclosed)return!0}catch(e){}try{if(!e.parent||!e.top)return!0}catch(e){}var n=function(e,t){for(var n=0;n<e.length;n++)try{if(e[n]===t)return n}catch(e){}return-1}(f,e);if(-1!==n){var r=l[n];if(r&&s(r))return!0}return!1}},function(e,t){},function(e,t,n){"use strict";n(0),n(6)},function(e,t,n){"use strict";n(0)},function(e,t,n){"use strict";function r(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function o(){return(arguments.length>0&&void 0!==arguments[0]?arguments[0]:"").toString().replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""").replace(/'/g,"'").replace(/\//g,"/")}n(0),n(2),"function"==typeof Symbol&&Symbol.iterator,Object.assign,function(e){function t(n){return r(this,t),function(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}(this,e.call(this,"",{},n))}(function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)})(t,e),t.prototype.toString=function(){return this.childrenToString()}}(function(){function e(t,n,o){r(this,e),this.name=t,this.props=n,this.children=o}return e.prototype.toString=function(){var e=this.name,t=this.propsToString(),n=this.childrenToString();return"<"+e+(t?" ":"")+t+">"+n+"</"+e+">"},e.prototype.propsToString=function(){var e=this.props;return e?Object.keys(e).filter(function(t){return"innerHTML"!==t&&e&&!1!==e[t]}).map(function(t){if(e){var n=e[t];if(!0===n)return""+o(t);if("string"==typeof n)return o(t)+'="'+o(n)+'"'}return""}).filter(Boolean).join(" "):""},e.prototype.childrenToString=function(){if(this.props&&this.props.innerHTML)return this.props.innerHTML;if(!this.children)return"";var t="";return function n(r){for(var i=0,a=null==r?0:r.length;i<a;i++){var c=r[i];null!==c&&void 0!==c&&(Array.isArray(c)?n(c):t+=c instanceof e?c.toString():o(c))}}(this.children),t},e}())},function(e,t,n){"use strict";t.a=function(e){var t=e.url,n=e.method,a=void 0===n?"get":n,c=e.headers,u=void 0===c?{}:c,s=e.json,f=e.data,l=e.body,d=e.win,h=void 0===d?window:d,p=e.timeout,w=void 0===p?0:p;return new r.a(function(e,n){if(s&&f||s&&l||f&&s)throw new Error("Only options.json or options.data or options.body should be passed");for(var r={},c=0,d=Object.keys(u),p=null==d?0:d.length;c<p;c++){var v=d[c];r[v.toLowerCase()]=u[v]}s?r[o.CONTENT_TYPE]=r[o.CONTENT_TYPE]||"application/json":(f||l)&&(r[o.CONTENT_TYPE]=r[o.CONTENT_TYPE]||"application/x-www-form-urlencoded; charset=utf-8"),r[o.ACCEPT]=r[o.ACCEPT]||"application/json";for(var y=0,m=null==i?0:i.length;y<m;y++)for(var g=(0,i[y])(),O=0,b=Object.keys(g),_=null==b?0:b.length;O<_;O++){var j=b[O];r[j.toLowerCase()]=g[j]}var E=new h.XMLHttpRequest;for(var T in E.addEventListener("load",function(){var r=function(){for(var e={},t=0,n=(arguments.length>0&&void 0!==arguments[0]?arguments[0]:"").trim().split("\n"),r=null==n?0:n.length;t<r;t++){var o=n[t].split(":"),i=o[0],a=o.slice(1);e[i.toLowerCase()]=a.join(":").trim()}return e}(this.getAllResponseHeaders());if(!this.status)return n(new Error("Request to "+a.toLowerCase()+" "+t+" failed: no response status code."));var o=r["content-type"],i=o&&(0===o.indexOf("application/json")||0===o.indexOf("text/json")),c=this.responseText;try{c=JSON.parse(c)}catch(e){if(i)return n(new Error("Invalid json: "+this.responseText+"."))}var u={status:this.status,headers:r,body:c};return e(u)},!1),E.addEventListener("error",function(e){n(new Error("Request to "+a.toLowerCase()+" "+t+" failed: "+e.toString()+"."))},!1),E.open(a,t,!0),r)r.hasOwnProperty(T)&&E.setRequestHeader(T,r[T]);s?l=JSON.stringify(s):f&&(l=Object.keys(f).map(function(e){return encodeURIComponent(e)+"="+(f?encodeURIComponent(f[e]):"")}).join("&")),E.timeout=w,E.ontimeout=function(){n(new Error("Request to "+a.toLowerCase()+" "+t+" has timed out"))},E.send(l)})};var r=n(1),o=(n(3),{CONTENT_TYPE:"content-type",ACCEPT:"accept"}),i=[]},function(e,t){},function(e,t,n){"use strict";n(0)},function(e,t,n){"use strict"}])}); | ||
//# sourceMappingURL=beaver-logger.min.js.map | ||
//# sourceMappingURL=beaver-logger.min.js.map |
{ | ||
"name": "beaver-logger", | ||
"version": "4.0.5", | ||
"version": "4.0.6", | ||
"description": "Client side logger.", | ||
@@ -5,0 +5,0 @@ "main": "dist/beaver-logger.js", |
@@ -1,2 +0,5 @@ | ||
export var LOG_LEVEL = { | ||
'use strict'; | ||
exports.__esModule = true; | ||
const LOG_LEVEL = exports.LOG_LEVEL = { | ||
DEBUG: 'debug', | ||
@@ -8,3 +11,3 @@ INFO: 'info', | ||
export var HTTP_HEADER = { | ||
const HTTP_HEADER = exports.HTTP_HEADER = { | ||
ORIGIN: 'origin', | ||
@@ -18,3 +21,3 @@ ACCESS_CONTROL_ALLOW_ORIGIN: 'access-control-allow-origin', | ||
export var HTTP_METHOD = { | ||
const HTTP_METHOD = exports.HTTP_METHOD = { | ||
GET: 'get', | ||
@@ -25,2 +28,2 @@ POST: 'post', | ||
export var WILDCARD = '*'; | ||
const WILDCARD = exports.WILDCARD = '*'; |
@@ -1,1 +0,15 @@ | ||
export * from './server'; | ||
'use strict'; | ||
exports.__esModule = true; | ||
var _server = require('./server'); | ||
Object.keys(_server).forEach(function (key) { | ||
if (key === "default" || key === "__esModule") return; | ||
Object.defineProperty(exports, key, { | ||
enumerable: true, | ||
get: function () { | ||
return _server[key]; | ||
} | ||
}); | ||
}); |
@@ -0,16 +1,28 @@ | ||
'use strict'; | ||
exports.__esModule = true; | ||
exports.log = log; | ||
exports.handleRequest = handleRequest; | ||
exports.expressEndpoint = expressEndpoint; | ||
var _url = require('url'); | ||
var _url2 = _interopRequireDefault(_url); | ||
var _constants = require('./constants'); | ||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; } | ||
function _objectWithoutProperties(obj, keys) { var target = {}; for (var i in obj) { if (keys.indexOf(i) >= 0) continue; if (!Object.prototype.hasOwnProperty.call(obj, i)) continue; target[i] = obj[i]; } return target; } | ||
/* eslint no-console: 0 */ | ||
import url from 'url'; | ||
import { LOG_LEVEL, HTTP_HEADER, HTTP_METHOD, WILDCARD } from './constants'; // eslint-disable-line no-undef | ||
// eslint-disable-line no-undef | ||
// eslint-disable-line no-undef | ||
var defaultLogger = { | ||
log: function log(req, level, name, payload) { | ||
var date = payload.timestamp ? new Date(payload.timestamp).toString() : new Date().toString(); | ||
let defaultLogger = { | ||
log(req, level, name, payload) { | ||
let date = payload.timestamp ? new Date(payload.timestamp).toString() : new Date().toString(); | ||
var str = [name, '\t[ ', date, ' ]\n', Object.keys(payload).map(function (key) { | ||
return '\t' + key + ': ' + payload[key]; | ||
let str = [name, '\t[ ', date, ' ]\n', Object.keys(payload).map(key => { | ||
return `\t${key}: ${payload[key]}`; | ||
}).join('\n'), '\n'].join(''); | ||
@@ -20,32 +32,24 @@ | ||
}, | ||
track: function track(req, tracking) { | ||
console.log('[track]\n', Object.keys(tracking).map(function (key) { | ||
return '\t' + key + ': ' + tracking[key]; | ||
track(req, tracking) { | ||
console.log('[track]\n', Object.keys(tracking).map(key => { | ||
return `\t${key}: ${tracking[key]}`; | ||
}).join('\n'), '\n'); | ||
}, | ||
meta: function (_meta) { | ||
function meta(_x, _x2) { | ||
return _meta.apply(this, arguments); | ||
} | ||
meta.toString = function () { | ||
return _meta.toString(); | ||
}; | ||
return meta; | ||
}(function (req, meta) { | ||
console.log('[meta]\n', Object.keys(meta).map(function (key) { | ||
return '\t' + key + ': ' + meta[key]; | ||
meta(req, meta) { | ||
console.log('[meta]\n', Object.keys(meta).map(key => { | ||
return `\t${key}: ${meta[key]}`; | ||
}).join('\n'), '\n'); | ||
}) | ||
} | ||
}; | ||
export function log(req, logger, logs) { | ||
function log(req, logger, logs) { | ||
var events = logs.events || []; | ||
var tracking = logs.tracking || []; | ||
var meta = logs.meta || {}; | ||
let events = logs.events || []; | ||
let tracking = logs.tracking || []; | ||
let meta = logs.meta || {}; | ||
if (logger.log) { | ||
events.forEach(function (event) { | ||
events.forEach(event => { | ||
if (!event.event) { | ||
@@ -55,3 +59,3 @@ return; | ||
event.level = event.level || LOG_LEVEL.INFO; | ||
event.level = event.level || _constants.LOG_LEVEL.INFO; | ||
event.payload = event.payload || {}; | ||
@@ -68,3 +72,3 @@ | ||
if (logger.track) { | ||
tracking.forEach(function (track) { | ||
tracking.forEach(track => { | ||
logger.track(req, track); | ||
@@ -75,30 +79,25 @@ }); | ||
export function handleRequest(req, logger) { | ||
function handleRequest(req, logger) { | ||
// $FlowFixMe | ||
var method = req.method || HTTP_METHOD.GET; | ||
let method = req.method || _constants.HTTP_METHOD.GET; | ||
// $FlowFixMe | ||
var query = req.query; | ||
let query = req.query; | ||
// $FlowFixMe | ||
var body = req.body; | ||
let body = req.body; | ||
if (method.toLowerCase() === 'post') { | ||
var _events = body.events, | ||
_tracking = body.tracking, | ||
_meta2 = body.meta; | ||
log(req, logger, { events: _events, tracking: _tracking, meta: _meta2 }); | ||
let { events, tracking, meta } = body; | ||
log(req, logger, { events, tracking, meta }); | ||
} else { | ||
var _event = query.event, | ||
_query$level = query.level, | ||
_level = _query$level === undefined ? LOG_LEVEL.INFO : _query$level, | ||
_payload = _objectWithoutProperties(query, ['event', 'level']); | ||
let { event, level = _constants.LOG_LEVEL.INFO } = query, | ||
payload = _objectWithoutProperties(query, ['event', 'level']); | ||
log(req, logger, { | ||
events: [{ | ||
level: _level, | ||
event: _event, | ||
payload: _payload | ||
level, | ||
event, | ||
payload | ||
}] | ||
@@ -110,42 +109,35 @@ }); | ||
function sendCorsHeaders(req, res) { | ||
var origin = req.get(HTTP_HEADER.ORIGIN); | ||
let origin = req.get(_constants.HTTP_HEADER.ORIGIN); | ||
if (origin) { | ||
var parsedUrl = url.parse(origin) || {}; | ||
let parsedUrl = _url2['default'].parse(origin) || {}; | ||
if (!parsedUrl.protocol || !parsedUrl.host) { | ||
res.header(HTTP_HEADER.ACCESS_CONTROL_ALLOW_ORIGIN, WILDCARD); | ||
res.header(_constants.HTTP_HEADER.ACCESS_CONTROL_ALLOW_ORIGIN, _constants.WILDCARD); | ||
} else { | ||
res.header(HTTP_HEADER.ACCESS_CONTROL_ALLOW_ORIGIN, parsedUrl.protocol + '//' + parsedUrl.host); | ||
res.header(_constants.HTTP_HEADER.ACCESS_CONTROL_ALLOW_ORIGIN, `${parsedUrl.protocol}//${parsedUrl.host}`); | ||
} | ||
} else { | ||
res.header(HTTP_HEADER.ACCESS_CONTROL_ALLOW_ORIGIN, WILDCARD); | ||
res.header(_constants.HTTP_HEADER.ACCESS_CONTROL_ALLOW_ORIGIN, _constants.WILDCARD); | ||
} | ||
var corsRequestHeaders = req.headers[HTTP_HEADER.ACCESS_CONTROL_REQUEST_HEADERS]; | ||
let corsRequestHeaders = req.headers[_constants.HTTP_HEADER.ACCESS_CONTROL_REQUEST_HEADERS]; | ||
if (corsRequestHeaders) { | ||
res.header(HTTP_HEADER.ACCESS_CONTROL_ALLOW_HEADERS, corsRequestHeaders); | ||
res.header(_constants.HTTP_HEADER.ACCESS_CONTROL_ALLOW_HEADERS, corsRequestHeaders); | ||
} | ||
var corsRequestMethod = req.headers[HTTP_HEADER.ACCESS_CONTROL_REQUEST_METHOD]; | ||
let corsRequestMethod = req.headers[_constants.HTTP_HEADER.ACCESS_CONTROL_REQUEST_METHOD]; | ||
if (corsRequestMethod) { | ||
res.header(HTTP_HEADER.ACCESS_CONTROL_ALLOW_METHODS, corsRequestMethod); | ||
res.header(_constants.HTTP_HEADER.ACCESS_CONTROL_ALLOW_METHODS, corsRequestMethod); | ||
} | ||
} | ||
export function expressEndpoint() { | ||
var _ref = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {}, | ||
_ref$uri = _ref.uri, | ||
uri = _ref$uri === undefined ? '/' : _ref$uri, | ||
_ref$logger = _ref.logger, | ||
logger = _ref$logger === undefined ? defaultLogger : _ref$logger, | ||
_ref$enableCors = _ref.enableCors, | ||
enableCors = _ref$enableCors === undefined ? false : _ref$enableCors; | ||
function expressEndpoint({ uri = '/', logger = defaultLogger, enableCors = false } = {}) { | ||
// $FlowFixMe | ||
var app = require('express')(); | ||
let app = require('express')(); | ||
app.all(uri, function (req, res) { | ||
app.all(uri, (req, res) => { | ||
if (enableCors) { | ||
@@ -155,3 +147,3 @@ sendCorsHeaders(req, res); | ||
if (req.method.toLowerCase() === HTTP_METHOD.OPTIONS) { | ||
if (req.method.toLowerCase() === _constants.HTTP_METHOD.OPTIONS) { | ||
return res.status(200).send(); | ||
@@ -158,0 +150,0 @@ } |
Sorry, the diff of this file is too big to display
124132
20
1905