@apmplus/web
Advanced tools
Comparing version 1.6.0 to 1.7.0
@@ -1,1 +0,1 @@ | ||
!function(){"use strict";var u,v=function(){return(v=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 C(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}function y(e,n,t){if(t||2===arguments.length)for(var r,o=0,i=n.length;o<i;o++)!r&&o in n||((r=r||Array.prototype.slice.call(n,0,o))[o]=n[o]);return e.concat(r||Array.prototype.slice.call(n))}"undefined"==typeof Element||Element.prototype.addEventListener||(u=[],hr=function(e,n){for(var t=0;t<u.length;){var r=u[t];if(r.object===this&&r.type===e&&r.listener===n){"DOMContentLoaded"===e?this.detachEvent("onreadystatechange",r.wrapper):this.detachEvent("on"+e,r.wrapper),u.splice(t,1);break}++t}},Element.prototype.addEventListener=br=function(e,n){function t(e){e.target=e.srcElement,e.currentTarget=i,void 0!==n.handleEvent?n.handleEvent(e):n.call(i,e)}var r,o,i=this;"DOMContentLoaded"===e?(r=function(e){"complete"===document.readyState&&t(e)},document.attachEvent("onreadystatechange",r),u.push({object:this,type:e,listener:n,wrapper:r}),"complete"===document.readyState&&((o=new Event).srcElement=window,r(o))):(this.attachEvent("on"+e,t),u.push({object:this,type:e,listener:n,wrapper:t}))},Element.prototype.removeEventListener=hr,HTMLDocument&&!HTMLDocument.prototype.addEventListener&&(HTMLDocument.prototype.addEventListener=br,HTMLDocument.prototype.removeEventListener=hr),Window&&!Window.prototype.addEventListener&&(Window.prototype.addEventListener=br,Window.prototype.removeEventListener=hr));function p(e){return JSON.stringify({ev_type:"batch",list:e})}var w=["init","start","config","beforeDestroy","provide","beforeReport","report","beforeBuild","build","beforeSend","send","beforeConfig"],b=function(){return{}};function g(e){return e}function E(e){return"object"==typeof e&&null!==e}var n=Object.prototype;function i(e){if(E(e)){if("function"!=typeof Object.getPrototypeOf)return"[object Object]"===n.toString.call(e);e=Object.getPrototypeOf(e);return e===n||null===e}}function a(e){return"[object Array]"===n.toString.call(e)}function _(e){return"function"==typeof e}function c(e){return"number"==typeof e}function h(e){return"string"==typeof e}function o(e){return"undefined"!=typeof Event&&function(e,n){try{return e instanceof n}catch(e){return}}(e,Event)}function d(e,n){var t,r,o=v({},e);for(t in n)r=t,Object.prototype.hasOwnProperty.call(n,r)&&void 0!==n[t]&&(E(n[t])&&i(n[t])?o[t]=d(E(e[t])?e[t]:{},n[t]):a(n[t])&&a(e[t])?o[t]=function n(e,t){e=a(e)?e:[];t=a(t)?t:[];return Array.prototype.concat.call(e,t).map(function(e){return e instanceof RegExp?e:E(e)&&i(e)?d({},e):a(e)?n([],e):e})}(e[t],n[t]):o[t]=n[t]);return o}function x(e,n){if(!a(e))return!1;if(0===e.length)return!1;for(var t=0;t<e.length;){if(e[t]===n)return!0;t++}return!1}function S(e,n){if(!a(e))return e;var t=e.indexOf(n);if(0<=t){n=e.slice();return n.splice(t,1),n}return e}function l(e,n,t){for(var r,o=(n=C(n.split(".")))[0],i=n.slice(1);e&&0<i.length;)e=e[o],o=(r=C(i))[0],i=r.slice(1);if(e)return t(e,o)}function m(e){return a(e)&&e.length?function(e){for(var n=[],t=e.length,r=0;r<t;r++){var o=e[r];h(o)?n.push(o.replace(/([.*+?^=!:${}()|[\]/\\])/g,"\\$1")):o&&o.source&&n.push(o.source)}return new RegExp(n.join("|"),"i")}(e):null}function s(e){try{return h(e)?e:JSON.stringify(e)}catch(e){return"[FAILED_TO_STRINGIFY]:"+String(e)}}function D(i,u,a,c){return void 0===c&&(c=!0),function(){for(var e=[],n=0;n<arguments.length;n++)e[n]=arguments[n];if(!i)return b;var t=i[u],r=a.apply(void 0,y([t],C(e),!1)),o=r;return _(o)&&c&&(o=function(){for(var n=[],e=0;e<arguments.length;e++)n[e]=arguments[e];try{return r.apply(this,n)}catch(e){return _(t)&&t.apply(this,n)}}),i[u]=o,function(e){e||(o===i[u]?i[u]=t:r=t)}}}function f(t,r,o){return function(){for(var e=[],n=0;n<arguments.length;n++)e[n]=arguments[n];t[r]=o.apply(void 0,y([t[r]],C(e),!1))}}function T(){for(var e=[],n=0;n<arguments.length;n++)e[n]=arguments[n];console.warn.apply(console,y(["[SDK]",Date.now(),(""+r++).padStart(8," ")],C(e),!1))}function R(r){return function(e){for(var n=e,t=0;t<r.length&&n;t++)try{n=r[t](n)}catch(e){L(e)}return n}}var t=0,L=function(){for(var e=[],n=0;n<arguments.length;n++)e[n]=arguments[n];console.error.apply(console,y(["[SDK]",Date.now(),(""+t++).padStart(8," ")],C(e),!1))},r=0,k=function(e){return Math.random()<Number(e)},j=function(e,n){return e<Number(n)};function O(){var e=function(){for(var e=new Array(16),n=0,t=0;t<16;t++)0==(3&t)&&(n=4294967296*Math.random()),e[t]=n>>>((3&t)<<3)&255;return e}();return e[6]=15&e[6]|64,e[8]=63&e[8]|128,function(e){for(var n=[],t=0;t<256;++t)n[t]=(t+256).toString(16).substr(1);var r=0,o=n;return[o[e[r++]],o[e[r++]],o[e[r++]],o[e[r++]],"-",o[e[r++]],o[e[r++]],"-",o[e[r++]],o[e[r++]],"-",o[e[r++]],o[e[r++]],"-",o[e[r++]],o[e[r++]],o[e[r++]],o[e[r++]],o[e[+r]],o[e[15]]].join("")}(e)}var q=function(e){var t,r,o,n=(t={},r={},o={set:function(e,n){return t[e]=n,r[e]=s(n),o},merge:function(n){return t=v(v({},t),n),Object.keys(n).forEach(function(e){r[e]=s(n[e])}),o},delete:function(e){return delete t[e],delete r[e],o},clear:function(){return t={},r={},o},get:function(e){return r[e]},toString:function(){return v({},r)}});e.provide("context",n),e.on("report",function(e){return e.extra||(e.extra={}),e.extra.context=n.toString(),e})},N=function(a,c,t){function s(){for(var e=[],n=0;n<arguments.length;n++)e[n]=arguments[n];var t=e[0];if(t){var r=t.split(".")[0];if(r in s)return i=s,u=t,o=[].slice.call(e,1),l(i,u,function(e,n){if(e&&n in e&&_(e[n]))try{return e[n].apply(e,o)}catch(e){return}});var o,i=f[r]||[],u=null!==(u=null==c?void 0:c(a))&&void 0!==u?u:{};i.push(y([u],C(e),!1)),void(f[r]=i)}}var e,f={};for(e in D(a,"provide",function(t){return function(e,n){s[e]=n,t.call(a,e,n)}})(),a)Object.prototype.hasOwnProperty.call(a,e)&&(s[e]=a[e]);return a.on("provide",function(e){f[e]&&(f[e].forEach(function(e){var n=C(e),e=n[0],n=n.slice(1);null!=t&&t(a,e,n)}),f[e]=null)}),s};function I(){if("object"==typeof window&&E(window))return window}function A(){if("object"==typeof document&&E(document))return document}function M(){return I()&&window.location}function B(){if(I()&&E(window.performance))return window.performance}function H(){if("function"==typeof XMLHttpRequest&&_(XMLHttpRequest))return XMLHttpRequest}function P(){try{return new Headers,new Request(""),new Response,window.fetch}catch(e){}}function U(){if(I()&&_(window.MutationObserver))return window.MutationObserver}function e(){if(I()&&_(window.PerformanceObserver))return window.PerformanceObserver}function W(){var e=B();if(e&&E(e.timing))return e.timing}function G(){var e=function(){if(I()&&"navigator"in window)return window.navigator}();if(e)return e.connection||e.mozConnection||e.webkitConnection}var F=function(){for(var e=[],n=0;n<arguments.length;n++)e[n]=arguments[n];var t=function(e){if(e)return e.__SLARDAR_REGISTRY__||(e.__SLARDAR_REGISTRY__={Slardar:{plugins:[],errors:[]}}),e.__SLARDAR_REGISTRY__.Slardar}(I());t&&(t.errors||(t.errors=[]),t.errors.push(e))},z=function(e,n){var t=e&&new e(n);return[function(e,n){t&&e&&t.observe(e,n)},function(){return t&&t.disconnect()}]},X=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 _(n)&&n.call(t,e)||[]},function(){var e=(t||{}).clearResourceTimings;_(e)&&e.call(t)},function(e){var n=(t||{}).getEntriesByName;return _(n)&&n.call(t,e)||[]}]},Y=function(t,o,n,i){var r=t&&new t(function(e,r){e.getEntries?e.getEntries().forEach(function(e,n,t){return o(e,n,t,r)}):i&&i(),n&&r.disconnect()});return[function(){for(var n=[],e=0;e<arguments.length;e++)n[e]=arguments[e];if(!t||!r)return i&&i();try{n.forEach(function(e){-1<t.supportedEntryTypes.indexOf(e)&&r.observe({type:e,buffered:!1})})}catch(e){try{r.observe({entryTypes:n})}catch(e){return i&&i()}}},function(){return r&&r.disconnect()}]},J=function(e,n,t,r){void 0===n&&(n={}),void 0===r&&(r=[]);try{var o=e.apply(void 0,y([],C(r),!1));return o&&o(n,t)||[]}catch(e){return F(e),[]}};function V(e){var n=A();if(!n||!e)return"";n=n.createElement("a");return n.href=e,n.href}function $(e){var n=A();if(!n||!e)return{url:e,protocol:"",domain:"",query:"",path:"",hash:""};n=n.createElement("a");n.href=e;e=n.pathname||"/";return"/"!==e[0]&&(e="/"+e),{url:n.href,protocol:n.protocol.slice(0,-1),domain:n.hostname,query:n.search.substring(1),path:e,hash:n.hash}}function K(){var e=I()&&M();return null==e?void 0:e.href}var Q=function(e){var n={url:K(),timestamp:Date.now()},t=e.config();return null!=t&&t.pid&&(n.pid=t.pid),null!=e&&e.context&&(n.context=e.context.toString()),n},Z=function(t,r){return function(e){function n(e){return e.overrides=r,e}t.on("report",n),e(),t.off("report",n)}},ee="<unknown>";function ne(e){try{for(var n,t=e,r=[],o=0,i=0,u=" > ".length;t&&o++<5&&!("html"===(n=function(e){var n,t,r,o,i=e,u=[];if(!i||!i.tagName)return"";u.push(i.tagName.toLowerCase()),i.id&&u.push("#"+i.id);e=i.className;if(e&&h(e))for(n=e.split(/\s+/),o=0;o<n.length;o++)u.push("."+n[o]);var a=["type","name","title","alt"];for(o=0;o<a.length;o++)t=a[o],(r=i.getAttribute(t))&&u.push("["+t+'="'+r+'"]');return u.join("")}(t))||1<o&&80<=i+r.length*u+n.length);)r.push(n),i+=n.length,t=t.parentNode;return r.reverse().join(" > ")}catch(e){return ee}}function te(o){function i(n,t){var r;return function(e){u=void 0,e&&r!==e&&t({event:r=e,name:n})}}var u;return[i,function(r){return function(e){var n;try{n=e.target}catch(e){return}var t=n&&n.tagName;t&&("INPUT"===t||"TEXTAREA"===t||n.isContentEditable)&&(u||i("input",r)(e),clearTimeout(u),u=window.setTimeout(function(){u=void 0},o))}}]}function re(n,t){return function(e){if(t)try{n(e)}catch(e){}}}function oe(e){var n=I(),t=A();n&&t&&("complete"!==t.readyState?n.addEventListener("load",function(){setTimeout(function(){e()},0)},!1):e())}function ie(e,n){var t;void 0===n&&(n=!0),"hidden"!==document.visibilityState?(t=function(){"hidden"===document.visibilityState&&(e(),n&&removeEventListener("visibilitychange",t,!0))},addEventListener("visibilitychange",t,!0)):e()}function ue(e,n){return E(e)?v(v({},n),e):!!e&&n}function ae(e,n){return!(!e||!n)&&(fe.test(e)||le.test(n))}var ce=function(n){var t=!1;return[function(e){t||(t=!0,n&&n(e))}]},se=function(e){var n=C(ce(e),1)[0];["unload","beforeunload","pagehide"].forEach(function(e){addEventListener(e,n)})},fe=new RegExp("(cookie|auth|jwt|token|key|ticket|secret|credential|session|password)","i"),le=new RegExp("(bearer|session)","i");function de(e,n,t){var r=e._method,o=e._reqHeaders,i=e._url,u=e._start,a=e._data,i={api:"xhr",request:{url:i=V(i),method:(r||"").toLowerCase(),headers:o,timestamp:u},response:{status:e.status||0,is_custom_error:!1,timing:t(i),timestamp:Date.now()},duration:Date.now()-u};"function"==typeof e.getAllResponseHeaders&&(i.response.headers=h(c=e.getAllResponseHeaders())&&c?c.split("\r\n").reduce(function(e,n){var t;return h(n)&&(n=(t=C(n.split(": "),2))[0],t=t[1],ae(n,t)||(e[n.toLowerCase()]=t)),e},{}):{});var u=i.response.status,c=n.collectBodyOnError,n=n.extraExtractor;try{var s=null==n?void 0:n(e.response,i);s&&(i.extra=s),s&&(i.response.is_custom_error=!0),c&&400<=u&&(i.request.body=a?""+a:void 0,i.response.body=e.response?""+e.response:void 0)}catch(e){}return i}function pe(e,n){return!!(e=m(e||[]))&&e.test(n)}function ve(e){var n=C(X(e),5)[4];return function(e){return n(e).pop()}}function he(o){return function(){for(var e=[],n=0;n<arguments.length;n++)e[n]=arguments[n];this._reqHeaders=this._reqHeaders||{};var t=C(e,2),r=t[0],t=t[1];return ae(r,t)||(this._reqHeaders[r.toLowerCase()]=t),o&&o.apply(this,e)}}function me(r,o,a,c){return function(){for(var i,u,t=this,e=[],n=0;n<arguments.length;n++)e[n]=arguments[n];return u=c,f(i=this,"onreadystatechange",function(t,r,o){return function(){for(var e=[],n=0;n<arguments.length;n++)e[n]=arguments[n];try{4===this.readyState&&!pe(r.ignoreUrls,i._url)&&o&&o({ev_type:"http",payload:de(i,r,u)})}catch(e){F(e)}return t&&t.apply(this,e)}})(o,o.hookCbAtReq(a)),o.setTraceHeader&&o.setTraceHeader(this._url,function(e,n){return t.setRequestHeader(e,n)}),this._start=Date.now(),this._data=null==e?void 0:e[0],r.apply(this,e)}}function ge(r){return function(){for(var e,n=[],t=0;t<arguments.length;t++)n[t]=arguments[t];return e=C(n,2),this._method=e[0],this._url=e[1],r.apply(this,n)}}function ye(e,n,t,r){f(e,"open",ge)(),f(e,"setRequestHeader",he)(),f(e,"send",me)(n,t,r)}function we(){var e=window.crypto||window.msCrypto;if(void 0!==e&&e.getRandomValues){var n=new Uint16Array(8);e.getRandomValues(n);e=function(e){for(var n=e.toString(16);n.length<4;)n="0"+n;return n};return e(n[0])+e(n[1])+e(n[2])+e(n[3])+e(n[4])+e(n[5])+e(n[6])+e(n[7])}return"xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx".replace(/[x]/g,function(){return(16*Math.random()|0).toString(16)})}var be=function(e,n){if(void 0===e&&(e=H()&&I()),void 0===n&&(n=B()),e){var f=ve(n);return function(c,s){var e;!c.autoWrap||(e=XMLHttpRequest&&XMLHttpRequest.prototype)&&ye(e,c,s,f);return[function(e,n,t){return i=n=void 0===n?c:n,u=t=void 0===t?s:t,a=f,r.prototype=new(o=e),["DONE","HEADERS_RECIEVED","LOADING","OPENED","UNSENT"].forEach(function(e){r[e]=o[e]}),r;function r(){var e=new o;return ye(e,i,u,a),e}var o,i,u,a}]}}},Ee={sampleRate:1,origins:[]},_e=function(e,r){var o=ue(e,Ee);if(o&&k(o.sampleRate))return function(e,n){var t=o.origins;t.length&&Boolean(e.match(new RegExp(t.join("|"))))&&(n("x-rum-traceparent","00-"+we()+"-"+we().substring(16)+"-01"),n("x-rum-tracestate",r))}};function xe(e,n,t){n=null===(e=e.config())||void 0===e?void 0:e.plugins[n];return ue(n,t)}var Se=function(n,t){var e=n.config(),r={url:K(),pid:e.pid,view_id:e.viewId};return function(e){n.report(v(v({},e),{overrides:v(v({},r),t&&t(e)||{})}))}},Te="ajax",De={autoWrap:!0,hookCbAtReq:g,ignoreUrls:[],collectBodyOnError:!1},Re=function(r){return function(n){if(!n)return n;var e=r.config(),t={url:K(),pid:e.pid,view_id:e.viewId};return function(e){n(v(v({},e),{overrides:v(v({},t),{timestamp:e.payload.request.timestamp})}))}}};var Le=function(s){if(s=void 0===s?A():s)return function(e,n){var t,r=e.maxBreadcrumbs,o=e.onAddBreadcrumb,i=e.onMaxBreadcrumbs,u=e.dom,a=C(te(100),2),e=a[0],a=a[1],r=C(function(n,t,r){void 0===n&&(n=20),void 0===t&&(t=g),void 0===r&&(r=function(e,n){return e.slice(-n)});var o=[];return[function(){return o},function(e){t(e)&&(e=v(v({},e),{timestamp:e.timestamp||Date.now()}),o=0<=n&&o.length+1>n?r(y(y([],C(o),!1),[e],!1),n):y(y([],C(o),!1),[e],!1))}]}(r,o,i),2),o=r[0],i=r[1],r=(t=i,function(e){var n;try{n=e.event.target?ne(e.event.target):ne(e.event)}catch(e){n="<unknown>"}0!==n.length&&t({type:"dom",category:"ui."+e.name,message:n})}),c=[];u&&(c.push(e("click",re(r,"dom"))),c.push(a(re(r,"dom"))),s.addEventListener("click",c[0]),s.addEventListener("keypress",c[1]));return[o,i,function(){s.removeEventListener("click",c[0]),s.removeEventListener("keypress",c[1])}]}},ke="breadcrumb",Ce={maxBreadcrumbs:20,dom:!0};function je(e,n){return e instanceof n}function Oe(n){for(var e=[],t=1;t<arguments.length;t++)e[t-1]=arguments[t];return e.reduce(function(t,e){return new n(e).forEach(function(e,n){return!ae(n,e)&&(t[n]=e)}),t},{})}function qe(e,n,t){return je(e,t)?e.body:null==n?void 0:n.body}function Ne(e,n,t,r){return{method:function(e,n,t){n=n&&n.method||"get";return(n=je(e,t)?e.method||n:n).toLowerCase()}(n,t,r),timestamp:Date.now(),url:V(e)}}function Ie(c,s,f,l,d,p){return function(i,u){void 0===u&&(u={});var e,n,t=(n=!1,t="",t=je(e=i,d)?e.url:e,t=!(n=void 0!==n&&n)&&h(t)?t.split("?")[0]:t);if(!function(e){if(h(e)){var n=C(e.split(":"),2),e=n[0];return!n[1]||"http"===e||"https"===e}}(t)||pe(s.ignoreUrls,t))return c(i,u);var r=s.hookCbAtReq(f),o={api:"fetch",request:Ne(i instanceof d?i.url:i,i,u,d),response:{is_custom_error:!1},duration:0};s.setTraceHeader&&s.setTraceHeader(o.request.url,function(e,n){var t,r,o;t=e,r=n,o=u,e=l,je(n=i,d)?n.headers.set(t,r):o.headers instanceof e?o.headers.set(t,r):o.headers=v(v({},o.headers),((o={})[t]=r,o))});var t=c(i,u);try{o.request.headers=Oe(l,i.headers,u.headers)}catch(e){F(e)}var a=function(){r&&r({ev_type:"http",payload:o})};return t.then(function(e){var n;try{o.response.status=e.status||0,o.response.headers=Oe(l,e.headers),o.response.timestamp=Date.now(),o.duration=o.response.timestamp-o.request.timestamp;var t=s.collectBodyOnError,r=s.extraExtractor;try{r&&e.clone().json().then(function(e){e=r(e,o);e&&(o.extra=e,o.response.is_custom_error=!0)}).catch(b)}catch(e){}t&&400<=e.status&&(o.request.body=null===(n=qe(i,u,d))||void 0===n?void 0:n.toString());setTimeout(function(){o.response.timing=p(e.url),a()},100)}catch(e){F(e)}},function(){var e;try{o.response.status=0,o.response.timestamp=Date.now(),o.duration=o.response.timestamp-o.request.timestamp,s.collectBodyOnError&&(o.request.body=null===(e=qe(i,u,d))||void 0===e?void 0:e.toString())}catch(e){F(e)}a()}),t}}var Ae=function(e,i,u,n){if(void 0===e&&(e=P()&&I()),void 0===i&&(i=window.Headers),void 0===u&&(u=window.Request),void 0===n&&(n=B()),e&&i&&u){var a=ve(n);return function(r,o){r.autoWrap&&f(e,"fetch",Ie)(r,o,i,u,a);return[function(e,n,t){return Ie(e,n=void 0===n?r:n,t=void 0===t?o:t,i,u,a)}]}}},Me="fetch",Be={autoWrap:!0,hookCbAtReq:g,ignoreUrls:[],collectBodyOnError:!1};function He(e){var n,t,r;return!function(e){switch(Object.prototype.toString.call(e)){case"[object Error]":case"[object Exception]":case"[object DOMError]":case"[object DOMException]":return 1;default:return e instanceof Error}}(e)?(i(e)||o(e)||h(e))&&(n={message:s(e)}):(r=Xe,n=(t=e)&&E(t)?r.reduce(function(e,n){return e[n]=t[n],e},{}):t),n}function Pe(e){return He(e.error)}function Ue(e){var n;try{var t=void 0;if("reason"in e?t=e.reason:"detail"in e&&"reason"in e.detail&&(t=e.detail.reason),t){var r=He(t);return v(v({},r),{name:null!==(n=r&&r.name)&&void 0!==n?n:"UnhandledRejection"})}}catch(e){}}function We(e){return"[object ErrorEvent]"===Object.prototype.toString.call(e)?Pe(e):("[object PromiseRejectionEvent]"===Object.prototype.toString.call(e)?Ue:He)(e)}function Ge(o,n,e){function u(e,t){if(!_(e))return e;var r={type:"capture-global",data:v({},t)},n=e._w_||(e._w_=function(){try{return(e.handleEvent&&_(e.handleEvent)?e.handleEvent:e).apply(this,[].map.call(arguments,function(e){return u(e,t)}))}catch(e){var n=He(e);throw n&&o({error:n,source:r}),e}});return n._hook_=!0,n}void 0===n&&(n=I()),void 0===e&&(e=H());var a=[];return n&&a.push.apply(a,y([],C(Je.filter(function(e){return n[e]}).map(function(o){return D(n,o,function(r){return function(e){for(var n=[],t=1;t<arguments.length;t++)n[t-1]=arguments[t];return r&&r.call.apply(r,y([this,u(e,{function:o})],C(n),!1))}},!1)()})),!1)),e&&e.prototype&&a.push(D(e.prototype,"send",function(r){return function(){for(var t=this,e=[],n=0;n<arguments.length;n++)e[n]=arguments[n];return a.push.apply(a,y([],C(Ve.filter(function(e){return t[e]&&!t[e]._hook_}).map(function(n){var e=D(t,n,function(e){return u(e,{function:n})},!1)();return function(){e(),t[n]._hook_=void 0}})),!1)),r.apply(this,e)}},!1)()),Ye.forEach(function(i){var e=n[i]&&n[i].prototype;e&&e[$e]&&(a.push(D(e,$e,function(o){return function(e,n,t){try{var r=n.handleEvent;_(r)&&(n.handleEvent=u(r,{function:"handleEvent",target:i}))}catch(e){}return o&&o.call(this,e,u(n,{function:$e,target:i}),t)}},!1)()),a.push(D(e,"removeEventListener",function(r){return function(e,n,t){return null!=n&&n._w_&&r.call(this,e,n._w_,t),r.call(this,e,n,t)}},!1)()))}),a}function Fe(e,n){return e&&n&&e===n}function ze(){var r;return function(e){try{if(t=r,!(!(n=e)||!t)&&!(!Fe(n.message,t.message)||!Fe(n.stack,t.stack)))return void(r=e)}catch(e){F(e)}var n,t;return r=e}}var Xe=["name","message","stack","filename","lineno","colno"],Ye=["EventTarget","Window","Node","ApplicationCache","ChannelMergerNode","EventSource","FileReader","HTMLUnknownElement","IDBDatabase","IDBRequest","IDBTransaction","MessagePort","Notification","SVGElementInstance","Screen","TextTrack","TextTrackCue","TextTrackList","WebSocket","Worker","XMLHttpRequest","XMLHttpRequestEventTarget","XMLHttpRequestUpload"],Je=["setTimeout","setInterval","requestAnimationFrame","requestIdleCallback"],Ve=["onload","onerror","onprogress","onreadystatechange"],$e="addEventListener",Ke=function(d){if(d=void 0===d?I():d)return function(e,o){var n,t,r=e.ignoreErrors,i=e.onerror,u=e.onunhandledrejection,a=e.dedupe,e=e.captureGlobalAsync,c=m(r),s=[],f=ze(),l=function(e){var n=e.error,t=e.extra,r=e.react,e=e.source,n=a?f(n):n;o&&n&&(c&&c.test(n.message)||o({ev_type:"js_error",payload:{error:n,breadcrumbs:[],extra:t,react:r,source:e}}))};i&&(d.addEventListener("error",n=function(e){return l({error:Pe(e),source:{type:"onerror"}})}),s.push(function(){return d.removeEventListener("error",n)})),u&&(d.addEventListener("unhandledrejection",t=function(e){return l({error:Ue(e),source:{type:"onunhandledrejection"}})}),s.push(function(){return d.removeEventListener("unhandledrejection",t)})),e&&s.push.apply(s,y([],C(Ge(l)),!1));return[function(e,n,t){return l({error:We(e),extra:n,react:t,source:{type:"manual"}})},function(){s.forEach(function(e){return e()})}]}},Qe="jsError",Ze={ignoreErrors:[],onerror:!0,onunhandledrejection:!0,captureGlobalAsync:!1,dedupe:!0};var en=function(y,w,b){if(void 0===y&&(y=I()),void 0===w&&(w=M()),void 0===b&&(b=I()&&window.history),y&&w)return function(e,t){var r,n,o,i,u,a,c,s,f=e.sendInit,l=e.initPid,d=e.routeMode,p=e.extractPid,e=e.onPidUpdate,v=[],h="manual"===d?function(){return""}:(r=d,function(e){var n;return"hash"===r?(null===(n=$(e).hash)||void 0===n?void 0:n.replace(/^#/,""))||"/":$(e).path}),m=p||function(){},p=C(function(r,e,n,o){var i=n,u=e;o&&o(e);return[function(e,n,t){"user_set"!==e&&n!==i?(i=n,u=null!=t?t:i,o&&o(u),r(e,u)):"user_set"===e&&n!==u&&(u=n,o&&o(u),r(e,u))},function(){e&&r("init",e)}]}(function(e,n){t&&t({ev_type:"pageview",payload:{pid:n,source:e}})},l||(n=w.href,null!==(o=m(n))&&void 0!==o?o:h(n)),h(w.href),e),2),g=p[0],l=p[1],e=g.bind(null,"user_set");"manual"!==d&&(i=C((c=function(e,n){return g(e,h(n),m(n))},s="",[function(e,n){n!==s&&c(e,s=n)}]),1)[0],u=function(){return i("history",w.href)},b&&(p=function(t){return function(){for(var e=[],n=0;n<arguments.length;n++)e[n]=arguments[n];try{t.apply(b,e)}finally{u()}}},v.push(D(b,"pushState",p)(),D(b,"replaceState",p)())),"hash"===d?(a=function(){return i("hash",w.href)},y.addEventListener("hashchange",a,!0),v.push(function(){return y.removeEventListener("hashchange",a,!0)})):(y.addEventListener("popstate",u,!0),v.push(function(){return y.removeEventListener("popstate",u,!0)})));return f&&l(),[e,function(){v.forEach(function(e){return e()})}]}},nn="pageview",tn={sendInit:!0,routeMode:"history"};var rn="resource",on=["xmlhttprequest","fetch","beacon"],un=function(s,f,l){if(void 0===s&&(s=B()),void 0===f&&(f=e()),void 0===l&&(l=W()),s)return function(e,t){var n=e.ignoreUrls,r=e.slowSessionThreshold,o=e.ignoreTypes,i=m(n),u=[],a=function(e,n){void 0===n&&(n=!1),e=e.filter(function(e){return!(x(null!=o?o:on,e.initiatorType)||null!=i&&i.test(e.name))}),t&&e.length&&e.forEach(function(e){t([{ev_type:"resource",payload:e},n])})},c=C(X(s),3)[2];oe(function(){var e,n;a(c(rn),function(){if(!l)return!1;var e=l.loadEventEnd-l.navigationStart;return r<e}()),e=C(Y(f,function(e,n,t){return 0===n&&a(t)}),2),n=e[0],e=e[1],n(rn),u.push(e)});return[function(){u.forEach(function(e){return e()})}]}},an="resource",cn={ignoreUrls:[],slowSessionThreshold:4e3};function sn(e){return e="link"===(n=e).tagName.toLowerCase()?"href":"src",_(n.getAttribute)?n.getAttribute(e)||"":n[e]||"";var n}var fn=function(l,d,p){if(void 0===l&&(l=I()),void 0===d&&(d=B()),void 0===p&&(p=null===location||void 0===location?void 0:location.href),l)return function(e,i){var n=e.ignoreUrls,t=e.includeUrls,u=e.dedupe,a=m(t),c=m(n),s=C(X(d),5)[4],f=void 0,r=function(e){var n,t,r,o;p&&e.url===p||a&&!a.test(e.url)||c&&c.test(e.url)||(e.url||e.xpath&&e.xpath!==ee)&&(u&&e.url===f||(f=e.url,t=s,r=(n=e).url,o=e.tagName,n=e.xpath,r=V(r),t=t(r)[0],t={type:o.toLowerCase(),url:r,xpath:n,timing:t},i&&i({ev_type:"resource_error",payload:t})))},o=function(e){e=e||l.event;!e||(e=function(e){var n=e.target||e.srcElement;if(n){var t=n.tagName;if(t&&h(t)){e=sn(n);return{url:e,tagName:t,xpath:e?void 0:ne(n)}}}}(e))&&r(e)};l.addEventListener("error",o,!0);return[r,function(){l.removeEventListener("error",o,!0)}]}},ln="resourceError",dn={includeUrls:[],ignoreUrls:[],dedupe:!0};function pn(e,n){return v({name:e,value:n},wn)}function vn(e){return{ev_type:"performance",payload:e}}function hn(i,u){return void 0===i&&(i=e()),void 0===u&&(u=B()),function(e,n){var t=pn("fid",0),r=C(ce(n),1)[0];if(!u||!i)return t.isSupport=!1,void r(t);function o(e){var n=e.processingStart,e=e.startTime;t.value=n-e,r(t)}n=(0,C(X(u),3)[2])(bn)[0];n?o(n):(0,C(Y(i,o,!0),1)[0])(bn)}}function mn(a){return void 0===a&&(a=e()),function(e,n){var e=e.precollect,t=pn("lcp",0),r=C(ce(n),1)[0];if(!a)return t.isSupport=!1,void r(t);(e.entries||[]).forEach(function(e){var n=e.entryType,e=e.startTime;n===En&&(t.value=e)});var n=C(Y(a,function(e){e=e.startTime;t.value=e}),2),e=n[0],o=n[1];e(En);var i=function(){o(),_n.forEach(function(e){window.removeEventListener(e,u,!0)})},u=function(){r(t),i()};_n.forEach(function(e){window.addEventListener(e,u,!0)});ie(function(){t.isSupport=!1,u()});se(function(){t.isBounced=!0,u()})}}function gn(c,s){return void 0===c&&(c=e()),void 0===s&&(s=B()),function(e,n){var t=e.metricName,r=e.entryName,o=pn(t,0),i=C(ce(n),1)[0];if(!s||!c)return o.isSupport=!1,void i(o);var u,a=function(e){e=e.startTime;o.value=e,i(o)},t=(0,C(X(s),5)[4])(r)[0];t?a(t):(t=(n=C(Y(c,function(e){e.name===r&&(a(e),u())}),2))[0],u=n[1],t("paint"),ie(function(){o.isSupport=!1,i(o),u()}),se(function(){o.isBounced=!0,i(o),u()}))}}function yn(r,a){return void 0===r&&(r=e()),void 0===a&&(a=B()),function(e,n){var t=pn("mpfid",0),o=C(ce(n),1)[0];if(!r)return t.isSupport=!1,o(t),[b];var i=[],n=e.precollect;n&&(n.entries||[]).forEach(function(e){e.entryType===Sn&&i.push(e)});var e=C(Y(r,function(e){return i.push(e)}),2),n=e[0],u=e[1];n(Sn);return[function(){u();var e=(0,C(X(a),5)[4])(xn)[0],r=e&&e.startTime||0;t.value=i.reduce(function(e,n){var t=n.duration,n=n.startTime;return e<t&&r<n?t:e},0),o(t)}]}}var wn={isSupport:!0,isPolyfill:!1,isBounced:!1,isCustom:!1,type:"perf"},bn="first-input",En="largest-contentful-paint",_n=["keydown","click"],xn="first-contentful-paint",Sn="longtask",Tn=function(d){return void 0===d&&(d=B()),function(e,r){var n,o,t,i=e.precollect,u=e.fp,a=e.fcp,c=e.lcp,s=e.fid,f=e.mpfid,l=e.timing,e=function(e){r&&r({ev_type:"performance",payload:e})};u&&J(gn,{metricName:"fp",entryName:"first-paint"},e),a&&J(gn,{metricName:"fcp",entryName:xn},e),c&&J(mn,{precollect:i},e),s&&J(hn,0,e),f&&(n=C(J(yn,{precollect:i},e),1)[0],oe(function(){return setTimeout(n,200)})),l&&(o=C(X(d),3)[2],t=C(ce(function(e){var n=d&&d.timing||void 0,t=o("navigation")[0];r&&r({ev_type:"performance_timing",payload:{isBounced:e,timing:n,navigation_timing:t}})}),1)[0],oe(function(){t(!1)}),se(function(){t(!0)}))}},Dn="layout-shift",Rn=function(c){return void 0===c&&(c=e()),function(e,n){var t=C(e,1)[0],r=pn("cls",0);if(!c)return r.isSupport=!1,[function(){return n&&n(r)},b];var o,i,e=C((o=0,i=[],[function(){o=0},function(e,n){var t,r;n.hadRecentInput||(t=i[0],r=i[i.length-1],o&&n.startTime-r<1e3&&n.startTime-t<5e3?(o+=n.value,i.push(n.startTime)):(o=n.value,i=[n.startTime]),e(o))}]),2),u=e[0],a=e[1].bind(null,function(e){e>r.value&&(r.value=e)});(t.entries||[]).forEach(function(e){e.entryType===Dn&&a(e)});e=C(Y(c,a),2),t=e[0],e=e[1];return t(Dn),ie(function(){u()},!1),[function(){n&&n(r),u(),r=pn("cls",0)},e]}},Ln="longtask",kn=function(o){return void 0===o&&(o=e()),function(e,n){function t(e){n&&n({longtasks:e,type:"pref"})}var r=(e.precollect||{}).entries,e=(void 0===r?[]:r).filter(function(e){return e.entryType===Ln});if(e.length&&t(e),!o)return[b];r=C(Y(o,function(e){return t([e])},!1),2),e=r[0],r=r[1];return e(Ln),[r]}},Cn=function(){return function(e,n){var t=0,r=pn("spa_load",0),o=function(e){r.value=e,n&&n(r)},i=function(){o(Date.now()-t),t=0};return se(function(){t&&(r.isBounced=!0,i())}),[function(){t=Date.now()},i]}},jn="performance",On={entries:[],observer:void 0},qn={fp:!0,fcp:!0,fid:!0,mpfid:!0,lcp:!0,cls:!0,timing:!0,longtask:!0};function Nn(n){function t(e){e<o||!r||(u(),i=window.setTimeout(r,e-n()),o=e)}var r,o=-1/0,i=void 0,u=function(){return window.clearTimeout(i)};return[function(e,n){r=e,t(n)},function(){u(),r=void 0},t]}function In(e,t){var r=["img","script","iframe","link","audio","video","source"],n=(e=C(z(e,function(e){for(var n=0;n<e.length;n++)("childList"===e[n].type&&function e(n,t){for(var r=0;r<n.length;r++)if(x(t,n[r].nodeName.toLowerCase())||n[r].children&&e(n[r].children,t))return 1}(e[n].addedNodes,r)||"attributes"===e[n].type&&x(r,e[n].target.nodeName.toLowerCase()))&&t(e[n])}),2))[0];return[function(){return n(document,{attributes:!0,childList:!0,subtree:!0,attributeFilter:["href","src"]})},e[1]]}function An(e){var e=(n=e||{}).domContentLoadedEventEnd,n=n.navigationStart;return e?e-(void 0===n?0:n):null}function Mn(t){return function(){for(var e=[],n=0;n<arguments.length;n++)e[n]=arguments[n];return this._method=e[0],t.apply(this,e)}}function Bn(r,o,i){var u=0;return function(){for(var e=[],n=0;n<arguments.length;n++)e[n]=arguments[n];if("GET"!==this._method)return r.apply(this,e);var t=u+=2;return o(t,Date.now()),D(this,"onreadystatechange",function(n){return function(e){n&&n.call(this,e),4===this.readyState&&i(t)}})(),r.apply(this,e)}}function Hn(i,u,a){var c=1;return function(){for(var e,o=[],n=0;n<arguments.length;n++)o[n]=arguments[n];return"GET"!==((null===(e=o[0])||void 0===e?void 0:e.method)||(null===(e=o[1])||void 0===e?void 0:e.method)||"GET")?i.apply(void 0,y([],C(o),!1)):new Promise(function(n,t){var r=c+=2;u(r,Date.now()),i.apply(void 0,y([],C(o),!1)).then(function(e){a(r),n(e)},function(e){a(r,e),t(e)})})}}function Pn(_,x,S,T){return function(e,t,n){var c,s,r,o,i,u,a,f,l=C([c=[],s=[],function(u,a){return function(e){var n=e.startTime,t=e.duration,r=e.fetchStart,o=e.responseEnd,i=e.entryType;"longtask"===i?(e.start=n,e.end=n+t,c.push(e),u&&u(e)):"resource"===i&&(s.push({start:r,end:o}),a&&a(e))}}],3),d=l[0],p=l[1],v=l[2],h=C((r=_,o=x,h=C([i={},function(e,n){return i[e]=n},function(e){return delete i[e]}],3),y=h[0],l=h[1],h=h[2],u=o&&D(o.prototype,"open",Mn)(),a=o&&D(o.prototype,"send",Bn)(l,h),f=r&&D(r,"fetch",Hn)(l,h),[y,function(){u&&u(!0),a&&a(!0),f&&f(!0)}]),2),m=h[0],g=h[1],y=C(T&&In(T,function(){return t(n()+5e3)})||[],2),h=y[0],w=y[1];h&&h();function b(){return function(e,n,t){if(2<e.length)return t();for(var r=[],o=0;o<n.length;o++)r.push([n[o].start,0],[n[o].end,1]);for(o=0;o<e.length;o++)r.push([e[o],0]);r.sort(function(e,n){return e[0]-n[0]});for(var i=e.length,o=r.length-1;0<=o;o--){var u=C(r[o],2),a=u[0];switch(u[1]){case 0:i--;break;case 1:if(2<++i)return a}}return 0}(function(e){for(var n=Object.keys(e),t=[],r=0;r<n.length;r++){var o=e[n[r]];"number"==typeof o&&t.push(o)}return t}(m),p,n)}var y=C(Y(S,v(function(e){var n=e.startTime,e=e.duration;return t(n+e+5e3)},function(){return t(b()+5e3)}),!1,function(){return d.notSupport=!0}),2),h=y[0],E=y[1];return h("longtask","resource"),e.forEach(v()),[d,function(){g(),E(),w&&w()},b]}}var Un=function(_,x,S,T,D){return void 0===_&&(_=H()),void 0===x&&(x=P()&&I()),void 0===S&&(S=e()),void 0===T&&(T=U()),void 0===D&&(D=B()),function(e,n,t,r){var o=pn("tti",0),i=C(ce(function(e){e=vn(e);n&&n(e)}),1)[0];if(!(_&&x&&S&&D))return o.isSupport=!1,i(o),[function(){return 0}];var u=e.precollect,a=e.isAsync,a=void 0===a?0:a,e=e.minValue,c=void 0===e?null:e,e=u||{},u=e.entries,s=void 0===u?[]:u,f=e.observer,u=C(X(D),5),l=u[0],d=u[1],p=u[4],e=C(Nn(d),3),u=e[0],v=e[1],h=e[2],a=C(Pn(x,_,S,T)(a?[]:s,h,d),3),m=a[0],g=a[1],y=a[2],w=function(){v(),g(),t&&t(),f&&f.disconnect(),s.length=0},b=function(e){var n=p("first-contentful-paint")[0],n=function(e,n,t,r,o){if(r-t<5e3)return null;o=0===o.length?e:o[o.length-1].end;return r-o<5e3?null:Math.max(o,n)}((n?n.startTime:An(l))||0,c||An(l)||0,y(),d()+(e?0:5e3),m);return e?n?(w(),void e(n)):h(d()+1e3):(w(),n)};if(r&&r(m,h,o),m.notSupport)return o.isSupport=!1,i(o),[function(){return 0}];function E(e){o.value=e,i(o)}r=m[m.length-1];u(function(){return b(E)},Math.max(y()+5e3,r?r.end:0));return[function(){return b()||0}]}},Wn="tti";function Gn(e,t,n,r){if(!e||-1<r.indexOf(e.tagName))return 0;var o=e.children;if((o=[].slice.call(void 0===o?[]:o).reduceRight(function(e,n){return e+Gn(n,t+1,0<e,r)},0))<=0&&!n){if(!_(e.getBoundingClientRect))return 0;n=e.getBoundingClientRect()||{},e=n.top,n=n.height;if(e>window.innerHeight||n<=0)return 0}return o+1+.5*t}var Fn=["SCRIPT","STYLE","META","HEAD"],zn=function(h,m,g,y,w){var e;return void 0===h&&(h=A()),void 0===m&&(m=U()),void 0===g&&(g=null===(e=W())||void 0===e?void 0:e.navigationStart),void 0===y&&(y=function(){if(I()&&"requestAnimationFrame"in window)return window.requestAnimationFrame}()),void 0===w&&(w=function(){if(I()&&"cancelAnimationFrame"in window)return window.cancelAnimationFrame}()),function(e,n){var t=e.renderType,r=pn("fmp",0),o=function(e){e=vn(e);n&&n(e)};if("SSR"===t)return J(gn,{metricName:"fmp",entryName:xn},o),[b];var i=C(ce(o),1)[0];if(!h||!m||!g)return r.isSupport=!1,i(r),[b];function u(){return d.push({time:Date.now()-l,score:Gn(h&&h.body,1,!1,Fn)})}var a,c,s,f,l=Date.now(),d=[],p=C((a=h,e=w,t=!0,s=!_(o=y)||t&&a&&a.hidden?function(e){return e(0),0}:o,f=_(e)?e:b,[function(e){c&&f(c),c=s(e)},s,f]),1)[0],o=C(z(m,function(){return p(u)}),2),e=o[0],v=o[1],o=l-(g||0);return e(h,{subtree:!0,childList:!0}),[function(e){void 0===e&&(e=0),v();var n,t,n=(n=(t=C(void 0===(n=d)?[]:n))[0],(t=t.slice(1))&&t.reduce(function(e,n){var t=C(e,2),r=t[0],e=t[1],t=n.score-r.score;return[n,n.time>=r.time&&e.rate<t?{time:n.time,rate:t}:e]},[n,{time:null==n?void 0:n.time,rate:0}])[1].time||0);r.value=n?n+e:0,i(r)}.bind(null,o)]}},Xn="fmp",Yn={renderType:"CSR"};function Jn(T,D,R,L,k){if(void 0===T&&(T=I()),void 0===D&&(D=A()),void 0===R&&(R=e()),void 0===L&&(L=U()),void 0===k&&(k=B()),D&&T)return function(e,n){var t,r,o,i,u,a,c=e.threshold,s=e.screenshot,f=e.rootSelector,l=e.autoDetect,d=e.ssUrl,p=nt(T),v=C(X(k),2)[1],h=0,m=!1,g=function(e){t&&n&&n({ev_type:"blank_screen",payload:{timestamp:t[0],score:t[1],screenshot:e,error:r}})},y=(i=function(){t&&!m&&(m=!0,b(),s?ot(g,d,T,D):g())},function(){u||(a=Date.now(),u=T.setTimeout(function(){u=0,a<h||i()},v()>Kn?Zn:Qn))});se(function(){m||g()});function w(){o&&clearTimeout(o),o=T.setTimeout(function(){p(function(){T.requestAnimationFrame(function(){var e=f?D.querySelector(f):D.body;e&&((e=rt(e,0,0,c))<c?(t=[Date.now(),e],y()):t=void 0)})})},1e3)}var b=function(){clearTimeout(o),x&&x(),S&&S()},E=C(z(L,w),2),_=E[0],x=E[1],e=C(Y(R,function(e,n,t){return o&&1<t.length&&w()}),2),E=e[0],S=e[1];return l&&(_(null===(_=A())||void 0===_?void 0:_.body,{subtree:!0,childList:!0}),E("longtask","resource"),w()),[b,function(e){m||(h=Date.now(),r&&h-r.timestamp>et&&(r=void 0),r=tt(r,e))},w]}}var Vn=["SCRIPT","STYLE","META","HEAD"],$n=["js_error","http","resource_error"],Kn=1e4,Qn=8e3,Zn=2e3,et=1e4,nt=function(n){return n.requestIdleCallback||function(e){return n.setTimeout(e,1)}},tt=function(e,n){if(-1===$n.indexOf(n.ev_type))return e;if("http"===n.ev_type&&n.payload.response.status<400)return e;if(e&&$n.indexOf(e.type)<$n.indexOf(n.ev_type))return e;var t="";switch(n.ev_type){case"js_error":t=n.payload.error.message;break;case"http":t=n.payload.request.url;break;case"resource_error":t=n.payload.url}return{type:n.ev_type,message:t,timestamp:Date.now()}},rt=function(t,r,e,o,i){if(void 0===r&&(r=0),void 0===e&&(e=0),void 0===o&&(o=1.5),void 0===i&&(i=Vn),!t||-1<i.indexOf(t.tagName)||o<=e||4<r)return e;var n=function(){if(!r)return 0;var e=t.getBoundingClientRect(),n=e.top,e=e.height;return n>innerHeight||e<=0?0:1/Math.pow(2,r-1)}();return[].reduceRight.call(t.children,function(e,n){return rt(n,r+1,e,o,i)},e+n)},ot=function(n,e,t,r){if(I()&&"Promise"in window&&Promise&&t&&r){if(t.html2canvas)return i();var o=r.createElement("script");o.src=e,null!==(e=r.head)&&void 0!==e&&e.appendChild(o),o.onload=i}function i(){nt(t)(function(){t.html2canvas&&t.html2canvas(r.body,{scale:360/t.innerWidth}).then(function(e){n(e.toDataURL("image/jpeg",.1))})})}},it="blankScreen";var ut={autoDetect:!0,threshold:1.5,screenshot:!0,ssUrl:"https://apm.volccdn.com/mars-web/apmplus/web/html2canvas.min.js"};function at(e,n){var o,i,u;i=ut,u=n,(o=e).on("init",function(){var e,n,t,r=xe(o,it,i)||ue(u,i);r&&(r=C(J(Jn,r,o.report.bind(o)),3),e=r[0],n=r[1],r=r[2],o.on("report",t=function(e){return n(e),e}),o.on("beforeDestroy",function(){e(),o.off("report",t)}),o.provide("detectBlankScreen",r))})}var ct="custom",st=function(e){if(e&&E(e)&&e.name&&h(e.name)){var n={name:e.name,type:"event"};if("metrics"in e&&E(e.metrics)){var t=e.metrics,r={};for(o in t)c(t[o])&&(r[o]=t[o]);n.metrics=r}if("categories"in e&&E(e.categories)){var o,i=e.categories,u={};for(o in i)u[o]=s(i[o]);n.categories=u}return n}},ft=function(e){if(e&&E(e)&&e.content&&h(e.content)){var n={content:s(e.content),type:"log",level:"info"};if("level"in e&&(n.level=e.level),"extra"in e&&E(e.extra)){var t,r=e.extra,o={},i={};for(t in r)c(r[t])?o[t]=r[t]:i[t]=s(r[t]);n.metrics=o,n.categories=i}return n}};function lt(e){return(null==e?void 0:e.effectiveType)||(null==e?void 0:e.type)||""}function dt(e,n){var t=e.common||{};return t.sample_rate=n,e.common=t,e}function pt(e,n,t,r,o){return e?(i=o(r,n),function(){return i}):function(){return t(n)};var i}function vt(e,n,t,r){if(void 0===(e=l(e,n,function(e,n){return e[n]})))return!1;var o,n="boolean"==typeof e?"bool":c(e)?"number":"string";return function(e,n,t){switch(t){case"eq":return x(n,e);case"neq":return!x(n,e);case"gt":return e>n[0];case"gte":return e>=n[0];case"lt":return e<n[0];case"lte":return e<=n[0];case"regex":return Boolean(e.match(new RegExp(n.join("|"))));case"not_regex":return!e.match(new RegExp(n.join("|")));default:return!1}}(e,(o=n,r.map(function(e){switch(o){case"number":return Number(e);case"boolean":return"1"===e;default:return String(e)}})),t)}function ht(n,e){try{return"rule"===e.type?vt(n,e.field,e.op,e.values):"and"===e.type?e.children.every(function(e){return ht(n,e)}):e.children.some(function(e){return ht(n,e)})}catch(e){return F(e),!1}}function mt(){var t=I();return t&&t.navigator.sendBeacon?{get:function(){},post:function(e,n){t.navigator.sendBeacon(e,n)}}:{get:b,post:b}}function gt(e,n,t){var r=n.url,o=n.data,i=n.success,u=void 0===i?b:i,a=void 0===(i=n.fail)?b:i,c=void 0===(i=n.getResponseText)?b:i,n=void 0!==(n=n.withCredentials)&&n;(t=new t).withCredentials=n,t.open(e,r,!0),t.setRequestHeader("Content-Type","application/json"),t.onload=function(){null!=c&&c(this.responseText);try{var e;this.responseText?(e=JSON.parse(this.responseText),u(e)):u({})}catch(e){a(e)}},t.onerror=function(){a(new Error("Network request failed"))},t.onabort=function(){a(new Error("Network request aborted"))},t.send(o)}var yt=function(e){var n=G(),t=lt(n);n&&(n.onchange=function(){t=lt(n)}),e.on("report",function(e){return v(v({},e),{extra:v(v({},e.extra||{}),{network_type:t})})})},wt=function(e,n,t,r){if(!n)return g;var o=n.sample_rate,i=n.include_users,u=n.sample_granularity,a=n.rules,n=n.r,n=void 0===n?Math.random():n;if(x(i,e))return function(e){return dt(e,1)};var c,s,f,l,d,p,v,u="session"===u,h=pt(u,o,t,n,r),m=(c=a,s=u,f=o,l=t,d=n,p=r,v={},Object.keys(c).forEach(function(e){var n=c[e],t=n.enable,r=n.sample_rate,n=n.conditional_sample_rules;t?(v[e]={enable:t,sample_rate:r,effectiveSampleRate:r*f,hit:pt(s,r,l,d,p)},n&&(v[e].conditional_hit_rules=n.map(function(e){var n=e.sample_rate,e=e.filter;return{sample_rate:n,hit:pt(s,n,l,d,p),effectiveSampleRate:n*f,filter:e}}))):v[e]={enable:t,hit:function(){return!1},sample_rate:0,effectiveSampleRate:0}}),v);return function(e){if(!h())return!1;if(!(e.ev_type in m))return dt(e,o);if(!m[e.ev_type].enable)return!1;if(null!==(n=e.common)&&void 0!==n&&n.sample_rate)return e;var n=m[e.ev_type],t=n.conditional_hit_rules;if(t)for(var r=0;r<t.length;r++)if(ht(e,t[r].filter))return!!t[r].hit()&&dt(e,t[r].effectiveSampleRate);return!!n.hit()&&dt(e,n.effectiveSampleRate)}};function bt(e){var n,t,r,o,i,u,a,c,s=(t=(n=e).transport,r=e.endpoint,o=e.size,i=void 0===o?10:o,u=void 0===(n=e.wait)?1e3:n,a=[],c=0,{getSize:function(){return i},getWait:function(){return u},setSize:function(e){i=e},setWait:function(e){u=e},getEndpoint:function(){return r},setEndpoint:function(e){r=e},send:function(e){a.push(e),a.length>=i&&f.call(this),clearTimeout(c),c=setTimeout(f.bind(this),u)},flush:function(){clearTimeout(c),f.call(this)},getBatchData:function(){return a.length?p(a):""},clear:function(){clearTimeout(c),a=[]}});function f(){a.length&&(t.post({url:r,data:this.getBatchData()}),a=[])}function l(e){d.post(s.getEndpoint(),p([e]))}var d=mt();return se(function(){var e=s.getBatchData();e&&(d.post(s.getEndpoint(),e),s.clear()),s.send=l}),s}var Et={build:function(e){return{ev_type:e.ev_type,payload:e.payload,common:v(v({},e.extra||{}),e.overrides||{})}}};function _t(e){var n,t=e.plugins||{};for(n in t)t[n]&&!E(t[n])&&(t[n]={});return v(v({},e),{plugins:t})}function xt(e){return E(e)&&"aid"in e}function St(e){return v({},e)}function Tt(){var e=I(),n=A();if(e&&n)return(null===(n=null===(n=null===(n=function(){if(!document)return null;if(document.currentScript)return document.currentScript;try{throw new Error}catch(e){var n=0,t=/at\s+(.*)\s+\((.*):(\d*):(\d*)\)/i.exec(e.stack),r=t&&t[2]||!1,o=t&&t[3]||0,i=document.location.href.replace(document.location.hash,""),u="",a=document.getElementsByTagName("script");for(r===i&&(t=document.documentElement.outerHTML,o=new RegExp("(?:[^\\n]+?\\n){0,"+(o-2)+"}[^<]*<script>([\\d\\D]*?)<\\/script>[\\d\\D]*","i"),u=t.replace(o,"$1").trim());n<a.length;n++){if("interactive"===a[n].readyState)return a[n];if(a[n].src===r)return a[n];if(r===i&&a[n].innerHTML&&a[n].innerHTML.trim()===u)return a[n]}return null}}())||void 0===n?void 0:n.getAttribute("src"))||void 0===n?void 0:n.match(/globalName=(.+)$/))||void 0===n?void 0:n[1])||kt}function Dt(e){return"APMPLUS"+e}function Rt(e){return function(e){try{var n=localStorage.getItem(e),t=n;return t=n&&"string"==typeof n?JSON.parse(n):t}catch(e){return}}(Dt(e))||{userId:O(),deviceId:O(),r:Math.random()}}function Lt(e){var n=e.aid,t=e.userId,r=e.deviceId,e=e.sample;!function(e,n){try{var t="string"==typeof n?n:JSON.stringify(n);localStorage.setItem(e,t)}catch(e){}}(Dt(n),{userId:t,deviceId:r,r:e.r})}var kt="APM_PLUS_WEB",Ct="/settings/get/webpro",jt="/monitor_web/collect",Ot=[jt,Ct,"/monitor_browser/collect"],qt={sample_rate:1,include_users:[],sample_granularity:"session",rules:{}},Nt=20,It=function(e,n){return void 0===n&&(n=jt),(e&&0<=e.indexOf("//")?"":"https://")+e+n},At=O,Mt=function(n){var o,i,u,a=n,c={},s=b,t=b;return{getConfig:function(){return a},setConfig:function(e){var n,t,r;return c=v(v({},c),e||{}),f(),o||(o=e,a.useLocalConfig?(u={},s()):i?l():(n=a.transport,t=a.domain,e=a.aid,r=function(e){i=e,l()},n.get({withCredentials:!0,url:function(e,n){return void 0===n&&(n=Ct),(e&&0<=e.indexOf("//")?"":"https://")+e+n}(t)+"?aid="+e,success:function(e){r(e.data||{})},fail:function(){r()}}))),a},onChange:function(e){t=e},onReady:function(e){s=function(){!function(){n.userId!==a.userId&&(n.sample.r=Math.random(),f());Lt(a)}(),e()},u&&s()}};function f(){var e=v(v(v({},n),u||{}),c);e.plugins=function(){for(var e=[],n=0;n<arguments.length;n++)e[n]=arguments[n];for(var t={},r=0;r<e.length;)t=d(t,e[r++]);return t}(n.plugins,(null==u?void 0:u.plugins)||{},c.plugins||{}),e.sample=Bt(Bt(n.sample,null==u?void 0:u.sample),c.sample),a=e,t()}function l(){u=function(e){if(!e)return{};var n=e.sample,t=e.timestamp,r=e.status;if(!n)return{};var o=n.sample_rate,e=n.sample_granularity;return{sample:{include_users:n.include_users,sample_rate:r&&4===r?0:o,sample_granularity:e,rules:n.rules.reduce(function(e,n){var t=n.name,r=n.enable,o=n.sample_rate,n=n.conditional_sample_rules;return e[t]={enable:r,sample_rate:o,conditional_sample_rules:n},e},{})},serverTimestamp:t}}(i),f(),s()}};function Bt(r,o){if(!r||!o)return r||o;var e=v(v({},r),o);return e.include_users=y(y([],C(r.include_users||[]),!1),C(o.include_users||[]),!1),e.rules=y(y([],C(Object.keys(r.rules||{})),!1),C(Object.keys(o.rules||{})),!1).reduce(function(e,n){var t;return n in e||(n in(r.rules||{})&&n in(o.rules||{})?(e[n]=v(v({},r.rules[n]),o.rules[n]),e[n].conditional_sample_rules=y(y([],C(r.rules[n].conditional_sample_rules||[]),!1),C(o.rules[n].conditional_sample_rules||[]),!1)):e[n]=(null===(t=r.rules)||void 0===t?void 0:t[n])||(null===(t=o.rules)||void 0===t?void 0:t[n])),e},{}),e}var Ht,Pt,Ut,Wt,Gt,Ft,zt,Xt,Yt,Jt,Vt,$t,Kt,Qt,Zt,er,nr,tr,rr=function(e){e.on("report",function(e){return n=e,e={url:K(),timestamp:Date.now()},v(v({},n),{extra:v(v({},e),n.extra||{})});var n})},or={sri:"reportSri",st:"reportResourceError",err:"captureException"},ir=function(e){return Object.keys(e).reduce(function(e,n){return e[n]=[],e},{})},ur=function(t){return Object.keys(t).reduce(function(e,n){return e[t[n]]=n,e},{})},ar=function(o,i,u){return function(e,n,t,r){void 0===t&&(t=Date.now()),void 0===r&&(r=location.href);r=v(v({},Q(o)),{url:r,timestamp:t});i[e]&&(o[u[e]]?Z(o,r)(function(){o[u[e]](n)}):null!==(t=i[e])&&void 0!==t&&t.push([n,r]))}},cr=function(r,n,o){return function(t){var e;t in o&&(null!==(e=n[o[t]])&&void 0!==e&&e.forEach(function(e){var e=C(e,2),n=e[0],e=e[1];Z(r,e)(function(){r[t](n)})}),n[o[t]]=null)}},sr=function(t){var r,o=!1;t.on("init",function(){r=(new Date).getTime(),t.on("config",function(){var e,n=null===(e=t.config())||void 0===e?void 0:e.serverTimestamp;isNaN(n)||Number(n)<=0||o||(o=!0,(e=(new Date).getTime())-r<700&&n&&(e=n-(e+r)/2,!isNaN(e)&&(0<e||e<-6e5)&&t.set({offset:e})))})})},fr=function(r){r.on("beforeBuild",function(e){return n=e,t=r.config(),(e={}).aid=t.aid,e.pid=t.pid,e.view_id=t.viewId,e.user_id=t.userId,v(v({},n),{extra:v(v({},e),n.extra||{})});var n,t})},lr=function(c){c.on("start",function(){var t,e=c.config(),n=e.deviceId,r=e.sessionId,o=e.release,i=e.env,u=e.offset,a=e.aid,e=e.token,a={did:n,sid:r,release:o,env:i,sname:kt,sversion:"1.6.0",soffset:u||0,biz_id:a,x_auth_token:e},e=c.getSender();e.setEndpoint(e.getEndpoint()+(E(t=a)?Object.keys(t).reduce(function(e,n){return e+="&"+n+"="+t[n]},"").replace("&","?"):""))})},dr=function(e){var n,e=Rt(e.aid);return{aid:0,pid:"",token:"",viewId:"__"+Date.now(),userId:e.userId,deviceId:e.deviceId,sessionId:At(),domain:"apmplus.volces.com",plugins:{ajax:{ignoreUrls:Ot},fetch:{ignoreUrls:Ot},breadcrumb:{},pageview:{},jsError:{},resource:{},resourceError:{},performance:{},tti:{},fmp:{},blankScreen:!1},release:"",env:"production",sample:v(v({},qt),{r:e.r}),transport:(n=H())?{get:function(e){gt("GET",e,n)},post:function(e){gt("POST",e,n)}}:{get:b,post:b}}},pr=(tr=function(e){var n=void 0===e?{}:e,t=n.createSender,e=n.builder,n=n.createDefaultConfig,r=function(e){var t,r,n=e.builder,o=e.createSender,i=e.createDefaultConfig,u=e.createConfigManager,a=e.userConfigNormalizer,c=e.initConfigNormalizer,s=e.validateInitConfig,f={};w.forEach(function(e){return f[e]=[]});var l=!1,d=!1,p=!1,v=[],h=[],m={getBuilder:function(){return n},getSender:function(){return t},getPreStartQueue:function(){return v},init:function(e){if(l)T("already inited");else{if(!(e&&E(e)&&s(e)))throw new Error("invalid InitConfig, init failed");var n=i(e);if(!n)throw new Error("defaultConfig missing");e=c(e);if((r=u(n)).setConfig(e),r.onChange(function(){g("config")}),!(t=o(r.getConfig())))throw new Error("sender missing");g("init",l=!0)}},set:function(e){l&&e&&E(e)&&(g("beforeConfig",!1,e),null!=r&&r.setConfig(e))},config:function(e){if(l)return e&&E(e)&&(g("beforeConfig",!1,e),null!=r&&r.setConfig(a(e))),null==r?void 0:r.getConfig()},provide:function(e,n){x(h,e)?T("cannot provide "+e+", reserved"):(m[e]=n,g("provide",!1,e))},start:function(){var n=this;l&&(d||null!=r&&r.onReady(function(){g("start",d=!0),v.forEach(function(e){return n.build(e)}),v=[]}))},report:function(e){e&&(!(e=R(f.beforeReport)(e))||(e=R(f.report)(e))&&(d?this.build(e):v.push(e)))},build:function(e){!d||(e=R(f.beforeBuild)(e))&&(!(e=n.build(e))||(e=R(f.build)(e))&&this.send(e))},send:function(e){!d||(e=R(f.beforeSend)(e))&&(t.send(e),g("send",!1,e))},destroy:function(){g("beforeDestroy",p=!0)},on:function(e,n){"init"===e&&l||"start"===e&&d||"beforeDestroy"===e&&p?n():f[e]&&f[e].push(n)},off:function(e,n){f[e]&&(f[e]=S(f[e],n))}},h=Object.keys(m);return m;function g(e,n){void 0===n&&(n=!1);for(var t=[],r=2;r<arguments.length;r++)t[r-2]=arguments[r];f[e].forEach(function(e){try{e.apply(void 0,y([],C(t),!1))}catch(e){}}),n&&(f[e].length=0)}}({validateInitConfig:xt,initConfigNormalizer:_t,userConfigNormalizer:St,createSender:void 0===t?function(e){return bt({size:Nt,endpoint:It(e.domain),transport:e.transport})}:t,builder:void 0===e?Et:e,createDefaultConfig:void 0===n?dr:n,createConfigManager:Mt});q(r),sr(r),fr(r),rr(r),yt(r),lr(r);var o,n=N(r,Q,function(e,n,t){return Z(e,n)(function(){var e=C(t),n=e[0],e=e.slice(1);r[n].apply(r,y([],C(e),!1))})});return(o=n).on("init",function(){var n=[],e=o.config();e&&e.integrations&&e.integrations.forEach(function(e){x(n,e.name)||(n.push(e.name),e.setup(o),e.tearDown&&o.on("beforeDestroy",e.tearDown))})}),n}(Ht=void 0===Ht?{}:Ht),(Pt=tr).on("start",function(){var e=Pt.config(),n=e.userId,e=e.sample;e&&0===e.sample_rate&&Pt.destroy();e=wt(n,e,k,j);Pt.on("build",e)}),Ut=tr,Gt=ir(Wt=void 0===Wt?or:Wt),Ht=ur(Wt),Ft=ar(Ut,Gt,Wt),null!==(Wt=Ut.p)&&void 0!==Wt&&Wt.a&&"observe"in Ut.p.a&&Ut.p.a.observe(function(e){var n=C(e,5);n[0];var t=n[1],r=n[2],e=n[3],n=n[4];Ft(t,r,e,n)}),Ut.on("init",function(){var e;null!==(e=Ut.p)&&void 0!==e&&e.a.forEach(function(e){var n=C(e,5);n[0];var t=n[1],r=n[2],e=n[3],n=n[4];Ft(t,r,e,n)}),Ut.p&&Ut.p.a&&(Ut.p.a.length=0)}),Ut.provide("precollect",Ft),Ut.on("provide",cr(Ut,Gt,Ht)),(zt=tr).provide("sendEvent",function(e){e=st(e);e&&zt.report({ev_type:ct,payload:e,extra:{timestamp:Date.now()}})}),zt.provide("sendLog",function(e){e=ft(e);e&&zt.report({ev_type:ct,payload:e,extra:{timestamp:Date.now()}})}),(Xt=tr).on("init",function(){var e,n=xe(Xt,nn,tn);n&&(n=C(J(en,v(v({},n),{initPid:null===(n=Xt.config())||void 0===n?void 0:n.pid,onPidUpdate:function(e){Xt.set({pid:e,viewId:e+"_"+Date.now(),actionId:void 0})}}),Xt.report.bind(Xt)),2),e=n[0],n=n[1],Xt.on("config",function(){e(Xt.config().pid)}),Xt.on("beforeDestroy",n),Xt.provide("sendPageview",e))}),(Yt=tr).on("init",function(){var n,e=xe(Yt,Te,De);e&&(n=!1,e=C(J(be,v(v({},e),{hookCbAtReq:Re(Yt),setTraceHeader:_e(e.trace,"app_id="+(null===(e=Yt.config())||void 0===e?void 0:e.aid)+",origin=web")}),function(e){return!n&&Yt.report(e)}),1)[0],Yt.on("beforeDestroy",function(){n=!0}),Yt.provide("wrapXhr",e))}),(Jt=tr).on("init",function(){var n,e=xe(Jt,Me,Be);e&&(n=!1,e=C(J(Ae,v(v({},e),{hookCbAtReq:Re(Jt),setTraceHeader:_e(e.trace,"app_id="+(null===(e=Jt.config())||void 0===e?void 0:e.aid)+",origin=web")}),function(e){return!n&&Jt.report(e)}),1)[0],Jt.on("beforeDestroy",function(){n=!0}),Jt.provide("wrapFetch",e))}),(Vt=tr).on("init",function(){var e,n=xe(Vt,Wn,{});n&&(e=Vt.pp||On,J(Un,v(v({},n),{precollect:e}),Se(Vt)))}),($t=tr).on("init",function(){var e,n=xe($t,Xn,Yn);n&&(e=C(J(zn,n,Se($t)),1)[0],oe(function(){return setTimeout(e,200)}))}),(Kt=tr).on("init",function(){var n,e,t=xe(Kt,ke,Ce);t&&(t=(e=C(J(Le,t,b),3))[0],n=e[1],e=e[2],Kt.on("report",function(e){return"http"===e.ev_type&&n({type:"http",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}),Kt.on("beforeDestroy",e),Kt.provide("getBreadcrumbs",t),Kt.provide("addBreadcrumb",n))}),(Qt=tr).on("init",function(){window.removeEventListener("error",Qt.pcErr,!0),window.removeEventListener("unhandledrejection",Qt.pcRej,!0);var e,n=xe(Qt,Qe,Ze);n&&(n=(e=C(J(Ke,n,function(e){Qt.getBreadcrumbs&&(e.payload.breadcrumbs=Qt.getBreadcrumbs()),Qt.report(e)}),2))[0],e=e[1],Qt.on("beforeDestroy",e),Qt.provide("captureException",n))}),(Zt=tr).on("init",function(){var e=Zt.pp||On;null!==(t=e.observer)&&void 0!==t&&t.disconnect();var n,t,r,o,i,u=xe(Zt,jn,qn);u&&(J(Tn,v(v({},u),{precollect:e}),Se(Zt)),t=(r=C(J(Cn,0,n=function(e){Zt.report({ev_type:"performance",payload:e})}),2))[0],r=r[1],Zt.provide("performanceInit",t),Zt.provide("performanceSend",r),u.longtask&&(r=C(J(kn,{precollect:e},function(e){Zt.report({ev_type:"performance_longtask",payload:e})}),1)[0],Zt.on("beforeDestroy",r)),u.cls&&(o=K(),u=C(J(Rn,[e],function(e){Zt.report({ev_type:"performance",payload:e,overrides:{url:o}})}),2),i=u[0],u=u[1],Zt.on("beforeConfig",function(e){e.viewId&&e.viewId!==(null===(e=Zt.config())||void 0===e?void 0:e.viewId)&&(i(),o=K())}),Zt.on("beforeDestroy",u),se(i)),e.entries.length=0,Zt.provide("sendCustomPerfMetric",function(e){e=v(v(v({},wn),e),{isCustom:!0});n(e)}))}),(er=tr).on("init",function(){var e,n=xe(er,ln,dn);n&&(n=(e=C(J(fn,n,er.report.bind(er)),2))[0],e=e[1],er.on("beforeDestroy",e),er.provide("reportResourceError",n))}),(nr=tr).on("init",function(){var e=xe(nr,an,cn);e&&(e=C(J(un,e,function(e){var n=C(e,2),e=n[0],n=n[1];nr.report(n?v(v({},e),{extra:{sample_rate:1}}):e)}),1)[0],nr.on("beforeDestroy",e))}),at(tr),tr),vr=function(){var e=I(),n=Tt();if(e&&n)return e[n]}();vr&&["p","pp","pcErr","pcRej"].forEach(function(e){pr.provide(e,vr[e])});var hr,mr,gr,yr,wr=I(),br=Tt();wr&&br&&(hr=(null==(hr=wr[br])?void 0:hr.q)||[],wr[br]=pr,hr.forEach(function(e){var n,t;t=e,e=v(v({},Q(n=pr)),{url:t.pop(),timestamp:t.pop()}),Z(n,e)(function(){n.apply(void 0,y([],C(t),!1))})}),hr.length=0,pr.p&&("observe"in pr.p.a&&console.warn("global precollect queue already updated"),pr.p.a=(gr=pr.p.a,yr=[],gr.observe=function(e){yr.push(e)},gr.push=function(){for(var e,n=[],t=0;t<arguments.length;t++)n[t]=arguments[t];return n.forEach(function(n){yr.forEach(function(e){return e(n)})}),(e=[].push).call.apply(e,y([gr],C(n),!1))},gr),(mr=pr.precollect)&&pr.provide("precollect",function(){for(var e=[],n=0;n<arguments.length;n++)e[n]=arguments[n];return pr.p.a.push(y(["precollect"],C(e),!1)),mr.apply(void 0,y([],C(e),!1))})))}(); | ||
!function(){"use strict";var u,v=function(){return(v=Object.assign||function(n){for(var e,t=1,r=arguments.length;t<r;t++)for(var o in e=arguments[t])Object.prototype.hasOwnProperty.call(e,o)&&(n[o]=e[o]);return n}).apply(this,arguments)};function D(n,e){var t="function"==typeof Symbol&&n[Symbol.iterator];if(!t)return n;var r,o,i=t.call(n),u=[];try{for(;(void 0===e||0<e--)&&!(r=i.next()).done;)u.push(r.value)}catch(n){o={error:n}}finally{try{r&&!r.done&&(t=i.return)&&t.call(i)}finally{if(o)throw o.error}}return u}function y(n,e,t){if(t||2===arguments.length)for(var r,o=0,i=e.length;o<i;o++)!r&&o in e||((r=r||Array.prototype.slice.call(e,0,o))[o]=e[o]);return n.concat(r||Array.prototype.slice.call(e))}"undefined"==typeof Element||Element.prototype.addEventListener||(u=[],Nr=function(n,e){for(var t=0;t<u.length;){var r=u[t];if(r.object===this&&r.type===n&&r.listener===e){"DOMContentLoaded"===n?this.detachEvent("onreadystatechange",r.wrapper):this.detachEvent("on"+n,r.wrapper),u.splice(t,1);break}++t}},Element.prototype.addEventListener=Pr=function(n,e){function t(n){n.target=n.srcElement,n.currentTarget=i,void 0!==e.handleEvent?e.handleEvent(n):e.call(i,n)}var r,o,i=this;"DOMContentLoaded"===n?(r=function(n){"complete"===document.readyState&&t(n)},document.attachEvent("onreadystatechange",r),u.push({object:this,type:n,listener:e,wrapper:r}),"complete"===document.readyState&&((o=new Event).srcElement=window,r(o))):(this.attachEvent("on"+n,t),u.push({object:this,type:n,listener:e,wrapper:t}))},Element.prototype.removeEventListener=Nr,HTMLDocument&&!HTMLDocument.prototype.addEventListener&&(HTMLDocument.prototype.addEventListener=Pr,HTMLDocument.prototype.removeEventListener=Nr),Window&&!Window.prototype.addEventListener&&(Window.prototype.addEventListener=Pr,Window.prototype.removeEventListener=Nr));function p(n){return JSON.stringify({ev_type:"batch",list:n})}var b=["init","start","config","beforeDestroy","provide","beforeReport","report","beforeBuild","build","beforeSend","send","beforeConfig"],w=function(){return{}};function g(n){return n}function E(n){return"object"==typeof n&&null!==n}var e=Object.prototype;function i(n){if(E(n)){if("function"!=typeof Object.getPrototypeOf)return"[object Object]"===e.toString.call(n);n=Object.getPrototypeOf(n);return n===e||null===n}}function a(n){return"[object Array]"===e.toString.call(n)}function _(n){return"function"==typeof n}function c(n){return"number"==typeof n}function h(n){return"string"==typeof n}function o(n){return"undefined"!=typeof Event&&function(n,e){try{return n instanceof e}catch(n){return}}(n,Event)}function d(n,e){var t,r,o=v({},n);for(t in e)r=t,Object.prototype.hasOwnProperty.call(e,r)&&void 0!==e[t]&&(E(e[t])&&i(e[t])?o[t]=d(E(n[t])?n[t]:{},e[t]):a(e[t])&&a(n[t])?o[t]=function e(n,t){n=a(n)?n:[];t=a(t)?t:[];return Array.prototype.concat.call(n,t).map(function(n){return n instanceof RegExp?n:E(n)&&i(n)?d({},n):a(n)?e([],n):n})}(n[t],e[t]):o[t]=e[t]);return o}function S(n,e){if(!a(n))return!1;if(0===n.length)return!1;for(var t=0;t<n.length;){if(n[t]===e)return!0;t++}return!1}function x(n,e){if(!a(n))return n;var t=n.indexOf(e);if(0<=t){e=n.slice();return e.splice(t,1),e}return n}function l(n,e,t){for(var r,o=(e=D(e.split(".")))[0],i=e.slice(1);n&&0<i.length;)n=n[o],o=(r=D(i))[0],i=r.slice(1);if(n)return t(n,o)}function m(n){return a(n)&&n.length?function(n){for(var e=[],t=n.length,r=0;r<t;r++){var o=n[r];h(o)?e.push(o.replace(/([.*+?^=!:${}()|[\]/\\])/g,"\\$1")):o&&o.source&&e.push(o.source)}return new RegExp(e.join("|"),"i")}(n):null}function f(n){try{return h(n)?n:JSON.stringify(n)}catch(n){return"[FAILED_TO_STRINGIFY]:"+String(n)}}function L(i,u,a,c){return void 0===c&&(c=!0),function(){for(var n=[],e=0;e<arguments.length;e++)n[e]=arguments[e];if(!i)return w;var t=i[u],r=a.apply(void 0,y([t],D(n),!1)),o=r;return _(o)&&c&&(o=function(){for(var e=[],n=0;n<arguments.length;n++)e[n]=arguments[n];try{return r.apply(this,e)}catch(n){return _(t)&&t.apply(this,e)}}),i[u]=o,function(n){n||(o===i[u]?i[u]=t:r=t)}}}function s(i,u,a){return function(){for(var n=[],e=0;e<arguments.length;e++)n[e]=arguments[e];if(!i)return w;var t=i[u],r=a.apply(void 0,y([t],D(n),!1)),o=r;return _(o)&&(o=function(){for(var n=[],e=0;e<arguments.length;e++)n[e]=arguments[e];return r.apply(this,n)}),i[u]=o,function(){o===i[u]?i[u]=t:r=t}}}function T(){for(var n=[],e=0;e<arguments.length;e++)n[e]=arguments[e];console.warn.apply(console,y(["[SDK]",Date.now(),(""+r++).padStart(8," ")],D(n),!1))}function R(r){return function(n){for(var e=n,t=0;t<r.length&&e;t++)try{e=r[t](e)}catch(n){C(n)}return e}}var t=0,C=function(){for(var n=[],e=0;e<arguments.length;e++)n[e]=arguments[e];console.error.apply(console,y(["[SDK]",Date.now(),(""+t++).padStart(8," ")],D(n),!1))},r=0,j=function(n){return Math.random()<Number(n)},k=function(n,e){return n<Number(e)};function O(){var n=function(){for(var n=new Array(16),e=0,t=0;t<16;t++)0==(3&t)&&(e=4294967296*Math.random()),n[t]=e>>>((3&t)<<3)&255;return n}();return n[6]=15&n[6]|64,n[8]=63&n[8]|128,function(n){for(var e=[],t=0;t<256;++t)e[t]=(t+256).toString(16).substr(1);var r=0,o=e;return[o[n[r++]],o[n[r++]],o[n[r++]],o[n[r++]],"-",o[n[r++]],o[n[r++]],"-",o[n[r++]],o[n[r++]],"-",o[n[r++]],o[n[r++]],"-",o[n[r++]],o[n[r++]],o[n[r++]],o[n[r++]],o[n[+r]],o[n[15]]].join("")}(n)}function q(r,n){var e=n.reduce(function(n,e){try{var t=e(r);"function"==typeof t&&n.push(t)}catch(n){}return n},[]);return function(n){return q(n,e)}}var I=function(n){function e(n){a=x(a,n),f||s()}var t,r,o,i,u,a=[],c=[],f=!1,s=(r=function(){return a.length},o=function(){f=!0,t&&t[0](),c.forEach(function(n){return n()}),c.length=0,t=void 0},i=n=void 0===n?3e5:n,u=0,function(){if(r())return u&&clearTimeout(u),void(u=0);0===u&&(u=setTimeout(o,i))});return{next:function(n){return q(n,a)},complete:function(n){c.push(n)},attach:function(n,e){t=[n,e]},subscribe:function(n){if(f)throw new Error("Observer is closed");return a.push(n),t&&t[1]&&t[1](n),s(),function(){return e(n)}},unsubscribe:e}},N=function(n,e){var t=I();try{n(t.next,t.attach),e&&t.complete(e)}catch(n){}return[t.subscribe,t.unsubscribe]};var A=function(n){var t,r,o,e=(t={},r={},o={set:function(n,e){return t[n]=e,r[n]=f(e),o},merge:function(e){return t=v(v({},t),e),Object.keys(e).forEach(function(n){r[n]=f(e[n])}),o},delete:function(n){return delete t[n],delete r[n],o},clear:function(){return t={},r={},o},get:function(n){return r[n]},toString:function(){return v({},r)}});n.provide("context",e),n.on("report",function(n){return n.extra||(n.extra={}),n.extra.context=e.toString(),n})},M=function(a,c,t){function f(){for(var n=[],e=0;e<arguments.length;e++)n[e]=arguments[e];var t=n[0];if(t){var r=t.split(".")[0];if(r in f)return i=f,u=t,o=[].slice.call(n,1),l(i,u,function(n,e){if(n&&e in n&&_(n[e]))try{return n[e].apply(n,o)}catch(n){return}});var o,i=s[r]||[],u=null!==(u=null==c?void 0:c(a))&&void 0!==u?u:{};i.push(y([u],D(n),!1)),void(s[r]=i)}}var n,s={};for(n in L(a,"provide",function(t){return function(n,e){f[n]=e,t.call(a,n,e)}})(),a)Object.prototype.hasOwnProperty.call(a,n)&&(f[n]=a[n]);return a.on("provide",function(n){s[n]&&(s[n].forEach(function(n){var e=D(n),n=e[0],e=e.slice(1);null!=t&&t(a,n,e)}),s[n]=null)}),f};function B(n,e){return n.initSubject(e)}function H(){if("object"==typeof window&&E(window))return window}function P(){if("object"==typeof document&&E(document))return document}function U(){return H()&&window.location}function W(){if(H()&&E(window.performance))return window.performance}function G(){if("function"==typeof XMLHttpRequest&&_(XMLHttpRequest))return XMLHttpRequest}function F(){try{return new Headers,new Request(""),new Response,window.fetch}catch(n){}}function z(){if(H()&&_(window.MutationObserver))return window.MutationObserver}function X(){if(H()&&_(window.PerformanceObserver))return window.PerformanceObserver}function Y(){var n=W();if(n&&E(n.timing))return n.timing}function J(){var n=function(){if(H()&&"navigator"in window)return window.navigator}();if(n)return n.connection||n.mozConnection||n.webkitConnection}var V=function(n){if(n)return n.__SLARDAR_REGISTRY__||(n.__SLARDAR_REGISTRY__={Slardar:{plugins:[],errors:[],subject:{}}}),n.__SLARDAR_REGISTRY__.Slardar},$=function(){for(var n=[],e=0;e<arguments.length;e++)n[e]=arguments[e];var t=V(H());t&&(t.errors||(t.errors=[]),t.errors.push(n))},K=function(n,e){var t=n&&new n(e);return[function(n,e){t&&n&&t.observe(n,e)},function(){return t&&t.disconnect()}]},Q=function(t){var n=t&&t.timing||void 0;return[n,function(){return t&&t.now?t.now():(Date.now?Date.now():+new Date)-(n&&n.navigationStart||0)},function(n){var e=(t||{}).getEntriesByType;return _(e)&&e.call(t,n)||[]},function(){var n=(t||{}).clearResourceTimings;_(n)&&n.call(t)},function(n){var e=(t||{}).getEntriesByName;return _(e)&&e.call(t,n)||[]}]},Z=function(t,o,e,i){var r=t&&new t(function(n,r){n.getEntries?n.getEntries().forEach(function(n,e,t){return o(n,e,t,r)}):i&&i(),e&&r.disconnect()});return[function(){for(var e=[],n=0;n<arguments.length;n++)e[n]=arguments[n];if(!t||!r)return i&&i();try{e.forEach(function(n){-1<t.supportedEntryTypes.indexOf(n)&&r.observe({type:n,buffered:!1})})}catch(n){try{r.observe({entryTypes:e})}catch(n){return i&&i()}}},function(){return r&&r.disconnect()}]},nn=function(n,e,t,r){void 0===e&&(e={}),void 0===r&&(r=[]);try{var o=n.apply(void 0,y([],D(r),!1));return o&&o(e,t)||[]}catch(n){return $(n),[]}},en=function(e){return e.requestIdleCallback||function(n){return e.setTimeout(n,1)}},tn=function(){return Date.now()};function rn(n){var e=P();if(!e||!n)return"";e=e.createElement("a");return e.href=n,e.href}function on(n){var e=P();if(!e||!n)return{url:n,protocol:"",domain:"",query:"",path:"",hash:""};e=e.createElement("a");e.href=n;n=e.pathname||"/";return"/"!==n[0]&&(n="/"+n),{url:e.href,protocol:e.protocol.slice(0,-1),domain:e.hostname,query:e.search.substring(1),path:n,hash:e.hash}}function un(){var n=H()&&U();return null==n?void 0:n.href}var an=function(n){var e={url:un(),timestamp:tn()},t=n.config();return null!=t&&t.pid&&(e.pid=t.pid),null!=n&&n.context&&(e.context=n.context.toString()),e},cn=function(t,r){return function(n){function e(n){return n.overrides=r,n}t.on("report",e),n(),t.off("report",e)}},fn="<unknown>";function sn(n){try{for(var e,t=n,r=[],o=0,i=0,u=" > ".length;t&&o++<5&&!("html"===(e=function(n){var e,t,r,o,i=n,u=[];if(!i||!i.tagName)return"";u.push(i.tagName.toLowerCase()),i.id&&u.push("#"+i.id);n=i.className;if(n&&h(n))for(e=n.split(/\s+/),o=0;o<e.length;o++)u.push("."+e[o]);var a=["type","name","title","alt"];for(o=0;o<a.length;o++)t=a[o],(r=i.getAttribute(t))&&u.push("["+t+'="'+r+'"]');return u.join("")}(t))||1<o&&80<=i+r.length*u+e.length);)r.push(e),i+=e.length,t=t.parentNode;return r.reverse().join(" > ")}catch(n){return fn}}function ln(o){function i(e,t){var r;return function(n){u=void 0,n&&r!==n&&t({event:r=n,name:e})}}var u;return[i,function(r){return function(n){var e;try{e=n.target}catch(n){return}var t=e&&e.tagName;t&&("INPUT"===t||"TEXTAREA"===t||e.isContentEditable)&&(u||i("input",r)(n),clearTimeout(u),u=window.setTimeout(function(){u=void 0},o))}}]}function dn(e,t){return function(n){if(t)try{e(n)}catch(n){}}}function pn(n){var e=H(),t=P();e&&t&&("complete"!==t.readyState?e.addEventListener("load",function(){setTimeout(function(){n()},0)},!1):n())}function vn(n,e){return E(n)?v(v({},e),n):!!n&&e}function hn(n,e){return!(!n||!e)&&(yn.test(n)||bn.test(e))}var mn=function(e){var t=!1;return[function(n){t||(t=!0,e&&e(n))}]},gn=function(n){var e=D(mn(n),1)[0];["unload","beforeunload","pagehide"].forEach(function(n){addEventListener(n,e)})},yn=new RegExp("(cookie|auth|jwt|token|key|ticket|secret|credential|session|password)","i"),bn=new RegExp("(bearer|session)","i");function wn(n,e,t){var r=n._method,o=n._reqHeaders,i=n._url,u=n._start,a=n._data,i={api:"xhr",request:{url:i=rn(i),method:(r||"").toLowerCase(),headers:o,timestamp:u},response:{status:n.status||0,is_custom_error:!1,timing:t(i),timestamp:Date.now()},duration:Date.now()-u};"function"==typeof n.getAllResponseHeaders&&(i.response.headers=h(c=n.getAllResponseHeaders())&&c?c.split("\r\n").reduce(function(n,e){var t;return h(e)&&(e=(t=D(e.split(": "),2))[0],t=t[1],hn(e,t)||(n[e.toLowerCase()]=t)),n},{}):{});var u=i.response.status,c=e.collectBodyOnError,e=e.extraExtractor;try{var f=null==e?void 0:e(n.response,i);f&&(i.extra=f),f&&(i.response.is_custom_error=!0),c&&400<=u&&(i.request.body=a?""+a:void 0,i.response.body=n.response?""+n.response:void 0)}catch(n){}return i}function En(n,e){return!!(n=m(n||[]))&&n.test(e)}function _n(n){var e=D(Q(n),5)[4];return function(n){return e(n).pop()}}function Sn(o){return function(){for(var n=[],e=0;e<arguments.length;e++)n[e]=arguments[e];this._reqHeaders=this._reqHeaders||{};var t=D(n,2),r=t[0],t=t[1];return hn(r,t)||(this._reqHeaders[r.toLowerCase()]=t),o&&o.apply(this,n)}}function xn(r,o,a,c){return function(){for(var i,u,t=this,n=[],e=0;e<arguments.length;e++)n[e]=arguments[e];return u=c,s(i=this,"onreadystatechange",function(t,r,o){return function(){for(var n=[],e=0;e<arguments.length;e++)n[e]=arguments[e];try{4===this.readyState&&!En(r.ignoreUrls,i._url)&&o&&o({ev_type:"http",payload:wn(i,r,u)})}catch(n){$(n)}return t&&t.apply(this,n)}})(o,o.hookCbAtReq(a)),o.setTraceHeader&&o.setTraceHeader(this._url,function(n,e){return t.setRequestHeader(n,e)}),this._start=Date.now(),this._data=null==n?void 0:n[0],r.apply(this,n)}}function Tn(r){return function(){for(var n,e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];return n=D(e,2),this._method=n[0],this._url=n[1],r.apply(this,e)}}function Ln(n,e,t,r){s(n,"open",Tn)(),s(n,"setRequestHeader",Sn)(),s(n,"send",xn)(e,t,r)}function Rn(){var n=window.crypto||window.msCrypto;if(void 0!==n&&n.getRandomValues){var e=new Uint16Array(8);n.getRandomValues(e);n=function(n){for(var e=n.toString(16);e.length<4;)e="0"+e;return e};return n(e[0])+n(e[1])+n(e[2])+n(e[3])+n(e[4])+n(e[5])+n(e[6])+n(e[7])}return"xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx".replace(/[x]/g,function(){return(16*Math.random()|0).toString(16)})}var Cn=function(n,e){if(void 0===n&&(n=G()&&H()),void 0===e&&(e=W()),n){var s=_n(e);return function(c,f){var n;!c.autoWrap||(n=XMLHttpRequest&&XMLHttpRequest.prototype)&&Ln(n,c,f,s);return[function(n,e,t){return i=e=void 0===e?c:e,u=t=void 0===t?f:t,a=s,r.prototype=new(o=n),["DONE","HEADERS_RECIEVED","LOADING","OPENED","UNSENT"].forEach(function(n){r[n]=o[n]}),r;function r(){var n=new o;return Ln(n,i,u,a),n}var o,i,u,a}]}}},jn={sampleRate:1,origins:[]},kn=function(n,r){var o=vn(n,jn);if(o&&j(o.sampleRate))return function(n,e){var t=o.origins;t.length&&Boolean(n.match(new RegExp(t.join("|"))))&&(e("x-rum-traceparent","00-"+Rn()+"-"+Rn().substring(16)+"-01"),e("x-rum-tracestate",r))}};function Dn(n,e,t){e=null===(n=n.config())||void 0===n?void 0:n.plugins[e];return vn(e,t)}var On=function(e,t){var n=e.config(),r={url:un(),pid:n.pid,view_id:n.viewId};return function(n){e.report(v(v({},n),{overrides:v(v({},r),t&&t(n)||{})}))}},qn="ajax",In={autoWrap:!0,hookCbAtReq:g,ignoreUrls:[],collectBodyOnError:!1},Nn=function(r){return function(e){if(!e)return e;var n=r.config(),t={url:un(),pid:n.pid,view_id:n.viewId};return function(n){e(v(v({},n),{overrides:v(v({},t),{timestamp:n.payload.request.timestamp})}))}}};var An=function(f){if(f=void 0===f?P():f)return function(n,e){var t,r=n.maxBreadcrumbs,o=n.onAddBreadcrumb,i=n.onMaxBreadcrumbs,u=n.dom,a=D(ln(100),2),n=a[0],a=a[1],r=D(function(e,t,r){void 0===e&&(e=20),void 0===t&&(t=g),void 0===r&&(r=function(n,e){return n.slice(-e)});var o=[];return[function(){return o},function(n){t(n)&&(n=v(v({},n),{timestamp:n.timestamp||tn()}),o=0<=e&&o.length+1>e?r(y(y([],D(o),!1),[n],!1),e):y(y([],D(o),!1),[n],!1))}]}(r,o,i),2),o=r[0],i=r[1],r=(t=i,function(n){var e;try{e=n.event.target?sn(n.event.target):sn(n.event)}catch(n){e="<unknown>"}0!==e.length&&t({type:"dom",category:"ui."+n.name,message:e})}),c=[];u&&(c.push(n("click",dn(r,"dom"))),c.push(a(dn(r,"dom"))),f.addEventListener("click",c[0]),f.addEventListener("keypress",c[1]));return[o,i,function(){f.removeEventListener("click",c[0]),f.removeEventListener("keypress",c[1])}]}},Mn="breadcrumb",Bn={maxBreadcrumbs:20,dom:!0};function Hn(n,e){return n instanceof e}function Pn(e){for(var n=[],t=1;t<arguments.length;t++)n[t-1]=arguments[t];return n.reduce(function(t,n){return new e(n).forEach(function(n,e){return!hn(e,n)&&(t[e]=n)}),t},{})}function Un(n,e,t){return Hn(n,t)?n.body:null==e?void 0:e.body}function Wn(n,e,t,r){return{method:function(n,e,t){e=e&&e.method||"get";return(e=Hn(n,t)?n.method||e:e).toLowerCase()}(e,t,r),timestamp:tn(),url:rn(n)}}function Gn(c,f,s,l,d,p){return function(i,u){void 0===u&&(u={});var n,e,t=(e=!1,t="",t=Hn(n=i,d)?n.url:n,t=!(e=void 0!==e&&e)&&h(t)?t.split("?")[0]:t);if(!function(n){if(h(n)){var e=D(n.split(":"),2),n=e[0];return!e[1]||"http"===n||"https"===n}}(t)||En(f.ignoreUrls,t))return c(i,u);var r=f.hookCbAtReq(s),o={api:"fetch",request:Wn(i instanceof d?i.url:i,i,u,d),response:{is_custom_error:!1},duration:0};f.setTraceHeader&&f.setTraceHeader(o.request.url,function(n,e){var t,r,o;t=n,r=e,o=u,n=l,Hn(e=i,d)?e.headers.set(t,r):o.headers instanceof n?o.headers.set(t,r):o.headers=v(v({},o.headers),((o={})[t]=r,o))});var t=c(i,u);try{o.request.headers=Pn(l,i.headers,u.headers)}catch(n){$(n)}var a=function(){r&&r({ev_type:"http",payload:o})};return t.then(function(n){var e;try{o.response.status=n.status||0,o.response.headers=Pn(l,n.headers),o.response.timestamp=tn(),o.duration=o.response.timestamp-o.request.timestamp;var t=f.collectBodyOnError,r=f.extraExtractor;try{r&&n.clone().json().then(function(n){n=r(n,o);n&&(o.extra=n,o.response.is_custom_error=!0)}).catch(w)}catch(n){}t&&400<=n.status&&(o.request.body=null===(e=Un(i,u,d))||void 0===e?void 0:e.toString());setTimeout(function(){o.response.timing=p(n.url),a()},100)}catch(n){$(n)}},function(){var n;try{o.response.status=0,o.response.timestamp=tn(),o.duration=o.response.timestamp-o.request.timestamp,f.collectBodyOnError&&(o.request.body=null===(n=Un(i,u,d))||void 0===n?void 0:n.toString())}catch(n){$(n)}a()}),t}}var Fn=function(n,i,u,e){if(void 0===n&&(n=F()&&H()),void 0===i&&(i=window.Headers),void 0===u&&(u=window.Request),void 0===e&&(e=W()),n&&i&&u){var a=_n(e);return function(r,o){r.autoWrap&&s(n,"fetch",Gn)(r,o,i,u,a);return[function(n,e,t){return Gn(n,e=void 0===e?r:e,t=void 0===t?o:t,i,u,a)}]}}},zn="fetch",Xn={autoWrap:!0,hookCbAtReq:g,ignoreUrls:[],collectBodyOnError:!1};function Yn(n){var e,t,r;return!function(n){switch(Object.prototype.toString.call(n)){case"[object Error]":case"[object Exception]":case"[object DOMError]":case"[object DOMException]":return 1;default:return n instanceof Error}}(n)?(i(n)||o(n)||h(n))&&(e={message:f(n)}):(r=ne,e=(t=n)&&E(t)?r.reduce(function(n,e){return n[e]=t[e],n},{}):t),e}function Jn(n){return Yn(n.error)}function Vn(n){var e;try{var t=void 0;if("reason"in n?t=n.reason:"detail"in n&&"reason"in n.detail&&(t=n.detail.reason),t){var r=Yn(t);return v(v({},r),{name:null!==(e=r&&r.name)&&void 0!==e?e:"UnhandledRejection"})}}catch(n){}}function $n(n){return"[object ErrorEvent]"===Object.prototype.toString.call(n)?Jn(n):("[object PromiseRejectionEvent]"===Object.prototype.toString.call(n)?Vn:Yn)(n)}function Kn(o,e,n){function u(n,t){if(!_(n))return n;var r={type:"capture-global",data:v({},t)},e=n._w_||(n._w_=function(){try{return(n.handleEvent&&_(n.handleEvent)?n.handleEvent:n).apply(this,[].map.call(arguments,function(n){return u(n,t)}))}catch(n){var e=Yn(n);throw e&&o({error:e,source:r}),n}});return e._hook_=!0,e}void 0===e&&(e=H()),void 0===n&&(n=G());var a=[];return e&&a.push.apply(a,y([],D(te.filter(function(n){return e[n]}).map(function(o){return L(e,o,function(r){return function(n){for(var e=[],t=1;t<arguments.length;t++)e[t-1]=arguments[t];return r&&r.call.apply(r,y([this,u(n,{function:o})],D(e),!1))}},!1)()})),!1)),n&&n.prototype&&a.push(L(n.prototype,"send",function(r){return function(){for(var t=this,n=[],e=0;e<arguments.length;e++)n[e]=arguments[e];return a.push.apply(a,y([],D(re.filter(function(n){return t[n]&&!t[n]._hook_}).map(function(e){var n=L(t,e,function(n){return u(n,{function:e})},!1)();return function(){n(),t[e]._hook_=void 0}})),!1)),r.apply(this,n)}},!1)()),ee.forEach(function(i){var n=e[i]&&e[i].prototype;n&&n[oe]&&(a.push(L(n,oe,function(o){return function(n,e,t){try{var r=e.handleEvent;_(r)&&(e.handleEvent=u(r,{function:"handleEvent",target:i}))}catch(n){}return o&&o.call(this,n,u(e,{function:oe,target:i}),t)}},!1)()),a.push(L(n,"removeEventListener",function(r){return function(n,e,t){return null!=e&&e._w_&&r.call(this,n,e._w_,t),r.call(this,n,e,t)}},!1)()))}),a}function Qn(n,e){return n&&e&&n===e}function Zn(){var r;return function(n){try{if(t=r,!(!(e=n)||!t)&&!(!Qn(e.message,t.message)||!Qn(e.stack,t.stack)))return void(r=n)}catch(n){$(n)}var e,t;return r=n}}var ne=["name","message","stack","filename","lineno","colno"],ee=["EventTarget","Window","Node","ApplicationCache","ChannelMergerNode","EventSource","FileReader","HTMLUnknownElement","IDBDatabase","IDBRequest","IDBTransaction","MessagePort","Notification","SVGElementInstance","Screen","TextTrack","TextTrackCue","TextTrackList","WebSocket","Worker","XMLHttpRequest","XMLHttpRequestEventTarget","XMLHttpRequestUpload"],te=["setTimeout","setInterval","requestAnimationFrame","requestIdleCallback"],re=["onload","onerror","onprogress","onreadystatechange"],oe="addEventListener",ie=function(d){if(d=void 0===d?H():d)return function(n,o){var e,t,r=n.ignoreErrors,i=n.onerror,u=n.onunhandledrejection,a=n.dedupe,n=n.captureGlobalAsync,c=m(r),f=[],s=Zn(),l=function(n){var e=n.error,t=n.extra,r=n.react,n=n.source,e=a?s(e):e;o&&e&&(c&&c.test(e.message)||o({ev_type:"js_error",payload:{error:e,breadcrumbs:[],extra:t,react:r,source:n}}))};i&&(d.addEventListener("error",e=function(n){return l({error:Jn(n),source:{type:"onerror"}})}),f.push(function(){return d.removeEventListener("error",e)})),u&&(d.addEventListener("unhandledrejection",t=function(n){return l({error:Vn(n),source:{type:"onunhandledrejection"}})}),f.push(function(){return d.removeEventListener("unhandledrejection",t)})),n&&f.push.apply(f,y([],D(Kn(l)),!1));return[function(n,e,t){return l({error:$n(n),extra:e,react:t,source:{type:"manual"}})},function(){f.forEach(function(n){return n()})}]}},ue="jsError",ae={ignoreErrors:[],onerror:!0,onunhandledrejection:!0,captureGlobalAsync:!1,dedupe:!0};var ce=["hash_0",function(n,e){var t,r=H();r&&(r.addEventListener("hashchange",t=function(){return n(location.href)},!0),e(function(){return r.removeEventListener("hashchange",t,!0)}))}],fe=["history_0",function(n,e){var t,r,o,i=H()&&window.history;i&&(r=function(){return n(location.href)},(t=[]).push(L(i,"pushState",o=function(t){return function(){for(var n=[],e=0;e<arguments.length;e++)n[e]=arguments[e];try{t.apply(i,n)}finally{r()}}})(),L(i,"replaceState",o)()),window.addEventListener("popstate",r,!0),t.push(function(){return window.removeEventListener("popstate",r,!0)}),e(function(){t.forEach(function(n){return n()})}))}],se=function(n,g){if(void 0===n&&(n=H()),void 0===g&&(g=U()),n&&g)return function(n,t){var r,e,o,i,u,a,c=n.sendInit,f=n.initPid,s=n.routeMode,l=n.extractPid,d=n.onPidUpdate,n=n.createObserver,p=[],v="manual"===s?function(){return""}:(r=s,function(n){var e;return"hash"===r?(null===(e=on(n).hash)||void 0===e?void 0:e.replace(/^#/,""))||"/":on(n).path}),h=l||function(){},f=D(function(r,n,e,o){var i=e,u=n;o&&o(n);return[function(n,e,t){"user_set"!==n&&e!==i?(i=e,u=null!=t?t:i,o&&o(u),r(n,u)):"user_set"===n&&e!==u&&(u=e,o&&o(u),r(n,u))},function(){n&&r("init",n)}]}(function(n,e){t&&t({ev_type:"pageview",payload:{pid:e,source:n}})},f||(e=g.href,null!==(o=h(e))&&void 0!==o?o:v(e)),v(g.href),d),2),m=f[0],d=f[1],f=m.bind(null,"user_set");"manual"!==s&&(i=D((u=function(n,e){return m(n,v(e),h(e))},a="",[function(n,e){e!==a&&u(n,a=e)}]),1)[0],n=D(n(s),1)[0],p.push(n(function(n){return i(s,n)})));return c&&d(),[f,function(){p.forEach(function(n){return n()})}]}},le="pageview",de={sendInit:!0,routeMode:"history"};var pe="resource",ve=["xmlhttprequest","fetch","beacon"],he=function(f,s,l){if(void 0===f&&(f=W()),void 0===s&&(s=X()),void 0===l&&(l=Y()),f)return function(n,t){var e=n.ignoreUrls,r=n.slowSessionThreshold,o=n.ignoreTypes,i=m(e),u=[],a=function(n,e){void 0===e&&(e=!1),n=n.filter(function(n){return!(S(null!=o?o:ve,n.initiatorType)||null!=i&&i.test(n.name))}),t&&n.length&&n.forEach(function(n){t([{ev_type:"resource",payload:n},e])})},c=D(Q(f),3)[2];pn(function(){var n,e;a(c(pe),function(){if(!l)return!1;var n=l.loadEventEnd-l.navigationStart;return r<n}()),n=D(Z(s,function(n,e,t){return 0===e&&a(t)}),2),e=n[0],n=n[1],e(pe),u.push(n)});return[function(){u.forEach(function(n){return n()})}]}},me="resource",ge={ignoreUrls:[],slowSessionThreshold:4e3};function ye(n){return n="link"===(e=n).tagName.toLowerCase()?"href":"src",_(e.getAttribute)?e.getAttribute(n)||"":e[n]||"";var e}var be=function(l,d,p){if(void 0===l&&(l=H()),void 0===d&&(d=W()),void 0===p&&(p=null===location||void 0===location?void 0:location.href),l)return function(n,i){var e=n.ignoreUrls,t=n.includeUrls,u=n.dedupe,a=m(t),c=m(e),f=D(Q(d),5)[4],s=void 0,r=function(n){var e,t,r,o;p&&n.url===p||a&&!a.test(n.url)||c&&c.test(n.url)||(n.url||n.xpath&&n.xpath!==fn)&&(u&&n.url===s||(s=n.url,t=f,r=(e=n).url,o=n.tagName,e=n.xpath,r=rn(r),t=t(r)[0],t={type:o.toLowerCase(),url:r,xpath:e,timing:t},i&&i({ev_type:"resource_error",payload:t})))},o=function(n){n=n||l.event;!n||(n=function(n){var e=n.target||n.srcElement;if(e){var t=e.tagName;if(t&&h(t)){n=ye(e);return{url:n,tagName:t,xpath:n?void 0:sn(e)}}}}(n))&&r(n)};l.addEventListener("error",o,!0);return[r,function(){l.removeEventListener("error",o,!0)}]}},we="resourceError",Ee={includeUrls:[],ignoreUrls:[],dedupe:!0};function _e(n){return{ev_type:"performance",payload:n}}function Se(l,d){return void 0===l&&(l=X()),void 0===d&&(d=W()),function(n,e){var t=n.metricName,r=n.entryName,o=Oe(t,0),i=D(mn(e),1)[0];if(!d||!l)return o.isSupport=!1,void i(o);var u,a,c,f,s=function(n){n=n.startTime;o.value=n,i(o)},t=(0,D(Q(d),5)[4])(r)[0];t?s(t):(t=(e=D(Z(l,function(n){n.name===r&&(s(n),u())}),2))[0],u=e[1],t("paint"),a=function(){o.isSupport=!1,i(o),u()},void 0===c&&(c=!0),"hidden"!==document.visibilityState?(f=function(){"hidden"===document.visibilityState&&(a(),c&&removeEventListener("visibilitychange",f,!0))},addEventListener("visibilitychange",f,!0)):a(),gn(function(){o.isBounced=!0,i(o),u()}))}}function xe(e){function t(n){n<o||!r||(u(),i=window.setTimeout(r,n-e()),o=n)}var r,o=-1/0,i=void 0,u=function(){return window.clearTimeout(i)};return[function(n,e){r=n,t(e)},function(){u(),r=void 0},t]}function Te(n,t){var r=["img","script","iframe","link","audio","video","source"],e=(n=D(K(n,function(n){for(var e=0;e<n.length;e++)("childList"===n[e].type&&function n(e,t){for(var r=0;r<e.length;r++)if(S(t,e[r].nodeName.toLowerCase())||e[r].children&&n(e[r].children,t))return 1}(n[e].addedNodes,r)||"attributes"===n[e].type&&S(r,n[e].target.nodeName.toLowerCase()))&&t(n[e])}),2))[0];return[function(){return e(document,{attributes:!0,childList:!0,subtree:!0,attributeFilter:["href","src"]})},n[1]]}function Le(n){var n=(e=n||{}).domContentLoadedEventEnd,e=e.navigationStart;return n?n-(void 0===e?0:e):null}function Re(t){return function(){for(var n=[],e=0;e<arguments.length;e++)n[e]=arguments[e];return this._method=n[0],t.apply(this,n)}}function Ce(r,o,i){var u=0;return function(){for(var n=[],e=0;e<arguments.length;e++)n[e]=arguments[e];if("GET"!==this._method)return r.apply(this,n);var t=u+=2;return o(t,tn()),L(this,"onreadystatechange",function(e){return function(n){e&&e.call(this,n),4===this.readyState&&i(t)}})(),r.apply(this,n)}}function je(i,u,a){var c=1;return function(){for(var n,o=[],e=0;e<arguments.length;e++)o[e]=arguments[e];return"GET"!==((null===(n=o[0])||void 0===n?void 0:n.method)||(null===(n=o[1])||void 0===n?void 0:n.method)||"GET")?i.apply(void 0,y([],D(o),!1)):new Promise(function(e,t){var r=c+=2;u(r,tn()),i.apply(void 0,y([],D(o),!1)).then(function(n){a(r),e(n)},function(n){a(r,n),t(n)})})}}function ke(_,S,x,T){return function(n,t,e){var c,f,r,o,i,u,a,s,l=D([c=[],f=[],function(u,a){return function(n){var e=n.startTime,t=n.duration,r=n.fetchStart,o=n.responseEnd,i=n.entryType;"longtask"===i?(n.start=e,n.end=e+t,c.push(n),u&&u(n)):"resource"===i&&(f.push({start:r,end:o}),a&&a(n))}}],3),d=l[0],p=l[1],v=l[2],h=D((r=_,o=S,h=D([i={},function(n,e){return i[n]=e},function(n){return delete i[n]}],3),y=h[0],l=h[1],h=h[2],u=o&&L(o.prototype,"open",Re)(),a=o&&L(o.prototype,"send",Ce)(l,h),s=r&&L(r,"fetch",je)(l,h),[y,function(){u&&u(!0),a&&a(!0),s&&s(!0)}]),2),m=h[0],g=h[1],y=D(T&&Te(T,function(){return t(e()+5e3)})||[],2),h=y[0],b=y[1];h&&h();function w(){return function(n,e,t){if(2<n.length)return t();for(var r=[],o=0;o<e.length;o++)r.push([e[o].start,0],[e[o].end,1]);for(o=0;o<n.length;o++)r.push([n[o],0]);r.sort(function(n,e){return n[0]-e[0]});for(var i=n.length,o=r.length-1;0<=o;o--){var u=D(r[o],2),a=u[0];switch(u[1]){case 0:i--;break;case 1:if(2<++i)return a}}return 0}(function(n){for(var e=Object.keys(n),t=[],r=0;r<e.length;r++){var o=n[e[r]];"number"==typeof o&&t.push(o)}return t}(m),p,e)}var y=D(Z(x,v(function(n){var e=n.startTime,n=n.duration;return t(e+n+5e3)},function(){return t(w()+5e3)}),!1,function(){return d.notSupport=!0}),2),h=y[0],E=y[1];return h("longtask","resource"),n.forEach(v()),[d,function(){g(),E(),b&&b()},w]}}var De={isSupport:!0,isPolyfill:!1,isBounced:!1,isCustom:!1,type:"perf"},Oe=function(n,e){return v({name:n,value:e},De)},qe="performance",Ie={entries:[],observer:void 0},Ne=function(_,S,x,T,L){return void 0===_&&(_=G()),void 0===S&&(S=F()&&H()),void 0===x&&(x=X()),void 0===T&&(T=z()),void 0===L&&(L=W()),function(n,e,t,r){var o=Oe("tti",0),i=D(mn(function(n){n=_e(n);e&&e(n)}),1)[0];if(!(_&&S&&x&&L))return o.isSupport=!1,i(o),[function(){return 0}];var u=n.precollect,a=n.isAsync,a=void 0===a?0:a,n=n.minValue,c=void 0===n?null:n,n=u||{},u=n.entries,f=void 0===u?[]:u,s=n.observer,u=D(Q(L),5),l=u[0],d=u[1],p=u[4],n=D(xe(d),3),u=n[0],v=n[1],h=n[2],a=D(ke(S,_,x,T)(a?[]:f,h,d),3),m=a[0],g=a[1],y=a[2],b=function(){v(),g(),t&&t(),s&&s.disconnect(),f.length=0},w=function(n){var e=p("first-contentful-paint")[0],e=function(n,e,t,r,o){if(r-t<5e3)return null;o=0===o.length?n:o[o.length-1].end;return r-o<5e3?null:Math.max(o,e)}((e?e.startTime:Le(l))||0,c||Le(l)||0,y(),d()+(n?0:5e3),m);return n?e?(b(),void n(e)):h(d()+1e3):(b(),e)};if(r&&r(m,h,o),m.notSupport)return o.isSupport=!1,i(o),[function(){return 0}];function E(n){o.value=n,i(o)}r=m[m.length-1];u(function(){return w(E)},Math.max(y()+5e3,r?r.end:0));return[function(){return w()||0}]}},Ae="tti";function Me(n,t,e,r){if(!n||-1<r.indexOf(n.tagName))return 0;var o=n.children;if((o=[].slice.call(void 0===o?[]:o).reduceRight(function(n,e){return n+Me(e,t+1,0<n,r)},0))<=0&&!e){if(!_(n.getBoundingClientRect))return 0;e=n.getBoundingClientRect()||{},n=e.top,e=e.height;if(n>window.innerHeight||e<=0)return 0}return o+1+.5*t}var Be=["SCRIPT","STYLE","META","HEAD"],He=function(h,m,g,y,b){var n;return void 0===h&&(h=P()),void 0===m&&(m=z()),void 0===g&&(g=null===(n=Y())||void 0===n?void 0:n.navigationStart),void 0===y&&(y=function(){if(H()&&"requestAnimationFrame"in window)return window.requestAnimationFrame}()),void 0===b&&(b=function(){if(H()&&"cancelAnimationFrame"in window)return window.cancelAnimationFrame}()),function(n,e){var t=n.renderType,r=Oe("fmp",0),o=function(n){n=_e(n);e&&e(n)};if("SSR"===t)return nn(Se,{metricName:"fmp",entryName:"first-contentful-paint"},o),[w];var i=D(mn(o),1)[0];if(!h||!m||!g)return r.isSupport=!1,i(r),[w];function u(){return d.push({time:tn()-l,score:Me(h&&h.body,1,!1,Be)})}var a,c,f,s,l=tn(),d=[],p=D((a=h,n=b,t=!0,f=!_(o=y)||t&&a&&a.hidden?function(n){return n(0),0}:o,s=_(n)?n:w,[function(n){c&&s(c),c=f(n)},f,s]),1)[0],o=D(K(m,function(){return p(u)}),2),n=o[0],v=o[1],o=l-(g||0);return n(h,{subtree:!0,childList:!0}),[function(n){void 0===n&&(n=0),v();var e,t,e=(e=(t=D(void 0===(e=d)?[]:e))[0],(t=t.slice(1))&&t.reduce(function(n,e){var t=D(n,2),r=t[0],n=t[1],t=e.score-r.score;return[e,e.time>=r.time&&n.rate<t?{time:e.time,rate:t}:n]},[e,{time:null==e?void 0:e.time,rate:0}])[1].time||0);r.value=e?e+n:0,i(r)}.bind(null,o)]}},Pe="fmp",Ue={renderType:"CSR"};function We(L,R,C,j,k){if(void 0===L&&(L=H()),void 0===R&&(R=P()),void 0===C&&(C=X()),void 0===j&&(j=z()),void 0===k&&(k=W()),R&&L)return function(n,e){var t,r,o,i,u,a,c=n.threshold,f=n.screenshot,s=n.rootSelector,l=n.autoDetect,d=n.ssUrl,p=en(L),v=D(Q(k),2)[1],h=0,m=!1,g=function(n){t&&e&&e({ev_type:"blank_screen",payload:{timestamp:t[0],score:t[1],screenshot:n,error:r}})},y=(i=function(){t&&!m&&(m=!0,E(),f?Ze(g,d,L,R):g())},function(){u||(a=tn(),u=L.setTimeout(function(){u=0,a<h||i()},v()>ze?Ye:Xe))});gn(function(){!m&&r&&g()});function b(){o&&clearTimeout(o),o=L.setTimeout(function(){p(function(){L.requestAnimationFrame(function(){var n=s?R.querySelector(s):R.body;n&&((n=Qe(n,0,0,c))<c?(t=[tn(),n],y()):t=void 0)})})},1e3)}var w,E=function(){clearTimeout(o),S&&S(),T&&T()},n=D(K(j,b),2),_=n[0],S=n[1],n=D(Z(C,function(n,e,t){return o&&1<t.length&&b()}),2),x=n[0],T=n[1];return l&&(w=function(){var n;_(null===(n=P())||void 0===n?void 0:n.body,{subtree:!0,childList:!0}),x("longtask","resource"),b()},n=H(),l=P(),n&&l&&("loading"!==l.readyState?w():n.addEventListener("DOMContentLoaded",function(){setTimeout(function(){w()},0)},!1))),[E,function(n){m||$e(n)||(h=tn(),r&&h-r.timestamp>Je&&(r=void 0),r=Ke(r,n))},b]}}var Ge=["SCRIPT","STYLE","META","HEAD"],Fe=["js_error","http","resource_error"],ze=1e4,Xe=8e3,Ye=2e3,Je=1e4,Ve=["performance","performance_longtask","performance_timing","custom"],$e=function(n){return~Ve.indexOf(n.ev_type)},Ke=function(n,e){if(-1===Fe.indexOf(e.ev_type))return n;if("http"===e.ev_type&&e.payload.response.status<400)return n;if(n&&Fe.indexOf(n.type)<Fe.indexOf(e.ev_type))return n;var t="";switch(e.ev_type){case"js_error":t=e.payload.error.message;break;case"http":t=e.payload.request.url;break;case"resource_error":t=e.payload.url}return{type:e.ev_type,message:t,timestamp:tn()}},Qe=function(t,r,n,o,i){if(void 0===r&&(r=0),void 0===n&&(n=0),void 0===o&&(o=1.5),void 0===i&&(i=Ge),!t||-1<i.indexOf(t.tagName)||o<=n||4<r)return n;var e=function(){if(!r)return 0;var n=t.getBoundingClientRect(),e=n.top,n=n.height;return e>innerHeight||n<=0?0:1/Math.pow(2,r-1)}();return[].reduceRight.call(t.children,function(n,e){return Qe(e,r+1,n,o,i)},n+e)},Ze=function(e,n,t,r){if(H()&&"Promise"in window&&Promise&&t&&r){if(t.html2canvas)return i();var o=r.createElement("script");o.src=n,null!==(n=r.head)&&void 0!==n&&n.appendChild(o),o.onload=i}function i(){en(t)(function(){t.html2canvas&&t.html2canvas(r.body,{scale:360/t.innerWidth}).then(function(n){e(n.toDataURL("image/jpeg",.1))})})}},nt="blankScreen";var et={autoDetect:!0,threshold:1.5,screenshot:!0,ssUrl:"https://apm.volccdn.com/mars-web/apmplus/web/html2canvas.min.js"};function n(n,e){var o,i,u;i=et,u=e,(o=n).on("init",function(){var n,e,t,r=Dn(o,nt,i)||vn(u,i);r&&(r=D(nn(We,r,o.report.bind(o)),3),n=r[0],e=r[1],r=r[2],o.on("report",t=function(n){return e(n),n}),o.on("beforeDestroy",function(){n(),o.off("report",t)}),o.provide("detectBlankScreen",r))})}function tt(n){return{pid:n.pid,view_id:n.viewId,url:un()}}function rt(n,e,t){return n=D(st(n,e),3),e=n[1],n=n[2],e(t),n}function ot(e,n,t,r,o){var i=(a=D(o,2))[0],u=a[1],o=X(),a=W(),c=Oe(n,0),f=pt(vt,t,r);if(!a||!o)return c.isSupport=!1,void f(c);function s(n){n=n.startTime,c.value=n,f(c)}(a=(0,D(Q(a),5)[4])(e)[0])?s(a):(r.push(lt(o,function(n){n.name===e&&s(n)},[gt])),r.push(i[0](function(){c.isSupport=!1,f(c)})),r.push(u[0](function(){c.isBounced=!0,f(c)})))}var it=function(o){return function(t,n){function e(n){var e;n.viewId&&n.viewId!==(null===(e=o.config())||void 0===e?void 0:e.viewId)&&(t(r),r=tt(n))}var r=tt(o.config());o.on("beforeConfig",e),n(function(){o.off("beforeConfig",e)})}},ut=["hidden_0",function(n,e){var t,r,o=H(),i=P();o&&i&&(t=function(){"hidden"===i.visibilityState&&n()},addEventListener("visibilitychange",t,!0),r=en(o),e(function(){removeEventListener("visibilitychange",t,!0)},function(n){r(function(){"hidden"===i.visibilityState&&n()})}))}],at=["load_0",function(n,e){var t,r,o=H(),i=P();o&&i&&(o.addEventListener("load",t=function(){setTimeout(function(){n()},0)},!1),r=en(o),e(function(){o.removeEventListener("load",t,!1)},function(n){r(function(){"complete"===i.readyState&&n()})}))}],ct=["unload_0",function(n,e){var t,r,o,i=H();i&&(t=D(mn(n),1)[0],o=function(){t()},(r=["unload","beforeunload","pagehide"]).forEach(function(n){i.addEventListener(n,o)}),e(function(){r.forEach(function(n){i.removeEventListener(n,o)})}))}],ft=["longtask"],st=function(e,o,t){var r=e&&new e(function(n,r){n.getEntries?n.getEntries().forEach(function(n,e,t){return o(n,e,t,r)}):t&&t()});return[function(n){if(!e||!r)return t&&t();try{r.observe({entryTypes:n})}catch(n){return t&&t()}},function(n){if(!e||!r)return t&&t();try{r.observe({type:n,buffered:!0})}catch(n){return t&&t()}r.observe({type:n,buffered:!1})},function(){return r&&r.disconnect()}]},lt=function(n,e,t){n=D(st(n,e),3),e=n[0],n=n[2];return e(t),n},dt=["longtask_0",function(n,e){var t=X();t&&e(lt(t,n,ft))}],pt=function(e,t,r){var o=!1;return function(n){r.length&&r.forEach(function(n){n()}),r.length=0,o||(o=!0,t&&t(e(n)))}},vt=function(n,e){return{ev_type:"performance",payload:n,overrides:e}},ht=function(e){var t=0,r=Oe("spa_load",0);return[function(){t=tn()},function(){var n;n=tn()-t,r.value=n,e&&e(vt(r)),t=0}]},mt="first-contentful-paint",gt="paint",yt=["fp",function(n,e,t){return ot("first-paint","fp",n,e,t)}],bt=["fcp",function(n,e,t){return ot(mt,"fcp",n,e,t)}],wt=["keydown","click"],Et=["lcp",function(n,e,t){var r=D(t,2),o=r[0],t=r[1],r=X(),i=Oe("lcp",0),u=pt(vt,n,e);if(!r)return i.isSupport=!1,void u(i);e.push(rt(r,function(n){n=n.startTime;i.value=n},"largest-contentful-paint"));function a(){u(i)}wt.forEach(function(n){window.addEventListener(n,a,!0),e.push(function(){window.removeEventListener(n,a,!0)})}),e.push(o[0](function(){i.isSupport=!1,u(i)})),e.push(t[0](function(){i.isBounced=!0,u(i)}))}],_t="first-input",St=["fid",function(n,e){var t=X(),r=W(),o=Oe("fid",0),i=pt(vt,n,e);if(!r||!t)return o.isSupport=!1,void i(o);n=function(n){var e=n.processingStart,n=n.startTime;o.value=e-n,i(o)},r=(0,D(Q(r),3)[2])(_t)[0];r?n(r):e.push(lt(t,n,[_t]))}],xt=["cls",function(n,e,t){var r,o=D(t,3),i=o[0],u=o[1],t=o[2],o=X(),a=Oe("cls",0),c=(r=n,function(n,e){r(vt(n,e))});if(!o)return a.isSupport=!1,void c(a);var f,s,n=D((f=0,s=[],[function(){f=0},function(n,e){var t,r;e.hadRecentInput||(t=s[0],r=s[s.length-1],f&&e.startTime-r<1e3&&e.startTime-t<5e3?(f+=e.value,s.push(e.startTime)):(f=e.value,s=[e.startTime]),n(f))}]),2),l=n[0],n=n[1].bind(null,function(n){n>a.value&&(a.value=n)});e.push(rt(o,n,"layout-shift")),e.push(i[0](l)),e.push(t[0](function(n){c(a,n),l(),a=Oe("cls",0)})),e.push(u[0](function(){c(a)}))}],Tt=["longtask",function(e,n,t){t=D(t,3)[2];n.push(t[0](function(n){e({ev_type:"performance_longtask",payload:{type:"perf",longtasks:[n]}})}))}],Lt=["timing",function(n,e,t){var r=D(t,2),t=r[0],r=r[1],o=W(),i=D(Q(o),3)[2],u=pt(function(n){return{ev_type:"performance_timing",payload:{isBounced:n,timing:o&&o.timing||void 0,navigation_timing:i("navigation")[0]}}},n,e);e.push(t[0](function(){u(!1)})),e.push(r[0](function(){u(!0)}))}],Rt=["mpfid",function(n,e,t){var r=D(t,3),o=r[0],t=r[2],r=X(),i=W(),u=Oe("mpfid",0),a=[],c=pt(vt,n,e);if(!r)return u.isSupport=!1,void c(u);e.push(t[0](function(n){a.push(n)}));function f(){var n=(0,D(Q(i),5)[4])(mt)[0],r=n&&n.startTime||0;u.value=a.reduce(function(n,e){var t=e.duration,e=e.startTime;return n<t&&r<e?t:n},0),a.length=0,c(u)}e.push(o[0](function(){setTimeout(f,200)}))}];var Ct="custom",jt=function(n){if(n&&E(n)&&n.name&&h(n.name)){var e={name:n.name,type:"event"};if("metrics"in n&&E(n.metrics)){var t=n.metrics,r={};for(o in t)c(t[o])&&(r[o]=t[o]);e.metrics=r}if("categories"in n&&E(n.categories)){var o,i=n.categories,u={};for(o in i)u[o]=f(i[o]);e.categories=u}return e}},kt=function(n){if(n&&E(n)&&n.content&&h(n.content)){var e={content:f(n.content),type:"log",level:"info"};if("level"in n&&(e.level=n.level),"extra"in n&&E(n.extra)){var t,r=n.extra,o={},i={};for(t in r)c(r[t])?o[t]=r[t]:i[t]=f(r[t]);e.metrics=o,e.categories=i}return e}};function Dt(n){return(null==n?void 0:n.effectiveType)||(null==n?void 0:n.type)||""}function Ot(n,e){var t=n.common||{};return t.sample_rate=e,n.common=t,n}function qt(n,e,t,r,o){return n?(i=o(r,e),function(){return i}):function(){return t(e)};var i}function It(n,e,t,r){if(void 0===(n=l(n,e,function(n,e){return n[e]})))return!1;var o,e="boolean"==typeof n?"bool":c(n)?"number":"string";return function(n,e,t){switch(t){case"eq":return S(e,n);case"neq":return!S(e,n);case"gt":return n>e[0];case"gte":return n>=e[0];case"lt":return n<e[0];case"lte":return n<=e[0];case"regex":return Boolean(n.match(new RegExp(e.join("|"))));case"not_regex":return!n.match(new RegExp(e.join("|")));default:return!1}}(n,(o=e,r.map(function(n){switch(o){case"number":return Number(n);case"boolean":return"1"===n;default:return String(n)}})),t)}function Nt(e,n){try{return"rule"===n.type?It(e,n.field,n.op,n.values):"and"===n.type?n.children.every(function(n){return Nt(e,n)}):n.children.some(function(n){return Nt(e,n)})}catch(n){return $(n),!1}}function At(){var t=H();return t&&t.navigator.sendBeacon?{get:function(){},post:function(n,e){t.navigator.sendBeacon(n,e)}}:{get:w,post:w}}function Mt(n,e,t){var r=e.url,o=e.data,i=e.success,u=void 0===i?w:i,a=void 0===(i=e.fail)?w:i,c=void 0===(i=e.getResponseText)?w:i,e=void 0!==(e=e.withCredentials)&&e;(t=new t).withCredentials=e,t.open(n,r,!0),t.setRequestHeader("Content-Type","application/json"),t.onload=function(){null!=c&&c(this.responseText);try{var n;this.responseText?(n=JSON.parse(this.responseText),u(n)):u({})}catch(n){a(n)}},t.onerror=function(){a(new Error("Network request failed"))},t.onabort=function(){a(new Error("Network request aborted"))},t.send(o)}var Bt=function(n){var e=J(),t=Dt(e);e&&(e.onchange=function(){t=Dt(e)}),n.on("report",function(n){return v(v({},n),{extra:v(v({},n.extra||{}),{network_type:t})})})},Ht=function(n,e,t,r){if(!e)return g;var o=e.sample_rate,i=e.include_users,u=e.sample_granularity,a=e.rules,e=e.r,e=void 0===e?Math.random():e;if(S(i,n))return function(n){return Ot(n,1)};var c,f,s,l,d,p,v,u="session"===u,h=qt(u,o,t,e,r),m=(c=a,f=u,s=o,l=t,d=e,p=r,v={},Object.keys(c).forEach(function(n){var e=c[n],t=e.enable,r=e.sample_rate,e=e.conditional_sample_rules;t?(v[n]={enable:t,sample_rate:r,effectiveSampleRate:r*s,hit:qt(f,r,l,d,p)},e&&(v[n].conditional_hit_rules=e.map(function(n){var e=n.sample_rate,n=n.filter;return{sample_rate:e,hit:qt(f,e,l,d,p),effectiveSampleRate:e*s,filter:n}}))):v[n]={enable:t,hit:function(){return!1},sample_rate:0,effectiveSampleRate:0}}),v);return function(n){if(!h())return!1;if(!(n.ev_type in m))return Ot(n,o);if(!m[n.ev_type].enable)return!1;if(null!==(e=n.common)&&void 0!==e&&e.sample_rate)return n;var e=m[n.ev_type],t=e.conditional_hit_rules;if(t)for(var r=0;r<t.length;r++)if(Nt(n,t[r].filter))return!!t[r].hit()&&Ot(n,t[r].effectiveSampleRate);return!!e.hit()&&Ot(n,e.effectiveSampleRate)}};function Pt(n){var e,t,r,o,i,u,a,c,f=(t=(e=n).transport,r=n.endpoint,o=n.size,i=void 0===o?10:o,u=void 0===(e=n.wait)?1e3:e,a=[],c=0,{getSize:function(){return i},getWait:function(){return u},setSize:function(n){i=n},setWait:function(n){u=n},getEndpoint:function(){return r},setEndpoint:function(n){r=n},send:function(n){a.push(n),a.length>=i&&s.call(this),clearTimeout(c),c=setTimeout(s.bind(this),u)},flush:function(){clearTimeout(c),s.call(this)},getBatchData:function(){return a.length?p(a):""},clear:function(){clearTimeout(c),a=[]}});function s(){a.length&&(t.post({url:r,data:this.getBatchData()}),a=[])}function l(n){d.post(f.getEndpoint(),p([n]))}var d=At();return gn(function(){var n=f.getBatchData();n&&(d.post(f.getEndpoint(),n),f.clear()),f.send=l}),f}var Ut={build:function(n){return{ev_type:n.ev_type,payload:n.payload,common:v(v({},n.extra||{}),n.overrides||{})}}};function Wt(n){var e,t=n.plugins||{};for(e in t)t[e]&&!E(t[e])&&(t[e]={});return v(v({},n),{plugins:t})}function Gt(n){return E(n)&&"aid"in n}function Ft(n){return v({},n)}function zt(){var n=H(),e=P();if(n&&e)return(null===(e=null===(e=null===(e=function(){if(!document)return null;if(document.currentScript)return document.currentScript;try{throw new Error}catch(n){var e=0,t=/at\s+(.*)\s+\((.*):(\d*):(\d*)\)/i.exec(n.stack),r=t&&t[2]||!1,o=t&&t[3]||0,i=document.location.href.replace(document.location.hash,""),u="",a=document.getElementsByTagName("script");for(r===i&&(t=document.documentElement.outerHTML,o=new RegExp("(?:[^\\n]+?\\n){0,"+(o-2)+"}[^<]*<script>([\\d\\D]*?)<\\/script>[\\d\\D]*","i"),u=t.replace(o,"$1").trim());e<a.length;e++){if("interactive"===a[e].readyState)return a[e];if(a[e].src===r)return a[e];if(r===i&&a[e].innerHTML&&a[e].innerHTML.trim()===u)return a[e]}return null}}())||void 0===e?void 0:e.getAttribute("src"))||void 0===e?void 0:e.match(/globalName=(.+)$/))||void 0===e?void 0:e[1])||Vt}function Xt(n){return"APMPLUS"+n}function Yt(n){return function(n){try{var e=localStorage.getItem(n),t=e;return t=e&&"string"==typeof e?JSON.parse(e):t}catch(n){return}}(Xt(n))||{userId:O(),deviceId:O(),r:Math.random()}}function Jt(n){var e=n.aid,t=n.userId,r=n.deviceId,n=n.sample;!function(n,e){try{var t="string"==typeof e?e:JSON.stringify(e);localStorage.setItem(n,t)}catch(n){}}(Xt(e),{userId:t,deviceId:r,r:n.r})}var Vt="APM_PLUS_WEB",$t="/settings/get/webpro",Kt="/monitor_web/collect",Qt=[Kt,$t,"/monitor_browser/collect"],Zt={sample_rate:1,include_users:[],sample_granularity:"session",rules:{}},nr=20,er=function(n,e){return void 0===e&&(e=Kt),(n&&0<=n.indexOf("//")?"":"https://")+n+e},tr=O,rr=function(e){var o,i,u,a=e,c={},f=w,t=w;return{getConfig:function(){return a},setConfig:function(n){var e,t,r;return c=v(v({},c),n||{}),s(),o||(o=n,a.useLocalConfig?(u={},f()):i?l():(e=a.transport,t=a.domain,n=a.aid,r=function(n){i=n,l()},e.get({withCredentials:!0,url:function(n,e){return void 0===e&&(e=$t),(n&&0<=n.indexOf("//")?"":"https://")+n+e}(t)+"?aid="+n,success:function(n){r(n.data||{})},fail:function(){r()}}))),a},onChange:function(n){t=n},onReady:function(n){f=function(){!function(){e.userId!==a.userId&&(e.sample.r=Math.random(),s());Jt(a)}(),n()},u&&f()}};function s(){var n=v(v(v({},e),u||{}),c);n.plugins=function(){for(var n=[],e=0;e<arguments.length;e++)n[e]=arguments[e];for(var t={},r=0;r<n.length;)t=d(t,n[r++]);return t}(e.plugins,(null==u?void 0:u.plugins)||{},c.plugins||{}),n.sample=or(or(e.sample,null==u?void 0:u.sample),c.sample),a=n,t()}function l(){u=function(n){if(!n)return{};var e=n.sample,t=n.timestamp,r=n.status;if(!e)return{};var o=e.sample_rate,n=e.sample_granularity;return{sample:{include_users:e.include_users,sample_rate:r&&4===r?0:o,sample_granularity:n,rules:e.rules.reduce(function(n,e){var t=e.name,r=e.enable,o=e.sample_rate,e=e.conditional_sample_rules;return n[t]={enable:r,sample_rate:o,conditional_sample_rules:e},n},{})},serverTimestamp:t}}(i),s(),f()}};function or(r,o){if(!r||!o)return r||o;var n=v(v({},r),o);return n.include_users=y(y([],D(r.include_users||[]),!1),D(o.include_users||[]),!1),n.rules=y(y([],D(Object.keys(r.rules||{})),!1),D(Object.keys(o.rules||{})),!1).reduce(function(n,e){var t;return e in n||(e in(r.rules||{})&&e in(o.rules||{})?(n[e]=v(v({},r.rules[e]),o.rules[e]),n[e].conditional_sample_rules=y(y([],D(r.rules[e].conditional_sample_rules||[]),!1),D(o.rules[e].conditional_sample_rules||[]),!1)):n[e]=(null===(t=r.rules)||void 0===t?void 0:t[e])||(null===(t=o.rules)||void 0===t?void 0:t[e])),n},{}),n}var ir,ur,ar,cr,fr,sr,lr,dr,pr,vr,hr,mr,gr,yr,br,wr,Er,_r,Sr=function(n){n.on("report",function(n){return e=n,n={url:un(),timestamp:Date.now()},v(v({},e),{extra:v(v({},n),e.extra||{})});var e})},xr={sri:"reportSri",st:"reportResourceError",err:"captureException"},Tr=function(n){return Object.keys(n).reduce(function(n,e){return n[e]=[],n},{})},Lr=function(t){return Object.keys(t).reduce(function(n,e){return n[t[e]]=e,n},{})},Rr=function(o,i,u){return function(n,e,t,r){void 0===t&&(t=Date.now()),void 0===r&&(r=location.href);r=v(v({},an(o)),{url:r,timestamp:t});i[n]&&(o[u[n]]?cn(o,r)(function(){o[u[n]](e)}):null!==(t=i[n])&&void 0!==t&&t.push([e,r]))}},Cr=function(r,e,o){return function(t){var n;t in o&&(null!==(n=e[o[t]])&&void 0!==n&&n.forEach(function(n){var n=D(n,2),e=n[0],n=n[1];cn(r,n)(function(){r[t](e)})}),e[o[t]]=null)}},jr=function(t){var r,o=!1;t.on("init",function(){r=(new Date).getTime(),t.on("config",function(){var n,e=null===(n=t.config())||void 0===n?void 0:n.serverTimestamp;isNaN(e)||Number(e)<=0||o||(o=!0,(n=(new Date).getTime())-r<700&&e&&(n=e-(n+r)/2,!isNaN(n)&&(0<n||n<-6e5)&&t.set({offset:n})))})})},kr=function(r){r.on("beforeBuild",function(n){return e=n,t=r.config(),(n={}).aid=t.aid,n.pid=t.pid,n.view_id=t.viewId,n.user_id=t.userId,v(v({},e),{extra:v(v({},n),e.extra||{})});var e,t})},Dr=function(c){c.on("start",function(){var t,n=c.config(),e=n.deviceId,r=n.sessionId,o=n.release,i=n.env,u=n.offset,a=n.aid,n=n.token,a={did:e,sid:r,release:o,env:i,sname:Vt,sversion:"1.7.0",soffset:u||0,biz_id:a,x_auth_token:n},n=c.getSender();n.setEndpoint(n.getEndpoint()+(E(t=a)?Object.keys(t).reduce(function(n,e){return n+="&"+e+"="+t[e]},"").replace("&","?"):""))})},Or=function(n){var e,n=Yt(n.aid);return{aid:0,pid:"",token:"",viewId:"__"+Date.now(),userId:n.userId,deviceId:n.deviceId,sessionId:tr(),domain:"apmplus.volces.com",plugins:{ajax:{ignoreUrls:Qt},fetch:{ignoreUrls:Qt},breadcrumb:{},pageview:{},jsError:{},resource:{},resourceError:{},performance:{},tti:{},fmp:{},blankScreen:!1},release:"",env:"production",sample:v(v({},Zt),{r:n.r}),transport:(e=G())?{get:function(n){Mt("GET",n,e)},post:function(n){Mt("POST",n,e)}}:{get:w,post:w}}},qr=(_r=function(n){var e=void 0===n?{}:n,t=e.createSender,n=e.builder,e=e.createDefaultConfig,r=function(n){var t,r,e=n.builder,o=n.createSender,i=n.createDefaultConfig,u=n.createConfigManager,a=n.userConfigNormalizer,c=n.initConfigNormalizer,f=n.validateInitConfig,s={};b.forEach(function(n){return s[n]=[]});var l=!1,d=!1,p=!1,v=[],h=[],m={getBuilder:function(){return e},getSender:function(){return t},getPreStartQueue:function(){return v},init:function(n){if(l)T("already inited");else{if(!(n&&E(n)&&f(n)))throw new Error("invalid InitConfig, init failed");var e=i(n);if(!e)throw new Error("defaultConfig missing");n=c(n);if((r=u(e)).setConfig(n),r.onChange(function(){g("config")}),!(t=o(r.getConfig())))throw new Error("sender missing");g("init",l=!0)}},set:function(n){l&&n&&E(n)&&(g("beforeConfig",!1,n),null!=r&&r.setConfig(n))},config:function(n){if(l)return n&&E(n)&&(g("beforeConfig",!1,n),null!=r&&r.setConfig(a(n))),null==r?void 0:r.getConfig()},provide:function(n,e){S(h,n)?T("cannot provide "+n+", reserved"):(m[n]=e,g("provide",!1,n))},start:function(){var e=this;l&&(d||null!=r&&r.onReady(function(){g("start",d=!0),v.forEach(function(n){return e.build(n)}),v=[]}))},report:function(n){n&&(!(n=R(s.beforeReport)(n))||(n=R(s.report)(n))&&(d?this.build(n):v.push(n)))},build:function(n){!d||(n=R(s.beforeBuild)(n))&&(!(n=e.build(n))||(n=R(s.build)(n))&&this.send(n))},send:function(n){!d||(n=R(s.beforeSend)(n))&&(t.send(n),g("send",!1,n))},destroy:function(){g("beforeDestroy",p=!0)},on:function(n,e){"init"===n&&l||"start"===n&&d||"beforeDestroy"===n&&p?e():s[n]&&s[n].push(e)},off:function(n,e){s[n]&&(s[n]=x(s[n],e))}},h=Object.keys(m);return m;function g(n,e){void 0===e&&(e=!1);for(var t=[],r=2;r<arguments.length;r++)t[r-2]=arguments[r];s[n].forEach(function(n){try{n.apply(void 0,y([],D(t),!1))}catch(n){}}),e&&(s[n].length=0)}}({validateInitConfig:Gt,initConfigNormalizer:Wt,userConfigNormalizer:Ft,createSender:void 0===t?function(n){return Pt({size:nr,endpoint:er(n.domain),transport:n.transport})}:t,builder:void 0===n?Ut:n,createDefaultConfig:void 0===e?Or:e,createConfigManager:rr});A(r);var o,n=V(H());e=r,n=n&&n.subject,o=n||{},e.provide("initSubject",function(n){var n=D(n,2),e=n[0],n=n[1];return o[e]||(o[e]=N(n,function(){o[e]=void 0})),o[e]}),e.provide("getSubject",function(n){return o[n]}),jr(r),kr(r),Sr(r),Bt(r),Dr(r);var i,e=M(r,an,function(n,e,t){return cn(n,e)(function(){var n=D(t),e=n[0],n=n.slice(1);r[e].apply(r,y([],D(n),!1))})});return(i=e).on("init",function(){var e=[],n=i.config();n&&n.integrations&&n.integrations.forEach(function(n){S(e,n.name)||(e.push(n.name),n.setup(i),n.tearDown&&i.on("beforeDestroy",n.tearDown))})}),e}(ir=void 0===ir?{}:ir),(ur=_r).on("start",function(){var n=ur.config(),e=n.userId,n=n.sample;n&&0===n.sample_rate&&ur.destroy();n=Ht(e,n,j,k);ur.on("build",n)}),ar=_r,fr=Tr(cr=void 0===cr?xr:cr),ir=Lr(cr),sr=Rr(ar,fr,cr),null!==(cr=ar.p)&&void 0!==cr&&cr.a&&"observe"in ar.p.a&&ar.p.a.observe(function(n){var e=D(n,5);e[0];var t=e[1],r=e[2],n=e[3],e=e[4];sr(t,r,n,e)}),ar.on("init",function(){var n;null!==(n=ar.p)&&void 0!==n&&n.a.forEach(function(n){var e=D(n,5);e[0];var t=e[1],r=e[2],n=e[3],e=e[4];sr(t,r,n,e)}),ar.p&&ar.p.a&&(ar.p.a.length=0)}),ar.provide("precollect",sr),ar.on("provide",Cr(ar,fr,ir)),(lr=_r).provide("sendEvent",function(n){n=jt(n);n&&lr.report({ev_type:Ct,payload:n,extra:{timestamp:tn()}})}),lr.provide("sendLog",function(n){n=kt(n);n&&lr.report({ev_type:Ct,payload:n,extra:{timestamp:tn()}})}),(dr=_r).on("init",function(){var n,e=Dn(dr,le,de);e&&(e=D(nn(se,v(v({},e),{initPid:null===(e=dr.config())||void 0===e?void 0:e.pid,onPidUpdate:function(n){dr.set({pid:n,viewId:n+"_"+tn(),actionId:void 0})},createObserver:function(n){return dr.initSubject("hash"===n?ce:fe)}}),dr.report.bind(dr)),2),n=e[0],e=e[1],dr.on("config",function(){n(dr.config().pid)}),dr.on("beforeDestroy",e),dr.provide("sendPageview",n))}),(pr=_r).on("init",function(){var e,n=Dn(pr,qn,In);n&&(e=!1,n=D(nn(Cn,v(v({},n),{hookCbAtReq:Nn(pr),setTraceHeader:kn(n.trace,"app_id="+(null===(n=pr.config())||void 0===n?void 0:n.aid)+",origin=web")}),function(n){return!e&&pr.report(n)}),1)[0],pr.on("beforeDestroy",function(){e=!0}),pr.provide("wrapXhr",n))}),(vr=_r).on("init",function(){var e,n=Dn(vr,zn,Xn);n&&(e=!1,n=D(nn(Fn,v(v({},n),{hookCbAtReq:Nn(vr),setTraceHeader:kn(n.trace,"app_id="+(null===(n=vr.config())||void 0===n?void 0:n.aid)+",origin=web")}),function(n){return!e&&vr.report(n)}),1)[0],vr.on("beforeDestroy",function(){e=!0}),vr.provide("wrapFetch",n))}),(hr=_r).on("init",function(){var n,e=Dn(hr,Ae,{});e&&(n=hr.pp||Ie,nn(Ne,v(v({},e),{precollect:n}),On(hr)))}),(mr=_r).on("init",function(){var n,e=Dn(mr,Pe,Ue);e&&(n=D(nn(He,e,On(mr)),1)[0],pn(function(){return setTimeout(n,200)}))}),(gr=_r).on("init",function(){var e,n,t=Dn(gr,Mn,Bn);t&&(t=(n=D(nn(An,t,w),3))[0],e=n[1],n=n[2],gr.on("report",function(n){return"http"===n.ev_type&&e({type:"http",category:n.payload.api,message:"",data:{method:n.payload.request.method,url:n.payload.request.url,status_code:String(n.payload.response.status)},timestamp:n.payload.request.timestamp}),n}),gr.on("beforeDestroy",n),gr.provide("getBreadcrumbs",t),gr.provide("addBreadcrumb",e))}),(yr=_r).on("init",function(){window.removeEventListener("error",yr.pcErr,!0),window.removeEventListener("unhandledrejection",yr.pcRej,!0);var n,e=Dn(yr,ue,ae);e&&(e=(n=D(nn(ie,e,function(n){yr.getBreadcrumbs&&(n.payload.breadcrumbs=yr.getBreadcrumbs()),yr.report(n)}),2))[0],n=n[1],yr.on("beforeDestroy",n),yr.provide("captureException",e))}),(br=_r).on("init",function(){var n=br.pp||Ie;null!==(e=n.observer)&&void 0!==e&&e.disconnect();var t,r,o,i,u,a,e,c,f=Dn(br,qe,{});f&&(t=B(br,ut),r=B(br,ct),o=B(br,at),i=B(br,dt),u=[],a=N(it(br)),[yt,bt,Et,St,xt].forEach(function(n){var e;!1!==f[n[0]]&&(e=[],n[1](br.report.bind(br),e,[t,r,a]),u.push(e))}),[Tt,Lt,Rt].forEach(function(n){var e;!1!==f[n[0]]&&(e=[],n[1](br.report.bind(br),e,[o,r,i]),u.push(e))}),e=(c=D(ht(br.report.bind(br)),2))[0],c=c[1],br.provide("performanceInit",e),br.provide("performanceSend",c),n.entries.length=0,br.provide("sendCustomPerfMetric",function(n){n=v(v(v({},De),n),{isCustom:!0});br.report(vt(n))}),br.on("beforeDestroy",function(){u.reduce(function(n,e){return n.concat(e)},[]).forEach(function(n){return n()}),u.length=0}))}),(wr=_r).on("init",function(){var n,e=Dn(wr,we,Ee);e&&(e=(n=D(nn(be,e,wr.report.bind(wr)),2))[0],n=n[1],wr.on("beforeDestroy",n),wr.provide("reportResourceError",e))}),(Er=_r).on("init",function(){var n=Dn(Er,me,ge);n&&(n=D(nn(he,n,function(n){var e=D(n,2),n=e[0],e=e[1];Er.report(e?v(v({},n),{extra:{sample_rate:1}}):n)}),1)[0],Er.on("beforeDestroy",n))}),n(_r),_r),Ir=function(){var n=H(),e=zt();if(n&&e)return n[e]}();Ir&&["p","pp","pcErr","pcRej"].forEach(function(n){qr.provide(n,Ir[n])});var Nr,Ar,Mr,Br,Hr=H(),Pr=zt();Hr&&Pr&&(Nr=(null==(Nr=Hr[Pr])?void 0:Nr.q)||[],Hr[Pr]=qr,Nr.forEach(function(n){var e,t;t=n,n=v(v({},an(e=qr)),{url:t.pop(),timestamp:t.pop()}),cn(e,n)(function(){e.apply(void 0,y([],D(t),!1))})}),Nr.length=0,qr.p&&("observe"in qr.p.a&&console.warn("global precollect queue already updated"),qr.p.a=(Mr=qr.p.a,Br=[],Mr.observe=function(n){Br.push(n)},Mr.push=function(){for(var n,e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];return e.forEach(function(e){Br.forEach(function(n){return n(e)})}),(n=[].push).call.apply(n,y([Mr],D(e),!1))},Mr),(Ar=qr.precollect)&&qr.provide("precollect",function(){for(var n=[],e=0;e<arguments.length;e++)n[e]=arguments[e];return qr.p.a.push(y(["precollect"],D(n),!1)),Ar.apply(void 0,y([],D(n),!1))})))}(); |
@@ -1,1 +0,1 @@ | ||
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var REPORT_DOMAIN="apmplus.volces.com",SETTINGS_DOMAIN=REPORT_DOMAIN,SDK_VERSION="1.6.0",SDK_NAME="APM_PLUS_WEB",SETTINGS_PATH="/settings/get/webpro",BATCH_REPORT_PATH="/monitor_web/collect",STORAGE_PREFIX="APMPLUS",DEFAULT_IGNORE_PATHS=[BATCH_REPORT_PATH,SETTINGS_PATH,"/monitor_browser/collect"],DEFAULT_SAMPLE_CONFIG={sample_rate:1,include_users:[],sample_granularity:"session",rules:{}},DEFAULT_SENDER_SIZE=20;exports.BATCH_REPORT_PATH=BATCH_REPORT_PATH,exports.DEFAULT_IGNORE_PATHS=DEFAULT_IGNORE_PATHS,exports.DEFAULT_SAMPLE_CONFIG=DEFAULT_SAMPLE_CONFIG,exports.DEFAULT_SENDER_SIZE=DEFAULT_SENDER_SIZE,exports.REPORT_DOMAIN=REPORT_DOMAIN,exports.SDK_NAME=SDK_NAME,exports.SDK_VERSION=SDK_VERSION,exports.SETTINGS_DOMAIN=SETTINGS_DOMAIN,exports.SETTINGS_PATH=SETTINGS_PATH,exports.STORAGE_PREFIX=STORAGE_PREFIX; | ||
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var REPORT_DOMAIN="apmplus.volces.com",SETTINGS_DOMAIN=REPORT_DOMAIN,SDK_VERSION="1.7.0",SDK_NAME="APM_PLUS_WEB",SETTINGS_PATH="/settings/get/webpro",BATCH_REPORT_PATH="/monitor_web/collect",STORAGE_PREFIX="APMPLUS",DEFAULT_IGNORE_PATHS=[BATCH_REPORT_PATH,SETTINGS_PATH,"/monitor_browser/collect"],DEFAULT_SAMPLE_CONFIG={sample_rate:1,include_users:[],sample_granularity:"session",rules:{}},DEFAULT_SENDER_SIZE=20;exports.BATCH_REPORT_PATH=BATCH_REPORT_PATH,exports.DEFAULT_IGNORE_PATHS=DEFAULT_IGNORE_PATHS,exports.DEFAULT_SAMPLE_CONFIG=DEFAULT_SAMPLE_CONFIG,exports.DEFAULT_SENDER_SIZE=DEFAULT_SENDER_SIZE,exports.REPORT_DOMAIN=REPORT_DOMAIN,exports.SDK_NAME=SDK_NAME,exports.SDK_VERSION=SDK_VERSION,exports.SETTINGS_DOMAIN=SETTINGS_DOMAIN,exports.SETTINGS_PATH=SETTINGS_PATH,exports.STORAGE_PREFIX=STORAGE_PREFIX; |
@@ -115,2 +115,7 @@ declare type BatchSender<E> = EventSender<E> & { | ||
declare type ParametersForFn<T extends (args: any) => any> = T extends (args: infer P) => any ? P : never; | ||
declare type SafeObservable<T> = [(f: T) => () => void, (f: T) => void]; | ||
declare type Observer<T extends (args: any) => any> = (next: (args: ParametersForFn<T>) => ReturnType<NextLink<T>>, attach: (disconnect: () => void, onSubscribe?: (f: T) => void) => void) => void; | ||
declare type NextLink<T extends (args: any) => any> = (args: ParametersForFn<T>, cb: T[]) => NextLink<ReturnType<T>>; | ||
declare type WithContext<C extends AnyClient> = C & { | ||
@@ -142,2 +147,7 @@ context?: ContextAgent; | ||
declare type WithSubject<C extends AnyClient> = C & { | ||
initSubject: <T extends (args: any) => any>(args: [subjectKey: string, collector: Observer<T>]) => SafeObservable<T>; | ||
getSubject: (key: string) => SafeObservable<any> | undefined; | ||
}; | ||
/** 公共筛选条件 */ | ||
@@ -739,6 +749,7 @@ interface FilterCondition$1 { | ||
onPidUpdate?: (pid: string) => void; | ||
createObserver?: (mode: string) => SafeObservable<(args: string) => void>; | ||
} | ||
declare const PAGEVIEW_MONITOR_PLUGIN_NAME = "pageview"; | ||
declare type WithSendPageview<C extends WebClient> = C & { | ||
declare type WithSendPageview<C extends WithSubject<WebClient>> = C & { | ||
sendPageview?: SendPageview; | ||
@@ -795,3 +806,5 @@ }; | ||
lcp = "lcp", | ||
cls = "cls" | ||
cls = "cls", | ||
longtask = "longtask", | ||
timing = "timing" | ||
} | ||
@@ -804,5 +817,2 @@ interface PerformancePrecollect { | ||
[key in MetricEnum]: boolean; | ||
} & { | ||
timing: boolean; | ||
longtask: boolean; | ||
}; | ||
@@ -1051,3 +1061,3 @@ | ||
declare type PrecollectArg = [string, string, PrecollectData, number, string]; | ||
declare type BrowserClient = WithDetectBlankScreen<WithBreadcrumb<WithReportResourceError<WithSendPerformance<WithCaptureException<WithSendCustom<WithSendPageview<WithContext<Client<BrowserReportEvent, BrowserSendEvent, BrowserBuilder, BrowserSender, BrowserInitConfig, BrowserUserConfig, BrowserConfig>>>>>>>>> & LoadableTarget & { | ||
declare type BrowserClient = WithDetectBlankScreen<WithBreadcrumb<WithReportResourceError<WithSendPerformance<WithCaptureException<WithSendCustom<WithSendPageview<WithContext<WithSubject<Client<BrowserReportEvent, BrowserSendEvent, BrowserBuilder, BrowserSender, BrowserInitConfig, BrowserUserConfig, BrowserConfig>>>>>>>>>> & LoadableTarget & { | ||
q?: any[]; | ||
@@ -1054,0 +1064,0 @@ p?: { |
@@ -1,1 +0,1 @@ | ||
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var __assign=function(){return(__assign=Object.assign||function(e){for(var n,r=1,t=arguments.length;r<t;r++)for(var o in n=arguments[r])Object.prototype.hasOwnProperty.call(n,o)&&(e[o]=n[o]);return e}).apply(this,arguments)};function __read(e,n){var r="function"==typeof Symbol&&e[Symbol.iterator];if(!r)return e;var t,o,i=r.call(e),a=[];try{for(;(void 0===n||0<n--)&&!(t=i.next()).done;)a.push(t.value)}catch(e){o={error:e}}finally{try{t&&!t.done&&(r=i.return)&&r.call(i)}finally{if(o)throw o.error}}return a}function __spreadArray(e,n,r){if(r||2===arguments.length)for(var t,o=0,i=n.length;o<i;o++)!t&&o in n||((t=t||Array.prototype.slice.call(n,0,o))[o]=n[o]);return e.concat(t||Array.prototype.slice.call(n))}var DEFAULT_SIZE=10,DEFAULT_WAIT=1e3,stringifyBatch=function(e){return JSON.stringify({ev_type:"batch",list:e})};function createBatchSender(e){var n=e.transport,r=e.endpoint,t=e.size,o=void 0===t?DEFAULT_SIZE:t,e=e.wait,i=void 0===e?DEFAULT_WAIT:e,a=[],u=0;function s(){a.length&&(n.post({url:r,data:this.getBatchData()}),a=[])}return{getSize:function(){return o},getWait:function(){return i},setSize:function(e){o=e},setWait:function(e){i=e},getEndpoint:function(){return r},setEndpoint:function(e){r=e},send:function(e){a.push(e),a.length>=o&&s.call(this),clearTimeout(u),u=setTimeout(s.bind(this),i)},flush:function(){clearTimeout(u),s.call(this)},getBatchData:function(){return a.length?stringifyBatch(a):""},clear:function(){clearTimeout(u),a=[]}}}var EVENTS=["init","start","config","beforeDestroy","provide","beforeReport","report","beforeBuild","build","beforeSend","send","beforeConfig"],noop=function(){return{}};function isObject(e){return"object"==typeof e&&null!==e}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 hasKey(e,n){return Object.prototype.hasOwnProperty.call(e,n)}function mergeDeepConcatArray(){for(var e=[],n=0;n<arguments.length;n++)e[n]=arguments[n];for(var r={},t=0;t<e.length;)r=_mergeDeepMergeArray(r,e[t++]);return r}function _mergeDeepMergeArray(e,n){var r,t=__assign({},e);for(r in n)hasKey(n,r)&&void 0!==n[r]&&(isObject(n[r])&&isPlainObject(n[r])?t[r]=_mergeDeepMergeArray(isObject(e[r])?e[r]:{},n[r]):isArray(n[r])&&isArray(e[r])?t[r]=_mergeDeepArray(e[r],n[r]):t[r]=n[r]);return t}function _mergeDeepArray(e,n){e=isArray(e)?e:[],n=isArray(n)?n:[];return Array.prototype.concat.call(e,n).map(function(e){return e instanceof RegExp?e:isObject(e)&&isPlainObject(e)?_mergeDeepMergeArray({},e):isArray(e)?_mergeDeepArray([],e):e})}function arrayIncludes(e,n){if(!isArray(e))return!1;if(0===e.length)return!1;for(var r=0;r<e.length;){if(e[r]===n)return!0;r++}return!1}var arrayRemove=function(e,n){if(!isArray(e))return e;var r=e.indexOf(n);if(0<=r){n=e.slice();return n.splice(r,1),n}return e},safeVisit=function(e,n,r){for(var t,n=__read(n.split(".")),o=n[0],i=n.slice(1);e&&0<i.length;)e=e[o],o=(t=__read(i))[0],i=t.slice(1);if(e)return r(e,o)},safeCall=function(e,n,r){return safeVisit(e,n,function(e,n){if(e&&n in e&&isFunction(e[n]))try{return e[n].apply(e,r)}catch(e){return}})};function safeStringify(e){try{return isString(e)?e:JSON.stringify(e)}catch(e){return"[FAILED_TO_STRINGIFY]:"+String(e)}}var joinQueryWithMap=function(r){return isObject(r)?Object.keys(r).reduce(function(e,n){return e+="&"+n+"="+r[n]},"").replace("&","?"):""};function createContextAgent(){var r={},t={},o={set:function(e,n){return r[e]=n,t[e]=safeStringify(n),o},merge:function(n){return r=__assign(__assign({},r),n),Object.keys(n).forEach(function(e){t[e]=safeStringify(n[e])}),o},delete:function(e){return delete r[e],delete t[e],o},clear:function(){return r={},t={},o},get:function(e){return t[e]},toString:function(){return __assign({},t)}};return o}var hookObjectProperty=function(i,a,u,s){return void 0===s&&(s=!0),function(){for(var e=[],n=0;n<arguments.length;n++)e[n]=arguments[n];if(!i)return noop;var r=i[a],t=u.apply(void 0,__spreadArray([r],__read(e),!1)),o=t;return isFunction(o)&&s&&(o=function(){for(var n=[],e=0;e<arguments.length;e++)n[e]=arguments[e];try{return t.apply(this,n)}catch(e){return isFunction(r)&&r.apply(this,n)}}),i[a]=o,function(e){e||(o===i[a]?i[a]=r:t=r)}}},errCount=0,error=function(){for(var e=[],n=0;n<arguments.length;n++)e[n]=arguments[n];console.error.apply(console,__spreadArray(["[SDK]",Date.now(),(""+errCount++).padStart(8," ")],__read(e),!1))},warnCount=0,warn=function(){for(var e=[],n=0;n<arguments.length;n++)e[n]=arguments[n];console.warn.apply(console,__spreadArray(["[SDK]",Date.now(),(""+warnCount++).padStart(8," ")],__read(e),!1))},runProcessors=function(t){return function(e){for(var n=e,r=0;r<t.length&&n;r++)try{n=t[r](n)}catch(e){error(e)}return n}};function mathRNG(){for(var e=new Array(16),n=0,r=0;r<16;r++)0==(3&r)&&(n=4294967296*Math.random()),e[r]=n>>>((3&r)<<3)&255;return e}function bytesToUuid(e){for(var n=[],r=0;r<256;++r)n[r]=(r+256).toString(16).substr(1);var t=0,o=n;return[o[e[t++]],o[e[t++]],o[e[t++]],o[e[t++]],"-",o[e[t++]],o[e[t++]],"-",o[e[t++]],o[e[t++]],"-",o[e[t++]],o[e[t++]],"-",o[e[t++]],o[e[t++]],o[e[t++]],o[e[t++]],o[e[+t]],o[e[15]]].join("")}function uuid(){var e=mathRNG();return e[6]=15&e[6]|64,e[8]=63&e[8]|128,bytesToUuid(e)}function createClient(e){var r,t,n=e.builder,o=e.createSender,i=e.createDefaultConfig,a=e.createConfigManager,u=e.userConfigNormalizer,s=e.initConfigNormalizer,c=e.validateInitConfig,f={};EVENTS.forEach(function(e){return f[e]=[]});var l=!1,g=!1,d=!1,p=[],_=[],v={getBuilder:function(){return n},getSender:function(){return r},getPreStartQueue:function(){return p},init:function(e){if(l)warn("already inited");else{if(!(e&&isObject(e)&&c(e)))throw new Error("invalid InitConfig, init failed");var n=i(e);if(!n)throw new Error("defaultConfig missing");e=s(e);if((t=a(n)).setConfig(e),t.onChange(function(){y("config")}),!(r=o(t.getConfig())))throw new Error("sender missing");y("init",l=!0)}},set:function(e){l&&e&&isObject(e)&&(y("beforeConfig",!1,e),null!=t&&t.setConfig(e))},config:function(e){if(l)return e&&isObject(e)&&(y("beforeConfig",!1,e),null!=t&&t.setConfig(u(e))),null==t?void 0:t.getConfig()},provide:function(e,n){arrayIncludes(_,e)?warn("cannot provide "+e+", reserved"):(v[e]=n,y("provide",!1,e))},start:function(){var n=this;l&&(g||null!=t&&t.onReady(function(){y("start",g=!0),p.forEach(function(e){return n.build(e)}),p=[]}))},report:function(e){e&&(!(e=runProcessors(f.beforeReport)(e))||(e=runProcessors(f.report)(e))&&(g?this.build(e):p.push(e)))},build:function(e){!g||(e=runProcessors(f.beforeBuild)(e))&&(!(e=n.build(e))||(e=runProcessors(f.build)(e))&&this.send(e))},send:function(e){!g||(e=runProcessors(f.beforeSend)(e))&&(r.send(e),y("send",!1,e))},destroy:function(){y("beforeDestroy",d=!0)},on:function(e,n){"init"===e&&l||"start"===e&&g||"beforeDestroy"===e&&d?n():f[e]&&f[e].push(n)},off:function(e,n){f[e]&&(f[e]=arrayRemove(f[e],n))}},_=Object.keys(v);return v;function y(e,n){void 0===n&&(n=!1);for(var r=[],t=2;t<arguments.length;t++)r[t-2]=arguments[t];f[e].forEach(function(e){try{e.apply(void 0,__spreadArray([],__read(r),!1))}catch(e){}}),n&&(f[e].length=0)}}var ContextPlugin=function(e){var n=createContextAgent();e.provide("context",n),e.on("report",function(e){return e.extra||(e.extra={}),e.extra.context=n.toString(),e})},withCommandArray=function(i,a,r){function u(){for(var e=[],n=0;n<arguments.length;n++)e[n]=arguments[n];if(o=e[0]){var r=o.split(".")[0];if(r in u)return safeCall(u,o,[].slice.call(e,1));var t=s[r]||[],o=null!==(o=null==a?void 0:a(i))&&void 0!==o?o:{};t.push(__spreadArray([o],__read(e),!1)),void(s[r]=t)}}var e,s={};for(e in hookObjectProperty(i,"provide",function(r){return function(e,n){u[e]=n,r.call(i,e,n)}})(),i)Object.prototype.hasOwnProperty.call(i,e)&&(u[e]=i[e]);return i.on("provide",function(e){s[e]&&(s[e].forEach(function(e){var n=__read(e),e=n[0],n=n.slice(1);null!=r&&r(i,e,n)}),s[e]=null)}),u};function IntegrationPlugin(r){r.on("init",function(){var n=[],e=r.config();e&&e.integrations&&e.integrations.forEach(function(e){arrayIncludes(n,e.name)||(n.push(e.name),e.setup(r),e.tearDown&&r.on("beforeDestroy",e.tearDown))})})}function getDefaultBrowser(){if("object"==typeof window&&isObject(window))return window}function getDefaultLocation(){return getDefaultBrowser()&&window.location}function getDefaultXMLHttpRequest(){if("function"==typeof XMLHttpRequest&&isFunction(XMLHttpRequest))return XMLHttpRequest}function getDefaultNavigator(){if(getDefaultBrowser()&&"navigator"in window)return window.navigator}function getDefaultNetworkInformation(){var e=getDefaultNavigator();if(e)return e.connection||e.mozConnection||e.webkitConnection}function getLocationUrl(){var e=getDefaultBrowser()&&getDefaultLocation();return null==e?void 0:e.href}var captureCurrentContext=function(e){var n={url:getLocationUrl(),timestamp:Date.now()},r=e.config();return null!=r&&r.pid&&(n.pid=r.pid),null!=e&&e.context&&(n.context=e.context.toString()),n},syncReportWithCapturedContext=function(r,t){return function(e){function n(e){return e.overrides=t,e}r.on("report",n),e(),r.off("report",n)}},invokeCallbackOnce=function(n){var r=!1;return[function(e){r||(r=!0,n&&n(e))}]},onPageUnload=function(e){var n=__read(invokeCallbackOnce(e),1)[0];["unload","beforeunload","pagehide"].forEach(function(e){addEventListener(e,n)})},getStorageItem=function(e){try{var n=localStorage.getItem(e),r=n;return r=n&&"string"==typeof n?JSON.parse(n):r}catch(e){return}},setStorageItem=function(e,n){try{var r="string"==typeof n?n:JSON.stringify(n);localStorage.setItem(e,r)}catch(e){}};function getNetworkType(e){return(null==e?void 0:e.effectiveType)||(null==e?void 0:e.type)||""}var InjectNetworkTypePlugin=function(e){var n=getDefaultNetworkInformation(),r=getNetworkType(n);n&&(n.onchange=function(){r=getNetworkType(n)}),e.on("report",function(e){return __assign(__assign({},e),{extra:__assign(__assign({},e.extra||{}),{network_type:r})})})},getBeaconTransport=function(){var r=getDefaultBrowser();return r&&r.navigator.sendBeacon?{get:function(){},post:function(e,n){r.navigator.sendBeacon(e,n)}}:{get:noop,post:noop}},request=function(e,n,r){var t=n.url,o=n.data,i=n.success,a=void 0===i?noop:i,i=n.fail,u=void 0===i?noop:i,i=n.getResponseText,s=void 0===i?noop:i,n=n.withCredentials,n=void 0!==n&&n,r=new r;r.withCredentials=n,r.open(e,t,!0),r.setRequestHeader("Content-Type","application/json"),r.onload=function(){null!=s&&s(this.responseText);try{var e;this.responseText?(e=JSON.parse(this.responseText),a(e)):a({})}catch(e){u(e)}},r.onerror=function(){u(new Error("Network request failed"))},r.onabort=function(){u(new Error("Network request aborted"))},r.send(o)},getXhrTransport=function(){var n=getDefaultXMLHttpRequest();return n?{get:function(e){request("GET",e,n)},post:function(e){request("POST",e,n)}}:{get:noop,post:noop}};function createBrowserSender(e){function n(e){t.post(r.getEndpoint(),stringifyBatch([e]))}var r=createBatchSender(e),t=getBeaconTransport();return onPageUnload(function(){var e=r.getBatchData();e&&(t.post(r.getEndpoint(),e),r.clear()),r.send=n}),r}var browserBuilder={build:function(e){return{ev_type:e.ev_type,payload:e.payload,common:__assign(__assign({},e.extra||{}),e.overrides||{})}}};function normalizeInitConfig(e){var n,r=e.plugins||{};for(n in r)r[n]&&!isObject(r[n])&&(r[n]={});return __assign(__assign({},e),{plugins:r})}function validateInitConfig(e){return isObject(e)&&"aid"in e}function normalizeUserConfig(e){return __assign({},e)}function parseServerConfig(e){if(!e)return{};var n=e.sample,r=e.timestamp,t=e.status;if(!n)return{};var o=n.sample_rate,e=n.sample_granularity;return{sample:{include_users:n.include_users,sample_rate:t&&4===t?0:o,sample_granularity:e,rules:n.rules.reduce(function(e,n){var r=n.name,t=n.enable,o=n.sample_rate,n=n.conditional_sample_rules;return e[r]={enable:t,sample_rate:o,conditional_sample_rules:n},e},{})},serverTimestamp:r}}var REPORT_DOMAIN="apmplus.volces.com",SDK_VERSION="1.6.0",SDK_NAME="APM_PLUS_WEB",SETTINGS_PATH="/settings/get/webpro",BATCH_REPORT_PATH="/monitor_web/collect",STORAGE_PREFIX="APMPLUS",DEFAULT_IGNORE_PATHS=[BATCH_REPORT_PATH,SETTINGS_PATH,"/monitor_browser/collect"],DEFAULT_SAMPLE_CONFIG={sample_rate:1,include_users:[],sample_granularity:"session",rules:{}},DEFAULT_SENDER_SIZE=20,getReportUrl=function(e,n){return void 0===n&&(n=BATCH_REPORT_PATH),(e&&0<=e.indexOf("//")?"":"https://")+e+n},getSettingsUrl=function(e,n){return void 0===n&&(n=SETTINGS_PATH),(e&&0<=e.indexOf("//")?"":"https://")+e+n},getViewId=function(e){return e+"_"+Date.now()},getDefaultSessionId=function(){return uuid()},getStorageKey=function(e){return STORAGE_PREFIX+e},getStoreInfo=function(e){e=getStorageKey(e);return getStorageItem(e)||{userId:uuid(),deviceId:uuid(),r:Math.random()}},saveStoreInfo=function(e){var n=e.aid,r=e.userId,t=e.deviceId,e=e.sample,n=getStorageKey(n);setStorageItem(n,{userId:r,deviceId:t,r:e.r})},createBrowserConfigManager=function(n){var r,t,o,i=n,a={},u=noop,s=noop;return{getConfig:function(){return i},setConfig:function(e){return a=__assign(__assign({},a),e||{}),c(),r||(r=e,i.useLocalConfig?(o={},u()):t?f():getServerConfig(i.transport,i.domain,i.aid,function(e){t=e,f()})),i},onChange:function(e){s=e},onReady:function(e){u=function(){!function(){n.userId!==i.userId&&(n.sample.r=Math.random(),c());saveStoreInfo(i)}(),e()},o&&u()}};function c(){var e=__assign(__assign(__assign({},n),o||{}),a);e.plugins=mergeDeepConcatArray(n.plugins,(null==o?void 0:o.plugins)||{},a.plugins||{}),e.sample=mergeSampleConfig(mergeSampleConfig(n.sample,null==o?void 0:o.sample),a.sample),i=e,s()}function f(){o=parseServerConfig(t),c(),u()}};function getServerConfig(e,n,r,t){e.get({withCredentials:!0,url:getSettingsUrl(n)+"?aid="+r,success:function(e){t(e.data||{})},fail:function(){t()}})}function mergeSampleConfig(t,o){if(!t||!o)return t||o;var e=__assign(__assign({},t),o);return e.include_users=__spreadArray(__spreadArray([],__read(t.include_users||[]),!1),__read(o.include_users||[]),!1),e.rules=__spreadArray(__spreadArray([],__read(Object.keys(t.rules||{})),!1),__read(Object.keys(o.rules||{})),!1).reduce(function(e,n){var r;return n in e||(n in(t.rules||{})&&n in(o.rules||{})?(e[n]=__assign(__assign({},t.rules[n]),o.rules[n]),e[n].conditional_sample_rules=__spreadArray(__spreadArray([],__read(t.rules[n].conditional_sample_rules||[]),!1),__read(o.rules[n].conditional_sample_rules||[]),!1)):e[n]=(null===(r=t.rules)||void 0===r?void 0:r[n])||(null===(r=o.rules)||void 0===r?void 0:r[n])),e},{}),e}var addEnvToSendEvent=function(e){var n={url:getLocationUrl(),timestamp:Date.now()};return __assign(__assign({},e),{extra:__assign(__assign({},n),e.extra||{})})},InjectEnvPlugin=function(e){e.on("report",function(e){return addEnvToSendEvent(e)})},MAX_RTT=700,TimeCalibrationPlugin=function(r){var t,o=!1;r.on("init",function(){t=(new Date).getTime(),r.on("config",function(){var e,n=null===(e=r.config())||void 0===e?void 0:e.serverTimestamp;isNaN(n)||Number(n)<=0||o||(o=!0,(e=(new Date).getTime())-t<MAX_RTT&&n&&(e=n-(e+t)/2,!isNaN(e)&&(0<e||e<-6e5)&&r.set({offset:e})))})})},addConfigToReportEvent=function(e,n){var r={};return r.aid=n.aid,r.pid=n.pid,r.view_id=n.viewId,r.user_id=n.userId,__assign(__assign({},e),{extra:__assign(__assign({},r),e.extra||{})})},InjectConfigPlugin=function(n){n.on("beforeBuild",function(e){return addConfigToReportEvent(e,n.config())})},InjectQueryPlugin=function(u){u.on("start",function(){var e=u.config(),n=e.deviceId,r=e.sessionId,t=e.release,o=e.env,i=e.offset,a=e.aid,e=e.token,a={did:n,sid:r,release:t,env:o,sname:SDK_NAME,sversion:SDK_VERSION,soffset:i||0,biz_id:a,x_auth_token:e},e=u.getSender();e.setEndpoint(e.getEndpoint()+joinQueryWithMap(a))})},getDefaultConfig=function(e){e=getStoreInfo(e.aid);return{aid:0,pid:"",token:"",viewId:getViewId("_"),userId:e.userId,deviceId:e.deviceId,sessionId:getDefaultSessionId(),domain:REPORT_DOMAIN,plugins:{ajax:{ignoreUrls:DEFAULT_IGNORE_PATHS},fetch:{ignoreUrls:DEFAULT_IGNORE_PATHS},breadcrumb:{},pageview:{},jsError:{},resource:{},resourceError:{},performance:{},tti:{},fmp:{},blankScreen:!1},release:"",env:"production",sample:__assign(__assign({},DEFAULT_SAMPLE_CONFIG),{r:e.r}),transport:getXhrTransport()}},createMinimalBrowserClient=function(e){var n=void 0===e?{}:e,r=n.createSender,e=n.builder,n=n.createDefaultConfig,t=createClient({validateInitConfig:validateInitConfig,initConfigNormalizer:normalizeInitConfig,userConfigNormalizer:normalizeUserConfig,createSender:void 0===r?function(e){return createBrowserSender({size:DEFAULT_SENDER_SIZE,endpoint:getReportUrl(e.domain),transport:e.transport})}:r,builder:void 0===e?browserBuilder:e,createDefaultConfig:void 0===n?getDefaultConfig:n,createConfigManager:createBrowserConfigManager});ContextPlugin(t),TimeCalibrationPlugin(t),InjectConfigPlugin(t),InjectEnvPlugin(t),InjectNetworkTypePlugin(t),InjectQueryPlugin(t);n=withCommandArray(t,captureCurrentContext,function(e,n,r){return syncReportWithCapturedContext(e,n)(function(){var e=__read(r),n=e[0],e=e.slice(1);t[n].apply(t,__spreadArray([],__read(e),!1))})});return IntegrationPlugin(n),n};exports.createMinimalBrowserClient=createMinimalBrowserClient,exports.getDefaultConfig=getDefaultConfig; | ||
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var __assign=function(){return(__assign=Object.assign||function(e){for(var n,r=1,t=arguments.length;r<t;r++)for(var o in n=arguments[r])Object.prototype.hasOwnProperty.call(n,o)&&(e[o]=n[o]);return e}).apply(this,arguments)};function __read(e,n){var r="function"==typeof Symbol&&e[Symbol.iterator];if(!r)return e;var t,o,i=r.call(e),a=[];try{for(;(void 0===n||0<n--)&&!(t=i.next()).done;)a.push(t.value)}catch(e){o={error:e}}finally{try{t&&!t.done&&(r=i.return)&&r.call(i)}finally{if(o)throw o.error}}return a}function __spreadArray(e,n,r){if(r||2===arguments.length)for(var t,o=0,i=n.length;o<i;o++)!t&&o in n||((t=t||Array.prototype.slice.call(n,0,o))[o]=n[o]);return e.concat(t||Array.prototype.slice.call(n))}var DEFAULT_SIZE=10,DEFAULT_WAIT=1e3,stringifyBatch=function(e){return JSON.stringify({ev_type:"batch",list:e})};function createBatchSender(e){var n=e.transport,r=e.endpoint,t=e.size,o=void 0===t?DEFAULT_SIZE:t,e=e.wait,i=void 0===e?DEFAULT_WAIT:e,a=[],u=0;function s(){a.length&&(n.post({url:r,data:this.getBatchData()}),a=[])}return{getSize:function(){return o},getWait:function(){return i},setSize:function(e){o=e},setWait:function(e){i=e},getEndpoint:function(){return r},setEndpoint:function(e){r=e},send:function(e){a.push(e),a.length>=o&&s.call(this),clearTimeout(u),u=setTimeout(s.bind(this),i)},flush:function(){clearTimeout(u),s.call(this)},getBatchData:function(){return a.length?stringifyBatch(a):""},clear:function(){clearTimeout(u),a=[]}}}var EVENTS=["init","start","config","beforeDestroy","provide","beforeReport","report","beforeBuild","build","beforeSend","send","beforeConfig"],noop=function(){return{}};function isObject(e){return"object"==typeof e&&null!==e}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 hasKey(e,n){return Object.prototype.hasOwnProperty.call(e,n)}function mergeDeepConcatArray(){for(var e=[],n=0;n<arguments.length;n++)e[n]=arguments[n];for(var r={},t=0;t<e.length;)r=_mergeDeepMergeArray(r,e[t++]);return r}function _mergeDeepMergeArray(e,n){var r,t=__assign({},e);for(r in n)hasKey(n,r)&&void 0!==n[r]&&(isObject(n[r])&&isPlainObject(n[r])?t[r]=_mergeDeepMergeArray(isObject(e[r])?e[r]:{},n[r]):isArray(n[r])&&isArray(e[r])?t[r]=_mergeDeepArray(e[r],n[r]):t[r]=n[r]);return t}function _mergeDeepArray(e,n){e=isArray(e)?e:[],n=isArray(n)?n:[];return Array.prototype.concat.call(e,n).map(function(e){return e instanceof RegExp?e:isObject(e)&&isPlainObject(e)?_mergeDeepMergeArray({},e):isArray(e)?_mergeDeepArray([],e):e})}function arrayIncludes(e,n){if(!isArray(e))return!1;if(0===e.length)return!1;for(var r=0;r<e.length;){if(e[r]===n)return!0;r++}return!1}var arrayRemove=function(e,n){if(!isArray(e))return e;var r=e.indexOf(n);if(0<=r){n=e.slice();return n.splice(r,1),n}return e},safeVisit=function(e,n,r){for(var t,n=__read(n.split(".")),o=n[0],i=n.slice(1);e&&0<i.length;)e=e[o],o=(t=__read(i))[0],i=t.slice(1);if(e)return r(e,o)},safeCall=function(e,n,r){return safeVisit(e,n,function(e,n){if(e&&n in e&&isFunction(e[n]))try{return e[n].apply(e,r)}catch(e){return}})};function safeStringify(e){try{return isString(e)?e:JSON.stringify(e)}catch(e){return"[FAILED_TO_STRINGIFY]:"+String(e)}}var joinQueryWithMap=function(r){return isObject(r)?Object.keys(r).reduce(function(e,n){return e+="&"+n+"="+r[n]},"").replace("&","?"):""};function createContextAgent(){var r={},t={},o={set:function(e,n){return r[e]=n,t[e]=safeStringify(n),o},merge:function(n){return r=__assign(__assign({},r),n),Object.keys(n).forEach(function(e){t[e]=safeStringify(n[e])}),o},delete:function(e){return delete r[e],delete t[e],o},clear:function(){return r={},t={},o},get:function(e){return t[e]},toString:function(){return __assign({},t)}};return o}var hookObjectProperty=function(i,a,u,s){return void 0===s&&(s=!0),function(){for(var e=[],n=0;n<arguments.length;n++)e[n]=arguments[n];if(!i)return noop;var r=i[a],t=u.apply(void 0,__spreadArray([r],__read(e),!1)),o=t;return isFunction(o)&&s&&(o=function(){for(var n=[],e=0;e<arguments.length;e++)n[e]=arguments[e];try{return t.apply(this,n)}catch(e){return isFunction(r)&&r.apply(this,n)}}),i[a]=o,function(e){e||(o===i[a]?i[a]=r:t=r)}}},errCount=0,error=function(){for(var e=[],n=0;n<arguments.length;n++)e[n]=arguments[n];console.error.apply(console,__spreadArray(["[SDK]",Date.now(),(""+errCount++).padStart(8," ")],__read(e),!1))},warnCount=0,warn=function(){for(var e=[],n=0;n<arguments.length;n++)e[n]=arguments[n];console.warn.apply(console,__spreadArray(["[SDK]",Date.now(),(""+warnCount++).padStart(8," ")],__read(e),!1))},runProcessors=function(t){return function(e){for(var n=e,r=0;r<t.length&&n;r++)try{n=t[r](n)}catch(e){error(e)}return n}};function mathRNG(){for(var e=new Array(16),n=0,r=0;r<16;r++)0==(3&r)&&(n=4294967296*Math.random()),e[r]=n>>>((3&r)<<3)&255;return e}function bytesToUuid(e){for(var n=[],r=0;r<256;++r)n[r]=(r+256).toString(16).substr(1);var t=0,o=n;return[o[e[t++]],o[e[t++]],o[e[t++]],o[e[t++]],"-",o[e[t++]],o[e[t++]],"-",o[e[t++]],o[e[t++]],"-",o[e[t++]],o[e[t++]],"-",o[e[t++]],o[e[t++]],o[e[t++]],o[e[t++]],o[e[+t]],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,n,r){var t=0;return function(){if(e())return t&&clearTimeout(t),void(t=0);0===t&&(t=setTimeout(n,r))}},nextLink=function(t,e){var n=e.reduce(function(e,n){try{var r=n(t);"function"==typeof r&&e.push(r)}catch(e){}return e},[]);return function(e){return nextLink(e,n)}},toObservable=function(e){function n(e){t=arrayRemove(t,e),i||a()}var r,t=[],o=[],i=!1,a=applyBufferTimer(function(){return!!t.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,t)},complete:function(e){o.push(e)},attach:function(e,n){r=[e,n]},subscribe:function(e){if(i)throw new Error("Observer is closed");return t.push(e),r&&r[1]&&r[1](e),a(),function(){return n(e)}},unsubscribe:n}},createSafeObserver=function(e,n){var r=toObservable();try{e(r.next,r.attach),n&&r.complete(n)}catch(e){}return[r.subscribe,r.unsubscribe]};function createClient(e){var r,t,n=e.builder,o=e.createSender,i=e.createDefaultConfig,a=e.createConfigManager,u=e.userConfigNormalizer,s=e.initConfigNormalizer,c=e.validateInitConfig,f={};EVENTS.forEach(function(e){return f[e]=[]});var l=!1,g=!1,d=!1,p=[],_=[],v={getBuilder:function(){return n},getSender:function(){return r},getPreStartQueue:function(){return p},init:function(e){if(l)warn("already inited");else{if(!(e&&isObject(e)&&c(e)))throw new Error("invalid InitConfig, init failed");var n=i(e);if(!n)throw new Error("defaultConfig missing");e=s(e);if((t=a(n)).setConfig(e),t.onChange(function(){y("config")}),!(r=o(t.getConfig())))throw new Error("sender missing");y("init",l=!0)}},set:function(e){l&&e&&isObject(e)&&(y("beforeConfig",!1,e),null!=t&&t.setConfig(e))},config:function(e){if(l)return e&&isObject(e)&&(y("beforeConfig",!1,e),null!=t&&t.setConfig(u(e))),null==t?void 0:t.getConfig()},provide:function(e,n){arrayIncludes(_,e)?warn("cannot provide "+e+", reserved"):(v[e]=n,y("provide",!1,e))},start:function(){var n=this;l&&(g||null!=t&&t.onReady(function(){y("start",g=!0),p.forEach(function(e){return n.build(e)}),p=[]}))},report:function(e){e&&(!(e=runProcessors(f.beforeReport)(e))||(e=runProcessors(f.report)(e))&&(g?this.build(e):p.push(e)))},build:function(e){!g||(e=runProcessors(f.beforeBuild)(e))&&(!(e=n.build(e))||(e=runProcessors(f.build)(e))&&this.send(e))},send:function(e){!g||(e=runProcessors(f.beforeSend)(e))&&(r.send(e),y("send",!1,e))},destroy:function(){y("beforeDestroy",d=!0)},on:function(e,n){"init"===e&&l||"start"===e&&g||"beforeDestroy"===e&&d?n():f[e]&&f[e].push(n)},off:function(e,n){f[e]&&(f[e]=arrayRemove(f[e],n))}},_=Object.keys(v);return v;function y(e,n){void 0===n&&(n=!1);for(var r=[],t=2;t<arguments.length;t++)r[t-2]=arguments[t];f[e].forEach(function(e){try{e.apply(void 0,__spreadArray([],__read(r),!1))}catch(e){}}),n&&(f[e].length=0)}}var ContextPlugin=function(e){var n=createContextAgent();e.provide("context",n),e.on("report",function(e){return e.extra||(e.extra={}),e.extra.context=n.toString(),e})},withCommandArray=function(i,a,r){function u(){for(var e=[],n=0;n<arguments.length;n++)e[n]=arguments[n];if(o=e[0]){var r=o.split(".")[0];if(r in u)return safeCall(u,o,[].slice.call(e,1));var t=s[r]||[],o=null!==(o=null==a?void 0:a(i))&&void 0!==o?o:{};t.push(__spreadArray([o],__read(e),!1)),void(s[r]=t)}}var e,s={};for(e in hookObjectProperty(i,"provide",function(r){return function(e,n){u[e]=n,r.call(i,e,n)}})(),i)Object.prototype.hasOwnProperty.call(i,e)&&(u[e]=i[e]);return i.on("provide",function(e){s[e]&&(s[e].forEach(function(e){var n=__read(e),e=n[0],n=n.slice(1);null!=r&&r(i,e,n)}),s[e]=null)}),u};function IntegrationPlugin(r){r.on("init",function(){var n=[],e=r.config();e&&e.integrations&&e.integrations.forEach(function(e){arrayIncludes(n,e.name)||(n.push(e.name),e.setup(r),e.tearDown&&r.on("beforeDestroy",e.tearDown))})})}function SubjectPlugin(e,n){var r=n||{};e.provide("initSubject",function(e){var e=__read(e,2),n=e[0],e=e[1];return r[n]||(r[n]=createSafeObserver(e,function(){r[n]=void 0})),r[n]}),e.provide("getSubject",function(e){return r[e]})}function getDefaultBrowser(){if("object"==typeof window&&isObject(window))return window}function getDefaultLocation(){return getDefaultBrowser()&&window.location}function getDefaultXMLHttpRequest(){if("function"==typeof XMLHttpRequest&&isFunction(XMLHttpRequest))return XMLHttpRequest}function getDefaultNavigator(){if(getDefaultBrowser()&&"navigator"in window)return window.navigator}function getDefaultNetworkInformation(){var e=getDefaultNavigator();if(e)return e.connection||e.mozConnection||e.webkitConnection}var getGlobalRegistry=function(e){if(e)return e.__SLARDAR_REGISTRY__||(e.__SLARDAR_REGISTRY__={Slardar:{plugins:[],errors:[],subject:{}}}),e.__SLARDAR_REGISTRY__.Slardar},now=function(){return Date.now()};function getLocationUrl(){var e=getDefaultBrowser()&&getDefaultLocation();return null==e?void 0:e.href}var captureCurrentContext=function(e){var n={url:getLocationUrl(),timestamp:now()},r=e.config();return null!=r&&r.pid&&(n.pid=r.pid),null!=e&&e.context&&(n.context=e.context.toString()),n},syncReportWithCapturedContext=function(r,t){return function(e){function n(e){return e.overrides=t,e}r.on("report",n),e(),r.off("report",n)}},invokeCallbackOnce=function(n){var r=!1;return[function(e){r||(r=!0,n&&n(e))}]},onPageUnload=function(e){var n=__read(invokeCallbackOnce(e),1)[0];["unload","beforeunload","pagehide"].forEach(function(e){addEventListener(e,n)})},getStorageItem=function(e){try{var n=localStorage.getItem(e),r=n;return r=n&&"string"==typeof n?JSON.parse(n):r}catch(e){return}},setStorageItem=function(e,n){try{var r="string"==typeof n?n:JSON.stringify(n);localStorage.setItem(e,r)}catch(e){}};function getNetworkType(e){return(null==e?void 0:e.effectiveType)||(null==e?void 0:e.type)||""}var InjectNetworkTypePlugin=function(e){var n=getDefaultNetworkInformation(),r=getNetworkType(n);n&&(n.onchange=function(){r=getNetworkType(n)}),e.on("report",function(e){return __assign(__assign({},e),{extra:__assign(__assign({},e.extra||{}),{network_type:r})})})},getBeaconTransport=function(){var r=getDefaultBrowser();return r&&r.navigator.sendBeacon?{get:function(){},post:function(e,n){r.navigator.sendBeacon(e,n)}}:{get:noop,post:noop}},request=function(e,n,r){var t=n.url,o=n.data,i=n.success,a=void 0===i?noop:i,i=n.fail,u=void 0===i?noop:i,i=n.getResponseText,s=void 0===i?noop:i,n=n.withCredentials,n=void 0!==n&&n,r=new r;r.withCredentials=n,r.open(e,t,!0),r.setRequestHeader("Content-Type","application/json"),r.onload=function(){null!=s&&s(this.responseText);try{var e;this.responseText?(e=JSON.parse(this.responseText),a(e)):a({})}catch(e){u(e)}},r.onerror=function(){u(new Error("Network request failed"))},r.onabort=function(){u(new Error("Network request aborted"))},r.send(o)},getXhrTransport=function(){var n=getDefaultXMLHttpRequest();return n?{get:function(e){request("GET",e,n)},post:function(e){request("POST",e,n)}}:{get:noop,post:noop}};function createBrowserSender(e){function n(e){t.post(r.getEndpoint(),stringifyBatch([e]))}var r=createBatchSender(e),t=getBeaconTransport();return onPageUnload(function(){var e=r.getBatchData();e&&(t.post(r.getEndpoint(),e),r.clear()),r.send=n}),r}var browserBuilder={build:function(e){return{ev_type:e.ev_type,payload:e.payload,common:__assign(__assign({},e.extra||{}),e.overrides||{})}}};function normalizeInitConfig(e){var n,r=e.plugins||{};for(n in r)r[n]&&!isObject(r[n])&&(r[n]={});return __assign(__assign({},e),{plugins:r})}function validateInitConfig(e){return isObject(e)&&"aid"in e}function normalizeUserConfig(e){return __assign({},e)}function parseServerConfig(e){if(!e)return{};var n=e.sample,r=e.timestamp,t=e.status;if(!n)return{};var o=n.sample_rate,e=n.sample_granularity;return{sample:{include_users:n.include_users,sample_rate:t&&4===t?0:o,sample_granularity:e,rules:n.rules.reduce(function(e,n){var r=n.name,t=n.enable,o=n.sample_rate,n=n.conditional_sample_rules;return e[r]={enable:t,sample_rate:o,conditional_sample_rules:n},e},{})},serverTimestamp:r}}var REPORT_DOMAIN="apmplus.volces.com",SDK_VERSION="1.7.0",SDK_NAME="APM_PLUS_WEB",SETTINGS_PATH="/settings/get/webpro",BATCH_REPORT_PATH="/monitor_web/collect",STORAGE_PREFIX="APMPLUS",DEFAULT_IGNORE_PATHS=[BATCH_REPORT_PATH,SETTINGS_PATH,"/monitor_browser/collect"],DEFAULT_SAMPLE_CONFIG={sample_rate:1,include_users:[],sample_granularity:"session",rules:{}},DEFAULT_SENDER_SIZE=20,getReportUrl=function(e,n){return void 0===n&&(n=BATCH_REPORT_PATH),(e&&0<=e.indexOf("//")?"":"https://")+e+n},getSettingsUrl=function(e,n){return void 0===n&&(n=SETTINGS_PATH),(e&&0<=e.indexOf("//")?"":"https://")+e+n},getViewId=function(e){return e+"_"+Date.now()},getDefaultSessionId=function(){return uuid()},getStorageKey=function(e){return STORAGE_PREFIX+e},getStoreInfo=function(e){e=getStorageKey(e);return getStorageItem(e)||{userId:uuid(),deviceId:uuid(),r:Math.random()}},saveStoreInfo=function(e){var n=e.aid,r=e.userId,t=e.deviceId,e=e.sample,n=getStorageKey(n);setStorageItem(n,{userId:r,deviceId:t,r:e.r})},createBrowserConfigManager=function(n){var r,t,o,i=n,a={},u=noop,s=noop;return{getConfig:function(){return i},setConfig:function(e){return a=__assign(__assign({},a),e||{}),c(),r||(r=e,i.useLocalConfig?(o={},u()):t?f():getServerConfig(i.transport,i.domain,i.aid,function(e){t=e,f()})),i},onChange:function(e){s=e},onReady:function(e){u=function(){!function(){n.userId!==i.userId&&(n.sample.r=Math.random(),c());saveStoreInfo(i)}(),e()},o&&u()}};function c(){var e=__assign(__assign(__assign({},n),o||{}),a);e.plugins=mergeDeepConcatArray(n.plugins,(null==o?void 0:o.plugins)||{},a.plugins||{}),e.sample=mergeSampleConfig(mergeSampleConfig(n.sample,null==o?void 0:o.sample),a.sample),i=e,s()}function f(){o=parseServerConfig(t),c(),u()}};function getServerConfig(e,n,r,t){e.get({withCredentials:!0,url:getSettingsUrl(n)+"?aid="+r,success:function(e){t(e.data||{})},fail:function(){t()}})}function mergeSampleConfig(t,o){if(!t||!o)return t||o;var e=__assign(__assign({},t),o);return e.include_users=__spreadArray(__spreadArray([],__read(t.include_users||[]),!1),__read(o.include_users||[]),!1),e.rules=__spreadArray(__spreadArray([],__read(Object.keys(t.rules||{})),!1),__read(Object.keys(o.rules||{})),!1).reduce(function(e,n){var r;return n in e||(n in(t.rules||{})&&n in(o.rules||{})?(e[n]=__assign(__assign({},t.rules[n]),o.rules[n]),e[n].conditional_sample_rules=__spreadArray(__spreadArray([],__read(t.rules[n].conditional_sample_rules||[]),!1),__read(o.rules[n].conditional_sample_rules||[]),!1)):e[n]=(null===(r=t.rules)||void 0===r?void 0:r[n])||(null===(r=o.rules)||void 0===r?void 0:r[n])),e},{}),e}var addEnvToSendEvent=function(e){var n={url:getLocationUrl(),timestamp:Date.now()};return __assign(__assign({},e),{extra:__assign(__assign({},n),e.extra||{})})},InjectEnvPlugin=function(e){e.on("report",function(e){return addEnvToSendEvent(e)})},MAX_RTT=700,TimeCalibrationPlugin=function(r){var t,o=!1;r.on("init",function(){t=(new Date).getTime(),r.on("config",function(){var e,n=null===(e=r.config())||void 0===e?void 0:e.serverTimestamp;isNaN(n)||Number(n)<=0||o||(o=!0,(e=(new Date).getTime())-t<MAX_RTT&&n&&(e=n-(e+t)/2,!isNaN(e)&&(0<e||e<-6e5)&&r.set({offset:e})))})})},addConfigToReportEvent=function(e,n){var r={};return r.aid=n.aid,r.pid=n.pid,r.view_id=n.viewId,r.user_id=n.userId,__assign(__assign({},e),{extra:__assign(__assign({},r),e.extra||{})})},InjectConfigPlugin=function(n){n.on("beforeBuild",function(e){return addConfigToReportEvent(e,n.config())})},InjectQueryPlugin=function(u){u.on("start",function(){var e=u.config(),n=e.deviceId,r=e.sessionId,t=e.release,o=e.env,i=e.offset,a=e.aid,e=e.token,a={did:n,sid:r,release:t,env:o,sname:SDK_NAME,sversion:SDK_VERSION,soffset:i||0,biz_id:a,x_auth_token:e},e=u.getSender();e.setEndpoint(e.getEndpoint()+joinQueryWithMap(a))})},getDefaultConfig=function(e){e=getStoreInfo(e.aid);return{aid:0,pid:"",token:"",viewId:getViewId("_"),userId:e.userId,deviceId:e.deviceId,sessionId:getDefaultSessionId(),domain:REPORT_DOMAIN,plugins:{ajax:{ignoreUrls:DEFAULT_IGNORE_PATHS},fetch:{ignoreUrls:DEFAULT_IGNORE_PATHS},breadcrumb:{},pageview:{},jsError:{},resource:{},resourceError:{},performance:{},tti:{},fmp:{},blankScreen:!1},release:"",env:"production",sample:__assign(__assign({},DEFAULT_SAMPLE_CONFIG),{r:e.r}),transport:getXhrTransport()}},createMinimalBrowserClient=function(e){var n=void 0===e?{}:e,r=n.createSender,e=n.builder,n=n.createDefaultConfig,t=createClient({validateInitConfig:validateInitConfig,initConfigNormalizer:normalizeInitConfig,userConfigNormalizer:normalizeUserConfig,createSender:void 0===r?function(e){return createBrowserSender({size:DEFAULT_SENDER_SIZE,endpoint:getReportUrl(e.domain),transport:e.transport})}:r,builder:void 0===e?browserBuilder:e,createDefaultConfig:void 0===n?getDefaultConfig:n,createConfigManager:createBrowserConfigManager});ContextPlugin(t);n=getGlobalRegistry(getDefaultBrowser());SubjectPlugin(t,n&&n.subject),TimeCalibrationPlugin(t),InjectConfigPlugin(t),InjectEnvPlugin(t),InjectNetworkTypePlugin(t),InjectQueryPlugin(t);n=withCommandArray(t,captureCurrentContext,function(e,n,r){return syncReportWithCapturedContext(e,n)(function(){var e=__read(r),n=e[0],e=e.slice(1);t[n].apply(t,__spreadArray([],__read(e),!1))})});return IntegrationPlugin(n),n};exports.createMinimalBrowserClient=createMinimalBrowserClient,exports.getDefaultConfig=getDefaultConfig; |
@@ -115,2 +115,7 @@ declare type BatchSender<E> = EventSender<E> & { | ||
declare type ParametersForFn<T extends (args: any) => any> = T extends (args: infer P) => any ? P : never; | ||
declare type SafeObservable<T> = [(f: T) => () => void, (f: T) => void]; | ||
declare type Observer<T extends (args: any) => any> = (next: (args: ParametersForFn<T>) => ReturnType<NextLink<T>>, attach: (disconnect: () => void, onSubscribe?: (f: T) => void) => void) => void; | ||
declare type NextLink<T extends (args: any) => any> = (args: ParametersForFn<T>, cb: T[]) => NextLink<ReturnType<T>>; | ||
declare type WithContext<C extends AnyClient> = C & { | ||
@@ -142,2 +147,7 @@ context?: ContextAgent; | ||
declare type WithSubject<C extends AnyClient> = C & { | ||
initSubject: <T extends (args: any) => any>(args: [subjectKey: string, collector: Observer<T>]) => SafeObservable<T>; | ||
getSubject: (key: string) => SafeObservable<any> | undefined; | ||
}; | ||
/** 公共筛选条件 */ | ||
@@ -727,6 +737,7 @@ interface FilterCondition { | ||
onPidUpdate?: (pid: string) => void; | ||
createObserver?: (mode: string) => SafeObservable<(args: string) => void>; | ||
} | ||
declare const PAGEVIEW_MONITOR_PLUGIN_NAME = "pageview"; | ||
declare type WithSendPageview<C extends WebClient> = C & { | ||
declare type WithSendPageview<C extends WithSubject<WebClient>> = C & { | ||
sendPageview?: SendPageview; | ||
@@ -783,3 +794,5 @@ }; | ||
lcp = "lcp", | ||
cls = "cls" | ||
cls = "cls", | ||
longtask = "longtask", | ||
timing = "timing" | ||
} | ||
@@ -792,5 +805,2 @@ interface PerformancePrecollect { | ||
[key in MetricEnum]: boolean; | ||
} & { | ||
timing: boolean; | ||
longtask: boolean; | ||
}; | ||
@@ -997,3 +1007,3 @@ | ||
declare type PrecollectArg = [string, string, PrecollectData, number, string]; | ||
declare type BrowserClient = WithDetectBlankScreen<WithBreadcrumb<WithReportResourceError<WithSendPerformance<WithCaptureException<WithSendCustom<WithSendPageview<WithContext<Client<BrowserReportEvent, BrowserSendEvent, BrowserBuilder, BrowserSender, BrowserInitConfig, BrowserUserConfig, BrowserConfig>>>>>>>>> & LoadableTarget & { | ||
declare type BrowserClient = WithDetectBlankScreen<WithBreadcrumb<WithReportResourceError<WithSendPerformance<WithCaptureException<WithSendCustom<WithSendPageview<WithContext<WithSubject<Client<BrowserReportEvent, BrowserSendEvent, BrowserBuilder, BrowserSender, BrowserInitConfig, BrowserUserConfig, BrowserConfig>>>>>>>>>> & LoadableTarget & { | ||
q?: any[]; | ||
@@ -1000,0 +1010,0 @@ p?: { |
@@ -1,1 +0,1 @@ | ||
var __assign=function(){return(__assign=Object.assign||function(e){for(var n,r=1,t=arguments.length;r<t;r++)for(var o in n=arguments[r])Object.prototype.hasOwnProperty.call(n,o)&&(e[o]=n[o]);return e}).apply(this,arguments)};function __read(e,n){var r="function"==typeof Symbol&&e[Symbol.iterator];if(!r)return e;var t,o,i=r.call(e),a=[];try{for(;(void 0===n||0<n--)&&!(t=i.next()).done;)a.push(t.value)}catch(e){o={error:e}}finally{try{t&&!t.done&&(r=i.return)&&r.call(i)}finally{if(o)throw o.error}}return a}function __spreadArray(e,n,r){if(r||2===arguments.length)for(var t,o=0,i=n.length;o<i;o++)!t&&o in n||((t=t||Array.prototype.slice.call(n,0,o))[o]=n[o]);return e.concat(t||Array.prototype.slice.call(n))}var DEFAULT_SIZE=10,DEFAULT_WAIT=1e3,stringifyBatch=function(e){return JSON.stringify({ev_type:"batch",list:e})};function createBatchSender(e){var n=e.transport,r=e.endpoint,t=e.size,o=void 0===t?DEFAULT_SIZE:t,e=e.wait,i=void 0===e?DEFAULT_WAIT:e,a=[],u=0;function s(){a.length&&(n.post({url:r,data:this.getBatchData()}),a=[])}return{getSize:function(){return o},getWait:function(){return i},setSize:function(e){o=e},setWait:function(e){i=e},getEndpoint:function(){return r},setEndpoint:function(e){r=e},send:function(e){a.push(e),a.length>=o&&s.call(this),clearTimeout(u),u=setTimeout(s.bind(this),i)},flush:function(){clearTimeout(u),s.call(this)},getBatchData:function(){return a.length?stringifyBatch(a):""},clear:function(){clearTimeout(u),a=[]}}}var EVENTS=["init","start","config","beforeDestroy","provide","beforeReport","report","beforeBuild","build","beforeSend","send","beforeConfig"],noop=function(){return{}};function isObject(e){return"object"==typeof e&&null!==e}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 hasKey(e,n){return Object.prototype.hasOwnProperty.call(e,n)}function mergeDeepConcatArray(){for(var e=[],n=0;n<arguments.length;n++)e[n]=arguments[n];for(var r={},t=0;t<e.length;)r=_mergeDeepMergeArray(r,e[t++]);return r}function _mergeDeepMergeArray(e,n){var r,t=__assign({},e);for(r in n)hasKey(n,r)&&void 0!==n[r]&&(isObject(n[r])&&isPlainObject(n[r])?t[r]=_mergeDeepMergeArray(isObject(e[r])?e[r]:{},n[r]):isArray(n[r])&&isArray(e[r])?t[r]=_mergeDeepArray(e[r],n[r]):t[r]=n[r]);return t}function _mergeDeepArray(e,n){e=isArray(e)?e:[],n=isArray(n)?n:[];return Array.prototype.concat.call(e,n).map(function(e){return e instanceof RegExp?e:isObject(e)&&isPlainObject(e)?_mergeDeepMergeArray({},e):isArray(e)?_mergeDeepArray([],e):e})}function arrayIncludes(e,n){if(!isArray(e))return!1;if(0===e.length)return!1;for(var r=0;r<e.length;){if(e[r]===n)return!0;r++}return!1}var arrayRemove=function(e,n){if(!isArray(e))return e;var r=e.indexOf(n);if(0<=r){n=e.slice();return n.splice(r,1),n}return e},safeVisit=function(e,n,r){for(var t,n=__read(n.split(".")),o=n[0],i=n.slice(1);e&&0<i.length;)e=e[o],o=(t=__read(i))[0],i=t.slice(1);if(e)return r(e,o)},safeCall=function(e,n,r){return safeVisit(e,n,function(e,n){if(e&&n in e&&isFunction(e[n]))try{return e[n].apply(e,r)}catch(e){return}})};function safeStringify(e){try{return isString(e)?e:JSON.stringify(e)}catch(e){return"[FAILED_TO_STRINGIFY]:"+String(e)}}var joinQueryWithMap=function(r){return isObject(r)?Object.keys(r).reduce(function(e,n){return e+="&"+n+"="+r[n]},"").replace("&","?"):""};function createContextAgent(){var r={},t={},o={set:function(e,n){return r[e]=n,t[e]=safeStringify(n),o},merge:function(n){return r=__assign(__assign({},r),n),Object.keys(n).forEach(function(e){t[e]=safeStringify(n[e])}),o},delete:function(e){return delete r[e],delete t[e],o},clear:function(){return r={},t={},o},get:function(e){return t[e]},toString:function(){return __assign({},t)}};return o}var hookObjectProperty=function(i,a,u,s){return void 0===s&&(s=!0),function(){for(var e=[],n=0;n<arguments.length;n++)e[n]=arguments[n];if(!i)return noop;var r=i[a],t=u.apply(void 0,__spreadArray([r],__read(e),!1)),o=t;return isFunction(o)&&s&&(o=function(){for(var n=[],e=0;e<arguments.length;e++)n[e]=arguments[e];try{return t.apply(this,n)}catch(e){return isFunction(r)&&r.apply(this,n)}}),i[a]=o,function(e){e||(o===i[a]?i[a]=r:t=r)}}},errCount=0,error=function(){for(var e=[],n=0;n<arguments.length;n++)e[n]=arguments[n];console.error.apply(console,__spreadArray(["[SDK]",Date.now(),(""+errCount++).padStart(8," ")],__read(e),!1))},warnCount=0,warn=function(){for(var e=[],n=0;n<arguments.length;n++)e[n]=arguments[n];console.warn.apply(console,__spreadArray(["[SDK]",Date.now(),(""+warnCount++).padStart(8," ")],__read(e),!1))},runProcessors=function(t){return function(e){for(var n=e,r=0;r<t.length&&n;r++)try{n=t[r](n)}catch(e){error(e)}return n}};function mathRNG(){for(var e=new Array(16),n=0,r=0;r<16;r++)0==(3&r)&&(n=4294967296*Math.random()),e[r]=n>>>((3&r)<<3)&255;return e}function bytesToUuid(e){for(var n=[],r=0;r<256;++r)n[r]=(r+256).toString(16).substr(1);var t=0,o=n;return[o[e[t++]],o[e[t++]],o[e[t++]],o[e[t++]],"-",o[e[t++]],o[e[t++]],"-",o[e[t++]],o[e[t++]],"-",o[e[t++]],o[e[t++]],"-",o[e[t++]],o[e[t++]],o[e[t++]],o[e[t++]],o[e[+t]],o[e[15]]].join("")}function uuid(){var e=mathRNG();return e[6]=15&e[6]|64,e[8]=63&e[8]|128,bytesToUuid(e)}function createClient(e){var r,t,n=e.builder,o=e.createSender,i=e.createDefaultConfig,a=e.createConfigManager,u=e.userConfigNormalizer,s=e.initConfigNormalizer,c=e.validateInitConfig,f={};EVENTS.forEach(function(e){return f[e]=[]});var l=!1,g=!1,d=!1,p=[],_=[],v={getBuilder:function(){return n},getSender:function(){return r},getPreStartQueue:function(){return p},init:function(e){if(l)warn("already inited");else{if(!(e&&isObject(e)&&c(e)))throw new Error("invalid InitConfig, init failed");var n=i(e);if(!n)throw new Error("defaultConfig missing");e=s(e);if((t=a(n)).setConfig(e),t.onChange(function(){y("config")}),!(r=o(t.getConfig())))throw new Error("sender missing");y("init",l=!0)}},set:function(e){l&&e&&isObject(e)&&(y("beforeConfig",!1,e),null!=t&&t.setConfig(e))},config:function(e){if(l)return e&&isObject(e)&&(y("beforeConfig",!1,e),null!=t&&t.setConfig(u(e))),null==t?void 0:t.getConfig()},provide:function(e,n){arrayIncludes(_,e)?warn("cannot provide "+e+", reserved"):(v[e]=n,y("provide",!1,e))},start:function(){var n=this;l&&(g||null!=t&&t.onReady(function(){y("start",g=!0),p.forEach(function(e){return n.build(e)}),p=[]}))},report:function(e){e&&(!(e=runProcessors(f.beforeReport)(e))||(e=runProcessors(f.report)(e))&&(g?this.build(e):p.push(e)))},build:function(e){!g||(e=runProcessors(f.beforeBuild)(e))&&(!(e=n.build(e))||(e=runProcessors(f.build)(e))&&this.send(e))},send:function(e){!g||(e=runProcessors(f.beforeSend)(e))&&(r.send(e),y("send",!1,e))},destroy:function(){y("beforeDestroy",d=!0)},on:function(e,n){"init"===e&&l||"start"===e&&g||"beforeDestroy"===e&&d?n():f[e]&&f[e].push(n)},off:function(e,n){f[e]&&(f[e]=arrayRemove(f[e],n))}},_=Object.keys(v);return v;function y(e,n){void 0===n&&(n=!1);for(var r=[],t=2;t<arguments.length;t++)r[t-2]=arguments[t];f[e].forEach(function(e){try{e.apply(void 0,__spreadArray([],__read(r),!1))}catch(e){}}),n&&(f[e].length=0)}}var ContextPlugin=function(e){var n=createContextAgent();e.provide("context",n),e.on("report",function(e){return e.extra||(e.extra={}),e.extra.context=n.toString(),e})},withCommandArray=function(i,a,r){function u(){for(var e=[],n=0;n<arguments.length;n++)e[n]=arguments[n];if(o=e[0]){var r=o.split(".")[0];if(r in u)return safeCall(u,o,[].slice.call(e,1));var t=s[r]||[],o=null!==(o=null==a?void 0:a(i))&&void 0!==o?o:{};t.push(__spreadArray([o],__read(e),!1)),void(s[r]=t)}}var e,s={};for(e in hookObjectProperty(i,"provide",function(r){return function(e,n){u[e]=n,r.call(i,e,n)}})(),i)Object.prototype.hasOwnProperty.call(i,e)&&(u[e]=i[e]);return i.on("provide",function(e){s[e]&&(s[e].forEach(function(e){var n=__read(e),e=n[0],n=n.slice(1);null!=r&&r(i,e,n)}),s[e]=null)}),u};function IntegrationPlugin(r){r.on("init",function(){var n=[],e=r.config();e&&e.integrations&&e.integrations.forEach(function(e){arrayIncludes(n,e.name)||(n.push(e.name),e.setup(r),e.tearDown&&r.on("beforeDestroy",e.tearDown))})})}function getDefaultBrowser(){if("object"==typeof window&&isObject(window))return window}function getDefaultLocation(){return getDefaultBrowser()&&window.location}function getDefaultXMLHttpRequest(){if("function"==typeof XMLHttpRequest&&isFunction(XMLHttpRequest))return XMLHttpRequest}function getDefaultNavigator(){if(getDefaultBrowser()&&"navigator"in window)return window.navigator}function getDefaultNetworkInformation(){var e=getDefaultNavigator();if(e)return e.connection||e.mozConnection||e.webkitConnection}function getLocationUrl(){var e=getDefaultBrowser()&&getDefaultLocation();return null==e?void 0:e.href}var captureCurrentContext=function(e){var n={url:getLocationUrl(),timestamp:Date.now()},r=e.config();return null!=r&&r.pid&&(n.pid=r.pid),null!=e&&e.context&&(n.context=e.context.toString()),n},syncReportWithCapturedContext=function(r,t){return function(e){function n(e){return e.overrides=t,e}r.on("report",n),e(),r.off("report",n)}},invokeCallbackOnce=function(n){var r=!1;return[function(e){r||(r=!0,n&&n(e))}]},onPageUnload=function(e){var n=__read(invokeCallbackOnce(e),1)[0];["unload","beforeunload","pagehide"].forEach(function(e){addEventListener(e,n)})},getStorageItem=function(e){try{var n=localStorage.getItem(e),r=n;return r=n&&"string"==typeof n?JSON.parse(n):r}catch(e){return}},setStorageItem=function(e,n){try{var r="string"==typeof n?n:JSON.stringify(n);localStorage.setItem(e,r)}catch(e){}};function getNetworkType(e){return(null==e?void 0:e.effectiveType)||(null==e?void 0:e.type)||""}var InjectNetworkTypePlugin=function(e){var n=getDefaultNetworkInformation(),r=getNetworkType(n);n&&(n.onchange=function(){r=getNetworkType(n)}),e.on("report",function(e){return __assign(__assign({},e),{extra:__assign(__assign({},e.extra||{}),{network_type:r})})})},getBeaconTransport=function(){var r=getDefaultBrowser();return r&&r.navigator.sendBeacon?{get:function(){},post:function(e,n){r.navigator.sendBeacon(e,n)}}:{get:noop,post:noop}},request=function(e,n,r){var t=n.url,o=n.data,i=n.success,a=void 0===i?noop:i,i=n.fail,u=void 0===i?noop:i,i=n.getResponseText,s=void 0===i?noop:i,n=n.withCredentials,n=void 0!==n&&n,r=new r;r.withCredentials=n,r.open(e,t,!0),r.setRequestHeader("Content-Type","application/json"),r.onload=function(){null!=s&&s(this.responseText);try{var e;this.responseText?(e=JSON.parse(this.responseText),a(e)):a({})}catch(e){u(e)}},r.onerror=function(){u(new Error("Network request failed"))},r.onabort=function(){u(new Error("Network request aborted"))},r.send(o)},getXhrTransport=function(){var n=getDefaultXMLHttpRequest();return n?{get:function(e){request("GET",e,n)},post:function(e){request("POST",e,n)}}:{get:noop,post:noop}};function createBrowserSender(e){function n(e){t.post(r.getEndpoint(),stringifyBatch([e]))}var r=createBatchSender(e),t=getBeaconTransport();return onPageUnload(function(){var e=r.getBatchData();e&&(t.post(r.getEndpoint(),e),r.clear()),r.send=n}),r}var browserBuilder={build:function(e){return{ev_type:e.ev_type,payload:e.payload,common:__assign(__assign({},e.extra||{}),e.overrides||{})}}};function normalizeInitConfig(e){var n,r=e.plugins||{};for(n in r)r[n]&&!isObject(r[n])&&(r[n]={});return __assign(__assign({},e),{plugins:r})}function validateInitConfig(e){return isObject(e)&&"aid"in e}function normalizeUserConfig(e){return __assign({},e)}function parseServerConfig(e){if(!e)return{};var n=e.sample,r=e.timestamp,t=e.status;if(!n)return{};var o=n.sample_rate,e=n.sample_granularity;return{sample:{include_users:n.include_users,sample_rate:t&&4===t?0:o,sample_granularity:e,rules:n.rules.reduce(function(e,n){var r=n.name,t=n.enable,o=n.sample_rate,n=n.conditional_sample_rules;return e[r]={enable:t,sample_rate:o,conditional_sample_rules:n},e},{})},serverTimestamp:r}}var REPORT_DOMAIN="apmplus.volces.com",SDK_VERSION="1.6.0",SDK_NAME="APM_PLUS_WEB",SETTINGS_PATH="/settings/get/webpro",BATCH_REPORT_PATH="/monitor_web/collect",STORAGE_PREFIX="APMPLUS",DEFAULT_IGNORE_PATHS=[BATCH_REPORT_PATH,SETTINGS_PATH,"/monitor_browser/collect"],DEFAULT_SAMPLE_CONFIG={sample_rate:1,include_users:[],sample_granularity:"session",rules:{}},DEFAULT_SENDER_SIZE=20,getReportUrl=function(e,n){return void 0===n&&(n=BATCH_REPORT_PATH),(e&&0<=e.indexOf("//")?"":"https://")+e+n},getSettingsUrl=function(e,n){return void 0===n&&(n=SETTINGS_PATH),(e&&0<=e.indexOf("//")?"":"https://")+e+n},getViewId=function(e){return e+"_"+Date.now()},getDefaultSessionId=function(){return uuid()},getStorageKey=function(e){return STORAGE_PREFIX+e},getStoreInfo=function(e){e=getStorageKey(e);return getStorageItem(e)||{userId:uuid(),deviceId:uuid(),r:Math.random()}},saveStoreInfo=function(e){var n=e.aid,r=e.userId,t=e.deviceId,e=e.sample,n=getStorageKey(n);setStorageItem(n,{userId:r,deviceId:t,r:e.r})},createBrowserConfigManager=function(n){var r,t,o,i=n,a={},u=noop,s=noop;return{getConfig:function(){return i},setConfig:function(e){return a=__assign(__assign({},a),e||{}),c(),r||(r=e,i.useLocalConfig?(o={},u()):t?f():getServerConfig(i.transport,i.domain,i.aid,function(e){t=e,f()})),i},onChange:function(e){s=e},onReady:function(e){u=function(){!function(){n.userId!==i.userId&&(n.sample.r=Math.random(),c());saveStoreInfo(i)}(),e()},o&&u()}};function c(){var e=__assign(__assign(__assign({},n),o||{}),a);e.plugins=mergeDeepConcatArray(n.plugins,(null==o?void 0:o.plugins)||{},a.plugins||{}),e.sample=mergeSampleConfig(mergeSampleConfig(n.sample,null==o?void 0:o.sample),a.sample),i=e,s()}function f(){o=parseServerConfig(t),c(),u()}};function getServerConfig(e,n,r,t){e.get({withCredentials:!0,url:getSettingsUrl(n)+"?aid="+r,success:function(e){t(e.data||{})},fail:function(){t()}})}function mergeSampleConfig(t,o){if(!t||!o)return t||o;var e=__assign(__assign({},t),o);return e.include_users=__spreadArray(__spreadArray([],__read(t.include_users||[]),!1),__read(o.include_users||[]),!1),e.rules=__spreadArray(__spreadArray([],__read(Object.keys(t.rules||{})),!1),__read(Object.keys(o.rules||{})),!1).reduce(function(e,n){var r;return n in e||(n in(t.rules||{})&&n in(o.rules||{})?(e[n]=__assign(__assign({},t.rules[n]),o.rules[n]),e[n].conditional_sample_rules=__spreadArray(__spreadArray([],__read(t.rules[n].conditional_sample_rules||[]),!1),__read(o.rules[n].conditional_sample_rules||[]),!1)):e[n]=(null===(r=t.rules)||void 0===r?void 0:r[n])||(null===(r=o.rules)||void 0===r?void 0:r[n])),e},{}),e}var addEnvToSendEvent=function(e){var n={url:getLocationUrl(),timestamp:Date.now()};return __assign(__assign({},e),{extra:__assign(__assign({},n),e.extra||{})})},InjectEnvPlugin=function(e){e.on("report",function(e){return addEnvToSendEvent(e)})},MAX_RTT=700,TimeCalibrationPlugin=function(r){var t,o=!1;r.on("init",function(){t=(new Date).getTime(),r.on("config",function(){var e,n=null===(e=r.config())||void 0===e?void 0:e.serverTimestamp;isNaN(n)||Number(n)<=0||o||(o=!0,(e=(new Date).getTime())-t<MAX_RTT&&n&&(e=n-(e+t)/2,!isNaN(e)&&(0<e||e<-6e5)&&r.set({offset:e})))})})},addConfigToReportEvent=function(e,n){var r={};return r.aid=n.aid,r.pid=n.pid,r.view_id=n.viewId,r.user_id=n.userId,__assign(__assign({},e),{extra:__assign(__assign({},r),e.extra||{})})},InjectConfigPlugin=function(n){n.on("beforeBuild",function(e){return addConfigToReportEvent(e,n.config())})},InjectQueryPlugin=function(u){u.on("start",function(){var e=u.config(),n=e.deviceId,r=e.sessionId,t=e.release,o=e.env,i=e.offset,a=e.aid,e=e.token,a={did:n,sid:r,release:t,env:o,sname:SDK_NAME,sversion:SDK_VERSION,soffset:i||0,biz_id:a,x_auth_token:e},e=u.getSender();e.setEndpoint(e.getEndpoint()+joinQueryWithMap(a))})},getDefaultConfig=function(e){e=getStoreInfo(e.aid);return{aid:0,pid:"",token:"",viewId:getViewId("_"),userId:e.userId,deviceId:e.deviceId,sessionId:getDefaultSessionId(),domain:REPORT_DOMAIN,plugins:{ajax:{ignoreUrls:DEFAULT_IGNORE_PATHS},fetch:{ignoreUrls:DEFAULT_IGNORE_PATHS},breadcrumb:{},pageview:{},jsError:{},resource:{},resourceError:{},performance:{},tti:{},fmp:{},blankScreen:!1},release:"",env:"production",sample:__assign(__assign({},DEFAULT_SAMPLE_CONFIG),{r:e.r}),transport:getXhrTransport()}},createMinimalBrowserClient=function(e){var n=void 0===e?{}:e,r=n.createSender,e=n.builder,n=n.createDefaultConfig,t=createClient({validateInitConfig:validateInitConfig,initConfigNormalizer:normalizeInitConfig,userConfigNormalizer:normalizeUserConfig,createSender:void 0===r?function(e){return createBrowserSender({size:DEFAULT_SENDER_SIZE,endpoint:getReportUrl(e.domain),transport:e.transport})}:r,builder:void 0===e?browserBuilder:e,createDefaultConfig:void 0===n?getDefaultConfig:n,createConfigManager:createBrowserConfigManager});ContextPlugin(t),TimeCalibrationPlugin(t),InjectConfigPlugin(t),InjectEnvPlugin(t),InjectNetworkTypePlugin(t),InjectQueryPlugin(t);n=withCommandArray(t,captureCurrentContext,function(e,n,r){return syncReportWithCapturedContext(e,n)(function(){var e=__read(r),n=e[0],e=e.slice(1);t[n].apply(t,__spreadArray([],__read(e),!1))})});return IntegrationPlugin(n),n};export{createMinimalBrowserClient,getDefaultConfig}; | ||
var __assign=function(){return(__assign=Object.assign||function(e){for(var n,r=1,t=arguments.length;r<t;r++)for(var o in n=arguments[r])Object.prototype.hasOwnProperty.call(n,o)&&(e[o]=n[o]);return e}).apply(this,arguments)};function __read(e,n){var r="function"==typeof Symbol&&e[Symbol.iterator];if(!r)return e;var t,o,i=r.call(e),a=[];try{for(;(void 0===n||0<n--)&&!(t=i.next()).done;)a.push(t.value)}catch(e){o={error:e}}finally{try{t&&!t.done&&(r=i.return)&&r.call(i)}finally{if(o)throw o.error}}return a}function __spreadArray(e,n,r){if(r||2===arguments.length)for(var t,o=0,i=n.length;o<i;o++)!t&&o in n||((t=t||Array.prototype.slice.call(n,0,o))[o]=n[o]);return e.concat(t||Array.prototype.slice.call(n))}var DEFAULT_SIZE=10,DEFAULT_WAIT=1e3,stringifyBatch=function(e){return JSON.stringify({ev_type:"batch",list:e})};function createBatchSender(e){var n=e.transport,r=e.endpoint,t=e.size,o=void 0===t?DEFAULT_SIZE:t,e=e.wait,i=void 0===e?DEFAULT_WAIT:e,a=[],u=0;function s(){a.length&&(n.post({url:r,data:this.getBatchData()}),a=[])}return{getSize:function(){return o},getWait:function(){return i},setSize:function(e){o=e},setWait:function(e){i=e},getEndpoint:function(){return r},setEndpoint:function(e){r=e},send:function(e){a.push(e),a.length>=o&&s.call(this),clearTimeout(u),u=setTimeout(s.bind(this),i)},flush:function(){clearTimeout(u),s.call(this)},getBatchData:function(){return a.length?stringifyBatch(a):""},clear:function(){clearTimeout(u),a=[]}}}var EVENTS=["init","start","config","beforeDestroy","provide","beforeReport","report","beforeBuild","build","beforeSend","send","beforeConfig"],noop=function(){return{}};function isObject(e){return"object"==typeof e&&null!==e}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 hasKey(e,n){return Object.prototype.hasOwnProperty.call(e,n)}function mergeDeepConcatArray(){for(var e=[],n=0;n<arguments.length;n++)e[n]=arguments[n];for(var r={},t=0;t<e.length;)r=_mergeDeepMergeArray(r,e[t++]);return r}function _mergeDeepMergeArray(e,n){var r,t=__assign({},e);for(r in n)hasKey(n,r)&&void 0!==n[r]&&(isObject(n[r])&&isPlainObject(n[r])?t[r]=_mergeDeepMergeArray(isObject(e[r])?e[r]:{},n[r]):isArray(n[r])&&isArray(e[r])?t[r]=_mergeDeepArray(e[r],n[r]):t[r]=n[r]);return t}function _mergeDeepArray(e,n){e=isArray(e)?e:[],n=isArray(n)?n:[];return Array.prototype.concat.call(e,n).map(function(e){return e instanceof RegExp?e:isObject(e)&&isPlainObject(e)?_mergeDeepMergeArray({},e):isArray(e)?_mergeDeepArray([],e):e})}function arrayIncludes(e,n){if(!isArray(e))return!1;if(0===e.length)return!1;for(var r=0;r<e.length;){if(e[r]===n)return!0;r++}return!1}var arrayRemove=function(e,n){if(!isArray(e))return e;var r=e.indexOf(n);if(0<=r){n=e.slice();return n.splice(r,1),n}return e},safeVisit=function(e,n,r){for(var t,n=__read(n.split(".")),o=n[0],i=n.slice(1);e&&0<i.length;)e=e[o],o=(t=__read(i))[0],i=t.slice(1);if(e)return r(e,o)},safeCall=function(e,n,r){return safeVisit(e,n,function(e,n){if(e&&n in e&&isFunction(e[n]))try{return e[n].apply(e,r)}catch(e){return}})};function safeStringify(e){try{return isString(e)?e:JSON.stringify(e)}catch(e){return"[FAILED_TO_STRINGIFY]:"+String(e)}}var joinQueryWithMap=function(r){return isObject(r)?Object.keys(r).reduce(function(e,n){return e+="&"+n+"="+r[n]},"").replace("&","?"):""};function createContextAgent(){var r={},t={},o={set:function(e,n){return r[e]=n,t[e]=safeStringify(n),o},merge:function(n){return r=__assign(__assign({},r),n),Object.keys(n).forEach(function(e){t[e]=safeStringify(n[e])}),o},delete:function(e){return delete r[e],delete t[e],o},clear:function(){return r={},t={},o},get:function(e){return t[e]},toString:function(){return __assign({},t)}};return o}var hookObjectProperty=function(i,a,u,s){return void 0===s&&(s=!0),function(){for(var e=[],n=0;n<arguments.length;n++)e[n]=arguments[n];if(!i)return noop;var r=i[a],t=u.apply(void 0,__spreadArray([r],__read(e),!1)),o=t;return isFunction(o)&&s&&(o=function(){for(var n=[],e=0;e<arguments.length;e++)n[e]=arguments[e];try{return t.apply(this,n)}catch(e){return isFunction(r)&&r.apply(this,n)}}),i[a]=o,function(e){e||(o===i[a]?i[a]=r:t=r)}}},errCount=0,error=function(){for(var e=[],n=0;n<arguments.length;n++)e[n]=arguments[n];console.error.apply(console,__spreadArray(["[SDK]",Date.now(),(""+errCount++).padStart(8," ")],__read(e),!1))},warnCount=0,warn=function(){for(var e=[],n=0;n<arguments.length;n++)e[n]=arguments[n];console.warn.apply(console,__spreadArray(["[SDK]",Date.now(),(""+warnCount++).padStart(8," ")],__read(e),!1))},runProcessors=function(t){return function(e){for(var n=e,r=0;r<t.length&&n;r++)try{n=t[r](n)}catch(e){error(e)}return n}};function mathRNG(){for(var e=new Array(16),n=0,r=0;r<16;r++)0==(3&r)&&(n=4294967296*Math.random()),e[r]=n>>>((3&r)<<3)&255;return e}function bytesToUuid(e){for(var n=[],r=0;r<256;++r)n[r]=(r+256).toString(16).substr(1);var t=0,o=n;return[o[e[t++]],o[e[t++]],o[e[t++]],o[e[t++]],"-",o[e[t++]],o[e[t++]],"-",o[e[t++]],o[e[t++]],"-",o[e[t++]],o[e[t++]],"-",o[e[t++]],o[e[t++]],o[e[t++]],o[e[t++]],o[e[+t]],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,n,r){var t=0;return function(){if(e())return t&&clearTimeout(t),void(t=0);0===t&&(t=setTimeout(n,r))}},nextLink=function(t,e){var n=e.reduce(function(e,n){try{var r=n(t);"function"==typeof r&&e.push(r)}catch(e){}return e},[]);return function(e){return nextLink(e,n)}},toObservable=function(e){function n(e){t=arrayRemove(t,e),i||a()}var r,t=[],o=[],i=!1,a=applyBufferTimer(function(){return!!t.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,t)},complete:function(e){o.push(e)},attach:function(e,n){r=[e,n]},subscribe:function(e){if(i)throw new Error("Observer is closed");return t.push(e),r&&r[1]&&r[1](e),a(),function(){return n(e)}},unsubscribe:n}},createSafeObserver=function(e,n){var r=toObservable();try{e(r.next,r.attach),n&&r.complete(n)}catch(e){}return[r.subscribe,r.unsubscribe]};function createClient(e){var r,t,n=e.builder,o=e.createSender,i=e.createDefaultConfig,a=e.createConfigManager,u=e.userConfigNormalizer,s=e.initConfigNormalizer,c=e.validateInitConfig,f={};EVENTS.forEach(function(e){return f[e]=[]});var l=!1,g=!1,d=!1,p=[],_=[],v={getBuilder:function(){return n},getSender:function(){return r},getPreStartQueue:function(){return p},init:function(e){if(l)warn("already inited");else{if(!(e&&isObject(e)&&c(e)))throw new Error("invalid InitConfig, init failed");var n=i(e);if(!n)throw new Error("defaultConfig missing");e=s(e);if((t=a(n)).setConfig(e),t.onChange(function(){y("config")}),!(r=o(t.getConfig())))throw new Error("sender missing");y("init",l=!0)}},set:function(e){l&&e&&isObject(e)&&(y("beforeConfig",!1,e),null!=t&&t.setConfig(e))},config:function(e){if(l)return e&&isObject(e)&&(y("beforeConfig",!1,e),null!=t&&t.setConfig(u(e))),null==t?void 0:t.getConfig()},provide:function(e,n){arrayIncludes(_,e)?warn("cannot provide "+e+", reserved"):(v[e]=n,y("provide",!1,e))},start:function(){var n=this;l&&(g||null!=t&&t.onReady(function(){y("start",g=!0),p.forEach(function(e){return n.build(e)}),p=[]}))},report:function(e){e&&(!(e=runProcessors(f.beforeReport)(e))||(e=runProcessors(f.report)(e))&&(g?this.build(e):p.push(e)))},build:function(e){!g||(e=runProcessors(f.beforeBuild)(e))&&(!(e=n.build(e))||(e=runProcessors(f.build)(e))&&this.send(e))},send:function(e){!g||(e=runProcessors(f.beforeSend)(e))&&(r.send(e),y("send",!1,e))},destroy:function(){y("beforeDestroy",d=!0)},on:function(e,n){"init"===e&&l||"start"===e&&g||"beforeDestroy"===e&&d?n():f[e]&&f[e].push(n)},off:function(e,n){f[e]&&(f[e]=arrayRemove(f[e],n))}},_=Object.keys(v);return v;function y(e,n){void 0===n&&(n=!1);for(var r=[],t=2;t<arguments.length;t++)r[t-2]=arguments[t];f[e].forEach(function(e){try{e.apply(void 0,__spreadArray([],__read(r),!1))}catch(e){}}),n&&(f[e].length=0)}}var ContextPlugin=function(e){var n=createContextAgent();e.provide("context",n),e.on("report",function(e){return e.extra||(e.extra={}),e.extra.context=n.toString(),e})},withCommandArray=function(i,a,r){function u(){for(var e=[],n=0;n<arguments.length;n++)e[n]=arguments[n];if(o=e[0]){var r=o.split(".")[0];if(r in u)return safeCall(u,o,[].slice.call(e,1));var t=s[r]||[],o=null!==(o=null==a?void 0:a(i))&&void 0!==o?o:{};t.push(__spreadArray([o],__read(e),!1)),void(s[r]=t)}}var e,s={};for(e in hookObjectProperty(i,"provide",function(r){return function(e,n){u[e]=n,r.call(i,e,n)}})(),i)Object.prototype.hasOwnProperty.call(i,e)&&(u[e]=i[e]);return i.on("provide",function(e){s[e]&&(s[e].forEach(function(e){var n=__read(e),e=n[0],n=n.slice(1);null!=r&&r(i,e,n)}),s[e]=null)}),u};function IntegrationPlugin(r){r.on("init",function(){var n=[],e=r.config();e&&e.integrations&&e.integrations.forEach(function(e){arrayIncludes(n,e.name)||(n.push(e.name),e.setup(r),e.tearDown&&r.on("beforeDestroy",e.tearDown))})})}function SubjectPlugin(e,n){var r=n||{};e.provide("initSubject",function(e){var e=__read(e,2),n=e[0],e=e[1];return r[n]||(r[n]=createSafeObserver(e,function(){r[n]=void 0})),r[n]}),e.provide("getSubject",function(e){return r[e]})}function getDefaultBrowser(){if("object"==typeof window&&isObject(window))return window}function getDefaultLocation(){return getDefaultBrowser()&&window.location}function getDefaultXMLHttpRequest(){if("function"==typeof XMLHttpRequest&&isFunction(XMLHttpRequest))return XMLHttpRequest}function getDefaultNavigator(){if(getDefaultBrowser()&&"navigator"in window)return window.navigator}function getDefaultNetworkInformation(){var e=getDefaultNavigator();if(e)return e.connection||e.mozConnection||e.webkitConnection}var getGlobalRegistry=function(e){if(e)return e.__SLARDAR_REGISTRY__||(e.__SLARDAR_REGISTRY__={Slardar:{plugins:[],errors:[],subject:{}}}),e.__SLARDAR_REGISTRY__.Slardar},now=function(){return Date.now()};function getLocationUrl(){var e=getDefaultBrowser()&&getDefaultLocation();return null==e?void 0:e.href}var captureCurrentContext=function(e){var n={url:getLocationUrl(),timestamp:now()},r=e.config();return null!=r&&r.pid&&(n.pid=r.pid),null!=e&&e.context&&(n.context=e.context.toString()),n},syncReportWithCapturedContext=function(r,t){return function(e){function n(e){return e.overrides=t,e}r.on("report",n),e(),r.off("report",n)}},invokeCallbackOnce=function(n){var r=!1;return[function(e){r||(r=!0,n&&n(e))}]},onPageUnload=function(e){var n=__read(invokeCallbackOnce(e),1)[0];["unload","beforeunload","pagehide"].forEach(function(e){addEventListener(e,n)})},getStorageItem=function(e){try{var n=localStorage.getItem(e),r=n;return r=n&&"string"==typeof n?JSON.parse(n):r}catch(e){return}},setStorageItem=function(e,n){try{var r="string"==typeof n?n:JSON.stringify(n);localStorage.setItem(e,r)}catch(e){}};function getNetworkType(e){return(null==e?void 0:e.effectiveType)||(null==e?void 0:e.type)||""}var InjectNetworkTypePlugin=function(e){var n=getDefaultNetworkInformation(),r=getNetworkType(n);n&&(n.onchange=function(){r=getNetworkType(n)}),e.on("report",function(e){return __assign(__assign({},e),{extra:__assign(__assign({},e.extra||{}),{network_type:r})})})},getBeaconTransport=function(){var r=getDefaultBrowser();return r&&r.navigator.sendBeacon?{get:function(){},post:function(e,n){r.navigator.sendBeacon(e,n)}}:{get:noop,post:noop}},request=function(e,n,r){var t=n.url,o=n.data,i=n.success,a=void 0===i?noop:i,i=n.fail,u=void 0===i?noop:i,i=n.getResponseText,s=void 0===i?noop:i,n=n.withCredentials,n=void 0!==n&&n,r=new r;r.withCredentials=n,r.open(e,t,!0),r.setRequestHeader("Content-Type","application/json"),r.onload=function(){null!=s&&s(this.responseText);try{var e;this.responseText?(e=JSON.parse(this.responseText),a(e)):a({})}catch(e){u(e)}},r.onerror=function(){u(new Error("Network request failed"))},r.onabort=function(){u(new Error("Network request aborted"))},r.send(o)},getXhrTransport=function(){var n=getDefaultXMLHttpRequest();return n?{get:function(e){request("GET",e,n)},post:function(e){request("POST",e,n)}}:{get:noop,post:noop}};function createBrowserSender(e){function n(e){t.post(r.getEndpoint(),stringifyBatch([e]))}var r=createBatchSender(e),t=getBeaconTransport();return onPageUnload(function(){var e=r.getBatchData();e&&(t.post(r.getEndpoint(),e),r.clear()),r.send=n}),r}var browserBuilder={build:function(e){return{ev_type:e.ev_type,payload:e.payload,common:__assign(__assign({},e.extra||{}),e.overrides||{})}}};function normalizeInitConfig(e){var n,r=e.plugins||{};for(n in r)r[n]&&!isObject(r[n])&&(r[n]={});return __assign(__assign({},e),{plugins:r})}function validateInitConfig(e){return isObject(e)&&"aid"in e}function normalizeUserConfig(e){return __assign({},e)}function parseServerConfig(e){if(!e)return{};var n=e.sample,r=e.timestamp,t=e.status;if(!n)return{};var o=n.sample_rate,e=n.sample_granularity;return{sample:{include_users:n.include_users,sample_rate:t&&4===t?0:o,sample_granularity:e,rules:n.rules.reduce(function(e,n){var r=n.name,t=n.enable,o=n.sample_rate,n=n.conditional_sample_rules;return e[r]={enable:t,sample_rate:o,conditional_sample_rules:n},e},{})},serverTimestamp:r}}var REPORT_DOMAIN="apmplus.volces.com",SDK_VERSION="1.7.0",SDK_NAME="APM_PLUS_WEB",SETTINGS_PATH="/settings/get/webpro",BATCH_REPORT_PATH="/monitor_web/collect",STORAGE_PREFIX="APMPLUS",DEFAULT_IGNORE_PATHS=[BATCH_REPORT_PATH,SETTINGS_PATH,"/monitor_browser/collect"],DEFAULT_SAMPLE_CONFIG={sample_rate:1,include_users:[],sample_granularity:"session",rules:{}},DEFAULT_SENDER_SIZE=20,getReportUrl=function(e,n){return void 0===n&&(n=BATCH_REPORT_PATH),(e&&0<=e.indexOf("//")?"":"https://")+e+n},getSettingsUrl=function(e,n){return void 0===n&&(n=SETTINGS_PATH),(e&&0<=e.indexOf("//")?"":"https://")+e+n},getViewId=function(e){return e+"_"+Date.now()},getDefaultSessionId=function(){return uuid()},getStorageKey=function(e){return STORAGE_PREFIX+e},getStoreInfo=function(e){e=getStorageKey(e);return getStorageItem(e)||{userId:uuid(),deviceId:uuid(),r:Math.random()}},saveStoreInfo=function(e){var n=e.aid,r=e.userId,t=e.deviceId,e=e.sample,n=getStorageKey(n);setStorageItem(n,{userId:r,deviceId:t,r:e.r})},createBrowserConfigManager=function(n){var r,t,o,i=n,a={},u=noop,s=noop;return{getConfig:function(){return i},setConfig:function(e){return a=__assign(__assign({},a),e||{}),c(),r||(r=e,i.useLocalConfig?(o={},u()):t?f():getServerConfig(i.transport,i.domain,i.aid,function(e){t=e,f()})),i},onChange:function(e){s=e},onReady:function(e){u=function(){!function(){n.userId!==i.userId&&(n.sample.r=Math.random(),c());saveStoreInfo(i)}(),e()},o&&u()}};function c(){var e=__assign(__assign(__assign({},n),o||{}),a);e.plugins=mergeDeepConcatArray(n.plugins,(null==o?void 0:o.plugins)||{},a.plugins||{}),e.sample=mergeSampleConfig(mergeSampleConfig(n.sample,null==o?void 0:o.sample),a.sample),i=e,s()}function f(){o=parseServerConfig(t),c(),u()}};function getServerConfig(e,n,r,t){e.get({withCredentials:!0,url:getSettingsUrl(n)+"?aid="+r,success:function(e){t(e.data||{})},fail:function(){t()}})}function mergeSampleConfig(t,o){if(!t||!o)return t||o;var e=__assign(__assign({},t),o);return e.include_users=__spreadArray(__spreadArray([],__read(t.include_users||[]),!1),__read(o.include_users||[]),!1),e.rules=__spreadArray(__spreadArray([],__read(Object.keys(t.rules||{})),!1),__read(Object.keys(o.rules||{})),!1).reduce(function(e,n){var r;return n in e||(n in(t.rules||{})&&n in(o.rules||{})?(e[n]=__assign(__assign({},t.rules[n]),o.rules[n]),e[n].conditional_sample_rules=__spreadArray(__spreadArray([],__read(t.rules[n].conditional_sample_rules||[]),!1),__read(o.rules[n].conditional_sample_rules||[]),!1)):e[n]=(null===(r=t.rules)||void 0===r?void 0:r[n])||(null===(r=o.rules)||void 0===r?void 0:r[n])),e},{}),e}var addEnvToSendEvent=function(e){var n={url:getLocationUrl(),timestamp:Date.now()};return __assign(__assign({},e),{extra:__assign(__assign({},n),e.extra||{})})},InjectEnvPlugin=function(e){e.on("report",function(e){return addEnvToSendEvent(e)})},MAX_RTT=700,TimeCalibrationPlugin=function(r){var t,o=!1;r.on("init",function(){t=(new Date).getTime(),r.on("config",function(){var e,n=null===(e=r.config())||void 0===e?void 0:e.serverTimestamp;isNaN(n)||Number(n)<=0||o||(o=!0,(e=(new Date).getTime())-t<MAX_RTT&&n&&(e=n-(e+t)/2,!isNaN(e)&&(0<e||e<-6e5)&&r.set({offset:e})))})})},addConfigToReportEvent=function(e,n){var r={};return r.aid=n.aid,r.pid=n.pid,r.view_id=n.viewId,r.user_id=n.userId,__assign(__assign({},e),{extra:__assign(__assign({},r),e.extra||{})})},InjectConfigPlugin=function(n){n.on("beforeBuild",function(e){return addConfigToReportEvent(e,n.config())})},InjectQueryPlugin=function(u){u.on("start",function(){var e=u.config(),n=e.deviceId,r=e.sessionId,t=e.release,o=e.env,i=e.offset,a=e.aid,e=e.token,a={did:n,sid:r,release:t,env:o,sname:SDK_NAME,sversion:SDK_VERSION,soffset:i||0,biz_id:a,x_auth_token:e},e=u.getSender();e.setEndpoint(e.getEndpoint()+joinQueryWithMap(a))})},getDefaultConfig=function(e){e=getStoreInfo(e.aid);return{aid:0,pid:"",token:"",viewId:getViewId("_"),userId:e.userId,deviceId:e.deviceId,sessionId:getDefaultSessionId(),domain:REPORT_DOMAIN,plugins:{ajax:{ignoreUrls:DEFAULT_IGNORE_PATHS},fetch:{ignoreUrls:DEFAULT_IGNORE_PATHS},breadcrumb:{},pageview:{},jsError:{},resource:{},resourceError:{},performance:{},tti:{},fmp:{},blankScreen:!1},release:"",env:"production",sample:__assign(__assign({},DEFAULT_SAMPLE_CONFIG),{r:e.r}),transport:getXhrTransport()}},createMinimalBrowserClient=function(e){var n=void 0===e?{}:e,r=n.createSender,e=n.builder,n=n.createDefaultConfig,t=createClient({validateInitConfig:validateInitConfig,initConfigNormalizer:normalizeInitConfig,userConfigNormalizer:normalizeUserConfig,createSender:void 0===r?function(e){return createBrowserSender({size:DEFAULT_SENDER_SIZE,endpoint:getReportUrl(e.domain),transport:e.transport})}:r,builder:void 0===e?browserBuilder:e,createDefaultConfig:void 0===n?getDefaultConfig:n,createConfigManager:createBrowserConfigManager});ContextPlugin(t);n=getGlobalRegistry(getDefaultBrowser());SubjectPlugin(t,n&&n.subject),TimeCalibrationPlugin(t),InjectConfigPlugin(t),InjectEnvPlugin(t),InjectNetworkTypePlugin(t),InjectQueryPlugin(t);n=withCommandArray(t,captureCurrentContext,function(e,n,r){return syncReportWithCapturedContext(e,n)(function(){var e=__read(r),n=e[0],e=e.slice(1);t[n].apply(t,__spreadArray([],__read(e),!1))})});return IntegrationPlugin(n),n};export{createMinimalBrowserClient,getDefaultConfig}; |
@@ -1,1 +0,1 @@ | ||
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var __assign=function(){return(__assign=Object.assign||function(e){for(var n,r=1,t=arguments.length;r<t;r++)for(var o in n=arguments[r])Object.prototype.hasOwnProperty.call(n,o)&&(e[o]=n[o]);return e}).apply(this,arguments)};function __read(e,n){var r="function"==typeof Symbol&&e[Symbol.iterator];if(!r)return e;var t,o,i=r.call(e),a=[];try{for(;(void 0===n||0<n--)&&!(t=i.next()).done;)a.push(t.value)}catch(e){o={error:e}}finally{try{t&&!t.done&&(r=i.return)&&r.call(i)}finally{if(o)throw o.error}}return a}function __spreadArray(e,n,r){if(r||2===arguments.length)for(var t,o=0,i=n.length;o<i;o++)!t&&o in n||((t=t||Array.prototype.slice.call(n,0,o))[o]=n[o]);return e.concat(t||Array.prototype.slice.call(n))}var DEFAULT_SIZE=10,DEFAULT_WAIT=1e3,stringifyBatch=function(e){return JSON.stringify({ev_type:"batch",list:e})};function createBatchSender(e){var n=e.transport,r=e.endpoint,t=e.size,o=void 0===t?DEFAULT_SIZE:t,e=e.wait,i=void 0===e?DEFAULT_WAIT:e,a=[],u=0;function s(){a.length&&(n.post({url:r,data:this.getBatchData()}),a=[])}return{getSize:function(){return o},getWait:function(){return i},setSize:function(e){o=e},setWait:function(e){i=e},getEndpoint:function(){return r},setEndpoint:function(e){r=e},send:function(e){a.push(e),a.length>=o&&s.call(this),clearTimeout(u),u=setTimeout(s.bind(this),i)},flush:function(){clearTimeout(u),s.call(this)},getBatchData:function(){return a.length?stringifyBatch(a):""},clear:function(){clearTimeout(u),a=[]}}}var EVENTS=["init","start","config","beforeDestroy","provide","beforeReport","report","beforeBuild","build","beforeSend","send","beforeConfig"],noop=function(){return{}};function isObject(e){return"object"==typeof e&&null!==e}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 hasKey(e,n){return Object.prototype.hasOwnProperty.call(e,n)}function mergeDeepConcatArray(){for(var e=[],n=0;n<arguments.length;n++)e[n]=arguments[n];for(var r={},t=0;t<e.length;)r=_mergeDeepMergeArray(r,e[t++]);return r}function _mergeDeepMergeArray(e,n){var r,t=__assign({},e);for(r in n)hasKey(n,r)&&void 0!==n[r]&&(isObject(n[r])&&isPlainObject(n[r])?t[r]=_mergeDeepMergeArray(isObject(e[r])?e[r]:{},n[r]):isArray(n[r])&&isArray(e[r])?t[r]=_mergeDeepArray(e[r],n[r]):t[r]=n[r]);return t}function _mergeDeepArray(e,n){e=isArray(e)?e:[],n=isArray(n)?n:[];return Array.prototype.concat.call(e,n).map(function(e){return e instanceof RegExp?e:isObject(e)&&isPlainObject(e)?_mergeDeepMergeArray({},e):isArray(e)?_mergeDeepArray([],e):e})}function arrayIncludes(e,n){if(!isArray(e))return!1;if(0===e.length)return!1;for(var r=0;r<e.length;){if(e[r]===n)return!0;r++}return!1}var arrayRemove=function(e,n){if(!isArray(e))return e;var r=e.indexOf(n);if(0<=r){n=e.slice();return n.splice(r,1),n}return e},safeVisit=function(e,n,r){for(var t,n=__read(n.split(".")),o=n[0],i=n.slice(1);e&&0<i.length;)e=e[o],o=(t=__read(i))[0],i=t.slice(1);if(e)return r(e,o)},safeCall=function(e,n,r){return safeVisit(e,n,function(e,n){if(e&&n in e&&isFunction(e[n]))try{return e[n].apply(e,r)}catch(e){return}})};function safeStringify(e){try{return isString(e)?e:JSON.stringify(e)}catch(e){return"[FAILED_TO_STRINGIFY]:"+String(e)}}var joinQueryWithMap=function(r){return isObject(r)?Object.keys(r).reduce(function(e,n){return e+="&"+n+"="+r[n]},"").replace("&","?"):""};function createContextAgent(){var r={},t={},o={set:function(e,n){return r[e]=n,t[e]=safeStringify(n),o},merge:function(n){return r=__assign(__assign({},r),n),Object.keys(n).forEach(function(e){t[e]=safeStringify(n[e])}),o},delete:function(e){return delete r[e],delete t[e],o},clear:function(){return r={},t={},o},get:function(e){return t[e]},toString:function(){return __assign({},t)}};return o}var hookObjectProperty=function(i,a,u,s){return void 0===s&&(s=!0),function(){for(var e=[],n=0;n<arguments.length;n++)e[n]=arguments[n];if(!i)return noop;var r=i[a],t=u.apply(void 0,__spreadArray([r],__read(e),!1)),o=t;return isFunction(o)&&s&&(o=function(){for(var n=[],e=0;e<arguments.length;e++)n[e]=arguments[e];try{return t.apply(this,n)}catch(e){return isFunction(r)&&r.apply(this,n)}}),i[a]=o,function(e){e||(o===i[a]?i[a]=r:t=r)}}},errCount=0,error=function(){for(var e=[],n=0;n<arguments.length;n++)e[n]=arguments[n];console.error.apply(console,__spreadArray(["[SDK]",Date.now(),(""+errCount++).padStart(8," ")],__read(e),!1))},warnCount=0,warn=function(){for(var e=[],n=0;n<arguments.length;n++)e[n]=arguments[n];console.warn.apply(console,__spreadArray(["[SDK]",Date.now(),(""+warnCount++).padStart(8," ")],__read(e),!1))},runProcessors=function(t){return function(e){for(var n=e,r=0;r<t.length&&n;r++)try{n=t[r](n)}catch(e){error(e)}return n}};function mathRNG(){for(var e=new Array(16),n=0,r=0;r<16;r++)0==(3&r)&&(n=4294967296*Math.random()),e[r]=n>>>((3&r)<<3)&255;return e}function bytesToUuid(e){for(var n=[],r=0;r<256;++r)n[r]=(r+256).toString(16).substr(1);var t=0,o=n;return[o[e[t++]],o[e[t++]],o[e[t++]],o[e[t++]],"-",o[e[t++]],o[e[t++]],"-",o[e[t++]],o[e[t++]],"-",o[e[t++]],o[e[t++]],"-",o[e[t++]],o[e[t++]],o[e[t++]],o[e[t++]],o[e[+t]],o[e[15]]].join("")}function uuid(){var e=mathRNG();return e[6]=15&e[6]|64,e[8]=63&e[8]|128,bytesToUuid(e)}function createClient(e){var r,t,n=e.builder,o=e.createSender,i=e.createDefaultConfig,a=e.createConfigManager,u=e.userConfigNormalizer,s=e.initConfigNormalizer,c=e.validateInitConfig,f={};EVENTS.forEach(function(e){return f[e]=[]});var l=!1,g=!1,d=!1,p=[],_=[],v={getBuilder:function(){return n},getSender:function(){return r},getPreStartQueue:function(){return p},init:function(e){if(l)warn("already inited");else{if(!(e&&isObject(e)&&c(e)))throw new Error("invalid InitConfig, init failed");var n=i(e);if(!n)throw new Error("defaultConfig missing");e=s(e);if((t=a(n)).setConfig(e),t.onChange(function(){y("config")}),!(r=o(t.getConfig())))throw new Error("sender missing");y("init",l=!0)}},set:function(e){l&&e&&isObject(e)&&(y("beforeConfig",!1,e),null!=t&&t.setConfig(e))},config:function(e){if(l)return e&&isObject(e)&&(y("beforeConfig",!1,e),null!=t&&t.setConfig(u(e))),null==t?void 0:t.getConfig()},provide:function(e,n){arrayIncludes(_,e)?warn("cannot provide "+e+", reserved"):(v[e]=n,y("provide",!1,e))},start:function(){var n=this;l&&(g||null!=t&&t.onReady(function(){y("start",g=!0),p.forEach(function(e){return n.build(e)}),p=[]}))},report:function(e){e&&(!(e=runProcessors(f.beforeReport)(e))||(e=runProcessors(f.report)(e))&&(g?this.build(e):p.push(e)))},build:function(e){!g||(e=runProcessors(f.beforeBuild)(e))&&(!(e=n.build(e))||(e=runProcessors(f.build)(e))&&this.send(e))},send:function(e){!g||(e=runProcessors(f.beforeSend)(e))&&(r.send(e),y("send",!1,e))},destroy:function(){y("beforeDestroy",d=!0)},on:function(e,n){"init"===e&&l||"start"===e&&g||"beforeDestroy"===e&&d?n():f[e]&&f[e].push(n)},off:function(e,n){f[e]&&(f[e]=arrayRemove(f[e],n))}},_=Object.keys(v);return v;function y(e,n){void 0===n&&(n=!1);for(var r=[],t=2;t<arguments.length;t++)r[t-2]=arguments[t];f[e].forEach(function(e){try{e.apply(void 0,__spreadArray([],__read(r),!1))}catch(e){}}),n&&(f[e].length=0)}}var ContextPlugin=function(e){var n=createContextAgent();e.provide("context",n),e.on("report",function(e){return e.extra||(e.extra={}),e.extra.context=n.toString(),e})},withCommandArray=function(i,a,r){function u(){for(var e=[],n=0;n<arguments.length;n++)e[n]=arguments[n];if(o=e[0]){var r=o.split(".")[0];if(r in u)return safeCall(u,o,[].slice.call(e,1));var t=s[r]||[],o=null!==(o=null==a?void 0:a(i))&&void 0!==o?o:{};t.push(__spreadArray([o],__read(e),!1)),void(s[r]=t)}}var e,s={};for(e in hookObjectProperty(i,"provide",function(r){return function(e,n){u[e]=n,r.call(i,e,n)}})(),i)Object.prototype.hasOwnProperty.call(i,e)&&(u[e]=i[e]);return i.on("provide",function(e){s[e]&&(s[e].forEach(function(e){var n=__read(e),e=n[0],n=n.slice(1);null!=r&&r(i,e,n)}),s[e]=null)}),u};function IntegrationPlugin(r){r.on("init",function(){var n=[],e=r.config();e&&e.integrations&&e.integrations.forEach(function(e){arrayIncludes(n,e.name)||(n.push(e.name),e.setup(r),e.tearDown&&r.on("beforeDestroy",e.tearDown))})})}function getDefaultBrowser(){if("object"==typeof window&&isObject(window))return window}function getDefaultLocation(){return getDefaultBrowser()&&window.location}function getDefaultXMLHttpRequest(){if("function"==typeof XMLHttpRequest&&isFunction(XMLHttpRequest))return XMLHttpRequest}function getDefaultNavigator(){if(getDefaultBrowser()&&"navigator"in window)return window.navigator}function getDefaultNetworkInformation(){var e=getDefaultNavigator();if(e)return e.connection||e.mozConnection||e.webkitConnection}function getLocationUrl(){var e=getDefaultBrowser()&&getDefaultLocation();return null==e?void 0:e.href}var captureCurrentContext=function(e){var n={url:getLocationUrl(),timestamp:Date.now()},r=e.config();return null!=r&&r.pid&&(n.pid=r.pid),null!=e&&e.context&&(n.context=e.context.toString()),n},syncReportWithCapturedContext=function(r,t){return function(e){function n(e){return e.overrides=t,e}r.on("report",n),e(),r.off("report",n)}},invokeCallbackOnce=function(n){var r=!1;return[function(e){r||(r=!0,n&&n(e))}]},onPageUnload=function(e){var n=__read(invokeCallbackOnce(e),1)[0];["unload","beforeunload","pagehide"].forEach(function(e){addEventListener(e,n)})},getStorageItem=function(e){try{var n=localStorage.getItem(e),r=n;return r=n&&"string"==typeof n?JSON.parse(n):r}catch(e){return}},setStorageItem=function(e,n){try{var r="string"==typeof n?n:JSON.stringify(n);localStorage.setItem(e,r)}catch(e){}};function getNetworkType(e){return(null==e?void 0:e.effectiveType)||(null==e?void 0:e.type)||""}var InjectNetworkTypePlugin=function(e){var n=getDefaultNetworkInformation(),r=getNetworkType(n);n&&(n.onchange=function(){r=getNetworkType(n)}),e.on("report",function(e){return __assign(__assign({},e),{extra:__assign(__assign({},e.extra||{}),{network_type:r})})})},getBeaconTransport=function(){var r=getDefaultBrowser();return r&&r.navigator.sendBeacon?{get:function(){},post:function(e,n){r.navigator.sendBeacon(e,n)}}:{get:noop,post:noop}},request=function(e,n,r){var t=n.url,o=n.data,i=n.success,a=void 0===i?noop:i,i=n.fail,u=void 0===i?noop:i,i=n.getResponseText,s=void 0===i?noop:i,n=n.withCredentials,n=void 0!==n&&n,r=new r;r.withCredentials=n,r.open(e,t,!0),r.setRequestHeader("Content-Type","application/json"),r.onload=function(){null!=s&&s(this.responseText);try{var e;this.responseText?(e=JSON.parse(this.responseText),a(e)):a({})}catch(e){u(e)}},r.onerror=function(){u(new Error("Network request failed"))},r.onabort=function(){u(new Error("Network request aborted"))},r.send(o)},getXhrTransport=function(){var n=getDefaultXMLHttpRequest();return n?{get:function(e){request("GET",e,n)},post:function(e){request("POST",e,n)}}:{get:noop,post:noop}};function createBrowserSender(e){function n(e){t.post(r.getEndpoint(),stringifyBatch([e]))}var r=createBatchSender(e),t=getBeaconTransport();return onPageUnload(function(){var e=r.getBatchData();e&&(t.post(r.getEndpoint(),e),r.clear()),r.send=n}),r}var browserBuilder={build:function(e){return{ev_type:e.ev_type,payload:e.payload,common:__assign(__assign({},e.extra||{}),e.overrides||{})}}};function normalizeInitConfig(e){var n,r=e.plugins||{};for(n in r)r[n]&&!isObject(r[n])&&(r[n]={});return __assign(__assign({},e),{plugins:r})}function validateInitConfig(e){return isObject(e)&&"aid"in e}function normalizeUserConfig(e){return __assign({},e)}function parseServerConfig(e){if(!e)return{};var n=e.sample,r=e.timestamp,t=e.status;if(!n)return{};var o=n.sample_rate,e=n.sample_granularity;return{sample:{include_users:n.include_users,sample_rate:t&&4===t?0:o,sample_granularity:e,rules:n.rules.reduce(function(e,n){var r=n.name,t=n.enable,o=n.sample_rate,n=n.conditional_sample_rules;return e[r]={enable:t,sample_rate:o,conditional_sample_rules:n},e},{})},serverTimestamp:r}}var REPORT_DOMAIN="apmplus.volces.com",SDK_VERSION="1.6.0",SDK_NAME="APM_PLUS_WEB",SETTINGS_PATH="/settings/get/webpro",BATCH_REPORT_PATH="/monitor_web/collect",STORAGE_PREFIX="APMPLUS",DEFAULT_IGNORE_PATHS=[BATCH_REPORT_PATH,SETTINGS_PATH,"/monitor_browser/collect"],DEFAULT_SAMPLE_CONFIG={sample_rate:1,include_users:[],sample_granularity:"session",rules:{}},DEFAULT_SENDER_SIZE=20,getReportUrl=function(e,n){return void 0===n&&(n=BATCH_REPORT_PATH),(e&&0<=e.indexOf("//")?"":"https://")+e+n},getSettingsUrl=function(e,n){return void 0===n&&(n=SETTINGS_PATH),(e&&0<=e.indexOf("//")?"":"https://")+e+n},getViewId=function(e){return e+"_"+Date.now()},getDefaultSessionId=function(){return uuid()},getStorageKey=function(e){return STORAGE_PREFIX+e},getStoreInfo=function(e){e=getStorageKey(e);return getStorageItem(e)||{userId:uuid(),deviceId:uuid(),r:Math.random()}},saveStoreInfo=function(e){var n=e.aid,r=e.userId,t=e.deviceId,e=e.sample,n=getStorageKey(n);setStorageItem(n,{userId:r,deviceId:t,r:e.r})},createBrowserConfigManager=function(n){var r,t,o,i=n,a={},u=noop,s=noop;return{getConfig:function(){return i},setConfig:function(e){return a=__assign(__assign({},a),e||{}),c(),r||(r=e,i.useLocalConfig?(o={},u()):t?f():getServerConfig(i.transport,i.domain,i.aid,function(e){t=e,f()})),i},onChange:function(e){s=e},onReady:function(e){u=function(){!function(){n.userId!==i.userId&&(n.sample.r=Math.random(),c());saveStoreInfo(i)}(),e()},o&&u()}};function c(){var e=__assign(__assign(__assign({},n),o||{}),a);e.plugins=mergeDeepConcatArray(n.plugins,(null==o?void 0:o.plugins)||{},a.plugins||{}),e.sample=mergeSampleConfig(mergeSampleConfig(n.sample,null==o?void 0:o.sample),a.sample),i=e,s()}function f(){o=parseServerConfig(t),c(),u()}};function getServerConfig(e,n,r,t){e.get({withCredentials:!0,url:getSettingsUrl(n)+"?aid="+r,success:function(e){t(e.data||{})},fail:function(){t()}})}function mergeSampleConfig(t,o){if(!t||!o)return t||o;var e=__assign(__assign({},t),o);return e.include_users=__spreadArray(__spreadArray([],__read(t.include_users||[]),!1),__read(o.include_users||[]),!1),e.rules=__spreadArray(__spreadArray([],__read(Object.keys(t.rules||{})),!1),__read(Object.keys(o.rules||{})),!1).reduce(function(e,n){var r;return n in e||(n in(t.rules||{})&&n in(o.rules||{})?(e[n]=__assign(__assign({},t.rules[n]),o.rules[n]),e[n].conditional_sample_rules=__spreadArray(__spreadArray([],__read(t.rules[n].conditional_sample_rules||[]),!1),__read(o.rules[n].conditional_sample_rules||[]),!1)):e[n]=(null===(r=t.rules)||void 0===r?void 0:r[n])||(null===(r=o.rules)||void 0===r?void 0:r[n])),e},{}),e}var addEnvToSendEvent=function(e){var n={url:getLocationUrl(),timestamp:Date.now()};return __assign(__assign({},e),{extra:__assign(__assign({},n),e.extra||{})})},InjectEnvPlugin=function(e){e.on("report",function(e){return addEnvToSendEvent(e)})},MAX_RTT=700,TimeCalibrationPlugin=function(r){var t,o=!1;r.on("init",function(){t=(new Date).getTime(),r.on("config",function(){var e,n=null===(e=r.config())||void 0===e?void 0:e.serverTimestamp;isNaN(n)||Number(n)<=0||o||(o=!0,(e=(new Date).getTime())-t<MAX_RTT&&n&&(e=n-(e+t)/2,!isNaN(e)&&(0<e||e<-6e5)&&r.set({offset:e})))})})},addConfigToReportEvent=function(e,n){var r={};return r.aid=n.aid,r.pid=n.pid,r.view_id=n.viewId,r.user_id=n.userId,__assign(__assign({},e),{extra:__assign(__assign({},r),e.extra||{})})},InjectConfigPlugin=function(n){n.on("beforeBuild",function(e){return addConfigToReportEvent(e,n.config())})},InjectQueryPlugin=function(u){u.on("start",function(){var e=u.config(),n=e.deviceId,r=e.sessionId,t=e.release,o=e.env,i=e.offset,a=e.aid,e=e.token,a={did:n,sid:r,release:t,env:o,sname:SDK_NAME,sversion:SDK_VERSION,soffset:i||0,biz_id:a,x_auth_token:e},e=u.getSender();e.setEndpoint(e.getEndpoint()+joinQueryWithMap(a))})},getDefaultConfig=function(e){e=getStoreInfo(e.aid);return{aid:0,pid:"",token:"",viewId:getViewId("_"),userId:e.userId,deviceId:e.deviceId,sessionId:getDefaultSessionId(),domain:REPORT_DOMAIN,plugins:{ajax:{ignoreUrls:DEFAULT_IGNORE_PATHS},fetch:{ignoreUrls:DEFAULT_IGNORE_PATHS},breadcrumb:{},pageview:{},jsError:{},resource:{},resourceError:{},performance:{},tti:{},fmp:{},blankScreen:!1},release:"",env:"production",sample:__assign(__assign({},DEFAULT_SAMPLE_CONFIG),{r:e.r}),transport:getXhrTransport()}},createMinimalBrowserClient=function(e){var n=void 0===e?{}:e,r=n.createSender,e=n.builder,n=n.createDefaultConfig,t=createClient({validateInitConfig:validateInitConfig,initConfigNormalizer:normalizeInitConfig,userConfigNormalizer:normalizeUserConfig,createSender:void 0===r?function(e){return createBrowserSender({size:DEFAULT_SENDER_SIZE,endpoint:getReportUrl(e.domain),transport:e.transport})}:r,builder:void 0===e?browserBuilder:e,createDefaultConfig:void 0===n?getDefaultConfig:n,createConfigManager:createBrowserConfigManager});ContextPlugin(t),TimeCalibrationPlugin(t),InjectConfigPlugin(t),InjectEnvPlugin(t),InjectNetworkTypePlugin(t),InjectQueryPlugin(t);n=withCommandArray(t,captureCurrentContext,function(e,n,r){return syncReportWithCapturedContext(e,n)(function(){var e=__read(r),n=e[0],e=e.slice(1);t[n].apply(t,__spreadArray([],__read(e),!1))})});return IntegrationPlugin(n),n};exports.createMinimalBrowserClient=createMinimalBrowserClient,exports.getDefaultConfig=getDefaultConfig; | ||
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var __assign=function(){return(__assign=Object.assign||function(e){for(var n,r=1,t=arguments.length;r<t;r++)for(var o in n=arguments[r])Object.prototype.hasOwnProperty.call(n,o)&&(e[o]=n[o]);return e}).apply(this,arguments)};function __read(e,n){var r="function"==typeof Symbol&&e[Symbol.iterator];if(!r)return e;var t,o,i=r.call(e),a=[];try{for(;(void 0===n||0<n--)&&!(t=i.next()).done;)a.push(t.value)}catch(e){o={error:e}}finally{try{t&&!t.done&&(r=i.return)&&r.call(i)}finally{if(o)throw o.error}}return a}function __spreadArray(e,n,r){if(r||2===arguments.length)for(var t,o=0,i=n.length;o<i;o++)!t&&o in n||((t=t||Array.prototype.slice.call(n,0,o))[o]=n[o]);return e.concat(t||Array.prototype.slice.call(n))}var DEFAULT_SIZE=10,DEFAULT_WAIT=1e3,stringifyBatch=function(e){return JSON.stringify({ev_type:"batch",list:e})};function createBatchSender(e){var n=e.transport,r=e.endpoint,t=e.size,o=void 0===t?DEFAULT_SIZE:t,e=e.wait,i=void 0===e?DEFAULT_WAIT:e,a=[],u=0;function s(){a.length&&(n.post({url:r,data:this.getBatchData()}),a=[])}return{getSize:function(){return o},getWait:function(){return i},setSize:function(e){o=e},setWait:function(e){i=e},getEndpoint:function(){return r},setEndpoint:function(e){r=e},send:function(e){a.push(e),a.length>=o&&s.call(this),clearTimeout(u),u=setTimeout(s.bind(this),i)},flush:function(){clearTimeout(u),s.call(this)},getBatchData:function(){return a.length?stringifyBatch(a):""},clear:function(){clearTimeout(u),a=[]}}}var EVENTS=["init","start","config","beforeDestroy","provide","beforeReport","report","beforeBuild","build","beforeSend","send","beforeConfig"],noop=function(){return{}};function isObject(e){return"object"==typeof e&&null!==e}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 hasKey(e,n){return Object.prototype.hasOwnProperty.call(e,n)}function mergeDeepConcatArray(){for(var e=[],n=0;n<arguments.length;n++)e[n]=arguments[n];for(var r={},t=0;t<e.length;)r=_mergeDeepMergeArray(r,e[t++]);return r}function _mergeDeepMergeArray(e,n){var r,t=__assign({},e);for(r in n)hasKey(n,r)&&void 0!==n[r]&&(isObject(n[r])&&isPlainObject(n[r])?t[r]=_mergeDeepMergeArray(isObject(e[r])?e[r]:{},n[r]):isArray(n[r])&&isArray(e[r])?t[r]=_mergeDeepArray(e[r],n[r]):t[r]=n[r]);return t}function _mergeDeepArray(e,n){e=isArray(e)?e:[],n=isArray(n)?n:[];return Array.prototype.concat.call(e,n).map(function(e){return e instanceof RegExp?e:isObject(e)&&isPlainObject(e)?_mergeDeepMergeArray({},e):isArray(e)?_mergeDeepArray([],e):e})}function arrayIncludes(e,n){if(!isArray(e))return!1;if(0===e.length)return!1;for(var r=0;r<e.length;){if(e[r]===n)return!0;r++}return!1}var arrayRemove=function(e,n){if(!isArray(e))return e;var r=e.indexOf(n);if(0<=r){n=e.slice();return n.splice(r,1),n}return e},safeVisit=function(e,n,r){for(var t,n=__read(n.split(".")),o=n[0],i=n.slice(1);e&&0<i.length;)e=e[o],o=(t=__read(i))[0],i=t.slice(1);if(e)return r(e,o)},safeCall=function(e,n,r){return safeVisit(e,n,function(e,n){if(e&&n in e&&isFunction(e[n]))try{return e[n].apply(e,r)}catch(e){return}})};function safeStringify(e){try{return isString(e)?e:JSON.stringify(e)}catch(e){return"[FAILED_TO_STRINGIFY]:"+String(e)}}var joinQueryWithMap=function(r){return isObject(r)?Object.keys(r).reduce(function(e,n){return e+="&"+n+"="+r[n]},"").replace("&","?"):""};function createContextAgent(){var r={},t={},o={set:function(e,n){return r[e]=n,t[e]=safeStringify(n),o},merge:function(n){return r=__assign(__assign({},r),n),Object.keys(n).forEach(function(e){t[e]=safeStringify(n[e])}),o},delete:function(e){return delete r[e],delete t[e],o},clear:function(){return r={},t={},o},get:function(e){return t[e]},toString:function(){return __assign({},t)}};return o}var hookObjectProperty=function(i,a,u,s){return void 0===s&&(s=!0),function(){for(var e=[],n=0;n<arguments.length;n++)e[n]=arguments[n];if(!i)return noop;var r=i[a],t=u.apply(void 0,__spreadArray([r],__read(e),!1)),o=t;return isFunction(o)&&s&&(o=function(){for(var n=[],e=0;e<arguments.length;e++)n[e]=arguments[e];try{return t.apply(this,n)}catch(e){return isFunction(r)&&r.apply(this,n)}}),i[a]=o,function(e){e||(o===i[a]?i[a]=r:t=r)}}},errCount=0,error=function(){for(var e=[],n=0;n<arguments.length;n++)e[n]=arguments[n];console.error.apply(console,__spreadArray(["[SDK]",Date.now(),(""+errCount++).padStart(8," ")],__read(e),!1))},warnCount=0,warn=function(){for(var e=[],n=0;n<arguments.length;n++)e[n]=arguments[n];console.warn.apply(console,__spreadArray(["[SDK]",Date.now(),(""+warnCount++).padStart(8," ")],__read(e),!1))},runProcessors=function(t){return function(e){for(var n=e,r=0;r<t.length&&n;r++)try{n=t[r](n)}catch(e){error(e)}return n}};function mathRNG(){for(var e=new Array(16),n=0,r=0;r<16;r++)0==(3&r)&&(n=4294967296*Math.random()),e[r]=n>>>((3&r)<<3)&255;return e}function bytesToUuid(e){for(var n=[],r=0;r<256;++r)n[r]=(r+256).toString(16).substr(1);var t=0,o=n;return[o[e[t++]],o[e[t++]],o[e[t++]],o[e[t++]],"-",o[e[t++]],o[e[t++]],"-",o[e[t++]],o[e[t++]],"-",o[e[t++]],o[e[t++]],"-",o[e[t++]],o[e[t++]],o[e[t++]],o[e[t++]],o[e[+t]],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,n,r){var t=0;return function(){if(e())return t&&clearTimeout(t),void(t=0);0===t&&(t=setTimeout(n,r))}},nextLink=function(t,e){var n=e.reduce(function(e,n){try{var r=n(t);"function"==typeof r&&e.push(r)}catch(e){}return e},[]);return function(e){return nextLink(e,n)}},toObservable=function(e){function n(e){t=arrayRemove(t,e),i||a()}var r,t=[],o=[],i=!1,a=applyBufferTimer(function(){return!!t.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,t)},complete:function(e){o.push(e)},attach:function(e,n){r=[e,n]},subscribe:function(e){if(i)throw new Error("Observer is closed");return t.push(e),r&&r[1]&&r[1](e),a(),function(){return n(e)}},unsubscribe:n}},createSafeObserver=function(e,n){var r=toObservable();try{e(r.next,r.attach),n&&r.complete(n)}catch(e){}return[r.subscribe,r.unsubscribe]};function createClient(e){var r,t,n=e.builder,o=e.createSender,i=e.createDefaultConfig,a=e.createConfigManager,u=e.userConfigNormalizer,s=e.initConfigNormalizer,c=e.validateInitConfig,f={};EVENTS.forEach(function(e){return f[e]=[]});var l=!1,g=!1,d=!1,p=[],_=[],v={getBuilder:function(){return n},getSender:function(){return r},getPreStartQueue:function(){return p},init:function(e){if(l)warn("already inited");else{if(!(e&&isObject(e)&&c(e)))throw new Error("invalid InitConfig, init failed");var n=i(e);if(!n)throw new Error("defaultConfig missing");e=s(e);if((t=a(n)).setConfig(e),t.onChange(function(){y("config")}),!(r=o(t.getConfig())))throw new Error("sender missing");y("init",l=!0)}},set:function(e){l&&e&&isObject(e)&&(y("beforeConfig",!1,e),null!=t&&t.setConfig(e))},config:function(e){if(l)return e&&isObject(e)&&(y("beforeConfig",!1,e),null!=t&&t.setConfig(u(e))),null==t?void 0:t.getConfig()},provide:function(e,n){arrayIncludes(_,e)?warn("cannot provide "+e+", reserved"):(v[e]=n,y("provide",!1,e))},start:function(){var n=this;l&&(g||null!=t&&t.onReady(function(){y("start",g=!0),p.forEach(function(e){return n.build(e)}),p=[]}))},report:function(e){e&&(!(e=runProcessors(f.beforeReport)(e))||(e=runProcessors(f.report)(e))&&(g?this.build(e):p.push(e)))},build:function(e){!g||(e=runProcessors(f.beforeBuild)(e))&&(!(e=n.build(e))||(e=runProcessors(f.build)(e))&&this.send(e))},send:function(e){!g||(e=runProcessors(f.beforeSend)(e))&&(r.send(e),y("send",!1,e))},destroy:function(){y("beforeDestroy",d=!0)},on:function(e,n){"init"===e&&l||"start"===e&&g||"beforeDestroy"===e&&d?n():f[e]&&f[e].push(n)},off:function(e,n){f[e]&&(f[e]=arrayRemove(f[e],n))}},_=Object.keys(v);return v;function y(e,n){void 0===n&&(n=!1);for(var r=[],t=2;t<arguments.length;t++)r[t-2]=arguments[t];f[e].forEach(function(e){try{e.apply(void 0,__spreadArray([],__read(r),!1))}catch(e){}}),n&&(f[e].length=0)}}var ContextPlugin=function(e){var n=createContextAgent();e.provide("context",n),e.on("report",function(e){return e.extra||(e.extra={}),e.extra.context=n.toString(),e})},withCommandArray=function(i,a,r){function u(){for(var e=[],n=0;n<arguments.length;n++)e[n]=arguments[n];if(o=e[0]){var r=o.split(".")[0];if(r in u)return safeCall(u,o,[].slice.call(e,1));var t=s[r]||[],o=null!==(o=null==a?void 0:a(i))&&void 0!==o?o:{};t.push(__spreadArray([o],__read(e),!1)),void(s[r]=t)}}var e,s={};for(e in hookObjectProperty(i,"provide",function(r){return function(e,n){u[e]=n,r.call(i,e,n)}})(),i)Object.prototype.hasOwnProperty.call(i,e)&&(u[e]=i[e]);return i.on("provide",function(e){s[e]&&(s[e].forEach(function(e){var n=__read(e),e=n[0],n=n.slice(1);null!=r&&r(i,e,n)}),s[e]=null)}),u};function IntegrationPlugin(r){r.on("init",function(){var n=[],e=r.config();e&&e.integrations&&e.integrations.forEach(function(e){arrayIncludes(n,e.name)||(n.push(e.name),e.setup(r),e.tearDown&&r.on("beforeDestroy",e.tearDown))})})}function SubjectPlugin(e,n){var r=n||{};e.provide("initSubject",function(e){var e=__read(e,2),n=e[0],e=e[1];return r[n]||(r[n]=createSafeObserver(e,function(){r[n]=void 0})),r[n]}),e.provide("getSubject",function(e){return r[e]})}function getDefaultBrowser(){if("object"==typeof window&&isObject(window))return window}function getDefaultLocation(){return getDefaultBrowser()&&window.location}function getDefaultXMLHttpRequest(){if("function"==typeof XMLHttpRequest&&isFunction(XMLHttpRequest))return XMLHttpRequest}function getDefaultNavigator(){if(getDefaultBrowser()&&"navigator"in window)return window.navigator}function getDefaultNetworkInformation(){var e=getDefaultNavigator();if(e)return e.connection||e.mozConnection||e.webkitConnection}var getGlobalRegistry=function(e){if(e)return e.__SLARDAR_REGISTRY__||(e.__SLARDAR_REGISTRY__={Slardar:{plugins:[],errors:[],subject:{}}}),e.__SLARDAR_REGISTRY__.Slardar},now=function(){return Date.now()};function getLocationUrl(){var e=getDefaultBrowser()&&getDefaultLocation();return null==e?void 0:e.href}var captureCurrentContext=function(e){var n={url:getLocationUrl(),timestamp:now()},r=e.config();return null!=r&&r.pid&&(n.pid=r.pid),null!=e&&e.context&&(n.context=e.context.toString()),n},syncReportWithCapturedContext=function(r,t){return function(e){function n(e){return e.overrides=t,e}r.on("report",n),e(),r.off("report",n)}},invokeCallbackOnce=function(n){var r=!1;return[function(e){r||(r=!0,n&&n(e))}]},onPageUnload=function(e){var n=__read(invokeCallbackOnce(e),1)[0];["unload","beforeunload","pagehide"].forEach(function(e){addEventListener(e,n)})},getStorageItem=function(e){try{var n=localStorage.getItem(e),r=n;return r=n&&"string"==typeof n?JSON.parse(n):r}catch(e){return}},setStorageItem=function(e,n){try{var r="string"==typeof n?n:JSON.stringify(n);localStorage.setItem(e,r)}catch(e){}};function getNetworkType(e){return(null==e?void 0:e.effectiveType)||(null==e?void 0:e.type)||""}var InjectNetworkTypePlugin=function(e){var n=getDefaultNetworkInformation(),r=getNetworkType(n);n&&(n.onchange=function(){r=getNetworkType(n)}),e.on("report",function(e){return __assign(__assign({},e),{extra:__assign(__assign({},e.extra||{}),{network_type:r})})})},getBeaconTransport=function(){var r=getDefaultBrowser();return r&&r.navigator.sendBeacon?{get:function(){},post:function(e,n){r.navigator.sendBeacon(e,n)}}:{get:noop,post:noop}},request=function(e,n,r){var t=n.url,o=n.data,i=n.success,a=void 0===i?noop:i,i=n.fail,u=void 0===i?noop:i,i=n.getResponseText,s=void 0===i?noop:i,n=n.withCredentials,n=void 0!==n&&n,r=new r;r.withCredentials=n,r.open(e,t,!0),r.setRequestHeader("Content-Type","application/json"),r.onload=function(){null!=s&&s(this.responseText);try{var e;this.responseText?(e=JSON.parse(this.responseText),a(e)):a({})}catch(e){u(e)}},r.onerror=function(){u(new Error("Network request failed"))},r.onabort=function(){u(new Error("Network request aborted"))},r.send(o)},getXhrTransport=function(){var n=getDefaultXMLHttpRequest();return n?{get:function(e){request("GET",e,n)},post:function(e){request("POST",e,n)}}:{get:noop,post:noop}};function createBrowserSender(e){function n(e){t.post(r.getEndpoint(),stringifyBatch([e]))}var r=createBatchSender(e),t=getBeaconTransport();return onPageUnload(function(){var e=r.getBatchData();e&&(t.post(r.getEndpoint(),e),r.clear()),r.send=n}),r}var browserBuilder={build:function(e){return{ev_type:e.ev_type,payload:e.payload,common:__assign(__assign({},e.extra||{}),e.overrides||{})}}};function normalizeInitConfig(e){var n,r=e.plugins||{};for(n in r)r[n]&&!isObject(r[n])&&(r[n]={});return __assign(__assign({},e),{plugins:r})}function validateInitConfig(e){return isObject(e)&&"aid"in e}function normalizeUserConfig(e){return __assign({},e)}function parseServerConfig(e){if(!e)return{};var n=e.sample,r=e.timestamp,t=e.status;if(!n)return{};var o=n.sample_rate,e=n.sample_granularity;return{sample:{include_users:n.include_users,sample_rate:t&&4===t?0:o,sample_granularity:e,rules:n.rules.reduce(function(e,n){var r=n.name,t=n.enable,o=n.sample_rate,n=n.conditional_sample_rules;return e[r]={enable:t,sample_rate:o,conditional_sample_rules:n},e},{})},serverTimestamp:r}}var REPORT_DOMAIN="apmplus.volces.com",SDK_VERSION="1.7.0",SDK_NAME="APM_PLUS_WEB",SETTINGS_PATH="/settings/get/webpro",BATCH_REPORT_PATH="/monitor_web/collect",STORAGE_PREFIX="APMPLUS",DEFAULT_IGNORE_PATHS=[BATCH_REPORT_PATH,SETTINGS_PATH,"/monitor_browser/collect"],DEFAULT_SAMPLE_CONFIG={sample_rate:1,include_users:[],sample_granularity:"session",rules:{}},DEFAULT_SENDER_SIZE=20,getReportUrl=function(e,n){return void 0===n&&(n=BATCH_REPORT_PATH),(e&&0<=e.indexOf("//")?"":"https://")+e+n},getSettingsUrl=function(e,n){return void 0===n&&(n=SETTINGS_PATH),(e&&0<=e.indexOf("//")?"":"https://")+e+n},getViewId=function(e){return e+"_"+Date.now()},getDefaultSessionId=function(){return uuid()},getStorageKey=function(e){return STORAGE_PREFIX+e},getStoreInfo=function(e){e=getStorageKey(e);return getStorageItem(e)||{userId:uuid(),deviceId:uuid(),r:Math.random()}},saveStoreInfo=function(e){var n=e.aid,r=e.userId,t=e.deviceId,e=e.sample,n=getStorageKey(n);setStorageItem(n,{userId:r,deviceId:t,r:e.r})},createBrowserConfigManager=function(n){var r,t,o,i=n,a={},u=noop,s=noop;return{getConfig:function(){return i},setConfig:function(e){return a=__assign(__assign({},a),e||{}),c(),r||(r=e,i.useLocalConfig?(o={},u()):t?f():getServerConfig(i.transport,i.domain,i.aid,function(e){t=e,f()})),i},onChange:function(e){s=e},onReady:function(e){u=function(){!function(){n.userId!==i.userId&&(n.sample.r=Math.random(),c());saveStoreInfo(i)}(),e()},o&&u()}};function c(){var e=__assign(__assign(__assign({},n),o||{}),a);e.plugins=mergeDeepConcatArray(n.plugins,(null==o?void 0:o.plugins)||{},a.plugins||{}),e.sample=mergeSampleConfig(mergeSampleConfig(n.sample,null==o?void 0:o.sample),a.sample),i=e,s()}function f(){o=parseServerConfig(t),c(),u()}};function getServerConfig(e,n,r,t){e.get({withCredentials:!0,url:getSettingsUrl(n)+"?aid="+r,success:function(e){t(e.data||{})},fail:function(){t()}})}function mergeSampleConfig(t,o){if(!t||!o)return t||o;var e=__assign(__assign({},t),o);return e.include_users=__spreadArray(__spreadArray([],__read(t.include_users||[]),!1),__read(o.include_users||[]),!1),e.rules=__spreadArray(__spreadArray([],__read(Object.keys(t.rules||{})),!1),__read(Object.keys(o.rules||{})),!1).reduce(function(e,n){var r;return n in e||(n in(t.rules||{})&&n in(o.rules||{})?(e[n]=__assign(__assign({},t.rules[n]),o.rules[n]),e[n].conditional_sample_rules=__spreadArray(__spreadArray([],__read(t.rules[n].conditional_sample_rules||[]),!1),__read(o.rules[n].conditional_sample_rules||[]),!1)):e[n]=(null===(r=t.rules)||void 0===r?void 0:r[n])||(null===(r=o.rules)||void 0===r?void 0:r[n])),e},{}),e}var addEnvToSendEvent=function(e){var n={url:getLocationUrl(),timestamp:Date.now()};return __assign(__assign({},e),{extra:__assign(__assign({},n),e.extra||{})})},InjectEnvPlugin=function(e){e.on("report",function(e){return addEnvToSendEvent(e)})},MAX_RTT=700,TimeCalibrationPlugin=function(r){var t,o=!1;r.on("init",function(){t=(new Date).getTime(),r.on("config",function(){var e,n=null===(e=r.config())||void 0===e?void 0:e.serverTimestamp;isNaN(n)||Number(n)<=0||o||(o=!0,(e=(new Date).getTime())-t<MAX_RTT&&n&&(e=n-(e+t)/2,!isNaN(e)&&(0<e||e<-6e5)&&r.set({offset:e})))})})},addConfigToReportEvent=function(e,n){var r={};return r.aid=n.aid,r.pid=n.pid,r.view_id=n.viewId,r.user_id=n.userId,__assign(__assign({},e),{extra:__assign(__assign({},r),e.extra||{})})},InjectConfigPlugin=function(n){n.on("beforeBuild",function(e){return addConfigToReportEvent(e,n.config())})},InjectQueryPlugin=function(u){u.on("start",function(){var e=u.config(),n=e.deviceId,r=e.sessionId,t=e.release,o=e.env,i=e.offset,a=e.aid,e=e.token,a={did:n,sid:r,release:t,env:o,sname:SDK_NAME,sversion:SDK_VERSION,soffset:i||0,biz_id:a,x_auth_token:e},e=u.getSender();e.setEndpoint(e.getEndpoint()+joinQueryWithMap(a))})},getDefaultConfig=function(e){e=getStoreInfo(e.aid);return{aid:0,pid:"",token:"",viewId:getViewId("_"),userId:e.userId,deviceId:e.deviceId,sessionId:getDefaultSessionId(),domain:REPORT_DOMAIN,plugins:{ajax:{ignoreUrls:DEFAULT_IGNORE_PATHS},fetch:{ignoreUrls:DEFAULT_IGNORE_PATHS},breadcrumb:{},pageview:{},jsError:{},resource:{},resourceError:{},performance:{},tti:{},fmp:{},blankScreen:!1},release:"",env:"production",sample:__assign(__assign({},DEFAULT_SAMPLE_CONFIG),{r:e.r}),transport:getXhrTransport()}},createMinimalBrowserClient=function(e){var n=void 0===e?{}:e,r=n.createSender,e=n.builder,n=n.createDefaultConfig,t=createClient({validateInitConfig:validateInitConfig,initConfigNormalizer:normalizeInitConfig,userConfigNormalizer:normalizeUserConfig,createSender:void 0===r?function(e){return createBrowserSender({size:DEFAULT_SENDER_SIZE,endpoint:getReportUrl(e.domain),transport:e.transport})}:r,builder:void 0===e?browserBuilder:e,createDefaultConfig:void 0===n?getDefaultConfig:n,createConfigManager:createBrowserConfigManager});ContextPlugin(t);n=getGlobalRegistry(getDefaultBrowser());SubjectPlugin(t,n&&n.subject),TimeCalibrationPlugin(t),InjectConfigPlugin(t),InjectEnvPlugin(t),InjectNetworkTypePlugin(t),InjectQueryPlugin(t);n=withCommandArray(t,captureCurrentContext,function(e,n,r){return syncReportWithCapturedContext(e,n)(function(){var e=__read(r),n=e[0],e=e.slice(1);t[n].apply(t,__spreadArray([],__read(e),!1))})});return IntegrationPlugin(n),n};exports.createMinimalBrowserClient=createMinimalBrowserClient,exports.getDefaultConfig=getDefaultConfig; |
{ | ||
"name": "@apmplus/web", | ||
"version": "1.6.0", | ||
"version": "1.7.0", | ||
"description": "APM Plus Web SDK", | ||
@@ -71,3 +71,3 @@ "main": "cn/index.cjs.js", | ||
}, | ||
"gitHead": "e58f468c745df98a0300f319434e2486c0c6f044" | ||
"gitHead": "840026fdbe2eb2346b88f0ff575207d171a22f1d" | ||
} |
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
479037
3689