/*! pacakge version: 2.6.1 */ !function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define([],t):"object"==typeof exports?exports.Logger=t():e.Logger=t()}(window,(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,{enumerable:!0,get:r})},n.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},n.t=function(e,t){if(1&t&&(e=n(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var r=Object.create(null);if(n.r(r),Object.defineProperty(r,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var o in e)n.d(r,o,function(t){return e[t]}.bind(null,o));return 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="./build",n(n.s=7)}([function(e,t,n){"use strict";(function(e){n.d(t,"a",(function(){return i}));var r=n(2),o={};function i(){return Object(r.a)()?e:"undefined"!=typeof window?window:"undefined"!=typeof self?self:o}}).call(this,n(3))},function(e,t,n){"use strict";var r=this&&this.__assign||function(){return(r=Object.assign||function(e){for(var t,n=1,r=arguments.length;n0&&o[o.length-1])||6!==i[0]&&2!==i[0])){a=0;continue}if(3===i[0]&&(!o||i[1]>o[0]&&i[1]=i)throw new Error("lowerIndex should be less than upperIndex");o&&i&&u.paramChecker(a,u.ParamCheckerEnum.Boolean,"indexRange's lowerExclusive",!0),u.paramChecker(s,u.ParamCheckerEnum.Boolean,"indexRange's upperExclusive",!0)}}function l(){try{return a.default(),!0}catch(e){return!1}}t.idbIsSupported=l;var f=function(){function e(e){a.default(),function(e){u.paramChecker(e,u.ParamCheckerEnum.NotNullObject,"dbConfig",!1),u.paramChecker(e.dbName,u.ParamCheckerEnum.String,"dbName",!1),u.paramChecker(e.dbVersion,u.ParamCheckerEnum.NonNegativeInteger,"dbVersion",!0),u.paramChecker(e.itemDuration,u.ParamCheckerEnum.NonNegativeInteger,"itemDuration of dbConfig",!0),u.paramChecker(e.tables,u.ParamCheckerEnum.NotNullObject,"tables",!0),Object.keys(e.tables||{}).forEach((function(t){var n=e.tables[t];u.paramChecker(n.primaryKey,u.ParamCheckerEnum.String,"primaryKey",!0),u.paramChecker(n.itemDuration,u.ParamCheckerEnum.NonNegativeInteger,"itemDuration of table",!0),u.paramChecker(n.indexList,u.ParamCheckerEnum.Array,"indexList",!0),(n.indexList||[]).forEach((function(e){u.paramChecker(e.indexName,u.ParamCheckerEnum.String,"indexName",!1),u.paramChecker(e.unique,u.ParamCheckerEnum.Boolean,"unique",!0)}))}))}(e),this.name=e.dbName,this.version=u.optionWithBackup(e.dbVersion,1),this.tableList=Object.keys(e.tables||{}).map((function(t){return r({tableName:t},e.tables[t])})),this.itemDuration=e.itemDuration}return e.prototype.addItems=function(e){return o(this,void 0,void 0,(function(){var t,n,o=this;return i(this,(function(i){switch(i.label){case 0:return t=function(e,t,n){return void 0!==n?n:void 0!==t?t:e},a=e,c=this.tableList,u.paramChecker(a,u.ParamCheckerEnum.Array,"items",!1),a.forEach((function(e){u.paramChecker(e.tableName,u.ParamCheckerEnum.String,"item's tableName",!1),u.paramChecker(e.itemDuration,u.ParamCheckerEnum.NonNegativeInteger,"item's itemDuration",!0);var t=c.filter((function(t){return t.tableName===e.tableName}))[0];if(!t)throw new Error("Table "+e.tableName+" does not exist");if(void 0!==t.primaryKey&&Object.getOwnPropertyNames(e.item).indexOf(t.primaryKey)<0)throw new Error("primaryKey is needed for item in table "+e.tableName)})),n=e.map((function(e){var n=o.tableList.filter((function(t){return t.tableName===e.tableName}))[0];return r({itemDuration:t(o.itemDuration,n.itemDuration,e.itemDuration)},e)})),[4,s.default.addItems({name:this.name,tableList:this.tableList,version:this.version},n)];case 1:return i.sent(),[2]}var a,c}))}))},e.prototype.getItem=function(e,t){return o(this,void 0,void 0,(function(){return i(this,(function(n){switch(n.label){case 0:return[4,d(this.name,e,t)];case 1:return[2,n.sent()]}}))}))},e.prototype.getItemsInRange=function(e){return o(this,void 0,void 0,(function(){return i(this,(function(t){switch(t.label){case 0:return[4,h(this.name,e)];case 1:return[2,t.sent()]}}))}))},e.prototype.deleteItemsInRange=function(e){return o(this,void 0,void 0,(function(){return i(this,(function(t){switch(t.label){case 0:return u.paramChecker(e,u.ParamCheckerEnum.Array,"tableIndexRanges",!1),e.forEach((function(e){c(e)})),[4,s.default.deleteItems(this.name,e)];case 1:return t.sent(),[2]}}))}))},e}();function p(e){return o(this,void 0,void 0,(function(){return i(this,(function(t){switch(t.label){case 0:return a.default(),u.paramChecker(e,u.ParamCheckerEnum.String,"dbName",!1),[4,s.default.deleteDB(e)];case 1:return t.sent(),[2]}}))}))}function d(e,t,n){return o(this,void 0,void 0,(function(){return i(this,(function(r){switch(r.label){case 0:return u.paramChecker(e,u.ParamCheckerEnum.String,"dbName",!1),u.paramChecker(t,u.ParamCheckerEnum.String,"tableName",!1),[4,s.default.getItem(e,t,n)];case 1:return[2,r.sent()]}}))}))}function h(e,t){return o(this,void 0,void 0,(function(){return i(this,(function(n){switch(n.label){case 0:return u.paramChecker(e,u.ParamCheckerEnum.String,"dbName",!1),c(t),[4,s.default.getItemsInRange(e,t)];case 1:return[2,n.sent()]}}))}))}t.CustomDB=f,t.deleteDB=p,t.getItemFromDB=d,t.getItemsInRangeFromDB=h,t.default={idbIsSupported:l,CustomDB:f,deleteDB:p,getItemFromDB:d,getItemsInRangeFromDB:h}},function(e,t,n){"use strict";(function(e){function r(){return"[object process]"===Object.prototype.toString.call(void 0!==e?e:0)}n.d(t,"a",(function(){return r}))}).call(this,n(4))},function(e,t){var n;n=function(){return this}();try{n=n||new Function("return this")()}catch(e){"object"==typeof window&&(n=window)}e.exports=n},function(e,t){var n,r,o=e.exports={};function i(){throw new Error("setTimeout has not been defined")}function a(){throw new Error("clearTimeout has not been defined")}function s(e){if(n===setTimeout)return setTimeout(e,0);if((n===i||!n)&&setTimeout)return n=setTimeout,setTimeout(e,0);try{return n(e,0)}catch(t){try{return n.call(null,e,0)}catch(t){return n.call(this,e,0)}}}!function(){try{n="function"==typeof setTimeout?setTimeout:i}catch(e){n=i}try{r="function"==typeof clearTimeout?clearTimeout:a}catch(e){r=a}}();var u,c=[],l=!1,f=-1;function p(){l&&u&&(l=!1,u.length?c=u.concat(c):f=-1,c.length&&d())}function d(){if(!l){var e=s(p);l=!0;for(var t=c.length;t;){for(u=c,c=[];++f1)for(var n=1;n=0}Object.defineProperty(t,"__esModule",{value:!0}),t.ParamCheckerEnum={NonNegativeInteger:{rule:r,desc:"needs to be a non-negative integer"},NotNullObject:{rule:function(e){return e&&"object"==typeof e},desc:"needs to be a not-null object"},String:{rule:function(e){return"string"==typeof e},desc:"needs to be a string"},Array:{rule:function(e){return e instanceof Array},desc:"needs to be an Array"},Boolean:{rule:function(e){return"boolean"==typeof e},desc:"needs to be a boolean"}},t.isNonNegativeInteger=r,t.optionWithBackup=function(e,t){return void 0!==e?e:t},t.paramChecker=function(e,t,n,r){var o=n+" "+t.desc;if(r){if(void 0!==e&&!t.rule(e))throw new Error(o+" if defined")}else if(!t.rule(e))throw new Error(o)},t.deduplicateList=function(e){return e.reduce((function(e,t){return e.indexOf(t)<0?e.concat(t):e}),[])}},function(e,t,n){var r;e.exports=(r=r||function(e,t){var n=Object.create||function(){function e(){}return function(t){var n;return e.prototype=t,n=new e,e.prototype=null,n}}(),r={},o=r.lib={},i=o.Base={extend:function(e){var t=n(this);return e&&t.mixIn(e),t.hasOwnProperty("init")&&this.init!==t.init||(t.init=function(){t.$super.init.apply(this,arguments)}),t.init.prototype=t,t.$super=this,t},create:function(){var e=this.extend();return e.init.apply(e,arguments),e},init:function(){},mixIn:function(e){for(var t in e)e.hasOwnProperty(t)&&(this[t]=e[t]);e.hasOwnProperty("toString")&&(this.toString=e.toString)},clone:function(){return this.init.prototype.extend(this)}},a=o.WordArray=i.extend({init:function(e,t){e=this.words=e||[],this.sigBytes=null!=t?t:4*e.length},toString:function(e){return(e||u).stringify(this)},concat:function(e){var t=this.words,n=e.words,r=this.sigBytes,o=e.sigBytes;if(this.clamp(),r%4)for(var i=0;i>>2]>>>24-i%4*8&255;t[r+i>>>2]|=a<<24-(r+i)%4*8}else for(i=0;i>>2]=n[i>>>2];return this.sigBytes+=o,this},clamp:function(){var t=this.words,n=this.sigBytes;t[n>>>2]&=4294967295<<32-n%4*8,t.length=e.ceil(n/4)},clone:function(){var e=i.clone.call(this);return e.words=this.words.slice(0),e},random:function(t){for(var n,r=[],o=function(t){t=t;var n=987654321,r=4294967295;return function(){var o=((n=36969*(65535&n)+(n>>16)&r)<<16)+(t=18e3*(65535&t)+(t>>16)&r)&r;return o/=4294967296,(o+=.5)*(e.random()>.5?1:-1)}},i=0;i>>2]>>>24-o%4*8&255;r.push((i>>>4).toString(16)),r.push((15&i).toString(16))}return r.join("")},parse:function(e){for(var t=e.length,n=[],r=0;r>>3]|=parseInt(e.substr(r,2),16)<<24-r%8*4;return new a.init(n,t/2)}},c=s.Latin1={stringify:function(e){for(var t=e.words,n=e.sigBytes,r=[],o=0;o>>2]>>>24-o%4*8&255;r.push(String.fromCharCode(i))}return r.join("")},parse:function(e){for(var t=e.length,n=[],r=0;r>>2]|=(255&e.charCodeAt(r))<<24-r%4*8;return new a.init(n,t)}},l=s.Utf8={stringify:function(e){try{return decodeURIComponent(escape(c.stringify(e)))}catch(e){throw new Error("Malformed UTF-8 data")}},parse:function(e){return c.parse(unescape(encodeURIComponent(e)))}},f=o.BufferedBlockAlgorithm=i.extend({reset:function(){this._data=new a.init,this._nDataBytes=0},_append:function(e){"string"==typeof e&&(e=l.parse(e)),this._data.concat(e),this._nDataBytes+=e.sigBytes},_process:function(t){var n=this._data,r=n.words,o=n.sigBytes,i=this.blockSize,s=o/(4*i),u=(s=t?e.ceil(s):e.max((0|s)-this._minBufferSize,0))*i,c=e.min(4*u,o);if(u){for(var l=0;l0&&o[o.length-1])||6!==i[0]&&2!==i[0])){a=0;continue}if(3===i[0]&&(!o||i[1]>o[0]&&i[1]0&&e.expireTimen.version?(r=t.transaction("IDB_MANAGER_STORE","readwrite"),o=r.objectStore("IDB_MANAGER_STORE"),a={dbName:e.name,tableList:e.tableList,version:e.version},o.put(c({item:a,tableName:"IDB_MANAGER_STORE"})),[4,r.complete]):[3,4];case 3:i.sent(),t.close(),i.label=4;case 4:return[2]}}))}))}function p(e){return o(this,void 0,void 0,(function(){var t,n;return i(this,(function(r){switch(r.label){case 0:return[4,h()];case 1:return t=r.sent(),n=t.transaction("IDB_MANAGER_STORE","readwrite"),n.objectStore("IDB_MANAGER_STORE").delete(e),[4,n.complete];case 2:return r.sent(),t.close(),[2]}}))}))}function d(e){return o(this,void 0,void 0,(function(){return i(this,(function(t){switch(t.label){case 0:return[4,f(e)];case 1:return t.sent(),[4,s.open(e.name,e.version,(function(t){y(t,e.tableList)}))];case 2:return[2,t.sent()]}}))}))}function h(){return o(this,void 0,void 0,(function(){return i(this,(function(e){switch(e.label){case 0:return[4,s.open("IDB_MANAGER_DB",1,(function(e){!function(e){e.createObjectStore("IDB_MANAGER_STORE",{keyPath:"dbName"})}(e)}))];case 1:return[2,e.sent()]}}))}))}function v(e){return o(this,void 0,void 0,(function(){var t,n;return i(this,(function(r){switch(r.label){case 0:return[4,h()];case 1:return[4,m(t=r.sent(),"IDB_MANAGER_STORE",e)];case 2:return n=r.sent(),t.close(),n?[4,s.open(n.dbName,n.version,(function(e){y(e,n.tableList||[])}))]:[3,4];case 3:return[2,r.sent()];case 4:return[2,null]}}))}))}function m(e,t,n){return o(this,void 0,void 0,(function(){var r;return i(this,(function(o){switch(o.label){case 0:return e.objectStoreNames.contains(t)?(r=e.transaction(t,"readonly"),[4,r.objectStore(t).get(n)]):[3,2];case 1:return[2,l(o.sent())];case 2:return[2,null]}}))}))}function y(e,t){try{t.forEach((function(t){if(e.objectStoreNames.contains(t.tableName)){var n=e.transaction(t.tableName).objectStore(t.tableName);(t.indexList||[]).forEach((function(e){n.indexNames.contains(e.indexName)||n.createIndex(e.indexName,e.indexName,{unique:e.unique})}))}else{var o=t.primaryKey||"id",i=e.createObjectStore(t.tableName,r({keyPath:o},"id"===o?{autoIncrement:!0}:{}));i.createIndex(o,o,{unique:!0}),(t.indexList||[]).forEach((function(e){i.createIndex(e.indexName,e.indexName,{unique:e.unique})})),i.createIndex("updateTime","updateTime",{unique:!1}),i.createIndex("expireTime","expireTime",{unique:!1})}}))}catch(t){e.close()}}function g(e,t,n){return o(this,void 0,void 0,(function(){var r;return i(this,(function(o){switch(o.label){case 0:return o.trys.push([0,3,8,9]),[4,n()];case 1:return o.sent(),[4,e.complete];case 2:return o.sent(),[3,9];case 3:r=o.sent();try{e.abort()}catch(e){}o.label=4;case 4:return o.trys.push([4,6,,7]),[4,e.complete];case 5:return o.sent(),[3,7];case 6:return o.sent(),[3,7];case 7:throw r;case 8:return t.close(),[7];case 9:return[2]}}))}))}function b(e,t){return o(this,void 0,void 0,(function(){var n,r,s,c=this;return i(this,(function(l){switch(l.label){case 0:return n=t.filter((function(t){return e.objectStoreNames.contains(t.tableName)})),r=a.deduplicateList(n.map((function(e){return e.tableName}))),[4,g(s=e.transaction(r,"readwrite"),e,(function(){return o(c,void 0,void 0,(function(){return i(this,(function(e){switch(e.label){case 0:return[4,Promise.all(n.map((function(e){var t=e.tableName,n=e.indexRange,r=s.objectStore(t);return n?new Promise((function(e){r.index(n.indexName).iterateCursor(u(n),(function(t){t?(r.delete(t.primaryKey),t.continue()):e()}))})):r.clear()})))];case 1:return e.sent(),[2]}}))}))}))];case 1:return l.sent(),[2]}}))}))}function w(e,t){return o(this,void 0,void 0,(function(){var n,r,s,u=this;return i(this,(function(l){switch(l.label){case 0:return n=a.deduplicateList(t.map((function(e){return e.tableName}))),[4,T(e.name,n.map((function(e){return{tableName:e,indexRange:{indexName:"expireTime",upperIndex:+new Date,upperExclusive:!1}}})))];case 1:return l.sent(),[4,d(e)];case 2:return r=l.sent(),[4,g(s=r.transaction(n,"readwrite"),r,(function(){return o(u,void 0,void 0,(function(){return i(this,(function(e){switch(e.label){case 0:return[4,Promise.all(t.map((function(e){return s.objectStore(e.tableName).put(c(e))})))];case 1:return e.sent(),[2]}}))}))}))];case 3:return l.sent(),[2]}}))}))}function _(e,t,n){return o(this,void 0,void 0,(function(){var r;return i(this,(function(o){switch(o.label){case 0:return[4,v(e)];case 1:if(!(r=o.sent()))return[3,7];o.label=2;case 2:return o.trys.push([2,4,5,6]),[4,m(r,t,n)];case 3:return[2,o.sent()];case 4:throw o.sent();case 5:return r.close(),[7];case 6:return[3,8];case 7:return[2,null];case 8:return[2]}}))}))}function I(e,t){return o(this,void 0,void 0,(function(){var n,r,o,a,s,c,f;return i(this,(function(i){switch(i.label){case 0:return n=t.tableName,r=t.indexRange,[4,v(e)];case 1:if(!(o=i.sent()))return[3,11];i.label=2;case 2:return i.trys.push([2,8,9,10]),a=[],o.objectStoreNames.contains(n)?[3,3]:[3,7];case 3:return s=o.transaction(n,"readonly"),c=s.objectStore(n),r?[3,5]:[4,c.getAll()];case 4:return f=i.sent(),a=(f||[]).map(l).filter((function(e){return null!==e})),[3,7];case 5:return[4,new Promise((function(e){c.index(r.indexName).iterateCursor(u(r),(function(t){if(t){var n=l(t.value);n&&a.push(n),t.continue()}else e()}))}))];case 6:i.sent(),i.label=7;case 7:return[2,a];case 8:throw i.sent();case 9:return o.close(),[7];case 10:return[3,12];case 11:return[2,[]];case 12:return[2]}}))}))}function S(e){return o(this,void 0,void 0,(function(){return i(this,(function(t){switch(t.label){case 0:return[4,p(e)];case 1:return t.sent(),[4,s.delete(e)];case 2:return t.sent(),[2]}}))}))}function T(e,t){return o(this,void 0,void 0,(function(){var n;return i(this,(function(r){switch(r.label){case 0:return[4,v(e)];case 1:return(n=r.sent())?[4,b(n,t)]:[3,3];case 2:return r.sent(),[3,4];case 3:case 4:return[2]}}))}))}t.addItems=w,t.getItem=_,t.getItemsInRange=I,t.deleteDB=S,t.deleteItems=T,t.default={addItems:w,getItem:_,getItemsInRange:I,deleteDB:S,deleteItems:T}},function(e,t){function n(e){return Array.prototype.slice.call(e)}function r(e){return new Promise((function(t,n){e.onsuccess=function(){t(e.result)},e.onerror=function(){n(e.error)}}))}function o(e,t,n){var o,i=new Promise((function(i,a){r(o=e[t].apply(e,n)).then(i,a)}));return i.request=o,i}function i(e,t,n){var r=o(e,t,n);return r.then((function(e){if(e)return new f(e,r.request)}))}function a(e,t,n){n.forEach((function(n){Object.defineProperty(e.prototype,n,{get:function(){return this[t][n]},set:function(e){this[t][n]=e}})}))}function s(e,t,n,r){r.forEach((function(r){r in n.prototype&&(e.prototype[r]=function(){return o(this[t],r,arguments)})}))}function u(e,t,n,r){r.forEach((function(r){r in n.prototype&&(e.prototype[r]=function(){return this[t][r].apply(this[t],arguments)})}))}function c(e,t,n,r){r.forEach((function(r){r in n.prototype&&(e.prototype[r]=function(){return i(this[t],r,arguments)})}))}function l(e){this._index=e}function f(e,t){this._cursor=e,this._request=t}function p(e){this._store=e}function d(e){this._tx=e,this.complete=new Promise((function(t,n){e.oncomplete=function(){t()},e.onerror=function(){n(e.error)},e.onabort=function(){n(e.error)}}))}function h(e,t,n){this._db=e,this.oldVersion=t,this.transaction=new d(n)}function v(e){this._db=e}var m;if(p.prototype.createIndex=function(){return new l(this._store.createIndex.apply(this._store,arguments))},p.prototype.index=function(){return new l(this._store.index.apply(this._store,arguments))},d.prototype.objectStore=function(){return new p(this._tx.objectStore.apply(this._tx,arguments))},h.prototype.createObjectStore=function(){return new p(this._db.createObjectStore.apply(this._db,arguments))},v.prototype.transaction=function(){return new d(this._db.transaction.apply(this._db,arguments))},function(){try{return["IDBIndex","IDBCursor","IDBObjectStore","IDBTransaction","IDBDatabase"].forEach((function(e){if(window&&(!window[e]||!window.hasOwnProperty(e)))throw new Error(e)})),!0}catch(e){return!1}}())a(l,"_index",["name","keyPath","multiEntry","unique"]),s(l,"_index",IDBIndex,["get","getKey","getAll","getAllKeys","count"]),c(l,"_index",IDBIndex,["openCursor","openKeyCursor"]),a(f,"_cursor",["direction","key","primaryKey","value"]),s(f,"_cursor",IDBCursor,["update","delete"]),["advance","continue","continuePrimaryKey"].forEach((function(e){e in IDBCursor.prototype&&(f.prototype[e]=function(){var t=this,n=arguments;return Promise.resolve().then((function(){return t._cursor[e].apply(t._cursor,n),r(t._request).then((function(e){if(e)return new f(e,t._request)}))}))})})),a(p,"_store",["name","keyPath","indexNames","autoIncrement"]),s(p,"_store",IDBObjectStore,["put","add","delete","clear","get","getAll","getKey","getAllKeys","count"]),c(p,"_store",IDBObjectStore,["openCursor","openKeyCursor"]),u(p,"_store",IDBObjectStore,["deleteIndex"]),a(d,"_tx",["objectStoreNames","mode"]),u(d,"_tx",IDBTransaction,["abort"]),a(h,"_db",["name","version","objectStoreNames"]),u(h,"_db",IDBDatabase,["deleteObjectStore","close"]),a(v,"_db",["name","version","objectStoreNames"]),u(v,"_db",IDBDatabase,["close"]),["openCursor","openKeyCursor"].forEach((function(e){[p,l].forEach((function(t){e in t.prototype&&(t.prototype[e.replace("open","iterate")]=function(){var t=n(arguments),r=t[t.length-1],o=this._store||this._index,i=o[e].apply(o,t.slice(0,-1));i.onsuccess=function(){r(i.result)}})}))})),[l,p].forEach((function(e){e.prototype.getAll||(e.prototype.getAll=function(e,t){var n=this,r=[];return new Promise((function(o){n.iterateCursor(e,(function(e){e?(r.push(e.value),void 0===t||r.length!=t?e.continue():o(r)):o(r)}))}))})})),m={open:function(e,t,n){var r=o(indexedDB,"open",[e,t]),i=r.request;return i&&(i.onupgradeneeded=function(e){n&&n(new h(i.result,e.oldVersion,i.transaction))}),r.then((function(e){return new v(e)}))},delete:function(e){return o(indexedDB,"deleteDatabase",[e])}};else{var y="indexedDB is not supported";m={open:function(){return Promise.reject(new Error(y))},delete:function(){return Promise.reject(new Error(y))}}}e.exports=m},function(e,t,n){var r;e.exports=(r=n(6),r.enc.Utf8)},function(e,t,n){var r,o,i;e.exports=(i=n(6),o=(r=i).lib.WordArray,r.enc.Base64={stringify:function(e){var t=e.words,n=e.sigBytes,r=this._map;e.clamp();for(var o=[],i=0;i>>2]>>>24-i%4*8&255)<<16|(t[i+1>>>2]>>>24-(i+1)%4*8&255)<<8|t[i+2>>>2]>>>24-(i+2)%4*8&255,s=0;s<4&&i+.75*s>>6*(3-s)&63));var u=r.charAt(64);if(u)for(;o.length%4;)o.push(u);return o.join("")},parse:function(e){var t=e.length,n=this._map,r=this._reverseMap;if(!r){r=this._reverseMap=[];for(var i=0;i>>6-a%4*2;r[i>>>2]|=(s|u)<<24-i%4*8,i++}return o.create(r,i)}(e,t,r)},_map:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/="},i.enc.Base64)},function(e){e.exports=JSON.parse('{"name":"@bigo/logger","version":"2.6.1","description":"","main":"build/node-index.js","module":"build/index.js","types":"build/index.d.ts","scripts":{"test":"jest --coverage","build":"rm -rf build && tsc && cp -r src/lib/*.js build/lib/ && webpack --config webpack.config.js","dev":"rm -rf demo/dist & parcel demo/dev.html --port 1234 -d demo/dist","allready":"npm run test && npm run demo","publish:beta":"npm run build && standard-version --prerelease beta && npm publish --tag beta","publish:prod":"npm run build && standard-version && git push --follow-tags origin master && npm publish","publish:prod-patch":"npm run build && standard-version --release-as patch && git push --follow-tags origin master && npm publish"},"keywords":["Web","SDK"],"author":"sylvia","license":"MIT","devDependencies":{"@types/jest":"^24.0.22","@typescript-eslint/eslint-plugin":"^2.24.0","@typescript-eslint/parser":"^2.24.0","cross-env":"^7.0.3","eslint":"^6.6.0","fake-indexeddb":"^2.1.1","jest":"^24.9.0","parcel":"^1.12.4","rc-config-loader":"^4.0.0","serialize-javascript":"^2.1.1","source-map-loader":"^0.2.4","standard-version":"^7.0.1","ts-jest":"^26.0.0","typescript":"^3.7.2","webpack":"^4.41.2","webpack-cli":"^3.3.9","webpack-dev-server":"^3.11.0"},"dependencies":{"crypto-js":"^3.1.9-1","es6-promise":"^4.2.8","idb-managed":"^1.0.9"},"files":["/build","/src"]}')},function(e,t,n){(function(t,n){ /*! * @overview es6-promise - a tiny implementation of Promises/A+. * @copyright Copyright (c) 2014 Yehuda Katz, Tom Dale, Stefan Penner and contributors (Conversion to ES6 API by Jake Archibald) * @license Licensed under MIT license * See https://raw.githubusercontent.com/stefanpenner/es6-promise/master/LICENSE * @version v4.2.8+1e68dce6 */var r;r=function(){"use strict";function e(e){return"function"==typeof e}var r=Array.isArray?Array.isArray:function(e){return"[object Array]"===Object.prototype.toString.call(e)},o=0,i=void 0,a=void 0,s=function(e,t){h[o]=e,h[o+1]=t,2===(o+=2)&&(a?a(v):w())},u="undefined"!=typeof window?window:void 0,c=u||{},l=c.MutationObserver||c.WebKitMutationObserver,f="undefined"==typeof self&&void 0!==t&&"[object process]"==={}.toString.call(t),p="undefined"!=typeof Uint8ClampedArray&&"undefined"!=typeof importScripts&&"undefined"!=typeof MessageChannel;function d(){var e=setTimeout;return function(){return e(v,1)}}var h=new Array(1e3);function v(){for(var e=0;e0&&n<=12&&r>0&&r<=31&&"Invalid Date"!==new Date(e).toString()}function h(e){var t=e.getFullYear(),n=e.getMonth()+1,r=e.getDate();return t+"-"+(n<10?"0"+n:n)+"-"+(r<10?"0"+r:r)}function v(e){return new Date(e.getFullYear(),e.getMonth(),e.getDate()).getTime()}function m(e){var t=(e.match(/(\d+)/g)||[]).map((function(e){return parseInt(e)})),n=t[0],r=t[1],o=t[2];if(n<1e3)throw new Error("Invalid dayString: "+e);return new Date(n,r-1,o)}function y(e,t){return{t:t,c:e,d:Date.now()}}function g(e){if(0===e.length)return Promise.resolve([]);var t=e.map((function(e){return e instanceof Promise?e:Promise.resolve(e)}));return new Promise((function(e,n){var r=[],o=t.length;t.forEach((function(t,n){t.then((function(t){r[n]={status:"fulfilled",value:t},0===(o-=1)&&e(r)}),(function(t){r[n]={status:"rejected",reason:t},0===(o-=1)&&e(r)}))}))}))}var b=p("logTryTimes");var w={errorTrigger:function(){b>0&&b--},canSave:function(){return b>0},resetQuota:function(){b=p("logTryTimes")}};function _(e){return"[object String]"===Object.prototype.toString.call(e)}function I(e,t){try{return e instanceof t}catch(e){return!1}}var S=n(0);n(2);function T(e,t,n){if(t in e){var r=e[t],o=n(r);if("function"==typeof o)try{o.prototype=o.prototype||{},Object.defineProperties(o,{__sentry_original__:{enumerable:!1,value:r}})}catch(e){}e[t]=o}}function E(){if(!("fetch"in Object(S.a)()))return!1;try{return new Headers,new Request(""),new Response,!0}catch(e){return!1}}function x(e){return e&&/^function fetch\(\)\s+\{\s+\[native code\]\s+\}$/.test(e.toString())}function N(e){try{return e&&"function"==typeof e&&e.name||""}catch(e){return""}}var R=function(){return(R=Object.assign||function(e){for(var t,n=1,r=arguments.length;n2?t[2]:void 0;if(r){var o=B,i=String(r);B=i,j("history",{from:o,to:i})}return e.apply(this,t)}}C.onpopstate=function(){for(var e=[],t=0;t "+e.to,i.HISTORY)},e.prototype._consoleHandler=function(e){p("stop")||this._options.logHandler({content:e.args,level:e.level},i.CONSOLE)},e.prototype._nativeapiHandler=function(e){p("stop")||this._options.logHandler(e,i.NATIVEAPI)},e.id="GlobalHandlers",e}(),J=n(1),W=function(e,t,n,r){return new(n||(n=Promise))((function(o,i){function a(e){try{u(r.next(e))}catch(e){i(e)}}function s(e){try{u(r.throw(e))}catch(e){i(e)}}function u(e){var t;e.done?o(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(a,s)}u((r=r.apply(e,t||[])).next())}))},Z=function(e,t){var n,r,o,i,a={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return i={next:s(0),throw:s(1),return:s(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function s(i){return function(s){return function(i){if(n)throw new TypeError("Generator is already executing.");for(;a;)try{if(n=1,r&&(o=2&i[0]?r.return:i[0]?r.throw||((o=r.return)&&o.call(r),0):r.next)&&!(o=o.call(r,i[1])).done)return o;switch(r=0,o&&(i=[2&i[0],o.value]),i[0]){case 0:case 1:o=i;break;case 4:return a.label++,{value:i[1],done:!1};case 5:a.label++,r=i[1],i=[0];continue;case 7:i=a.ops.pop(),a.trys.pop();continue;default:if(!(o=a.trys,(o=o.length>0&&o[o.length-1])||6!==i[0]&&2!==i[0])){a=0;continue}if(3===i[0]&&(!o||i[1]>o[0]&&i[1]0)||Q)return[3,5];t=$.shift(),Q=!0,o.label=1;case 1:return o.trys.push([1,3,,4]),[4,t.asyncF()];case 2:return n=o.sent(),t.resolution(n),[3,4];case 3:return r=o.sent(),t.rejection(r),[3,4];case 4:return Q=!1,e(),[3,0];case 5:return[2]}}))}))}()}))}var te,ne=function(e,t,n,r){return new(n||(n=Promise))((function(o,i){function a(e){try{u(r.next(e))}catch(e){i(e)}}function s(e){try{u(r.throw(e))}catch(e){i(e)}}function u(e){var t;e.done?o(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(a,s)}u((r=r.apply(e,t||[])).next())}))},re=function(e,t){var n,r,o,i,a={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return i={next:s(0),throw:s(1),return:s(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function s(i){return function(s){return function(i){if(n)throw new TypeError("Generator is already executing.");for(;a;)try{if(n=1,r&&(o=2&i[0]?r.return:i[0]?r.throw||((o=r.return)&&o.call(r),0):r.next)&&!(o=o.call(r,i[1])).done)return o;switch(r=0,o&&(i=[2&i[0],o.value]),i[0]){case 0:case 1:o=i;break;case 4:return a.label++,{value:i[1],done:!1};case 5:a.label++,r=i[1],i=[0];continue;case 7:i=a.ops.pop(),a.trys.pop();continue;default:if(!(o=a.trys,(o=o.length>0&&o[o.length-1])||6!==i[0]&&2!==i[0])){a=0;continue}if(3===i[0]&&(!o||i[1]>o[0]&&i[1]0&&o[o.length-1])||6!==i[0]&&2!==i[0])){a=0;continue}if(3===i[0]&&(!o||i[1]>o[0]&&i[1]30720?[4,p("errorHandler")(new Error(r.EXCEED_SINGLE_LOG_SIZE_LIMIT))]:[3,2];case 1:return E.sent(),[2];case 2:return n=new Date,o=h(n),[4,this.getLogDayInfo(o)];case 3:if((i=E.sent()||((I={}).logDay=o,I.totalSize=0,I.reportPagesInfo={pageSizes:[0],pageIds:[ce],failTimes:[0]},I)).totalSize+t>7340032)throw new Error(r.EXCEED_LOG_SIZE_LIMIT);return i.reportPagesInfo&&i.reportPagesInfo.pageSizes||(i.reportPagesInfo={pageSizes:[0],pageIds:[ce],failTimes:[0]}),a=i.reportPagesInfo.pageSizes,s=i.reportPagesInfo.pageIds,u=i.reportPagesInfo.failTimes||[],c=a.length-1,l=s[s.length-1],f=a[c],d=l!==ce||f>0&&f+t>30720,x=a.slice(),d?x.push(t):x[c]+=t,m=x,y=function(){var e=s.slice();return d&&e.push(ce),e}(),g=function(){var e=u.slice();return d&&e.push(0),e}(),(S={}).logReportName=this.logReportNameFormatter(o,d?c+1:c),S.logCreateTime=+n,S.logSize=t,S.logString=e,b=S,(T={}).logDay=o,T.totalSize=i.totalSize+t,T.reportPagesInfo={pageSizes:m,pageIds:y,failTimes:g},w=T,_=6048e5-(+new Date-v(new Date)),[4,this.DB.addItems([{tableName:"log_day_table",item:w,itemDuration:_},{tableName:"log_detail_table",item:b,itemDuration:_}])];case 4:return E.sent(),[2]}var x}))}))},e.prototype.incrementalDelete=function(e,t){return se(this,void 0,void 0,(function(){var n,r,i,a,s,u,c,l,f,p,d,h,g,b;return ue(this,(function(w){switch(w.label){case 0:return[4,this.getLogDayInfo(e)];case 1:return(n=w.sent())&&n.reportPagesInfo&&n.reportPagesInfo.pageSizes instanceof Array?(r=n.reportPagesInfo.pageIds,i=n.reportPagesInfo.pageSizes,a=n.reportPagesInfo.failTimes||[],s=n.totalSize,u=i.reduce((function(e,n,r){return t.indexOf(r)>=0?e+n:e}),0),c=[],l=[],f=i.reduce((function(e,n,i){return t.indexOf(i)>=0?(l.push(i),e.concat([0])):a[i]>=2?(l.push(i),ie({pid:ce,logContent:y("[bigo-log]: reported fail, currentpageId: "+r[i]+", currentSize: "+n,2),encryptVersion:o.PLAIN}),e.concat([0])):(n>0&&c.push(i),e.concat([n]))}),[]),p={},p=c.length>0?ae(ae({},n),{reportPagesInfo:{pageSizes:f,pageIds:r,failTimes:f.map((function(e,t){var n=a[t]||0;return c.includes(t)?n+1:n}))},totalSize:Math.max(s-u,0)}):ae(ae({},n),{reportPagesInfo:{pageSizes:[],pageIds:[],failTimes:[]},totalSize:Math.max(s-u,0)}),d=6048e5-(+new Date-v(new Date))-(v(new Date)-m(e).getTime()),[4,this.DB.addItems([{tableName:"log_day_table",item:p,itemDuration:d}])]):[3,6];case 2:w.sent(),h=0,g=l,w.label=3;case 3:return h-1)return null;var o={},i=n;if(Ee){var a=window.performance.getEntriesByName(r);a.length&&(i=(o=ge(a[a.length-1])).duration)}return{url:r,success:t,cost_time:i,resource_type:ye(e),page_url:window.location.href,success_performance:me(o||{})}}(e,t,n);if(s){if(s.resource_type===fe&&s.url.includes("data:image/png;base64"))return;if(s.resource_type!==he&&Ne.includes(s.url))return;Ne.push(s.url),s.resource_type===he&&(s.error_type=r||0,s.error_msg=o||"",s.status_code=i||"",s=_e(_e({},s),a||{})),Re.push(s)}}catch(e){console.error(e)}}function De(){if(xe){var e={attributes:!1,childList:!0,subtree:!1},t=new MutationObserver((function(e){Array.from(e).forEach((function(e){"childList"===e.type&&Array.from(e.addedNodes).forEach((function(e){var t=e.tagName;t&&ve.includes(t.toLowerCase())&&function(e){e.addEventListener("load",(function(){return Ce(e,Se)})),e.addEventListener("error",(function(){return Ce(e,Te)}))}(e)}))}))}));t.observe(document.head,e),document.onreadystatechange=function(){"interactive"===document.readyState&&t.observe(document.body,e)}}}function Oe(){if(!Ee)return{};var e=Array.from(performance.getEntriesByType("paint")),t=e.length?e:[{},{}],n=t[0],r=t[1],o={FP:n?parseInt(n.duration+n.startTime,10):null,FCP:r?parseInt(r.duration+r.startTime,10):null},i={},a=performance.getEntriesByType("navigation");if(a&&a.length)i=ge(a[0]);else{var s=window.performance.timing;for(var u in s)i[u]=Math.max(+s[u]-s.navigationStart,0)}var c,l=i.connectEnd-i.domainLookupStart,f=i.responseEnd-i.requestStart,p=i.loadEventEnd||i.loadEventStart||i.domComplete||i.domInteractive;return{dns_cost_time:l,html_cost_time:f,js_cost_time:(c=Re.map((function(e){return e.resource_type===pe?e.cost_time:0})),Math.max.apply(Math,Ie(c,[0]))),load_cost_time:p,paint_time:o,performance:i}}function ke(e){try{Ee&&De();var t=function(){setTimeout((function(){(function e(t){var n=1;if(n>=10)return 0;if(t.hasChildNodes())for(var r=t.childNodes,o=0;o=10);o++)1===r.item(o).nodeType&&(n+=e(r.item(o)));return n})(document.body)<10&>({type:2,log_type:i.CRASH})}),3e3);setTimeout((function(){var t={};Ee&&(document.body&&Array.from(document.body.childNodes).forEach((function(e){var t=e.tagName;if(t&&ve.includes(t.toLowerCase())){var n=be(e);Ee&&Ce(e,!!window.performance.getEntriesByName(n)[0])}})),t=Oe()),gt(_e(_e({},e),{type:2,log_type:i.INIT,extra:{performaceDataObj:me(t)}}))}))};!document.readyState||document.readyState&&"complete"===document.readyState?t():window.addEventListener("load",t),window.addEventListener("beforeunload",mt)}catch(e){console.error(e)}}var Pe,je,Le=function(){},Ae=function(e,t,n,r){return new(n||(n=Promise))((function(o,i){function a(e){try{u(r.next(e))}catch(e){i(e)}}function s(e){try{u(r.throw(e))}catch(e){i(e)}}function u(e){var t;e.done?o(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(a,s)}u((r=r.apply(e,t||[])).next())}))},Be=function(e,t){var n,r,o,i,a={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return i={next:s(0),throw:s(1),return:s(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function s(i){return function(s){return function(i){if(n)throw new TypeError("Generator is already executing.");for(;a;)try{if(n=1,r&&(o=2&i[0]?r.return:i[0]?r.throw||((o=r.return)&&o.call(r),0):r.next)&&!(o=o.call(r,i[1])).done)return o;switch(r=0,o&&(i=[2&i[0],o.value]),i[0]){case 0:case 1:o=i;break;case 4:return a.label++,{value:i[1],done:!1};case 5:a.label++,r=i[1],i=[0];continue;case 7:i=a.ops.pop(),a.trys.pop();continue;default:if(!(o=a.trys,(o=o.length>0&&o[o.length-1])||6!==i[0]&&2!==i[0])){a=0;continue}if(3===i[0]&&(!o||i[1]>o[0]&&i[1]=200?e.success&&e.success(n.responseText):e.fail&&e.fail("Request failed, status: "+t+", responseText: "+n.responseText)}},"POST"===e.type){if(e.headers&&!t)for(var r in e.headers)n.setRequestHeader(r,e.headers[r]);n.send(e.data)}else n.send()}({url:e,type:r||"GET",data:t,withCredentials:!!n,headers:o,success:function(e){i(e)},fail:function(e){a(new Error(e||"Request failed"))}})}))]}))}))};function Ge(e){return"[object Array]"===Object.prototype.toString.call(e)}!function(e){e[e.UINT8=1]="UINT8",e[e.UINT16=2]="UINT16",e[e.UINT32=3]="UINT32",e[e.UINT64=4]="UINT64",e[e.STRING=5]="STRING",e[e.VECTOR_STRING=6]="VECTOR_STRING",e[e.MAP_STRING=7]="MAP_STRING",e[e.VECTOR_STRUCT=8]="VECTOR_STRUCT"}(je||(je={}));var Me,Ue=((Pe={})[je.UINT8]=0,Pe[je.UINT16]=0,Pe[je.UINT32]=0,Pe[je.UINT64]=0,Pe[je.STRING]="",Pe[je.VECTOR_STRING]="",Pe[je.MAP_STRING]="",Pe[je.VECTOR_STRUCT]="",Pe),He=function(){function e(e){var t=e.uri,n=e.aid,r=e.model;this.params={},this.uri=String(t),this.aid=String(n),this.model=r}return e.prototype.processVal=function(e,t){switch(t){case je.UINT8:case je.UINT16:case je.UINT32:case je.UINT64:e=parseInt(e,10);break;case je.STRING:e=""+e;break;case je.VECTOR_STRING:var n=[];if(!Ge(e))throw new Error("invalid data type of array");for(var r=0,o=e.length;r0&&o[o.length-1])||6!==i[0]&&2!==i[0])){a=0;continue}if(3===i[0]&&(!o||i[1]>o[0]&&i[1]0))return[3,12];y.label=3;case 3:return y.trys.push([3,10,,11]),[4,g(n[u].map((function(t){var n=t.split("_");return function(e,t){var n,o;return We(this,void 0,void 0,(function(){var i,a,s,u,c,l;return Ze(this,(function(f){switch(f.label){case 0:return[4,Ye.getLogsByReportName(e)];case 1:return(i=f.sent()).length>0?(a=Ye.logReportNameParser(e).pageIndex,s=i.map((function(e){return e.logString})),u=Ye.logReportNameParser(e),c="function"==typeof t.xhrOptsFormatter?t.xhrOptsFormatter(s,u.pageIndex+1,u.logDay):{},l=(null===(n=i[0])||void 0===n?void 0:n.logString)&&JSON.parse(i[0].logString).p,[4,qe(c.reportUrl||t.reportUrl||p("reportUrl"),JSON.stringify(Xe(c.data||Je(Je({},t),{log_content:i.map((function(e){return e.logString})),pid:l,url:window.location.href,extra:Je(Je({},t.extra),{version:$e}),time:(new Date).getTime()}))),(o=c.withCredentials,null!=o&&o),"POST",c.headers||{"Content-Type":"application/json",Accept:"application/json,text/javascript"}).then((function(e){var t,n,o;if("function"==typeof c.responseDealer){var i=c.responseDealer(e);if(i.resultMsg===r.REPORT_LOG_SUCC)return a;throw new Error(i.desc)}var s=void 0;try{s=JSON.parse(e)}catch(t){throw new Error("Try to parse response failed, responseText: "+e)}if(console.log("response",s),void 0===(null===(t=s)||void 0===t?void 0:t.code)||200===(null===(n=s)||void 0===n?void 0:n.code))return a;throw new Error("Server error, code: "+(null===(o=s)||void 0===o?void 0:o.code))}))]):[3,3];case 2:return[2,f.sent()];case 3:return[2,Promise.resolve(null)]}}))}))}(Ye.logReportNameFormatter(n[0],+n[1]),e)})))];case 4:c=y.sent(),(l=c.filter((function(e){return"rejected"===e.status}))).length>0?o[u]={msg:r.REPORT_LOG_PART_FAIL,desc:JSON.stringify(l)}:o[u]={msg:r.REPORT_LOG_SUCC},y.label=5;case 5:return y.trys.push([5,8,,9]),(f=c.filter((function(e){return null!==e.value})).map((function(e){return e.value}))).length>0&&p("incrementalReport")?[4,Ye.incrementalDelete(u,f)]:[3,7];case 6:y.sent(),y.label=7;case 7:return[3,9];case 8:return d=y.sent(),o[u]={msg:r.DELETE_LOG_FAIL,desc:d.message||d.stack||JSON.stringify(d)},[3,9];case 9:return[3,11];case 10:return v=y.sent(),o[u]={msg:r.REPORT_LOG_FAIL,desc:v.message||v.stack||JSON.stringify(v)},[3,11];case 11:return[3,13];case 12:o[u]={msg:r.NO_LOG},y.label=13;case 13:return s+=864e5,[3,2];case 14:return[2,o]}}))}))}))];case 2:return[2,n.sent()]}}))}))}n.d(t,"initConfig",(function(){return lt})),n.d(t,"setConfig",(function(){return ft})),n.d(t,"setConfigByKey",(function(){return pt})),n.d(t,"log",(function(){return dt})),n.d(t,"logWithEncryption",(function(){return ht})),n.d(t,"customLog",(function(){return vt})),n.d(t,"reportAll",(function(){return mt})),n.d(t,"report",(function(){return yt})),n.d(t,"immediateSend",(function(){return gt})),n.d(t,"stop",(function(){return bt})),n.d(t,"destroy",(function(){return wt}));var tt=function(){return(tt=Object.assign||function(e){for(var t,n=1,r=arguments.length;n0&&o[o.length-1])||6!==i[0]&&2!==i[0])){a=0;continue}if(3===i[0]&&(!o||i[1]>o[0]&&i[1]=p("autoReportCount")?[4,mt()]:[3,5];case 4:n.sent(),n.label=5;case 5:return[3,8];case 6:return t=n.sent(),w.errorTrigger(),[4,p("errorHandler")(t)];case 7:return n.sent(),[3,8];case 8:return[3,11];case 9:return[4,p("errorHandler")(new Error(r.EXCEED_TRY_TIMES))];case 10:n.sent(),n.label=11;case 11:return[2]}}))}))}function ut(e){(!document.readyState||document.readyState&&"complete"===document.readyState)&&at?st(e):it.push(e)}function ct(e,t,n){if(!p("stop")){try{!function(e,t){if("number"!=typeof e)throw new Error("logType needs to be set");if(t===o.RSA&&!p("publicKey"))throw new Error("publicKey needs to be set before logWithEncryption")}(t,o.PLAIN)}catch(e){p("errorHandler")(e)}p("_devSend");0,ut({logContent:y(e,t),pid:le.pageId,encryptVersion:n})}}function lt(e){var t,n;e.globalReportConfig&&(e.globalReportConfig=Object.assign({langCode:navigator.language,environment:navigator&&navigator.userAgent},e.globalReportConfig),e.globalReportConfig.userId||("string"==typeof e.globalReportConfig.uid?(e.globalReportConfig.userId=e.globalReportConfig.uid,e.globalReportConfig.uid=0):e.globalReportConfig.userId=String(e.globalReportConfig.uid))),l(e);var r=p("hooks");new Y({onxhr:r.xhr,onfetch:r.fetch,onconsole:r.console,onhistory:r.history,onnativeapi:r.nativeapi,logHandler:dt}).setupOnce(),mt();var o=p("globalReportConfig");((null===(t=o)||void 0===t?void 0:t.device_id)||(null===(n=o)||void 0===n?void 0:n.uid))&&ke(o),at=!0}function ft(e){l(e)}function pt(e,t){f(e,t)}function dt(e,t){void 0===t&&(t=1),p("stop")||ct(e,t,o.PLAIN)}function ht(e,t){p("stop")||ct(e,t,o.RSA)}function vt(e){p("stop")||ut({logContent:e.logContent,pid:e.pid,encryptVersion:e.encryptVersion})}function mt(){return nt(this,void 0,void 0,(function(){var e;return rt(this,(function(t){switch(t.label){case 0:return e=new Date,[4,yt({fromDayString:h(new Date(+e-5184e5)),toDayString:h(e)})];case 1:return[2,t.sent()]}}))}))}function yt(e){return nt(this,void 0,void 0,(function(){return rt(this,(function(t){switch(t.label){case 0:return p("stop")?[2]:(function(e){if(!e)throw new Error("reportConfig needs to be an object");var t="is not valid, needs to be YYYY-MM-DD format";if(!d(e.fromDayString))throw new Error("fromDayString "+t);if(!d(e.toDayString))throw new Error("toDayString "+t);if(e.fromDayString>e.toDayString)throw new Error("fromDayString needs to be no bigger than toDayString")}(e),[4,et(tt(tt({},p("globalReportConfig")),e))]);case 1:return[2,t.sent()]}}))}))}function gt(e){return nt(this,void 0,void 0,(function(){return rt(this,(function(t){switch(t.label){case 0:return[4,Qe(e)];case 1:return[2,t.sent()]}}))}))}function bt(){pt("stop",!0)}function wt(){return nt(this,void 0,void 0,(function(){return rt(this,(function(e){switch(e.label){case 0:return bt(),[4,le.deleteAll()];case 1:return e.sent(),[2]}}))}))}window.addEventListener("load",(function e(){it.forEach((function(e){st(e)})),it=[],window.removeEventListener("load",e)}));t.default={initConfig:lt,log:dt,logWithEncryption:ht,report:yt,customLog:vt,ResultMsg:r,reportAll:mt,setConfig:ft,setConfigByKey:pt,immediateSend:gt,destroy:wt}}])}));