@cloudcare/browser-logs 3.1.1 → 3.1.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/bundle/dataflux-logs.js +1 -1
- package/cjs/boot/buildEnv.js +1 -1
- package/cjs/boot/logsPublicApi.js +33 -11
- package/cjs/boot/logsPublicApi.js.map +1 -1
- package/esm/boot/buildEnv.js +1 -1
- package/esm/boot/logsPublicApi.js +34 -12
- package/esm/boot/logsPublicApi.js.map +1 -1
- package/package.json +3 -3
- package/src/boot/logsPublicApi.js +47 -15
package/bundle/dataflux-logs.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
!function(){"use strict";var e,t={log:"log",debug:"debug",info:"info",warn:"warn",error:"error"},n=function e(n){var r=[].slice.call(arguments,1);Object.prototype.hasOwnProperty.call(t,n)||(n=t.log),e[n].apply(e,r)};function r(e,t){var n,r=window;return r.Zone&&"function"==typeof r.Zone.__symbol__&&(n=e[r.Zone.__symbol__(t)]),n||(n=e[t]),n}n.debug=console.debug.bind(console),n.log=console.log.bind(console),n.info=console.info.bind(console),n.warn=console.warn.bind(console),n.error=console.error.bind(console);var o=!1;function i(e){o=e}function s(e){return function(){return a(e,this,arguments)}}function a(n,r,o){try{return n.apply(r,o)}catch(n){if(u(t.error,n),e)try{e(n)}catch(e){u(t.error,e)}}}function u(e){var t=[].slice.call(arguments,1);o&&n.apply(null,[e,"[MONITOR]"].concat(t))}function c(e,t){return function(){var r=[].slice.call(arguments);try{return e.apply(this,r)}catch(e){n.error(t,e)}}}function f(e){return f="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},f(e)}function l(){if("object"===("undefined"==typeof globalThis?"undefined":f(globalThis)))return globalThis;Object.defineProperty(Object.prototype,"_gc_temp_",{get:function(){return this},configurable:!0});var e=_gc_temp_;return delete Object.prototype._gc_temp_,"object"!==f(e)&&(e="object"===("undefined"==typeof self?"undefined":f(self))?self:"object"===("undefined"==typeof window?"undefined":f(window))?window:{}),e}function d(e,t){return r(l(),"setTimeout")(s(e),t)}function p(e){r(l(),"clearTimeout")(e)}function v(e,t){return r(window,"setInterval")(s(e),t)}function g(e){r(window,"clearInterval")(e)}function h(e){return h="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},h(e)}var y=Array.prototype,m=(Function.prototype,Object.prototype),b=y.slice,_=m.toString,E=m.hasOwnProperty,w=y.forEach,O=Array.isArray,S=function(e,t,n){if(null===e)return!1;if(w&&e.forEach===w)e.forEach(t,n);else if(e.length===+e.length){for(var r=0,o=e.length;r<o;r++)if(r in e&&false===t.call(n,e[r],r,e))return!1}else for(var i in e)if(E.call(e,i)&&false===t.call(n,e[i],i,e))return!1};function x(e){return S(b.call(arguments,1),(function(t){for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n])})),e}var C=function(e){return S(b.call(arguments,1),(function(t){for(var n in t)void 0!==t[n]&&(e[n]=t[n])})),e},T=function(e){return S(b.call(arguments,1),(function(t){for(var n in t)void 0!==t[n]&&($(t[n])&&$(e[n])?C(e[n],t[n]):e[n]=t[n])})),e},R=O||function(e){return"[object Array]"===_.call(e)},L=function(e){if(!e)return!1;try{return/^\s*\bfunction\b/.test(e)}catch(e){return!1}},k=function(e){var t=[];return null===e||S(e,(function(e){t[t.length]=e})),t},A=function(e){var t=[];return null===e||S(e,(function(e,n){t[t.length]=n})),t},D=function(e,t,n){if(e.filter)return e.filter(t);for(var r=[],o=0;o<e.length;o++)if(E.call(e,o)){var i=e[o];t.call(n,i,o,e)&&r.push(i)}return r},I=function(e,t,n){if(e.map)return e.map(t);for(var r=[],o=0;o<e.length;o++)if(E.call(e,o)){var i=e[o];r.push(t.call(n,i,o,e))}return r},M=function(e,t,n){if(e.every)return e.every(t);for(var r=!0,o=0;o<e.length;o++)if(E.call(e,o)){var i=e[o];if(!t.call(n,i,o,e)){r=!1;break}}return r},$=function(e){return null!==e&&"[object Object]"===_.call(e)},U=function(e){if($(e)){for(var t in e)if(E.call(e,t))return!1;return!0}return!1},P=function(e){var t=[];return S(e,(function(e,n){t.push([n,e])})),t},N=function(e){return"[object String]"===_.call(e)},B=function(e){return"[object Boolean]"===_.call(e)},G=function(e){return"[object Number]"===_.call(e)&&/[\d\.]+/.test(String(e))},W=(Date.now,function(e,t,n){var r,o,i=!n||void 0===n.leading||n.leading,s=!n||void 0===n.trailing||n.trailing,a=!1,u=this;return{throttled:function(){a?r=arguments:(i?e.apply(u,arguments):r=arguments,a=!0,o=d((function(){s&&r&&e.apply(u,r),a=!1,r=void 0}),t))},cancel:function(){p(o),a=!1,r=void 0}}}),F=function(e){for(var t,n=[],r={},o=0;o<e.length;o++)(t=e[o])in r||(r[t]=!0,n.push(t));return n};function V(e){return e?(parseInt(e,10)^16*Math.random()>>parseInt(e,10)/4).toString(16):"".concat(1e7,"-",1e3,"-",4e3,"-",8e3,"-",1e11).replace(/[018]/g,V)}var j=function(e){var t=function(e){this._fields={Username:4,Password:5,Port:7,Protocol:2,Host:6,Path:8,URL:0,QueryString:9,Fragment:10},this._values={},this._regex=null,this._regex=/^((\w+):\/\/)?((\w+):?(\w+)?@)?([^\/\?:]+):?(\d+)?(\/?[^\?#]+)?\??([^#]+)?#?(\w*)/,void 0!==e&&this._parse(e)};return t.prototype.setUrl=function(e){this._parse(e)},t.prototype._initValues=function(){for(var e in this._fields)this._values[e]=""},t.prototype.addQueryString=function(e){if("object"!==h(e))return!1;var t=this._values.QueryString||"";for(var n in e)t=new RegExp(n+"[^&]+").test(t)?t.replace(new RegExp(n+"[^&]+"),n+"="+e[n]):"&"===t.slice(-1)?t+n+"="+e[n]:""===t?n+"="+e[n]:t+"&"+n+"="+e[n];this._values.QueryString=t},t.prototype.getParse=function(){return this._values},t.prototype.getUrl=function(){var e="";return e+=this._values.Origin,e+=this._values.Path,e+=this._values.QueryString?"?"+this._values.QueryString:""},t.prototype._parse=function(e){this._initValues();var t=this._regex.exec(e);if(!t)throw"DPURLParser::_parse -> Invalid URL";for(var n in this._fields)void 0!==t[this._fields[n]]&&(this._values[n]=t[this._fields[n]]);this._values.Path=this._values.Path||"/",this._values.Hostname=this._values.Host.replace(/:\d+$/,""),this._values.Origin=this._values.Protocol+"://"+this._values.Hostname+(this._values.Port?":"+this._values.Port:"")},new t(e)};function q(e){return null===e?"null":Array.isArray(e)?"array":h(e)}function H(e,t,n){if(void 0===n&&(n=function(){if("undefined"!=typeof WeakSet){var e=new WeakSet;return{hasAlreadyBeenSeen:function(t){var n=e.has(t);return n||e.add(t),n}}}var t=[];return{hasAlreadyBeenSeen:function(e){var n=t.indexOf(e)>=0;return n||t.push(e),n}}}()),void 0===t)return e;if("object"!==h(t)||null===t)return t;if(t instanceof Date)return new Date(t.getTime());if(t instanceof RegExp){var r=t.flags||[t.global?"g":"",t.ignoreCase?"i":"",t.multiline?"m":"",t.sticky?"y":"",t.unicode?"u":""].join("");return new RegExp(t.source,r)}if(!n.hasAlreadyBeenSeen(t)){if(Array.isArray(t)){for(var o=Array.isArray(e)?e:[],i=0;i<t.length;++i)o[i]=H(o[i],t[i],n);return o}o="object"===q(e)?e:{};for(var s in t)Object.prototype.hasOwnProperty.call(t,s)&&(o[s]=H(o[s],t[s],n));return o}}function Q(e){return H(void 0,e)}function K(){}var X,z=1e3,Y=60*z,Z=60*Y;function J(e){return 0!==e&&100*Math.random()<=e}function ee(e,t){return+e.toFixed(t)}function te(){return performance.now()}function ne(){return{relative:te(),timeStamp:re()}}function re(){return oe()}function oe(){return(new Date).getTime()}function ie(){return void 0===X&&(X=performance.timing.navigationStart),X}function se(e,t){for(var n=t.split(".");n.length;){var r=n.shift();if(!(e&&r in e&&E.call(e,r)))return;e=e[r]}return e}function ae(e,t){var n=e.charCodeAt(t-1);return n>=55296&&n<=56319?e.slice(0,t+1):e.slice(0,t)}function ue(e,t){return-1!==e.indexOf(t)}function ce(e){return G(e)&&e>=0&&e<=100}function fe(e){var t={};return S(e,(function(e,n){var r;t[(r=n,r.replace(/[A-Z]/g,(function(e,t){return(0!==t?"_":"")+e.toLowerCase()})).replace(/-/g,"_"))]=le(e)})),t}function le(e){return R(e)?I(e,(function(e){return le(e)})):"object"===h(e)&&null!==e?fe(e):e}function de(e,t){return null!=e?e:t}function pe(e,t){return e.slice(0,t.length)===t}var ve=function(){this.buffer=[]};ve.prototype={add:function(e){this.buffer.push(e)>500&&this.buffer.splice(0,1)},drain:function(){S(this.buffer,(function(e){e()})),this.buffer.length=0}};var ge=ve;function he(e,t){var n="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(!n){if(Array.isArray(e)||(n=function(e,t){if(!e)return;if("string"==typeof e)return ye(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);"Object"===n&&e.constructor&&(n=e.constructor.name);if("Map"===n||"Set"===n)return Array.from(e);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return ye(e,t)}(e))||t&&e&&"number"==typeof e.length){n&&(e=n);var r=0,o=function(){};return{s:o,n:function(){return r>=e.length?{done:!0}:{done:!1,value:e[r++]}},e:function(e){throw e},f:o}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var i,s=!0,a=!1;return{s:function(){n=n.call(e)},n:function(){var e=n.next();return s=e.done,e},e:function(e){a=!0,i=e},f:function(){try{s||null==n.return||n.return()}finally{if(a)throw i}}}}function ye(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}var me=1/0,be=Y;function _e(e,t){this.expireDelay=e,this.entries=[],this.maxEntries=t;var n=this;this.clearOldContextsInterval=v((function(){n.clearOldContexts()}),be)}_e.prototype.add=function(e,t){var n=this,r={context:e,startTime:t,endTime:me,remove:function(){var e=n.entries.indexOf(r);e>=0&&n.entries.splice(e,1)},close:function(e){r.endTime=e}};return this.maxEntries&&this.entries.length>=this.maxEntries&&this.entries.pop(),this.entries.unshift(r),r},_e.prototype.find=function(e){void 0===e&&(e=me);var t,n=he(this.entries);try{for(n.s();!(t=n.n()).done;){var r=t.value;if(r.startTime<=e){if(e<=r.endTime)return r.context;break}}}catch(e){n.e(e)}finally{n.f()}},_e.prototype.closeActive=function(e){var t=this.entries[0];t&&t.endTime===me&&t.close(e)},_e.prototype.findAll=function(e,t){void 0===t&&(t=0),void 0===e&&(e=me);var n=e+t,r=D(this.entries,(function(t){return t.startTime<=n&&e<=t.endTime}));return I(r,(function(e){return e.context}))},_e.prototype.reset=function(){this.entries=[]},_e.prototype.stop=function(){g(this.clearOldContextsInterval)},_e.prototype.clearOldContexts=function(){for(var e=te()-this.expireDelay;this.entries.length>0&&this.entries[this.entries.length-1].endTime<e;)this.entries.pop()};var Ee={navigator:"undefined"!=typeof window&&void 0!==window.navigator?window.navigator:{},infoMap:{engine:["WebKit","Trident","Gecko","Presto"],browser:["Safari","Chrome","Edge","IE","IE 11","IE 10","IE 9","IE 8","IE 7","Firefox","Firefox Focus","Chromium","Opera","Vivaldi","Yandex","Arora","Lunascape","QupZilla","Coc Coc","Kindle","Iceweasel","Konqueror","Iceape","SeaMonkey","Epiphany","360","360SE","360EE","UC","QQBrowser","QQ","Baidu","Maxthon","Sogou","LBBROWSER","2345Explorer","TheWorld","XiaoMi","Quark","Qiyu","Wechat",,"WechatWork","Taobao","Alipay","Weibo","Douban","Suning","iQiYi"],os:["Windows","Linux","Mac OS","Android","Ubuntu","FreeBSD","Debian","iOS","Windows Phone","BlackBerry","MeeGo","Symbian","Chrome OS","WebOS"],device:["Mobile","Tablet","iPad"]}},we={getMatchMap:function(e){return{Trident:e.indexOf("Trident")>-1||e.indexOf("NET CLR")>-1,Presto:e.indexOf("Presto")>-1,WebKit:e.indexOf("AppleWebKit")>-1,Gecko:e.indexOf("Gecko/")>-1,Safari:e.indexOf("Safari")>-1,Chrome:e.indexOf("Chrome")>-1||e.indexOf("CriOS")>-1,IE:e.indexOf("MSIE")>-1||e.indexOf("Trident")>-1,Edge:e.indexOf("Edge")>-1||e.indexOf("Edg")>-1,Firefox:e.indexOf("Firefox")>-1||e.indexOf("FxiOS")>-1,"Firefox Focus":e.indexOf("Focus")>-1,Chromium:e.indexOf("Chromium")>-1,Opera:e.indexOf("Opera")>-1||e.indexOf("OPR")>-1,Vivaldi:e.indexOf("Vivaldi")>-1,Yandex:e.indexOf("YaBrowser")>-1,Arora:e.indexOf("Arora")>-1,Lunascape:e.indexOf("Lunascape")>-1,QupZilla:e.indexOf("QupZilla")>-1,"Coc Coc":e.indexOf("coc_coc_browser")>-1,Kindle:e.indexOf("Kindle")>-1||e.indexOf("Silk/")>-1,Iceweasel:e.indexOf("Iceweasel")>-1,Konqueror:e.indexOf("Konqueror")>-1,Iceape:e.indexOf("Iceape")>-1,SeaMonkey:e.indexOf("SeaMonkey")>-1,Epiphany:e.indexOf("Epiphany")>-1,360:e.indexOf("QihooBrowser")>-1||e.indexOf("QHBrowser")>-1,"360EE":e.indexOf("360EE")>-1,"360SE":e.indexOf("360SE")>-1,UC:e.indexOf("UC")>-1||e.indexOf(" UBrowser")>-1,QQBrowser:e.indexOf("QQBrowser")>-1,QQ:e.indexOf("QQ/")>-1,Baidu:e.indexOf("Baidu")>-1||e.indexOf("BIDUBrowser")>-1,Maxthon:e.indexOf("Maxthon")>-1,Sogou:e.indexOf("MetaSr")>-1||e.indexOf("Sogou")>-1,LBBROWSER:e.indexOf("LBBROWSER")>-1,"2345Explorer":e.indexOf("2345Explorer")>-1,TheWorld:e.indexOf("TheWorld")>-1,XiaoMi:e.indexOf("MiuiBrowser")>-1,Quark:e.indexOf("Quark")>-1,Qiyu:e.indexOf("Qiyu")>-1,Wechat:e.indexOf("MicroMessenger")>-1,Taobao:e.indexOf("AliApp(TB")>-1,Alipay:e.indexOf("AliApp(AP")>-1,Weibo:e.indexOf("Weibo")>-1,Douban:e.indexOf("com.douban.frodo")>-1,Suning:e.indexOf("SNEBUY-APP")>-1,iQiYi:e.indexOf("IqiyiApp")>-1,Windows:e.indexOf("Windows")>-1,Linux:e.indexOf("Linux")>-1||e.indexOf("X11")>-1,"Mac OS":e.indexOf("Macintosh")>-1,Android:e.indexOf("Android")>-1||e.indexOf("Adr")>-1,Ubuntu:e.indexOf("Ubuntu")>-1,FreeBSD:e.indexOf("FreeBSD")>-1,Debian:e.indexOf("Debian")>-1,"Windows Phone":e.indexOf("IEMobile")>-1||e.indexOf("Windows Phone")>-1,BlackBerry:e.indexOf("BlackBerry")>-1||e.indexOf("RIM")>-1,MeeGo:e.indexOf("MeeGo")>-1,Symbian:e.indexOf("Symbian")>-1,iOS:e.indexOf("like Mac OS X")>-1,"Chrome OS":e.indexOf("CrOS")>-1,WebOS:e.indexOf("hpwOS")>-1,Mobile:e.indexOf("Mobi")>-1||e.indexOf("iPh")>-1||e.indexOf("480")>-1,Tablet:e.indexOf("Tablet")>-1||e.indexOf("Nexus 7")>-1,iPad:e.indexOf("iPad")>-1}},matchInfoMap:function(e){var t=Ee.navigator.userAgent||"",n=we.getMatchMap(t);for(var r in Ee.infoMap)for(var o=0;o<Ee.infoMap[r].length;o++){var i=Ee.infoMap[r][o];n[i]&&(e[r]=i)}},getOS:function(){return we.matchInfoMap(this),this.os||"Unknown"},getOSVersion:function(){var e=this,t=Ee.navigator.userAgent||"";e.osVersion="",e.osMajor="";var n={Windows:function(){var e=t.replace(/^.*Windows NT ([\d.]+);.*$/,"$1");return{6.4:"10",6.3:"8.1",6.2:"8",6.1:"7","6.0":"Vista",5.2:"XP",5.1:"XP","5.0":"2000"}[e]||e},Android:function(){return t.replace(/^.*Android ([\d.]+);.*$/,"$1")},iOS:function(){return t.replace(/^.*OS ([\d_]+) like.*$/,"$1").replace(/_/g,".")},Debian:function(){return t.replace(/^.*Debian\/([\d.]+).*$/,"$1")},"Windows Phone":function(){return t.replace(/^.*Windows Phone( OS)? ([\d.]+);.*$/,"$2")},"Mac OS":function(){return t.replace(/^.*Mac OS X ([\d_]+).*$/,"$1").replace(/_/g,".")},WebOS:function(){return t.replace(/^.*hpwOS\/([\d.]+);.*$/,"$1")}};return n[e.os]&&(e.osVersion=n[e.os](),e.osVersion===t&&(e.osVersion="")),e.osVersion&&(e.osMajor=e.osVersion.split(".").length&&e.osVersion.split(".")[0]),{version:e.osVersion,osMajor:e.osMajor}},getOrientationStatu:function(){return window.matchMedia("(orientation: portrait)").matches?"竖屏":"横屏"},getDeviceType:function(){var e=this;return e.device="PC",we.matchInfoMap(e),e.device},getNetwork:function(){var e=window.navigator.connection||window.navigator.mozConnection||window.navigator.webkitConnection,t="unknown",n=e?e.type||e.effectiveType:null;if(n&&"string"==typeof n)switch(n){case"bluetooth":case"cellular":case"slow-2g":case"2g":case"3g":t="cellular";break;case"none":t="none";break;case"ethernet":case"wifi":case"wimax":case"4g":t="wifi";break;case"other":case"unknown":t="unknown"}return t},getLanguage:function(){var e;return this.language=((e=(Ee.navigator.browserLanguage||Ee.navigator.language||"").split("-"))[1]&&(e[1]=e[1].toUpperCase()),e.join("_")),this.language},getBrowserInfo:function(){var e=this;we.matchInfoMap(e);var t=Ee.navigator.userAgent||"",n=function(e,t){var n=Ee.navigator.mimeTypes;for(var r in n)if(n[r][e]==t)return!0;return!1},r=we.getMatchMap(t),o=!1;if("undefined"!=typeof window&&window.chrome){var i=t.replace(/^.*Chrome\/([\d]+).*$/,"$1");i>36&&window.showModalDialog?o=!0:i>45&&(o=n("type","application/vnd.chromium.remoting-viewer"))}if(r.Baidu&&r.Opera&&(r.Baidu=!1),r.Mobile&&(r.Mobile=!(t.indexOf("iPad")>-1)),o&&(n("type","application/gameplugin")||Ee.navigator&&void 0===Ee.navigator.connection.saveData?r["360SE"]=!0:r["360EE"]=!0),r.IE||r.Edge)switch(window.screenTop-window.screenY){case 71:case 74:case 99:case 75:case 74:case 105:default:break;case 102:r["360EE"]=!0;break;case 104:r["360SE"]=!0}var s={Safari:function(){return t.replace(/^.*Version\/([\d.]+).*$/,"$1")},Chrome:function(){return t.replace(/^.*Chrome\/([\d.]+).*$/,"$1").replace(/^.*CriOS\/([\d.]+).*$/,"$1")},IE:function(){return t.replace(/^.*MSIE ([\d.]+).*$/,"$1").replace(/^.*rv:([\d.]+).*$/,"$1")},Edge:function(){return t.replace(/^.*Edge?\/([\d.]+).*$/,"$1")},Firefox:function(){return t.replace(/^.*Firefox\/([\d.]+).*$/,"$1").replace(/^.*FxiOS\/([\d.]+).*$/,"$1")},"Firefox Focus":function(){return t.replace(/^.*Focus\/([\d.]+).*$/,"$1")},Chromium:function(){return t.replace(/^.*Chromium\/([\d.]+).*$/,"$1")},Opera:function(){return t.replace(/^.*Opera\/([\d.]+).*$/,"$1").replace(/^.*OPR\/([\d.]+).*$/,"$1")},Vivaldi:function(){return t.replace(/^.*Vivaldi\/([\d.]+).*$/,"$1")},Yandex:function(){return t.replace(/^.*YaBrowser\/([\d.]+).*$/,"$1")},Arora:function(){return t.replace(/^.*Arora\/([\d.]+).*$/,"$1")},Lunascape:function(){return t.replace(/^.*Lunascape[\/\s]([\d.]+).*$/,"$1")},QupZilla:function(){return t.replace(/^.*QupZilla[\/\s]([\d.]+).*$/,"$1")},"Coc Coc":function(){return t.replace(/^.*coc_coc_browser\/([\d.]+).*$/,"$1")},Kindle:function(){return t.replace(/^.*Version\/([\d.]+).*$/,"$1")},Iceweasel:function(){return t.replace(/^.*Iceweasel\/([\d.]+).*$/,"$1")},Konqueror:function(){return t.replace(/^.*Konqueror\/([\d.]+).*$/,"$1")},Iceape:function(){return t.replace(/^.*Iceape\/([\d.]+).*$/,"$1")},SeaMonkey:function(){return t.replace(/^.*SeaMonkey\/([\d.]+).*$/,"$1")},Epiphany:function(){return t.replace(/^.*Epiphany\/([\d.]+).*$/,"$1")},360:function(){return t.replace(/^.*QihooBrowser\/([\d.]+).*$/,"$1")},"360SE":function(){return{63:"10.0",55:"9.1",45:"8.1",42:"8.0",31:"7.0",21:"6.3"}[t.replace(/^.*Chrome\/([\d]+).*$/,"$1")]||""},"360EE":function(){return{69:"11.0",63:"9.5",55:"9.0",50:"8.7",30:"7.5"}[t.replace(/^.*Chrome\/([\d]+).*$/,"$1")]||""},Maxthon:function(){return t.replace(/^.*Maxthon\/([\d.]+).*$/,"$1")},QQBrowser:function(){return t.replace(/^.*QQBrowser\/([\d.]+).*$/,"$1")},QQ:function(){return t.replace(/^.*QQ\/([\d.]+).*$/,"$1")},Baidu:function(){return t.replace(/^.*BIDUBrowser[\s\/]([\d.]+).*$/,"$1")},UC:function(){return t.replace(/^.*UC?Browser\/([\d.]+).*$/,"$1")},Sogou:function(){return t.replace(/^.*SE ([\d.X]+).*$/,"$1").replace(/^.*SogouMobileBrowser\/([\d.]+).*$/,"$1")},LBBROWSER:function(){var e="";t.indexOf("LieBaoFast")>-1&&(e=t.replace(/^.*LieBaoFast\/([\d.]+).*$/,"$1"));var n=t.replace(/^.*Chrome\/([\d]+).*$/,"$1");return e||{57:"6.5",49:"6.0",46:"5.9",42:"5.3",39:"5.2",34:"5.0",29:"4.5",21:"4.0"}[n]||""},"2345Explorer":function(){return t.replace(/^.*2345Explorer\/([\d.]+).*$/,"$1")},TheWorld:function(){return t.replace(/^.*TheWorld ([\d.]+).*$/,"$1")},XiaoMi:function(){return t.replace(/^.*MiuiBrowser\/([\d.]+).*$/,"$1")},Quark:function(){return t.replace(/^.*Quark\/([\d.]+).*$/,"$1")},Qiyu:function(){return t.replace(/^.*Qiyu\/([\d.]+).*$/,"$1")},Wechat:function(){return t.replace(/^.*MicroMessenger\/([\d.]+).*$/,"$1")},WechatWork:function(){return t.replace(/^.*wxwork\/([\d.]+).*$/,"$1")},Taobao:function(){return t.replace(/^.*AliApp\(TB\/([\d.]+).*$/,"$1")},Alipay:function(){return t.replace(/^.*AliApp\(AP\/([\d.]+).*$/,"$1")},Weibo:function(){return t.replace(/^.*weibo__([\d.]+).*$/,"$1")},Douban:function(){return t.replace(/^.*com.douban.frodo\/([\d.]+).*$/,"$1")},Suning:function(){return t.replace(/^.*SNEBUY-APP([\d.]+).*$/,"$1")},iQiYi:function(){return t.replace(/^.*IqiyiVersion\/([\d.]+).*$/,"$1")}};return e.browserVersion="",e.browserMajor="",s[e.browser]&&(e.browserVersion=s[e.browser](),e.browserVersion==t&&(e.browserVersion="")),"Chrome"==e.browser&&t.match(/\S+Browser/)&&(e.browser=t.match(/\S+Browser/)[0],e.version=t.replace(/^.*Browser\/([\d.]+).*$/,"$1")),"Edge"==e.browser&&(e.version>"75"?e.engine="Blink":e.engine="EdgeHTML"),("Chrome"==e.browser&&parseInt(e.browserVersion)>27||r.Chrome&&"WebKit"==e.engine&&parseInt(e.browserVersion)>27||"Opera"==e.browser&&parseInt(e.version)>12||"Yandex"==e.browser)&&(e.engine="Blink"),e.browserVersion&&(e.browserMajor=e.browserVersion.split(".").length&&this.browserVersion.split(".")[0]),{browser:e.browser,browserVersion:e.browserVersion,engine:e.engine,browserMajor:e.browserMajor}},getGeoPostion:function(e){navigator&&navigator.geolocation&&navigator.geolocation.getCurrentPosition((function(t){e(t)}),(function(e){n.warn(e)}))}},Oe={};"undefined"!=typeof window&&(Oe={os:we.getOS(),osVersion:we.getOSVersion().version,osVersionMajor:we.getOSVersion().osMajor,browser:we.getBrowserInfo().browser,browserVersion:we.getBrowserInfo().browserVersion,browserVersionMajor:we.getBrowserInfo().browserMajor,screenSize:window.screen.width+"*"+window.screen.height,networkType:we.getNetwork(),divice:we.getDeviceType()});var Se=Oe,xe={BEFORE_UNLOAD:"beforeunload",CLICK:"click",DBL_CLICK:"dblclick",KEY_DOWN:"keydown",LOAD:"load",POP_STATE:"popstate",SCROLL:"scroll",TOUCH_START:"touchstart",TOUCH_END:"touchend",TOUCH_MOVE:"touchmove",VISIBILITY_CHANGE:"visibilitychange",PAGE_SHOW:"pageshow",FREEZE:"freeze",RESUME:"resume",DOM_CONTENT_LOADED:"DOMContentLoaded",POINTER_DOWN:"pointerdown",POINTER_UP:"pointerup",POINTER_CANCEL:"pointercancel",HASH_CHANGE:"hashchange",PAGE_HIDE:"pagehide",MOUSE_DOWN:"mousedown",MOUSE_UP:"mouseup",MOUSE_MOVE:"mousemove",FOCUS:"focus",BLUR:"blur",CONTEXT_MENU:"contextmenu",RESIZE:"resize",CHANGE:"change",INPUT:"input",PLAY:"play",PAUSE:"pause",SECURITY_POLICY_VIOLATION:"securitypolicyviolation",SELECTION_CHANGE:"selectionchange"},Ce={ACTION:"action",ERROR:"error",LONG_TASK:"long_task",VIEW:"view",RESOURCE:"resource",LOGGER:"logger"},Te={FETCH:"fetch",XHR:"xhr"},Re={HANDLED:"handled",UNHANDLED:"unhandled"},Le={UNCAUGHT:"Uncaught",PROVIDED:"Provided"};function ke(e,t,n){var r=e[t],o=n(r),i=function(){if("function"==typeof o)return o.apply(this,arguments)};return e[t]=i,{stop:function(){e[t]===i?e[t]=r:o=r}}}function Ae(e,t,n){return ke(e,t,(function(e){return function(){var t;return n&&n.before&&a(n.before,this,arguments),"function"==typeof e&&(t=e.apply(this,arguments)),n&&n.after&&a(n.after,this,arguments),t}}))}function De(e){return De="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},De(e)}function Ie(e,t,n){if("object"!==De(e)||null===e)return JSON.stringify(e);var r=Me(Object.prototype),o=Me(Array.prototype),i=Me(Object.getPrototypeOf(e)),s=Me(e);try{return JSON.stringify(e,t,n)}catch(e){return"<error: unable to serialize object>"}finally{r(),o(),i(),s()}}function Me(e){var t=e,n=t.toJSON;return n?(delete t.toJSON,function(){t.toJSON=n}):K}function $e(e){return $e="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},$e(e)}var Ue="?";function Pe(e){var t=[],n=He(e,"stack");return n&&S(n.split("\n"),(function(e){var n=function(e){var t=Ge.exec(e);if(!t)return;var n=t[2]&&0===t[2].indexOf("native"),r=t[2]&&0===t[2].indexOf("eval"),o=We.exec(t[2]);r&&o&&(t[2]=o[1],t[3]=o[2],t[4]=o[3]);return{args:n?[t[2]]:[],column:t[4]?+t[4]:void 0,func:t[1]||Ue,line:t[3]?+t[3]:void 0,url:n?void 0:t[2]}}(e)||function(e){var t=Fe.exec(e);if(!t)return;return{args:[],column:t[3]?+t[3]:void 0,func:Ue,line:t[2]?+t[2]:void 0,url:t[1]}}(e)||function(e){var t=Ve.exec(e);if(!t)return;return{args:[],column:t[4]?+t[4]:void 0,func:t[1]||Ue,line:+t[3],url:t[2]}}(e)||function(e){var t=je.exec(e);if(!t)return;var n=t[3]&&t[3].indexOf(" > eval")>-1,r=qe.exec(t[3]);n&&r&&(t[3]=r[1],t[4]=r[2],t[5]=void 0);return{args:t[2]?t[2].split(","):[],column:t[5]?+t[5]:void 0,func:t[1]||Ue,line:t[4]?+t[4]:void 0,url:t[3]}}(e);n&&(!n.func&&n.line&&(n.func=Ue),t.push(n))})),{message:He(e,"message"),name:He(e,"name"),stack:t}}var Ne="((?:file|https?|blob|chrome-extension|native|eval|webpack|<anonymous>|\\w+\\.|\\/).*?)",Be="(?::(\\d+))",Ge=new RegExp("^\\s*at (.*?) ?\\("+Ne+Be+"?"+Be+"?\\)?\\s*$","i"),We=new RegExp("\\((\\S*)"+Be+Be+"\\)");var Fe=new RegExp("^\\s*at ?"+Ne+Be+"?"+Be+"??\\s*$","i");var Ve=/^\s*at (?:((?:\[object object\])?.+) )?\(?((?:file|ms-appx|https?|webpack|blob):.*?):(\d+)(?::(\d+))?\)?\s*$/i;var je=/^\s*(.*?)(?:\((.*?)\))?(?:^|@)((?:file|https?|blob|chrome|webpack|resource|capacitor|\[native).*?|[^@]*bundle)(?::(\d+))?(?::(\d+))?\s*$/i,qe=/(\S+) line (\d+)(?: > eval line \d+)* > eval/i;function He(e,t){if("object"===$e(e)&&e&&t in e){var n=e[t];return"string"==typeof n?n:void 0}}var Qe=/^(?:[Uu]ncaught (?:exception: )?)?(?:((?:Eval|Internal|Range|Reference|Syntax|Type|URI|)Error): )?([\s\S]*)$/;function Ke(e){var t=function(e){return Ae(window,"onerror",{before:function(t,n,r,o,i){var s;if(i instanceof Error)s=Pe(i);else{var a={url:n,column:o,line:r},u=function(e){var t,n;if("[object String]"==={}.toString.call(e)){var r=Qe.exec(e);r&&(t=r[1],n=r[2])}return{name:t,message:n}}(t);s={name:u.name,message:u.message,stack:[a]}}e(s,de(i,t))}})}(e),n=function(e){return Ae(window,"onunhandledrejection",{before:function(t){var n=t.reason||"Empty reason",r=Pe(n);e(r,n)}})}(e);return{stop:function(){t.stop(),n.stop()}}}var Xe="No stack, consider using an instance of Error",ze={AGENT:"agent",CONSOLE:"console",NETWORK:"network",SOURCE:"source",LOGGER:"logger",CUSTOM:"custom"};function Ye(e){var t=e.stackTrace,n=e.originalError,r=e.handlingStack,o=e.startClocks,i=e.nonErrorPrefix,s=e.source,a=e.handling,u=n instanceof Error,c=function(e,t,n,r){return e&&e.message&&e&&e.name?e.message:t?"Empty message":n+" "+Ie(sanitize(r))}(t,u,i,n),f=function(e,t){if(void 0===t)return!1;if(e)return!0;return t.stack.length>0&&(t.stack.length>1||void 0!==t.stack[0].url)}(u,t)?Ze(t):Xe,l=u?function(e,t){var n=e,r=[];for(;n&&n.cause instanceof Error&&r.length<10;){var o=Pe(n.cause);r.push({message:n.cause.message,source:t,type:o&&o.name,stack:o&&Ze(o)}),n=n.cause}return r.length?r:void 0}(n,s):void 0;return{startClocks:o,source:s,handling:a,originalError:n,message:c,stack:f,handlingStack:r,type:t&&t.name,causes:l}}function Ze(e){var t=Je(e);return S(e.stack,(function(e){var n="?"===e.func?"<anonymous>":e.func,r=e.args&&e.args.length>0?"("+e.args.join(", ")+")":"",o=e.line?":"+e.line:"",i=e.line&&e.column?":"+e.column:"";t+="\n at "+n+r+" @ "+e.url+o+i})),t}function Je(e){return(e.name||"Error")+": "+e.message}var et=1024,tt=1024*et,nt=/[^\u0000-\u007F]/;function rt(e){return nt.test(e)?void 0!==window.TextEncoder?(new TextEncoder).encode(e).length:new Blob([e]).size:e.length}var ot=function(e){this.observers=[],this.onLastUnsubscribe=void 0,this.onFirstSubscribe=e};ot.prototype={subscribe:function(e){!this.observers.length&&this.onFirstSubscribe&&(this.onLastUnsubscribe=this.onFirstSubscribe()||void 0),this.observers.push(e);var t=this;return{unsubscribe:function(){t.observers=D(t.observers,(function(t){return e!==t})),!t.observers.length&&t.onLastUnsubscribe&&t.onLastUnsubscribe()}}},notify:function(e){S(this.observers,(function(t){t(e)}))}};var it=ot;function st(){var e=[].slice.call(arguments),t=new it((function(){var n=I(e,(function(e){return e.subscribe((function(e){return t.notify(e)}))}));return function(){return S(n,(function(e){return e.unsubscribe()}))}}));return t}var at={};function ut(e){var n=I(e,(function(e){return at[e]||(at[e]=function(e){var n=new it((function(){var r=console[e];return console[e]=function(){var o=[].slice.call(arguments);r.apply(console,arguments);var i=function(){var e,t=new Error;if(!t.stack)try{throw t}catch(e){}return a((function(){var n=Pe(t);n.stack=n.stack.slice(2),e=Ze(n)})),e}();a((function(){n.notify(function(e,n,r){var o,i=I(e,(function(e){return function(e){if("string"==typeof e)return e;if(e instanceof Error)return Je(Pe(e));return Ie(e,void 0,2)}(e)})).join(" ");if(n===t.error){var s=function(e,t){for(var n=0;n<e.length;n+=1){var r=e[n];if(t(r,n,e))return r}}(e,(function(e){return e instanceof Error}));o=s?Ze(Pe(s)):void 0,i="console error: "+i}return{api:n,message:i,stack:o,handlingStack:r}}(o,e,i))}))},function(){console[e]=r}}));return n}(e)),at[e]}));return st.apply(this,n)}function ct(e,t,n,r){return ft(e,[t],n,r)}function ft(e,t,n,o){var i=s(o&&o.once?function(e){u(),n(e)}:n);o=o&&o.passive?{capture:o.capture,passive:o.passive}:o&&o.capture;var a=r(e,"addEventListener");S(t,(function(t){a.call(e,t,i,o)}));var u=function(){var n=r(e,"removeEventListener");S(t,(function(t){n.call(e,t,i,o)}))};return{stop:u}}var lt={intervention:"intervention",deprecation:"deprecation",cspViolation:"csp_violation"};function dt(e,t){var n,r=[];ue(t,lt.cspViolation)&&r.push(n=new it((function(){var e=function(e){n.notify(function(e){var t=lt.cspViolation,n="'"+e.blockedURI+"' blocked by '"+e.effectiveDirective+"' directive";return{type:lt.cspViolation,subtype:e.effectiveDirective,message:t+": "+n,stack:pt(e.effectiveDirective,n+' of the policy "'+ae(e.originalPolicy,100)+'"',e.sourceFile,e.lineNumber,e.columnNumber)}}(e))};return ct(document,xe.SECURITY_POLICY_VIOLATION,e).stop})));var o=D(t,(function(e){return e!==lt.cspViolation}));return o.length&&r.push(function(e){var t=new it((function(){if(window.ReportingObserver){var n=s((function(e){S(e,(function(e){t.notify(function(e){var t=e.body,n=e.type;return{type:n,subtype:t.id,message:n+": "+t.message,stack:pt(t.id,t.message,t.sourceFile,t.lineNumber,t.columnNumber)}}(e))}))})),r=new window.ReportingObserver(n,{types:e,buffered:!0});return r.observe(),function(){r.disconnect()}}}));return t}(o)),st.apply(this,r)}function pt(e,t,n,r,o){return n&&Ze({name:e,message:t,stack:[{func:"?",url:n,line:r,column:o}]})}function vt(e){return vt="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},vt(e)}var gt=220*et;function ht(e,t,n,r,o){var i=function(e){var t=e;if(t&&"function"==typeof t.toJSON)try{return t.toJSON()}catch(e){}return e}(e);if(!i||"object"!==vt(i))return function(e){if("bigint"==typeof e)return"[BigInt] "+e.toString();if("function"==typeof e)return"[Function] "+e.name||0;if("symbol"===vt(e))return"[Symbol] "+e.description||0;return e}(i);var s=function(e){try{if(e instanceof Event)return{isTrusted:e.isTrusted};var t=Object.prototype.toString.call(e).match(/\[object (.*)\]/);if(t&&t[1])return"["+t[1]+"]"}catch(e){}return"[Unserializable]"}(i);if("[Object]"!==s&&"[Array]"!==s&&"[Error]"!==s)return s;var a=e;if(o.has(a))return"[Reference seen at "+o.get(a)+"]";var u=void 0!==n?t+"."+n:t,c=Array.isArray(i)?[]:{};return o.set(a,u),r.push({source:i,target:c,path:u}),c}function yt(e,t,r){n.warn("The data provided has been "+t+" as it is over the limit of "+e+" characters:",r)}var mt=function(){this._events=[],this.pendingEvents=[]};mt.prototype={emit:function(e){var t=[].slice.call(arguments,1);S(this._events,(function(n){if(n.type!==e)return!1;n.callback.apply(n.context,t)}))},on:function(e,t,n){"function"==typeof t&&this._events.push({type:e,callback:t,context:n||this})}};new mt;var bt,_t={PERFORMANCE_ENTRIES_COLLECTED:"PERFORMANCE_ENTRIES_COLLECTED",AUTO_ACTION_COMPLETED:"AUTO_ACTION_COMPLETED",VIEW_CREATED:"VIEW_CREATED",VIEW_UPDATED:"VIEW_UPDATED",VIEW_ENDED:"VIEW_ENDED",SESSION_RENEWED:"SESSION_RENEWED",SESSION_EXPIRED:"SESSION_EXPIRED",PAGE_EXITED:"PAGE_EXITED",REQUEST_STARTED:"REQUEST_STARTED",REQUEST_COMPLETED:"REQUEST_COMPLETED",RAW_RUM_EVENT_COLLECTED:"RAW_RUM_EVENT_COLLECTED",RUM_EVENT_COLLECTED:"RUM_EVENT_COLLECTED",RAW_ERROR_COLLECTED:"RAW_ERROR_COLLECTED",RAW_LOG_COLLECTED:"RAW_LOG_COLLECTED",LOG_COLLECTED:"LOG_COLLECTED"};function Et(){this.callbacks={}}function wt(e){return Ot(e,function(e){if(e.origin&&"null"!==e.origin)return e.origin;var t=e.host.replace(/(:80|:443)$/,"");return e.protocol+"//"+t}(window.location)).href}function Ot(e,t){if(function(){if(void 0!==bt)return bt;try{var e=new URL("http://test/path");return bt="http://test/path"===e.href}catch(e){bt=!1}return bt}())return void 0!==t?new URL(e,t):new URL(e);if(void 0===t&&!/:/.test(e))throw new Error("Invalid URL: "+e);var n=document,r=n.createElement("a");if(void 0!==t){var o=(n=document.implementation.createHTMLDocument("")).createElement("base");o.href=t,n.head.appendChild(o),n.body.appendChild(r)}return r.href=e,r}Et.prototype={notify:function(e,t){var n=this.callbacks[e];n&&S(n,(function(e){e(t)}))},subscribe:function(e,t){this.callbacks[e]||(this.callbacks[e]=[]),this.callbacks[e].push(t);var n=this;return{unsubscribe:function(){n.callbacks[e]=D(n.callbacks[e],(function(e){return e!==t}))}}}};var St=navigator.userAgent.toLowerCase(),xt=function(){return/iphone os/.test(St)};var Ct,Tt=z;function Rt(e,t,n,r){var o=new Date;o.setTime(o.getTime()+n);var i="expires="+o.toUTCString(),s=r&&r.crossSite?"none":"strict",a=r&&r.domain?";domain="+r.domain:"",u=r&&r.secure?";secure":"";document.cookie=e+"="+t+";"+i+";path=/;samesite="+s+a+u}function Lt(e){return function(e,t){var n=e.match("(?:^|;)\\s*"+t+"\\s*=\\s*([^;]+)");return n?n[1]:void 0}(document.cookie,e)}var kt=/^\s+|\s+$/g,At={rum:"/rum",log:"/logging",sessionReplay:"/rum/replay"};function Dt(e,t){var n=At[t];return n?(0===e.indexOf("/")&&(e=location.origin+It(e)),e.lastIndexOf("/")===e.length-1?It(e)+"v1/write"+n:It(e)+"/v1/write"+n):""}function It(e){return e.replace(kt,"")}var Mt,$t;function Ut(e){if(void 0===e.sampleRate||ce(e.sampleRate))if(void 0===e.sessionSampleRate||ce(e.sessionSampleRate)){if(void 0===e.telemetrySampleRate||ce(e.telemetrySampleRate)){var t=e.sessionSampleRate||e.sampleRate;return x({beforeSend:e.beforeSend&&c(e.beforeSend,"beforeSend threw an error:"),cookieOptions:Pt(e),sessionSampleRate:de(t,100),service:e.service,version:e.version,env:e.env,telemetrySampleRate:de(e.telemetrySampleRate,100),telemetryEnabled:de(e.telemetryEnabled,!1),silentMultipleInit:!!e.silentMultipleInit,batchBytesLimit:16*et,eventRateLimiterThreshold:3e3,maxTelemetryEventsPerPage:15,flushTimeout:30*z,batchMessagesLimit:50,messageBytesLimit:256*et,resourceUrlLimit:5*et},function(e){var t=function(e){return!1};"isIntakeUrl"in e&&L(e.isIntakeUrl)&&B(e.isIntakeUrl())&&(t=e.isIntakeUrl);var n=function(e){return!1};return"isServerError"in e&&L(e.isServerError)&&B(e.isServerError())&&(n=e.isServerError),{rumEndpoint:Dt(e.datakitUrl||e.datakitOrigin,"rum"),logsEndpoint:Dt(e.datakitOrigin,"log"),sessionReplayEndPoint:Dt(e.datakitOrigin,"sessionReplay"),isIntakeUrl:t,isServerError:n}}(e))}n.error("Telemetry Sample Rate should be a number between 0 and 100")}else n.error("Sample Rate should be a number between 0 and 100");else n.error("Sample Rate should be a number between 0 and 100")}function Pt(e){var t={};return t.secure=function(e){return!!e.useSecureSessionCookie||!!e.useCrossSiteSessionCookie}(e),t.crossSite=!!e.useCrossSiteSessionCookie,e.trackSessionAcrossSubdomains&&(t.domain=function(){if(void 0===Ct){for(var e="dd_site_test_".concat(V()),t=window.location.hostname.split("."),n=t.pop();t.length&&!Lt(e);)n=t.pop()+"."+n,Rt(e,"test",z,{domain:n});Ct=n}return Ct}()),t}function Nt(){var e;return Mt||(e=new it((function(){if(window.fetch)return ke(window,"fetch",(function(t){return function(n,r){var o,i=a(Bt,null,[e,n,r]);return i?(o=t.call(this,i.input,i.init),a(Gt,null,[e,o,i])):o=t.call(this,n,r),o}})).stop})),Mt=e),Mt}function Bt(e,t,n){var r=n&&n.method||t instanceof Request&&t.method||"GET",o=t instanceof Request?t.url:wt(String(t)),i={state:"start",init:n,input:t,method:r,startClocks:ne(),url:o};return e.notify(i),i}function Gt(e,t,n){var r=function(t){var r=n;if(r.state="resolve","stack"in t||t instanceof Error)r.status=0,r.isAborted=t instanceof DOMException&&t.code===DOMException.ABORT_ERR,r.error=t;else if("status"in t){r.response=t;try{r.responseType=t.constructor===Response&&t.type||""}catch(e){r.responseType=""}r.status=t.status,r.isAborted=!1}e.notify(r)};t.then(s(r),s(r))}var Wt={},Ft="_DATAFLUX_REQUEST_UUID";function Vt(){var e;return $t||(e=new it((function(){var t=Ae(XMLHttpRequest.prototype,"open",{before:jt}),n=Ae(XMLHttpRequest.prototype,"send",{before:function(){qt.call(this,e)}}),r=Ae(XMLHttpRequest.prototype,"abort",{before:Qt});return function(){t.stop(),n.stop(),r.stop()}})),$t=e),$t}function jt(e,t){var n=this[Ft]||V();this[Ft]=n,Wt[n]={state:"open",method:e,url:wt(String(t))}}function qt(e){var t=Wt[this[Ft]];if(t){var n=t;n.state="start",n.startTime=te(),n.startClocks=ne(),n.isAborted=!1,n.xhr=this;var r=!1,o=Ae(this,"onreadystatechange",{before:function(){this.readyState===XMLHttpRequest.DONE&&i.call(this)}}).stop,i=function(){if(s(),o(),!r){r=!0;var i,a=t;a.state="complete",a.duration=(i=n.startClocks.timeStamp,re()-i),a.status=this.status,e.notify(x({},a)),Ht.call(this)}},s=ct(this,"loadend",i).stop;e.notify(n)}}function Ht(){delete Wt[this[Ft]],delete this[Ft]}function Qt(){var e=Wt[this[Ft]];e&&(e.isAborted=!0)}var Kt={HIDDEN:"visibility_hidden",UNLOADING:"before_unload",PAGEHIDE:"page_hide",FROZEN:"page_frozen"};var Xt,zt={sdk_name:"_gc.sdk_name",sdk_version:"_gc.sdk_version",app_id:"application.id",env:"env",service:"service",version:"version",userid:"user.id",user_email:"user.email",user_name:"user.name",session_id:"session.id",session_type:"session.type",session_sampling:"session.is_sampling",session_has_replay:"session.has_replay",is_signin:"user.is_signin",os:"device.os",os_version:"device.os_version",os_version_major:"device.os_version_major",browser:"device.browser",browser_version:"device.browser_version",browser_version_major:"device.browser_version_major",screen_size:"device.screen_size",network_type:"device.network_type",device:"device.device",view_id:"view.id",view_referrer:"view.referrer",view_url:"view.url",view_host:"view.host",view_path:"view.path",view_name:"view.path",view_path_group:"view.path_group",view_url_query:"view.url_query"},Yt={action_id:"action.id",action_ids:"action.ids",view_in_foreground:"view.in_foreground",display:"display"},Zt={view:{type:Ce.VIEW,tags:{view_loading_type:"view.loading_type",view_apdex_level:"view.apdex_level",view_privacy_replay_level:"privacy.replay_level"},fields:{is_active:"view.is_active",session_replay_stats:"_gc.replay_stats",session_is_active:"session.is_active",view_error_count:"view.error.count",view_resource_count:"view.resource.count",view_long_task_count:"view.long_task.count",view_action_count:"view.action.count",first_contentful_paint:"view.first_contentful_paint",largest_contentful_paint:"view.largest_contentful_paint",largest_contentful_paint_element_selector:"view.largest_contentful_paint_element_selector",cumulative_layout_shift:"view.cumulative_layout_shift",first_input_delay:"view.first_input_delay",loading_time:"view.loading_time",dom_interactive:"view.dom_interactive",dom_content_loaded:"view.dom_content_loaded",dom_complete:"view.dom_complete",load_event:"view.load_event",first_input_time:"view.first_input_time",first_paint_time:"view.fpt",interaction_to_next_paint:"view.interaction_to_next_paint",resource_load_time:"view.resource_load_time",time_to_interactive:"view.tti",dom:"view.dom",dom_ready:"view.dom_ready",time_spent:"view.time_spent",first_byte:"view.first_byte",page_states:"_gc.page_states",frustration_count:"view.frustration.count",custom_timings:"view.custom_timings"}},resource:{type:Ce.RESOURCE,tags:{trace_id:"_gc.trace_id",span_id:"_gc.span_id",resource_url:"resource.url",resource_url_host:"resource.url_host",resource_url_path:"resource.url_path",resource_url_path_group:"resource.url_path_group",resource_url_query:"resource.url_query",resource_type:"resource.type",resource_status:"resource.status",resource_status_group:"resource.status_group",resource_method:"resource.method"},fields:{duration:"resource.duration",resource_size:"resource.size",resource_encode_size:"resource.encode_size",resource_render_blocking_status:"resource.render_blocking_status",resource_dns:"resource.dns",resource_tcp:"resource.tcp",resource_ssl:"resource.ssl",resource_ttfb:"resource.ttfb",resource_trans:"resource.trans",resource_redirect:"resource.redirect",resource_first_byte:"resource.firstbyte",resource_dns_time:"resource.dns_time",resource_download_time:"resource.download_time",resource_first_byte_time:"resource.first_byte_time",resource_connect_time:"resource.connect_time",resource_ssl_time:"resource.ssl_time",resource_redirect_time:"resource.redirect_time"}},error:{type:Ce.ERROR,tags:{error_id:"error.id",trace_id:"_gc.trace_id",span_id:"_gc.span_id",error_source:"error.source",error_type:"error.type",error_handling:"error.handling"},fields:{error_message:["string","error.message"],error_stack:["string","error.stack"],error_causes:["string","error.causes"]}},long_task:{type:Ce.LONG_TASK,tags:{long_task_id:"long_task.id"},fields:{duration:"long_task.duration"}},action:{type:Ce.ACTION,tags:{action_type:"action.type"},fields:{action_name:"action.target.name",duration:"action.loading_time",action_error_count:"action.error.count",action_resource_count:"action.resource.count",action_frustration_types:"action.frustration.type",action_long_task_count:"action.long_task.count",action_target:"_gc.action.target",action_position:"_gc.action.position"}},telemetry:{type:"telemetry",fields:{status:"telemetry.status",message:["string","telemetry.message"],type:"telemetry.type",error_stack:["string","telemetry.error.stack"],error_kind:["string","telemetry.error.kind"]}},browser_log:{type:Ce.LOGGER,tags:{error_source:"error.source",error_type:"error.type",error_resource_url:"http.url",error_resource_url_host:"http.url_host",error_resource_url_path:"http.url_path",error_resource_url_path_group:"http.url_path_group",error_resource_status:"http.status_code",error_resource_status_group:"http.status_group",error_resource_method:"http.method",action_id:"user_action.id",service:"service",status:"status"},fields:{message:["string","message"]}}},Jt=4*Z,en=15*Y,tn=/^([a-z]+)=([a-z0-9-]+)$/,nn="&",rn="_dataflux_s",on=10,sn=100,an=[];function un(e,t){if(void 0===t&&(t=0),Xt||(Xt=e),e===Xt)if(t>=sn)ln();else{var n,r=pn();if(cn()){if(r.lock)return void fn(e,t);if(n=V(),r.lock=n,dn(r,e.options),(r=pn()).lock!==n)return void fn(e,t)}var o=e.process(r);if(cn()&&(r=pn()).lock!==n)fn(e,t);else{if(o&&function(e,t){if(vn(e))return void function(e){Rt(rn,"",0,e)}(t);e.expire=String(oe()+en),dn(e,t)}(o,e.options),cn()&&(!o||!vn(o))){if((r=pn()).lock!==n)return void fn(e,t);delete r.lock,dn(r,e.options),o=r}e.after&&e.after(o||r),ln()}}else an.push(e)}function cn(){return!!window.chrome||/HeadlessChrome/.test(window.navigator.userAgent)}function fn(e,t){d((function(){un(e,t+1)}),on)}function ln(){Xt=void 0;var e=an.shift();e&&un(e)}function dn(e,t){Rt(rn,function(e){return I(P(e),(function(e){return e[0]+"="+e[1]})).join(nn)}(e),en,t)}function pn(){var e=Lt(rn),t={};return function(e){return void 0!==e&&(-1!==e.indexOf(nn)||tn.test(e))}(e)&&S(e.split(nn),(function(e){var n=tn.exec(e);if(null!==n){var r=n[1],o=n[2];t[r]=o}})),t}function vn(e){return U(e)}function gn(e,t,n){var r=new it,o=new it,i=v((function(){un({options:e,process:function(e){return c(e)?void 0:{}},after:a})}),Tt),s=function(){var e=pn();if(c(e))return e;return{}}();function a(e){return c(e)||(e={}),u()&&(!function(e){return s.id!==e.id||s[t]!==e[t]}(e)?s=e:(s={},o.notify())),e}function u(){return void 0!==s[t]}function c(e){return(void 0===e.created||oe()-Number(e.created)<Jt)&&(void 0===e.expire||oe()<Number(e.expire))}return{expandOrRenewSession:W((function(){var o;un({options:e,process:function(e){var r=a(e);return o=function(e){var r=n(e[t]),o=r.trackingType,i=r.isTracked;e[t]=o,i&&!e.id&&(e.id=V(),e.created=String(oe()));return i}(r),r},after:function(e){o&&!u()&&function(e){s=e,r.notify()}(e),s=e}})}),Tt).throttled,expandSession:function(){un({options:e,process:function(e){return u()?a(e):void 0}})},getSession:function(){return s},renewObservable:r,expireObservable:o,expire:function(){deleteSessionCookie(e),a({})},stop:function(){g(i)}}}var hn=Y,yn=Jt,mn=[],bn=function(e,t,n){var r=gn(e,t,n);mn.push((function(){return r.stop()}));var o,i,s=new _e(yn);function a(){return{id:r.getSession().id,trackingType:r.getSession()[t]}}return mn.push((function(){return s.stop()})),r.renewObservable.subscribe((function(){s.add(a(),te())})),r.expireObservable.subscribe((function(){s.closeActive(te())})),r.expandOrRenewSession(),s.add(a(),[0,ie()][0]),o=function(){return r.expandOrRenewSession()},i=ft(window,[xe.CLICK,xe.TOUCH_START,xe.KEY_DOWN,xe.SCROLL],o,{capture:!0,passive:!0}),mn.push(i.stop),function(e){var t=function(){"visible"===document.visibilityState&&e()},n=ct(document,xe.VISIBILITY_CHANGE,t);mn.push(n.stop);var r=v(t,hn);mn.push((function(){g(r)}))}((function(){return r.expandSession()})),{findActiveSession:function(e){return s.find(e)},renewObservable:r.renewObservable,expireObservable:r.expireObservable,expire:r.expire}};var _n=80*et,En=32,wn=3*tt,On=256*z,Sn=z,xn={UP:0,FAILURE_DETECTED:1,DOWN:2},Cn={AFTER_SUCCESS:0,AFTER_RESUME:1};function Tn(e,t,n,r,o){t.transportStatus===xn.UP&&0===t.queuedPayloads.size()&&t.bandwidthMonitor.canHandle(e)?Ln(e,t,n,{onSuccess:function(){return kn(Cn.AFTER_SUCCESS,t,n,r,o)},onFailure:function(){t.queuedPayloads.enqueue(e),Rn(t,n,r,o)}}):t.queuedPayloads.enqueue(e)}function Rn(e,t,n,r){e.transportStatus===xn.DOWN&&d((function(){Ln(e.queuedPayloads.first(),e,t,{onSuccess:function(){e.queuedPayloads.dequeue(),e.currentBackoffTime=Sn,kn(Cn.AFTER_RESUME,e,t,n,r)},onFailure:function(){e.currentBackoffTime=Math.min(On,2*e.currentBackoffTime),Rn(e,t,n,r)}})}),e.currentBackoffTime)}function Ln(e,t,n,r){var o=r.onSuccess,i=r.onFailure;t.bandwidthMonitor.add(e),n(e,(function(n){t.bandwidthMonitor.remove(e),!function(e){return"opaque"!==e.type&&(0===e.status&&!navigator.onLine||408===e.status||429===e.status||e.status>=500)}(n)?(t.transportStatus=xn.UP,o()):(t.transportStatus=t.bandwidthMonitor.ongoingRequestCount>0?xn.FAILURE_DETECTED:xn.DOWN,t.lastFailureStatus=n.status,i())}))}function kn(e,t,n,r,o){e===Cn.AFTER_SUCCESS&&t.queuedPayloads.isFull()&&!t.queueFullReported&&(o({message:"Reached max "+r+" events size queued for upload: "+wn/tt+"MiB",source:ze.AGENT,startClocks:ne()}),t.queueFullReported=!0);var i=t.queuedPayloads;for(t.queuedPayloads=An();i.size()>0;)Tn(i.dequeue(),t,n,r,o)}function An(){var e=[];return{bytesCount:0,enqueue:function(t){this.isFull()||(e.push(t),this.bytesCount+=t.bytesCount)},first:function(){return e[0]},dequeue:function(){var t=e.shift();return t&&(this.bytesCount-=t.bytesCount),t},size:function(){return e.length},isFull:function(){return this.bytesCount>=wn}}}function Dn(e){return e?e+(-1===e.indexOf("?")?"?":"&")+"precision=ms":e}function In(e,t,n){var r={transportStatus:xn.UP,lastFailureStatus:0,currentBackoffTime:Sn,bandwidthMonitor:{ongoingRequestCount:0,ongoingByteCount:0,canHandle:function(e){return 0===this.ongoingRequestCount||this.ongoingByteCount+e.bytesCount<=_n&&this.ongoingRequestCount<En},add:function(e){this.ongoingRequestCount+=1,this.ongoingByteCount+=e.bytesCount},remove:function(e){this.ongoingRequestCount-=1,this.ongoingByteCount-=e.bytesCount}},queuedPayloads:An(),queueFullReported:!1},o=function(n,r){return function(e,t,n,r){var o=n.data,i=n.bytesCount,a=Dn(e),u=function(){try{return window.Request&&"keepalive"in new Request("http://a")}catch(e){return!1}}()&&i<t;u?fetch(a,{method:"POST",body:o,keepalive:!0,mode:"cors"}).then(s((function(e){"function"==typeof r&&r({status:e.status,type:e.type})})),s((function(){Mn(a,o,r)}))):Mn(a,o,r)}(e,t,n,r)};return{send:function(t){Tn(t,r,o,e,n)},sendOnExit:function(n){!function(e,t,n){var r=n.data,o=n.bytesCount,i=Dn(e),s=!!navigator.sendBeacon&&o<t;if(s)try{if(navigator.sendBeacon(i,r))return}catch(e){}Mn(i,r)}(e,t,n)}}}function Mn(e,t,n){var r=new XMLHttpRequest;r.open("POST",e,!0),ct(r,"loadend",(function(){"function"==typeof n&&n({status:r.status})}),{once:!0}),r.send(t)}function $n(e){return $n="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},$n(e)}function Un(e){if("object"===$n(e)&&e)e=Ie(e);else if(!N(e))return e;return String(e).replace(/[\s=,"]/g,(function(e){return"\\"+e}))}function Pn(e){return'"'+e.replace(/\\/g,"\\\\").replace(/"/g,'\\"')+'"'}function Nn(e){return"object"===$n(e)&&e?Pn(Ie(e)):N(e)?Pn(e):e}var Bn="custom_keys",Gn=function(e){if(!e||!e.type)return{rowStr:"",rowData:void 0};var t={tags:{},fields:{}},n=!1,r="";return S(Zt,(function(o,i){if(o.type===e.type){r+=i+",",t.measurement=i;var s=[],a=C({},zt,o.tags),u=["date","type",Bn];S(a,(function(n,r){var o=se(e,n);u.push(r),(o||G(o))&&(t.tags[r]=function(e){return N(e)?e:Ie(e)}(o),s.push(Un(r)+"="+Un(o)))}));var c=[],f=C({},Yt,o.fields);if(S(f,(function(n,r){if(R(n)&&2===n.length){var o=n[1],i=se(e,o);u.push(r),null!=i&&(t.fields[r]=i,c.push(Un(r)+"="+Nn(i)))}else if(N(n)){i=se(e,n);u.push(r),null!=i&&(t.fields[r]=i,c.push(Un(r)+"="+Nn(i)))}})),e.context&&$(e.context)&&!U(e.context)){var l=[];S(e.context,(function(e,n){u.indexOf(n)>-1||(u.push(n),null!=e&&(l.push(n),t.fields[n]=e,c.push(Un(n)+"="+Nn(e))))})),l.length&&(t.fields[Bn]=Nn(l),c.push(Un(Bn)+"="+Nn(l)))}e.type===Ce.LOGGER&&S(e,(function(e,n){-1===u.indexOf(n)&&null!=e&&(t.fields[n]=e,c.push(Un(n)+"="+Nn(e)))})),s.length&&(r+=s.join(",")),c.length&&(r+=" ",r+=c.join(","),n=!0),r=r+" "+e.date,t.time=(d=e.date,G(d)?ee(1e6*d,0):d)}var d})),{rowStr:n?r:"",rowData:n?t:void 0}},Wn=function(e,t,n){this.pushOnlyBuffer=[],this.upsertBuffer={},this.request=e,this.flushController=t,this.messageBytesLimit=n;var r=this;this.flushController.flushObservable.subscribe((function(e){r.flush(e)}))};Wn.prototype.add=function(e){this.addOrUpdate(e)},Wn.prototype.upsert=function(e,t){this.addOrUpdate(e,t)},Wn.prototype.flush=function(e){var t,n=this.pushOnlyBuffer.concat(k(this.upsertBuffer));if(this.pushOnlyBuffer=[],this.upsertBuffer={},n.length>0){var r={data:n.join("\n"),bytesCount:e.bytesCount,flushReason:e.reason};t=e.reason,ue(k(Kt),t)?this.request.sendOnExit(r):this.request.send(r)}},Wn.prototype.addOrUpdate=function(e,t){var r=this.process(e),o=r.processedMessage,i=r.messageBytesCount;i>=this.messageBytesLimit?n.warn("Discarded a message whose size was bigger than the maximum allowed size "+this.messageBytesLimit+"KB."):(this.hasMessageFor(t)&&this.remove(t),this.push(o,i,t))},Wn.prototype.process=function(e){var t=Gn(e).rowStr;return{processedMessage:t,messageBytesCount:rt(t)}},Wn.prototype.push=function(e,t,n){var r=this.flushController.getMessagesCount()>0?1:0;this.flushController.notifyBeforeAddMessage(t+r),void 0!==n?this.upsertBuffer[n]=e:this.pushOnlyBuffer.push(e),this.flushController.notifyAfterAddMessage()},Wn.prototype.remove=function(e){var t=this.upsertBuffer[e];delete this.upsertBuffer[e];var n=rt(t),r=this.flushController.getMessagesCount()>1?1:0;this.flushController.notifyAfterRemoveMessage(n+r)},Wn.prototype.hasMessageFor=function(e){return void 0!==e&&void 0!==this.upsertBuffer[e]};var Fn=Wn;function Vn(e){var t=e.messagesLimit,n=e.bytesLimit,r=e.durationLimit,o=e.pageExitObservable,i=e.sessionExpireObservable,s=new it;o.subscribe((function(e){return f(e.reason)})),i.subscribe((function(){return f("session_expire")}));var a,u=0,c=0;function f(e){if(0!==c){var t=c,n=u;c=0,u=0,l(),s.notify({reason:e,messagesCount:t,bytesCount:n})}}function l(){p(a),a=void 0}return{flushObservable:s,getMessagesCount:function(){return c},notifyBeforeAddMessage:function(e){u+e>=n&&f("bytes_limit"),c+=1,u+=e,void 0===a&&(a=d((function(){f("duration_limit")}),r))},notifyAfterAddMessage:function(){c>=t?f("messages_limit"):u>=n&&f("bytes_limit")},notifyAfterRemoveMessage:function(e){u-=e,0===(c-=1)&&l()}}}function jn(e,t,n,r,o){var i=function(t){return new Fn(In(t,e.batchBytesLimit,n),Vn({messagesLimit:e.batchMessagesLimit,bytesLimit:e.batchBytesLimit,durationLimit:e.flushTimeout,pageExitObservable:r,sessionExpireObservable:o}),e.messageBytesLimit)}(t);return{add:function(e){i.add(e)}}}function qn(){var e=l().FTWebViewJavascriptBridge;if(e)return{send:function(t,n){e.sendEvent(JSON.stringify({name:t,data:n}))}}}function Hn(){return!!qn()}var Qn=3*et,Kn={FeatureFlag:"feature flag evaluation",User:"user",GlobalContext:"global context",LoggerContext:"logger context"};var Xn=200;function zn(e,t){void 0===t&&(t=rt);var r,o={},i=!1,s=W((function(o){r=t(Ie(o)),i||(i=function(e,t){return e>Qn&&(n.warn("The "+t+"data is over "+Qn/et+" KiB. On low connectivity, the SDK has the potential to exhaust the user's upload bandwidth."),!0)}(r,e))}),Xn).throttled;return{getBytesCount:function(){return r},get:function(){return o},add:function(e,t){o[e]=t,s(o)},remove:function(e){delete o[e],s(o)},set:function(e){s(o=e)},getContext:function(){return Q(o)},setContext:function(e){o=Q(e),s(o)},setContextProperty:function(e,t){o[e]=Q(t),s(o)},removeContextProperty:function(e){delete o[e],s(o)},clearContext:function(){o={},r=0}}}var Yn,Zn={log:"log",configuration:"configuration"},Jn={debug:"debug",error:"error"},er=["https://static.guance.com","http://localhost","<anonymous>"],tr={LOGS:"browser-logs-sdk",RUM:"browser-rum-sdk"},nr={maxEventsPerPage:0,sentEventCount:0,telemetryEnabled:!1};function rr(t,n){var r,o=new it;return nr.telemetryEnabled=n.telemetryEnabled&&J(n.telemetrySampleRate),Yn=function(e){if(nr.telemetryEnabled){var n=function(e,t){return T({type:"telemetry",date:re(),service:e,version:"3.1.1",source:"browser",telemetry:t},void 0!==r?r():{})}(t,e);o.notify(n)}},e=or,x(nr,{maxEventsPerPage:n.maxTelemetryEventsPerPage,sentEventCount:0}),{setContextProvider:function(e){r=e},observable:o,enabled:nr.telemetryEnabled}}function or(e,t){ir(x({type:Zn.log,status:Jn.error},function(e){if(e instanceof Error){var t=Pe(e);return{error:{kind:t.name,stack:Ze(sr(t))},message:t.message}}return{error:{stack:Xe},message:Le.UNCAUGHT+" "+Ie(e)}}(e),t))}function ir(e){Yn&&nr.sentEventCount<nr.maxEventsPerPage&&(nr.sentEventCount+=1,Yn(e))}function sr(e){return e.stack=e.stack.filter((function(e){return!e.url||er.some((function(t){return pe(e.url,t)}))})),e}var ar={sdkVersion:"3.1.1",sdkName:"df_web_logs_sdk"},ur=32*et;function cr(e,t,r){return void 0===e?[]:"all"===e||R(e)&&M(e,(function(e){return ue(t,e)}))?"all"===e?t:F(e):void n.error(r+' should be "all" or an array with allowed values "'+t.join('", "')+'"')}var fr={debug:"debug",error:"error",info:"info",warn:"warn",critical:"critical"},lr={console:"console",http:"http",silent:"silent"},dr=A(fr);function pr(e,t,n,r,o){this.contextManager=zn(Kn.LoggerContext),void 0===n&&(n=lr.http),void 0===r&&(r=fr.debug),void 0===o&&(o={}),this.handleLogStrategy=e,this.handlerType=n,this.level=r,this.contextManager.set(x({},o,t?{logger:{name:t}}:void 0))}pr.prototype={log:s((function(e,t,n,r){var o;if(void 0===n&&(n=fr.info),n===fr.error&&(o={origin:ze.LOGGER}),null!=r){var i=Ye({stackTrace:r instanceof Error?Pe(r):void 0,originalError:r,nonErrorPrefix:Le.PROVIDED,source:ze.LOGGER,handling:Re.HANDLED,startClocks:ne()});o={origin:ze.LOGGER,stack:i.stack,kind:i.type,message:i.message}}var s=function(e,t){void 0===t&&(t=gt);var n=Me(Object.prototype),r=Me(Array.prototype),o=[],i=new WeakMap,s=ht(e,"$",void 0,o,i),a=JSON.stringify(s)&&JSON.stringify(s).length||0;if(!(a>t)){for(;o.length>0&&a<t;){var u=o.shift(),c=0;if(Array.isArray(u.source))for(var f=0;f<u.source.length;f++){if(a+=void 0!==(l=ht(u.source[f],u.path,f,o,i))?JSON.stringify(l).length:4,a+=c,c=1,a>t){yt(t,"truncated",e);break}u.target[f]=l}else for(var f in u.source)if(Object.prototype.hasOwnProperty.call(u.source,f)){var l;if(void 0!==(l=ht(u.source[f],u.path,f,o,i))&&(a+=JSON.stringify(l).length+c+f.length+3,c=1),a>t){yt(t,"truncated",e);break}u.target[f]=l}}return n(),r(),s}yt(t,"discarded",e)}(t),a=o?T({error:o},s):s;this.handleLogStrategy({message:e,context:a,status:n},this)})),debug:function(e,t,n){this.log(e,t,fr.debug,n)},info:function(e,t,n){this.log(e,t,fr.info,n)},warn:function(e,t,n){this.log(e,t,fr.warn,n)},critical:function(e,t,n){this.log(e,t,fr.critical,n)},error:function(e,t,n){var r={error:{origin:ze.LOGGER}};this.log(e,T(r,t),fr.error,n)},setContext:function(e){this.contextManager.set(e)},getContext:function(){return this.contextManager.get()},addContext:function(e,t){this.contextManager.add(e,t)},removeContext:function(e){this.contextManager.remove(e)},setHandler:function(e){this.handlerType=e},getHandler:function(){return this.handlerType},setLevel:function(e){this.level=e},getLevel:function(){return this.level}};var vr="logs",gr={NOT_TRACKED:"0",TRACKED:"1"};function hr(e){var t=bn(e.cookieOptions,vr,(function(t){return function(e,t){var n=function(e){return e===gr.NOT_TRACKED||e===gr.TRACKED}(t)?t:yr(e);return{trackingType:n,isTracked:n===gr.TRACKED}}(e,t)}));return{findTrackedSession:function(e){var n=t.findActiveSession(e);return n&&n.trackingType===gr.TRACKED?{id:n.id}:void 0},expireObservable:t.expireObservable}}function yr(e){return J(e.sessionSampleRate)?gr.TRACKED:gr.NOT_TRACKED}var mr={[fr.debug]:0,[fr.info]:1,[fr.warn]:2,[fr.error]:3};function br(e,t,n){var r=n.getHandler(),o=R(r)?r:[r];return mr[e]>=mr[n.getLevel()]&&ue(o,t)}function _r(e,t,n,r,o,i){var s=dr.concat(["custom"]),a={};S(s,(function(e){var n,r,o,s,u;a[e]=(n=e,r=t.eventRateLimiterThreshold,o=i,s=0,u=!1,{isLimitReached:function(){if(0===s&&d((function(){s=0}),Y),(s+=1)<=r||u)return u=!1,!1;if(s===r+1){u=!0;try{o({message:"Reached max number of "+n+"s by minute: "+r,source:ze.AGENT,startClocks:ne()})}finally{u=!1}}return!0}})})),n.subscribe(_t.RAW_LOG_COLLECTED,(function(i){var s=i.rawLogsEvent,u=i.messageContext||void 0,c=i.savedCommonContext||void 0,f=i.logger||o,l=s.date-ie(),d=e.findTrackedSession(l);if(d){var p=c||r(),v=T({service:t.service||"browser",env:t.env||"",version:t.version||"",_dd:{sdkName:t.sdkName,sdkVersion:t.sdkVersion},session:{id:d.id},view:p.view,user:U(p.user)?void 0:p.user,device:Se,type:Ce.LOGGER},p.context,Er(l),s,f.getContext(),u);!br(s.status,lr.http,f)||t.beforeSend&&!1===t.beforeSend(v)||v.error&&v.error.origin!==ze.AGENT&&de(a[v.status],a.custom).isLimitReached()||n.notify(_t.LOG_COLLECTED,fe(v))}}))}function Er(e){return function(t){if(t&&t.getInternalContext)return t.getInternalContext(e)}(window.DATAFLUX_RUM)}var wr={[t.log]:fr.info,[t.debug]:fr.debug,[t.info]:fr.info,[t.warn]:fr.warn,[t.error]:fr.error};var Or={[lt.cspViolation]:fr.error,[lt.intervention]:fr.error,[lt.deprecation]:fr.warn};function Sr(e,t){if(!e.forwardErrorsToLogs)return{stop:K};var n=Vt().subscribe((function(e){"complete"===e.state&&o(Te.XHR,e)})),r=Nt().subscribe((function(e){"resolve"===e.state&&o(Te.FETCH,e)}));function o(n,r){function o(e){var o,i,s,a=j(r.url).getParse();t.notify(_t.RAW_LOG_COLLECTED,{rawLogsEvent:{message:Cr(n)+" error "+r.method+" "+r.url,date:r.startClocks.timeStamp,error:{origin:ze.NETWORK,stack:e||"Failed to load"},http:{method:r.method,status_code:r.status,url:r.url,statusGroup:(s=r.status,s?String(s).substr(0,1)+String(s).substr(1).replace(/\d*/g,"x"):s),urlHost:a.Host,urlPath:a.Path,urlPathGroup:(o=a.Path,i="",o&&(i=o.replace(/\/([^\/]*)\d([^\/]*)/g,"/?").replace(/\/$/g,"")),i||"/")},status:fr.error,origin:ze.NETWORK}})}!e.isIntakeUrl(r.url)&&(function(e){return 0===e.status&&"opaque"!==e.responseType}(r)||function(e){return e.status>=500}(r)||e.isServerError(r))&&("xhr"in r?function(e,t,n){"string"==typeof e.response?n(xr(e.response,t)):n(e.response)}(r.xhr,e,o):r.response?function(e,t,n){var r=function(e){try{return e.clone()}catch(e){return}}(e);r&&r.body?window.TextDecoder?function(e,t,n){!function(e,t,n){var r=e.getReader(),o=[],i=0;function a(){var e,s;if(r.cancel().catch(K),n.collectStreamBody){var a;if(1===o.length)a=o[0];else{a=new Uint8Array(i);var u=0;S(o,(function(e){a.set(e,u),u+=e.length}))}e=a.slice(0,n.bytesLimit),s=a.length>n.bytesLimit}t(void 0,e,s)}!function e(){r.read().then(s((function(t){t.done?a():(n.collectStreamBody&&o.push(t.value),(i+=t.value.length)>n.bytesLimit?a():e())})),s((function(e){t(e)})))}()}(e,(function(e,t,r){if(e)n(e);else{var o=(new TextDecoder).decode(t);r&&(o+="..."),n(void 0,o)}}),{bytesLimit:t,collectStreamBody:!0})}(r.body,t.requestErrorResponseLengthLimit,(function(e,t){n(e?"Unable to retrieve response: "+e:t)})):r.text().then(s((function(e){return n(xr(e,t))})),s((function(e){return n("Unable to retrieve response: "+e)}))):n()}(r.response,e,o):r.error&&function(e,t,n){n(xr(Ze(Pe(e)),t))}(r.error,e,o))}return{stop:function(){n.unsubscribe(),r.unsubscribe()}}}function xr(e,t){return e.length>t.requestErrorResponseLengthLimit?e.substring(0,t.requestErrorResponseLengthLimit)+"...":e}function Cr(e){return Te.XHR===e?"XHR":"Fetch"}function Tr(e,t){if(!e.forwardErrorsToLogs)return{stop:K};var n,r=new it,o=(n=r,Ke((function(e,t){n.notify(Ye({stackTrace:e,originalError:t,startClocks:ne(),nonErrorPrefix:Le.UNCAUGHT,source:ze.SOURCE,handling:Re.UNHANDLED}))}))),i=r.subscribe((function(e){t.notify(_t.RAW_LOG_COLLECTED,{rawLogsEvent:{message:e.message,date:e.startClocks.timeStamp,error:{kind:e.type,origin:ze.SOURCE,stack:e.stack},origin:ze.SOURCE,status:fr.error}})}));return{stop:function(){o.stop(),i.unsubscribe()}}}const Rr=function(e){var r,o,a=!1,u=zn(Kn.GlobalContext),c=zn(Kn.User),f={},l=function(){},d=new ge,p=function(e,t,n,r){void 0===n&&(n=Q(h())),void 0===r&&(r=re()),d.add((function(){return p(e,t,n,r)}))},v=function(){},g=new pr((function(){return p.apply(this,arguments)}));function h(){return{view:{referrer:document.referrer,url:window.location.href},context:u.getContext(),user:c.getContext()}}return r={logger:g,init:s((function(r){if(function(e){return a?(e.silentMultipleInit||n.error("DD_LOGS is already initialized."),!1):!(!e.datakitUrl&&!e.datakitOrigin)||(n.error("datakitOrigin is not configured, no RUM data will be collected."),!1)}(r)){var o=function(e){var n=Ut(e),r=cr(e.forwardConsoleLogs,k(t),"Forward Console Logs"),o=cr(e.forwardReports,k(lt),"Forward Reports");if(n&&r&&o)return e.forwardErrorsToLogs&&!ue(r,t.error)&&r.push(t.error),x({forwardErrorsToLogs:!1!==e.forwardErrorsToLogs,forwardConsoleLogs:r,forwardReports:o,requestErrorResponseLengthLimit:ur},n,ar)}(r);if(o){var i=e(o,h,g);p=i.handleLog,l=i.getInternalContext,v=function(){return Q(r)},d.drain(),a=!0}}})),getGlobalContext:s(u.getContext),setGlobalContext:s(u.setContext),setGlobalContextProperty:s(u.setContextProperty),removeGlobalContextProperty:s(u.removeContextProperty),clearGlobalContext:s(u.clearContext),createLogger:s((function(e,t){return void 0===t&&(t={}),f[e]=new pr((function(){return p(this.arguments)}),e,t.handler,t.level,t.context),f[e]})),getLogger:s((function(e){return f[e]})),getInitConfiguration:s((function(){return v()})),getInternalContext:s((function(e){return l(e)})),setUser:s((function(e){(function(e){var t="object"===q(e);return t||n.error("Unsupported user:",e),t})(e)&&c.setContext(function(e){var t=x({},e);return S(["id","name","email"],(function(e){e in t&&(t[e]=String(t[e]))})),t}(e))})),getUser:s(c.getContext),removeUserProperty:s(c.removeContextProperty),clearUser:s(c.clearContext)},o=x({onReady:function(e){e()}},r),Object.defineProperty(o,"_setDebug",{get:function(){return i},enumerable:!1}),o}((function(e,r,o){var i,s=new Et,a=function(e){s.notify(_t.RAW_LOG_COLLECTED,{rawLogsEvent:{message:e.message,date:e.startClocks.timeStamp,error:{origin:ze.AGENT},origin:ze.AGENT,status:fr.error}})},u=i=new it((function(){var e=ft(document,[xe.VISIBILITY_CHANGE,xe.FREEZE,xe.PAGE_HIDE],(function(e){e.type===xe.VISIBILITY_CHANGE&&"hidden"===document.visibilityState?i.notify({reason:Kt.HIDDEN}):e.type===xe.FREEZE&&i.notify({reason:Kt.FROZEN})}),{capture:!0}),t=ct(window,xe.BEFORE_UNLOAD,(function(){i.notify({reason:Kt.UNLOADING})}));return function(){e.stop(),t.stop()}})),c=function(e){if(void 0===document.cookie||null===document.cookie)return!1;try{var t="dd_cookie_test_".concat(V()),n="test";return Rt(t,n,z,e),Lt(t)===n}catch(e){return!1}}(e.cookieOptions)?hr(e):function(e){var t=yr(e)===gr.TRACKED?{}:void 0;return{findTrackedSession:function(){return t},expireObservable:new it}}(e);(function(e,t,n,r){const o=rr(tr.LOGS,e);if(!Hn()){var i=jn(e,e.rumEndpoint,t,n,r);o.observable.subscribe((function(e){i.add(e)}))}return o})(e,a,u,c.expireObservable).setContextProvider((function(){var e=Er();return{application:{id:e&&e.application&&e.application.id},session:{id:c.findTrackedSession()&&c.findTrackedSession().id},view:{id:e&&e.view&&e.view.id},action:{id:e&&e.userAction&&e.userAction.id}}})),Sr(e,s),Tr(e,s),function(e,n){var r=ut(e.forwardConsoleLogs).subscribe((function(e){n.notify(_t.RAW_LOG_COLLECTED,{rawLogsEvent:{date:re(),message:e.message,origin:ze.CONSOLE,error:e.api===t.error?{origin:ze.CONSOLE,stack:e.stack}:void 0,status:wr[e.api]}})}))}(e,s),function(e,t){var n=dt(0,e.forwardReports).subscribe((function(e){var n,r,o,i=e.message,s=Or[e.type];s===fr.error?n={kind:e.subtype,origin:ze.REPORT,stack:e.stack}:e.stack&&(i+=" Found in "+(r=e.stack,(o=/@ (.+)/.exec(r))&&o[1])),t.notify(_t.RAW_LOG_COLLECTED,{rawLogsEvent:{date:re(),message:i,origin:ze.REPORT,error:n,status:s}})}))}(e,s);var f=function(e){return{handleLog:function(t,r,o,i){var s=t.context;br(t.status,lr.console,r)&&n(t.status,t.message,T(r.getContext(),s)),e.notify(_t.RAW_LOG_COLLECTED,{rawLogsEvent:{date:i||re(),message:t.message,status:t.status,origin:ze.LOGGER},messageContext:s,savedCommonContext:o,logger:r})}}}(s);_r(c,e,s,r,o,a),Hn()||function(e,t,n,r,o){var i=jn(e,e.logsEndpoint,n,r,o);t.subscribe(_t.LOG_COLLECTED,(function(e){i.add(e)}))}(e,s,a,u,c.expireObservable);var l,d=(l=c,{get:function(e){var t=l.findTrackedSession(e);if(t)return{session:{id:t.id}}}});return{handleLog:f.handleLog,getInternalContext:d.get}}));var Lr,kr,Ar,Dr;Lr=l(),Ar=Rr,Dr=Lr[kr="DATAFLUX_LOGS"],Lr[kr]=Ar,Dr&&Dr.q&&S(Dr.q,(function(e){c(e,"onReady callback threw an error:")()}))}();
|
|
1
|
+
!function(){"use strict";var e,t={log:"log",debug:"debug",info:"info",warn:"warn",error:"error"},n=function e(n){var r=[].slice.call(arguments,1);Object.prototype.hasOwnProperty.call(t,n)||(n=t.log),e[n].apply(e,r)};function r(e,t){var n,r=window;return r.Zone&&"function"==typeof r.Zone.__symbol__&&(n=e[r.Zone.__symbol__(t)]),n||(n=e[t]),n}n.debug=console.debug.bind(console),n.log=console.log.bind(console),n.info=console.info.bind(console),n.warn=console.warn.bind(console),n.error=console.error.bind(console);var o=!1;function i(e){o=e}function s(e){return function(){return a(e,this,arguments)}}function a(n,r,o){try{return n.apply(r,o)}catch(n){if(u(t.error,n),e)try{e(n)}catch(e){u(t.error,e)}}}function u(e){var t=[].slice.call(arguments,1);o&&n.apply(null,[e,"[MONITOR]"].concat(t))}function c(e,t){return function(){var r=[].slice.call(arguments);try{return e.apply(this,r)}catch(e){n.error(t,e)}}}function f(e){return f="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},f(e)}function l(){if("object"===("undefined"==typeof globalThis?"undefined":f(globalThis)))return globalThis;Object.defineProperty(Object.prototype,"_gc_temp_",{get:function(){return this},configurable:!0});var e=_gc_temp_;return delete Object.prototype._gc_temp_,"object"!==f(e)&&(e="object"===("undefined"==typeof self?"undefined":f(self))?self:"object"===("undefined"==typeof window?"undefined":f(window))?window:{}),e}function d(e,t){return r(l(),"setTimeout")(s(e),t)}function p(e){r(l(),"clearTimeout")(e)}function v(e,t){return r(window,"setInterval")(s(e),t)}function g(e){r(window,"clearInterval")(e)}function h(e){return h="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},h(e)}var y=Array.prototype,m=(Function.prototype,Object.prototype),b=y.slice,_=m.toString,E=m.hasOwnProperty,w=y.forEach,O=Array.isArray,S=function(e,t,n){if(null===e)return!1;if(w&&e.forEach===w)e.forEach(t,n);else if(e.length===+e.length){for(var r=0,o=e.length;r<o;r++)if(r in e&&false===t.call(n,e[r],r,e))return!1}else for(var i in e)if(E.call(e,i)&&false===t.call(n,e[i],i,e))return!1};function x(e){return S(b.call(arguments,1),(function(t){for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n])})),e}var C=function(e){return S(b.call(arguments,1),(function(t){for(var n in t)void 0!==t[n]&&(e[n]=t[n])})),e},T=function(e){return S(b.call(arguments,1),(function(t){for(var n in t)void 0!==t[n]&&($(t[n])&&$(e[n])?C(e[n],t[n]):e[n]=t[n])})),e},L=O||function(e){return"[object Array]"===_.call(e)},R=function(e){if(!e)return!1;try{return/^\s*\bfunction\b/.test(e)}catch(e){return!1}},k=function(e){var t=[];return null===e||S(e,(function(e){t[t.length]=e})),t},A=function(e){var t=[];return null===e||S(e,(function(e,n){t[t.length]=n})),t},I=function(e,t,n){if(e.filter)return e.filter(t);for(var r=[],o=0;o<e.length;o++)if(E.call(e,o)){var i=e[o];t.call(n,i,o,e)&&r.push(i)}return r},D=function(e,t,n){if(e.map)return e.map(t);for(var r=[],o=0;o<e.length;o++)if(E.call(e,o)){var i=e[o];r.push(t.call(n,i,o,e))}return r},M=function(e,t,n){if(e.every)return e.every(t);for(var r=!0,o=0;o<e.length;o++)if(E.call(e,o)){var i=e[o];if(!t.call(n,i,o,e)){r=!1;break}}return r},$=function(e){return null!==e&&"[object Object]"===_.call(e)},U=function(e){if($(e)){for(var t in e)if(E.call(e,t))return!1;return!0}return!1},P=function(e){var t=[];return S(e,(function(e,n){t.push([n,e])})),t},N=function(e){return"[object String]"===_.call(e)},B=function(e){return"[object Boolean]"===_.call(e)},G=function(e){return"[object Number]"===_.call(e)&&/[\d\.]+/.test(String(e))},W=(Date.now,function(e,t,n){var r,o,i=!n||void 0===n.leading||n.leading,s=!n||void 0===n.trailing||n.trailing,a=!1,u=this;return{throttled:function(){a?r=arguments:(i?e.apply(u,arguments):r=arguments,a=!0,o=d((function(){s&&r&&e.apply(u,r),a=!1,r=void 0}),t))},cancel:function(){p(o),a=!1,r=void 0}}}),F=function(e){for(var t,n=[],r={},o=0;o<e.length;o++)(t=e[o])in r||(r[t]=!0,n.push(t));return n};function V(e){return e?(parseInt(e,10)^16*Math.random()>>parseInt(e,10)/4).toString(16):"".concat(1e7,"-",1e3,"-",4e3,"-",8e3,"-",1e11).replace(/[018]/g,V)}var j=function(e){var t=function(e){this._fields={Username:4,Password:5,Port:7,Protocol:2,Host:6,Path:8,URL:0,QueryString:9,Fragment:10},this._values={},this._regex=null,this._regex=/^((\w+):\/\/)?((\w+):?(\w+)?@)?([^\/\?:]+):?(\d+)?(\/?[^\?#]+)?\??([^#]+)?#?(\w*)/,void 0!==e&&this._parse(e)};return t.prototype.setUrl=function(e){this._parse(e)},t.prototype._initValues=function(){for(var e in this._fields)this._values[e]=""},t.prototype.addQueryString=function(e){if("object"!==h(e))return!1;var t=this._values.QueryString||"";for(var n in e)t=new RegExp(n+"[^&]+").test(t)?t.replace(new RegExp(n+"[^&]+"),n+"="+e[n]):"&"===t.slice(-1)?t+n+"="+e[n]:""===t?n+"="+e[n]:t+"&"+n+"="+e[n];this._values.QueryString=t},t.prototype.getParse=function(){return this._values},t.prototype.getUrl=function(){var e="";return e+=this._values.Origin,e+=this._values.Path,e+=this._values.QueryString?"?"+this._values.QueryString:""},t.prototype._parse=function(e){this._initValues();var t=this._regex.exec(e);if(!t)throw"DPURLParser::_parse -> Invalid URL";for(var n in this._fields)void 0!==t[this._fields[n]]&&(this._values[n]=t[this._fields[n]]);this._values.Path=this._values.Path||"/",this._values.Hostname=this._values.Host.replace(/:\d+$/,""),this._values.Origin=this._values.Protocol+"://"+this._values.Hostname+(this._values.Port?":"+this._values.Port:"")},new t(e)};function q(e){return null===e?"null":Array.isArray(e)?"array":h(e)}function H(e,t,n){if(void 0===n&&(n=function(){if("undefined"!=typeof WeakSet){var e=new WeakSet;return{hasAlreadyBeenSeen:function(t){var n=e.has(t);return n||e.add(t),n}}}var t=[];return{hasAlreadyBeenSeen:function(e){var n=t.indexOf(e)>=0;return n||t.push(e),n}}}()),void 0===t)return e;if("object"!==h(t)||null===t)return t;if(t instanceof Date)return new Date(t.getTime());if(t instanceof RegExp){var r=t.flags||[t.global?"g":"",t.ignoreCase?"i":"",t.multiline?"m":"",t.sticky?"y":"",t.unicode?"u":""].join("");return new RegExp(t.source,r)}if(!n.hasAlreadyBeenSeen(t)){if(Array.isArray(t)){for(var o=Array.isArray(e)?e:[],i=0;i<t.length;++i)o[i]=H(o[i],t[i],n);return o}o="object"===q(e)?e:{};for(var s in t)Object.prototype.hasOwnProperty.call(t,s)&&(o[s]=H(o[s],t[s],n));return o}}function Q(e){return H(void 0,e)}function K(){}var X,z,Y=1e3,J=60*Y,Z=60*J;function ee(e){return 0!==e&&100*Math.random()<=e}function te(e,t){return+e.toFixed(t)}function ne(){return performance.now()}function re(){return{relative:ne(),timeStamp:oe()}}function oe(){return ie()}function ie(){return(new Date).getTime()}function se(){return void 0===X&&(X=performance.timing.navigationStart),X}function ae(e,t){for(var n=t.split(".");n.length;){var r=n.shift();if(!(e&&r in e&&E.call(e,r)))return;e=e[r]}return e}function ue(e,t){var n=e.charCodeAt(t-1);return n>=55296&&n<=56319?e.slice(0,t+1):e.slice(0,t)}function ce(e,t){return-1!==e.indexOf(t)}function fe(e){return G(e)&&e>=0&&e<=100}function le(e){var t={};return S(e,(function(e,n){var r;t[(r=n,r.replace(/[A-Z]/g,(function(e,t){return(0!==t?"_":"")+e.toLowerCase()})).replace(/-/g,"_"))]=de(e)})),t}function de(e){return L(e)?D(e,(function(e){return de(e)})):"object"===h(e)&&null!==e?le(e):e}function pe(e,t){return null!=e?e:t}function ve(e,t){return e.slice(0,t.length)===t}var ge=function(){this.buffer=[]};ge.prototype={add:function(e){this.buffer.push(e)>500&&this.buffer.splice(0,1)},drain:function(){S(this.buffer,(function(e){e()})),this.buffer.length=0}};var he=ge;function ye(e,t){var n="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(!n){if(Array.isArray(e)||(n=function(e,t){if(!e)return;if("string"==typeof e)return me(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);"Object"===n&&e.constructor&&(n=e.constructor.name);if("Map"===n||"Set"===n)return Array.from(e);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return me(e,t)}(e))||t&&e&&"number"==typeof e.length){n&&(e=n);var r=0,o=function(){};return{s:o,n:function(){return r>=e.length?{done:!0}:{done:!1,value:e[r++]}},e:function(e){throw e},f:o}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var i,s=!0,a=!1;return{s:function(){n=n.call(e)},n:function(){var e=n.next();return s=e.done,e},e:function(e){a=!0,i=e},f:function(){try{s||null==n.return||n.return()}finally{if(a)throw i}}}}function me(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}var be=1/0,_e=J;function Ee(e,t){this.expireDelay=e,this.entries=[],this.maxEntries=t;var n=this;this.clearOldContextsInterval=v((function(){n.clearOldContexts()}),_e)}Ee.prototype.add=function(e,t){var n=this,r={context:e,startTime:t,endTime:be,remove:function(){var e=n.entries.indexOf(r);e>=0&&n.entries.splice(e,1)},close:function(e){r.endTime=e}};return this.maxEntries&&this.entries.length>=this.maxEntries&&this.entries.pop(),this.entries.unshift(r),r},Ee.prototype.find=function(e){void 0===e&&(e=be);var t,n=ye(this.entries);try{for(n.s();!(t=n.n()).done;){var r=t.value;if(r.startTime<=e){if(e<=r.endTime)return r.context;break}}}catch(e){n.e(e)}finally{n.f()}},Ee.prototype.closeActive=function(e){var t=this.entries[0];t&&t.endTime===be&&t.close(e)},Ee.prototype.findAll=function(e,t){void 0===t&&(t=0),void 0===e&&(e=be);var n=e+t,r=I(this.entries,(function(t){return t.startTime<=n&&e<=t.endTime}));return D(r,(function(e){return e.context}))},Ee.prototype.reset=function(){this.entries=[]},Ee.prototype.stop=function(){g(this.clearOldContextsInterval)},Ee.prototype.clearOldContexts=function(){for(var e=ne()-this.expireDelay;this.entries.length>0&&this.entries[this.entries.length-1].endTime<e;)this.entries.pop()};var we={navigator:"undefined"!=typeof window&&void 0!==window.navigator?window.navigator:{},infoMap:{engine:["WebKit","Trident","Gecko","Presto"],browser:["Safari","Chrome","Edge","IE","IE 11","IE 10","IE 9","IE 8","IE 7","Firefox","Firefox Focus","Chromium","Opera","Vivaldi","Yandex","Arora","Lunascape","QupZilla","Coc Coc","Kindle","Iceweasel","Konqueror","Iceape","SeaMonkey","Epiphany","360","360SE","360EE","UC","QQBrowser","QQ","Baidu","Maxthon","Sogou","LBBROWSER","2345Explorer","TheWorld","XiaoMi","Quark","Qiyu","Wechat",,"WechatWork","Taobao","Alipay","Weibo","Douban","Suning","iQiYi"],os:["Windows","Linux","Mac OS","Android","Ubuntu","FreeBSD","Debian","iOS","Windows Phone","BlackBerry","MeeGo","Symbian","Chrome OS","WebOS"],device:["Mobile","Tablet","iPad"]}},Oe={getMatchMap:function(e){return{Trident:e.indexOf("Trident")>-1||e.indexOf("NET CLR")>-1,Presto:e.indexOf("Presto")>-1,WebKit:e.indexOf("AppleWebKit")>-1,Gecko:e.indexOf("Gecko/")>-1,Safari:e.indexOf("Safari")>-1,Chrome:e.indexOf("Chrome")>-1||e.indexOf("CriOS")>-1,IE:e.indexOf("MSIE")>-1||e.indexOf("Trident")>-1,Edge:e.indexOf("Edge")>-1||e.indexOf("Edg")>-1,Firefox:e.indexOf("Firefox")>-1||e.indexOf("FxiOS")>-1,"Firefox Focus":e.indexOf("Focus")>-1,Chromium:e.indexOf("Chromium")>-1,Opera:e.indexOf("Opera")>-1||e.indexOf("OPR")>-1,Vivaldi:e.indexOf("Vivaldi")>-1,Yandex:e.indexOf("YaBrowser")>-1,Arora:e.indexOf("Arora")>-1,Lunascape:e.indexOf("Lunascape")>-1,QupZilla:e.indexOf("QupZilla")>-1,"Coc Coc":e.indexOf("coc_coc_browser")>-1,Kindle:e.indexOf("Kindle")>-1||e.indexOf("Silk/")>-1,Iceweasel:e.indexOf("Iceweasel")>-1,Konqueror:e.indexOf("Konqueror")>-1,Iceape:e.indexOf("Iceape")>-1,SeaMonkey:e.indexOf("SeaMonkey")>-1,Epiphany:e.indexOf("Epiphany")>-1,360:e.indexOf("QihooBrowser")>-1||e.indexOf("QHBrowser")>-1,"360EE":e.indexOf("360EE")>-1,"360SE":e.indexOf("360SE")>-1,UC:e.indexOf("UC")>-1||e.indexOf(" UBrowser")>-1,QQBrowser:e.indexOf("QQBrowser")>-1,QQ:e.indexOf("QQ/")>-1,Baidu:e.indexOf("Baidu")>-1||e.indexOf("BIDUBrowser")>-1,Maxthon:e.indexOf("Maxthon")>-1,Sogou:e.indexOf("MetaSr")>-1||e.indexOf("Sogou")>-1,LBBROWSER:e.indexOf("LBBROWSER")>-1,"2345Explorer":e.indexOf("2345Explorer")>-1,TheWorld:e.indexOf("TheWorld")>-1,XiaoMi:e.indexOf("MiuiBrowser")>-1,Quark:e.indexOf("Quark")>-1,Qiyu:e.indexOf("Qiyu")>-1,Wechat:e.indexOf("MicroMessenger")>-1,Taobao:e.indexOf("AliApp(TB")>-1,Alipay:e.indexOf("AliApp(AP")>-1,Weibo:e.indexOf("Weibo")>-1,Douban:e.indexOf("com.douban.frodo")>-1,Suning:e.indexOf("SNEBUY-APP")>-1,iQiYi:e.indexOf("IqiyiApp")>-1,Windows:e.indexOf("Windows")>-1,Linux:e.indexOf("Linux")>-1||e.indexOf("X11")>-1,"Mac OS":e.indexOf("Macintosh")>-1,Android:e.indexOf("Android")>-1||e.indexOf("Adr")>-1,Ubuntu:e.indexOf("Ubuntu")>-1,FreeBSD:e.indexOf("FreeBSD")>-1,Debian:e.indexOf("Debian")>-1,"Windows Phone":e.indexOf("IEMobile")>-1||e.indexOf("Windows Phone")>-1,BlackBerry:e.indexOf("BlackBerry")>-1||e.indexOf("RIM")>-1,MeeGo:e.indexOf("MeeGo")>-1,Symbian:e.indexOf("Symbian")>-1,iOS:e.indexOf("like Mac OS X")>-1,"Chrome OS":e.indexOf("CrOS")>-1,WebOS:e.indexOf("hpwOS")>-1,Mobile:e.indexOf("Mobi")>-1||e.indexOf("iPh")>-1||e.indexOf("480")>-1,Tablet:e.indexOf("Tablet")>-1||e.indexOf("Nexus 7")>-1,iPad:e.indexOf("iPad")>-1}},matchInfoMap:function(e){var t=we.navigator.userAgent||"",n=Oe.getMatchMap(t);for(var r in we.infoMap)for(var o=0;o<we.infoMap[r].length;o++){var i=we.infoMap[r][o];n[i]&&(e[r]=i)}},getOS:function(){return Oe.matchInfoMap(this),this.os||"Unknown"},getOSVersion:function(){var e=this,t=we.navigator.userAgent||"";e.osVersion="",e.osMajor="";var n={Windows:function(){var e=t.replace(/^.*Windows NT ([\d.]+);.*$/,"$1");return{6.4:"10",6.3:"8.1",6.2:"8",6.1:"7","6.0":"Vista",5.2:"XP",5.1:"XP","5.0":"2000"}[e]||e},Android:function(){return t.replace(/^.*Android ([\d.]+);.*$/,"$1")},iOS:function(){return t.replace(/^.*OS ([\d_]+) like.*$/,"$1").replace(/_/g,".")},Debian:function(){return t.replace(/^.*Debian\/([\d.]+).*$/,"$1")},"Windows Phone":function(){return t.replace(/^.*Windows Phone( OS)? ([\d.]+);.*$/,"$2")},"Mac OS":function(){return t.replace(/^.*Mac OS X ([\d_]+).*$/,"$1").replace(/_/g,".")},WebOS:function(){return t.replace(/^.*hpwOS\/([\d.]+);.*$/,"$1")}};return n[e.os]&&(e.osVersion=n[e.os](),e.osVersion===t&&(e.osVersion="")),e.osVersion&&(e.osMajor=e.osVersion.split(".").length&&e.osVersion.split(".")[0]),{version:e.osVersion,osMajor:e.osMajor}},getOrientationStatu:function(){return window.matchMedia("(orientation: portrait)").matches?"竖屏":"横屏"},getDeviceType:function(){var e=this;return e.device="PC",Oe.matchInfoMap(e),e.device},getNetwork:function(){var e=window.navigator.connection||window.navigator.mozConnection||window.navigator.webkitConnection,t="unknown",n=e?e.type||e.effectiveType:null;if(n&&"string"==typeof n)switch(n){case"bluetooth":case"cellular":case"slow-2g":case"2g":case"3g":t="cellular";break;case"none":t="none";break;case"ethernet":case"wifi":case"wimax":case"4g":t="wifi";break;case"other":case"unknown":t="unknown"}return t},getLanguage:function(){var e;return this.language=((e=(we.navigator.browserLanguage||we.navigator.language||"").split("-"))[1]&&(e[1]=e[1].toUpperCase()),e.join("_")),this.language},getBrowserInfo:function(){var e=this;Oe.matchInfoMap(e);var t=we.navigator.userAgent||"",n=function(e,t){var n=we.navigator.mimeTypes;for(var r in n)if(n[r][e]==t)return!0;return!1},r=Oe.getMatchMap(t),o=!1;if("undefined"!=typeof window&&window.chrome){var i=t.replace(/^.*Chrome\/([\d]+).*$/,"$1");i>36&&window.showModalDialog?o=!0:i>45&&(o=n("type","application/vnd.chromium.remoting-viewer"))}if(r.Baidu&&r.Opera&&(r.Baidu=!1),r.Mobile&&(r.Mobile=!(t.indexOf("iPad")>-1)),o&&(n("type","application/gameplugin")||we.navigator&&void 0===we.navigator.connection.saveData?r["360SE"]=!0:r["360EE"]=!0),r.IE||r.Edge)switch(window.screenTop-window.screenY){case 71:case 74:case 99:case 75:case 74:case 105:default:break;case 102:r["360EE"]=!0;break;case 104:r["360SE"]=!0}var s={Safari:function(){return t.replace(/^.*Version\/([\d.]+).*$/,"$1")},Chrome:function(){return t.replace(/^.*Chrome\/([\d.]+).*$/,"$1").replace(/^.*CriOS\/([\d.]+).*$/,"$1")},IE:function(){return t.replace(/^.*MSIE ([\d.]+).*$/,"$1").replace(/^.*rv:([\d.]+).*$/,"$1")},Edge:function(){return t.replace(/^.*Edge?\/([\d.]+).*$/,"$1")},Firefox:function(){return t.replace(/^.*Firefox\/([\d.]+).*$/,"$1").replace(/^.*FxiOS\/([\d.]+).*$/,"$1")},"Firefox Focus":function(){return t.replace(/^.*Focus\/([\d.]+).*$/,"$1")},Chromium:function(){return t.replace(/^.*Chromium\/([\d.]+).*$/,"$1")},Opera:function(){return t.replace(/^.*Opera\/([\d.]+).*$/,"$1").replace(/^.*OPR\/([\d.]+).*$/,"$1")},Vivaldi:function(){return t.replace(/^.*Vivaldi\/([\d.]+).*$/,"$1")},Yandex:function(){return t.replace(/^.*YaBrowser\/([\d.]+).*$/,"$1")},Arora:function(){return t.replace(/^.*Arora\/([\d.]+).*$/,"$1")},Lunascape:function(){return t.replace(/^.*Lunascape[\/\s]([\d.]+).*$/,"$1")},QupZilla:function(){return t.replace(/^.*QupZilla[\/\s]([\d.]+).*$/,"$1")},"Coc Coc":function(){return t.replace(/^.*coc_coc_browser\/([\d.]+).*$/,"$1")},Kindle:function(){return t.replace(/^.*Version\/([\d.]+).*$/,"$1")},Iceweasel:function(){return t.replace(/^.*Iceweasel\/([\d.]+).*$/,"$1")},Konqueror:function(){return t.replace(/^.*Konqueror\/([\d.]+).*$/,"$1")},Iceape:function(){return t.replace(/^.*Iceape\/([\d.]+).*$/,"$1")},SeaMonkey:function(){return t.replace(/^.*SeaMonkey\/([\d.]+).*$/,"$1")},Epiphany:function(){return t.replace(/^.*Epiphany\/([\d.]+).*$/,"$1")},360:function(){return t.replace(/^.*QihooBrowser\/([\d.]+).*$/,"$1")},"360SE":function(){return{63:"10.0",55:"9.1",45:"8.1",42:"8.0",31:"7.0",21:"6.3"}[t.replace(/^.*Chrome\/([\d]+).*$/,"$1")]||""},"360EE":function(){return{69:"11.0",63:"9.5",55:"9.0",50:"8.7",30:"7.5"}[t.replace(/^.*Chrome\/([\d]+).*$/,"$1")]||""},Maxthon:function(){return t.replace(/^.*Maxthon\/([\d.]+).*$/,"$1")},QQBrowser:function(){return t.replace(/^.*QQBrowser\/([\d.]+).*$/,"$1")},QQ:function(){return t.replace(/^.*QQ\/([\d.]+).*$/,"$1")},Baidu:function(){return t.replace(/^.*BIDUBrowser[\s\/]([\d.]+).*$/,"$1")},UC:function(){return t.replace(/^.*UC?Browser\/([\d.]+).*$/,"$1")},Sogou:function(){return t.replace(/^.*SE ([\d.X]+).*$/,"$1").replace(/^.*SogouMobileBrowser\/([\d.]+).*$/,"$1")},LBBROWSER:function(){var e="";t.indexOf("LieBaoFast")>-1&&(e=t.replace(/^.*LieBaoFast\/([\d.]+).*$/,"$1"));var n=t.replace(/^.*Chrome\/([\d]+).*$/,"$1");return e||{57:"6.5",49:"6.0",46:"5.9",42:"5.3",39:"5.2",34:"5.0",29:"4.5",21:"4.0"}[n]||""},"2345Explorer":function(){return t.replace(/^.*2345Explorer\/([\d.]+).*$/,"$1")},TheWorld:function(){return t.replace(/^.*TheWorld ([\d.]+).*$/,"$1")},XiaoMi:function(){return t.replace(/^.*MiuiBrowser\/([\d.]+).*$/,"$1")},Quark:function(){return t.replace(/^.*Quark\/([\d.]+).*$/,"$1")},Qiyu:function(){return t.replace(/^.*Qiyu\/([\d.]+).*$/,"$1")},Wechat:function(){return t.replace(/^.*MicroMessenger\/([\d.]+).*$/,"$1")},WechatWork:function(){return t.replace(/^.*wxwork\/([\d.]+).*$/,"$1")},Taobao:function(){return t.replace(/^.*AliApp\(TB\/([\d.]+).*$/,"$1")},Alipay:function(){return t.replace(/^.*AliApp\(AP\/([\d.]+).*$/,"$1")},Weibo:function(){return t.replace(/^.*weibo__([\d.]+).*$/,"$1")},Douban:function(){return t.replace(/^.*com.douban.frodo\/([\d.]+).*$/,"$1")},Suning:function(){return t.replace(/^.*SNEBUY-APP([\d.]+).*$/,"$1")},iQiYi:function(){return t.replace(/^.*IqiyiVersion\/([\d.]+).*$/,"$1")}};return e.browserVersion="",e.browserMajor="",s[e.browser]&&(e.browserVersion=s[e.browser](),e.browserVersion==t&&(e.browserVersion="")),"Chrome"==e.browser&&t.match(/\S+Browser/)&&(e.browser=t.match(/\S+Browser/)[0],e.version=t.replace(/^.*Browser\/([\d.]+).*$/,"$1")),"Edge"==e.browser&&(e.version>"75"?e.engine="Blink":e.engine="EdgeHTML"),("Chrome"==e.browser&&parseInt(e.browserVersion)>27||r.Chrome&&"WebKit"==e.engine&&parseInt(e.browserVersion)>27||"Opera"==e.browser&&parseInt(e.version)>12||"Yandex"==e.browser)&&(e.engine="Blink"),e.browserVersion&&(e.browserMajor=e.browserVersion.split(".").length&&this.browserVersion.split(".")[0]),{browser:e.browser,browserVersion:e.browserVersion,engine:e.engine,browserMajor:e.browserMajor}},getGeoPostion:function(e){navigator&&navigator.geolocation&&navigator.geolocation.getCurrentPosition((function(t){e(t)}),(function(e){n.warn(e)}))}},Se={};"undefined"!=typeof window&&(Se={os:Oe.getOS(),osVersion:Oe.getOSVersion().version,osVersionMajor:Oe.getOSVersion().osMajor,browser:Oe.getBrowserInfo().browser,browserVersion:Oe.getBrowserInfo().browserVersion,browserVersionMajor:Oe.getBrowserInfo().browserMajor,screenSize:window.screen.width+"*"+window.screen.height,networkType:Oe.getNetwork(),divice:Oe.getDeviceType()});var xe=Se,Ce={BEFORE_UNLOAD:"beforeunload",CLICK:"click",DBL_CLICK:"dblclick",KEY_DOWN:"keydown",LOAD:"load",POP_STATE:"popstate",SCROLL:"scroll",TOUCH_START:"touchstart",TOUCH_END:"touchend",TOUCH_MOVE:"touchmove",VISIBILITY_CHANGE:"visibilitychange",PAGE_SHOW:"pageshow",FREEZE:"freeze",RESUME:"resume",DOM_CONTENT_LOADED:"DOMContentLoaded",POINTER_DOWN:"pointerdown",POINTER_UP:"pointerup",POINTER_CANCEL:"pointercancel",HASH_CHANGE:"hashchange",PAGE_HIDE:"pagehide",MOUSE_DOWN:"mousedown",MOUSE_UP:"mouseup",MOUSE_MOVE:"mousemove",FOCUS:"focus",BLUR:"blur",CONTEXT_MENU:"contextmenu",RESIZE:"resize",CHANGE:"change",INPUT:"input",PLAY:"play",PAUSE:"pause",SECURITY_POLICY_VIOLATION:"securitypolicyviolation",SELECTION_CHANGE:"selectionchange",STORAGE:"storage"},Te={ACTION:"action",ERROR:"error",LONG_TASK:"long_task",VIEW:"view",RESOURCE:"resource",LOGGER:"logger"},Le={FETCH:"fetch",XHR:"xhr"},Re={HANDLED:"handled",UNHANDLED:"unhandled"},ke={UNCAUGHT:"Uncaught",PROVIDED:"Provided"};function Ae(e,t,n){var r=e[t],o=n(r),i=function(){if("function"==typeof o)return o.apply(this,arguments)};return e[t]=i,{stop:function(){e[t]===i?e[t]=r:o=r}}}function Ie(e,t,n){return Ae(e,t,(function(e){return function(){var t;return n&&n.before&&a(n.before,this,arguments),"function"==typeof e&&(t=e.apply(this,arguments)),n&&n.after&&a(n.after,this,arguments),t}}))}function De(e){return De="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},De(e)}function Me(e,t,n){if("object"!==De(e)||null===e)return JSON.stringify(e);var r=$e(Object.prototype),o=$e(Array.prototype),i=$e(Object.getPrototypeOf(e)),s=$e(e);try{return JSON.stringify(e,t,n)}catch(e){return"<error: unable to serialize object>"}finally{r(),o(),i(),s()}}function $e(e){var t=e,n=t.toJSON;return n?(delete t.toJSON,function(){t.toJSON=n}):K}function Ue(e){return Ue="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},Ue(e)}var Pe="?";function Ne(e){var t=[],n=Qe(e,"stack");return n&&S(n.split("\n"),(function(e){var n=function(e){var t=We.exec(e);if(!t)return;var n=t[2]&&0===t[2].indexOf("native"),r=t[2]&&0===t[2].indexOf("eval"),o=Fe.exec(t[2]);r&&o&&(t[2]=o[1],t[3]=o[2],t[4]=o[3]);return{args:n?[t[2]]:[],column:t[4]?+t[4]:void 0,func:t[1]||Pe,line:t[3]?+t[3]:void 0,url:n?void 0:t[2]}}(e)||function(e){var t=Ve.exec(e);if(!t)return;return{args:[],column:t[3]?+t[3]:void 0,func:Pe,line:t[2]?+t[2]:void 0,url:t[1]}}(e)||function(e){var t=je.exec(e);if(!t)return;return{args:[],column:t[4]?+t[4]:void 0,func:t[1]||Pe,line:+t[3],url:t[2]}}(e)||function(e){var t=qe.exec(e);if(!t)return;var n=t[3]&&t[3].indexOf(" > eval")>-1,r=He.exec(t[3]);n&&r&&(t[3]=r[1],t[4]=r[2],t[5]=void 0);return{args:t[2]?t[2].split(","):[],column:t[5]?+t[5]:void 0,func:t[1]||Pe,line:t[4]?+t[4]:void 0,url:t[3]}}(e);n&&(!n.func&&n.line&&(n.func=Pe),t.push(n))})),{message:Qe(e,"message"),name:Qe(e,"name"),stack:t}}var Be="((?:file|https?|blob|chrome-extension|native|eval|webpack|<anonymous>|\\w+\\.|\\/).*?)",Ge="(?::(\\d+))",We=new RegExp("^\\s*at (.*?) ?\\("+Be+Ge+"?"+Ge+"?\\)?\\s*$","i"),Fe=new RegExp("\\((\\S*)"+Ge+Ge+"\\)");var Ve=new RegExp("^\\s*at ?"+Be+Ge+"?"+Ge+"??\\s*$","i");var je=/^\s*at (?:((?:\[object object\])?.+) )?\(?((?:file|ms-appx|https?|webpack|blob):.*?):(\d+)(?::(\d+))?\)?\s*$/i;var qe=/^\s*(.*?)(?:\((.*?)\))?(?:^|@)((?:file|https?|blob|chrome|webpack|resource|capacitor|\[native).*?|[^@]*bundle)(?::(\d+))?(?::(\d+))?\s*$/i,He=/(\S+) line (\d+)(?: > eval line \d+)* > eval/i;function Qe(e,t){if("object"===Ue(e)&&e&&t in e){var n=e[t];return"string"==typeof n?n:void 0}}var Ke=/^(?:[Uu]ncaught (?:exception: )?)?(?:((?:Eval|Internal|Range|Reference|Syntax|Type|URI|)Error): )?([\s\S]*)$/;function Xe(e){var t=function(e){return Ie(window,"onerror",{before:function(t,n,r,o,i){var s;if(i instanceof Error)s=Ne(i);else{var a={url:n,column:o,line:r},u=function(e){var t,n;if("[object String]"==={}.toString.call(e)){var r=Ke.exec(e);r&&(t=r[1],n=r[2])}return{name:t,message:n}}(t);s={name:u.name,message:u.message,stack:[a]}}e(s,pe(i,t))}})}(e),n=function(e){return Ie(window,"onunhandledrejection",{before:function(t){var n=t.reason||"Empty reason",r=Ne(n);e(r,n)}})}(e);return{stop:function(){t.stop(),n.stop()}}}var ze="No stack, consider using an instance of Error",Ye={AGENT:"agent",CONSOLE:"console",NETWORK:"network",SOURCE:"source",LOGGER:"logger",CUSTOM:"custom"};function Je(e){var t=e.stackTrace,n=e.originalError,r=e.handlingStack,o=e.startClocks,i=e.nonErrorPrefix,s=e.source,a=e.handling,u=n instanceof Error,c=function(e,t,n,r){return e&&e.message&&e&&e.name?e.message:t?"Empty message":n+" "+Me(sanitize(r))}(t,u,i,n),f=function(e,t){if(void 0===t)return!1;if(e)return!0;return t.stack.length>0&&(t.stack.length>1||void 0!==t.stack[0].url)}(u,t)?Ze(t):ze,l=u?function(e,t){var n=e,r=[];for(;n&&n.cause instanceof Error&&r.length<10;){var o=Ne(n.cause);r.push({message:n.cause.message,source:t,type:o&&o.name,stack:o&&Ze(o)}),n=n.cause}return r.length?r:void 0}(n,s):void 0;return{startClocks:o,source:s,handling:a,originalError:n,message:c,stack:f,handlingStack:r,type:t&&t.name,causes:l}}function Ze(e){var t=et(e);return S(e.stack,(function(e){var n="?"===e.func?"<anonymous>":e.func,r=e.args&&e.args.length>0?"("+e.args.join(", ")+")":"",o=e.line?":"+e.line:"",i=e.line&&e.column?":"+e.column:"";t+="\n at "+n+r+" @ "+e.url+o+i})),t}function et(e){return(e.name||"Error")+": "+e.message}var tt=1024,nt=1024*tt,rt=/[^\u0000-\u007F]/;function ot(e){return rt.test(e)?void 0!==window.TextEncoder?(new TextEncoder).encode(e).length:new Blob([e]).size:e.length}var it=function(e){this.observers=[],this.onLastUnsubscribe=void 0,this.onFirstSubscribe=e};it.prototype={subscribe:function(e){!this.observers.length&&this.onFirstSubscribe&&(this.onLastUnsubscribe=this.onFirstSubscribe()||void 0),this.observers.push(e);var t=this;return{unsubscribe:function(){t.observers=I(t.observers,(function(t){return e!==t})),!t.observers.length&&t.onLastUnsubscribe&&t.onLastUnsubscribe()}}},notify:function(e){S(this.observers,(function(t){t(e)}))}};var st=it;function at(){var e=[].slice.call(arguments),t=new st((function(){var n=D(e,(function(e){return e.subscribe((function(e){return t.notify(e)}))}));return function(){return S(n,(function(e){return e.unsubscribe()}))}}));return t}var ut={};function ct(e){var n=D(e,(function(e){return ut[e]||(ut[e]=function(e){var n=new st((function(){var r=console[e];return console[e]=function(){var o=[].slice.call(arguments);r.apply(console,arguments);var i=function(){var e,t=new Error;if(!t.stack)try{throw t}catch(e){}return a((function(){var n=Ne(t);n.stack=n.stack.slice(2),e=Ze(n)})),e}();a((function(){n.notify(function(e,n,r){var o,i=D(e,(function(e){return function(e){if("string"==typeof e)return e;if(e instanceof Error)return et(Ne(e));return Me(e,void 0,2)}(e)})).join(" ");if(n===t.error){var s=function(e,t){for(var n=0;n<e.length;n+=1){var r=e[n];if(t(r,n,e))return r}}(e,(function(e){return e instanceof Error}));o=s?Ze(Ne(s)):void 0,i="console error: "+i}return{api:n,message:i,stack:o,handlingStack:r}}(o,e,i))}))},function(){console[e]=r}}));return n}(e)),ut[e]}));return at.apply(this,n)}function ft(e,t,n,r){return lt(e,[t],n,r)}function lt(e,t,n,o){var i=s(o&&o.once?function(e){u(),n(e)}:n);o=o&&o.passive?{capture:o.capture,passive:o.passive}:o&&o.capture;var a=r(e,"addEventListener");S(t,(function(t){a.call(e,t,i,o)}));var u=function(){var n=r(e,"removeEventListener");S(t,(function(t){n.call(e,t,i,o)}))};return{stop:u}}var dt={intervention:"intervention",deprecation:"deprecation",cspViolation:"csp_violation"};function pt(e,t){var n,r=[];ce(t,dt.cspViolation)&&r.push(n=new st((function(){var e=function(e){n.notify(function(e){var t=dt.cspViolation,n="'"+e.blockedURI+"' blocked by '"+e.effectiveDirective+"' directive";return{type:dt.cspViolation,subtype:e.effectiveDirective,message:t+": "+n,stack:vt(e.effectiveDirective,n+' of the policy "'+ue(e.originalPolicy,100)+'"',e.sourceFile,e.lineNumber,e.columnNumber)}}(e))};return ft(document,Ce.SECURITY_POLICY_VIOLATION,e).stop})));var o=I(t,(function(e){return e!==dt.cspViolation}));return o.length&&r.push(function(e){var t=new st((function(){if(window.ReportingObserver){var n=s((function(e){S(e,(function(e){t.notify(function(e){var t=e.body,n=e.type;return{type:n,subtype:t.id,message:n+": "+t.message,stack:vt(t.id,t.message,t.sourceFile,t.lineNumber,t.columnNumber)}}(e))}))})),r=new window.ReportingObserver(n,{types:e,buffered:!0});return r.observe(),function(){r.disconnect()}}}));return t}(o)),at.apply(this,r)}function vt(e,t,n,r,o){return n&&Ze({name:e,message:t,stack:[{func:"?",url:n,line:r,column:o}]})}function gt(e){return gt="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},gt(e)}var ht=220*tt,yt="$",mt=3;function bt(e,t){void 0===t&&(t=ht);var n=$e(Object.prototype),r=$e(Array.prototype),o=[],i=new WeakMap,s=_t(e,yt,void 0,o,i),a=JSON.stringify(s)&&JSON.stringify(s).length||0;if(!(a>t)){for(;o.length>0&&a<t;){var u=o.shift(),c=0;if(Array.isArray(u.source))for(var f=0;f<u.source.length;f++){if(a+=void 0!==(l=_t(u.source[f],u.path,f,o,i))?JSON.stringify(l).length:4,a+=c,c=1,a>t){Et(t,"truncated",e);break}u.target[f]=l}else for(var f in u.source)if(Object.prototype.hasOwnProperty.call(u.source,f)){var l;if(void 0!==(l=_t(u.source[f],u.path,f,o,i))&&(a+=JSON.stringify(l).length+c+f.length+mt,c=1),a>t){Et(t,"truncated",e);break}u.target[f]=l}}return n(),r(),s}Et(t,"discarded",e)}function _t(e,t,n,r,o){var i=function(e){var t=e;if(t&&"function"==typeof t.toJSON)try{return t.toJSON()}catch(e){}return e}(e);if(!i||"object"!==gt(i))return function(e){if("bigint"==typeof e)return"[BigInt] "+e.toString();if("function"==typeof e)return"[Function] "+e.name||0;if("symbol"===gt(e))return"[Symbol] "+e.description||0;return e}(i);var s=function(e){try{if(e instanceof Event)return{isTrusted:e.isTrusted};var t=Object.prototype.toString.call(e).match(/\[object (.*)\]/);if(t&&t[1])return"["+t[1]+"]"}catch(e){}return"[Unserializable]"}(i);if("[Object]"!==s&&"[Array]"!==s&&"[Error]"!==s)return s;var a=e;if(o.has(a))return"[Reference seen at "+o.get(a)+"]";var u=void 0!==n?t+"."+n:t,c=Array.isArray(i)?[]:{};return o.set(a,u),r.push({source:i,target:c,path:u}),c}function Et(e,t,r){n.warn("The data provided has been "+t+" as it is over the limit of "+e+" characters:",r)}var wt=function(){this._events=[],this.pendingEvents=[]};wt.prototype={emit:function(e){var t=[].slice.call(arguments,1);S(this._events,(function(n){if(n.type!==e)return!1;n.callback.apply(n.context,t)}))},on:function(e,t,n){"function"==typeof t&&this._events.push({type:e,callback:t,context:n||this})}};new wt;var Ot,St={PERFORMANCE_ENTRIES_COLLECTED:"PERFORMANCE_ENTRIES_COLLECTED",AUTO_ACTION_COMPLETED:"AUTO_ACTION_COMPLETED",VIEW_CREATED:"VIEW_CREATED",VIEW_UPDATED:"VIEW_UPDATED",VIEW_ENDED:"VIEW_ENDED",SESSION_RENEWED:"SESSION_RENEWED",SESSION_EXPIRED:"SESSION_EXPIRED",PAGE_EXITED:"PAGE_EXITED",REQUEST_STARTED:"REQUEST_STARTED",REQUEST_COMPLETED:"REQUEST_COMPLETED",RAW_RUM_EVENT_COLLECTED:"RAW_RUM_EVENT_COLLECTED",RUM_EVENT_COLLECTED:"RUM_EVENT_COLLECTED",RAW_ERROR_COLLECTED:"RAW_ERROR_COLLECTED",RAW_LOG_COLLECTED:"RAW_LOG_COLLECTED",LOG_COLLECTED:"LOG_COLLECTED"};function xt(){this.callbacks={}}function Ct(e){return Tt(e,function(e){if(e.origin&&"null"!==e.origin)return e.origin;var t=e.host.replace(/(:80|:443)$/,"");return e.protocol+"//"+t}(window.location)).href}function Tt(e,t){if(function(){if(void 0!==Ot)return Ot;try{var e=new URL("http://test/path");return Ot="http://test/path"===e.href}catch(e){Ot=!1}return Ot}())return void 0!==t?new URL(e,t):new URL(e);if(void 0===t&&!/:/.test(e))throw new Error("Invalid URL: "+e);var n=document,r=n.createElement("a");if(void 0!==t){var o=(n=document.implementation.createHTMLDocument("")).createElement("base");o.href=t,n.head.appendChild(o),n.body.appendChild(r)}return r.href=e,r}xt.prototype={notify:function(e,t){var n=this.callbacks[e];n&&S(n,(function(e){e(t)}))},subscribe:function(e,t){this.callbacks[e]||(this.callbacks[e]=[]),this.callbacks[e].push(t);var n=this;return{unsubscribe:function(){n.callbacks[e]=I(n.callbacks[e],(function(e){return e!==t}))}}}};var Lt=navigator.userAgent.toLowerCase(),Rt=function(){return/iphone os/.test(Lt)};var kt,At=Y;function It(e,t,n,r){var o=new Date;o.setTime(o.getTime()+n);var i="expires="+o.toUTCString(),s=r&&r.crossSite?"none":"strict",a=r&&r.domain?";domain="+r.domain:"",u=r&&r.secure?";secure":"";document.cookie=e+"="+t+";"+i+";path=/;samesite="+s+a+u}function Dt(e){return function(e,t){var n=e.match("(?:^|;)\\s*"+t+"\\s*=\\s*([^;]+)");return n?n[1]:void 0}(document.cookie,e)}var Mt=/^\s+|\s+$/g,$t={rum:"/rum",log:"/logging",sessionReplay:"/rum/replay"};function Ut(e,t){var n=$t[t];return n?(0===e.indexOf("/")&&(e=location.origin+Pt(e)),e.lastIndexOf("/")===e.length-1?Pt(e)+"v1/write"+n:Pt(e)+"/v1/write"+n):""}function Pt(e){return e.replace(Mt,"")}var Nt,Bt;function Gt(e){if(void 0===e.sampleRate||fe(e.sampleRate))if(void 0===e.sessionSampleRate||fe(e.sessionSampleRate)){if(void 0===e.telemetrySampleRate||fe(e.telemetrySampleRate)){var t=e.sessionSampleRate||e.sampleRate;return x({beforeSend:e.beforeSend&&c(e.beforeSend,"beforeSend threw an error:"),cookieOptions:Wt(e),sessionSampleRate:pe(t,100),service:e.service,version:e.version,env:e.env,telemetrySampleRate:pe(e.telemetrySampleRate,100),telemetryEnabled:pe(e.telemetryEnabled,!1),silentMultipleInit:!!e.silentMultipleInit,batchBytesLimit:16*tt,eventRateLimiterThreshold:3e3,maxTelemetryEventsPerPage:15,flushTimeout:30*Y,batchMessagesLimit:50,messageBytesLimit:256*tt,resourceUrlLimit:5*tt,storeContextsToLocal:!!e.storeContextsToLocal},function(e){var t=function(e){return!1};"isIntakeUrl"in e&&R(e.isIntakeUrl)&&B(e.isIntakeUrl())&&(t=e.isIntakeUrl);var n=function(e){return!1};return"isServerError"in e&&R(e.isServerError)&&B(e.isServerError())&&(n=e.isServerError),{rumEndpoint:Ut(e.datakitUrl||e.datakitOrigin,"rum"),logsEndpoint:Ut(e.datakitOrigin,"log"),sessionReplayEndPoint:Ut(e.datakitOrigin,"sessionReplay"),isIntakeUrl:t,isServerError:n}}(e))}n.error("Telemetry Sample Rate should be a number between 0 and 100")}else n.error("Sample Rate should be a number between 0 and 100");else n.error("Sample Rate should be a number between 0 and 100")}function Wt(e){var t={};return t.secure=function(e){return!!e.useSecureSessionCookie||!!e.useCrossSiteSessionCookie}(e),t.crossSite=!!e.useCrossSiteSessionCookie,e.trackSessionAcrossSubdomains&&(t.domain=function(){if(void 0===kt){for(var e="dd_site_test_".concat(V()),t=window.location.hostname.split("."),n=t.pop();t.length&&!Dt(e);)n=t.pop()+"."+n,It(e,"test",Y,{domain:n});kt=n}return kt}()),t}function Ft(){var e;return Nt||(e=new st((function(){if(window.fetch)return Ae(window,"fetch",(function(t){return function(n,r){var o,i=a(Vt,null,[e,n,r]);return i?(o=t.call(this,i.input,i.init),a(jt,null,[e,o,i])):o=t.call(this,n,r),o}})).stop})),Nt=e),Nt}function Vt(e,t,n){var r=n&&n.method||t instanceof Request&&t.method||"GET",o=t instanceof Request?t.url:Ct(String(t)),i={state:"start",init:n,input:t,method:r,startClocks:re(),url:o};return e.notify(i),i}function jt(e,t,n){var r=function(t){var r=n;if(r.state="resolve","stack"in t||t instanceof Error)r.status=0,r.isAborted=t instanceof DOMException&&t.code===DOMException.ABORT_ERR,r.error=t;else if("status"in t){r.response=t;try{r.responseType=t.constructor===Response&&t.type||""}catch(e){r.responseType=""}r.status=t.status,r.isAborted=!1}e.notify(r)};t.then(s(r),s(r))}var qt={},Ht="_DATAFLUX_REQUEST_UUID";function Qt(){var e;return Bt||(e=new st((function(){var t=Ie(XMLHttpRequest.prototype,"open",{before:Kt}),n=Ie(XMLHttpRequest.prototype,"send",{before:function(){Xt.call(this,e)}}),r=Ie(XMLHttpRequest.prototype,"abort",{before:Yt});return function(){t.stop(),n.stop(),r.stop()}})),Bt=e),Bt}function Kt(e,t){var n=this[Ht]||V();this[Ht]=n,qt[n]={state:"open",method:e,url:Ct(String(t))}}function Xt(e){var t=qt[this[Ht]];if(t){var n=t;n.state="start",n.startTime=ne(),n.startClocks=re(),n.isAborted=!1,n.xhr=this;var r=!1,o=Ie(this,"onreadystatechange",{before:function(){this.readyState===XMLHttpRequest.DONE&&i.call(this)}}).stop,i=function(){if(s(),o(),!r){r=!0;var i,a=t;a.state="complete",a.duration=(i=n.startClocks.timeStamp,oe()-i),a.status=this.status,e.notify(x({},a)),zt.call(this)}},s=ft(this,"loadend",i).stop;e.notify(n)}}function zt(){delete qt[this[Ht]],delete this[Ht]}function Yt(){var e=qt[this[Ht]];e&&(e.isAborted=!0)}var Jt={HIDDEN:"visibility_hidden",UNLOADING:"before_unload",PAGEHIDE:"page_hide",FROZEN:"page_frozen"};var Zt,en={sdk_name:"_gc.sdk_name",sdk_version:"_gc.sdk_version",app_id:"application.id",env:"env",service:"service",version:"version",userid:"user.id",user_email:"user.email",user_name:"user.name",session_id:"session.id",session_type:"session.type",session_sampling:"session.is_sampling",session_has_replay:"session.has_replay",is_signin:"user.is_signin",os:"device.os",os_version:"device.os_version",os_version_major:"device.os_version_major",browser:"device.browser",browser_version:"device.browser_version",browser_version_major:"device.browser_version_major",screen_size:"device.screen_size",network_type:"device.network_type",device:"device.device",view_id:"view.id",view_referrer:"view.referrer",view_url:"view.url",view_host:"view.host",view_path:"view.path",view_name:"view.path",view_path_group:"view.path_group",view_url_query:"view.url_query"},tn={action_id:"action.id",action_ids:"action.ids",view_in_foreground:"view.in_foreground",display:"display"},nn={view:{type:Te.VIEW,tags:{view_loading_type:"view.loading_type",view_apdex_level:"view.apdex_level",view_privacy_replay_level:"privacy.replay_level"},fields:{is_active:"view.is_active",session_replay_stats:"_gc.replay_stats",session_is_active:"session.is_active",view_error_count:"view.error.count",view_resource_count:"view.resource.count",view_long_task_count:"view.long_task.count",view_action_count:"view.action.count",first_contentful_paint:"view.first_contentful_paint",largest_contentful_paint:"view.largest_contentful_paint",largest_contentful_paint_element_selector:"view.largest_contentful_paint_element_selector",cumulative_layout_shift:"view.cumulative_layout_shift",first_input_delay:"view.first_input_delay",loading_time:"view.loading_time",dom_interactive:"view.dom_interactive",dom_content_loaded:"view.dom_content_loaded",dom_complete:"view.dom_complete",load_event:"view.load_event",first_input_time:"view.first_input_time",first_paint_time:"view.fpt",interaction_to_next_paint:"view.interaction_to_next_paint",resource_load_time:"view.resource_load_time",time_to_interactive:"view.tti",dom:"view.dom",dom_ready:"view.dom_ready",time_spent:"view.time_spent",first_byte:"view.first_byte",page_states:"_gc.page_states",frustration_count:"view.frustration.count",custom_timings:"view.custom_timings"}},resource:{type:Te.RESOURCE,tags:{trace_id:"_gc.trace_id",span_id:"_gc.span_id",resource_url:"resource.url",resource_url_host:"resource.url_host",resource_url_path:"resource.url_path",resource_url_path_group:"resource.url_path_group",resource_url_query:"resource.url_query",resource_type:"resource.type",resource_status:"resource.status",resource_status_group:"resource.status_group",resource_method:"resource.method"},fields:{duration:"resource.duration",resource_size:"resource.size",resource_encode_size:"resource.encode_size",resource_render_blocking_status:"resource.render_blocking_status",resource_dns:"resource.dns",resource_tcp:"resource.tcp",resource_ssl:"resource.ssl",resource_ttfb:"resource.ttfb",resource_trans:"resource.trans",resource_redirect:"resource.redirect",resource_first_byte:"resource.firstbyte",resource_dns_time:"resource.dns_time",resource_download_time:"resource.download_time",resource_first_byte_time:"resource.first_byte_time",resource_connect_time:"resource.connect_time",resource_ssl_time:"resource.ssl_time",resource_redirect_time:"resource.redirect_time"}},error:{type:Te.ERROR,tags:{error_id:"error.id",trace_id:"_gc.trace_id",span_id:"_gc.span_id",error_source:"error.source",error_type:"error.type",error_handling:"error.handling"},fields:{error_message:["string","error.message"],error_stack:["string","error.stack"],error_causes:["string","error.causes"]}},long_task:{type:Te.LONG_TASK,tags:{long_task_id:"long_task.id"},fields:{duration:"long_task.duration"}},action:{type:Te.ACTION,tags:{action_type:"action.type"},fields:{action_name:"action.target.name",duration:"action.loading_time",action_error_count:"action.error.count",action_resource_count:"action.resource.count",action_frustration_types:"action.frustration.type",action_long_task_count:"action.long_task.count",action_target:"_gc.action.target",action_position:"_gc.action.position"}},telemetry:{type:"telemetry",fields:{status:"telemetry.status",message:["string","telemetry.message"],type:"telemetry.type",error_stack:["string","telemetry.error.stack"],error_kind:["string","telemetry.error.kind"]}},browser_log:{type:Te.LOGGER,tags:{error_source:"error.source",error_type:"error.type",error_resource_url:"http.url",error_resource_url_host:"http.url_host",error_resource_url_path:"http.url_path",error_resource_url_path_group:"http.url_path_group",error_resource_status:"http.status_code",error_resource_status_group:"http.status_group",error_resource_method:"http.method",action_id:"user_action.id",service:"service",status:"status"},fields:{message:["string","message"]}}},rn=4*Z,on=15*J,sn=/^([a-z]+)=([a-z0-9-]+)$/,an="&",un="_dataflux_s",cn=10,fn=100,ln=[];function dn(e,t){if(void 0===t&&(t=0),Zt||(Zt=e),e===Zt)if(t>=fn)gn();else{var n,r=yn();if(pn()){if(r.lock)return void vn(e,t);if(n=V(),r.lock=n,hn(r,e.options),(r=yn()).lock!==n)return void vn(e,t)}var o=e.process(r);if(pn()&&(r=yn()).lock!==n)vn(e,t);else{if(o&&function(e,t){if(mn(e))return void function(e){It(un,"",0,e)}(t);e.expire=String(ie()+on),hn(e,t)}(o,e.options),pn()&&(!o||!mn(o))){if((r=yn()).lock!==n)return void vn(e,t);delete r.lock,hn(r,e.options),o=r}e.after&&e.after(o||r),gn()}}else ln.push(e)}function pn(){return void 0===z&&(z=!!window.chrome||/HeadlessChrome/.test(window.navigator.userAgent)),z}function vn(e,t){d((function(){dn(e,t+1)}),cn)}function gn(){Zt=void 0;var e=ln.shift();e&&dn(e)}function hn(e,t){It(un,function(e){return D(P(e),(function(e){return e[0]+"="+e[1]})).join(an)}(e),on,t)}function yn(){var e=Dt(un),t={};return function(e){return void 0!==e&&(-1!==e.indexOf(an)||sn.test(e))}(e)&&S(e.split(an),(function(e){var n=sn.exec(e);if(null!==n){var r=n[1],o=n[2];t[r]=o}})),t}function mn(e){return U(e)}function bn(e,t,n){var r=new st,o=new st,i=v((function(){dn({options:e,process:function(e){return c(e)?void 0:{}},after:a})}),At),s=function(){var e=yn();if(c(e))return e;return{}}();function a(e){return c(e)||(e={}),u()&&(!function(e){return s.id!==e.id||s[t]!==e[t]}(e)?s=e:(s={},o.notify())),e}function u(){return void 0!==s[t]}function c(e){return(void 0===e.created||ie()-Number(e.created)<rn)&&(void 0===e.expire||ie()<Number(e.expire))}return{expandOrRenewSession:W((function(){var o;dn({options:e,process:function(e){var r=a(e);return o=function(e){var r=n(e[t]),o=r.trackingType,i=r.isTracked;e[t]=o,i&&!e.id&&(e.id=V(),e.created=String(ie()));return i}(r),r},after:function(e){o&&!u()&&function(e){s=e,r.notify()}(e),s=e}})}),At).throttled,expandSession:function(){dn({options:e,process:function(e){return u()?a(e):void 0}})},getSession:function(){return s},renewObservable:r,expireObservable:o,expire:function(){deleteSessionCookie(e),a({})},stop:function(){g(i)}}}var _n=J,En=rn,wn=[],On=function(e,t,n){var r=bn(e,t,n);wn.push((function(){return r.stop()}));var o,i,s=new Ee(En);function a(){return{id:r.getSession().id,trackingType:r.getSession()[t]}}return wn.push((function(){return s.stop()})),r.renewObservable.subscribe((function(){s.add(a(),ne())})),r.expireObservable.subscribe((function(){s.closeActive(ne())})),r.expandOrRenewSession(),s.add(a(),[0,se()][0]),o=function(){return r.expandOrRenewSession()},i=lt(window,[Ce.CLICK,Ce.TOUCH_START,Ce.KEY_DOWN,Ce.SCROLL],o,{capture:!0,passive:!0}),wn.push(i.stop),function(e){var t=function(){"visible"===document.visibilityState&&e()},n=ft(document,Ce.VISIBILITY_CHANGE,t);wn.push(n.stop);var r=v(t,_n);wn.push((function(){g(r)}))}((function(){return r.expandSession()})),{findActiveSession:function(e){return s.find(e)},renewObservable:r.renewObservable,expireObservable:r.expireObservable,expire:r.expire}};var Sn=80*tt,xn=32,Cn=3*nt,Tn=256*Y,Ln=Y,Rn={UP:0,FAILURE_DETECTED:1,DOWN:2},kn={AFTER_SUCCESS:0,AFTER_RESUME:1};function An(e,t,n,r,o){t.transportStatus===Rn.UP&&0===t.queuedPayloads.size()&&t.bandwidthMonitor.canHandle(e)?Dn(e,t,n,{onSuccess:function(){return Mn(kn.AFTER_SUCCESS,t,n,r,o)},onFailure:function(){t.queuedPayloads.enqueue(e),In(t,n,r,o)}}):t.queuedPayloads.enqueue(e)}function In(e,t,n,r){e.transportStatus===Rn.DOWN&&d((function(){Dn(e.queuedPayloads.first(),e,t,{onSuccess:function(){e.queuedPayloads.dequeue(),e.currentBackoffTime=Ln,Mn(kn.AFTER_RESUME,e,t,n,r)},onFailure:function(){e.currentBackoffTime=Math.min(Tn,2*e.currentBackoffTime),In(e,t,n,r)}})}),e.currentBackoffTime)}function Dn(e,t,n,r){var o=r.onSuccess,i=r.onFailure;t.bandwidthMonitor.add(e),n(e,(function(n){t.bandwidthMonitor.remove(e),!function(e){return"opaque"!==e.type&&(0===e.status&&!navigator.onLine||408===e.status||429===e.status||e.status>=500)}(n)?(t.transportStatus=Rn.UP,o()):(t.transportStatus=t.bandwidthMonitor.ongoingRequestCount>0?Rn.FAILURE_DETECTED:Rn.DOWN,t.lastFailureStatus=n.status,i())}))}function Mn(e,t,n,r,o){e===kn.AFTER_SUCCESS&&t.queuedPayloads.isFull()&&!t.queueFullReported&&(o({message:"Reached max "+r+" events size queued for upload: "+Cn/nt+"MiB",source:Ye.AGENT,startClocks:re()}),t.queueFullReported=!0);var i=t.queuedPayloads;for(t.queuedPayloads=$n();i.size()>0;)An(i.dequeue(),t,n,r,o)}function $n(){var e=[];return{bytesCount:0,enqueue:function(t){this.isFull()||(e.push(t),this.bytesCount+=t.bytesCount)},first:function(){return e[0]},dequeue:function(){var t=e.shift();return t&&(this.bytesCount-=t.bytesCount),t},size:function(){return e.length},isFull:function(){return this.bytesCount>=Cn}}}function Un(e){return e?e+(-1===e.indexOf("?")?"?":"&")+"precision=ms":e}function Pn(e,t,n){var r={transportStatus:Rn.UP,lastFailureStatus:0,currentBackoffTime:Ln,bandwidthMonitor:{ongoingRequestCount:0,ongoingByteCount:0,canHandle:function(e){return 0===this.ongoingRequestCount||this.ongoingByteCount+e.bytesCount<=Sn&&this.ongoingRequestCount<xn},add:function(e){this.ongoingRequestCount+=1,this.ongoingByteCount+=e.bytesCount},remove:function(e){this.ongoingRequestCount-=1,this.ongoingByteCount-=e.bytesCount}},queuedPayloads:$n(),queueFullReported:!1},o=function(n,r){return function(e,t,n,r){var o=n.data,i=n.bytesCount,a=Un(e),u=function(){try{return window.Request&&"keepalive"in new Request("http://a")}catch(e){return!1}}()&&i<t;u?fetch(a,{method:"POST",body:o,keepalive:!0,mode:"cors"}).then(s((function(e){"function"==typeof r&&r({status:e.status,type:e.type})})),s((function(){Nn(a,o,r)}))):Nn(a,o,r)}(e,t,n,r)};return{send:function(t){An(t,r,o,e,n)},sendOnExit:function(n){!function(e,t,n){var r=n.data,o=n.bytesCount,i=Un(e),s=!!navigator.sendBeacon&&o<t;if(s)try{if(navigator.sendBeacon(i,r))return}catch(e){}Nn(i,r)}(e,t,n)}}}function Nn(e,t,n){var r=new XMLHttpRequest;r.open("POST",e,!0),ft(r,"loadend",(function(){"function"==typeof n&&n({status:r.status})}),{once:!0}),r.send(t)}function Bn(e){return Bn="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},Bn(e)}function Gn(e){if("object"===Bn(e)&&e)e=Me(e);else if(!N(e))return e;return String(e).replace(/[\s=,"]/g,(function(e){return"\\"+e}))}function Wn(e){return'"'+e.replace(/\\/g,"\\\\").replace(/"/g,'\\"')+'"'}function Fn(e){return"object"===Bn(e)&&e?Wn(Me(e)):N(e)?Wn(e):e}var Vn="custom_keys",jn=function(e){if(!e||!e.type)return{rowStr:"",rowData:void 0};var t={tags:{},fields:{}},n=!1,r="";return S(nn,(function(o,i){if(o.type===e.type){r+=i+",",t.measurement=i;var s=[],a=C({},en,o.tags),u=["date","type",Vn];S(a,(function(n,r){var o=ae(e,n);u.push(r),(o||G(o))&&(t.tags[r]=function(e){return N(e)?e:Me(e)}(o),s.push(Gn(r)+"="+Gn(o)))}));var c=[],f=C({},tn,o.fields);if(S(f,(function(n,r){if(L(n)&&2===n.length){var o=n[1],i=ae(e,o);u.push(r),null!=i&&(t.fields[r]=i,c.push(Gn(r)+"="+Fn(i)))}else if(N(n)){i=ae(e,n);u.push(r),null!=i&&(t.fields[r]=i,c.push(Gn(r)+"="+Fn(i)))}})),e.context&&$(e.context)&&!U(e.context)){var l=[];S(e.context,(function(e,n){u.indexOf(n)>-1||(u.push(n),null!=e&&(l.push(n),t.fields[n]=e,c.push(Gn(n)+"="+Fn(e))))})),l.length&&(t.fields[Vn]=Fn(l),c.push(Gn(Vn)+"="+Fn(l)))}e.type===Te.LOGGER&&S(e,(function(e,n){-1===u.indexOf(n)&&null!=e&&(t.fields[n]=e,c.push(Gn(n)+"="+Fn(e)))})),s.length&&(r+=s.join(",")),c.length&&(r+=" ",r+=c.join(","),n=!0),r=r+" "+e.date,t.time=(d=e.date,G(d)?te(1e6*d,0):d)}var d})),{rowStr:n?r:"",rowData:n?t:void 0}},qn=function(e,t,n){this.pushOnlyBuffer=[],this.upsertBuffer={},this.request=e,this.flushController=t,this.messageBytesLimit=n;var r=this;this.flushController.flushObservable.subscribe((function(e){r.flush(e)}))};qn.prototype.add=function(e){this.addOrUpdate(e)},qn.prototype.upsert=function(e,t){this.addOrUpdate(e,t)},qn.prototype.flush=function(e){var t,n=this.pushOnlyBuffer.concat(k(this.upsertBuffer));if(this.pushOnlyBuffer=[],this.upsertBuffer={},n.length>0){var r={data:n.join("\n"),bytesCount:e.bytesCount,flushReason:e.reason};t=e.reason,ce(k(Jt),t)?this.request.sendOnExit(r):this.request.send(r)}},qn.prototype.addOrUpdate=function(e,t){var r=this.process(e),o=r.processedMessage,i=r.messageBytesCount;i>=this.messageBytesLimit?n.warn("Discarded a message whose size was bigger than the maximum allowed size "+this.messageBytesLimit+"KB."):(this.hasMessageFor(t)&&this.remove(t),this.push(o,i,t))},qn.prototype.process=function(e){var t=jn(e).rowStr;return{processedMessage:t,messageBytesCount:ot(t)}},qn.prototype.push=function(e,t,n){var r=this.flushController.getMessagesCount()>0?1:0;this.flushController.notifyBeforeAddMessage(t+r),void 0!==n?this.upsertBuffer[n]=e:this.pushOnlyBuffer.push(e),this.flushController.notifyAfterAddMessage()},qn.prototype.remove=function(e){var t=this.upsertBuffer[e];delete this.upsertBuffer[e];var n=ot(t),r=this.flushController.getMessagesCount()>1?1:0;this.flushController.notifyAfterRemoveMessage(n+r)},qn.prototype.hasMessageFor=function(e){return void 0!==e&&void 0!==this.upsertBuffer[e]};var Hn=qn;function Qn(e){var t=e.messagesLimit,n=e.bytesLimit,r=e.durationLimit,o=e.pageExitObservable,i=e.sessionExpireObservable,s=new st;o.subscribe((function(e){return f(e.reason)})),i.subscribe((function(){return f("session_expire")}));var a,u=0,c=0;function f(e){if(0!==c){var t=c,n=u;c=0,u=0,l(),s.notify({reason:e,messagesCount:t,bytesCount:n})}}function l(){p(a),a=void 0}return{flushObservable:s,getMessagesCount:function(){return c},notifyBeforeAddMessage:function(e){u+e>=n&&f("bytes_limit"),c+=1,u+=e,void 0===a&&(a=d((function(){f("duration_limit")}),r))},notifyAfterAddMessage:function(){c>=t?f("messages_limit"):u>=n&&f("bytes_limit")},notifyAfterRemoveMessage:function(e){u-=e,0===(c-=1)&&l()}}}function Kn(e,t,n,r,o){var i=function(t){return new Hn(Pn(t,e.batchBytesLimit,n),Qn({messagesLimit:e.batchMessagesLimit,bytesLimit:e.batchBytesLimit,durationLimit:e.flushTimeout,pageExitObservable:r,sessionExpireObservable:o}),e.messageBytesLimit)}(t);return{add:function(e){i.add(e)}}}function Xn(){var e=l().FTWebViewJavascriptBridge;if(e)return{send:function(t,n){e.sendEvent(JSON.stringify({name:t,data:n}))}}}function zn(){return!!Xn()}var Yn=3*tt,Jn={FeatureFlag:"feature flag evaluation",User:"user",GlobalContext:"global context",LoggerContext:"logger context"};var Zn=200;function er(e,t){void 0===t&&(t=ot);var r,o={},i=!1,s=new st,a=W((function(o){r=t(Me(o)),i||(i=function(e,t){return e>Yn&&(n.warn("The "+t+"data is over "+Yn/tt+" KiB. On low connectivity, the SDK has the potential to exhaust the user's upload bandwidth."),!0)}(r,e))}),Zn).throttled,u={getBytesCount:function(){return r},get:function(){return o},add:function(e,t){o[e]=t,a(o),s.notify()},remove:function(e){delete o[e],a(o),s.notify()},set:function(e){a(o=e),s.notify()},getContext:function(){return Q(o)},setContext:function(e){"object"===q(e)?(o=bt(e),a(o)):u.clearContext(),s.notify()},setContextProperty:function(e,t){o[e]=Q(t),a(o),s.notify()},removeContextProperty:function(e){delete o[e],a(o),s.notify()},clearContext:function(){o={},r=0,s.notify()},changeObservable:s};return u}var tr="_gc_s",nr=[];function rr(e,t,n){void 0===n&&(n=ot);var r=function(e,t){return tr+"_"+e+"_"+t}(e,t),o=er(t,n);function i(){var e=localStorage.getItem(r),t=null!==e?JSON.parse(e):{};o.setContext(t)}return i(),nr.push(ft(window,Ce.STORAGE,(function(e){r===e.key&&i()}))),o.changeObservable.subscribe((function(){localStorage.setItem(r,JSON.stringify(o.getContext()))})),o}var or,ir={log:"log",configuration:"configuration"},sr={debug:"debug",error:"error"},ar=["https://static.guance.com","http://localhost","<anonymous>"],ur={LOGS:"browser-logs-sdk",RUM:"browser-rum-sdk"},cr={maxEventsPerPage:0,sentEventCount:0,telemetryEnabled:!1};function fr(t,n){var r,o=new st;return cr.telemetryEnabled=n.telemetryEnabled&&ee(n.telemetrySampleRate),or=function(e){if(cr.telemetryEnabled){var n=function(e,t){return T({type:"telemetry",date:oe(),service:e,version:"3.1.2",source:"browser",telemetry:t},void 0!==r?r():{})}(t,e);o.notify(n)}},e=lr,x(cr,{maxEventsPerPage:n.maxTelemetryEventsPerPage,sentEventCount:0}),{setContextProvider:function(e){r=e},observable:o,enabled:cr.telemetryEnabled}}function lr(e,t){dr(x({type:ir.log,status:sr.error},function(e){if(e instanceof Error){var t=Ne(e);return{error:{kind:t.name,stack:Ze(pr(t))},message:t.message}}return{error:{stack:ze},message:ke.UNCAUGHT+" "+Me(e)}}(e),t))}function dr(e){or&&cr.sentEventCount<cr.maxEventsPerPage&&(cr.sentEventCount+=1,or(e))}function pr(e){return e.stack=e.stack.filter((function(e){return!e.url||ar.some((function(t){return ve(e.url,t)}))})),e}var vr={sdkVersion:"3.1.2",sdkName:"df_web_logs_sdk"},gr=32*tt;function hr(e,t,r){return void 0===e?[]:"all"===e||L(e)&&M(e,(function(e){return ce(t,e)}))?"all"===e?t:F(e):void n.error(r+' should be "all" or an array with allowed values "'+t.join('", "')+'"')}var yr={debug:"debug",error:"error",info:"info",warn:"warn",critical:"critical"},mr={console:"console",http:"http",silent:"silent"},br=A(yr);function _r(e,t,n,r,o){this.contextManager=er(Jn.LoggerContext),void 0===n&&(n=mr.http),void 0===r&&(r=yr.debug),void 0===o&&(o={}),this.handleLogStrategy=e,this.handlerType=n,this.level=r,this.contextManager.set(x({},o,t?{logger:{name:t}}:void 0))}_r.prototype={log:s((function(e,t,n,r){var o;if(void 0===n&&(n=yr.info),n===yr.error&&(o={origin:Ye.LOGGER}),null!=r){var i=Je({stackTrace:r instanceof Error?Ne(r):void 0,originalError:r,nonErrorPrefix:ke.PROVIDED,source:Ye.LOGGER,handling:Re.HANDLED,startClocks:re()});o={origin:Ye.LOGGER,stack:i.stack,kind:i.type,message:i.message}}var s=bt(t),a=o?T({error:o},s):s;this.handleLogStrategy({message:e,context:a,status:n},this)})),debug:function(e,t,n){this.log(e,t,yr.debug,n)},info:function(e,t,n){this.log(e,t,yr.info,n)},warn:function(e,t,n){this.log(e,t,yr.warn,n)},critical:function(e,t,n){this.log(e,t,yr.critical,n)},error:function(e,t,n){var r={error:{origin:Ye.LOGGER}};this.log(e,T(r,t),yr.error,n)},setContext:function(e){this.contextManager.set(e)},getContext:function(){return this.contextManager.get()},addContext:function(e,t){this.contextManager.add(e,t)},removeContext:function(e){this.contextManager.remove(e)},setHandler:function(e){this.handlerType=e},getHandler:function(){return this.handlerType},setLevel:function(e){this.level=e},getLevel:function(){return this.level}};var Er="logs";var wr="logs",Or={NOT_TRACKED:"0",TRACKED:"1"};function Sr(e){var t=On(e.cookieOptions,wr,(function(t){return function(e,t){var n=function(e){return e===Or.NOT_TRACKED||e===Or.TRACKED}(t)?t:xr(e);return{trackingType:n,isTracked:n===Or.TRACKED}}(e,t)}));return{findTrackedSession:function(e){var n=t.findActiveSession(e);return n&&n.trackingType===Or.TRACKED?{id:n.id}:void 0},expireObservable:t.expireObservable}}function xr(e){return ee(e.sessionSampleRate)?Or.TRACKED:Or.NOT_TRACKED}var Cr={[yr.debug]:0,[yr.info]:1,[yr.warn]:2,[yr.error]:3};function Tr(e,t,n){var r=n.getHandler(),o=L(r)?r:[r];return Cr[e]>=Cr[n.getLevel()]&&ce(o,t)}function Lr(e,t,n,r,o,i){var s=br.concat(["custom"]),a={};S(s,(function(e){var n,r,o,s,u;a[e]=(n=e,r=t.eventRateLimiterThreshold,o=i,s=0,u=!1,{isLimitReached:function(){if(0===s&&d((function(){s=0}),J),(s+=1)<=r||u)return u=!1,!1;if(s===r+1){u=!0;try{o({message:"Reached max number of "+n+"s by minute: "+r,source:Ye.AGENT,startClocks:re()})}finally{u=!1}}return!0}})})),n.subscribe(St.RAW_LOG_COLLECTED,(function(i){var s=i.rawLogsEvent,u=i.messageContext||void 0,c=i.savedCommonContext||void 0,f=i.logger||o,l=s.date-se(),d=e.findTrackedSession(l);if(d){var p=c||r(),v=T({service:t.service||"browser",env:t.env||"",version:t.version||"",_dd:{sdkName:t.sdkName,sdkVersion:t.sdkVersion},session:{id:d.id},view:p.view,user:U(p.user)?void 0:p.user,device:xe,type:Te.LOGGER},p.context,Rr(l),s,f.getContext(),u);!Tr(s.status,mr.http,f)||t.beforeSend&&!1===t.beforeSend(v)||v.error&&v.error.origin!==Ye.AGENT&&pe(a[v.status],a.custom).isLimitReached()||n.notify(St.LOG_COLLECTED,le(v))}}))}function Rr(e){return function(t){if(t&&t.getInternalContext)return t.getInternalContext(e)}(window.DATAFLUX_RUM)}var kr={[t.log]:yr.info,[t.debug]:yr.debug,[t.info]:yr.info,[t.warn]:yr.warn,[t.error]:yr.error};var Ar={[dt.cspViolation]:yr.error,[dt.intervention]:yr.error,[dt.deprecation]:yr.warn};function Ir(e,t){if(!e.forwardErrorsToLogs)return{stop:K};var n=Qt().subscribe((function(e){"complete"===e.state&&o(Le.XHR,e)})),r=Ft().subscribe((function(e){"resolve"===e.state&&o(Le.FETCH,e)}));function o(n,r){function o(e){var o,i,s,a=j(r.url).getParse();t.notify(St.RAW_LOG_COLLECTED,{rawLogsEvent:{message:Mr(n)+" error "+r.method+" "+r.url,date:r.startClocks.timeStamp,error:{origin:Ye.NETWORK,stack:e||"Failed to load"},http:{method:r.method,status_code:r.status,url:r.url,statusGroup:(s=r.status,s?String(s).substr(0,1)+String(s).substr(1).replace(/\d*/g,"x"):s),urlHost:a.Host,urlPath:a.Path,urlPathGroup:(o=a.Path,i="",o&&(i=o.replace(/\/([^\/]*)\d([^\/]*)/g,"/?").replace(/\/$/g,"")),i||"/")},status:yr.error,origin:Ye.NETWORK}})}!e.isIntakeUrl(r.url)&&(function(e){return 0===e.status&&"opaque"!==e.responseType}(r)||function(e){return e.status>=500}(r)||e.isServerError(r))&&("xhr"in r?function(e,t,n){"string"==typeof e.response?n(Dr(e.response,t)):n(e.response)}(r.xhr,e,o):r.response?function(e,t,n){var r=function(e){try{return e.clone()}catch(e){return}}(e);r&&r.body?window.TextDecoder?function(e,t,n){!function(e,t,n){var r=e.getReader(),o=[],i=0;function a(){var e,s;if(r.cancel().catch(K),n.collectStreamBody){var a;if(1===o.length)a=o[0];else{a=new Uint8Array(i);var u=0;S(o,(function(e){a.set(e,u),u+=e.length}))}e=a.slice(0,n.bytesLimit),s=a.length>n.bytesLimit}t(void 0,e,s)}!function e(){r.read().then(s((function(t){t.done?a():(n.collectStreamBody&&o.push(t.value),(i+=t.value.length)>n.bytesLimit?a():e())})),s((function(e){t(e)})))}()}(e,(function(e,t,r){if(e)n(e);else{var o=(new TextDecoder).decode(t);r&&(o+="..."),n(void 0,o)}}),{bytesLimit:t,collectStreamBody:!0})}(r.body,t.requestErrorResponseLengthLimit,(function(e,t){n(e?"Unable to retrieve response: "+e:t)})):r.text().then(s((function(e){return n(Dr(e,t))})),s((function(e){return n("Unable to retrieve response: "+e)}))):n()}(r.response,e,o):r.error&&function(e,t,n){n(Dr(Ze(Ne(e)),t))}(r.error,e,o))}return{stop:function(){n.unsubscribe(),r.unsubscribe()}}}function Dr(e,t){return e.length>t.requestErrorResponseLengthLimit?e.substring(0,t.requestErrorResponseLengthLimit)+"...":e}function Mr(e){return Le.XHR===e?"XHR":"Fetch"}function $r(e,t){if(!e.forwardErrorsToLogs)return{stop:K};var n,r=new st,o=(n=r,Xe((function(e,t){n.notify(Je({stackTrace:e,originalError:t,startClocks:re(),nonErrorPrefix:ke.UNCAUGHT,source:Ye.SOURCE,handling:Re.UNHANDLED}))}))),i=r.subscribe((function(e){t.notify(St.RAW_LOG_COLLECTED,{rawLogsEvent:{message:e.message,date:e.startClocks.timeStamp,error:{kind:e.type,origin:Ye.SOURCE,stack:e.stack},origin:Ye.SOURCE,status:yr.error}})}));return{stop:function(){o.stop(),i.unsubscribe()}}}const Ur=function(e){var r,o,a=!1,u=er(Jn.GlobalContext),c=er(Jn.User),f={},l=function(){},d=new he,p=function(e,t,n,r){void 0===n&&(n=Q(h())),void 0===r&&(r=oe()),d.add((function(){return p(e,t,n,r)}))},v=function(){},g=new _r((function(){return p.apply(this,arguments)}));function h(){return{view:{referrer:document.referrer,url:window.location.href},context:u.getContext(),user:c.getContext()}}return r={logger:g,init:s((function(r){if(function(e){return a?(e.silentMultipleInit||n.error("DD_LOGS is already initialized."),!1):!(!e.datakitUrl&&!e.datakitOrigin)||(n.error("datakitOrigin is not configured, no RUM data will be collected."),!1)}(r)){var o=function(e){var n=Gt(e),r=hr(e.forwardConsoleLogs,k(t),"Forward Console Logs"),o=hr(e.forwardReports,k(dt),"Forward Reports");if(n&&r&&o)return e.forwardErrorsToLogs&&!ce(r,t.error)&&r.push(t.error),x({forwardErrorsToLogs:!1!==e.forwardErrorsToLogs,forwardConsoleLogs:r,forwardReports:o,requestErrorResponseLengthLimit:gr},n,vr)}(r);if(o){if(r.storeContextsToLocal){var i=u.getContext();(u=rr(Er,Jn.GlobalContext)).setContext(T(u.getContext(),i));var s=c.getContext();(c=rr(Er,Jn.User)).setContext(T(c.getContext(),s))}var f=e(o,h,g);p=f.handleLog,l=f.getInternalContext,v=function(){return Q(r)},d.drain(),a=!0}}})),getGlobalContext:s((function(){return u.getContext()})),setGlobalContext:s((function(e){return u.setContext(e)})),setGlobalContextProperty:s((function(e,t){return u.setContextProperty(e,t)})),removeGlobalContextProperty:s((function(e){return u.removeContextProperty(e)})),clearGlobalContext:s((function(){return u.clearContext()})),createLogger:s((function(e,t){return void 0===t&&(t={}),f[e]=new _r((function(){return p(this.arguments)}),e,t.handler,t.level,t.context),f[e]})),getLogger:s((function(e){return f[e]})),getInitConfiguration:s((function(){return v()})),getInternalContext:s((function(e){return l(e)})),setUser:s((function(e){(function(e){var t="object"===q(e);return t||n.error("Unsupported user:",e),t})(e)&&c.setContext(function(e){var t=x({},e);return S(["id","name","email"],(function(e){e in t&&(t[e]=String(t[e]))})),t}(e))})),getUser:s((function(){return c.getContext()})),removeUserProperty:s((function(e){return c.removeContextProperty(e)})),clearUser:s((function(){return c.clearContext()}))},o=x({onReady:function(e){e()}},r),Object.defineProperty(o,"_setDebug",{get:function(){return i},enumerable:!1}),o}((function(e,r,o){var i,s=new xt,a=function(e){s.notify(St.RAW_LOG_COLLECTED,{rawLogsEvent:{message:e.message,date:e.startClocks.timeStamp,error:{origin:Ye.AGENT},origin:Ye.AGENT,status:yr.error}})},u=i=new st((function(){var e=lt(document,[Ce.VISIBILITY_CHANGE,Ce.FREEZE,Ce.PAGE_HIDE],(function(e){e.type===Ce.VISIBILITY_CHANGE&&"hidden"===document.visibilityState?i.notify({reason:Jt.HIDDEN}):e.type===Ce.FREEZE&&i.notify({reason:Jt.FROZEN})}),{capture:!0}),t=ft(window,Ce.BEFORE_UNLOAD,(function(){i.notify({reason:Jt.UNLOADING})}));return function(){e.stop(),t.stop()}})),c=function(e){if(void 0===document.cookie||null===document.cookie)return!1;try{var t="dd_cookie_test_".concat(V()),n="test";return It(t,n,Y,e),Dt(t)===n}catch(e){return!1}}(e.cookieOptions)?Sr(e):function(e){var t=xr(e)===Or.TRACKED?{}:void 0;return{findTrackedSession:function(){return t},expireObservable:new st}}(e);(function(e,t,n,r){const o=fr(ur.LOGS,e);if(!zn()){var i=Kn(e,e.rumEndpoint,t,n,r);o.observable.subscribe((function(e){i.add(e)}))}return o})(e,a,u,c.expireObservable).setContextProvider((function(){var e=Rr();return{application:{id:e&&e.application&&e.application.id},session:{id:c.findTrackedSession()&&c.findTrackedSession().id},view:{id:e&&e.view&&e.view.id},action:{id:e&&e.userAction&&e.userAction.id}}})),Ir(e,s),$r(e,s),function(e,n){var r=ct(e.forwardConsoleLogs).subscribe((function(e){n.notify(St.RAW_LOG_COLLECTED,{rawLogsEvent:{date:oe(),message:e.message,origin:Ye.CONSOLE,error:e.api===t.error?{origin:Ye.CONSOLE,stack:e.stack}:void 0,status:kr[e.api]}})}))}(e,s),function(e,t){var n=pt(0,e.forwardReports).subscribe((function(e){var n,r,o,i=e.message,s=Ar[e.type];s===yr.error?n={kind:e.subtype,origin:Ye.REPORT,stack:e.stack}:e.stack&&(i+=" Found in "+(r=e.stack,(o=/@ (.+)/.exec(r))&&o[1])),t.notify(St.RAW_LOG_COLLECTED,{rawLogsEvent:{date:oe(),message:i,origin:Ye.REPORT,error:n,status:s}})}))}(e,s);var f=function(e){return{handleLog:function(t,r,o,i){var s=t.context;Tr(t.status,mr.console,r)&&n(t.status,t.message,T(r.getContext(),s)),e.notify(St.RAW_LOG_COLLECTED,{rawLogsEvent:{date:i||oe(),message:t.message,status:t.status,origin:Ye.LOGGER},messageContext:s,savedCommonContext:o,logger:r})}}}(s);Lr(c,e,s,r,o,a),zn()||function(e,t,n,r,o){var i=Kn(e,e.logsEndpoint,n,r,o);t.subscribe(St.LOG_COLLECTED,(function(e){i.add(e)}))}(e,s,a,u,c.expireObservable);var l,d=(l=c,{get:function(e){var t=l.findTrackedSession(e);if(t)return{session:{id:t.id}}}});return{handleLog:f.handleLog,getInternalContext:d.get}}));var Pr,Nr,Br,Gr;Pr=l(),Br=Ur,Gr=Pr[Nr="DATAFLUX_LOGS"],Pr[Nr]=Br,Gr&&Gr.q&&S(Gr.q,(function(e){c(e,"onReady callback threw an error:")()}))}();
|
package/cjs/boot/buildEnv.js
CHANGED
|
@@ -7,6 +7,7 @@ exports.makeLogsPublicApi = makeLogsPublicApi;
|
|
|
7
7
|
var _browserCore = require("@cloudcare/browser-core");
|
|
8
8
|
var _configuration = require("../domain/configuration");
|
|
9
9
|
var _logger = require("../domain/logger");
|
|
10
|
+
var LOGS_STORAGE_KEY = 'logs';
|
|
10
11
|
function makeLogsPublicApi(startLogsImpl) {
|
|
11
12
|
var isAlreadyInitialized = false;
|
|
12
13
|
var globalContextManager = (0, _browserCore.createContextManager)(_browserCore.CustomerDataType.GlobalContext);
|
|
@@ -53,6 +54,14 @@ function makeLogsPublicApi(startLogsImpl) {
|
|
|
53
54
|
if (!configuration) {
|
|
54
55
|
return;
|
|
55
56
|
}
|
|
57
|
+
if (initConfiguration.storeContextsToLocal) {
|
|
58
|
+
var beforeInitGlobalContext = globalContextManager.getContext();
|
|
59
|
+
globalContextManager = (0, _browserCore.createStoredContextManager)(LOGS_STORAGE_KEY, _browserCore.CustomerDataType.GlobalContext);
|
|
60
|
+
globalContextManager.setContext((0, _browserCore.extend2Lev)(globalContextManager.getContext(), beforeInitGlobalContext));
|
|
61
|
+
var beforeInitUserContext = userContextManager.getContext();
|
|
62
|
+
userContextManager = (0, _browserCore.createStoredContextManager)(LOGS_STORAGE_KEY, _browserCore.CustomerDataType.User);
|
|
63
|
+
userContextManager.setContext((0, _browserCore.extend2Lev)(userContextManager.getContext(), beforeInitUserContext));
|
|
64
|
+
}
|
|
56
65
|
var _startLogsImpl = startLogsImpl(configuration, buildCommonContext, mainLogger);
|
|
57
66
|
_handleLogStrategy = _startLogsImpl.handleLog;
|
|
58
67
|
getInternalContextStrategy = _startLogsImpl.getInternalContext;
|
|
@@ -62,15 +71,22 @@ function makeLogsPublicApi(startLogsImpl) {
|
|
|
62
71
|
beforeInitLoggerLog.drain();
|
|
63
72
|
isAlreadyInitialized = true;
|
|
64
73
|
}),
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
setGlobalContext: (0, _browserCore.monitor)(
|
|
69
|
-
|
|
70
|
-
|
|
74
|
+
getGlobalContext: (0, _browserCore.monitor)(function () {
|
|
75
|
+
return globalContextManager.getContext();
|
|
76
|
+
}),
|
|
77
|
+
setGlobalContext: (0, _browserCore.monitor)(function (context) {
|
|
78
|
+
return globalContextManager.setContext(context);
|
|
79
|
+
}),
|
|
80
|
+
setGlobalContextProperty: (0, _browserCore.monitor)(function (key, value) {
|
|
81
|
+
return globalContextManager.setContextProperty(key, value);
|
|
82
|
+
}),
|
|
71
83
|
/** @deprecated: use removeGlobalContextProperty instead */
|
|
72
|
-
removeGlobalContextProperty: (0, _browserCore.monitor)(
|
|
73
|
-
|
|
84
|
+
removeGlobalContextProperty: (0, _browserCore.monitor)(function (key) {
|
|
85
|
+
return globalContextManager.removeContextProperty(key);
|
|
86
|
+
}),
|
|
87
|
+
clearGlobalContext: (0, _browserCore.monitor)(function () {
|
|
88
|
+
return globalContextManager.clearContext();
|
|
89
|
+
}),
|
|
74
90
|
createLogger: (0, _browserCore.monitor)(function (name, conf) {
|
|
75
91
|
if (typeof conf == 'undefined') {
|
|
76
92
|
conf = {};
|
|
@@ -94,9 +110,15 @@ function makeLogsPublicApi(startLogsImpl) {
|
|
|
94
110
|
userContextManager.setContext((0, _browserCore.sanitizeUser)(newUser));
|
|
95
111
|
}
|
|
96
112
|
}),
|
|
97
|
-
getUser: (0, _browserCore.monitor)(
|
|
98
|
-
|
|
99
|
-
|
|
113
|
+
getUser: (0, _browserCore.monitor)(function () {
|
|
114
|
+
return userContextManager.getContext();
|
|
115
|
+
}),
|
|
116
|
+
removeUserProperty: (0, _browserCore.monitor)(function (key) {
|
|
117
|
+
return userContextManager.removeContextProperty(key);
|
|
118
|
+
}),
|
|
119
|
+
clearUser: (0, _browserCore.monitor)(function () {
|
|
120
|
+
return userContextManager.clearContext();
|
|
121
|
+
})
|
|
100
122
|
});
|
|
101
123
|
function canInitLogs(initConfiguration) {
|
|
102
124
|
if (isAlreadyInitialized) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"logsPublicApi.js","names":["_browserCore","require","_configuration","_logger","makeLogsPublicApi","startLogsImpl","isAlreadyInitialized","globalContextManager","createContextManager","CustomerDataType","GlobalContext","userContextManager","User","customLoggers","getInternalContextStrategy","undefined","beforeInitLoggerLog","BoundedBuffer","handleLogStrategy","logsMessage","logger","savedCommonContext","date","deepClone","buildCommonContext","timeStampNow","add","getInitConfigurationStrategy","mainLogger","Logger","apply","arguments","view","referrer","document","url","window","location","href","context","getContext","user","makePublicApi","init","monitor","initConfiguration","canInitLogs","configuration","validateAndBuildLogsConfiguration","_startLogsImpl","handleLog","getInternalContext","drain","getGlobalContext","setGlobalContext","setContext","setGlobalContextProperty","setContextProperty","removeGlobalContextProperty","removeContextProperty","clearGlobalContext","clearContext","createLogger","name","conf","handler","level","getLogger","getInitConfiguration","startTime","setUser","newUser","checkUser","sanitizeUser","getUser","removeUserProperty","clearUser","silentMultipleInit","display","error","datakitUrl","datakitOrigin"],"sources":["../../src/boot/logsPublicApi.js"],"sourcesContent":["import {\n BoundedBuffer,\n createContextManager,\n makePublicApi,\n CustomerDataType,\n display,\n deepClone,\n timeStampNow,\n checkUser,\n sanitizeUser,\n monitor\n} from '@cloudcare/browser-core'\nimport { validateAndBuildLogsConfiguration } from '../domain/configuration'\nimport { Logger } from '../domain/logger'\n\nexport function makeLogsPublicApi(startLogsImpl) {\n var isAlreadyInitialized = false\n\n var globalContextManager = createContextManager(\n CustomerDataType.GlobalContext\n )\n var userContextManager = createContextManager(CustomerDataType.User)\n var customLoggers = {}\n var getInternalContextStrategy = function () {\n return undefined\n }\n\n var beforeInitLoggerLog = new BoundedBuffer()\n\n var handleLogStrategy = function (\n logsMessage,\n logger,\n savedCommonContext,\n date\n ) {\n if (typeof savedCommonContext === 'undefined') {\n savedCommonContext = deepClone(buildCommonContext())\n }\n if (typeof date === 'undefined') {\n date = timeStampNow()\n }\n beforeInitLoggerLog.add(function () {\n return handleLogStrategy(logsMessage, logger, savedCommonContext, date)\n })\n }\n\n var getInitConfigurationStrategy = function () {\n return undefined\n }\n\n var mainLogger = new Logger(function () {\n return handleLogStrategy.apply(this, arguments)\n })\n\n function buildCommonContext() {\n return {\n view: {\n referrer: document.referrer,\n url: window.location.href\n },\n context: globalContextManager.getContext(),\n user: userContextManager.getContext()\n }\n }\n\n return makePublicApi({\n logger: mainLogger,\n\n init: monitor(function (initConfiguration) {\n if (!canInitLogs(initConfiguration)) {\n return\n }\n\n var configuration = validateAndBuildLogsConfiguration(initConfiguration)\n if (!configuration) {\n return\n }\n var _startLogsImpl = startLogsImpl(\n configuration,\n buildCommonContext,\n mainLogger\n )\n handleLogStrategy = _startLogsImpl.handleLog\n getInternalContextStrategy = _startLogsImpl.getInternalContext\n getInitConfigurationStrategy = function () {\n return deepClone(initConfiguration)\n }\n beforeInitLoggerLog.drain()\n\n isAlreadyInitialized = true\n }),\n\n /** @deprecated: use getGlobalContext instead */\n getGlobalContext: monitor(globalContextManager.getContext),\n\n /** @deprecated: use setGlobalContext instead */\n setGlobalContext: monitor(globalContextManager.setContext),\n\n /** @deprecated: use setGlobalContextProperty instead */\n setGlobalContextProperty: monitor(globalContextManager.setContextProperty),\n\n /** @deprecated: use removeGlobalContextProperty instead */\n removeGlobalContextProperty: monitor(\n globalContextManager.removeContextProperty\n ),\n\n clearGlobalContext: monitor(globalContextManager.clearContext),\n\n createLogger: monitor(function (name, conf) {\n if (typeof conf == 'undefined') {\n conf = {}\n }\n customLoggers[name] = new Logger(\n function () {\n return handleLogStrategy(this.arguments)\n },\n name,\n conf.handler,\n conf.level,\n conf.context\n )\n return customLoggers[name]\n }),\n\n getLogger: monitor(function (name) {\n return customLoggers[name]\n }),\n\n getInitConfiguration: monitor(function () {\n return getInitConfigurationStrategy()\n }),\n\n getInternalContext: monitor(function (startTime) {\n return getInternalContextStrategy(startTime)\n }),\n setUser: monitor(function (newUser) {\n if (checkUser(newUser)) {\n userContextManager.setContext(sanitizeUser(newUser))\n }\n }),\n getUser: monitor(userContextManager.getContext),\n removeUserProperty: monitor(userContextManager.removeContextProperty),\n clearUser: monitor(userContextManager.clearContext)\n })\n\n function canInitLogs(initConfiguration) {\n if (isAlreadyInitialized) {\n if (!initConfiguration.silentMultipleInit) {\n display.error('DD_LOGS is already initialized.')\n }\n return false\n }\n if (!initConfiguration.datakitUrl && !initConfiguration.datakitOrigin) {\n display.error(\n 'datakitOrigin is not configured, no RUM data will be collected.'\n )\n return false\n }\n return true\n }\n}\n"],"mappings":";;;;;;AAAA,IAAAA,YAAA,GAAAC,OAAA;AAYA,IAAAC,cAAA,GAAAD,OAAA;AACA,IAAAE,OAAA,GAAAF,OAAA;AAEO,SAASG,iBAAiBA,CAACC,aAAa,EAAE;EAC/C,IAAIC,oBAAoB,GAAG,KAAK;EAEhC,IAAIC,oBAAoB,GAAG,IAAAC,iCAAoB,EAC7CC,6BAAgB,CAACC,aACnB,CAAC;EACD,IAAIC,kBAAkB,GAAG,IAAAH,iCAAoB,EAACC,6BAAgB,CAACG,IAAI,CAAC;EACpE,IAAIC,aAAa,GAAG,CAAC,CAAC;EACtB,IAAIC,0BAA0B,GAAG,SAAAA,2BAAA,EAAY;IAC3C,OAAOC,SAAS;EAClB,CAAC;EAED,IAAIC,mBAAmB,GAAG,IAAIC,0BAAa,CAAC,CAAC;EAE7C,IAAIC,kBAAiB,GAAG,SAAAA,kBACtBC,WAAW,EACXC,MAAM,EACNC,kBAAkB,EAClBC,IAAI,EACJ;IACA,IAAI,OAAOD,kBAAkB,KAAK,WAAW,EAAE;MAC7CA,kBAAkB,GAAG,IAAAE,sBAAS,EAACC,kBAAkB,CAAC,CAAC,CAAC;IAC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EAAE,IAAAP,oBAAO,EAAC,UAAUyB,SAAS,EAAE;MAC/C,OAAOvD,0BAA0B,CAACuD,SAAS,CAAC;IAC9C,CAAC,CAAC;IACFC,OAAO,EAAE,IAAA1B,oBAAO,EAAC,UAAU2B,OAAO,EAAE;MAClC,IAAI,IAAAC,sBAAS,EAACD,OAAO,CAAC,EAAE;QACtB5D,kBAAkB,CAAC4C,UAAU,CAAC,IAAAkB,yBAAY,EAACF,OAAO,CAAC,CAAC;MACtD;IACF,CAAC,CAAC;IACFG,OAAO,EAAE,IAAA9B,oBAAO,EAACjC,kBAAkB,CAAC6B,UAAU,CAAC;IAC/CmC,kBAAkB,EAAE,IAAA/B,oBAAO,EAACjC,kBAAkB,CAACgD,qBAAqB,CAAC;IACrEiB,SAAS,EAAE,IAAAhC,oBAAO,EAACjC,kBAAkB,CAACkD,YAAY;EACpD,CAAC,CAAC;EAEF,SAASf,WAAWA,CAACD,iBAAiB,EAAE;IACtC,IAAIvC,oBAAoB,EAAE;MACxB,IAAI,CAACuC,iBAAiB,CAACgC,kBAAkB,EAAE;QACzCC,oBAAO,CAACC,KAAK,CAAC,iCAAiC,CAAC;MAClD;MACA,OAAO,KAAK;IACd;IACA,IAAI,CAAClC,iBAAiB,CAACmC,UAAU,IAAI,CAACnC,iBAAiB,CAACoC,aAAa,EAAE;MACrEH,oBAAO,CAACC,KAAK,CACX,iEACF,CAAC;MACD,OAAO,KAAK;IACd;IACA,OAAO,IAAI;EACb;AACF"}
|
|
1
|
+
{"version":3,"file":"logsPublicApi.js","names":["_browserCore","require","_configuration","_logger","LOGS_STORAGE_KEY","makeLogsPublicApi","startLogsImpl","isAlreadyInitialized","globalContextManager","createContextManager","CustomerDataType","GlobalContext","userContextManager","User","customLoggers","getInternalContextStrategy","undefined","beforeInitLoggerLog","BoundedBuffer","handleLogStrategy","logsMessage","logger","savedCommonContext","date","deepClone","buildCommonContext","timeStampNow","add","getInitConfigurationStrategy","mainLogger","Logger","apply","arguments","view","referrer","document","url","window","location","href","context","getContext","user","makePublicApi","init","monitor","initConfiguration","canInitLogs","configuration","validateAndBuildLogsConfiguration","storeContextsToLocal","beforeInitGlobalContext","createStoredContextManager","setContext","extend2Lev","beforeInitUserContext","_startLogsImpl","handleLog","getInternalContext","drain","getGlobalContext","setGlobalContext","setGlobalContextProperty","key","value","setContextProperty","removeGlobalContextProperty","removeContextProperty","clearGlobalContext","clearContext","createLogger","name","conf","handler","level","getLogger","getInitConfiguration","startTime","setUser","newUser","checkUser","sanitizeUser","getUser","removeUserProperty","clearUser","silentMultipleInit","display","error","datakitUrl","datakitOrigin"],"sources":["../../src/boot/logsPublicApi.js"],"sourcesContent":["import {\n BoundedBuffer,\n createContextManager,\n makePublicApi,\n CustomerDataType,\n display,\n deepClone,\n timeStampNow,\n checkUser,\n sanitizeUser,\n monitor,\n createStoredContextManager,\n extend2Lev\n} from '@cloudcare/browser-core'\nimport { validateAndBuildLogsConfiguration } from '../domain/configuration'\nimport { Logger } from '../domain/logger'\nvar LOGS_STORAGE_KEY = 'logs'\nexport function makeLogsPublicApi(startLogsImpl) {\n var isAlreadyInitialized = false\n\n var globalContextManager = createContextManager(\n CustomerDataType.GlobalContext\n )\n var userContextManager = createContextManager(CustomerDataType.User)\n var customLoggers = {}\n var getInternalContextStrategy = function () {\n return undefined\n }\n\n var beforeInitLoggerLog = new BoundedBuffer()\n\n var handleLogStrategy = function (\n logsMessage,\n logger,\n savedCommonContext,\n date\n ) {\n if (typeof savedCommonContext === 'undefined') {\n savedCommonContext = deepClone(buildCommonContext())\n }\n if (typeof date === 'undefined') {\n date = timeStampNow()\n }\n beforeInitLoggerLog.add(function () {\n return handleLogStrategy(logsMessage, logger, savedCommonContext, date)\n })\n }\n\n var getInitConfigurationStrategy = function () {\n return undefined\n }\n\n var mainLogger = new Logger(function () {\n return handleLogStrategy.apply(this, arguments)\n })\n\n function buildCommonContext() {\n return {\n view: {\n referrer: document.referrer,\n url: window.location.href\n },\n context: globalContextManager.getContext(),\n user: userContextManager.getContext()\n }\n }\n\n return makePublicApi({\n logger: mainLogger,\n\n init: monitor(function (initConfiguration) {\n if (!canInitLogs(initConfiguration)) {\n return\n }\n\n var configuration = validateAndBuildLogsConfiguration(initConfiguration)\n if (!configuration) {\n return\n }\n if (initConfiguration.storeContextsToLocal) {\n var beforeInitGlobalContext = globalContextManager.getContext()\n globalContextManager = createStoredContextManager(\n LOGS_STORAGE_KEY,\n CustomerDataType.GlobalContext\n )\n globalContextManager.setContext(\n extend2Lev(globalContextManager.getContext(), beforeInitGlobalContext)\n )\n\n var beforeInitUserContext = userContextManager.getContext()\n userContextManager = createStoredContextManager(\n LOGS_STORAGE_KEY,\n CustomerDataType.User\n )\n userContextManager.setContext(\n extend2Lev(userContextManager.getContext(), beforeInitUserContext)\n )\n }\n var _startLogsImpl = startLogsImpl(\n configuration,\n buildCommonContext,\n mainLogger\n )\n handleLogStrategy = _startLogsImpl.handleLog\n getInternalContextStrategy = _startLogsImpl.getInternalContext\n getInitConfigurationStrategy = function () {\n return deepClone(initConfiguration)\n }\n beforeInitLoggerLog.drain()\n\n isAlreadyInitialized = true\n }),\n\n getGlobalContext: monitor(function () {\n return globalContextManager.getContext()\n }),\n\n setGlobalContext: monitor(function (context) {\n return globalContextManager.setContext(context)\n }),\n\n setGlobalContextProperty: monitor(function (key, value) {\n return globalContextManager.setContextProperty(key, value)\n }),\n\n /** @deprecated: use removeGlobalContextProperty instead */\n removeGlobalContextProperty: monitor(function (key) {\n return globalContextManager.removeContextProperty(key)\n }),\n\n clearGlobalContext: monitor(function () {\n return globalContextManager.clearContext()\n }),\n\n createLogger: monitor(function (name, conf) {\n if (typeof conf == 'undefined') {\n conf = {}\n }\n customLoggers[name] = new Logger(\n function () {\n return handleLogStrategy(this.arguments)\n },\n name,\n conf.handler,\n conf.level,\n conf.context\n )\n return customLoggers[name]\n }),\n\n getLogger: monitor(function (name) {\n return customLoggers[name]\n }),\n\n getInitConfiguration: monitor(function () {\n return getInitConfigurationStrategy()\n }),\n\n getInternalContext: monitor(function (startTime) {\n return getInternalContextStrategy(startTime)\n }),\n setUser: monitor(function (newUser) {\n if (checkUser(newUser)) {\n userContextManager.setContext(sanitizeUser(newUser))\n }\n }),\n getUser: monitor(function () {\n return userContextManager.getContext()\n }),\n removeUserProperty: monitor(function (key) {\n return userContextManager.removeContextProperty(key)\n }),\n clearUser: monitor(function () {\n return userContextManager.clearContext()\n })\n })\n\n function canInitLogs(initConfiguration) {\n if (isAlreadyInitialized) {\n if (!initConfiguration.silentMultipleInit) {\n display.error('DD_LOGS is already initialized.')\n }\n return false\n }\n if (!initConfiguration.datakitUrl && !initConfiguration.datakitOrigin) {\n display.error(\n 'datakitOrigin is not configured, no RUM data will be collected.'\n )\n return false\n }\n return true\n }\n}\n"],"mappings":";;;;;;AAAA,IAAAA,YAAA,GAAAC,OAAA;AAcA,IAAAC,cAAA,GAAAD,OAAA;AACA,IAAAE,OAAA,GAAAF,OAAA;AACA,IAAIG,gBAAgB,GAAG,MAAM;AACtB,SAASC,iBAAiBA,CAACC,aAAa,EAAE;EAC/C,IAAIC,oBAAoB,GAAG,KAAK;EAEhC,IAAIC,oBAAoB,GAAG,IAAAC,iCAAoB,EAC7CC,6BAAgB,CAACC,aACnB,CAAC;EACD,IAAIC,kBAAkB,GAAG,IAAAH,iCAAoB,EAACC,6BAAgB,CAACG,IAAI,CAAC;EACpE,IAAIC,aAAa,GAAG,CAAC,CAAC;EACtB,IAAIC,0BAA0B,GAAG,SAAAA,2BAAA,EAAY;IAC3C,OAAOC,SAAS;EAClB,CAAC;EAED,IAAIC,mBAAmB,GAAG,IAAIC,0BAAa,CAAC,CAAC;EAE7C,IAAIC,kBAAiB,GAAG,SAAAA,kBACtBC,WAAW,EACXC,MAAM,EACNC,kBAAkB,EAClBC,IAAI,EACJ;IACA,IAAI,OAAOD,kBAAkB,KAAK,WAAW,EAAE;MAC7CA,kBAAkB,GAAG,IAAAE,sBAAS,EAACC,kBAAkB,CAAC,CAAC,CAAC;IACtD;IAC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AArC,oBAAO,EAAC,YAAY;MAC3B,OAAOjC,kBAAkB,CAAC6B,UAAU,CAAC,CAAC;IACxC,CAAC,CAAC;IACF0C,kBAAkB,EAAE,IAAAtC,oBAAO,EAAC,UAAUkB,GAAG,EAAE;MACzC,OAAOnD,kBAAkB,CAACuD,qBAAqB,CAACJ,GAAG,CAAC;IACtD,CAAC,CAAC;IACFqB,SAAS,EAAE,IAAAvC,oBAAO,EAAC,YAAY;MAC7B,OAAOjC,kBAAkB,CAACyD,YAAY,CAAC,CAAC;IAC1C,CAAC;EACH,CAAC,CAAC;EAEF,SAAStB,WAAWA,CAACD,iBAAiB,EAAE;IACtC,IAAIvC,oBAAoB,EAAE;MACxB,IAAI,CAACuC,iBAAiB,CAACuC,kBAAkB,EAAE;QACzCC,oBAAO,CAACC,KAAK,CAAC,iCAAiC,CAAC;MAClD;MACA,OAAO,KAAK;IACd;IACA,IAAI,CAACzC,iBAAiB,CAAC0C,UAAU,IAAI,CAAC1C,iBAAiB,CAAC2C,aAAa,EAAE;MACrEH,oBAAO,CAACC,KAAK,CACX,iEACF,CAAC;MACD,OAAO,KAAK;IACd;IACA,OAAO,IAAI;EACb;AACF"}
|
package/esm/boot/buildEnv.js
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
|
-
import { BoundedBuffer, createContextManager, makePublicApi, CustomerDataType, display, deepClone, timeStampNow, checkUser, sanitizeUser, monitor } from '@cloudcare/browser-core';
|
|
1
|
+
import { BoundedBuffer, createContextManager, makePublicApi, CustomerDataType, display, deepClone, timeStampNow, checkUser, sanitizeUser, monitor, createStoredContextManager, extend2Lev } from '@cloudcare/browser-core';
|
|
2
2
|
import { validateAndBuildLogsConfiguration } from '../domain/configuration';
|
|
3
3
|
import { Logger } from '../domain/logger';
|
|
4
|
+
var LOGS_STORAGE_KEY = 'logs';
|
|
4
5
|
export function makeLogsPublicApi(startLogsImpl) {
|
|
5
6
|
var isAlreadyInitialized = false;
|
|
6
7
|
var globalContextManager = createContextManager(CustomerDataType.GlobalContext);
|
|
@@ -47,6 +48,14 @@ export function makeLogsPublicApi(startLogsImpl) {
|
|
|
47
48
|
if (!configuration) {
|
|
48
49
|
return;
|
|
49
50
|
}
|
|
51
|
+
if (initConfiguration.storeContextsToLocal) {
|
|
52
|
+
var beforeInitGlobalContext = globalContextManager.getContext();
|
|
53
|
+
globalContextManager = createStoredContextManager(LOGS_STORAGE_KEY, CustomerDataType.GlobalContext);
|
|
54
|
+
globalContextManager.setContext(extend2Lev(globalContextManager.getContext(), beforeInitGlobalContext));
|
|
55
|
+
var beforeInitUserContext = userContextManager.getContext();
|
|
56
|
+
userContextManager = createStoredContextManager(LOGS_STORAGE_KEY, CustomerDataType.User);
|
|
57
|
+
userContextManager.setContext(extend2Lev(userContextManager.getContext(), beforeInitUserContext));
|
|
58
|
+
}
|
|
50
59
|
var _startLogsImpl = startLogsImpl(configuration, buildCommonContext, mainLogger);
|
|
51
60
|
_handleLogStrategy = _startLogsImpl.handleLog;
|
|
52
61
|
getInternalContextStrategy = _startLogsImpl.getInternalContext;
|
|
@@ -56,15 +65,22 @@ export function makeLogsPublicApi(startLogsImpl) {
|
|
|
56
65
|
beforeInitLoggerLog.drain();
|
|
57
66
|
isAlreadyInitialized = true;
|
|
58
67
|
}),
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
setGlobalContext: monitor(
|
|
63
|
-
|
|
64
|
-
|
|
68
|
+
getGlobalContext: monitor(function () {
|
|
69
|
+
return globalContextManager.getContext();
|
|
70
|
+
}),
|
|
71
|
+
setGlobalContext: monitor(function (context) {
|
|
72
|
+
return globalContextManager.setContext(context);
|
|
73
|
+
}),
|
|
74
|
+
setGlobalContextProperty: monitor(function (key, value) {
|
|
75
|
+
return globalContextManager.setContextProperty(key, value);
|
|
76
|
+
}),
|
|
65
77
|
/** @deprecated: use removeGlobalContextProperty instead */
|
|
66
|
-
removeGlobalContextProperty: monitor(
|
|
67
|
-
|
|
78
|
+
removeGlobalContextProperty: monitor(function (key) {
|
|
79
|
+
return globalContextManager.removeContextProperty(key);
|
|
80
|
+
}),
|
|
81
|
+
clearGlobalContext: monitor(function () {
|
|
82
|
+
return globalContextManager.clearContext();
|
|
83
|
+
}),
|
|
68
84
|
createLogger: monitor(function (name, conf) {
|
|
69
85
|
if (typeof conf == 'undefined') {
|
|
70
86
|
conf = {};
|
|
@@ -88,9 +104,15 @@ export function makeLogsPublicApi(startLogsImpl) {
|
|
|
88
104
|
userContextManager.setContext(sanitizeUser(newUser));
|
|
89
105
|
}
|
|
90
106
|
}),
|
|
91
|
-
getUser: monitor(
|
|
92
|
-
|
|
93
|
-
|
|
107
|
+
getUser: monitor(function () {
|
|
108
|
+
return userContextManager.getContext();
|
|
109
|
+
}),
|
|
110
|
+
removeUserProperty: monitor(function (key) {
|
|
111
|
+
return userContextManager.removeContextProperty(key);
|
|
112
|
+
}),
|
|
113
|
+
clearUser: monitor(function () {
|
|
114
|
+
return userContextManager.clearContext();
|
|
115
|
+
})
|
|
94
116
|
});
|
|
95
117
|
function canInitLogs(initConfiguration) {
|
|
96
118
|
if (isAlreadyInitialized) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"logsPublicApi.js","names":["BoundedBuffer","createContextManager","makePublicApi","CustomerDataType","display","deepClone","timeStampNow","checkUser","sanitizeUser","monitor","validateAndBuildLogsConfiguration","Logger","makeLogsPublicApi","startLogsImpl","isAlreadyInitialized","globalContextManager","GlobalContext","userContextManager","User","customLoggers","getInternalContextStrategy","undefined","beforeInitLoggerLog","handleLogStrategy","logsMessage","logger","savedCommonContext","date","buildCommonContext","add","getInitConfigurationStrategy","mainLogger","apply","arguments","view","referrer","document","url","window","location","href","context","getContext","user","init","initConfiguration","canInitLogs","configuration","_startLogsImpl","handleLog","getInternalContext","drain","getGlobalContext","setGlobalContext","setContext","setGlobalContextProperty","setContextProperty","removeGlobalContextProperty","removeContextProperty","clearGlobalContext","clearContext","createLogger","name","conf","handler","level","getLogger","getInitConfiguration","startTime","setUser","newUser","getUser","removeUserProperty","clearUser","silentMultipleInit","error","datakitUrl","datakitOrigin"],"sources":["../../src/boot/logsPublicApi.js"],"sourcesContent":["import {\n BoundedBuffer,\n createContextManager,\n makePublicApi,\n CustomerDataType,\n display,\n deepClone,\n timeStampNow,\n checkUser,\n sanitizeUser,\n monitor\n} from '@cloudcare/browser-core'\nimport { validateAndBuildLogsConfiguration } from '../domain/configuration'\nimport { Logger } from '../domain/logger'\n\nexport function makeLogsPublicApi(startLogsImpl) {\n var isAlreadyInitialized = false\n\n var globalContextManager = createContextManager(\n CustomerDataType.GlobalContext\n )\n var userContextManager = createContextManager(CustomerDataType.User)\n var customLoggers = {}\n var getInternalContextStrategy = function () {\n return undefined\n }\n\n var beforeInitLoggerLog = new BoundedBuffer()\n\n var handleLogStrategy = function (\n logsMessage,\n logger,\n savedCommonContext,\n date\n ) {\n if (typeof savedCommonContext === 'undefined') {\n savedCommonContext = deepClone(buildCommonContext())\n }\n if (typeof date === 'undefined') {\n date = timeStampNow()\n }\n beforeInitLoggerLog.add(function () {\n return handleLogStrategy(logsMessage, logger, savedCommonContext, date)\n })\n }\n\n var getInitConfigurationStrategy = function () {\n return undefined\n }\n\n var mainLogger = new Logger(function () {\n return handleLogStrategy.apply(this, arguments)\n })\n\n function buildCommonContext() {\n return {\n view: {\n referrer: document.referrer,\n url: window.location.href\n },\n context: globalContextManager.getContext(),\n user: userContextManager.getContext()\n }\n }\n\n return makePublicApi({\n logger: mainLogger,\n\n init: monitor(function (initConfiguration) {\n if (!canInitLogs(initConfiguration)) {\n return\n }\n\n var configuration = validateAndBuildLogsConfiguration(initConfiguration)\n if (!configuration) {\n return\n }\n var _startLogsImpl = startLogsImpl(\n configuration,\n buildCommonContext,\n mainLogger\n )\n handleLogStrategy = _startLogsImpl.handleLog\n getInternalContextStrategy = _startLogsImpl.getInternalContext\n getInitConfigurationStrategy = function () {\n return deepClone(initConfiguration)\n }\n beforeInitLoggerLog.drain()\n\n isAlreadyInitialized = true\n }),\n\n /** @deprecated: use getGlobalContext instead */\n getGlobalContext: monitor(globalContextManager.getContext),\n\n /** @deprecated: use setGlobalContext instead */\n setGlobalContext: monitor(globalContextManager.setContext),\n\n /** @deprecated: use setGlobalContextProperty instead */\n setGlobalContextProperty: monitor(globalContextManager.setContextProperty),\n\n /** @deprecated: use removeGlobalContextProperty instead */\n removeGlobalContextProperty: monitor(\n globalContextManager.removeContextProperty\n ),\n\n clearGlobalContext: monitor(globalContextManager.clearContext),\n\n createLogger: monitor(function (name, conf) {\n if (typeof conf == 'undefined') {\n conf = {}\n }\n customLoggers[name] = new Logger(\n function () {\n return handleLogStrategy(this.arguments)\n },\n name,\n conf.handler,\n conf.level,\n conf.context\n )\n return customLoggers[name]\n }),\n\n getLogger: monitor(function (name) {\n return customLoggers[name]\n }),\n\n getInitConfiguration: monitor(function () {\n return getInitConfigurationStrategy()\n }),\n\n getInternalContext: monitor(function (startTime) {\n return getInternalContextStrategy(startTime)\n }),\n setUser: monitor(function (newUser) {\n if (checkUser(newUser)) {\n userContextManager.setContext(sanitizeUser(newUser))\n }\n }),\n getUser: monitor(userContextManager.getContext),\n removeUserProperty: monitor(userContextManager.removeContextProperty),\n clearUser: monitor(userContextManager.clearContext)\n })\n\n function canInitLogs(initConfiguration) {\n if (isAlreadyInitialized) {\n if (!initConfiguration.silentMultipleInit) {\n display.error('DD_LOGS is already initialized.')\n }\n return false\n }\n if (!initConfiguration.datakitUrl && !initConfiguration.datakitOrigin) {\n display.error(\n 'datakitOrigin is not configured, no RUM data will be collected.'\n )\n return false\n }\n return true\n }\n}\n"],"mappings":"AAAA,SACEA,aAAa,EACbC,oBAAoB,EACpBC,aAAa,EACbC,gBAAgB,EAChBC,OAAO,EACPC,SAAS,EACTC,YAAY,EACZC,SAAS,EACTC,YAAY,EACZC,OAAO,QACF,yBAAyB;AAChC,SAASC,iCAAiC,QAAQ,yBAAyB;AAC3E,SAASC,MAAM,QAAQ,kBAAkB;AAEzC,OAAO,SAASC,iB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B,UAAU,IAAI,CAAC/B,iBAAiB,CAACgC,aAAa,EAAE;MACrEzE,OAAO,CAACuE,KAAK,CACX,iEACF,CAAC;MACD,OAAO,KAAK;IACd;IACA,OAAO,IAAI;EACb;AACF"}
|
|
1
|
+
{"version":3,"file":"logsPublicApi.js","names":["BoundedBuffer","createContextManager","makePublicApi","CustomerDataType","display","deepClone","timeStampNow","checkUser","sanitizeUser","monitor","createStoredContextManager","extend2Lev","validateAndBuildLogsConfiguration","Logger","LOGS_STORAGE_KEY","makeLogsPublicApi","startLogsImpl","isAlreadyInitialized","globalContextManager","GlobalContext","userContextManager","User","customLoggers","getInternalContextStrategy","undefined","beforeInitLoggerLog","handleLogStrategy","logsMessage","logger","savedCommonContext","date","buildCommonContext","add","getInitConfigurationStrategy","mainLogger","apply","arguments","view","referrer","document","url","window","location","href","context","getContext","user","init","initConfiguration","canInitLogs","configuration","storeContextsToLocal","beforeInitGlobalContext","setContext","beforeInitUserContext","_startLogsImpl","handleLog","getInternalContext","drain","getGlobalContext","setGlobalContext","setGlobalContextProperty","key","value","setContextProperty","removeGlobalContextProperty","removeContextProperty","clearGlobalContext","clearContext","createLogger","name","conf","handler","level","getLogger","getInitConfiguration","startTime","setUser","newUser","getUser","removeUserProperty","clearUser","silentMultipleInit","error","datakitUrl","datakitOrigin"],"sources":["../../src/boot/logsPublicApi.js"],"sourcesContent":["import {\n BoundedBuffer,\n createContextManager,\n makePublicApi,\n CustomerDataType,\n display,\n deepClone,\n timeStampNow,\n checkUser,\n sanitizeUser,\n monitor,\n createStoredContextManager,\n extend2Lev\n} from '@cloudcare/browser-core'\nimport { validateAndBuildLogsConfiguration } from '../domain/configuration'\nimport { Logger } from '../domain/logger'\nvar LOGS_STORAGE_KEY = 'logs'\nexport function makeLogsPublicApi(startLogsImpl) {\n var isAlreadyInitialized = false\n\n var globalContextManager = createContextManager(\n CustomerDataType.GlobalContext\n )\n var userContextManager = createContextManager(CustomerDataType.User)\n var customLoggers = {}\n var getInternalContextStrategy = function () {\n return undefined\n }\n\n var beforeInitLoggerLog = new BoundedBuffer()\n\n var handleLogStrategy = function (\n logsMessage,\n logger,\n savedCommonContext,\n date\n ) {\n if (typeof savedCommonContext === 'undefined') {\n savedCommonContext = deepClone(buildCommonContext())\n }\n if (typeof date === 'undefined') {\n date = timeStampNow()\n }\n beforeInitLoggerLog.add(function () {\n return handleLogStrategy(logsMessage, logger, savedCommonContext, date)\n })\n }\n\n var getInitConfigurationStrategy = function () {\n return undefined\n }\n\n var mainLogger = new Logger(function () {\n return handleLogStrategy.apply(this, arguments)\n })\n\n function buildCommonContext() {\n return {\n view: {\n referrer: document.referrer,\n url: window.location.href\n },\n context: globalContextManager.getContext(),\n user: userContextManager.getContext()\n }\n }\n\n return makePublicApi({\n logger: mainLogger,\n\n init: monitor(function (initConfiguration) {\n if (!canInitLogs(initConfiguration)) {\n return\n }\n\n var configuration = validateAndBuildLogsConfiguration(initConfiguration)\n if (!configuration) {\n return\n }\n if (initConfiguration.storeContextsToLocal) {\n var beforeInitGlobalContext = globalContextManager.getContext()\n globalContextManager = createStoredContextManager(\n LOGS_STORAGE_KEY,\n CustomerDataType.GlobalContext\n )\n globalContextManager.setContext(\n extend2Lev(globalContextManager.getContext(), beforeInitGlobalContext)\n )\n\n var beforeInitUserContext = userContextManager.getContext()\n userContextManager = createStoredContextManager(\n LOGS_STORAGE_KEY,\n CustomerDataType.User\n )\n userContextManager.setContext(\n extend2Lev(userContextManager.getContext(), beforeInitUserContext)\n )\n }\n var _startLogsImpl = startLogsImpl(\n configuration,\n buildCommonContext,\n mainLogger\n )\n handleLogStrategy = _startLogsImpl.handleLog\n getInternalContextStrategy = _startLogsImpl.getInternalContext\n getInitConfigurationStrategy = function () {\n return deepClone(initConfiguration)\n }\n beforeInitLoggerLog.drain()\n\n isAlreadyInitialized = true\n }),\n\n getGlobalContext: monitor(function () {\n return globalContextManager.getContext()\n }),\n\n setGlobalContext: monitor(function (context) {\n return globalContextManager.setContext(context)\n }),\n\n setGlobalContextProperty: monitor(function (key, value) {\n return globalContextManager.setContextProperty(key, value)\n }),\n\n /** @deprecated: use removeGlobalContextProperty instead */\n removeGlobalContextProperty: monitor(function (key) {\n return globalContextManager.removeContextProperty(key)\n }),\n\n clearGlobalContext: monitor(function () {\n return globalContextManager.clearContext()\n }),\n\n createLogger: monitor(function (name, conf) {\n if (typeof conf == 'undefined') {\n conf = {}\n }\n customLoggers[name] = new Logger(\n function () {\n return handleLogStrategy(this.arguments)\n },\n name,\n conf.handler,\n conf.level,\n conf.context\n )\n return customLoggers[name]\n }),\n\n getLogger: monitor(function (name) {\n return customLoggers[name]\n }),\n\n getInitConfiguration: monitor(function () {\n return getInitConfigurationStrategy()\n }),\n\n getInternalContext: monitor(function (startTime) {\n return getInternalContextStrategy(startTime)\n }),\n setUser: monitor(function (newUser) {\n if (checkUser(newUser)) {\n userContextManager.setContext(sanitizeUser(newUser))\n }\n }),\n getUser: monitor(function () {\n return userContextManager.getContext()\n }),\n removeUserProperty: monitor(function (key) {\n return userContextManager.removeContextProperty(key)\n }),\n clearUser: monitor(function () {\n return userContextManager.clearContext()\n })\n })\n\n function canInitLogs(initConfiguration) {\n if (isAlreadyInitialized) {\n if (!initConfiguration.silentMultipleInit) {\n display.error('DD_LOGS is already initialized.')\n }\n return false\n }\n if (!initConfiguration.datakitUrl && !initConfiguration.datakitOrigin) {\n display.error(\n 'datakitOrigin is not configured, no RUM data will be collected.'\n )\n return false\n }\n return true\n }\n}\n"],"mappings":"AAAA,SACEA,aAAa,EACbC,oBAAoB,EACpBC,aAAa,EACbC,gBAAgB,EAChBC,OAAO,EACPC,SAAS,EACTC,YAAY,EACZC,SAAS,EACTC,YAAY,EACZC,OAAO,EACPC,0BAA0B,EAC1BC,UAAU,QACL,yBAAyB;AAChC,SAASC,iCAAiC,QAAQ,yBAAyB;AAC3E,SAASC,MAAM,QAAQ,kBAAkB;AACzC,IAAIC,gBAAgB,GAAG,MAAM;AAC7B,OAAO,SAASC,iBAAiBA,CAAC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": "cjs/index.js",
|
|
4
4
|
"module": "esm/index.js",
|
|
5
|
-
"version": "3.1.
|
|
5
|
+
"version": "3.1.2",
|
|
6
6
|
"dependencies": {
|
|
7
|
-
"@cloudcare/browser-core": "3.1.
|
|
7
|
+
"@cloudcare/browser-core": "3.1.2"
|
|
8
8
|
},
|
|
9
9
|
"scripts": {
|
|
10
10
|
"dev": "webpack serve --open --mode=development",
|
|
@@ -29,5 +29,5 @@
|
|
|
29
29
|
"author": "dataflux",
|
|
30
30
|
"license": "MIT",
|
|
31
31
|
"description": "DataFlux RUM Web 端数据指标监控",
|
|
32
|
-
"gitHead": "
|
|
32
|
+
"gitHead": "76a8647c7e9154baecb6c5e6f0cf8dd76e13d508"
|
|
33
33
|
}
|
|
@@ -8,11 +8,13 @@ import {
|
|
|
8
8
|
timeStampNow,
|
|
9
9
|
checkUser,
|
|
10
10
|
sanitizeUser,
|
|
11
|
-
monitor
|
|
11
|
+
monitor,
|
|
12
|
+
createStoredContextManager,
|
|
13
|
+
extend2Lev
|
|
12
14
|
} from '@cloudcare/browser-core'
|
|
13
15
|
import { validateAndBuildLogsConfiguration } from '../domain/configuration'
|
|
14
16
|
import { Logger } from '../domain/logger'
|
|
15
|
-
|
|
17
|
+
var LOGS_STORAGE_KEY = 'logs'
|
|
16
18
|
export function makeLogsPublicApi(startLogsImpl) {
|
|
17
19
|
var isAlreadyInitialized = false
|
|
18
20
|
|
|
@@ -75,6 +77,25 @@ export function makeLogsPublicApi(startLogsImpl) {
|
|
|
75
77
|
if (!configuration) {
|
|
76
78
|
return
|
|
77
79
|
}
|
|
80
|
+
if (initConfiguration.storeContextsToLocal) {
|
|
81
|
+
var beforeInitGlobalContext = globalContextManager.getContext()
|
|
82
|
+
globalContextManager = createStoredContextManager(
|
|
83
|
+
LOGS_STORAGE_KEY,
|
|
84
|
+
CustomerDataType.GlobalContext
|
|
85
|
+
)
|
|
86
|
+
globalContextManager.setContext(
|
|
87
|
+
extend2Lev(globalContextManager.getContext(), beforeInitGlobalContext)
|
|
88
|
+
)
|
|
89
|
+
|
|
90
|
+
var beforeInitUserContext = userContextManager.getContext()
|
|
91
|
+
userContextManager = createStoredContextManager(
|
|
92
|
+
LOGS_STORAGE_KEY,
|
|
93
|
+
CustomerDataType.User
|
|
94
|
+
)
|
|
95
|
+
userContextManager.setContext(
|
|
96
|
+
extend2Lev(userContextManager.getContext(), beforeInitUserContext)
|
|
97
|
+
)
|
|
98
|
+
}
|
|
78
99
|
var _startLogsImpl = startLogsImpl(
|
|
79
100
|
configuration,
|
|
80
101
|
buildCommonContext,
|
|
@@ -90,21 +111,26 @@ export function makeLogsPublicApi(startLogsImpl) {
|
|
|
90
111
|
isAlreadyInitialized = true
|
|
91
112
|
}),
|
|
92
113
|
|
|
93
|
-
|
|
94
|
-
|
|
114
|
+
getGlobalContext: monitor(function () {
|
|
115
|
+
return globalContextManager.getContext()
|
|
116
|
+
}),
|
|
95
117
|
|
|
96
|
-
|
|
97
|
-
|
|
118
|
+
setGlobalContext: monitor(function (context) {
|
|
119
|
+
return globalContextManager.setContext(context)
|
|
120
|
+
}),
|
|
98
121
|
|
|
99
|
-
|
|
100
|
-
|
|
122
|
+
setGlobalContextProperty: monitor(function (key, value) {
|
|
123
|
+
return globalContextManager.setContextProperty(key, value)
|
|
124
|
+
}),
|
|
101
125
|
|
|
102
126
|
/** @deprecated: use removeGlobalContextProperty instead */
|
|
103
|
-
removeGlobalContextProperty: monitor(
|
|
104
|
-
globalContextManager.removeContextProperty
|
|
105
|
-
),
|
|
127
|
+
removeGlobalContextProperty: monitor(function (key) {
|
|
128
|
+
return globalContextManager.removeContextProperty(key)
|
|
129
|
+
}),
|
|
106
130
|
|
|
107
|
-
clearGlobalContext: monitor(
|
|
131
|
+
clearGlobalContext: monitor(function () {
|
|
132
|
+
return globalContextManager.clearContext()
|
|
133
|
+
}),
|
|
108
134
|
|
|
109
135
|
createLogger: monitor(function (name, conf) {
|
|
110
136
|
if (typeof conf == 'undefined') {
|
|
@@ -138,9 +164,15 @@ export function makeLogsPublicApi(startLogsImpl) {
|
|
|
138
164
|
userContextManager.setContext(sanitizeUser(newUser))
|
|
139
165
|
}
|
|
140
166
|
}),
|
|
141
|
-
getUser: monitor(
|
|
142
|
-
|
|
143
|
-
|
|
167
|
+
getUser: monitor(function () {
|
|
168
|
+
return userContextManager.getContext()
|
|
169
|
+
}),
|
|
170
|
+
removeUserProperty: monitor(function (key) {
|
|
171
|
+
return userContextManager.removeContextProperty(key)
|
|
172
|
+
}),
|
|
173
|
+
clearUser: monitor(function () {
|
|
174
|
+
return userContextManager.clearContext()
|
|
175
|
+
})
|
|
144
176
|
})
|
|
145
177
|
|
|
146
178
|
function canInitLogs(initConfiguration) {
|