@apmplus/integrations
Advanced tools
Comparing version 2.1.6 to 2.2.0-alpha.0
@@ -984,2 +984,3 @@ interface ContextAgent { | ||
pure?: boolean; | ||
ignoreUrls?: (string | RegExp)[]; | ||
} | ||
@@ -986,0 +987,0 @@ |
@@ -1,1 +0,1 @@ | ||
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var __assign=function(){return(__assign=Object.assign||function(t){for(var e,r=1,n=arguments.length;r<n;r++)for(var o in e=arguments[r])Object.prototype.hasOwnProperty.call(e,o)&&(t[o]=e[o]);return t}).apply(this,arguments)};function __read(t,e){var r="function"==typeof Symbol&&t[Symbol.iterator];if(!r)return t;var n,o,i=r.call(t),u=[];try{for(;(void 0===e||0<e--)&&!(n=i.next()).done;)u.push(n.value)}catch(t){o={error:t}}finally{try{n&&!n.done&&(r=i.return)&&r.call(i)}finally{if(o)throw o.error}}return u}function __spreadArray(t,e,r){if(r||2===arguments.length)for(var n,o=0,i=e.length;o<i;o++)!n&&o in e||((n=n||Array.prototype.slice.call(e,0,o))[o]=e[o]);return t.concat(n||Array.prototype.slice.call(e))}var noop=function(){return{}};function isObject(t){return"object"==typeof t&&null!==t}function isUndefined(t){return void 0===t}var objProto=Object.prototype;function isArray(t){return"[object Array]"===objProto.toString.call(t)}function isFunction(t){return"function"==typeof t}function isString(t){return"string"==typeof t}function arrayIncludes(t,e){if(!isArray(t))return!1;if(0===t.length)return!1;for(var r=0;r<t.length;){if(t[r]===e)return!0;r++}return!1}var applyRecord=function(){var r={};return[r,function(t,e){return r[t]=e},function(t){return delete r[t]}]},hookMethodDangerously=function(i,u,a){return function(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];if(!i)return noop;var r=i[u],n=a.apply(void 0,__spreadArray([r],__read(t),!1)),o=n;return isFunction(o)&&(o=function(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];return n.apply(this,t)}),i[u]=o,function(){o===i[u]?i[u]=r:n=r}}};function mathRNG(){for(var t=new Array(16),e=0,r=0;r<16;r++)0==(3&r)&&(e=4294967296*Math.random()),t[r]=e>>>((3&r)<<3)&255;return t}function bytesToUuid(t){for(var e=[],r=0;r<256;++r)e[r]=(r+256).toString(16).substr(1);var n=0,o=e;return[o[t[n++]],o[t[n++]],o[t[n++]],o[t[n++]],"-",o[t[n++]],o[t[n++]],"-",o[t[n++]],o[t[n++]],"-",o[t[n++]],o[t[n++]],"-",o[t[n++]],o[t[n++]],o[t[n++]],o[t[n++]],o[t[+n]],o[t[15]]].join("")}function uuid(){var t=mathRNG();return t[6]=15&t[6]|64,t[8]=63&t[8]|128,bytesToUuid(t)}var registerTearDownGroup=function(t,e,r,n){return t.destroyAgent.set(e,r,n)};function initSubjectInGlobal(t,e){return t.initSubject(e)}var now=function(){return Date.now()};function getDefaultBrowser(){if("object"==typeof window&&isObject(window))return window}function getDefaultDocument(){if("object"==typeof document&&isObject(document))return document}function getDefaultLocation(){return getDefaultBrowser()&&window.location}function getDefaultPerformanceObserver(){if(getDefaultBrowser()&&isFunction(window.PerformanceObserver))return window.PerformanceObserver}function getLocationUrl(){var t=getDefaultBrowser()&&getDefaultLocation();return t?t.href:""}var getViewOverrides=function(t){return{pid:t.pid,view_id:t.viewId,url:getLocationUrl()}},getOverrides=function(t){var e=t.config(),e=getViewOverrides(e);return e.context=t.context?t.context.toString():{},e},reportWithCurrentContext=function(e,t){void 0===t&&(t=!1);var r=getOverrides(e);return t&&(r.timestamp=now()),function(t){e.report(__assign(__assign({},t),{overrides:r}))}},applyMutationObserver=function(t,e){var r=t&&new t(e);return[function(t,e){r&&t&&r.observe(t,e)},function(){return r&&r.disconnect()}]},applyPerformance=function(r){var t=r&&r.timing||void 0;return[t,function(){return r&&r.now?r.now():(Date.now?Date.now():+new Date)-(t&&t.navigationStart||0)},function(t){var e=(r||{}).getEntriesByType;return isFunction(e)&&e.call(r,t)||[]},function(){var t=(r||{}).clearResourceTimings;isFunction(t)&&t.call(r)},function(t){var e=(r||{}).getEntriesByName;return isFunction(e)&&e.call(r,t)||[]}]},UNKNOWN_PATH="<unknown>";function htmlTreeAsString(t){try{for(var e,r=t,n=[],o=0,i=0,u=" > ".length;r&&o++<5&&!("html"===(e=_htmlElementAsString(r))||1<o&&256<=i+n.length*u+e.length);)n.push(e),i+=e.length,r=r.parentNode;return n.reverse().join(" > ")}catch(t){return UNKNOWN_PATH}}function _htmlElementAsString(t){var e,r,n,o=t,i=[];if(!o||!o.tagName)return"";i.push(o.tagName.toLowerCase()),o.id&&i.push("#"+o.id);t=o.className;if(t&&isString(t))for(e=t.split(/\s+/),a=0;a<e.length;a++)i.push("."+e[a]);for(var u=["type","name","title","alt"],a=0;a<u.length;a++)(n=o.getAttribute(r=u[a]))&&i.push("["+r+'="'+n+'"]');return i.join("")}var addListenerToDocument=function(t,e,r,n){return void 0===n&&(n=!1),t.addEventListener(e,r,n),function(){t.removeEventListener(e,r,n)}},XHR_SUBJECT_NAME="xhr_0",getReportPathRegExp=function(){var e=new RegExp("\\/monitor_web\\/collect|\\/monitor_browser\\/collect\\/batch","i");return function(t){return e.test(t)}},hookOpen=function(n){return function(){for(var t,e=[],r=0;r<arguments.length;r++)e[r]=arguments[r];return t=__read(e,2),this._method=t[0],this._url=t[1],n.apply(this,e)}},hookSetHeader=function(o){return function(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];this._reqHeaders=this._reqHeaders||{};var r=__read(t,2),n=r[0],r=r[1];return this._reqHeaders[n]=r,o&&o.apply(this,t)}},hookOnreadystatechange=function(n,o){return hookMethodDangerously(n,"onreadystatechange",function(r){return function(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];return 4===this.readyState&&o(n),r&&r.apply(this,t)}})},hookSend=function(n,o){var i=getReportPathRegExp();return function(){for(var t,e=[],r=0;r<arguments.length;r++)e[r]=arguments[r];return this._start=now(),this._data=null==e?void 0:e[0],i(this._url)||(t=o([this._method,this._url,this._start,this]),hookOnreadystatechange(this,t)()),n.apply(this,e)}},applyXHR=function(n){return function(t,e){var r;n&&((r=[]).push(hookMethodDangerously(n,"open",hookOpen)()),r.push(hookMethodDangerously(n,"setRequestHeader",hookSetHeader)()),r.push(hookMethodDangerously(n,"send",hookSend)(t)),e(function(){r.forEach(function(t){return t()})}))}},FETCH_SUBJECT_NAME="fetch_0",hookFetch=function(n,o){return function(t,e){var r=o([t,e=void 0===e?{}:e]),e=n(t,e);return e.then(function(t){r(t)},function(){r(void 0)}),e}},observeFetch=function(t,e){var r,n=getDefaultBrowser();n&&fetch&&((r=[]).push(hookMethodDangerously(n,"fetch",hookFetch)(t)),e(function(){r.forEach(function(t){return t()})}))},fetchSubject=[FETCH_SUBJECT_NAME,observeFetch],RESOURCE_TYPE=["resource"],LONGTASK_TYPE=["longtask"],applyPerformanceObserver=function(n,o,i){var u=n&&new n(function(t,n){t.getEntries?t.getEntries().forEach(function(t,e,r){return o(t,e,r,n)}):i&&i()});return[function(t){if(!n||!u)return i&&i();try{u.observe({entryTypes:t})}catch(t){return i&&i()}},function(t,e){if(!n||!u)return i&&i();try{var r={type:t,buffered:!0};isUndefined(e)||(r.durationThreshold=e),u.observe(r)}catch(t){return i&&i()}u.observe({type:t,buffered:!1})},function(){return u&&u.disconnect()}]},observePerf=function(t,e,r){t=__read(applyPerformanceObserver(t,e),3),e=t[0],t=t[2];return e(r),t},LONGTASK_SUBJECT_NAME="longtask_0",observeLongtask=function(t,e){var r=getDefaultPerformanceObserver();r&&e(observePerf(r,t,LONGTASK_TYPE))},longtaskSubject=[LONGTASK_SUBJECT_NAME,observeLongtask],RESOURCE_SUBJECT_NAME="resource_0",observeResource=function(t,e){var r=getDefaultPerformanceObserver();r&&e(observePerf(r,t,RESOURCE_TYPE))},resourceSubject=[RESOURCE_SUBJECT_NAME,observeResource],PAGEVIEW_EV_TYPE="pageview",JS_ERROR_EV_TYPE="js_error",HTTP_EV_TYPE="http",RESOURCE_EV_TYPE="resource",LONG_TASK_EV_TYPE="performance_longtask",ACTION_EV_TYPE="action",PAGE_ACTIVITY_DELAY=100,ROOT_TAGS=["BODY","HTML","HEAD"],SVG_TAG="SVG",DEFAULT_ATTR_NAME="data-apm-action",waitActionComplete=function(t,e,r,n){function o(){t.clearTimeout(i),a&&(i=t.setTimeout(function(){e()},PAGE_ACTIVITY_DELAY))}var i,u,a=!1;return[function(){a=!0,t.clearTimeout(u),u=t.setTimeout(function(){e(!0),r()},n),o()},o,function(){a=!1,t.clearTimeout(i),t.clearTimeout(u)}]},isSupportsElementClosest=function(){var t;return function(){return void 0===t?t="closest"in HTMLElement.prototype:t}}(),findElementWithAttributeByParents=function(t,e,r){void 0===r&&(r=10);for(var n=t,o=0;o<r&&n;o++){if(~ROOT_TAGS.indexOf(n.nodeName))return;if(n.hasAttribute(e))return n;n=n.parentElement}},getActionNameByAttribute=function(t,e){t=isSupportsElementClosest()?t.closest("["+e+"]"):findElementWithAttributeByParents(t,e);if(t)return t.getAttribute(e).trim()},getActionName=function(t,e){return getActionNameByAttribute(t,e)||t.innerText},isSVGTarget=function(t){for(var e=t,r=!1;e;)e.tagName.toUpperCase()===SVG_TAG?r=!(e=null):e=e.parentElement;return r},isElementWithinTwoLevels=function(t){t=t.children;return!t.length||![].slice.call(t).some(function(t){return 0<t.children.length})},isValidTarget=function(t){var e=t.tagName.toUpperCase();return 1===t.nodeType&&!ROOT_TAGS.includes(e)&&!isSVGTarget(t)&&((!t.style||"none"!==t.style.display)&&(!(!["A","BUTTON","INPUT","TEXTAREA"].includes(e)&&!getActionNameByAttribute(t,DEFAULT_ATTR_NAME))||!!isElementWithinTwoLevels(t)))},SUPPORT_TYPES=["click"],EVENT_LISTENER_OPTIONS={capture:!0},MIN_LONG_TASK=50,MAX_ACTIVITY_DELAY=1e4,applyIncompleteReq=function(t,e,r){var n=__read(e,2),o=n[0],i=n[1],e=__read(applyRecord(),3),n=e[0],u=e[1],a=e[2],c=0;return t.push(o[0](function(t){__read(t,1)[0];var e=c+=1;return u(e,now()),r(),function(){a(e),r()}})),t.push(i[0](function(){var t=c+=1;return u(t,now()),r(),function(){a(t),r()}})),n},actionGetterWithFetchObserver=function(o,e,t,r){function n(t){var e;!l||!_&&!Object.keys(l.metrics).length||Object.keys(A).length&&!t||(l.metrics[LONG_TASK_EV_TYPE]&&(l.metrics[LONG_TASK_EV_TYPE].duration=h),e=0<T.length?Math.max.apply(Math,__spreadArray([],__read(T),!1))-Math.min.apply(Math,__spreadArray([],__read(T),!1)):0,l.metrics[HTTP_EV_TYPE]&&(l.metrics[HTTP_EV_TYPE].duration=e),t=E()-l.start_time,d&&d({ev_type:ACTION_EV_TYPE,payload:__assign(__assign({},l),{duration:t,frontend_time:t-e})}),i())}function i(){m(),l&&(p={start_time:l.start_time,id:l.id}),l=null,T=[],h=0}function u(t){l&&(l.metrics[t]={count:(null!==(t=null===(t=l.metrics[t])||void 0===t?void 0:t.count)&&void 0!==t?t:0)+1})}var a=__read(t,4),c=a[0],s=a[1],f=a[2],t=a[3],a=r.types,_=r.pure,l=null,p=null,d=void 0,T=[],h=0,E=__read(applyPerformance(performance),2)[1],r=__read(waitActionComplete(window,n,i,MAX_ACTIVITY_DELAY),3),v=r[0],g=r[1],m=r[2],A=applyIncompleteReq(e,[c,s],g),c=__read(applyMutationObserver(MutationObserver,g),2),s=c[0],c=c[1];s(),e.push(c),e.push(m),e.push(f[0](function(t){var e=t.startTime,t=t.duration;g(),l&&l.start_time<=e+MIN_LONG_TASK&&(h+=t,u(LONG_TASK_EV_TYPE))})),e.push(t[0](function(t){var e=t.startTime,r=t.duration,t=t.initiatorType;g(),l&&l.start_time<e&&(["xmlhttprequest","fetch"].includes(t)&&(T.push(e,e+r),u(HTTP_EV_TYPE)),["xmlhttprequest","fetch","beacon"].includes(t)||u(RESOURCE_EV_TYPE))}));function y(t,e){var r=uuid(),n=__read(applyPerformance(performance),2)[1];l={start_time:n(),id:r,type:e,target:t,metrics:{}},d=o(),v()}function O(t){var e;n(!0),i(),t.target instanceof HTMLElement&&isValidTarget(t.target)&&((e=getActionName(t.target,DEFAULT_ATTR_NAME))&&y({name:e,path:htmlTreeAsString(t.target)},t.type))}a&&a.forEach(function(t){arrayIncludes(SUPPORT_TYPES,t)&&e.push(addListenerToDocument(document,t,O,EVENT_LISTENER_OPTIONS))});return[function(t){if(t.ev_type===PAGEVIEW_EV_TYPE)return n(!0),void i();if(t.ev_type===HTTP_EV_TYPE)return(e=t.payload.response.timing&&t.payload.response.timing.startTime)?l&&e>l.start_time?l.id:p&&e>p.start_time?p.id:void 0:void 0;if(t.ev_type!==LONG_TASK_EV_TYPE)return l?(t.ev_type!==JS_ERROR_EV_TYPE&&t.ev_type!==RESOURCE_EV_TYPE||u(t.ev_type),l.id):void 0;var e=t.payload.longtasks.length&&t.payload.longtasks[0].startTime+MIN_LONG_TASK;return l&&e&&e>l.start_time?l.id:void 0},function(t,e){n(!0),i(),y({name:t},e)}]},ACTION_MONITOR_PLUGIN_NAME="action",defaultConfig={types:["click"],pure:!0};function ActionMonitorBasePlugin(t,e){void 0===e&&(e=defaultConfig);var r,n,o=[],i=getDefaultDocument(),u=getDefaultBrowser();i&&u&&(e=__read(actionGetterWithFetchObserver(function(){return reportWithCurrentContext(t,!0)},o,[initSubjectInGlobal(t,[XHR_SUBJECT_NAME,applyXHR(XMLHttpRequest&&XMLHttpRequest.prototype)]),initSubjectInGlobal(t,fetchSubject),initSubjectInGlobal(t,longtaskSubject),initSubjectInGlobal(t,resourceSubject)],e),2),r=e[0],e=e[1],t.on("report",n=function(t){var e=r(t);return e&&t.extra&&(t.extra.action_id=e),t}),o.push(function(){t.off("report",n)}),t.provide("startAction",e),registerTearDownGroup(t,ACTION_MONITOR_PLUGIN_NAME,ACTION_EV_TYPE,o))}var ACTION_INTEGRATION_NAME=ACTION_MONITOR_PLUGIN_NAME,actionPlugin=function(e){return{name:ACTION_INTEGRATION_NAME,setup:function(t){ActionMonitorBasePlugin(t,e)}}};exports.ACTION_INTEGRATION_NAME=ACTION_INTEGRATION_NAME,exports.actionPlugin=actionPlugin; | ||
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var __assign=function(){return(__assign=Object.assign||function(t){for(var e,r=1,n=arguments.length;r<n;r++)for(var o in e=arguments[r])Object.prototype.hasOwnProperty.call(e,o)&&(t[o]=e[o]);return t}).apply(this,arguments)};function __read(t,e){var r="function"==typeof Symbol&&t[Symbol.iterator];if(!r)return t;var n,o,i=r.call(t),u=[];try{for(;(void 0===e||0<e--)&&!(n=i.next()).done;)u.push(n.value)}catch(t){o={error:t}}finally{try{n&&!n.done&&(r=i.return)&&r.call(i)}finally{if(o)throw o.error}}return u}function __spreadArray(t,e,r){if(r||2===arguments.length)for(var n,o=0,i=e.length;o<i;o++)!n&&o in e||((n=n||Array.prototype.slice.call(e,0,o))[o]=e[o]);return t.concat(n||Array.prototype.slice.call(e))}var noop=function(){return{}};function isObject(t){return"object"==typeof t&&null!==t}function isUndefined(t){return void 0===t}var objProto=Object.prototype;function isArray(t){return"[object Array]"===objProto.toString.call(t)}function isFunction(t){return"function"==typeof t}function isString(t){return"string"==typeof t}function arrayIncludes(t,e){if(!isArray(t))return!1;if(0===t.length)return!1;for(var r=0;r<t.length;){if(t[r]===e)return!0;r++}return!1}var applyRecord=function(){var r={};return[r,function(t,e){return r[t]=e},function(t){return delete r[t]}]};function getRegexp(t){return isArray(t)&&t.length?joinRegExp(t):null}function joinRegExp(t){for(var e=[],r=t.length,n=0;n<r;n++){var o=t[n];isString(o)?e.push(o.replace(/([.*+?^=!:${}()|[\]/\\])/g,"\\$1")):o&&o.source&&e.push(o.source)}return new RegExp(e.join("|"),"i")}var checkIfHit=function(t,e){t=getRegexp(t||[]);return!!t&&t.test(e)},hookMethodDangerously=function(i,u,a){return function(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];if(!i)return noop;var r=i[u],n=a.apply(void 0,__spreadArray([r],__read(t),!1)),o=n;return isFunction(o)&&(o=function(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];return n.apply(this,t)}),i[u]=o,function(){o===i[u]?i[u]=r:n=r}}};function mathRNG(){for(var t=new Array(16),e=0,r=0;r<16;r++)0==(3&r)&&(e=4294967296*Math.random()),t[r]=e>>>((3&r)<<3)&255;return t}function bytesToUuid(t){for(var e=[],r=0;r<256;++r)e[r]=(r+256).toString(16).substr(1);var n=0,o=e;return[o[t[n++]],o[t[n++]],o[t[n++]],o[t[n++]],"-",o[t[n++]],o[t[n++]],"-",o[t[n++]],o[t[n++]],"-",o[t[n++]],o[t[n++]],"-",o[t[n++]],o[t[n++]],o[t[n++]],o[t[n++]],o[t[+n]],o[t[15]]].join("")}function uuid(){var t=mathRNG();return t[6]=15&t[6]|64,t[8]=63&t[8]|128,bytesToUuid(t)}var registerTearDownGroup=function(t,e,r,n){return t.destroyAgent.set(e,r,n)};function initSubjectInGlobal(t,e){return t.initSubject(e)}var now=function(){return Date.now()};function getDefaultBrowser(){if("object"==typeof window&&isObject(window))return window}function getDefaultDocument(){if("object"==typeof document&&isObject(document))return document}function getDefaultLocation(){return getDefaultBrowser()&&window.location}function getDefaultPerformanceObserver(){if(getDefaultBrowser()&&isFunction(window.PerformanceObserver))return window.PerformanceObserver}function getFullUrl(t){var e=getDefaultDocument();if(!e||!t)return"";e=e.createElement("a");return e.href=t,e.href}function getLocationUrl(){var t=getDefaultBrowser()&&getDefaultLocation();return t?t.href:""}var getViewOverrides=function(t){return{pid:t.pid,view_id:t.viewId,url:getLocationUrl()}},getOverrides=function(t){var e=t.config(),e=getViewOverrides(e);return e.context=t.context?t.context.toString():{},e},reportWithCurrentContext=function(e,t){void 0===t&&(t=!1);var r=getOverrides(e);return t&&(r.timestamp=now()),function(t){e.report(__assign(__assign({},t),{overrides:r}))}},applyMutationObserver=function(t,e){var r=t&&new t(e);return[function(t,e){r&&t&&r.observe(t,e)},function(){return r&&r.disconnect()}]},applyPerformance=function(r){var t=r&&r.timing||void 0;return[t,function(){return r&&r.now?r.now():(Date.now?Date.now():+new Date)-(t&&t.navigationStart||0)},function(t){var e=(r||{}).getEntriesByType;return isFunction(e)&&e.call(r,t)||[]},function(){var t=(r||{}).clearResourceTimings;isFunction(t)&&t.call(r)},function(t){var e=(r||{}).getEntriesByName;return isFunction(e)&&e.call(r,t)||[]}]},UNKNOWN_PATH="<unknown>";function htmlTreeAsString(t){try{for(var e,r=t,n=[],o=0,i=0,u=" > ".length;r&&o++<5&&!("html"===(e=_htmlElementAsString(r))||1<o&&256<=i+n.length*u+e.length);)n.push(e),i+=e.length,r=r.parentNode;return n.reverse().join(" > ")}catch(t){return UNKNOWN_PATH}}function _htmlElementAsString(t){var e,r,n,o,i=t,u=[];if(!i||!i.tagName)return"";if(u.push(i.tagName.toLowerCase()),i.id)return"#"+i.id;t=i.className;if(t&&isString(t))for(r=t.split(/\s+/),c=0;c<r.length;c++)u.push("."+r[c]);for(var a=["type","name","title","alt"],c=0;c<a.length;c++)n=a[c],(o=i.getAttribute(n))&&u.push("["+n+'="'+o+'"]');for(var s=i,l=1,f=!0;s=s.previousElementSibling;)(null===(e=s.tagName)||void 0===e?void 0:e.toLowerCase())===(null===(e=i.tagName)||void 0===e?void 0:e.toLowerCase())&&(s.className===i.className&&a.every(function(t){return i.getAttribute(t)===(null==s?void 0:s.getAttribute(t))})&&(f=!1),l++);return 1<l&&!f&&u.push(":nth-of-type("+l+")"),u.join("")}var addListenerToDocument=function(t,e,r,n){return void 0===n&&(n=!1),t.addEventListener(e,r,n),function(){t.removeEventListener(e,r,n)}},XHR_SUBJECT_NAME="xhr_0",getReportPathRegExp=function(){var e=new RegExp("\\/monitor_web\\/collect|\\/monitor_browser\\/collect\\/batch","i");return function(t){return e.test(t)}},hookOpen=function(n){return function(){for(var t,e=[],r=0;r<arguments.length;r++)e[r]=arguments[r];return t=__read(e,2),this._method=t[0],this._url=t[1],n.apply(this,e)}},hookSetHeader=function(o){return function(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];this._reqHeaders=this._reqHeaders||{};var r=__read(t,2),n=r[0],r=r[1];return this._reqHeaders[n]=r,o&&o.apply(this,t)}},hookOnreadystatechange=function(n,o){return hookMethodDangerously(n,"onreadystatechange",function(r){return function(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];return 4===this.readyState&&o(n),r&&r.apply(this,t)}})},hookSend=function(n,o){var i=getReportPathRegExp();return function(){for(var t,e=[],r=0;r<arguments.length;r++)e[r]=arguments[r];return this._start=now(),this._data=null==e?void 0:e[0],i(this._url)||(t=o([this._method,this._url,this._start,this]),hookOnreadystatechange(this,t)()),n.apply(this,e)}},applyXHR=function(n){return function(t,e){var r;n&&((r=[]).push(hookMethodDangerously(n,"open",hookOpen)()),r.push(hookMethodDangerously(n,"setRequestHeader",hookSetHeader)()),r.push(hookMethodDangerously(n,"send",hookSend)(t)),e(function(){r.forEach(function(t){return t()})}))}},FETCH_SUBJECT_NAME="fetch_0",hookFetch=function(n,o){return function(t,e){var r=o([t,e=void 0===e?{}:e]),e=n(t,e);return e.then(function(t){r(t)},function(){r(void 0)}),e}},observeFetch=function(t,e){var r,n=getDefaultBrowser();n&&fetch&&((r=[]).push(hookMethodDangerously(n,"fetch",hookFetch)(t)),e(function(){r.forEach(function(t){return t()})}))},fetchSubject=[FETCH_SUBJECT_NAME,observeFetch],RESOURCE_TYPE=["resource"],LONGTASK_TYPE=["longtask"],applyPerformanceObserver=function(n,o,i){var u=n&&new n(function(t,n){t.getEntries?t.getEntries().forEach(function(t,e,r){return o(t,e,r,n)}):i&&i()});return[function(t){if(!n||!u)return i&&i();try{u.observe({entryTypes:t})}catch(t){return i&&i()}},function(t,e){if(!n||!u)return i&&i();try{var r={type:t,buffered:!0};isUndefined(e)||(r.durationThreshold=e),u.observe(r)}catch(t){return i&&i()}u.observe({type:t,buffered:!1})},function(){return u&&u.disconnect()}]},observePerf=function(t,e,r){t=__read(applyPerformanceObserver(t,e),3),e=t[0],t=t[2];return e(r),t},LONGTASK_SUBJECT_NAME="longtask_0",observeLongtask=function(t,e){var r=getDefaultPerformanceObserver();r&&e(observePerf(r,t,LONGTASK_TYPE))},longtaskSubject=[LONGTASK_SUBJECT_NAME,observeLongtask],RESOURCE_SUBJECT_NAME="resource_0",observeResource=function(e,t){var r,n=getDefaultPerformanceObserver();n&&(r=getReportPathRegExp(),t(observePerf(n,function(t){r(t.name)||e(t)},RESOURCE_TYPE)))},resourceSubject=[RESOURCE_SUBJECT_NAME,observeResource],PAGEVIEW_EV_TYPE="pageview",JS_ERROR_EV_TYPE="js_error",HTTP_EV_TYPE="http",RESOURCE_ERROR_EV_TYPE="resource_error",RESOURCE_EV_TYPE="resource",LONG_TASK_EV_TYPE="performance_longtask",ACTION_EV_TYPE="action",PAGE_ACTIVITY_DELAY=100,ROOT_TAGS=["BODY","HTML","HEAD"],SVG_TAG="SVG",DEFAULT_ATTR_NAME="data-apm-action",waitActionComplete=function(t,e,r,n){function o(){t.clearTimeout(i),a&&(i=t.setTimeout(function(){e()},PAGE_ACTIVITY_DELAY))}var i,u,a=!1;return[function(){a=!0,t.clearTimeout(u),u=t.setTimeout(function(){e(!0),r()},n),o()},o,function(){a=!1,t.clearTimeout(i),t.clearTimeout(u)}]},isSupportsElementClosest=function(){var t;return function(){return void 0===t?t="closest"in HTMLElement.prototype:t}}(),findElementWithAttributeByParents=function(t,e,r){void 0===r&&(r=10);for(var n=t,o=0;o<r&&n;o++){if(~ROOT_TAGS.indexOf(n.nodeName))return;if(n.hasAttribute(e))return n;n=n.parentElement}},getActionNameByAttribute=function(t,e){t=isSupportsElementClosest()?t.closest("["+e+"]"):findElementWithAttributeByParents(t,e);if(t)return t.getAttribute(e).trim()},getActionName=function(t,e){return getActionNameByAttribute(t,e)||t.innerText},isSVGTarget=function(t){for(var e=t,r=!1;e;)e.tagName.toUpperCase()===SVG_TAG?r=!(e=null):e=e.parentElement;return r},isElementWithinTwoLevels=function(t){t=t.children;return!t.length||![].slice.call(t).some(function(t){return 0<t.children.length})},isValidTarget=function(t){var e=t.tagName.toUpperCase();return 1===t.nodeType&&!ROOT_TAGS.includes(e)&&!isSVGTarget(t)&&((!t.style||"none"!==t.style.display)&&(!(!["A","BUTTON","INPUT","TEXTAREA"].includes(e)&&!getActionNameByAttribute(t,DEFAULT_ATTR_NAME))||!!isElementWithinTwoLevels(t)))},shouldIgnoreUrl=function(t,e){return!!(t&&t.length&&e&&checkIfHit(t,getFullUrl(e)))},shouldIgnoreEvent=function(t,e){var r;return e.ev_type===HTTP_EV_TYPE?r=e.payload.request.url:e.ev_type===RESOURCE_EV_TYPE&&"name"in e.payload?r=e.payload.name:e.ev_type===RESOURCE_ERROR_EV_TYPE&&(r=e.payload.url),shouldIgnoreUrl(t,r)},SUPPORT_TYPES=["click"],EVENT_LISTENER_OPTIONS={capture:!0},MIN_LONG_TASK=50,MAX_ACTIVITY_DELAY=1e4,applyIncompleteReq=function(t,e,r,n){var o=__read(e,2),i=o[0],u=o[1],e=__read(applyRecord(),3),o=e[0],a=e[1],c=e[2],s=0;return t.push(i[0](function(t){t=__read(t,2);t[0];t=t[1];if(shouldIgnoreUrl(n,t))return noop;var e=s+=1;return a(e,now()),r(),function(){c(e),r()}})),t.push(u[0](function(t){t=__read(t,1)[0],t="string"==typeof t?t:t.url;if(shouldIgnoreUrl(n,t))return noop;var e=s+=1;return a(e,now()),r(),function(){c(e),r()}})),o},actionGetterWithFetchObserver=function(o,e,t,r){function n(t){var e;!p||!f&&!Object.keys(p.metrics).length||Object.keys(A).length&&!t||(p.metrics[LONG_TASK_EV_TYPE]&&(p.metrics[LONG_TASK_EV_TYPE].duration=T),e=0<h.length?Math.max.apply(Math,__spreadArray([],__read(h),!1))-Math.min.apply(Math,__spreadArray([],__read(h),!1)):0,p.metrics[HTTP_EV_TYPE]&&(p.metrics[HTTP_EV_TYPE].duration=e),t=g()-p.start_time,E&&E({ev_type:ACTION_EV_TYPE,payload:__assign(__assign({},p),{duration:t,frontend_time:t-e})}),i())}function i(){y(),p&&(d={start_time:p.start_time,id:p.id}),p=null,h=[],T=0}function u(t){p&&(p.metrics[t]={count:(null!==(t=null===(t=p.metrics[t])||void 0===t?void 0:t.count)&&void 0!==t?t:0)+1})}var a=__read(t,4),c=a[0],s=a[1],l=a[2],t=a[3],a=r.types,f=r.pure,_=r.ignoreUrls,p=null,d=null,E=void 0,h=[],T=0,g=__read(applyPerformance(performance),2)[1],r=__read(waitActionComplete(window,n,i,MAX_ACTIVITY_DELAY),3),v=r[0],m=r[1],y=r[2],A=applyIncompleteReq(e,[c,s],m,_),c=__read(applyMutationObserver(MutationObserver,m),2),s=c[0],c=c[1];s(),e.push(c),e.push(y),e.push(l[0](function(t){var e=t.startTime,t=t.duration;m(),p&&p.start_time<=e+MIN_LONG_TASK&&(T+=t,u(LONG_TASK_EV_TYPE))})),e.push(t[0](function(t){var e=t.name,r=t.startTime,n=t.duration,t=t.initiatorType;shouldIgnoreUrl(_,e)||(m(),p&&p.start_time<r&&(["xmlhttprequest","fetch"].includes(t)&&(h.push(r,r+n),u(HTTP_EV_TYPE)),["xmlhttprequest","fetch","beacon"].includes(t)||u(RESOURCE_EV_TYPE)))}));function O(t,e){var r=uuid(),n=__read(applyPerformance(performance),2)[1];p={start_time:n(),id:r,type:e,target:t,metrics:{}},E=o(),v()}function N(t){var e;n(!0),i(),t.target instanceof HTMLElement&&isValidTarget(t.target)&&((e=getActionName(t.target,DEFAULT_ATTR_NAME))&&O({name:e,path:htmlTreeAsString(t.target)},t.type))}a&&a.forEach(function(t){arrayIncludes(SUPPORT_TYPES,t)&&e.push(addListenerToDocument(document,t,N,EVENT_LISTENER_OPTIONS))});return[function(t){if(!shouldIgnoreEvent(_,t)){if(t.ev_type===PAGEVIEW_EV_TYPE)return n(!0),void i();if(t.ev_type===HTTP_EV_TYPE)return(e=t.payload.response.timing&&t.payload.response.timing.startTime)?p&&e>p.start_time?p.id:d&&e>d.start_time?d.id:void 0:void 0;if(t.ev_type!==LONG_TASK_EV_TYPE)return p?(t.ev_type!==JS_ERROR_EV_TYPE&&t.ev_type!==RESOURCE_ERROR_EV_TYPE||u(t.ev_type),p.id):void 0;var e=t.payload.longtasks.length&&t.payload.longtasks[0].startTime+MIN_LONG_TASK;return p&&e&&e>p.start_time?p.id:void 0}},function(t,e){n(!0),i(),O({name:t},e)}]},ACTION_MONITOR_PLUGIN_NAME="action",defaultConfig={types:["click"],pure:!0};function ActionMonitorBasePlugin(t,e){void 0===e&&(e=defaultConfig);var r,n,o=[],i=getDefaultDocument(),u=getDefaultBrowser();i&&u&&(e=__read(actionGetterWithFetchObserver(function(){return reportWithCurrentContext(t,!0)},o,[initSubjectInGlobal(t,[XHR_SUBJECT_NAME,applyXHR(XMLHttpRequest&&XMLHttpRequest.prototype)]),initSubjectInGlobal(t,fetchSubject),initSubjectInGlobal(t,longtaskSubject),initSubjectInGlobal(t,resourceSubject)],e),2),r=e[0],e=e[1],t.on("report",n=function(t){var e=r(t);return e&&t.extra&&(t.extra.action_id=e),t}),o.push(function(){t.off("report",n)}),t.provide("startAction",e),registerTearDownGroup(t,ACTION_MONITOR_PLUGIN_NAME,ACTION_EV_TYPE,o))}var ACTION_INTEGRATION_NAME=ACTION_MONITOR_PLUGIN_NAME,actionPlugin=function(e){return{name:ACTION_INTEGRATION_NAME,setup:function(t){ActionMonitorBasePlugin(t,e)}}};exports.ACTION_INTEGRATION_NAME=ACTION_INTEGRATION_NAME,exports.actionPlugin=actionPlugin; |
@@ -984,2 +984,3 @@ interface ContextAgent { | ||
pure?: boolean; | ||
ignoreUrls?: (string | RegExp)[]; | ||
} | ||
@@ -986,0 +987,0 @@ |
@@ -1,1 +0,1 @@ | ||
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var __assign=function(){return(__assign=Object.assign||function(e){for(var n,t=1,r=arguments.length;t<r;t++)for(var o in n=arguments[t])Object.prototype.hasOwnProperty.call(n,o)&&(e[o]=n[o]);return e}).apply(this,arguments)};function __read(e,n){var t="function"==typeof Symbol&&e[Symbol.iterator];if(!t)return e;var r,o,i=t.call(e),u=[];try{for(;(void 0===n||0<n--)&&!(r=i.next()).done;)u.push(r.value)}catch(e){o={error:e}}finally{try{r&&!r.done&&(t=i.return)&&t.call(i)}finally{if(o)throw o.error}}return u}var noop=function(){return{}};function isObject(e){return"object"==typeof e&&null!==e}function isUndefined(e){return void 0===e}function isFunction(e){return"function"==typeof e}function isNumber(e){return"number"==typeof e}var registerTearDownGroup=function(e,n,t,r){return e.destroyAgent.set(n,t,r)};function initSubjectInGlobal(e,n){return e.initSubject(n)}var now=function(){return Date.now()};function getDefaultBrowser(){if("object"==typeof window&&isObject(window))return window}function getDefaultDocument(){if("object"==typeof document&&isObject(document))return document}function getDefaultPromise(){if(getDefaultBrowser()&&"Promise"in window)return Promise}function getDefaultMutationObserver(){if(getDefaultBrowser()&&isFunction(window.MutationObserver))return window.MutationObserver}function getDefaultPerformanceObserver(){if(getDefaultBrowser()&&isFunction(window.PerformanceObserver))return window.PerformanceObserver}var applyMutationObserver=function(e,n){var t=e&&new e(n);return[function(e,n){t&&e&&t.observe(e,n)},function(){return t&&t.disconnect()}]},applyPerformance=function(t){var e=t&&t.timing||void 0;return[e,function(){return t&&t.now?t.now():(Date.now?Date.now():+new Date)-(e&&e.navigationStart||0)},function(e){var n=(t||{}).getEntriesByType;return isFunction(n)&&n.call(t,e)||[]},function(){var e=(t||{}).clearResourceTimings;isFunction(e)&&e.call(t)},function(e){var n=(t||{}).getEntriesByName;return isFunction(n)&&n.call(t,e)||[]}]},applyRequestIdleCallback=function(n){return n.requestIdleCallback||function(e){return n.setTimeout(e,1)}},addListenerToWindow=function(e,n,t,r){return void 0===r&&(r=!1),e.addEventListener(n,t,r),function(){e.removeEventListener(n,t,r)}},addListenerToDocument=function(e,n,t,r){return void 0===r&&(r=!1),e.addEventListener(n,t,r),function(){e.removeEventListener(n,t,r)}},invokeCallbackOnce=function(n){var t=!1;return[function(e){t||(t=!0,n&&n(e))}]},getConfig=function(e,n){return isObject(e)?__assign(__assign({},n),e):!!e&&n},RESOURCE_TYPE=["resource"],LONGTASK_TYPE=["longtask"],applyPerformanceObserver=function(r,o,i){var u=r&&new r(function(e,r){e.getEntries?e.getEntries().forEach(function(e,n,t){return o(e,n,t,r)}):i&&i()});return[function(e){if(!r||!u)return i&&i();try{u.observe({entryTypes:e})}catch(e){return i&&i()}},function(e,n){if(!r||!u)return i&&i();try{var t={type:e,buffered:!0};isUndefined(n)||(t.durationThreshold=n),u.observe(t)}catch(e){return i&&i()}u.observe({type:e,buffered:!1})},function(){return u&&u.disconnect()}]},observePerf=function(e,n,t){e=__read(applyPerformanceObserver(e,n),3),n=e[0],e=e[2];return n(t),e},LONGTASK_SUBJECT_NAME="longtask_0",observeLongtask=function(e,n){var t=getDefaultPerformanceObserver();t&&n(observePerf(t,e,LONGTASK_TYPE))},longtaskSubject=[LONGTASK_SUBJECT_NAME,observeLongtask],RESOURCE_SUBJECT_NAME="resource_0",observeResource=function(e,n){var t=getDefaultPerformanceObserver();t&&n(observePerf(t,e,RESOURCE_TYPE))},resourceSubject=[RESOURCE_SUBJECT_NAME,observeResource],JS_ERROR_EV_TYPE="js_error",HTTP_EV_TYPE="http",RESOURCE_ERROR_EV_TYPE="resource_error",CUSTOM_EV_TYPE="custom",PERFORMANCE_METRIC_EV_TYPE="performance",PERFORMANCE_TIMING_EV_TYPE="performance_timing",LONG_TASK_EV_TYPE="performance_longtask",BLANK_SCREEN_EV_TYPE="blank_screen";function getPluginConfig(e,n,t){n=null===(e=e.config())||void 0===e?void 0:e.plugins[n];return getConfig(n,t)}var UNLOAD_SUBJECT_NAME="unload_0",observeUnload=function(e,n){var t,r,o,i=getDefaultBrowser();i&&(t=__read(invokeCallbackOnce(e),1)[0],r=function(){t()},o=[],["unload","beforeunload","pagehide"].forEach(function(e){o.push(addListenerToWindow(i,e,r,!1))}),n(function(){o.forEach(function(e){return e()})}))},unloadSubject=[UNLOAD_SUBJECT_NAME,observeUnload],DOM_CONTENT_LOAD_SUBJECT_NAME="domLoad_1",observeDOMContentLoad=function(e,n){var t,r,o=getDefaultBrowser(),i=getDefaultDocument();o&&i&&(t=!1,r=noop,o=function(){setTimeout(function(){e(),t=!0},0)},"loading"!==i.readyState?o():r=addListenerToDocument(i,"DOMContentLoaded",o,!1),n(function(){r()},function(e){t&&e()}))},DOMContentLoadSubject=[DOM_CONTENT_LOAD_SUBJECT_NAME,observeDOMContentLoad],DEFAULT_IGNORE_TAGS=["SCRIPT","STYLE","META","HEAD"],ERROR_RELATED_TYPE=[JS_ERROR_EV_TYPE,HTTP_EV_TYPE,RESOURCE_ERROR_EV_TYPE],DEFAULT_THRESHOLD=1.5,MAX_RENDER_TIME=1e4,MAX_CHECK_TIME=8e3,DEFAULT_CHECK_TIME=4e3,MAX_RELATED_TIME=1e4,DEFAULT_T0_DATA_URL_QUALITY=.1,DEFAULT_MAX_DEPTH=4,CHECK_EXCLUSIVE_EV_TYPES=[PERFORMANCE_METRIC_EV_TYPE,LONG_TASK_EV_TYPE,PERFORMANCE_TIMING_EV_TYPE,CUSTOM_EV_TYPE],isSkipBeforeCheck=function(e){return~CHECK_EXCLUSIVE_EV_TYPES.indexOf(e.ev_type)},blankErrorCompare=function(e,n){if(-1===ERROR_RELATED_TYPE.indexOf(n.ev_type))return e;if(n.ev_type===HTTP_EV_TYPE&&n.payload.response.status<400)return e;if(e&&ERROR_RELATED_TYPE.indexOf(e.type)<ERROR_RELATED_TYPE.indexOf(n.ev_type))return e;var t="";switch(n.ev_type){case JS_ERROR_EV_TYPE:t=n.payload.error.message;break;case HTTP_EV_TYPE:t=n.payload.request.url;break;case RESOURCE_ERROR_EV_TYPE:t=n.payload.url}return{type:n.ev_type,message:t,timestamp:now()}},isSkipMeasure=function(e,n){return~DEFAULT_IGNORE_TAGS.indexOf(e.tagName)||DEFAULT_MAX_DEPTH<n},getBounding=function(e){e=e.getBoundingClientRect();return{width:e.width,height:e.height,top:e.top}},getElementByRootSelector=function(e){return e?document.querySelector(e):document.body},measure=function(t,r,e,o){if(void 0===r&&(r=0),void 0===e&&(e=0),void 0===o&&(o=DEFAULT_THRESHOLD),!t||isSkipMeasure(t,r)||o<=e)return e;var n=function(){if(!r)return 0;var e=getBounding(t),n=e.top,e=e.height;return n>innerHeight||e<=0?0:1/(1<<r-1)}();return[].reduceRight.call(t.children,function(e,n){return measure(n,r+1,e,o)},e+n)};function serializeDom2String(e,t,n){if(void 0===t&&(t=0),void 0===n&&(n=!0),!e||isSkipMeasure(e,t))return"";var r=__assign(__assign({},getBounding(e)),{id:e.getAttribute("id"),class:e.getAttribute("class")}),o=Object.keys(r).reduce(function(e,n){return e+(isNumber(r[n])||r[n]?" "+n+'="'+r[n]+'"':"")},""),i=e.tagName.toLowerCase(),e=[].reduce.call(e.children,function(e,n){return e+serializeDom2String(n,t+1,!1)},"");return"<"+i+o+(n?' innerHeight="'+innerHeight+'"':"")+">"+e+"</"+i+">"}var screenshot=function(e){var n=e.cb,t=e.screenshotUrl,r=e.window,o=e.document,i=e.mask,u=e.partialShot,a=e.quality,c=e.rootSelector;if(getDefaultPromise()&&r&&o){if(r.html2canvas)return s();e=o.createElement("script");e.src=t,null!==(t=o.head)&&void 0!==t&&t.appendChild(e),e.onload=s,e.onerror=function(){n()}}function s(){applyRequestIdleCallback(r)(function(){r.html2canvas&&r.html2canvas(u&&c&&o.querySelector(c)||o.body,{scale:360/r.innerWidth,mask:i}).then(function(e){n(handleBase64(e.toDataURL("image/jpeg",a)))}).catch(function(){n(getBlankImageBase64())})})}};function handleBase64(e){return"data:image"===e.slice(0,10)?e:getBlankImageBase64()}function getBlankImageBase64(e,n){void 0===e&&(e=192),void 0===n&&(n=108);var t=document.createElement("canvas");t.width=e,t.height=n;var r=t.getContext("2d");return r&&(r.fillStyle="#ffffff",r.fillRect(0,0,e,n)),t.toDataURL("image/jpeg")}var blankScreenGetterWithObserver=function(t,r,e,n){function o(e,n){y||(u=B())&&(y=!0,r.forEach(function(e){return e()}),r.length=0,t({ev_type:BLANK_SCREEN_EV_TYPE,payload:{timestamp:u[0],score:u[1],screenshot:n,error:a,serialized_dom:serializeDom2String(getElementByRootSelector(R))},overrides:{timestamp:e||u[0]}}))}function i(){E&&clearTimeout(E),c&&clearTimeout(c),c=N.setTimeout(function(){s=C(function(){(u=B())&&U()})},1e3)}var u,a,c,s,E,_,l,f=__read(e,4),d=f[0],T=f[1],v=f[2],g=f[3],m=n.threshold,e=n.screenshot,R=n.rootSelector,f=n.autoDetect,p=n.ssUrl,S=n.quality,b=n.mask,O=n.partialShot,A=n.initDetTime,D=n.runDetTime,N=getDefaultBrowser(),h=getDefaultDocument(),C=N.requestAnimationFrame||noop,P=N.cancelAnimationFrame||noop,L=__read(applyPerformance(performance),2)[1],M=0,y=!1,w=!e,B=function(){var e=getElementByRootSelector(R);if(e){e=measure(e,0,0,m);return e<m?[now(),e]:void 0}},U=(_=function(){u&&!y&&(w?o():(w=!0,screenshot({cb:o.bind(null,now()),screenshotUrl:p,window:N,document:h,mask:b,partialShot:O,quality:S,rootSelector:R})))},function(){E&&clearTimeout(E),l=now(),E=N.setTimeout(function(){(l<M?i:_)()},L()>MAX_RENDER_TIME?D:A)});return r.push(g[0](function(){a&&o()})),f&&r.push(d[0](function(){var e=__read(applyMutationObserver(getDefaultMutationObserver(),i),2),n=e[0],t=e[1];r.push(function(){clearTimeout(c),clearTimeout(E),P(s),t&&t()}),n(null===(n=getDefaultDocument())||void 0===n?void 0:n.body,{subtree:!0,childList:!0}),r.push(T()[0](function(){c&&i()})),r.push(v()[0](function(){c&&i()})),i()})),[function(e){y||isSkipBeforeCheck(e)||(M=now(),a&&M-a.timestamp>MAX_RELATED_TIME&&(a=void 0),a=blankErrorCompare(a,e))},i]},BLANK_SCREEN_MONITOR_PLUGIN_NAME="blankScreen";function BlankScreenMonitorBasePlugin(e,n){var t,r,o=getDefaultDocument(),i=getDefaultBrowser();o&&i&&(i=[],n=__read(blankScreenGetterWithObserver(e.report.bind(e),i,[initSubjectInGlobal(e,DOMContentLoadSubject),function(){return initSubjectInGlobal(e,longtaskSubject)},function(){return initSubjectInGlobal(e,resourceSubject)},initSubjectInGlobal(e,unloadSubject)],n),2),t=n[0],n=n[1],e.on("report",r=function(e){return t(e),e}),i.push(function(){e.off("report",r)}),registerTearDownGroup(e,BLANK_SCREEN_MONITOR_PLUGIN_NAME,BLANK_SCREEN_EV_TYPE,i),e.provide("detectBlankScreen",n))}function BlankScreenMonitorVolPlugin(n,t){n.on("init",function(){var e={autoDetect:!0,threshold:DEFAULT_THRESHOLD,screenshot:!0,ssUrl:"https://apm.volccdn.com/mars-web/apmplus/web/html2canvas.min.js",mask:!1,partialShot:!0,quality:DEFAULT_T0_DATA_URL_QUALITY,initDetTime:MAX_CHECK_TIME,runDetTime:DEFAULT_CHECK_TIME},e=t?getConfig(t,e):getPluginConfig(n,BLANK_SCREEN_MONITOR_PLUGIN_NAME,e);e&&BlankScreenMonitorBasePlugin(n,e)})}var BLANK_SCREEN_INTEGRATION_NAME=BLANK_SCREEN_MONITOR_PLUGIN_NAME,blankScreenPlugin=function(n){return void 0===n&&(n={}),{name:BLANK_SCREEN_INTEGRATION_NAME,setup:function(e){BlankScreenMonitorVolPlugin(e,n)}}};exports.BLANK_SCREEN_INTEGRATION_NAME=BLANK_SCREEN_INTEGRATION_NAME,exports.blankScreenPlugin=blankScreenPlugin; | ||
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var __assign=function(){return(__assign=Object.assign||function(e){for(var n,t=1,r=arguments.length;t<r;t++)for(var o in n=arguments[t])Object.prototype.hasOwnProperty.call(n,o)&&(e[o]=n[o]);return e}).apply(this,arguments)};function __read(e,n){var t="function"==typeof Symbol&&e[Symbol.iterator];if(!t)return e;var r,o,i=t.call(e),u=[];try{for(;(void 0===n||0<n--)&&!(r=i.next()).done;)u.push(r.value)}catch(e){o={error:e}}finally{try{r&&!r.done&&(t=i.return)&&t.call(i)}finally{if(o)throw o.error}}return u}var noop=function(){return{}};function isObject(e){return"object"==typeof e&&null!==e}function isUndefined(e){return void 0===e}function isFunction(e){return"function"==typeof e}function isNumber(e){return"number"==typeof e}var registerTearDownGroup=function(e,n,t,r){return e.destroyAgent.set(n,t,r)};function initSubjectInGlobal(e,n){return e.initSubject(n)}var now=function(){return Date.now()};function getDefaultBrowser(){if("object"==typeof window&&isObject(window))return window}function getDefaultDocument(){if("object"==typeof document&&isObject(document))return document}function getDefaultPromise(){if(getDefaultBrowser()&&"Promise"in window)return Promise}function getDefaultMutationObserver(){if(getDefaultBrowser()&&isFunction(window.MutationObserver))return window.MutationObserver}function getDefaultPerformanceObserver(){if(getDefaultBrowser()&&isFunction(window.PerformanceObserver))return window.PerformanceObserver}var applyMutationObserver=function(e,n){var t=e&&new e(n);return[function(e,n){t&&e&&t.observe(e,n)},function(){return t&&t.disconnect()}]},applyPerformance=function(t){var e=t&&t.timing||void 0;return[e,function(){return t&&t.now?t.now():(Date.now?Date.now():+new Date)-(e&&e.navigationStart||0)},function(e){var n=(t||{}).getEntriesByType;return isFunction(n)&&n.call(t,e)||[]},function(){var e=(t||{}).clearResourceTimings;isFunction(e)&&e.call(t)},function(e){var n=(t||{}).getEntriesByName;return isFunction(n)&&n.call(t,e)||[]}]},applyRequestIdleCallback=function(n){return n.requestIdleCallback||function(e){return n.setTimeout(e,1)}},addListenerToWindow=function(e,n,t,r){return void 0===r&&(r=!1),e.addEventListener(n,t,r),function(){e.removeEventListener(n,t,r)}},addListenerToDocument=function(e,n,t,r){return void 0===r&&(r=!1),e.addEventListener(n,t,r),function(){e.removeEventListener(n,t,r)}},invokeCallbackOnce=function(n){var t=!1;return[function(e){t||(t=!0,n&&n(e))}]},getConfig=function(e,n){return isObject(e)?__assign(__assign({},n),e):!!e&&n},getReportPathRegExp=function(){var n=new RegExp("\\/monitor_web\\/collect|\\/monitor_browser\\/collect\\/batch","i");return function(e){return n.test(e)}},RESOURCE_TYPE=["resource"],LONGTASK_TYPE=["longtask"],applyPerformanceObserver=function(r,o,i){var u=r&&new r(function(e,r){e.getEntries?e.getEntries().forEach(function(e,n,t){return o(e,n,t,r)}):i&&i()});return[function(e){if(!r||!u)return i&&i();try{u.observe({entryTypes:e})}catch(e){return i&&i()}},function(e,n){if(!r||!u)return i&&i();try{var t={type:e,buffered:!0};isUndefined(n)||(t.durationThreshold=n),u.observe(t)}catch(e){return i&&i()}u.observe({type:e,buffered:!1})},function(){return u&&u.disconnect()}]},observePerf=function(e,n,t){e=__read(applyPerformanceObserver(e,n),3),n=e[0],e=e[2];return n(t),e},LONGTASK_SUBJECT_NAME="longtask_0",observeLongtask=function(e,n){var t=getDefaultPerformanceObserver();t&&n(observePerf(t,e,LONGTASK_TYPE))},longtaskSubject=[LONGTASK_SUBJECT_NAME,observeLongtask],RESOURCE_SUBJECT_NAME="resource_0",observeResource=function(n,e){var t,r=getDefaultPerformanceObserver();r&&(t=getReportPathRegExp(),e(observePerf(r,function(e){t(e.name)||n(e)},RESOURCE_TYPE)))},resourceSubject=[RESOURCE_SUBJECT_NAME,observeResource],JS_ERROR_EV_TYPE="js_error",HTTP_EV_TYPE="http",RESOURCE_ERROR_EV_TYPE="resource_error",CUSTOM_EV_TYPE="custom",PERFORMANCE_METRIC_EV_TYPE="performance",PERFORMANCE_TIMING_EV_TYPE="performance_timing",LONG_TASK_EV_TYPE="performance_longtask",BLANK_SCREEN_EV_TYPE="blank_screen";function getPluginConfig(e,n,t){n=null===(e=e.config())||void 0===e?void 0:e.plugins[n];return getConfig(n,t)}var UNLOAD_SUBJECT_NAME="unload_0",observeUnload=function(e,n){var t,r,o,i=getDefaultBrowser();i&&(t=__read(invokeCallbackOnce(e),1)[0],r=function(){t()},o=[],["unload","beforeunload","pagehide"].forEach(function(e){o.push(addListenerToWindow(i,e,r,!1))}),n(function(){o.forEach(function(e){return e()})}))},unloadSubject=[UNLOAD_SUBJECT_NAME,observeUnload],DOM_CONTENT_LOAD_SUBJECT_NAME="domLoad_1",observeDOMContentLoad=function(e,n){var t,r,o=getDefaultBrowser(),i=getDefaultDocument();o&&i&&(t=!1,r=noop,o=function(){setTimeout(function(){e(),t=!0},0)},"loading"!==i.readyState?o():r=addListenerToDocument(i,"DOMContentLoaded",o,!1),n(function(){r()},function(e){t&&e()}))},DOMContentLoadSubject=[DOM_CONTENT_LOAD_SUBJECT_NAME,observeDOMContentLoad],ACTIVATED_SUBJECT_NAME="activated_0",observeActivated=function(e,n){var t,r,o,i=getDefaultDocument();i&&(t=!1,r=noop,o=function(){e(),t=!0},i&&i.prerendering?r=addListenerToDocument(i,"prerenderingchange",o,!0):o(),n(function(){r()},function(e){t&&e()}))},activatedSubject=[ACTIVATED_SUBJECT_NAME,observeActivated],DEFAULT_IGNORE_TAGS=["SCRIPT","STYLE","META","HEAD"],ERROR_RELATED_TYPE=[JS_ERROR_EV_TYPE,HTTP_EV_TYPE,RESOURCE_ERROR_EV_TYPE],DEFAULT_THRESHOLD=1.5,MAX_RENDER_TIME=1e4,MAX_CHECK_TIME=8e3,DEFAULT_CHECK_TIME=4e3,MAX_RELATED_TIME=1e4,DEFAULT_T0_DATA_URL_QUALITY=.1,DEFAULT_MAX_DEPTH=4,CHECK_EXCLUSIVE_EV_TYPES=[PERFORMANCE_METRIC_EV_TYPE,LONG_TASK_EV_TYPE,PERFORMANCE_TIMING_EV_TYPE,CUSTOM_EV_TYPE],isSkipBeforeCheck=function(e){return~CHECK_EXCLUSIVE_EV_TYPES.indexOf(e.ev_type)},blankErrorCompare=function(e,n){if(-1===ERROR_RELATED_TYPE.indexOf(n.ev_type))return e;if(n.ev_type===HTTP_EV_TYPE&&n.payload.response.status<400)return e;if(e&&ERROR_RELATED_TYPE.indexOf(e.type)<ERROR_RELATED_TYPE.indexOf(n.ev_type))return e;var t="";switch(n.ev_type){case JS_ERROR_EV_TYPE:t=n.payload.error.message;break;case HTTP_EV_TYPE:t=n.payload.request.url;break;case RESOURCE_ERROR_EV_TYPE:t=n.payload.url}return{type:n.ev_type,message:t,timestamp:now()}},isSkipMeasure=function(e,n){return~DEFAULT_IGNORE_TAGS.indexOf(e.tagName)||DEFAULT_MAX_DEPTH<n},getBounding=function(e){e=e.getBoundingClientRect();return{width:e.width,height:e.height,top:e.top}},getElementByRootSelector=function(e){return e?document.querySelector(e):document.body},measure=function(t,r,e,o){if(void 0===r&&(r=0),void 0===e&&(e=0),void 0===o&&(o=DEFAULT_THRESHOLD),!t||isSkipMeasure(t,r)||o<=e)return e;var n=function(){if(!r)return 0;var e=getBounding(t),n=e.top,e=e.height;return n>innerHeight||e<=0?0:1/(1<<r-1)}();return[].reduceRight.call(t.children,function(e,n){return measure(n,r+1,e,o)},e+n)};function serializeDom2String(e,t,n){if(void 0===t&&(t=0),void 0===n&&(n=!0),!e||isSkipMeasure(e,t))return"";var r=__assign(__assign({},getBounding(e)),{id:e.getAttribute("id"),class:e.getAttribute("class")}),o=Object.keys(r).reduce(function(e,n){return e+(isNumber(r[n])||r[n]?" "+n+'="'+r[n]+'"':"")},""),i=e.tagName.toLowerCase(),e=[].reduce.call(e.children,function(e,n){return e+serializeDom2String(n,t+1,!1)},"");return"<"+i+o+(n?' innerHeight="'+innerHeight+'"':"")+">"+e+"</"+i+">"}var screenshot=function(e){var n=e.cb,t=e.screenshotUrl,r=e.window,o=e.document,i=e.mask,u=e.partialShot,a=e.quality,c=e.rootSelector;if(getDefaultPromise()&&r&&o){if(r.html2canvas)return s();e=o.createElement("script");e.src=t,null!==(t=o.head)&&void 0!==t&&t.appendChild(e),e.onload=s,e.onerror=function(){n()}}function s(){applyRequestIdleCallback(r)(function(){r.html2canvas&&r.html2canvas(u&&c&&o.querySelector(c)||o.body,{scale:360/r.innerWidth,mask:i}).then(function(e){n(handleBase64(e.toDataURL("image/jpeg",a)))}).catch(function(){n(getBlankImageBase64())})})}};function handleBase64(e){return"data:image"===e.slice(0,10)?e:getBlankImageBase64()}function getBlankImageBase64(e,n){void 0===e&&(e=192),void 0===n&&(n=108);var t=document.createElement("canvas");t.width=e,t.height=n;var r=t.getContext("2d");return r&&(r.fillStyle="#ffffff",r.fillRect(0,0,e,n)),t.toDataURL("image/jpeg")}var blankScreenGetterWithObserver=function(t,r,e,n){function o(e,n){w||(u=U())&&(w=!0,r.forEach(function(e){return e()}),r.length=0,t({ev_type:BLANK_SCREEN_EV_TYPE,payload:{timestamp:u[0],score:u[1],screenshot:n,error:a,serialized_dom:serializeDom2String(getElementByRootSelector(R))},overrides:{timestamp:e||u[0]}}))}function i(){E&&clearTimeout(E),c&&clearTimeout(c),c=h.setTimeout(function(){s=P(function(){(u=U())&&I()})},1e3)}var u,a,c,s,E,_,f,l=__read(e,5),d=l[0],T=l[1],v=l[2],g=l[3],m=l[4],p=n.threshold,e=n.screenshot,R=n.rootSelector,l=n.autoDetect,b=n.ssUrl,S=n.quality,A=n.mask,O=n.partialShot,D=n.initDetTime,N=n.runDetTime,h=getDefaultBrowser(),C=getDefaultDocument(),P=h.requestAnimationFrame||noop,L=h.cancelAnimationFrame||noop,M=__read(applyPerformance(performance),2)[1],y=0,w=!1,B=!e,U=function(){var e=getElementByRootSelector(R);if(e){e=measure(e,0,0,p);return e<p?[now(),e]:void 0}},I=(_=function(){u&&!w&&(B?o():(B=!0,screenshot({cb:o.bind(null,now()),screenshotUrl:b,window:h,document:C,mask:A,partialShot:O,quality:S,rootSelector:R})))},function(){E&&clearTimeout(E),f=now(),E=h.setTimeout(function(){(f<y?i:_)()},M()>MAX_RENDER_TIME?N:D)});return r.push(m[0](function(){a&&o()})),l&&r.push(d[0](function(){var e=T();r.push(e[0](function(){var e=__read(applyMutationObserver(getDefaultMutationObserver(),i),2),n=e[0],t=e[1];r.push(function(){clearTimeout(c),clearTimeout(E),L(s),t&&t()}),n(null===(n=getDefaultDocument())||void 0===n?void 0:n.body,{subtree:!0,childList:!0}),r.push(v()[0](function(){c&&i()})),r.push(g()[0](function(){c&&i()})),i()}))})),[function(e){w||isSkipBeforeCheck(e)||(y=now(),a&&y-a.timestamp>MAX_RELATED_TIME&&(a=void 0),a=blankErrorCompare(a,e))},i]},BLANK_SCREEN_MONITOR_PLUGIN_NAME="blankScreen";function BlankScreenMonitorBasePlugin(e,n){var t,r,o=getDefaultDocument(),i=getDefaultBrowser();o&&i&&(i=[],n=__read(blankScreenGetterWithObserver(e.report.bind(e),i,[initSubjectInGlobal(e,activatedSubject),function(){return initSubjectInGlobal(e,DOMContentLoadSubject)},function(){return initSubjectInGlobal(e,longtaskSubject)},function(){return initSubjectInGlobal(e,resourceSubject)},initSubjectInGlobal(e,unloadSubject)],n),2),t=n[0],n=n[1],e.on("report",r=function(e){return t(e),e}),i.push(function(){e.off("report",r)}),registerTearDownGroup(e,BLANK_SCREEN_MONITOR_PLUGIN_NAME,BLANK_SCREEN_EV_TYPE,i),e.provide("detectBlankScreen",n))}function BlankScreenMonitorVolPlugin(n,t){n.on("init",function(){var e={autoDetect:!0,threshold:DEFAULT_THRESHOLD,screenshot:!0,ssUrl:"https://apm.volccdn.com/mars-web/apmplus/web/html2canvas.min.js",mask:!1,partialShot:!0,quality:DEFAULT_T0_DATA_URL_QUALITY,initDetTime:MAX_CHECK_TIME,runDetTime:DEFAULT_CHECK_TIME},e=t?getConfig(t,e):getPluginConfig(n,BLANK_SCREEN_MONITOR_PLUGIN_NAME,e);e&&BlankScreenMonitorBasePlugin(n,e)})}var BLANK_SCREEN_INTEGRATION_NAME=BLANK_SCREEN_MONITOR_PLUGIN_NAME,blankScreenPlugin=function(n){return void 0===n&&(n={}),{name:BLANK_SCREEN_INTEGRATION_NAME,setup:function(e){BlankScreenMonitorVolPlugin(e,n)}}};exports.BLANK_SCREEN_INTEGRATION_NAME=BLANK_SCREEN_INTEGRATION_NAME,exports.blankScreenPlugin=blankScreenPlugin; |
@@ -984,2 +984,3 @@ interface ContextAgent { | ||
pure?: boolean; | ||
ignoreUrls?: (string | RegExp)[]; | ||
} | ||
@@ -986,0 +987,0 @@ |
@@ -1,1 +0,1 @@ | ||
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var __assign=function(){return(__assign=Object.assign||function(e){for(var r,t=1,n=arguments.length;t<n;t++)for(var o in r=arguments[t])Object.prototype.hasOwnProperty.call(r,o)&&(e[o]=r[o]);return e}).apply(this,arguments)};function __read(e,r){var t="function"==typeof Symbol&&e[Symbol.iterator];if(!t)return e;var n,o,i=t.call(e),a=[];try{for(;(void 0===r||0<r--)&&!(n=i.next()).done;)a.push(n.value)}catch(e){o={error:e}}finally{try{n&&!n.done&&(t=i.return)&&t.call(i)}finally{if(o)throw o.error}}return a}function __spreadArray(e,r,t){if(t||2===arguments.length)for(var n,o=0,i=r.length;o<i;o++)!n&&o in r||((n=n||Array.prototype.slice.call(r,0,o))[o]=r[o]);return e.concat(n||Array.prototype.slice.call(r))}function id(e){return e}function isObject(e){return"object"==typeof e&&null!==e}function isString(e){return"string"==typeof e}var registerTearDownGroup=function(e,r,t,n){return e.destroyAgent.set(r,t,n)};function initSubjectInGlobal(e,r){return e.initSubject(r)}var now=function(){return Date.now()};function getDefaultDocument(){if("object"==typeof document&&isObject(document))return document}var UNKNOWN_PATH="<unknown>";function htmlTreeAsString(e){try{for(var r,t=e,n=[],o=0,i=0,a=" > ".length;t&&o++<5&&!("html"===(r=_htmlElementAsString(t))||1<o&&256<=i+n.length*a+r.length);)n.push(r),i+=r.length,t=t.parentNode;return n.reverse().join(" > ")}catch(e){return UNKNOWN_PATH}}function _htmlElementAsString(e){var r,t,n,o=e,i=[];if(!o||!o.tagName)return"";i.push(o.tagName.toLowerCase()),o.id&&i.push("#"+o.id);e=o.className;if(e&&isString(e))for(r=e.split(/\s+/),u=0;u<r.length;u++)i.push("."+r[u]);for(var a=["type","name","title","alt"],u=0;u<a.length;u++)(n=o.getAttribute(t=a[u]))&&i.push("["+t+'="'+n+'"]');return i.join("")}var addListenerToDocument=function(e,r,t,n){return void 0===n&&(n=!1),e.addEventListener(r,t,n),function(){e.removeEventListener(r,t,n)}},getConfig=function(e,r){return isObject(e)?__assign(__assign({},r),e):!!e&&r},JS_ERROR_EV_TYPE="js_error",HTTP_EV_TYPE="http";function getPluginConfig(e,r,t){r=null===(e=e.config())||void 0===e?void 0:e.plugins[r];return getConfig(r,t)}var CLICK_EVENT_NAME="click",CLICK_SUBJECT_NAME=CLICK_EVENT_NAME+"_0",DOM_EVENT_TYPE="dom",observeClick=function(e,r){var t,n=getDefaultDocument();n&&(t=addListenerToDocument(n,CLICK_EVENT_NAME,e,!0),r(function(){t()}))},clickSubject=[CLICK_SUBJECT_NAME,observeClick],KEYPRESS_EVENT_NAME="keypress",KEYPRESS_SUBJECT_NAME=KEYPRESS_EVENT_NAME+"_0",observeKeypress=function(e,r){var t,n=getDefaultDocument();n&&(t=addListenerToDocument(n,KEYPRESS_EVENT_NAME,e,!0),r(function(){t()}))},keypressSubject=[KEYPRESS_SUBJECT_NAME,observeKeypress],domBreadcrumb=function(t){return function(e){var r;try{r=e.event.target?htmlTreeAsString(e.event.target):htmlTreeAsString(e.event)}catch(e){r=UNKNOWN_PATH}0!==r.length&&t({type:"dom",category:"ui."+e.name,message:r})}},triggerHandlers=function(r,t){return function(e){if(t)try{r(e)}catch(e){}}},applyDomAndKeyPress=function(o){function i(r,t){var n;return function(e){a=void 0,e&&n!==e&&t({event:n=e,name:r})}}var a;return[i,function(n){return function(e){var r;try{r=e.target}catch(e){return}var t=r&&r.tagName;t&&("INPUT"===t||"TEXTAREA"===t||r.isContentEditable)&&(a||i("input",n)(e),clearTimeout(a),a=window.setTimeout(function(){a=void 0},o))}}]},applyBreadcrumb=function(t,n,o){void 0===t&&(t=20),void 0===n&&(n=id),void 0===o&&(o=function(e,r){return e.slice(-r)});var i=[];return[function(){return i},function(e){var r=n(e);r&&(e=__assign(__assign({},r),{timestamp:e.timestamp||now()}),i=0<=t&&i.length+1>t?o(__spreadArray(__spreadArray([],__read(i),!1),[e],!1),t):__spreadArray(__spreadArray([],__read(i),!1),[e],!1))}]},breadcrumbGetterWithDomObserver=function(e,r,t){var n=__read(r,2),o=n[0],i=n[1],a=t.maxBreadcrumbs,u=t.onAddBreadcrumb,c=t.onMaxBreadcrumbs,r=t.dom,n=__read(applyDomAndKeyPress(100),2),t=n[0],n=n[1],u=__read(applyBreadcrumb(a,u,c),2),c=u[0],u=u[1];return r&&(r=domBreadcrumb(u),e.push(o[0](t(CLICK_EVENT_NAME,triggerHandlers(r,DOM_EVENT_TYPE)))),e.push(i[0](n(triggerHandlers(r,DOM_EVENT_TYPE))))),[c,u]},BREADCRUMB_MONITOR_PLUGIN_NAME="breadcrumb",defaultConfig={maxBreadcrumbs:20,dom:!0};function BreadcrumbMonitorPlugin(i){i.on("init",function(){var e,r,t,n,o=getPluginConfig(i,BREADCRUMB_MONITOR_PLUGIN_NAME,defaultConfig);o&&(o=(r=__read(breadcrumbGetterWithDomObserver(e=[],[initSubjectInGlobal(i,clickSubject),initSubjectInGlobal(i,keypressSubject)],o),2))[0],t=r[1],i.on("report",n=function(e){return e.ev_type===HTTP_EV_TYPE&&t({type:HTTP_EV_TYPE,category:e.payload.api,message:"",data:{method:e.payload.request.method,url:e.payload.request.url,status_code:String(e.payload.response.status)},timestamp:e.payload.request.timestamp}),e}),e.push(function(){i.off("report",n)}),registerTearDownGroup(i,BREADCRUMB_MONITOR_PLUGIN_NAME,JS_ERROR_EV_TYPE,e),i.provide("getBreadcrumbs",o),i.provide("addBreadcrumb",t))})}var BREADCRUMB_INTEGRATION_NAME=BREADCRUMB_MONITOR_PLUGIN_NAME,breadcrumbPlugin=function(){return{name:BREADCRUMB_INTEGRATION_NAME,setup:function(e){BreadcrumbMonitorPlugin(e)}}};exports.BREADCRUMB_INTEGRATION_NAME=BREADCRUMB_INTEGRATION_NAME,exports.breadcrumbPlugin=breadcrumbPlugin; | ||
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var __assign=function(){return(__assign=Object.assign||function(e){for(var r,t=1,n=arguments.length;t<n;t++)for(var o in r=arguments[t])Object.prototype.hasOwnProperty.call(r,o)&&(e[o]=r[o]);return e}).apply(this,arguments)};function __read(e,r){var t="function"==typeof Symbol&&e[Symbol.iterator];if(!t)return e;var n,o,a=t.call(e),i=[];try{for(;(void 0===r||0<r--)&&!(n=a.next()).done;)i.push(n.value)}catch(e){o={error:e}}finally{try{n&&!n.done&&(t=a.return)&&t.call(a)}finally{if(o)throw o.error}}return i}function __spreadArray(e,r,t){if(t||2===arguments.length)for(var n,o=0,a=r.length;o<a;o++)!n&&o in r||((n=n||Array.prototype.slice.call(r,0,o))[o]=r[o]);return e.concat(n||Array.prototype.slice.call(r))}function id(e){return e}function isObject(e){return"object"==typeof e&&null!==e}function isString(e){return"string"==typeof e}var registerTearDownGroup=function(e,r,t,n){return e.destroyAgent.set(r,t,n)};function initSubjectInGlobal(e,r){return e.initSubject(r)}var now=function(){return Date.now()};function getDefaultDocument(){if("object"==typeof document&&isObject(document))return document}var UNKNOWN_PATH="<unknown>";function htmlTreeAsString(e){try{for(var r,t=e,n=[],o=0,a=0,i=" > ".length;t&&o++<5&&!("html"===(r=_htmlElementAsString(t))||1<o&&256<=a+n.length*i+r.length);)n.push(r),a+=r.length,t=t.parentNode;return n.reverse().join(" > ")}catch(e){return UNKNOWN_PATH}}function _htmlElementAsString(e){var r,t,n,o,a=e,i=[];if(!a||!a.tagName)return"";if(i.push(a.tagName.toLowerCase()),a.id)return"#"+a.id;e=a.className;if(e&&isString(e))for(t=e.split(/\s+/),c=0;c<t.length;c++)i.push("."+t[c]);for(var u=["type","name","title","alt"],c=0;c<u.length;c++)n=u[c],(o=a.getAttribute(n))&&i.push("["+n+'="'+o+'"]');for(var s=a,_=1,l=!0;s=s.previousElementSibling;)(null===(r=s.tagName)||void 0===r?void 0:r.toLowerCase())===(null===(r=a.tagName)||void 0===r?void 0:r.toLowerCase())&&(s.className===a.className&&u.every(function(e){return a.getAttribute(e)===(null==s?void 0:s.getAttribute(e))})&&(l=!1),_++);return 1<_&&!l&&i.push(":nth-of-type("+_+")"),i.join("")}var addListenerToDocument=function(e,r,t,n){return void 0===n&&(n=!1),e.addEventListener(r,t,n),function(){e.removeEventListener(r,t,n)}},getConfig=function(e,r){return isObject(e)?__assign(__assign({},r),e):!!e&&r},JS_ERROR_EV_TYPE="js_error",HTTP_EV_TYPE="http",CLICK_EVENT_NAME="click",CLICK_SUBJECT_NAME=CLICK_EVENT_NAME+"_0",DOM_EVENT_TYPE="dom",observeClick=function(e,r){var t,n=getDefaultDocument();n&&(t=addListenerToDocument(n,CLICK_EVENT_NAME,e,!0),r(function(){t()}))},clickSubject=[CLICK_SUBJECT_NAME,observeClick],KEYPRESS_EVENT_NAME="keypress",KEYPRESS_SUBJECT_NAME=KEYPRESS_EVENT_NAME+"_0",observeKeypress=function(e,r){var t,n=getDefaultDocument();n&&(t=addListenerToDocument(n,KEYPRESS_EVENT_NAME,e,!0),r(function(){t()}))},keypressSubject=[KEYPRESS_SUBJECT_NAME,observeKeypress],domBreadcrumb=function(t){return function(e){var r;try{r=e.event.target?htmlTreeAsString(e.event.target):htmlTreeAsString(e.event)}catch(e){r=UNKNOWN_PATH}0!==r.length&&t({type:"dom",category:"ui."+e.name,message:r})}},triggerHandlers=function(r,t){return function(e){if(t)try{r(e)}catch(e){}}},applyDomAndKeyPress=function(o){function a(r,t){var n;return function(e){i=void 0,e&&n!==e&&t({event:n=e,name:r})}}var i;return[a,function(n){return function(e){var r;try{r=e.target}catch(e){return}var t=r&&r.tagName;t&&("INPUT"===t||"TEXTAREA"===t||r.isContentEditable)&&(i||a("input",n)(e),clearTimeout(i),i=window.setTimeout(function(){i=void 0},o))}}]},applyBreadcrumb=function(t,n,o){void 0===t&&(t=20),void 0===n&&(n=id),void 0===o&&(o=function(e,r){return e.slice(-r)});var a=[];return[function(){return a},function(e){var r=n(e);r&&(e=__assign(__assign({},r),{timestamp:e.timestamp||now()}),a=0<=t&&a.length+1>t?o(__spreadArray(__spreadArray([],__read(a),!1),[e],!1),t):__spreadArray(__spreadArray([],__read(a),!1),[e],!1))}]},breadcrumbGetterWithDomObserver=function(e,r,t){var n=__read(r,2),o=n[0],a=n[1],i=t.maxBreadcrumbs,u=t.onAddBreadcrumb,c=t.onMaxBreadcrumbs,r=t.dom,n=__read(applyDomAndKeyPress(100),2),t=n[0],n=n[1],u=__read(applyBreadcrumb(i,u,c),2),c=u[0],u=u[1];return r&&(r=domBreadcrumb(u),e.push(o[0](t(CLICK_EVENT_NAME,triggerHandlers(r,DOM_EVENT_TYPE)))),e.push(a[0](n(triggerHandlers(r,DOM_EVENT_TYPE))))),[c,u]},BREADCRUMB_MONITOR_PLUGIN_NAME="breadcrumb",defaultConfig={maxBreadcrumbs:20,dom:!0};function BreadcrumbMonitorBasePlugin(e,r){var t,n,o,a=getConfig(r,defaultConfig);a&&(a=(r=__read(breadcrumbGetterWithDomObserver(t=[],[initSubjectInGlobal(e,clickSubject),initSubjectInGlobal(e,keypressSubject)],a),2))[0],n=r[1],e.on("report",o=function(e){return e.ev_type===HTTP_EV_TYPE&&n({type:HTTP_EV_TYPE,category:e.payload.api,message:"",data:{method:e.payload.request.method,url:e.payload.request.url,status_code:String(e.payload.response.status)},timestamp:e.payload.request.timestamp}),e}),t.push(function(){e.off("report",o)}),registerTearDownGroup(e,BREADCRUMB_MONITOR_PLUGIN_NAME,JS_ERROR_EV_TYPE,t),e.provide("getBreadcrumbs",a),e.provide("addBreadcrumb",n))}function BreadcrumbMonitorPlugin(r){r.on("init",function(){var e=null===(e=r.config())||void 0===e?void 0:e.plugins[BREADCRUMB_MONITOR_PLUGIN_NAME];BreadcrumbMonitorBasePlugin(r,e)})}var BREADCRUMB_INTEGRATION_NAME=BREADCRUMB_MONITOR_PLUGIN_NAME,breadcrumbPlugin=function(){return{name:BREADCRUMB_INTEGRATION_NAME,setup:function(e){BreadcrumbMonitorPlugin(e)}}};exports.BREADCRUMB_INTEGRATION_NAME=BREADCRUMB_INTEGRATION_NAME,exports.breadcrumbPlugin=breadcrumbPlugin; |
@@ -984,2 +984,3 @@ interface ContextAgent { | ||
pure?: boolean; | ||
ignoreUrls?: (string | RegExp)[]; | ||
} | ||
@@ -986,0 +987,0 @@ |
@@ -984,2 +984,3 @@ interface ContextAgent { | ||
pure?: boolean; | ||
ignoreUrls?: (string | RegExp)[]; | ||
} | ||
@@ -986,0 +987,0 @@ |
@@ -984,2 +984,3 @@ interface ContextAgent { | ||
pure?: boolean; | ||
ignoreUrls?: (string | RegExp)[]; | ||
} | ||
@@ -999,2 +1000,6 @@ | ||
interface SPALoadMonitorConfig { | ||
ignoreUrls?: (string | RegExp)[]; | ||
} | ||
declare type CustomEventData = { | ||
@@ -1245,3 +1250,3 @@ name: string; | ||
declare type WebClient = WithSubject<Client<BrowserReportEvent, any, any, any, any, any, BrowserConfig>>; | ||
declare const SPALoadPlugin: () => { | ||
declare const SPALoadPlugin: (config?: SPALoadMonitorConfig | undefined) => { | ||
name: string; | ||
@@ -1248,0 +1253,0 @@ setup: (client: WebClient) => void; |
@@ -1,1 +0,1 @@ | ||
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var __assign=function(){return(__assign=Object.assign||function(e){for(var t,r=1,n=arguments.length;r<n;r++)for(var o in t=arguments[r])Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o]);return e}).apply(this,arguments)};function __read(e,t){var r="function"==typeof Symbol&&e[Symbol.iterator];if(!r)return e;var n,o,i=r.call(e),u=[];try{for(;(void 0===t||0<t--)&&!(n=i.next()).done;)u.push(n.value)}catch(e){o={error:e}}finally{try{n&&!n.done&&(r=i.return)&&r.call(i)}finally{if(o)throw o.error}}return u}function __spreadArray(e,t,r){if(r||2===arguments.length)for(var n,o=0,i=t.length;o<i;o++)!n&&o in t||((n=n||Array.prototype.slice.call(t,0,o))[o]=t[o]);return e.concat(n||Array.prototype.slice.call(t))}var REFRESH_PRE_START_CONTEXT_INTEGRATION_NAME="refreshPreStartContext",refreshPreStartContext=function(){return{name:REFRESH_PRE_START_CONTEXT_INTEGRATION_NAME,setup:function(n){n.on("start",function(){var r=n.getPreStartQueue();r.forEach(function(e,t){r[t]=__assign(__assign({},e),{overrides:__assign(__assign({},null!==(e=e.overrides)&&void 0!==e?e:{}),{context:(null===(e=n.context)||void 0===e?void 0:e.toString())||{}})})})})}}},noop=function(){return{}};function isObject(e){return"object"==typeof e&&null!==e}function isUndefined(e){return void 0===e}function isInstanceOf(e,t){try{return e instanceof t}catch(e){return!1}}var objProto=Object.prototype;function isPlainObject(e){if(isObject(e)){if("function"!=typeof Object.getPrototypeOf)return"[object Object]"===objProto.toString.call(e);e=Object.getPrototypeOf(e);return e===objProto||null===e}return!1}function isArray(e){return"[object Array]"===objProto.toString.call(e)}function isFunction(e){return"function"==typeof e}function isString(e){return"string"==typeof e}function isError(e){switch(Object.prototype.toString.call(e)){case"[object Error]":case"[object Exception]":case"[object DOMError]":case"[object DOMException]":return!0;default:return e instanceof Error}}function isEvent(e){return"undefined"!=typeof Event&&isInstanceOf(e,Event)}function isErrorEvent(e){return"[object ErrorEvent]"===Object.prototype.toString.call(e)}function isPromiseRejectionEvent(e){return"[object PromiseRejectionEvent]"===Object.prototype.toString.call(e)}function arrayIncludes(e,t){if(!isArray(e))return!1;if(0===e.length)return!1;for(var r=0;r<e.length;){if(e[r]===t)return!0;r++}return!1}var arrayRemove=function(e,t){if(!isArray(e))return e;var r=e.indexOf(t);if(0<=r){t=e.slice();return t.splice(r,1),t}return e},applyRecord=function(){var r={};return[r,function(e,t){return r[e]=t},function(e){return delete r[e]}]},pick=function(r,e){return r&&isObject(r)?e.reduce(function(e,t){return e[t]=r[t],e},{}):r};function getRegexp(e){return isArray(e)&&e.length?joinRegExp(e):null}function joinRegExp(e){for(var t=[],r=e.length,n=0;n<r;n++){var o=e[n];isString(o)?t.push(o.replace(/([.*+?^=!:${}()|[\]/\\])/g,"\\$1")):o&&o.source&&t.push(o.source)}return new RegExp(t.join("|"),"i")}function safeStringify(e){try{return isString(e)?e:JSON.stringify(e)}catch(e){return"[FAILED_TO_STRINGIFY]:"+String(e)}}function safeJoin(e,t){if(!isArray(e))return"";for(var r=[],n=0;n<e.length;n++)try{r.push(String(e[n]))}catch(e){r.push("[value cannot be serialized]")}return r.join(t)}var hookObjectProperty=function(i,u,a,c){return void 0===c&&(c=!0),function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];if(!i)return noop;var r=i[u],n=a.apply(void 0,__spreadArray([r],__read(e),!1)),o=n;return isFunction(o)&&c&&(o=function(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];try{return n.apply(this,t)}catch(e){return isFunction(r)&&r.apply(this,t)}}),i[u]=o,function(e){e||(o===i[u]?i[u]=r:n=r)}}},hookMethodDangerously=function(i,u,a){return function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];if(!i)return noop;var r=i[u],n=a.apply(void 0,__spreadArray([r],__read(e),!1)),o=n;return isFunction(o)&&(o=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];return n.apply(this,e)}),i[u]=o,function(){o===i[u]?i[u]=r:n=r}}};function mathRNG(){for(var e=new Array(16),t=0,r=0;r<16;r++)0==(3&r)&&(t=4294967296*Math.random()),e[r]=t>>>((3&r)<<3)&255;return e}function bytesToUuid(e){for(var t=[],r=0;r<256;++r)t[r]=(r+256).toString(16).substr(1);var n=0,o=t;return[o[e[n++]],o[e[n++]],o[e[n++]],o[e[n++]],"-",o[e[n++]],o[e[n++]],"-",o[e[n++]],o[e[n++]],"-",o[e[n++]],o[e[n++]],"-",o[e[n++]],o[e[n++]],o[e[n++]],o[e[n++]],o[e[+n]],o[e[15]]].join("")}function uuid(){var e=mathRNG();return e[6]=15&e[6]|64,e[8]=63&e[8]|128,bytesToUuid(e)}var BUFFER_TIME=3e5,applyBufferTimer=function(e,t,r){var n=0;return-1===r?noop:function(){if(e())return n&&clearTimeout(n),void(n=0);0===n&&(n=setTimeout(t,r))}},nextLink=function(n,e){var t=[];try{t=e.reduce(function(e,t){try{var r=t(n);"function"==typeof r&&e.push(r)}catch(e){}return e},[])}catch(e){}return function(e){return nextLink(e,t)}},toObservable=function(e){function t(e){n=arrayRemove(n,e),i||u()}var r,n=[],o=[],i=!1,u=applyBufferTimer(function(){return!!n.length},function(){i=!0,r&&r[0](),o.forEach(function(e){return e()}),o.length=0,r=void 0},e=void 0===e?BUFFER_TIME:e);return{next:function(e){return nextLink(e,n)},complete:function(e){o.push(e)},attach:function(e,t){r=[e,t]},subscribe:function(e){if(i)throw new Error("Observer is closed");return n.push(e),r&&r[1]&&r[1](e),u(),function(){return t(e)}},unsubscribe:t}},createSafeObserver=function(e,t,r){r=toObservable(r);try{e(r.next,r.attach),t&&r.complete(t)}catch(e){}return[r.subscribe,r.unsubscribe]},registerTearDownGroup=function(e,t,r,n){return e.destroyAgent.set(t,r,n)};function initSubjectInGlobal(e,t){return e.initSubject(t)}function initPrivateSubject(e,t,r){var t=__read(t,2),n=t[0],t=t[1],o=e.privateSubject||{};return o[n]||(o[n]=createSafeObserver(t,function(){o[n]=void 0},r)),o[n]}var now=function(){return Date.now()};function getDefaultBrowser(){if("object"==typeof window&&isObject(window))return window}function getDefaultDocument(){if("object"==typeof document&&isObject(document))return document}function getDefaultLocation(){return getDefaultBrowser()&&window.location}function getDefaultXMLHttpRequest(){if("function"==typeof XMLHttpRequest&&isFunction(XMLHttpRequest))return XMLHttpRequest}function getDefaultMutationObserver(){if(getDefaultBrowser()&&isFunction(window.MutationObserver))return window.MutationObserver}function getDefaultPerformanceObserver(){if(getDefaultBrowser()&&isFunction(window.PerformanceObserver))return window.PerformanceObserver}function getLocationUrl(){var e=getDefaultBrowser()&&getDefaultLocation();return e?e.href:""}var getViewOverrides=function(e){return{pid:e.pid,view_id:e.viewId,url:getLocationUrl()}},getOverrides=function(e){var t=e.config(),t=getViewOverrides(t);return t.context=e.context?e.context.toString():{},t},reportWithCurrentContext=function(t,e){void 0===e&&(e=!1);var r=getOverrides(t);return e&&(r.timestamp=now()),function(e){t.report(__assign(__assign({},e),{overrides:r}))}},PV_SUBJECT_NAME="view_0",applyPV=function(o){return function(r,e){function t(e){var t;e.viewId&&e.viewId!==(null===(t=o.config())||void 0===t?void 0:t.viewId)&&(r(n),n=__assign(__assign({},getOverrides(o)),getViewOverrides(e)))}var n=getOverrides(o);o.on("beforeConfig",t),e(function(){o.off("beforeConfig",t)})}},getGlobalRegistry=function(e){if(e)return e.__SLARDAR_REGISTRY__||(e.__SLARDAR_REGISTRY__={Slardar:{plugins:[],errors:[],subject:{}}}),e.__SLARDAR_REGISTRY__.Slardar},reportSelfError=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];var r=getGlobalRegistry(getDefaultBrowser());r&&(r.errors||(r.errors=[]),r.errors.push(e))},applyMutationObserver=function(e,t){var r=e&&new e(t);return[function(e,t){r&&e&&r.observe(e,t)},function(){return r&&r.disconnect()}]},applyPerformance=function(r){var e=r&&r.timing||void 0;return[e,function(){return r&&r.now?r.now():(Date.now?Date.now():+new Date)-(e&&e.navigationStart||0)},function(e){var t=(r||{}).getEntriesByType;return isFunction(t)&&t.call(r,e)||[]},function(){var e=(r||{}).clearResourceTimings;isFunction(e)&&e.call(r)},function(e){var t=(r||{}).getEntriesByName;return isFunction(t)&&t.call(r,e)||[]}]},UNKNOWN_PATH="<unknown>";function htmlTreeAsString(e){try{for(var t,r=e,n=[],o=0,i=0,u=" > ".length;r&&o++<5&&!("html"===(t=_htmlElementAsString(r))||1<o&&256<=i+n.length*u+t.length);)n.push(t),i+=t.length,r=r.parentNode;return n.reverse().join(" > ")}catch(e){return UNKNOWN_PATH}}function _htmlElementAsString(e){var t,r,n,o=e,i=[];if(!o||!o.tagName)return"";i.push(o.tagName.toLowerCase()),o.id&&i.push("#"+o.id);e=o.className;if(e&&isString(e))for(t=e.split(/\s+/),a=0;a<t.length;a++)i.push("."+t[a]);for(var u=["type","name","title","alt"],a=0;a<u.length;a++)(n=o.getAttribute(r=u[a]))&&i.push("["+r+'="'+n+'"]');return i.join("")}var addListenerToWindow=function(e,t,r,n){return void 0===n&&(n=!1),e.addEventListener(t,r,n),function(){e.removeEventListener(t,r,n)}},addListenerToDocument=function(e,t,r,n){return void 0===n&&(n=!1),e.addEventListener(t,r,n),function(){e.removeEventListener(t,r,n)}},getConfig=function(e,t){return isObject(e)?__assign(__assign({},t),e):!!e&&t},XHR_SUBJECT_NAME="xhr_0",getReportPathRegExp=function(){var t=new RegExp("\\/monitor_web\\/collect|\\/monitor_browser\\/collect\\/batch","i");return function(e){return t.test(e)}},hookOpen=function(n){return function(){for(var e,t=[],r=0;r<arguments.length;r++)t[r]=arguments[r];return e=__read(t,2),this._method=e[0],this._url=e[1],n.apply(this,t)}},hookSetHeader=function(o){return function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];this._reqHeaders=this._reqHeaders||{};var r=__read(e,2),n=r[0],r=r[1];return this._reqHeaders[n]=r,o&&o.apply(this,e)}},hookOnreadystatechange=function(n,o){return hookMethodDangerously(n,"onreadystatechange",function(r){return function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];return 4===this.readyState&&o(n),r&&r.apply(this,e)}})},hookSend=function(n,o){var i=getReportPathRegExp();return function(){for(var e,t=[],r=0;r<arguments.length;r++)t[r]=arguments[r];return this._start=now(),this._data=null==t?void 0:t[0],i(this._url)||(e=o([this._method,this._url,this._start,this]),hookOnreadystatechange(this,e)()),n.apply(this,t)}},applyXHR=function(n){return function(e,t){var r;n&&((r=[]).push(hookMethodDangerously(n,"open",hookOpen)()),r.push(hookMethodDangerously(n,"setRequestHeader",hookSetHeader)()),r.push(hookMethodDangerously(n,"send",hookSend)(e)),t(function(){r.forEach(function(e){return e()})}))}},FETCH_SUBJECT_NAME="fetch_0",hookFetch=function(n,o){return function(e,t){var r=o([e,t=void 0===t?{}:t]),t=n(e,t);return t.then(function(e){r(e)},function(){r(void 0)}),t}},observeFetch=function(e,t){var r,n=getDefaultBrowser();n&&fetch&&((r=[]).push(hookMethodDangerously(n,"fetch",hookFetch)(e)),t(function(){r.forEach(function(e){return e()})}))},fetchSubject=[FETCH_SUBJECT_NAME,observeFetch],RESOURCE_TYPE=["resource"],LONGTASK_TYPE=["longtask"],applyPerformanceObserver=function(n,o,i){var u=n&&new n(function(e,n){e.getEntries?e.getEntries().forEach(function(e,t,r){return o(e,t,r,n)}):i&&i()});return[function(e){if(!n||!u)return i&&i();try{u.observe({entryTypes:e})}catch(e){return i&&i()}},function(e,t){if(!n||!u)return i&&i();try{var r={type:e,buffered:!0};isUndefined(t)||(r.durationThreshold=t),u.observe(r)}catch(e){return i&&i()}u.observe({type:e,buffered:!1})},function(){return u&&u.disconnect()}]},observePerf=function(e,t,r){e=__read(applyPerformanceObserver(e,t),3),t=e[0],e=e[2];return t(r),e},LONGTASK_SUBJECT_NAME="longtask_0",observeLongtask=function(e,t){var r=getDefaultPerformanceObserver();r&&t(observePerf(r,e,LONGTASK_TYPE))},longtaskSubject=[LONGTASK_SUBJECT_NAME,observeLongtask],RESOURCE_SUBJECT_NAME="resource_0",observeResource=function(e,t){var r=getDefaultPerformanceObserver();r&&t(observePerf(r,e,RESOURCE_TYPE))},resourceSubject=[RESOURCE_SUBJECT_NAME,observeResource],PAGEVIEW_EV_TYPE="pageview",JS_ERROR_EV_TYPE="js_error",HTTP_EV_TYPE="http",RESOURCE_EV_TYPE="resource",PERFORMANCE_METRIC_EV_TYPE="performance",LONG_TASK_EV_TYPE="performance_longtask",ACTION_EV_TYPE="action";function getPluginConfig(e,t,r){t=null===(e=e.config())||void 0===e?void 0:e.plugins[t];return getConfig(t,r)}var CLICK_EVENT_NAME="click",CLICK_SUBJECT_NAME=CLICK_EVENT_NAME+"_0",observeClick=function(e,t){var r,n=getDefaultDocument();n&&(r=addListenerToDocument(n,CLICK_EVENT_NAME,e,!0),t(function(){r()}))},clickSubject=[CLICK_SUBJECT_NAME,observeClick],ERROR_FIELDS=["name","message","stack","filename","lineno","colno"],normalize=function(e){var t;return isError(e)?t=pick(e,ERROR_FIELDS):(isPlainObject(e)||isEvent(e)||isString(e))&&(t={message:safeStringify(e)}),t},normalizeError=function(e){return normalize(e.error)},normalizeException=function(e){var t;try{var r=void 0;if("reason"in e?r=e.reason:"detail"in e&&"reason"in e.detail&&(r=e.detail.reason),r){var n=normalize(r);return __assign(__assign({},n),{name:null!==(t=n&&n.name)&&void 0!==t?t:"UnhandledRejection"})}}catch(e){}},normalizeUnknownError=function(e){return(isErrorEvent(e)?normalizeError:isPromiseRejectionEvent(e)?normalizeException:normalize)(e)},DEFAULT_EVENT_TARGET=["EventTarget","Window","Node","ApplicationCache","ChannelMergerNode","EventSource","FileReader","HTMLUnknownElement","IDBDatabase","IDBRequest","IDBTransaction","MessagePort","Notification","SVGElementInstance","Screen","TextTrack","TextTrackCue","TextTrackList","WebSocket","Worker","XMLHttpRequest","XMLHttpRequestEventTarget","XMLHttpRequestUpload"],DEFAULT_TIME_FUNCTION=["setTimeout","setInterval","requestAnimationFrame","requestIdleCallback"],xmlHttpRequestProps=["onload","onerror","onprogress","onreadystatechange"],ADD_EVENT_LISTENER="addEventListener",REMOVE_EVENT_LISTENER="removeEventListener",DEFAULT_SOURCE_TYPE="capture-global",observeAsyncErrorWithSource=function(o,e){function u(e,r){if(!isFunction(e))return e;var n={type:DEFAULT_SOURCE_TYPE,data:__assign({},r)},t=e._w_||(e._w_=function(){try{return(e.handleEvent&&isFunction(e.handleEvent)?e.handleEvent:e).apply(this,[].map.call(arguments,function(e){return u(e,r)}))}catch(e){var t=normalize(e);throw t&&o({source:n,error:t}),e}});return t._hook_=!0,t}var t=getDefaultBrowser(),r=getDefaultXMLHttpRequest(),n=[];t&&n.push.apply(n,__spreadArray([],__read(DEFAULT_TIME_FUNCTION.filter(function(e){return t[e]}).map(function(o){return hookObjectProperty(t,o,function(n){return function(e){for(var t=[],r=1;r<arguments.length;r++)t[r-1]=arguments[r];return n&&n.call.apply(n,__spreadArray([this,u(e,{function:o})],__read(t),!1))}},!1)()})),!1)),r&&r.prototype&&n.push(hookObjectProperty(r.prototype,"send",function(n){return function(){for(var t=this,e=[],r=0;r<arguments.length;r++)e[r]=arguments[r];return xmlHttpRequestProps.filter(function(e){return t[e]&&!t[e]._hook_}).forEach(function(e){t[e]=u(t[e],{function:e})}),n.apply(this,e)}},!1)()),DEFAULT_EVENT_TARGET.forEach(function(i){var e=t&&t[i]&&t[i].prototype;e&&e[ADD_EVENT_LISTENER]&&(n.push(hookObjectProperty(e,ADD_EVENT_LISTENER,function(o){return function(e,t,r){try{var n=t.handleEvent;isFunction(n)&&(t.handleEvent=u(n,{function:"handleEvent",target:i}))}catch(e){}return o&&o.call(this,e,u(t,{function:ADD_EVENT_LISTENER,target:i}),r)}},!1)()),n.push(hookObjectProperty(e,REMOVE_EVENT_LISTENER,function(n){return function(e,t,r){return null!=t&&t._w_&&n.call(this,e,t._w_,r),n.call(this,e,t,r)}},!1)()))}),e(function(){return n.forEach(function(e){return e()})})},ASYNC_ERROR_SUBJECT_NAME="async_error_0",asyncErrorWithSourceSubject=[ASYNC_ERROR_SUBJECT_NAME,observeAsyncErrorWithSource],ERROR_SUBJECT_NAME="err_0",observeError=function(e,t){var r,n=getDefaultBrowser();n&&(r=addListenerToWindow(n,"error",e,!0),t(function(){r()}))},errorSubject=[ERROR_SUBJECT_NAME,observeError],PROMISE_REJECTION_SUBJECT_NAME="perr_0",observePromiseRejection=function(e,t){var r,n=getDefaultBrowser();n&&(r=addListenerToWindow(n,"unhandledrejection",e,!0),t(function(){r()}))},promiseRejectionSubject=[PROMISE_REJECTION_SUBJECT_NAME,observePromiseRejection],isSameErrorString=function(e,t){return e&&t&&e===t},shouldDropEvent=function(e,t){return!(!e||!t)&&!(!isSameErrorString(e.message,t.message)||!isSameErrorString(e.stack,t.stack))},dedupe=function(){var t;return function(e){try{if(shouldDropEvent(e,t))return void(t=e)}catch(e){reportSelfError(e)}return t=e}},jsErrorGetterWithContext=function(o,e,t,r){function n(e){var t=e.error,r=e.extra,n=e.react,e=e.source;!(t=f?_(t):t)||!t.message||l&&l.test(t.message)||o({ev_type:JS_ERROR_EV_TYPE,payload:{error:t,breadcrumbs:[],extra:r,react:n,source:e}})}var i=__read(t,3),u=i[0],a=i[1],c=i[2],s=r.ignoreErrors,t=r.onerror,i=r.onunhandledrejection,f=r.dedupe,r=r.captureGlobalAsync,l=getRegexp(s),_=dedupe();return t&&e.push(u[0](function(e){return n({error:normalizeError(e),source:{type:"onerror"}})})),i&&e.push(a[0](function(e){return n({error:normalizeException(e),source:{type:"onunhandledrejection"}})})),r&&e.push(c()[0](function(e){n(e)})),function(e,t,r){return n({error:normalizeUnknownError(e),extra:t,react:r,source:{type:"manual"}})}},JS_ERROR_MONITOR_PLUGIN_NAME="jsError",defaultConfig$1={ignoreErrors:[],onerror:!0,onunhandledrejection:!0,captureGlobalAsync:!1,dedupe:!0};function JsErrorMonitorPlugin(r){r.on("init",function(){window.removeEventListener("error",r.pcErr,!0),window.removeEventListener("unhandledrejection",r.pcRej,!0);var e,t=getPluginConfig(r,JS_ERROR_MONITOR_PLUGIN_NAME,defaultConfig$1);t&&(t=jsErrorGetterWithContext(function(e){r.getBreadcrumbs&&(e.payload.breadcrumbs=r.getBreadcrumbs()),r.report(e)},e=[],[initSubjectInGlobal(r,errorSubject),initSubjectInGlobal(r,promiseRejectionSubject),function(){return initSubjectInGlobal(r,asyncErrorWithSourceSubject)}],t),registerTearDownGroup(r,JS_ERROR_MONITOR_PLUGIN_NAME,JS_ERROR_EV_TYPE,e),r.provide("captureException",t))})}var defaultMetricContext={isSupport:!0,isPolyfill:!1,isBounced:!1,isCustom:!1,type:"perf"},initMetric=function(e,t){return __assign({name:e,value:t},defaultMetricContext)},wrapPerformanceMetric=function(e,t){return{ev_type:PERFORMANCE_METRIC_EV_TYPE,payload:e,overrides:t}},applyReportMetric=function(r){return function(e,t){r(wrapPerformanceMetric(e,t))}},SPA_LOAD_METRIC_NAME="spa_load",PAGE_ACTIVITY_DELAY=100,ROOT_TAGS=["BODY","HTML","HEAD"],SVG_TAG="SVG",DEFAULT_ATTR_NAME="data-apm-action",waitActionComplete=function(e,t,r,n){function o(){e.clearTimeout(i),a&&(i=e.setTimeout(function(){t()},PAGE_ACTIVITY_DELAY))}var i,u,a=!1;return[function(){a=!0,e.clearTimeout(u),u=e.setTimeout(function(){t(!0),r()},n),o()},o,function(){a=!1,e.clearTimeout(i),e.clearTimeout(u)}]},isSupportsElementClosest=function(){var e;return function(){return void 0===e?e="closest"in HTMLElement.prototype:e}}(),findElementWithAttributeByParents=function(e,t,r){void 0===r&&(r=10);for(var n=e,o=0;o<r&&n;o++){if(~ROOT_TAGS.indexOf(n.nodeName))return;if(n.hasAttribute(t))return n;n=n.parentElement}},getActionNameByAttribute=function(e,t){e=isSupportsElementClosest()?e.closest("["+t+"]"):findElementWithAttributeByParents(e,t);if(e)return e.getAttribute(t).trim()},getActionName=function(e,t){return getActionNameByAttribute(e,t)||e.innerText},isSVGTarget=function(e){for(var t=e,r=!1;t;)t.tagName.toUpperCase()===SVG_TAG?r=!(t=null):t=t.parentElement;return r},isElementWithinTwoLevels=function(e){e=e.children;return!e.length||![].slice.call(e).some(function(e){return 0<e.children.length})},isValidTarget=function(e){var t=e.tagName.toUpperCase();return 1===e.nodeType&&!ROOT_TAGS.includes(t)&&!isSVGTarget(e)&&((!e.style||"none"!==e.style.display)&&(!(!["A","BUTTON","INPUT","TEXTAREA"].includes(t)&&!getActionNameByAttribute(e,DEFAULT_ATTR_NAME))||!!isElementWithinTwoLevels(e)))},SUPPORT_TYPES=["click"],EVENT_LISTENER_OPTIONS={capture:!0},MIN_LONG_TASK=50,MAX_ACTIVITY_DELAY=1e4,applyIncompleteReq=function(e,t,r){var n=__read(t,2),o=n[0],i=n[1],t=__read(applyRecord(),3),n=t[0],u=t[1],a=t[2],c=0;return e.push(o[0](function(e){__read(e,1)[0];var t=c+=1;return u(t,now()),r(),function(){a(t),r()}})),e.push(i[0](function(){var e=c+=1;return u(e,now()),r(),function(){a(e),r()}})),n},actionGetterWithFetchObserver=function(o,t,e,r){function n(e){var t;!_||!l&&!Object.keys(_.metrics).length||Object.keys(R).length&&!e||(_.metrics[LONG_TASK_EV_TYPE]&&(_.metrics[LONG_TASK_EV_TYPE].duration=v),t=0<d.length?Math.max.apply(Math,__spreadArray([],__read(d),!1))-Math.min.apply(Math,__spreadArray([],__read(d),!1)):0,_.metrics[HTTP_EV_TYPE]&&(_.metrics[HTTP_EV_TYPE].duration=t),e=T()-_.start_time,p&&p({ev_type:ACTION_EV_TYPE,payload:__assign(__assign({},_),{duration:e,frontend_time:e-t})}),i())}function i(){A(),_&&(E={start_time:_.start_time,id:_.id}),_=null,d=[],v=0}function u(e){_&&(_.metrics[e]={count:(null!==(e=null===(e=_.metrics[e])||void 0===e?void 0:e.count)&&void 0!==e?e:0)+1})}var a=__read(e,4),c=a[0],s=a[1],f=a[2],e=a[3],a=r.types,l=r.pure,_=null,E=null,p=void 0,d=[],v=0,T=__read(applyPerformance(performance),2)[1],r=__read(waitActionComplete(window,n,i,MAX_ACTIVITY_DELAY),3),h=r[0],g=r[1],A=r[2],R=applyIncompleteReq(t,[c,s],g),c=__read(applyMutationObserver(MutationObserver,g),2),s=c[0],c=c[1];s(),t.push(c),t.push(A),t.push(f[0](function(e){var t=e.startTime,e=e.duration;g(),_&&_.start_time<=t+MIN_LONG_TASK&&(v+=e,u(LONG_TASK_EV_TYPE))})),t.push(e[0](function(e){var t=e.startTime,r=e.duration,e=e.initiatorType;g(),_&&_.start_time<t&&(["xmlhttprequest","fetch"].includes(e)&&(d.push(t,t+r),u(HTTP_EV_TYPE)),["xmlhttprequest","fetch","beacon"].includes(e)||u(RESOURCE_EV_TYPE))}));function S(e,t){var r=uuid(),n=__read(applyPerformance(performance),2)[1];_={start_time:n(),id:r,type:t,target:e,metrics:{}},p=o(),h()}function y(e){var t;n(!0),i(),e.target instanceof HTMLElement&&isValidTarget(e.target)&&((t=getActionName(e.target,DEFAULT_ATTR_NAME))&&S({name:t,path:htmlTreeAsString(e.target)},e.type))}a&&a.forEach(function(e){arrayIncludes(SUPPORT_TYPES,e)&&t.push(addListenerToDocument(document,e,y,EVENT_LISTENER_OPTIONS))});return[function(e){if(e.ev_type===PAGEVIEW_EV_TYPE)return n(!0),void i();if(e.ev_type===HTTP_EV_TYPE)return(t=e.payload.response.timing&&e.payload.response.timing.startTime)?_&&t>_.start_time?_.id:E&&t>E.start_time?E.id:void 0:void 0;if(e.ev_type!==LONG_TASK_EV_TYPE)return _?(e.ev_type!==JS_ERROR_EV_TYPE&&e.ev_type!==RESOURCE_EV_TYPE||u(e.ev_type),_.id):void 0;var t=e.payload.longtasks.length&&e.payload.longtasks[0].startTime+MIN_LONG_TASK;return _&&t&&t>_.start_time?_.id:void 0},function(e,t){n(!0),i(),S({name:e},t)}]},ACTION_MONITOR_PLUGIN_NAME="action",defaultConfig={types:["click"],pure:!0};function ActionMonitorBasePlugin(e,t){void 0===t&&(t=defaultConfig);var r,n,o=[],i=getDefaultDocument(),u=getDefaultBrowser();i&&u&&(t=__read(actionGetterWithFetchObserver(function(){return reportWithCurrentContext(e,!0)},o,[initSubjectInGlobal(e,[XHR_SUBJECT_NAME,applyXHR(XMLHttpRequest&&XMLHttpRequest.prototype)]),initSubjectInGlobal(e,fetchSubject),initSubjectInGlobal(e,longtaskSubject),initSubjectInGlobal(e,resourceSubject)],t),2),r=t[0],t=t[1],e.on("report",n=function(e){var t=r(e);return t&&e.extra&&(e.extra.action_id=t),e}),o.push(function(){e.off("report",n)}),e.provide("startAction",t),registerTearDownGroup(e,ACTION_MONITOR_PLUGIN_NAME,ACTION_EV_TYPE,o))}var MAX_PAGE_DELAY=3e4,getSPA=function(e,t,r){function n(e){!_||Object.keys(v).length&&!e||(E(initMetric(SPA_LOAD_METRIC_NAME,now()-_)),o())}function o(){d(),_=0}var i=__read(r,7),u=i[0],a=i[1],c=i[2],s=i[3],f=i[4],l=i[5],r=i[6],_=0,E=applyReportMetric(e),i=__read(waitActionComplete(window,n,noop,MAX_PAGE_DELAY),3),p=i[0],e=i[1],d=i[2],v=applyIncompleteReq(t,[c,s],e);t.push(f[0](e)),t.push(l[0](e));var e=__read(applyMutationObserver(r,e),2),T=e[0],e=e[1];t.push(e);var h=!0;t.push(u[0](function(){h?h=!1:(n(!0),o(),_=now(),T(document,{childList:!0,subtree:!0}),p())})),t.push(a[0](function(){n(!0),o()})),t.push(o)};function SPALoadMonitorPlugin(n){n.on("init",function(){var e=[],t=getDefaultDocument(),r=getDefaultMutationObserver();t&&r&&(getSPA(n.report.bind(n),e,[initPrivateSubject(n,[PV_SUBJECT_NAME,applyPV(n)]),initSubjectInGlobal(n,clickSubject),initSubjectInGlobal(n,[XHR_SUBJECT_NAME,applyXHR(XMLHttpRequest&&XMLHttpRequest.prototype)]),initSubjectInGlobal(n,fetchSubject),initSubjectInGlobal(n,resourceSubject),initSubjectInGlobal(n,longtaskSubject),r]),n.on("beforeDestroy",function(){e.forEach(function(e){return e()})}))})}var CAPTURE_CONSOLE_INTEGRATION_NAME="captureConsole",captureConsole=function(e){var e=e.levels,r=void 0===e?["log","info","warn","error","debug","assert"]:e;return{name:CAPTURE_CONSOLE_INTEGRATION_NAME,setup:function(n){var t,o=getDefaultBrowser();o&&o.console&&(t=[],r.forEach(function(e){e in o.console&&t.push(hookMethodDangerously(o.console,e,function(r){return function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];try{r&&r.call.apply(r,__spreadArray([o.console],__read(e),!1))}finally{n("captureException",safeJoin(e," "))}}})())}),n.on("beforeDestroy",function(){t.forEach(function(e){return e()})}))}}},JS_ERROR_INTEGRATION_NAME=JS_ERROR_MONITOR_PLUGIN_NAME,jsErrorPlugin=function(){return{name:JS_ERROR_INTEGRATION_NAME,setup:function(e){JsErrorMonitorPlugin(e)}}},ACTION_INTEGRATION_NAME=ACTION_MONITOR_PLUGIN_NAME,actionPlugin=function(t){return{name:ACTION_INTEGRATION_NAME,setup:function(e){ActionMonitorBasePlugin(e,t)}}},SPA_LOAD_INTEGRATION_NAME="spa_load",SPALoadPlugin=function(){return{name:SPA_LOAD_INTEGRATION_NAME,setup:function(e){SPALoadMonitorPlugin(e)}}};exports.SPALoadPlugin=SPALoadPlugin,exports.actionPlugin=actionPlugin,exports.captureConsole=captureConsole,exports.jsErrorPlugin=jsErrorPlugin,exports.refreshPreStartContext=refreshPreStartContext; | ||
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var __assign=function(){return(__assign=Object.assign||function(e){for(var t,r=1,n=arguments.length;r<n;r++)for(var o in t=arguments[r])Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o]);return e}).apply(this,arguments)};function __read(e,t){var r="function"==typeof Symbol&&e[Symbol.iterator];if(!r)return e;var n,o,i=r.call(e),u=[];try{for(;(void 0===t||0<t--)&&!(n=i.next()).done;)u.push(n.value)}catch(e){o={error:e}}finally{try{n&&!n.done&&(r=i.return)&&r.call(i)}finally{if(o)throw o.error}}return u}function __spreadArray(e,t,r){if(r||2===arguments.length)for(var n,o=0,i=t.length;o<i;o++)!n&&o in t||((n=n||Array.prototype.slice.call(t,0,o))[o]=t[o]);return e.concat(n||Array.prototype.slice.call(t))}var REFRESH_PRE_START_CONTEXT_INTEGRATION_NAME="refreshPreStartContext",refreshPreStartContext=function(){return{name:REFRESH_PRE_START_CONTEXT_INTEGRATION_NAME,setup:function(n){n.on("start",function(){var r=n.getPreStartQueue();r.forEach(function(e,t){r[t]=__assign(__assign({},e),{overrides:__assign(__assign({},null!==(e=e.overrides)&&void 0!==e?e:{}),{context:(null===(e=n.context)||void 0===e?void 0:e.toString())||{}})})})})}}},noop=function(){return{}};function isObject(e){return"object"==typeof e&&null!==e}function isUndefined(e){return void 0===e}function isInstanceOf(e,t){try{return e instanceof t}catch(e){return!1}}var objProto=Object.prototype;function isPlainObject(e){if(isObject(e)){if("function"!=typeof Object.getPrototypeOf)return"[object Object]"===objProto.toString.call(e);e=Object.getPrototypeOf(e);return e===objProto||null===e}return!1}function isArray(e){return"[object Array]"===objProto.toString.call(e)}function isFunction(e){return"function"==typeof e}function isString(e){return"string"==typeof e}function isError(e){switch(Object.prototype.toString.call(e)){case"[object Error]":case"[object Exception]":case"[object DOMError]":case"[object DOMException]":return!0;default:return e instanceof Error}}function isEvent(e){return"undefined"!=typeof Event&&isInstanceOf(e,Event)}function isErrorEvent(e){return"[object ErrorEvent]"===Object.prototype.toString.call(e)}function isPromiseRejectionEvent(e){return"[object PromiseRejectionEvent]"===Object.prototype.toString.call(e)}function arrayIncludes(e,t){if(!isArray(e))return!1;if(0===e.length)return!1;for(var r=0;r<e.length;){if(e[r]===t)return!0;r++}return!1}var arrayRemove=function(e,t){if(!isArray(e))return e;var r=e.indexOf(t);if(0<=r){t=e.slice();return t.splice(r,1),t}return e},applyRecord=function(){var r={};return[r,function(e,t){return r[e]=t},function(e){return delete r[e]}]},pick=function(r,e){return r&&isObject(r)?e.reduce(function(e,t){return e[t]=r[t],e},{}):r};function getRegexp(e){return isArray(e)&&e.length?joinRegExp(e):null}function joinRegExp(e){for(var t=[],r=e.length,n=0;n<r;n++){var o=e[n];isString(o)?t.push(o.replace(/([.*+?^=!:${}()|[\]/\\])/g,"\\$1")):o&&o.source&&t.push(o.source)}return new RegExp(t.join("|"),"i")}var checkIfHit=function(e,t){e=getRegexp(e||[]);return!!e&&e.test(t)};function safeStringify(e){try{return isString(e)?e:JSON.stringify(e)}catch(e){return"[FAILED_TO_STRINGIFY]:"+String(e)}}function safeJoin(e,t){if(!isArray(e))return"";for(var r=[],n=0;n<e.length;n++)try{r.push(String(e[n]))}catch(e){r.push("[value cannot be serialized]")}return r.join(t)}var hookObjectProperty=function(i,u,a,c){return void 0===c&&(c=!0),function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];if(!i)return noop;var r=i[u],n=a.apply(void 0,__spreadArray([r],__read(e),!1)),o=n;return isFunction(o)&&c&&(o=function(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];try{return n.apply(this,t)}catch(e){return isFunction(r)&&r.apply(this,t)}}),i[u]=o,function(e){e||(o===i[u]?i[u]=r:n=r)}}},hookMethodDangerously=function(i,u,a){return function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];if(!i)return noop;var r=i[u],n=a.apply(void 0,__spreadArray([r],__read(e),!1)),o=n;return isFunction(o)&&(o=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];return n.apply(this,e)}),i[u]=o,function(){o===i[u]?i[u]=r:n=r}}};function mathRNG(){for(var e=new Array(16),t=0,r=0;r<16;r++)0==(3&r)&&(t=4294967296*Math.random()),e[r]=t>>>((3&r)<<3)&255;return e}function bytesToUuid(e){for(var t=[],r=0;r<256;++r)t[r]=(r+256).toString(16).substr(1);var n=0,o=t;return[o[e[n++]],o[e[n++]],o[e[n++]],o[e[n++]],"-",o[e[n++]],o[e[n++]],"-",o[e[n++]],o[e[n++]],"-",o[e[n++]],o[e[n++]],"-",o[e[n++]],o[e[n++]],o[e[n++]],o[e[n++]],o[e[+n]],o[e[15]]].join("")}function uuid(){var e=mathRNG();return e[6]=15&e[6]|64,e[8]=63&e[8]|128,bytesToUuid(e)}var BUFFER_TIME=3e5,applyBufferTimer=function(e,t,r){var n=0;return-1===r?noop:function(){if(e())return n&&clearTimeout(n),void(n=0);0===n&&(n=setTimeout(t,r))}},nextLink=function(n,e){var t=[];try{t=e.reduce(function(e,t){try{var r=t(n);"function"==typeof r&&e.push(r)}catch(e){}return e},[])}catch(e){}return function(e){return nextLink(e,t)}},toObservable=function(e){function t(e){n=arrayRemove(n,e),i||u()}var r,n=[],o=[],i=!1,u=applyBufferTimer(function(){return!!n.length},function(){i=!0,r&&r[0](),o.forEach(function(e){return e()}),o.length=0,r=void 0},e=void 0===e?BUFFER_TIME:e);return{next:function(e){return nextLink(e,n)},complete:function(e){o.push(e)},attach:function(e,t){r=[e,t]},subscribe:function(e){if(i)throw new Error("Observer is closed");return n.push(e),r&&r[1]&&r[1](e),u(),function(){return t(e)}},unsubscribe:t}},createSafeObserver=function(e,t,r){r=toObservable(r);try{e(r.next,r.attach),t&&r.complete(t)}catch(e){}return[r.subscribe,r.unsubscribe]},registerTearDownGroup=function(e,t,r,n){return e.destroyAgent.set(t,r,n)};function initSubjectInGlobal(e,t){return e.initSubject(t)}function initPrivateSubject(e,t,r){var t=__read(t,2),n=t[0],t=t[1],o=e.privateSubject||{};return o[n]||(o[n]=createSafeObserver(t,function(){o[n]=void 0},r)),o[n]}var now=function(){return Date.now()};function getDefaultBrowser(){if("object"==typeof window&&isObject(window))return window}function getDefaultDocument(){if("object"==typeof document&&isObject(document))return document}function getDefaultLocation(){return getDefaultBrowser()&&window.location}function getDefaultXMLHttpRequest(){if("function"==typeof XMLHttpRequest&&isFunction(XMLHttpRequest))return XMLHttpRequest}function getDefaultMutationObserver(){if(getDefaultBrowser()&&isFunction(window.MutationObserver))return window.MutationObserver}function getDefaultPerformanceObserver(){if(getDefaultBrowser()&&isFunction(window.PerformanceObserver))return window.PerformanceObserver}function getFullUrl(e){var t=getDefaultDocument();if(!t||!e)return"";t=t.createElement("a");return t.href=e,t.href}function getLocationUrl(){var e=getDefaultBrowser()&&getDefaultLocation();return e?e.href:""}var getViewOverrides=function(e){return{pid:e.pid,view_id:e.viewId,url:getLocationUrl()}},getOverrides=function(e){var t=e.config(),t=getViewOverrides(t);return t.context=e.context?e.context.toString():{},t},reportWithCurrentContext=function(t,e){void 0===e&&(e=!1);var r=getOverrides(t);return e&&(r.timestamp=now()),function(e){t.report(__assign(__assign({},e),{overrides:r}))}},PV_SUBJECT_NAME="view_0",applyPV=function(o){return function(r,e){function t(e){var t;e.viewId&&e.viewId!==(null===(t=o.config())||void 0===t?void 0:t.viewId)&&(r(n),n=__assign(__assign({},getOverrides(o)),getViewOverrides(e)))}var n=getOverrides(o);o.on("beforeConfig",t),e(function(){o.off("beforeConfig",t)})}},getGlobalRegistry=function(e){if(e)return e.__SLARDAR_REGISTRY__||(e.__SLARDAR_REGISTRY__={Slardar:{plugins:[],errors:[],subject:{}}}),e.__SLARDAR_REGISTRY__.Slardar},reportSelfError=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];var r=getGlobalRegistry(getDefaultBrowser());r&&(r.errors||(r.errors=[]),r.errors.push(e))},applyMutationObserver=function(e,t){var r=e&&new e(t);return[function(e,t){r&&e&&r.observe(e,t)},function(){return r&&r.disconnect()}]},applyPerformance=function(r){var e=r&&r.timing||void 0;return[e,function(){return r&&r.now?r.now():(Date.now?Date.now():+new Date)-(e&&e.navigationStart||0)},function(e){var t=(r||{}).getEntriesByType;return isFunction(t)&&t.call(r,e)||[]},function(){var e=(r||{}).clearResourceTimings;isFunction(e)&&e.call(r)},function(e){var t=(r||{}).getEntriesByName;return isFunction(t)&&t.call(r,e)||[]}]},UNKNOWN_PATH="<unknown>";function htmlTreeAsString(e){try{for(var t,r=e,n=[],o=0,i=0,u=" > ".length;r&&o++<5&&!("html"===(t=_htmlElementAsString(r))||1<o&&256<=i+n.length*u+t.length);)n.push(t),i+=t.length,r=r.parentNode;return n.reverse().join(" > ")}catch(e){return UNKNOWN_PATH}}function _htmlElementAsString(e){var t,r,n,o,i=e,u=[];if(!i||!i.tagName)return"";if(u.push(i.tagName.toLowerCase()),i.id)return"#"+i.id;e=i.className;if(e&&isString(e))for(r=e.split(/\s+/),c=0;c<r.length;c++)u.push("."+r[c]);for(var a=["type","name","title","alt"],c=0;c<a.length;c++)n=a[c],(o=i.getAttribute(n))&&u.push("["+n+'="'+o+'"]');for(var s=i,f=1,l=!0;s=s.previousElementSibling;)(null===(t=s.tagName)||void 0===t?void 0:t.toLowerCase())===(null===(t=i.tagName)||void 0===t?void 0:t.toLowerCase())&&(s.className===i.className&&a.every(function(e){return i.getAttribute(e)===(null==s?void 0:s.getAttribute(e))})&&(l=!1),f++);return 1<f&&!l&&u.push(":nth-of-type("+f+")"),u.join("")}var addListenerToWindow=function(e,t,r,n){return void 0===n&&(n=!1),e.addEventListener(t,r,n),function(){e.removeEventListener(t,r,n)}},addListenerToDocument=function(e,t,r,n){return void 0===n&&(n=!1),e.addEventListener(t,r,n),function(){e.removeEventListener(t,r,n)}},getConfig=function(e,t){return isObject(e)?__assign(__assign({},t),e):!!e&&t},XHR_SUBJECT_NAME="xhr_0",getReportPathRegExp=function(){var t=new RegExp("\\/monitor_web\\/collect|\\/monitor_browser\\/collect\\/batch","i");return function(e){return t.test(e)}},hookOpen=function(n){return function(){for(var e,t=[],r=0;r<arguments.length;r++)t[r]=arguments[r];return e=__read(t,2),this._method=e[0],this._url=e[1],n.apply(this,t)}},hookSetHeader=function(o){return function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];this._reqHeaders=this._reqHeaders||{};var r=__read(e,2),n=r[0],r=r[1];return this._reqHeaders[n]=r,o&&o.apply(this,e)}},hookOnreadystatechange=function(n,o){return hookMethodDangerously(n,"onreadystatechange",function(r){return function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];return 4===this.readyState&&o(n),r&&r.apply(this,e)}})},hookSend=function(n,o){var i=getReportPathRegExp();return function(){for(var e,t=[],r=0;r<arguments.length;r++)t[r]=arguments[r];return this._start=now(),this._data=null==t?void 0:t[0],i(this._url)||(e=o([this._method,this._url,this._start,this]),hookOnreadystatechange(this,e)()),n.apply(this,t)}},applyXHR=function(n){return function(e,t){var r;n&&((r=[]).push(hookMethodDangerously(n,"open",hookOpen)()),r.push(hookMethodDangerously(n,"setRequestHeader",hookSetHeader)()),r.push(hookMethodDangerously(n,"send",hookSend)(e)),t(function(){r.forEach(function(e){return e()})}))}},FETCH_SUBJECT_NAME="fetch_0",hookFetch=function(n,o){return function(e,t){var r=o([e,t=void 0===t?{}:t]),t=n(e,t);return t.then(function(e){r(e)},function(){r(void 0)}),t}},observeFetch=function(e,t){var r,n=getDefaultBrowser();n&&fetch&&((r=[]).push(hookMethodDangerously(n,"fetch",hookFetch)(e)),t(function(){r.forEach(function(e){return e()})}))},fetchSubject=[FETCH_SUBJECT_NAME,observeFetch],RESOURCE_TYPE=["resource"],LONGTASK_TYPE=["longtask"],applyPerformanceObserver=function(n,o,i){var u=n&&new n(function(e,n){e.getEntries?e.getEntries().forEach(function(e,t,r){return o(e,t,r,n)}):i&&i()});return[function(e){if(!n||!u)return i&&i();try{u.observe({entryTypes:e})}catch(e){return i&&i()}},function(e,t){if(!n||!u)return i&&i();try{var r={type:e,buffered:!0};isUndefined(t)||(r.durationThreshold=t),u.observe(r)}catch(e){return i&&i()}u.observe({type:e,buffered:!1})},function(){return u&&u.disconnect()}]},observePerf=function(e,t,r){e=__read(applyPerformanceObserver(e,t),3),t=e[0],e=e[2];return t(r),e},LONGTASK_SUBJECT_NAME="longtask_0",observeLongtask=function(e,t){var r=getDefaultPerformanceObserver();r&&t(observePerf(r,e,LONGTASK_TYPE))},longtaskSubject=[LONGTASK_SUBJECT_NAME,observeLongtask],RESOURCE_SUBJECT_NAME="resource_0",observeResource=function(t,e){var r,n=getDefaultPerformanceObserver();n&&(r=getReportPathRegExp(),e(observePerf(n,function(e){r(e.name)||t(e)},RESOURCE_TYPE)))},resourceSubject=[RESOURCE_SUBJECT_NAME,observeResource],PAGEVIEW_EV_TYPE="pageview",JS_ERROR_EV_TYPE="js_error",HTTP_EV_TYPE="http",RESOURCE_ERROR_EV_TYPE="resource_error",RESOURCE_EV_TYPE="resource",PERFORMANCE_METRIC_EV_TYPE="performance",LONG_TASK_EV_TYPE="performance_longtask",ACTION_EV_TYPE="action",CLICK_EVENT_NAME="click",CLICK_SUBJECT_NAME=CLICK_EVENT_NAME+"_0",observeClick=function(e,t){var r,n=getDefaultDocument();n&&(r=addListenerToDocument(n,CLICK_EVENT_NAME,e,!0),t(function(){r()}))},clickSubject=[CLICK_SUBJECT_NAME,observeClick],ERROR_FIELDS=["name","message","stack","filename","lineno","colno"],normalize=function(e){var t;return isError(e)?t=pick(e,ERROR_FIELDS):(isPlainObject(e)||isEvent(e)||isString(e))&&(t={message:safeStringify(e)}),t},normalizeError=function(e){return normalize(e.error)},normalizeException=function(e){var t;try{var r=void 0;if("reason"in e?r=e.reason:"detail"in e&&"reason"in e.detail&&(r=e.detail.reason),r){var n=normalize(r);return __assign(__assign({},n),{name:null!==(t=n&&n.name)&&void 0!==t?t:"UnhandledRejection"})}}catch(e){}},normalizeUnknownError=function(e){return(isErrorEvent(e)?normalizeError:isPromiseRejectionEvent(e)?normalizeException:normalize)(e)},DEFAULT_EVENT_TARGET=["EventTarget","Window","Node","ApplicationCache","ChannelMergerNode","EventSource","FileReader","HTMLUnknownElement","IDBDatabase","IDBRequest","IDBTransaction","MessagePort","Notification","SVGElementInstance","Screen","TextTrack","TextTrackCue","TextTrackList","WebSocket","Worker","XMLHttpRequest","XMLHttpRequestEventTarget","XMLHttpRequestUpload"],DEFAULT_TIME_FUNCTION=["setTimeout","setInterval","requestAnimationFrame","requestIdleCallback"],xmlHttpRequestProps=["onload","onerror","onprogress","onreadystatechange"],ADD_EVENT_LISTENER="addEventListener",REMOVE_EVENT_LISTENER="removeEventListener",DEFAULT_SOURCE_TYPE="capture-global",observeAsyncErrorWithSource=function(o,e){function u(e,r){if(!isFunction(e))return e;var n={type:DEFAULT_SOURCE_TYPE,data:__assign({},r)},t=e._w_||(e._w_=function(){try{return(e.handleEvent&&isFunction(e.handleEvent)?e.handleEvent:e).apply(this,[].map.call(arguments,function(e){return u(e,r)}))}catch(e){var t=normalize(e);throw t&&o({source:n,error:t}),e}});return t._hook_=!0,t}var t=getDefaultBrowser(),r=getDefaultXMLHttpRequest(),n=[];t&&n.push.apply(n,__spreadArray([],__read(DEFAULT_TIME_FUNCTION.filter(function(e){return t[e]}).map(function(o){return hookObjectProperty(t,o,function(n){return function(e){for(var t=[],r=1;r<arguments.length;r++)t[r-1]=arguments[r];return n&&n.call.apply(n,__spreadArray([this,u(e,{function:o})],__read(t),!1))}},!1)()})),!1)),r&&r.prototype&&n.push(hookObjectProperty(r.prototype,"send",function(n){return function(){for(var t=this,e=[],r=0;r<arguments.length;r++)e[r]=arguments[r];return xmlHttpRequestProps.filter(function(e){return t[e]&&!t[e]._hook_}).forEach(function(e){t[e]=u(t[e],{function:e})}),n.apply(this,e)}},!1)()),DEFAULT_EVENT_TARGET.forEach(function(i){var e=t&&t[i]&&t[i].prototype;e&&e[ADD_EVENT_LISTENER]&&(n.push(hookObjectProperty(e,ADD_EVENT_LISTENER,function(o){return function(e,t,r){try{var n=t.handleEvent;isFunction(n)&&(t.handleEvent=u(n,{function:"handleEvent",target:i}))}catch(e){}return o&&o.call(this,e,u(t,{function:ADD_EVENT_LISTENER,target:i}),r)}},!1)()),n.push(hookObjectProperty(e,REMOVE_EVENT_LISTENER,function(n){return function(e,t,r){return null!=t&&t._w_&&n.call(this,e,t._w_,r),n.call(this,e,t,r)}},!1)()))}),e(function(){return n.forEach(function(e){return e()})})},ASYNC_ERROR_SUBJECT_NAME="async_error_0",asyncErrorWithSourceSubject=[ASYNC_ERROR_SUBJECT_NAME,observeAsyncErrorWithSource],ERROR_SUBJECT_NAME="err_0",observeError=function(e,t){var r,n=getDefaultBrowser();n&&(r=addListenerToWindow(n,"error",e,!0),t(function(){r()}))},errorSubject=[ERROR_SUBJECT_NAME,observeError],PROMISE_REJECTION_SUBJECT_NAME="perr_0",observePromiseRejection=function(e,t){var r,n=getDefaultBrowser();n&&(r=addListenerToWindow(n,"unhandledrejection",e,!0),t(function(){r()}))},promiseRejectionSubject=[PROMISE_REJECTION_SUBJECT_NAME,observePromiseRejection],isSameErrorString=function(e,t){return e&&t&&e===t},shouldDropEvent=function(e,t){return!(!e||!t)&&!(!isSameErrorString(e.message,t.message)||!isSameErrorString(e.stack,t.stack))},dedupe=function(){var t;return function(e){try{if(shouldDropEvent(e,t))return void(t=e)}catch(e){reportSelfError(e)}return t=e}},jsErrorGetterWithContext=function(o,e,t,r){function n(e){var t=e.error,r=e.extra,n=e.react,e=e.source;!(t=f?_(t):t)||!t.message||l&&l.test(t.message)||o({ev_type:JS_ERROR_EV_TYPE,payload:{error:t,breadcrumbs:[],extra:r,react:n,source:e}})}var i=__read(t,3),u=i[0],a=i[1],c=i[2],s=r.ignoreErrors,t=r.onerror,i=r.onunhandledrejection,f=r.dedupe,r=r.captureGlobalAsync,l=getRegexp(s),_=dedupe();return t&&e.push(u[0](function(e){return n({error:normalizeError(e),source:{type:"onerror"}})})),i&&e.push(a[0](function(e){return n({error:normalizeException(e),source:{type:"onunhandledrejection"}})})),r&&e.push(c()[0](function(e){n(e)})),function(e,t,r){return n({error:normalizeUnknownError(e),extra:t,react:r,source:{type:"manual"}})}},JS_ERROR_MONITOR_PLUGIN_NAME="jsError",defaultConfig$1={ignoreErrors:[],onerror:!0,onunhandledrejection:!0,captureGlobalAsync:!1,dedupe:!0};function JsErrorMonitorBasePlugin(t,e){window.removeEventListener("error",t.pcErr,!0),window.removeEventListener("unhandledrejection",t.pcRej,!0);var r=getConfig(e,defaultConfig$1);r&&(r=jsErrorGetterWithContext(function(e){t.getBreadcrumbs&&(e.payload.breadcrumbs=t.getBreadcrumbs()),t.report(e)},e=[],[initSubjectInGlobal(t,errorSubject),initSubjectInGlobal(t,promiseRejectionSubject),function(){return initSubjectInGlobal(t,asyncErrorWithSourceSubject)}],r),registerTearDownGroup(t,JS_ERROR_MONITOR_PLUGIN_NAME,JS_ERROR_EV_TYPE,e),t.provide("captureException",r))}function JsErrorMonitorPlugin(t){t.on("init",function(){var e=null===(e=t.config())||void 0===e?void 0:e.plugins[JS_ERROR_MONITOR_PLUGIN_NAME];JsErrorMonitorBasePlugin(t,e)})}var defaultMetricContext={isSupport:!0,isPolyfill:!1,isBounced:!1,isCustom:!1,type:"perf"},initMetric=function(e,t){return __assign({name:e,value:t},defaultMetricContext)},wrapPerformanceMetric=function(e,t){return{ev_type:PERFORMANCE_METRIC_EV_TYPE,payload:e,overrides:t}},applyReportMetric=function(r){return function(e,t){r(wrapPerformanceMetric(e,t))}},SPA_LOAD_METRIC_NAME="spa_load",PAGE_ACTIVITY_DELAY=100,ROOT_TAGS=["BODY","HTML","HEAD"],SVG_TAG="SVG",DEFAULT_ATTR_NAME="data-apm-action",waitActionComplete=function(e,t,r,n){function o(){e.clearTimeout(i),a&&(i=e.setTimeout(function(){t()},PAGE_ACTIVITY_DELAY))}var i,u,a=!1;return[function(){a=!0,e.clearTimeout(u),u=e.setTimeout(function(){t(!0),r()},n),o()},o,function(){a=!1,e.clearTimeout(i),e.clearTimeout(u)}]},isSupportsElementClosest=function(){var e;return function(){return void 0===e?e="closest"in HTMLElement.prototype:e}}(),findElementWithAttributeByParents=function(e,t,r){void 0===r&&(r=10);for(var n=e,o=0;o<r&&n;o++){if(~ROOT_TAGS.indexOf(n.nodeName))return;if(n.hasAttribute(t))return n;n=n.parentElement}},getActionNameByAttribute=function(e,t){e=isSupportsElementClosest()?e.closest("["+t+"]"):findElementWithAttributeByParents(e,t);if(e)return e.getAttribute(t).trim()},getActionName=function(e,t){return getActionNameByAttribute(e,t)||e.innerText},isSVGTarget=function(e){for(var t=e,r=!1;t;)t.tagName.toUpperCase()===SVG_TAG?r=!(t=null):t=t.parentElement;return r},isElementWithinTwoLevels=function(e){e=e.children;return!e.length||![].slice.call(e).some(function(e){return 0<e.children.length})},isValidTarget=function(e){var t=e.tagName.toUpperCase();return 1===e.nodeType&&!ROOT_TAGS.includes(t)&&!isSVGTarget(e)&&((!e.style||"none"!==e.style.display)&&(!(!["A","BUTTON","INPUT","TEXTAREA"].includes(t)&&!getActionNameByAttribute(e,DEFAULT_ATTR_NAME))||!!isElementWithinTwoLevels(e)))},shouldIgnoreUrl=function(e,t){return!!(e&&e.length&&t&&checkIfHit(e,getFullUrl(t)))},shouldIgnoreEvent=function(e,t){var r;return t.ev_type===HTTP_EV_TYPE?r=t.payload.request.url:t.ev_type===RESOURCE_EV_TYPE&&"name"in t.payload?r=t.payload.name:t.ev_type===RESOURCE_ERROR_EV_TYPE&&(r=t.payload.url),shouldIgnoreUrl(e,r)},SUPPORT_TYPES=["click"],EVENT_LISTENER_OPTIONS={capture:!0},MIN_LONG_TASK=50,MAX_ACTIVITY_DELAY=1e4,applyIncompleteReq=function(e,t,r,n){var o=__read(t,2),i=o[0],u=o[1],t=__read(applyRecord(),3),o=t[0],a=t[1],c=t[2],s=0;return e.push(i[0](function(e){e=__read(e,2);e[0];e=e[1];if(shouldIgnoreUrl(n,e))return noop;var t=s+=1;return a(t,now()),r(),function(){c(t),r()}})),e.push(u[0](function(e){e=__read(e,1)[0],e="string"==typeof e?e:e.url;if(shouldIgnoreUrl(n,e))return noop;var t=s+=1;return a(t,now()),r(),function(){c(t),r()}})),o},actionGetterWithFetchObserver=function(o,t,e,r){function n(e){var t;!E||!l&&!Object.keys(E.metrics).length||Object.keys(y).length&&!e||(E.metrics[LONG_TASK_EV_TYPE]&&(E.metrics[LONG_TASK_EV_TYPE].duration=g),t=0<v.length?Math.max.apply(Math,__spreadArray([],__read(v),!1))-Math.min.apply(Math,__spreadArray([],__read(v),!1)):0,E.metrics[HTTP_EV_TYPE]&&(E.metrics[HTTP_EV_TYPE].duration=t),e=h()-E.start_time,d&&d({ev_type:ACTION_EV_TYPE,payload:__assign(__assign({},E),{duration:e,frontend_time:e-t})}),i())}function i(){A(),E&&(p={start_time:E.start_time,id:E.id}),E=null,v=[],g=0}function u(e){E&&(E.metrics[e]={count:(null!==(e=null===(e=E.metrics[e])||void 0===e?void 0:e.count)&&void 0!==e?e:0)+1})}var a=__read(e,4),c=a[0],s=a[1],f=a[2],e=a[3],a=r.types,l=r.pure,_=r.ignoreUrls,E=null,p=null,d=void 0,v=[],g=0,h=__read(applyPerformance(performance),2)[1],r=__read(waitActionComplete(window,n,i,MAX_ACTIVITY_DELAY),3),T=r[0],R=r[1],A=r[2],y=applyIncompleteReq(t,[c,s],R,_),c=__read(applyMutationObserver(MutationObserver,R),2),s=c[0],c=c[1];s(),t.push(c),t.push(A),t.push(f[0](function(e){var t=e.startTime,e=e.duration;R(),E&&E.start_time<=t+MIN_LONG_TASK&&(g+=e,u(LONG_TASK_EV_TYPE))})),t.push(e[0](function(e){var t=e.name,r=e.startTime,n=e.duration,e=e.initiatorType;shouldIgnoreUrl(_,t)||(R(),E&&E.start_time<r&&(["xmlhttprequest","fetch"].includes(e)&&(v.push(r,r+n),u(HTTP_EV_TYPE)),["xmlhttprequest","fetch","beacon"].includes(e)||u(RESOURCE_EV_TYPE)))}));function S(e,t){var r=uuid(),n=__read(applyPerformance(performance),2)[1];E={start_time:n(),id:r,type:t,target:e,metrics:{}},d=o(),T()}function m(e){var t;n(!0),i(),e.target instanceof HTMLElement&&isValidTarget(e.target)&&((t=getActionName(e.target,DEFAULT_ATTR_NAME))&&S({name:t,path:htmlTreeAsString(e.target)},e.type))}a&&a.forEach(function(e){arrayIncludes(SUPPORT_TYPES,e)&&t.push(addListenerToDocument(document,e,m,EVENT_LISTENER_OPTIONS))});return[function(e){if(!shouldIgnoreEvent(_,e)){if(e.ev_type===PAGEVIEW_EV_TYPE)return n(!0),void i();if(e.ev_type===HTTP_EV_TYPE)return(t=e.payload.response.timing&&e.payload.response.timing.startTime)?E&&t>E.start_time?E.id:p&&t>p.start_time?p.id:void 0:void 0;if(e.ev_type!==LONG_TASK_EV_TYPE)return E?(e.ev_type!==JS_ERROR_EV_TYPE&&e.ev_type!==RESOURCE_ERROR_EV_TYPE||u(e.ev_type),E.id):void 0;var t=e.payload.longtasks.length&&e.payload.longtasks[0].startTime+MIN_LONG_TASK;return E&&t&&t>E.start_time?E.id:void 0}},function(e,t){n(!0),i(),S({name:e},t)}]},ACTION_MONITOR_PLUGIN_NAME="action",defaultConfig={types:["click"],pure:!0};function ActionMonitorBasePlugin(e,t){void 0===t&&(t=defaultConfig);var r,n,o=[],i=getDefaultDocument(),u=getDefaultBrowser();i&&u&&(t=__read(actionGetterWithFetchObserver(function(){return reportWithCurrentContext(e,!0)},o,[initSubjectInGlobal(e,[XHR_SUBJECT_NAME,applyXHR(XMLHttpRequest&&XMLHttpRequest.prototype)]),initSubjectInGlobal(e,fetchSubject),initSubjectInGlobal(e,longtaskSubject),initSubjectInGlobal(e,resourceSubject)],t),2),r=t[0],t=t[1],e.on("report",n=function(e){var t=r(e);return t&&e.extra&&(e.extra.action_id=t),e}),o.push(function(){e.off("report",n)}),e.provide("startAction",t),registerTearDownGroup(e,ACTION_MONITOR_PLUGIN_NAME,ACTION_EV_TYPE,o))}var MAX_PAGE_DELAY=3e4,getSPA=function(e,t,r,n){function o(e){!E||Object.keys(h).length&&!e||(p(initMetric(SPA_LOAD_METRIC_NAME,now()-E)),i())}function i(){g(),E=0}var u=__read(r,7),a=u[0],c=u[1],s=u[2],f=u[3],l=u[4],r=u[5],u=u[6],_=n.ignoreUrls,E=0,p=applyReportMetric(e),e=__read(waitActionComplete(window,o,noop,MAX_PAGE_DELAY),3),d=e[0],v=e[1],g=e[2],h=applyIncompleteReq(t,[s,f],v,_);t.push(l[0](function(e){e=e.name;shouldIgnoreUrl(_,e)||v()})),t.push(r[0](v));var u=__read(applyMutationObserver(u,v),2),T=u[0],u=u[1];t.push(u);var R=!0;t.push(a[0](function(){R?R=!1:(o(!0),i(),E=now(),T(document,{childList:!0,subtree:!0}),d())})),t.push(c[0](function(){o(!0),i()})),t.push(i)};function SPALoadMonitorPlugin(n,o){void 0===o&&(o={}),n.on("init",function(){var e=[],t=getDefaultDocument(),r=getDefaultMutationObserver();t&&r&&(getSPA(n.report.bind(n),e,[initPrivateSubject(n,[PV_SUBJECT_NAME,applyPV(n)]),initSubjectInGlobal(n,clickSubject),initSubjectInGlobal(n,[XHR_SUBJECT_NAME,applyXHR(XMLHttpRequest&&XMLHttpRequest.prototype)]),initSubjectInGlobal(n,fetchSubject),initSubjectInGlobal(n,resourceSubject),initSubjectInGlobal(n,longtaskSubject),r],o),n.on("beforeDestroy",function(){e.forEach(function(e){return e()})}))})}var CAPTURE_CONSOLE_INTEGRATION_NAME="captureConsole",captureConsole=function(e){var e=e.levels,r=void 0===e?["log","info","warn","error","debug","assert"]:e;return{name:CAPTURE_CONSOLE_INTEGRATION_NAME,setup:function(n){var t,o=getDefaultBrowser();o&&o.console&&(t=[],r.forEach(function(e){e in o.console&&t.push(hookMethodDangerously(o.console,e,function(r){return function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];try{r&&r.call.apply(r,__spreadArray([o.console],__read(e),!1))}finally{n("captureException",safeJoin(e," "))}}})())}),n.on("beforeDestroy",function(){t.forEach(function(e){return e()})}))}}},JS_ERROR_INTEGRATION_NAME=JS_ERROR_MONITOR_PLUGIN_NAME,jsErrorPlugin=function(){return{name:JS_ERROR_INTEGRATION_NAME,setup:function(e){JsErrorMonitorPlugin(e)}}},ACTION_INTEGRATION_NAME=ACTION_MONITOR_PLUGIN_NAME,actionPlugin=function(t){return{name:ACTION_INTEGRATION_NAME,setup:function(e){ActionMonitorBasePlugin(e,t)}}},SPA_LOAD_INTEGRATION_NAME="spa_load",SPALoadPlugin=function(t){return{name:SPA_LOAD_INTEGRATION_NAME,setup:function(e){SPALoadMonitorPlugin(e,t)}}};exports.SPALoadPlugin=SPALoadPlugin,exports.actionPlugin=actionPlugin,exports.captureConsole=captureConsole,exports.jsErrorPlugin=jsErrorPlugin,exports.refreshPreStartContext=refreshPreStartContext; |
@@ -984,2 +984,3 @@ interface ContextAgent { | ||
pure?: boolean; | ||
ignoreUrls?: (string | RegExp)[]; | ||
} | ||
@@ -986,0 +987,0 @@ |
@@ -1,1 +0,1 @@ | ||
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var __assign=function(){return(__assign=Object.assign||function(r){for(var e,t=1,n=arguments.length;t<n;t++)for(var o in e=arguments[t])Object.prototype.hasOwnProperty.call(e,o)&&(r[o]=e[o]);return r}).apply(this,arguments)};function __read(r,e){var t="function"==typeof Symbol&&r[Symbol.iterator];if(!t)return r;var n,o,i=t.call(r),u=[];try{for(;(void 0===e||0<e--)&&!(n=i.next()).done;)u.push(n.value)}catch(r){o={error:r}}finally{try{n&&!n.done&&(t=i.return)&&t.call(i)}finally{if(o)throw o.error}}return u}function __spreadArray(r,e,t){if(t||2===arguments.length)for(var n,o=0,i=e.length;o<i;o++)!n&&o in e||((n=n||Array.prototype.slice.call(e,0,o))[o]=e[o]);return r.concat(n||Array.prototype.slice.call(e))}var noop=function(){return{}};function isObject(r){return"object"==typeof r&&null!==r}function isInstanceOf(r,e){try{return r instanceof e}catch(r){return!1}}var objProto=Object.prototype;function isPlainObject(r){if(isObject(r)){if("function"!=typeof Object.getPrototypeOf)return"[object Object]"===objProto.toString.call(r);r=Object.getPrototypeOf(r);return r===objProto||null===r}return!1}function isArray(r){return"[object Array]"===objProto.toString.call(r)}function isFunction(r){return"function"==typeof r}function isString(r){return"string"==typeof r}function isError(r){switch(Object.prototype.toString.call(r)){case"[object Error]":case"[object Exception]":case"[object DOMError]":case"[object DOMException]":return!0;default:return r instanceof Error}}function isEvent(r){return"undefined"!=typeof Event&&isInstanceOf(r,Event)}function isErrorEvent(r){return"[object ErrorEvent]"===Object.prototype.toString.call(r)}function isPromiseRejectionEvent(r){return"[object PromiseRejectionEvent]"===Object.prototype.toString.call(r)}var pick=function(t,r){return t&&isObject(t)?r.reduce(function(r,e){return r[e]=t[e],r},{}):t};function getRegexp(r){return isArray(r)&&r.length?joinRegExp(r):null}function joinRegExp(r){for(var e=[],t=r.length,n=0;n<t;n++){var o=r[n];isString(o)?e.push(o.replace(/([.*+?^=!:${}()|[\]/\\])/g,"\\$1")):o&&o.source&&e.push(o.source)}return new RegExp(e.join("|"),"i")}function safeStringify(r){try{return isString(r)?r:JSON.stringify(r)}catch(r){return"[FAILED_TO_STRINGIFY]:"+String(r)}}var hookObjectProperty=function(i,u,c,a){return void 0===a&&(a=!0),function(){for(var r=[],e=0;e<arguments.length;e++)r[e]=arguments[e];if(!i)return noop;var t=i[u],n=c.apply(void 0,__spreadArray([t],__read(r),!1)),o=n;return isFunction(o)&&a&&(o=function(){for(var e=[],r=0;r<arguments.length;r++)e[r]=arguments[r];try{return n.apply(this,e)}catch(r){return isFunction(t)&&t.apply(this,e)}}),i[u]=o,function(r){r||(o===i[u]?i[u]=t:n=t)}}},registerTearDownGroup=function(r,e,t,n){return r.destroyAgent.set(e,t,n)};function initSubjectInGlobal(r,e){return r.initSubject(e)}function getDefaultBrowser(){if("object"==typeof window&&isObject(window))return window}function getDefaultXMLHttpRequest(){if("function"==typeof XMLHttpRequest&&isFunction(XMLHttpRequest))return XMLHttpRequest}var getGlobalRegistry=function(r){if(r)return r.__SLARDAR_REGISTRY__||(r.__SLARDAR_REGISTRY__={Slardar:{plugins:[],errors:[],subject:{}}}),r.__SLARDAR_REGISTRY__.Slardar},reportSelfError=function(){for(var r=[],e=0;e<arguments.length;e++)r[e]=arguments[e];var t=getGlobalRegistry(getDefaultBrowser());t&&(t.errors||(t.errors=[]),t.errors.push(r))},addListenerToWindow=function(r,e,t,n){return void 0===n&&(n=!1),r.addEventListener(e,t,n),function(){r.removeEventListener(e,t,n)}},getConfig=function(r,e){return isObject(r)?__assign(__assign({},e),r):!!r&&e},JS_ERROR_EV_TYPE="js_error";function getPluginConfig(r,e,t){e=null===(r=r.config())||void 0===r?void 0:r.plugins[e];return getConfig(e,t)}var ERROR_FIELDS=["name","message","stack","filename","lineno","colno"],normalize=function(r){var e;return isError(r)?e=pick(r,ERROR_FIELDS):(isPlainObject(r)||isEvent(r)||isString(r))&&(e={message:safeStringify(r)}),e},normalizeError=function(r){return normalize(r.error)},normalizeException=function(r){var e;try{var t=void 0;if("reason"in r?t=r.reason:"detail"in r&&"reason"in r.detail&&(t=r.detail.reason),t){var n=normalize(t);return __assign(__assign({},n),{name:null!==(e=n&&n.name)&&void 0!==e?e:"UnhandledRejection"})}}catch(r){}},normalizeUnknownError=function(r){return(isErrorEvent(r)?normalizeError:isPromiseRejectionEvent(r)?normalizeException:normalize)(r)},DEFAULT_EVENT_TARGET=["EventTarget","Window","Node","ApplicationCache","ChannelMergerNode","EventSource","FileReader","HTMLUnknownElement","IDBDatabase","IDBRequest","IDBTransaction","MessagePort","Notification","SVGElementInstance","Screen","TextTrack","TextTrackCue","TextTrackList","WebSocket","Worker","XMLHttpRequest","XMLHttpRequestEventTarget","XMLHttpRequestUpload"],DEFAULT_TIME_FUNCTION=["setTimeout","setInterval","requestAnimationFrame","requestIdleCallback"],xmlHttpRequestProps=["onload","onerror","onprogress","onreadystatechange"],ADD_EVENT_LISTENER="addEventListener",REMOVE_EVENT_LISTENER="removeEventListener",DEFAULT_SOURCE_TYPE="capture-global",observeAsyncErrorWithSource=function(o,r){function u(r,t){if(!isFunction(r))return r;var n={type:DEFAULT_SOURCE_TYPE,data:__assign({},t)},e=r._w_||(r._w_=function(){try{return(r.handleEvent&&isFunction(r.handleEvent)?r.handleEvent:r).apply(this,[].map.call(arguments,function(r){return u(r,t)}))}catch(r){var e=normalize(r);throw e&&o({source:n,error:e}),r}});return e._hook_=!0,e}var e=getDefaultBrowser(),t=getDefaultXMLHttpRequest(),n=[];e&&n.push.apply(n,__spreadArray([],__read(DEFAULT_TIME_FUNCTION.filter(function(r){return e[r]}).map(function(o){return hookObjectProperty(e,o,function(n){return function(r){for(var e=[],t=1;t<arguments.length;t++)e[t-1]=arguments[t];return n&&n.call.apply(n,__spreadArray([this,u(r,{function:o})],__read(e),!1))}},!1)()})),!1)),t&&t.prototype&&n.push(hookObjectProperty(t.prototype,"send",function(n){return function(){for(var e=this,r=[],t=0;t<arguments.length;t++)r[t]=arguments[t];return xmlHttpRequestProps.filter(function(r){return e[r]&&!e[r]._hook_}).forEach(function(r){e[r]=u(e[r],{function:r})}),n.apply(this,r)}},!1)()),DEFAULT_EVENT_TARGET.forEach(function(i){var r=e&&e[i]&&e[i].prototype;r&&r[ADD_EVENT_LISTENER]&&(n.push(hookObjectProperty(r,ADD_EVENT_LISTENER,function(o){return function(r,e,t){try{var n=e.handleEvent;isFunction(n)&&(e.handleEvent=u(n,{function:"handleEvent",target:i}))}catch(r){}return o&&o.call(this,r,u(e,{function:ADD_EVENT_LISTENER,target:i}),t)}},!1)()),n.push(hookObjectProperty(r,REMOVE_EVENT_LISTENER,function(n){return function(r,e,t){return null!=e&&e._w_&&n.call(this,r,e._w_,t),n.call(this,r,e,t)}},!1)()))}),r(function(){return n.forEach(function(r){return r()})})},ASYNC_ERROR_SUBJECT_NAME="async_error_0",asyncErrorWithSourceSubject=[ASYNC_ERROR_SUBJECT_NAME,observeAsyncErrorWithSource],ERROR_SUBJECT_NAME="err_0",observeError=function(r,e){var t,n=getDefaultBrowser();n&&(t=addListenerToWindow(n,"error",r,!0),e(function(){t()}))},errorSubject=[ERROR_SUBJECT_NAME,observeError],PROMISE_REJECTION_SUBJECT_NAME="perr_0",observePromiseRejection=function(r,e){var t,n=getDefaultBrowser();n&&(t=addListenerToWindow(n,"unhandledrejection",r,!0),e(function(){t()}))},promiseRejectionSubject=[PROMISE_REJECTION_SUBJECT_NAME,observePromiseRejection],isSameErrorString=function(r,e){return r&&e&&r===e},shouldDropEvent=function(r,e){return!(!r||!e)&&!(!isSameErrorString(r.message,e.message)||!isSameErrorString(r.stack,e.stack))},dedupe=function(){var e;return function(r){try{if(shouldDropEvent(r,e))return void(e=r)}catch(r){reportSelfError(r)}return e=r}},jsErrorGetterWithContext=function(o,r,e,t){function n(r){var e=r.error,t=r.extra,n=r.react,r=r.source;!(e=E?f(e):e)||!e.message||l&&l.test(e.message)||o({ev_type:JS_ERROR_EV_TYPE,payload:{error:e,breadcrumbs:[],extra:t,react:n,source:r}})}var i=__read(e,3),u=i[0],c=i[1],a=i[2],s=t.ignoreErrors,e=t.onerror,i=t.onunhandledrejection,E=t.dedupe,t=t.captureGlobalAsync,l=getRegexp(s),f=dedupe();return e&&r.push(u[0](function(r){return n({error:normalizeError(r),source:{type:"onerror"}})})),i&&r.push(c[0](function(r){return n({error:normalizeException(r),source:{type:"onunhandledrejection"}})})),t&&r.push(a()[0](function(r){n(r)})),function(r,e,t){return n({error:normalizeUnknownError(r),extra:e,react:t,source:{type:"manual"}})}},JS_ERROR_MONITOR_PLUGIN_NAME="jsError",defaultConfig={ignoreErrors:[],onerror:!0,onunhandledrejection:!0,captureGlobalAsync:!1,dedupe:!0};function JsErrorMonitorPlugin(t){t.on("init",function(){window.removeEventListener("error",t.pcErr,!0),window.removeEventListener("unhandledrejection",t.pcRej,!0);var r,e=getPluginConfig(t,JS_ERROR_MONITOR_PLUGIN_NAME,defaultConfig);e&&(e=jsErrorGetterWithContext(function(r){t.getBreadcrumbs&&(r.payload.breadcrumbs=t.getBreadcrumbs()),t.report(r)},r=[],[initSubjectInGlobal(t,errorSubject),initSubjectInGlobal(t,promiseRejectionSubject),function(){return initSubjectInGlobal(t,asyncErrorWithSourceSubject)}],e),registerTearDownGroup(t,JS_ERROR_MONITOR_PLUGIN_NAME,JS_ERROR_EV_TYPE,r),t.provide("captureException",e))})}var JS_ERROR_INTEGRATION_NAME=JS_ERROR_MONITOR_PLUGIN_NAME,jsErrorPlugin=function(){return{name:JS_ERROR_INTEGRATION_NAME,setup:function(r){JsErrorMonitorPlugin(r)}}};exports.JS_ERROR_INTEGRATION_NAME=JS_ERROR_INTEGRATION_NAME,exports.jsErrorPlugin=jsErrorPlugin; | ||
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var __assign=function(){return(__assign=Object.assign||function(r){for(var e,t=1,n=arguments.length;t<n;t++)for(var o in e=arguments[t])Object.prototype.hasOwnProperty.call(e,o)&&(r[o]=e[o]);return r}).apply(this,arguments)};function __read(r,e){var t="function"==typeof Symbol&&r[Symbol.iterator];if(!t)return r;var n,o,i=t.call(r),u=[];try{for(;(void 0===e||0<e--)&&!(n=i.next()).done;)u.push(n.value)}catch(r){o={error:r}}finally{try{n&&!n.done&&(t=i.return)&&t.call(i)}finally{if(o)throw o.error}}return u}function __spreadArray(r,e,t){if(t||2===arguments.length)for(var n,o=0,i=e.length;o<i;o++)!n&&o in e||((n=n||Array.prototype.slice.call(e,0,o))[o]=e[o]);return r.concat(n||Array.prototype.slice.call(e))}var noop=function(){return{}};function isObject(r){return"object"==typeof r&&null!==r}function isInstanceOf(r,e){try{return r instanceof e}catch(r){return!1}}var objProto=Object.prototype;function isPlainObject(r){if(isObject(r)){if("function"!=typeof Object.getPrototypeOf)return"[object Object]"===objProto.toString.call(r);r=Object.getPrototypeOf(r);return r===objProto||null===r}return!1}function isArray(r){return"[object Array]"===objProto.toString.call(r)}function isFunction(r){return"function"==typeof r}function isString(r){return"string"==typeof r}function isError(r){switch(Object.prototype.toString.call(r)){case"[object Error]":case"[object Exception]":case"[object DOMError]":case"[object DOMException]":return!0;default:return r instanceof Error}}function isEvent(r){return"undefined"!=typeof Event&&isInstanceOf(r,Event)}function isErrorEvent(r){return"[object ErrorEvent]"===Object.prototype.toString.call(r)}function isPromiseRejectionEvent(r){return"[object PromiseRejectionEvent]"===Object.prototype.toString.call(r)}var pick=function(t,r){return t&&isObject(t)?r.reduce(function(r,e){return r[e]=t[e],r},{}):t};function getRegexp(r){return isArray(r)&&r.length?joinRegExp(r):null}function joinRegExp(r){for(var e=[],t=r.length,n=0;n<t;n++){var o=r[n];isString(o)?e.push(o.replace(/([.*+?^=!:${}()|[\]/\\])/g,"\\$1")):o&&o.source&&e.push(o.source)}return new RegExp(e.join("|"),"i")}function safeStringify(r){try{return isString(r)?r:JSON.stringify(r)}catch(r){return"[FAILED_TO_STRINGIFY]:"+String(r)}}var hookObjectProperty=function(i,u,c,a){return void 0===a&&(a=!0),function(){for(var r=[],e=0;e<arguments.length;e++)r[e]=arguments[e];if(!i)return noop;var t=i[u],n=c.apply(void 0,__spreadArray([t],__read(r),!1)),o=n;return isFunction(o)&&a&&(o=function(){for(var e=[],r=0;r<arguments.length;r++)e[r]=arguments[r];try{return n.apply(this,e)}catch(r){return isFunction(t)&&t.apply(this,e)}}),i[u]=o,function(r){r||(o===i[u]?i[u]=t:n=t)}}},registerTearDownGroup=function(r,e,t,n){return r.destroyAgent.set(e,t,n)};function initSubjectInGlobal(r,e){return r.initSubject(e)}function getDefaultBrowser(){if("object"==typeof window&&isObject(window))return window}function getDefaultXMLHttpRequest(){if("function"==typeof XMLHttpRequest&&isFunction(XMLHttpRequest))return XMLHttpRequest}var getGlobalRegistry=function(r){if(r)return r.__SLARDAR_REGISTRY__||(r.__SLARDAR_REGISTRY__={Slardar:{plugins:[],errors:[],subject:{}}}),r.__SLARDAR_REGISTRY__.Slardar},reportSelfError=function(){for(var r=[],e=0;e<arguments.length;e++)r[e]=arguments[e];var t=getGlobalRegistry(getDefaultBrowser());t&&(t.errors||(t.errors=[]),t.errors.push(r))},addListenerToWindow=function(r,e,t,n){return void 0===n&&(n=!1),r.addEventListener(e,t,n),function(){r.removeEventListener(e,t,n)}},getConfig=function(r,e){return isObject(r)?__assign(__assign({},e),r):!!r&&e},JS_ERROR_EV_TYPE="js_error",ERROR_FIELDS=["name","message","stack","filename","lineno","colno"],normalize=function(r){var e;return isError(r)?e=pick(r,ERROR_FIELDS):(isPlainObject(r)||isEvent(r)||isString(r))&&(e={message:safeStringify(r)}),e},normalizeError=function(r){return normalize(r.error)},normalizeException=function(r){var e;try{var t=void 0;if("reason"in r?t=r.reason:"detail"in r&&"reason"in r.detail&&(t=r.detail.reason),t){var n=normalize(t);return __assign(__assign({},n),{name:null!==(e=n&&n.name)&&void 0!==e?e:"UnhandledRejection"})}}catch(r){}},normalizeUnknownError=function(r){return(isErrorEvent(r)?normalizeError:isPromiseRejectionEvent(r)?normalizeException:normalize)(r)},DEFAULT_EVENT_TARGET=["EventTarget","Window","Node","ApplicationCache","ChannelMergerNode","EventSource","FileReader","HTMLUnknownElement","IDBDatabase","IDBRequest","IDBTransaction","MessagePort","Notification","SVGElementInstance","Screen","TextTrack","TextTrackCue","TextTrackList","WebSocket","Worker","XMLHttpRequest","XMLHttpRequestEventTarget","XMLHttpRequestUpload"],DEFAULT_TIME_FUNCTION=["setTimeout","setInterval","requestAnimationFrame","requestIdleCallback"],xmlHttpRequestProps=["onload","onerror","onprogress","onreadystatechange"],ADD_EVENT_LISTENER="addEventListener",REMOVE_EVENT_LISTENER="removeEventListener",DEFAULT_SOURCE_TYPE="capture-global",observeAsyncErrorWithSource=function(o,r){function u(r,t){if(!isFunction(r))return r;var n={type:DEFAULT_SOURCE_TYPE,data:__assign({},t)},e=r._w_||(r._w_=function(){try{return(r.handleEvent&&isFunction(r.handleEvent)?r.handleEvent:r).apply(this,[].map.call(arguments,function(r){return u(r,t)}))}catch(r){var e=normalize(r);throw e&&o({source:n,error:e}),r}});return e._hook_=!0,e}var e=getDefaultBrowser(),t=getDefaultXMLHttpRequest(),n=[];e&&n.push.apply(n,__spreadArray([],__read(DEFAULT_TIME_FUNCTION.filter(function(r){return e[r]}).map(function(o){return hookObjectProperty(e,o,function(n){return function(r){for(var e=[],t=1;t<arguments.length;t++)e[t-1]=arguments[t];return n&&n.call.apply(n,__spreadArray([this,u(r,{function:o})],__read(e),!1))}},!1)()})),!1)),t&&t.prototype&&n.push(hookObjectProperty(t.prototype,"send",function(n){return function(){for(var e=this,r=[],t=0;t<arguments.length;t++)r[t]=arguments[t];return xmlHttpRequestProps.filter(function(r){return e[r]&&!e[r]._hook_}).forEach(function(r){e[r]=u(e[r],{function:r})}),n.apply(this,r)}},!1)()),DEFAULT_EVENT_TARGET.forEach(function(i){var r=e&&e[i]&&e[i].prototype;r&&r[ADD_EVENT_LISTENER]&&(n.push(hookObjectProperty(r,ADD_EVENT_LISTENER,function(o){return function(r,e,t){try{var n=e.handleEvent;isFunction(n)&&(e.handleEvent=u(n,{function:"handleEvent",target:i}))}catch(r){}return o&&o.call(this,r,u(e,{function:ADD_EVENT_LISTENER,target:i}),t)}},!1)()),n.push(hookObjectProperty(r,REMOVE_EVENT_LISTENER,function(n){return function(r,e,t){return null!=e&&e._w_&&n.call(this,r,e._w_,t),n.call(this,r,e,t)}},!1)()))}),r(function(){return n.forEach(function(r){return r()})})},ASYNC_ERROR_SUBJECT_NAME="async_error_0",asyncErrorWithSourceSubject=[ASYNC_ERROR_SUBJECT_NAME,observeAsyncErrorWithSource],ERROR_SUBJECT_NAME="err_0",observeError=function(r,e){var t,n=getDefaultBrowser();n&&(t=addListenerToWindow(n,"error",r,!0),e(function(){t()}))},errorSubject=[ERROR_SUBJECT_NAME,observeError],PROMISE_REJECTION_SUBJECT_NAME="perr_0",observePromiseRejection=function(r,e){var t,n=getDefaultBrowser();n&&(t=addListenerToWindow(n,"unhandledrejection",r,!0),e(function(){t()}))},promiseRejectionSubject=[PROMISE_REJECTION_SUBJECT_NAME,observePromiseRejection],isSameErrorString=function(r,e){return r&&e&&r===e},shouldDropEvent=function(r,e){return!(!r||!e)&&!(!isSameErrorString(r.message,e.message)||!isSameErrorString(r.stack,e.stack))},dedupe=function(){var e;return function(r){try{if(shouldDropEvent(r,e))return void(e=r)}catch(r){reportSelfError(r)}return e=r}},jsErrorGetterWithContext=function(o,r,e,t){function n(r){var e=r.error,t=r.extra,n=r.react,r=r.source;!(e=E?f(e):e)||!e.message||l&&l.test(e.message)||o({ev_type:JS_ERROR_EV_TYPE,payload:{error:e,breadcrumbs:[],extra:t,react:n,source:r}})}var i=__read(e,3),u=i[0],c=i[1],a=i[2],s=t.ignoreErrors,e=t.onerror,i=t.onunhandledrejection,E=t.dedupe,t=t.captureGlobalAsync,l=getRegexp(s),f=dedupe();return e&&r.push(u[0](function(r){return n({error:normalizeError(r),source:{type:"onerror"}})})),i&&r.push(c[0](function(r){return n({error:normalizeException(r),source:{type:"onunhandledrejection"}})})),t&&r.push(a()[0](function(r){n(r)})),function(r,e,t){return n({error:normalizeUnknownError(r),extra:e,react:t,source:{type:"manual"}})}},JS_ERROR_MONITOR_PLUGIN_NAME="jsError",defaultConfig={ignoreErrors:[],onerror:!0,onunhandledrejection:!0,captureGlobalAsync:!1,dedupe:!0};function JsErrorMonitorBasePlugin(e,r){window.removeEventListener("error",e.pcErr,!0),window.removeEventListener("unhandledrejection",e.pcRej,!0);var t=getConfig(r,defaultConfig);t&&(t=jsErrorGetterWithContext(function(r){e.getBreadcrumbs&&(r.payload.breadcrumbs=e.getBreadcrumbs()),e.report(r)},r=[],[initSubjectInGlobal(e,errorSubject),initSubjectInGlobal(e,promiseRejectionSubject),function(){return initSubjectInGlobal(e,asyncErrorWithSourceSubject)}],t),registerTearDownGroup(e,JS_ERROR_MONITOR_PLUGIN_NAME,JS_ERROR_EV_TYPE,r),e.provide("captureException",t))}function JsErrorMonitorPlugin(e){e.on("init",function(){var r=null===(r=e.config())||void 0===r?void 0:r.plugins[JS_ERROR_MONITOR_PLUGIN_NAME];JsErrorMonitorBasePlugin(e,r)})}var JS_ERROR_INTEGRATION_NAME=JS_ERROR_MONITOR_PLUGIN_NAME,jsErrorPlugin=function(){return{name:JS_ERROR_INTEGRATION_NAME,setup:function(r){JsErrorMonitorPlugin(r)}}};exports.JS_ERROR_INTEGRATION_NAME=JS_ERROR_INTEGRATION_NAME,exports.jsErrorPlugin=jsErrorPlugin; |
@@ -984,2 +984,3 @@ interface ContextAgent { | ||
pure?: boolean; | ||
ignoreUrls?: (string | RegExp)[]; | ||
} | ||
@@ -986,0 +987,0 @@ |
@@ -984,2 +984,3 @@ interface ContextAgent { | ||
pure?: boolean; | ||
ignoreUrls?: (string | RegExp)[]; | ||
} | ||
@@ -986,0 +987,0 @@ |
@@ -984,2 +984,3 @@ interface ContextAgent { | ||
pure?: boolean; | ||
ignoreUrls?: (string | RegExp)[]; | ||
} | ||
@@ -999,2 +1000,6 @@ | ||
interface SPALoadMonitorConfig { | ||
ignoreUrls?: (string | RegExp)[]; | ||
} | ||
declare type CustomEventData = { | ||
@@ -1219,3 +1224,3 @@ name: string; | ||
declare const SPA_LOAD_INTEGRATION_NAME = "spa_load"; | ||
declare const SPALoadPlugin: () => { | ||
declare const SPALoadPlugin: (config?: SPALoadMonitorConfig | undefined) => { | ||
name: string; | ||
@@ -1222,0 +1227,0 @@ setup: (client: WebClient) => void; |
@@ -1,1 +0,1 @@ | ||
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var __assign=function(){return(__assign=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var o in t=arguments[n])Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o]);return e}).apply(this,arguments)};function __read(e,t){var n="function"==typeof Symbol&&e[Symbol.iterator];if(!n)return e;var r,o,i=n.call(e),u=[];try{for(;(void 0===t||0<t--)&&!(r=i.next()).done;)u.push(r.value)}catch(e){o={error:e}}finally{try{r&&!r.done&&(n=i.return)&&n.call(i)}finally{if(o)throw o.error}}return u}function __spreadArray(e,t,n){if(n||2===arguments.length)for(var r,o=0,i=t.length;o<i;o++)!r&&o in t||((r=r||Array.prototype.slice.call(t,0,o))[o]=t[o]);return e.concat(r||Array.prototype.slice.call(t))}var noop=function(){return{}};function isObject(e){return"object"==typeof e&&null!==e}function isUndefined(e){return void 0===e}var objProto=Object.prototype;function isArray(e){return"[object Array]"===objProto.toString.call(e)}function isFunction(e){return"function"==typeof e}var arrayRemove=function(e,t){if(!isArray(e))return e;var n=e.indexOf(t);if(0<=n){t=e.slice();return t.splice(n,1),t}return e},applyRecord=function(){var n={};return[n,function(e,t){return n[e]=t},function(e){return delete n[e]}]},hookMethodDangerously=function(i,u,c){return function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];if(!i)return noop;var n=i[u],r=c.apply(void 0,__spreadArray([n],__read(e),!1)),o=r;return isFunction(o)&&(o=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];return r.apply(this,e)}),i[u]=o,function(){o===i[u]?i[u]=n:r=n}}},BUFFER_TIME=3e5,applyBufferTimer=function(e,t,n){var r=0;return-1===n?noop:function(){if(e())return r&&clearTimeout(r),void(r=0);0===r&&(r=setTimeout(t,n))}},nextLink=function(r,e){var t=[];try{t=e.reduce(function(e,t){try{var n=t(r);"function"==typeof n&&e.push(n)}catch(e){}return e},[])}catch(e){}return function(e){return nextLink(e,t)}},toObservable=function(e){function t(e){r=arrayRemove(r,e),i||u()}var n,r=[],o=[],i=!1,u=applyBufferTimer(function(){return!!r.length},function(){i=!0,n&&n[0](),o.forEach(function(e){return e()}),o.length=0,n=void 0},e=void 0===e?BUFFER_TIME:e);return{next:function(e){return nextLink(e,r)},complete:function(e){o.push(e)},attach:function(e,t){n=[e,t]},subscribe:function(e){if(i)throw new Error("Observer is closed");return r.push(e),n&&n[1]&&n[1](e),u(),function(){return t(e)}},unsubscribe:t}},createSafeObserver=function(e,t,n){n=toObservable(n);try{e(n.next,n.attach),t&&n.complete(t)}catch(e){}return[n.subscribe,n.unsubscribe]};function initSubjectInGlobal(e,t){return e.initSubject(t)}function initPrivateSubject(e,t,n){var t=__read(t,2),r=t[0],t=t[1],o=e.privateSubject||{};return o[r]||(o[r]=createSafeObserver(t,function(){o[r]=void 0},n)),o[r]}var now=function(){return Date.now()};function getDefaultBrowser(){if("object"==typeof window&&isObject(window))return window}function getDefaultDocument(){if("object"==typeof document&&isObject(document))return document}function getDefaultLocation(){return getDefaultBrowser()&&window.location}function getDefaultMutationObserver(){if(getDefaultBrowser()&&isFunction(window.MutationObserver))return window.MutationObserver}function getDefaultPerformanceObserver(){if(getDefaultBrowser()&&isFunction(window.PerformanceObserver))return window.PerformanceObserver}function getLocationUrl(){var e=getDefaultBrowser()&&getDefaultLocation();return e?e.href:""}var getViewOverrides=function(e){return{pid:e.pid,view_id:e.viewId,url:getLocationUrl()}},getOverrides=function(e){var t=e.config(),t=getViewOverrides(t);return t.context=e.context?e.context.toString():{},t},PV_SUBJECT_NAME="view_0",applyPV=function(o){return function(n,e){function t(e){var t;e.viewId&&e.viewId!==(null===(t=o.config())||void 0===t?void 0:t.viewId)&&(n(r),r=__assign(__assign({},getOverrides(o)),getViewOverrides(e)))}var r=getOverrides(o);o.on("beforeConfig",t),e(function(){o.off("beforeConfig",t)})}},applyMutationObserver=function(e,t){var n=e&&new e(t);return[function(e,t){n&&e&&n.observe(e,t)},function(){return n&&n.disconnect()}]},addListenerToDocument=function(e,t,n,r){return void 0===r&&(r=!1),e.addEventListener(t,n,r),function(){e.removeEventListener(t,n,r)}},XHR_SUBJECT_NAME="xhr_0",getReportPathRegExp=function(){var t=new RegExp("\\/monitor_web\\/collect|\\/monitor_browser\\/collect\\/batch","i");return function(e){return t.test(e)}},hookOpen=function(r){return function(){for(var e,t=[],n=0;n<arguments.length;n++)t[n]=arguments[n];return e=__read(t,2),this._method=e[0],this._url=e[1],r.apply(this,t)}},hookSetHeader=function(o){return function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];this._reqHeaders=this._reqHeaders||{};var n=__read(e,2),r=n[0],n=n[1];return this._reqHeaders[r]=n,o&&o.apply(this,e)}},hookOnreadystatechange=function(r,o){return hookMethodDangerously(r,"onreadystatechange",function(n){return function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];return 4===this.readyState&&o(r),n&&n.apply(this,e)}})},hookSend=function(r,o){var i=getReportPathRegExp();return function(){for(var e,t=[],n=0;n<arguments.length;n++)t[n]=arguments[n];return this._start=now(),this._data=null==t?void 0:t[0],i(this._url)||(e=o([this._method,this._url,this._start,this]),hookOnreadystatechange(this,e)()),r.apply(this,t)}},applyXHR=function(r){return function(e,t){var n;r&&((n=[]).push(hookMethodDangerously(r,"open",hookOpen)()),n.push(hookMethodDangerously(r,"setRequestHeader",hookSetHeader)()),n.push(hookMethodDangerously(r,"send",hookSend)(e)),t(function(){n.forEach(function(e){return e()})}))}},FETCH_SUBJECT_NAME="fetch_0",hookFetch=function(r,o){return function(e,t){var n=o([e,t=void 0===t?{}:t]),t=r(e,t);return t.then(function(e){n(e)},function(){n(void 0)}),t}},observeFetch=function(e,t){var n,r=getDefaultBrowser();r&&fetch&&((n=[]).push(hookMethodDangerously(r,"fetch",hookFetch)(e)),t(function(){n.forEach(function(e){return e()})}))},fetchSubject=[FETCH_SUBJECT_NAME,observeFetch],RESOURCE_TYPE=["resource"],LONGTASK_TYPE=["longtask"],applyPerformanceObserver=function(r,o,i){var u=r&&new r(function(e,r){e.getEntries?e.getEntries().forEach(function(e,t,n){return o(e,t,n,r)}):i&&i()});return[function(e){if(!r||!u)return i&&i();try{u.observe({entryTypes:e})}catch(e){return i&&i()}},function(e,t){if(!r||!u)return i&&i();try{var n={type:e,buffered:!0};isUndefined(t)||(n.durationThreshold=t),u.observe(n)}catch(e){return i&&i()}u.observe({type:e,buffered:!1})},function(){return u&&u.disconnect()}]},observePerf=function(e,t,n){e=__read(applyPerformanceObserver(e,t),3),t=e[0],e=e[2];return t(n),e},LONGTASK_SUBJECT_NAME="longtask_0",observeLongtask=function(e,t){var n=getDefaultPerformanceObserver();n&&t(observePerf(n,e,LONGTASK_TYPE))},longtaskSubject=[LONGTASK_SUBJECT_NAME,observeLongtask],RESOURCE_SUBJECT_NAME="resource_0",observeResource=function(e,t){var n=getDefaultPerformanceObserver();n&&t(observePerf(n,e,RESOURCE_TYPE))},resourceSubject=[RESOURCE_SUBJECT_NAME,observeResource],PERFORMANCE_METRIC_EV_TYPE="performance",CLICK_EVENT_NAME="click",CLICK_SUBJECT_NAME=CLICK_EVENT_NAME+"_0",observeClick=function(e,t){var n,r=getDefaultDocument();r&&(n=addListenerToDocument(r,CLICK_EVENT_NAME,e,!0),t(function(){n()}))},clickSubject=[CLICK_SUBJECT_NAME,observeClick],defaultMetricContext={isSupport:!0,isPolyfill:!1,isBounced:!1,isCustom:!1,type:"perf"},initMetric=function(e,t){return __assign({name:e,value:t},defaultMetricContext)},wrapPerformanceMetric=function(e,t){return{ev_type:PERFORMANCE_METRIC_EV_TYPE,payload:e,overrides:t}},applyReportMetric=function(n){return function(e,t){n(wrapPerformanceMetric(e,t))}},SPA_LOAD_METRIC_NAME="spa_load",PAGE_ACTIVITY_DELAY=100,waitActionComplete=function(e,t,n,r){function o(){e.clearTimeout(i),c&&(i=e.setTimeout(function(){t()},PAGE_ACTIVITY_DELAY))}var i,u,c=!1;return[function(){c=!0,e.clearTimeout(u),u=e.setTimeout(function(){t(!0),n()},r),o()},o,function(){c=!1,e.clearTimeout(i),e.clearTimeout(u)}]},applyIncompleteReq=function(e,t,n){var r=__read(t,2),o=r[0],i=r[1],t=__read(applyRecord(),3),r=t[0],u=t[1],c=t[2],a=0;return e.push(o[0](function(e){__read(e,1)[0];var t=a+=1;return u(t,now()),n(),function(){c(t),n()}})),e.push(i[0](function(){var e=a+=1;return u(e,now()),n(),function(){c(e),n()}})),r},MAX_PAGE_DELAY=3e4,getSPA=function(e,t,n){function r(e){!_||Object.keys(h).length&&!e||(p(initMetric(SPA_LOAD_METRIC_NAME,now()-_)),o())}function o(){d(),_=0}var i=__read(n,7),u=i[0],c=i[1],a=i[2],f=i[3],s=i[4],l=i[5],n=i[6],_=0,p=applyReportMetric(e),i=__read(waitActionComplete(window,r,noop,MAX_PAGE_DELAY),3),v=i[0],e=i[1],d=i[2],h=applyIncompleteReq(t,[a,f],e);t.push(s[0](e)),t.push(l[0](e));var e=__read(applyMutationObserver(n,e),2),E=e[0],e=e[1];t.push(e);var b=!0;t.push(u[0](function(){b?b=!1:(r(!0),o(),_=now(),E(document,{childList:!0,subtree:!0}),v())})),t.push(c[0](function(){r(!0),o()})),t.push(o)};function SPALoadMonitorPlugin(r){r.on("init",function(){var e=[],t=getDefaultDocument(),n=getDefaultMutationObserver();t&&n&&(getSPA(r.report.bind(r),e,[initPrivateSubject(r,[PV_SUBJECT_NAME,applyPV(r)]),initSubjectInGlobal(r,clickSubject),initSubjectInGlobal(r,[XHR_SUBJECT_NAME,applyXHR(XMLHttpRequest&&XMLHttpRequest.prototype)]),initSubjectInGlobal(r,fetchSubject),initSubjectInGlobal(r,resourceSubject),initSubjectInGlobal(r,longtaskSubject),n]),r.on("beforeDestroy",function(){e.forEach(function(e){return e()})}))})}var SPA_LOAD_INTEGRATION_NAME="spa_load",SPALoadPlugin=function(){return{name:SPA_LOAD_INTEGRATION_NAME,setup:function(e){SPALoadMonitorPlugin(e)}}};exports.SPALoadPlugin=SPALoadPlugin,exports.SPA_LOAD_INTEGRATION_NAME=SPA_LOAD_INTEGRATION_NAME; | ||
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var __assign=function(){return(__assign=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var o in t=arguments[n])Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o]);return e}).apply(this,arguments)};function __read(e,t){var n="function"==typeof Symbol&&e[Symbol.iterator];if(!n)return e;var r,o,i=n.call(e),u=[];try{for(;(void 0===t||0<t--)&&!(r=i.next()).done;)u.push(r.value)}catch(e){o={error:e}}finally{try{r&&!r.done&&(n=i.return)&&n.call(i)}finally{if(o)throw o.error}}return u}function __spreadArray(e,t,n){if(n||2===arguments.length)for(var r,o=0,i=t.length;o<i;o++)!r&&o in t||((r=r||Array.prototype.slice.call(t,0,o))[o]=t[o]);return e.concat(r||Array.prototype.slice.call(t))}var noop=function(){return{}};function isObject(e){return"object"==typeof e&&null!==e}function isUndefined(e){return void 0===e}var objProto=Object.prototype;function isArray(e){return"[object Array]"===objProto.toString.call(e)}function isFunction(e){return"function"==typeof e}function isString(e){return"string"==typeof e}var arrayRemove=function(e,t){if(!isArray(e))return e;var n=e.indexOf(t);if(0<=n){t=e.slice();return t.splice(n,1),t}return e},applyRecord=function(){var n={};return[n,function(e,t){return n[e]=t},function(e){return delete n[e]}]};function getRegexp(e){return isArray(e)&&e.length?joinRegExp(e):null}function joinRegExp(e){for(var t=[],n=e.length,r=0;r<n;r++){var o=e[r];isString(o)?t.push(o.replace(/([.*+?^=!:${}()|[\]/\\])/g,"\\$1")):o&&o.source&&t.push(o.source)}return new RegExp(t.join("|"),"i")}var checkIfHit=function(e,t){e=getRegexp(e||[]);return!!e&&e.test(t)},hookMethodDangerously=function(i,u,c){return function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];if(!i)return noop;var n=i[u],r=c.apply(void 0,__spreadArray([n],__read(e),!1)),o=r;return isFunction(o)&&(o=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];return r.apply(this,e)}),i[u]=o,function(){o===i[u]?i[u]=n:r=n}}},BUFFER_TIME=3e5,applyBufferTimer=function(e,t,n){var r=0;return-1===n?noop:function(){if(e())return r&&clearTimeout(r),void(r=0);0===r&&(r=setTimeout(t,n))}},nextLink=function(r,e){var t=[];try{t=e.reduce(function(e,t){try{var n=t(r);"function"==typeof n&&e.push(n)}catch(e){}return e},[])}catch(e){}return function(e){return nextLink(e,t)}},toObservable=function(e){function t(e){r=arrayRemove(r,e),i||u()}var n,r=[],o=[],i=!1,u=applyBufferTimer(function(){return!!r.length},function(){i=!0,n&&n[0](),o.forEach(function(e){return e()}),o.length=0,n=void 0},e=void 0===e?BUFFER_TIME:e);return{next:function(e){return nextLink(e,r)},complete:function(e){o.push(e)},attach:function(e,t){n=[e,t]},subscribe:function(e){if(i)throw new Error("Observer is closed");return r.push(e),n&&n[1]&&n[1](e),u(),function(){return t(e)}},unsubscribe:t}},createSafeObserver=function(e,t,n){n=toObservable(n);try{e(n.next,n.attach),t&&n.complete(t)}catch(e){}return[n.subscribe,n.unsubscribe]};function initSubjectInGlobal(e,t){return e.initSubject(t)}function initPrivateSubject(e,t,n){var t=__read(t,2),r=t[0],t=t[1],o=e.privateSubject||{};return o[r]||(o[r]=createSafeObserver(t,function(){o[r]=void 0},n)),o[r]}var now=function(){return Date.now()};function getDefaultBrowser(){if("object"==typeof window&&isObject(window))return window}function getDefaultDocument(){if("object"==typeof document&&isObject(document))return document}function getDefaultLocation(){return getDefaultBrowser()&&window.location}function getDefaultMutationObserver(){if(getDefaultBrowser()&&isFunction(window.MutationObserver))return window.MutationObserver}function getDefaultPerformanceObserver(){if(getDefaultBrowser()&&isFunction(window.PerformanceObserver))return window.PerformanceObserver}function getFullUrl(e){var t=getDefaultDocument();if(!t||!e)return"";t=t.createElement("a");return t.href=e,t.href}function getLocationUrl(){var e=getDefaultBrowser()&&getDefaultLocation();return e?e.href:""}var getViewOverrides=function(e){return{pid:e.pid,view_id:e.viewId,url:getLocationUrl()}},getOverrides=function(e){var t=e.config(),t=getViewOverrides(t);return t.context=e.context?e.context.toString():{},t},PV_SUBJECT_NAME="view_0",applyPV=function(o){return function(n,e){function t(e){var t;e.viewId&&e.viewId!==(null===(t=o.config())||void 0===t?void 0:t.viewId)&&(n(r),r=__assign(__assign({},getOverrides(o)),getViewOverrides(e)))}var r=getOverrides(o);o.on("beforeConfig",t),e(function(){o.off("beforeConfig",t)})}},applyMutationObserver=function(e,t){var n=e&&new e(t);return[function(e,t){n&&e&&n.observe(e,t)},function(){return n&&n.disconnect()}]},addListenerToDocument=function(e,t,n,r){return void 0===r&&(r=!1),e.addEventListener(t,n,r),function(){e.removeEventListener(t,n,r)}},XHR_SUBJECT_NAME="xhr_0",getReportPathRegExp=function(){var t=new RegExp("\\/monitor_web\\/collect|\\/monitor_browser\\/collect\\/batch","i");return function(e){return t.test(e)}},hookOpen=function(r){return function(){for(var e,t=[],n=0;n<arguments.length;n++)t[n]=arguments[n];return e=__read(t,2),this._method=e[0],this._url=e[1],r.apply(this,t)}},hookSetHeader=function(o){return function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];this._reqHeaders=this._reqHeaders||{};var n=__read(e,2),r=n[0],n=n[1];return this._reqHeaders[r]=n,o&&o.apply(this,e)}},hookOnreadystatechange=function(r,o){return hookMethodDangerously(r,"onreadystatechange",function(n){return function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];return 4===this.readyState&&o(r),n&&n.apply(this,e)}})},hookSend=function(r,o){var i=getReportPathRegExp();return function(){for(var e,t=[],n=0;n<arguments.length;n++)t[n]=arguments[n];return this._start=now(),this._data=null==t?void 0:t[0],i(this._url)||(e=o([this._method,this._url,this._start,this]),hookOnreadystatechange(this,e)()),r.apply(this,t)}},applyXHR=function(r){return function(e,t){var n;r&&((n=[]).push(hookMethodDangerously(r,"open",hookOpen)()),n.push(hookMethodDangerously(r,"setRequestHeader",hookSetHeader)()),n.push(hookMethodDangerously(r,"send",hookSend)(e)),t(function(){n.forEach(function(e){return e()})}))}},FETCH_SUBJECT_NAME="fetch_0",hookFetch=function(r,o){return function(e,t){var n=o([e,t=void 0===t?{}:t]),t=r(e,t);return t.then(function(e){n(e)},function(){n(void 0)}),t}},observeFetch=function(e,t){var n,r=getDefaultBrowser();r&&fetch&&((n=[]).push(hookMethodDangerously(r,"fetch",hookFetch)(e)),t(function(){n.forEach(function(e){return e()})}))},fetchSubject=[FETCH_SUBJECT_NAME,observeFetch],RESOURCE_TYPE=["resource"],LONGTASK_TYPE=["longtask"],applyPerformanceObserver=function(r,o,i){var u=r&&new r(function(e,r){e.getEntries?e.getEntries().forEach(function(e,t,n){return o(e,t,n,r)}):i&&i()});return[function(e){if(!r||!u)return i&&i();try{u.observe({entryTypes:e})}catch(e){return i&&i()}},function(e,t){if(!r||!u)return i&&i();try{var n={type:e,buffered:!0};isUndefined(t)||(n.durationThreshold=t),u.observe(n)}catch(e){return i&&i()}u.observe({type:e,buffered:!1})},function(){return u&&u.disconnect()}]},observePerf=function(e,t,n){e=__read(applyPerformanceObserver(e,t),3),t=e[0],e=e[2];return t(n),e},LONGTASK_SUBJECT_NAME="longtask_0",observeLongtask=function(e,t){var n=getDefaultPerformanceObserver();n&&t(observePerf(n,e,LONGTASK_TYPE))},longtaskSubject=[LONGTASK_SUBJECT_NAME,observeLongtask],RESOURCE_SUBJECT_NAME="resource_0",observeResource=function(t,e){var n,r=getDefaultPerformanceObserver();r&&(n=getReportPathRegExp(),e(observePerf(r,function(e){n(e.name)||t(e)},RESOURCE_TYPE)))},resourceSubject=[RESOURCE_SUBJECT_NAME,observeResource],PERFORMANCE_METRIC_EV_TYPE="performance",CLICK_EVENT_NAME="click",CLICK_SUBJECT_NAME=CLICK_EVENT_NAME+"_0",observeClick=function(e,t){var n,r=getDefaultDocument();r&&(n=addListenerToDocument(r,CLICK_EVENT_NAME,e,!0),t(function(){n()}))},clickSubject=[CLICK_SUBJECT_NAME,observeClick],defaultMetricContext={isSupport:!0,isPolyfill:!1,isBounced:!1,isCustom:!1,type:"perf"},initMetric=function(e,t){return __assign({name:e,value:t},defaultMetricContext)},wrapPerformanceMetric=function(e,t){return{ev_type:PERFORMANCE_METRIC_EV_TYPE,payload:e,overrides:t}},applyReportMetric=function(n){return function(e,t){n(wrapPerformanceMetric(e,t))}},SPA_LOAD_METRIC_NAME="spa_load",PAGE_ACTIVITY_DELAY=100,waitActionComplete=function(e,t,n,r){function o(){e.clearTimeout(i),c&&(i=e.setTimeout(function(){t()},PAGE_ACTIVITY_DELAY))}var i,u,c=!1;return[function(){c=!0,e.clearTimeout(u),u=e.setTimeout(function(){t(!0),n()},r),o()},o,function(){c=!1,e.clearTimeout(i),e.clearTimeout(u)}]},shouldIgnoreUrl=function(e,t){return!!(e&&e.length&&t&&checkIfHit(e,getFullUrl(t)))},applyIncompleteReq=function(e,t,n,r){var o=__read(t,2),i=o[0],u=o[1],t=__read(applyRecord(),3),o=t[0],c=t[1],a=t[2],f=0;return e.push(i[0](function(e){e=__read(e,2);e[0];e=e[1];if(shouldIgnoreUrl(r,e))return noop;var t=f+=1;return c(t,now()),n(),function(){a(t),n()}})),e.push(u[0](function(e){e=__read(e,1)[0],e="string"==typeof e?e:e.url;if(shouldIgnoreUrl(r,e))return noop;var t=f+=1;return c(t,now()),n(),function(){a(t),n()}})),o},MAX_PAGE_DELAY=3e4,getSPA=function(e,t,n,r){function o(e){!_||Object.keys(E).length&&!e||(v(initMetric(SPA_LOAD_METRIC_NAME,now()-_)),i())}function i(){g(),_=0}var u=__read(n,7),c=u[0],a=u[1],f=u[2],s=u[3],l=u[4],n=u[5],u=u[6],p=r.ignoreUrls,_=0,v=applyReportMetric(e),e=__read(waitActionComplete(window,o,noop,MAX_PAGE_DELAY),3),h=e[0],d=e[1],g=e[2],E=applyIncompleteReq(t,[f,s],d,p);t.push(l[0](function(e){e=e.name;shouldIgnoreUrl(p,e)||d()})),t.push(n[0](d));var u=__read(applyMutationObserver(u,d),2),b=u[0],u=u[1];t.push(u);var y=!0;t.push(c[0](function(){y?y=!1:(o(!0),i(),_=now(),b(document,{childList:!0,subtree:!0}),h())})),t.push(a[0](function(){o(!0),i()})),t.push(i)};function SPALoadMonitorPlugin(r,o){void 0===o&&(o={}),r.on("init",function(){var e=[],t=getDefaultDocument(),n=getDefaultMutationObserver();t&&n&&(getSPA(r.report.bind(r),e,[initPrivateSubject(r,[PV_SUBJECT_NAME,applyPV(r)]),initSubjectInGlobal(r,clickSubject),initSubjectInGlobal(r,[XHR_SUBJECT_NAME,applyXHR(XMLHttpRequest&&XMLHttpRequest.prototype)]),initSubjectInGlobal(r,fetchSubject),initSubjectInGlobal(r,resourceSubject),initSubjectInGlobal(r,longtaskSubject),n],o),r.on("beforeDestroy",function(){e.forEach(function(e){return e()})}))})}var SPA_LOAD_INTEGRATION_NAME="spa_load",SPALoadPlugin=function(t){return{name:SPA_LOAD_INTEGRATION_NAME,setup:function(e){SPALoadMonitorPlugin(e,t)}}};exports.SPALoadPlugin=SPALoadPlugin,exports.SPA_LOAD_INTEGRATION_NAME=SPA_LOAD_INTEGRATION_NAME; |
{ | ||
"name": "@apmplus/integrations", | ||
"version": "2.1.6", | ||
"version": "2.2.0-alpha.0", | ||
"description": "APMPlus Integrations", | ||
@@ -5,0 +5,0 @@ "main": "dist/index.js", |
Sorry, the diff of this file is too big to display
No v1
QualityPackage is not semver >=1. This means it is not stable and does not support ^ ranges.
Found 1 instance in 1 package
560830
14192
2