@arms/rum-uniapp 0.1.4 → 0.1.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/uniapp-sdk.js +1 -1
- package/es/collector/exception/index.d.ts +36 -1
- package/es/collector/exception/index.js +49 -6
- package/es/collector/resource/api.js +3 -1
- package/es/reporter/index.js +1 -1
- package/es/utils/api.d.ts +1 -1
- package/es/utils/api.js +1 -1
- package/es/utils/platform.d.ts +4 -2
- package/es/utils/platform.js +1 -1
- package/lib/collector/exception/index.d.ts +36 -1
- package/lib/collector/exception/index.js +48 -6
- package/lib/collector/resource/api.js +3 -1
- package/lib/reporter/index.js +1 -1
- package/lib/utils/api.d.ts +1 -1
- package/lib/utils/api.js +1 -1
- package/lib/utils/platform.d.ts +4 -2
- package/lib/utils/platform.js +1 -1
- package/package.json +2 -2
package/dist/uniapp-sdk.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
module.exports=function(e){var t={};function n(r){if(t[r])return t[r].exports;var o=t[r]={i:r,l:!1,exports:{}};return e[r].call(o.exports,o,o.exports,n),o.l=!0,o.exports}return n.m=e,n.c=t,n.d=function(e,t,r){n.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:r})},n.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},n.t=function(e,t){if(1&t&&(e=n(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var r=Object.create(null);if(n.r(r),Object.defineProperty(r,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var o in e)n.d(r,o,function(t){return e[t]}.bind(null,o));return r},n.n=function(e){var t=e&&e.__esModule?function t(){return e.default}:function t(){return e};return n.d(t,"a",t),t},n.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},n.p="./dist/",n(n.s=22)}([function(e,t,n){"use strict";var r=this&&this.__createBinding||(Object.create?function(e,t,n,r){void 0===r&&(r=n);var o=Object.getOwnPropertyDescriptor(t,n);o&&!("get"in o?!t.__esModule:o.writable||o.configurable)||(o={enumerable:!0,get:function e(){return t[n]}}),Object.defineProperty(e,r,o)}:function(e,t,n,r){void 0===r&&(r=n),e[r]=t[n]}),o=this&&this.__exportStar||function(e,t){for(var n in e)"default"===n||Object.prototype.hasOwnProperty.call(t,n)||r(t,e,n)};Object.defineProperty(t,"__esModule",{value:!0}),t.Shell=t.Reporter=t.Context=t.Client=void 0;var i=n(11);t.Client=i.default;var u=n(16);t.Context=u.default;var a=n(25);t.Reporter=a.default;var c=n(27);t.Shell=c.default,o(n(28),t),o(n(12),t),o(n(29),t),o(n(30),t),o(n(31),t),o(n(7),t),o(n(32),t),o(n(33),t),o(n(18),t),o(n(19),t),o(n(1),t),o(n(15),t),o(n(20),t),o(n(34),t),o(n(17),t),o(n(6),t),o(n(5),t),o(n(35),t),o(n(36),t),o(n(37),t)},function(e,t,n){"use strict";function r(e){return(r="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function o(e,t){return r(e)===t}Object.defineProperty(t,"__esModule",{value:!0}),t.isZero=t.isObject=t.isNull=t.isNumber=t.isBoolean=t.isRegExp=t.isArray=t.isToString=t.isString=t.isFunction=t.isTypeof=void 0,t.isTypeof=o;var i=function e(t){return"function"==typeof t};function u(e,t){return Object.prototype.toString.call(e)==="[object ".concat(t,"]")}function a(){for(var e=0;e<arguments.length;e++)if(0!==(e<0||arguments.length<=e?void 0:arguments[e]))return!1;return!0}t.isFunction=i,t.isString=function(e){return o(e,"string")},t.isToString=u,t.isArray=function(e){return u(e,"Array")},t.isRegExp=function(e){return u(e,"RegExp")},t.isBoolean=function(e){return o(e,"boolean")},t.isNumber=function(e){return o(e,"number")&&!isNaN(e)||o(e,"bigint")},t.isNull=function(e){return null===e},t.isObject=function(e){return!(0,t.isNull)(e)&&o(e,"object")},t.isZero=a},function(e,t,n){"use strict";(function(e){function r(){function e(e,n,r,i){var u=n&&n.prototype instanceof t?n:t,s=Object.create(u.prototype);return o(s,"_invoke",function(e,t,n){function r(e,t){for(i=e,u=t,c=0;!l&&s&&!n&&c<f.length;c++){var n,r=f[c],o=v.p,y=r[2];3<e?(n=y===t)&&(u=r[(i=r[4])?5:(i=3,3)],r[4]=r[5]=a):r[0]<=o&&((n=2>e&&o<r[1])?(i=0,v.v=t,v.n=r[1]):o<y&&(n=3>e||r[0]>t||t>y)&&(r[4]=e,r[5]=t,v.n=y,i=0))}if(n||1<e)return p;throw l=!0,t}var o,i,u,s=0,f=n||[],l=!1,v={p:0,n:0,v:a,a:r,f:r.bind(a,4),d:function e(t,n){return o=t,i=0,u=a,v.n=n,p}};return function(n,f,y){if(1<s)throw TypeError("Generator is already running");for(l&&1===f&&r(f,y),i=f,u=y;(c=2>i?a:u)||!l;){o||(i?3>i?(1<i&&(v.n=-1),r(i,u)):v.n=u:v.v=u);try{if(s=2,o){if(i||(n="next"),c=o[n]){if(!(c=c.call(o,u)))throw TypeError("iterator result is not an object");if(!c.done)return c;u=c.value,2>i&&(i=0)}else 1===i&&(c=o.return)&&c.call(o),2>i&&(u=TypeError("The iterator does not provide a '"+n+"' method"),i=1);o=a}else if((c=(l=0>v.n)?u:e.call(t,v))!==p)break}catch(e){o=a,i=1,u=e}finally{s=1}}return{value:c,done:l}}}(e,r,i),!0),s}function t(){}function n(){}function i(){}function u(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,i):(e.__proto__=i,o(e,l,"GeneratorFunction")),e.prototype=Object.create(y),e}/*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/babel/babel/blob/main/packages/babel-helpers/LICENSE */var a,c,s="function"==typeof Symbol?Symbol:{},f=s.iterator||"@@iterator",l=s.toStringTag||"@@toStringTag",p={};c=Object.getPrototypeOf;var v=[][f]?c(c([][f]())):(o(c={},f,(function(){return this})),c),y=i.prototype=t.prototype=Object.create(v);return n.prototype=i,o(y,"constructor",i),o(i,"constructor",n),n.displayName="GeneratorFunction",o(i,l,"GeneratorFunction"),o(y),o(y,l,"Generator"),o(y,f,(function(){return this})),o(y,"toString",(function(){return"[object Generator]"})),(r=function t(){return{w:e,m:u}})()}function o(e,t,n,r){var i=Object.defineProperty;try{i({},"",{})}catch(e){i=0}(o=function e(t,n,r,u){function a(e,n){o(t,e,(function(t){return this._invoke(e,n,t)}))}n?i?i(t,n,{value:r,enumerable:!u,configurable:!u,writable:!u}):t[n]=r:(a("next",0),a("throw",1),a("return",2))})(e,t,n,r)}var i=this&&this.__awaiter||function(e,t,n,r){function o(e){return e instanceof n?e:new n((function(t){t(e)}))}return new(n||(n=Promise))((function(n,i){function u(e){try{c(r.next(e))}catch(e){i(e)}}function a(e){try{c(r.throw(e))}catch(e){i(e)}}function c(e){e.done?n(e.value):o(e.value).then(u,a)}c((r=r.apply(e,t||[])).next())}))};Object.defineProperty(t,"__esModule",{value:!0}),t.fixAttrs=t.getNetType=t.getPerformance=t.setStorageSync=t.getStorageSync=t.appName=t.sdk=t.VERSION=t.global2=void 0;var u=n(0);function a(e){return"function"==typeof t.sdk.getStorageSync?t.sdk.getStorageSync(e):void 0}function c(e,n){return"function"==typeof t.sdk.setStorageSync?t.sdk.setStorageSync(e,n):void 0}function s(){return"performance"in t.global2?t.global2.performance:void 0}function f(){return new Promise((function(e){try{t.sdk.getNetworkType({success:function t(n){var r=n.networkType||n.subtype;e(r?r.toLowerCase():void 0)},fail:function t(n){e(void 0)}})}catch(t){e(void 0)}}))}t.global2=e||window,t.VERSION="0.1.4",t.sdk=uni,t.appName="uniapp",t.getStorageSync=a,t.setStorageSync=c,t.getPerformance=s,t.getNetType=f;var l=function e(n){return i(this,void 0,void 0,r().m((function e(){var o,i,a,c,s;return r().w((function(e){for(;;)switch(e.n){case 0:if(n){e.n=1;break}return e.a(2);case 1:return e.n=2,f();case 2:return o=e.v,n.app.type=u.AppType.uniapp,n._v=t.VERSION,n.net=Object.assign({model:o},n.net),i=t.sdk.getDeviceInfo()||{},a=t.sdk.getAppBaseInfo()||{},c={brand:i.brand,model:i.model},s={type:i.platform,version:i.system,container:t.appName,container_version:a.SDKVersion},n.device=Object.assign(Object.assign({},c),n.device),n.os=Object.assign(Object.assign({},s),n.os),e.a(2,n)}}),e)})))};t.fixAttrs=l}).call(this,n(21))},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.getCurViews=t.getCurView=t.getCurrentPage=void 0;var r=n(0),o="__rum_view";function i(){if("function"==typeof getCurrentPages)try{var e=getCurrentPages()||[];return e[e.length-1]}catch(e){r.logger.warn("view","getCurrentPage failed",e)}}function u(e){if(e){var t=i();if(t){if(o in t)return t[o];var n=t.$page||{},u=n.fullPath,a=n.route,c=n.openType,s=e.session.getViewId(),f=u||a||t.route,l=a||t.route,p,v=e.getConfig().parseViewName;return(0,r.isFunction)(v)&&(l=v(f)),t[o]={id:s,name:l,url:f,loading_type:c,_noReport:!0}}}}function a(){var e=[];if("function"==typeof getCurrentPages)try{(getCurrentPages()||[]).forEach((function(t){o in t&&e.push(t[o])}))}catch(e){r.logger.warn("view","getCurViews failed",e)}return e}t.getCurrentPage=i,t.getCurView=u,t.getCurViews=a},function(e,t,n){"use strict";function r(e){return(r="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function o(e,t){return s(e)||c(e,t)||u(e,t)||i()}function i(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function u(e,t){if(e){if("string"==typeof e)return a(e,t);var n={}.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?a(e,t):void 0}}function a(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}function c(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var r,o,i,u,a=[],c=!0,s=!1;try{if(i=(n=n.call(e)).next,0===t){if(Object(n)!==n)return;c=!1}else for(;!(c=(r=i.call(n)).done)&&(a.push(r.value),a.length!==t);c=!0);}catch(e){s=!0,o=e}finally{try{if(!c&&null!=n.return&&(u=n.return(),Object(u)!==u))return}finally{if(s)throw o}}return a}}function s(e){if(Array.isArray(e))return e}function f(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function l(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,v(r.key),r)}}function p(e,t,n){return t&&l(e.prototype,t),n&&l(e,n),Object.defineProperty(e,"prototype",{writable:!1}),e}function v(e){var t=y(e,"string");return"symbol"==r(t)?t:t+""}function y(e,t){if("object"!=r(e)||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var o=n.call(e,t||"default");if("object"!=r(o))return o;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}Object.defineProperty(t,"__esModule",{value:!0}),t.callMonitored=t.logger=void 0;var d=["debug","error","crash"],g=function(){function e(){f(this,e),this.console=!1,this.reportLevels=d}return p(e,[{key:"setConsole",value:function e(t){this.console=t}},{key:"setReportLevels",value:function e(t){this.reportLevels=t}},{key:"setOnError",value:function e(t){this.onError=t}},{key:"debug",value:function e(){for(var t=arguments.length,n=new Array(t),r=0;r<t;r++)n[r]=arguments[r];this.log("debug",n)}},{key:"info",value:function e(){for(var t=arguments.length,n=new Array(t),r=0;r<t;r++)n[r]=arguments[r];this.log("info",n)}},{key:"warn",value:function e(){for(var t=arguments.length,n=new Array(t),r=0;r<t;r++)n[r]=arguments[r];this.log("warn",n)}},{key:"error",value:function e(){for(var t=arguments.length,n=new Array(t),r=0;r<t;r++)n[r]=arguments[r];this.log("error",n)}},{key:"crash",value:function e(){for(var t=arguments.length,n=new Array(t),r=0;r<t;r++)n[r]=arguments[r];this.log("crash",n)}},{key:"log",value:function e(t,n){var i=o(n,4),u=i[0],a=i[1],c=i[2],s=i[3],f,l,p;this.console&&console["crash"===t?"error":"debug"===t?"log":t]("[RUM-SDK][".concat(u,"]"),a,c||"");this.reportLevels.includes(t)&&(c instanceof Error?p=c.stack:c&&"object"===r(c)&&"stack"in c&&(p=String(c.stack)),p&&p.length>12288&&(p=p.slice(0,12288)),null===(f=this.onError)||void 0===f||f.call(this,Object.assign({level:t,content:a,type:u,stack:p},s)))}},{key:"wrap",value:function e(t,n,r){return function(){for(var e=arguments.length,o=new Array(e),i=0;i<e;i++)o[i]=arguments[i];return h(t,this,o,n,r)}}}])}();function h(e,n,r,o,i){try{var u=e.apply(n,r);return u&&"function"==typeof u.catch&&u.catch((function(e){t.logger.error(o||"unknown",i||(e instanceof Error?e.message:String(e)),e)})),u}catch(e){t.logger.error(o||"unknown",i||(e instanceof Error?e.message:String(e)),e)}}t.logger=new g,t.callMonitored=h},function(e,t,n){"use strict";function r(e){return(r="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function o(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function i(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,a(r.key),r)}}function u(e,t,n){return t&&i(e.prototype,t),n&&i(e,n),Object.defineProperty(e,"prototype",{writable:!1}),e}function a(e){var t=c(e,"string");return"symbol"==r(t)?t:t+""}function c(e,t){if("object"!=r(e)||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var o=n.call(e,t||"default");if("object"!=r(o))return o;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}Object.defineProperty(t,"__esModule",{value:!0}),t.EventEmitter=void 0;var s=n(4),f=function(){function e(){o(this,e),this.events={}}return u(e,[{key:"on",value:function e(t,n){this.events[t]||(this.events[t]=[]),this.events[t].push(n)}},{key:"emit",value:function e(t){var n=this.events[t];if(n){for(var r=n.slice(),o=arguments.length,i=new Array(o>1?o-1:0),u=1;u<o;u++)i[u-1]=arguments[u];for(var a=0;a<r.length;a++)try{r[a].apply(r,i)}catch(e){s.logger.error("EventEmitter",'Error in handler for "'.concat(t,'"'),e)}}}},{key:"off",value:function e(t,n){var r=this.events[t];if(r)if(n){for(var o=r.length;o--;)r[o]===n&&r.splice(o,1);0===r.length&&delete this.events[t]}else delete this.events[t]}},{key:"once",value:function e(t,n){var r=this,o=function e(){r.off(t,o),n.apply(void 0,arguments)};this.on(t,o)}}])}();t.EventEmitter=f},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.getUrlParams=void 0;var r=function e(t){if(0===t.length)return"";try{return decodeURIComponent(t.replace(/\+/g," "))}catch(e){return t.replace(/\+/g," ").replace(/%20/g," ").replace(/%2F/g,"/").replace(/%3D/g,"=").replace(/%26/g,"&").replace(/%3F/g,"?")}},o=function e(t){if(0===t.length)return"";var n=t.indexOf("#"),r=n>=0?t.slice(0,n):t,o=r.indexOf("?");return-1===o?"":r.slice(o+1)};function i(e){if("string"!=typeof e||!e.trim())return{};var t={},n=o(e);if(!n)return t;for(var i=n.split("&"),u=0;u<i.length;u++){var a=i[u];if(a){var c=a.indexOf("=");if(!(c<=0)){var s=r(a.slice(0,c)),f=c<a.length-1?r(a.slice(c+1)):"",l=t[s];void 0!==l?Array.isArray(l)?l.push(f):t[s]=[l,f]:t[s]=f}}}return t}t.getUrlParams=i},function(e,t,n){"use strict";var r,o,i;Object.defineProperty(t,"__esModule",{value:!0}),t.AppType=t.ResourceStatus=t.RumEventType=void 0,function(e){e.VIEW="view",e.RESOURCE="resource",e.EXCEPTION="exception",e.LONG_TASK="longTask",e.ACTION="action",e.CUSTOM="custom",e.APPLICATION="application"}(r=t.RumEventType||(t.RumEventType={})),function(e){e[e.Unknown=-1]="Unknown",e[e.Failed=0]="Failed",e[e.Success=1]="Success"}(o=t.ResourceStatus||(t.ResourceStatus={})),function(e){e.browser="browser",e.miniapp="miniapp",e.minigame="minigame",e.uniapp="uniapp",e.reactnative="reactnative"}(i=t.AppType||(t.AppType={}))},function(e,t,n){"use strict";function r(e){return(r="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}Object.defineProperty(t,"__esModule",{value:!0}),t.removeEventListener=t.addEventListener=t.mixin=t.getVueRuntimeKind=void 0;var o,i=n(0);function u(e){return null==e?null:"function"==typeof e.mixin?"function"==typeof e?"vue2":"object"===r(e)?"vue3":null:null}t.getVueRuntimeKind=u;var a=["onLaunch","onLoad","onShow","beforeCreate","mounted"],c={onError:[]};function s(e,t,n){var r=c[e];if(null!=r&&r.length)for(var o=0;o<r.length;o++)try{r[o](t,n)}catch(t){i.logger.warn("vue-mixin","vue listener failed",t,{hook:e})}}a.forEach((function(e){c[e]=[]}));var f=["tap","click"];function l(e){return!!e&&"object"===r(e)&&-1!==f.indexOf(e.type)&&(null!=e.currentTarget||null!=e.target)}function p(e){if(c.action&&c.action.length){var t=e&&e.$options&&e.$options.methods;if(t)for(var n=Object.keys(t),r=function e(){var r=n[o],i=t[r];if("function"!=typeof i||i.__armsActionWrapped)return 1;var u=function e(){var t=arguments[0];return l(t)&&s("action",this,t),i.apply(this,arguments)};u.__armsActionWrapped=!0,t[r]=u},o=0;o<n.length;o++)r()}}function v(e){function t(e,t,n){s("onError",this,{error:e,instance:t,info:n})}for(var n={},r=function e(){var t=a[i];n[t]=function(e){s(t,this,e)}},i=0;i<a.length;i++)r();var u=n.beforeCreate;return n.beforeCreate=function(e){u.call(this,e),p(this)},"vue2"===e?Object.defineProperty(o.config,"errorHandler",{get:function e(){var n=this;return function(e,r,o){t(e,r,o),n.__errorHandler&&n.__errorHandler(e,r,o)}},set:function e(t){this.__errorHandler=t}}):Object.defineProperty(o.config,"onErrorCaptured",{get:function e(){var n=this;return function(e,r,o){t(e,r,o),n.__onErrorCaptured&&n.__onErrorCaptured(e,r,o)}},set:function e(t){this.__onErrorCaptured=t}}),n}function y(e){if(!o){o=e;var t=u(e);if(t)try{e.mixin(v(t))}catch(e){i.logger.error("vue-mixin","vue.mixin failed",e)}}}function d(e,t){e in c||(c[e]=[]),c[e].push(t)}function g(e,t){if(e in c&&t){var n=c[e],r=n.indexOf(t);return n.splice(r,1),!0}return!1}t.mixin=y,t.addEventListener=d,t.removeEventListener=g},function(e,t,n){"use strict";function r(e){var t=!!(1<arguments.length&&void 0!==arguments[1])&&arguments[1];try{var n=u(e);return t?n.hash:n.pathname}catch(e){return""}}function o(e,t){var n,r=e.getConfig().endpoint;try{return u(t).hostname===u(r).hostname}catch(e){return!1}}Object.defineProperty(t,"__esModule",{value:!0}),t.getURL=t.isEndpoint=t.getPathByURL=void 0,t.getPathByURL=r,t.isEndpoint=o;var i=/^(?:([^:\/?#]+):\/\/)?((?:([^\/?#@]*)@)?([^\/?#:]*)(?:\:(\d*))?)?([^?#]*)(?:\?([^#]*))?(?:#((?:.|\n)*))?/i;function u(e){var t=decodeURIComponent(e).match(i),n,r=(t[3]||"").split(":").length?(t[2]||"").replace(/(.*\@)/,""):t[2];return{uri:t[0],protocol:t[1],host:r,hostname:t[4],port:t[5],pathname:t[6],search:t[7],hash:t[8]}}t.getURL=u},function(e,t,n){"use strict";function r(){return(new Date).getTime()}function o(e){var t=1<arguments.length&&void 0!==arguments[1]?arguments[1]:"utf8";if("string"!=typeof e)throw new TypeError("Input must be a string");var n=t.toLowerCase();if("utf16"===n){for(var r,o=0,i=0;i<e.length;i++){if(55296<=(r=e.charCodeAt(i))&&56319>=r&&i+1<e.length){var u=e.charCodeAt(i+1);if(56320<=u&&57343>=u){o+=4,i++;continue}}o+=2}return o}if("utf8"===n){for(var a,c=0,s=0;s<e.length;s++){if(55296<=(a=e.charCodeAt(s))&&56319>=a&&s+1<e.length){var f=e.charCodeAt(s+1);56320<=f&&57343>=f&&(a=1024*(a-55296)+(f-56320)+65536,s++)}c+=127>=a?1:2047>=a?2:65535>=a?3:1114111>=a?4:3}return c}throw new Error('Unsupported encoding. Use "utf8" or "utf16".')}Object.defineProperty(t,"__esModule",{value:!0}),t.getStringSize=t.getCurrentTime=void 0,t.getCurrentTime=r,t.getStringSize=o},function(e,t,n){"use strict";function r(e){return(r="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function o(e,t){var n="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(!n){if(Array.isArray(e)||(n=i(e))||t&&e&&"number"==typeof e.length){n&&(e=n);var r=0,o=function e(){};return{s:o,n:function t(){return r>=e.length?{done:!0}:{done:!1,value:e[r++]}},e:function e(t){throw t},f:o}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var u,a=!0,c=!1;return{s:function t(){n=n.call(e)},n:function e(){var t=n.next();return a=t.done,t},e:function e(t){c=!0,u=t},f:function e(){try{a||null==n.return||n.return()}finally{if(c)throw u}}}}function i(e,t){if(e){if("string"==typeof e)return u(e,t);var n={}.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?u(e,t):void 0}}function u(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}function a(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function c(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,f(r.key),r)}}function s(e,t,n){return t&&c(e.prototype,t),n&&c(e,n),Object.defineProperty(e,"prototype",{writable:!1}),e}function f(e){var t=l(e,"string");return"symbol"==r(t)?t:t+""}function l(e,t){if("object"!=r(e)||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var o=n.call(e,t||"default");if("object"!=r(o))return o;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}Object.defineProperty(t,"__esModule",{value:!0});var p=n(12),v=n(5),y=n(13),d=n(16),g=n(1),h=function(){function e(){var t=this;a(this,e),this.emitter=new v.EventEmitter,this.sendEvent=function(e,n){t.emitter.emit(p.EventType.collect,e,n)}}return s(e,[{key:"init",value:function e(t,n,r,i){var u=this;if(this.ctx=new d.default(t,n,r),i){var a={appType:(null==n?void 0:n.appType)||"",sdkVersion:(null==n?void 0:n.sdkVersion)||"",endpoint:t.endpoint,getSessionId:n?function(){return n.getSessionId()}:void 0,getSessionSampled:n?function(){return n.getSampled()}:void 0,getViewId:function e(){var t,n=null===(t=u.ctx)||void 0===t?void 0:t.getViews();return n&&n.length?n[n.length-1].id:void 0},selfMonitor:t.selfMonitor};t.pid&&(a["app.id"]=t.pid),y.Telemetry.init(a,i)}var c=this.ctx,s=this.collectors,f=this.processors,l=this.reporter;f.forEach((function(e){(0,g.isFunction)(e.setup)&&e.setup(c)})),this.emitter.on(p.EventType.collect,(function(e,t){c.setRumEvent(e);var n=o(f),r;try{for(n.s();!(r=n.n()).done;){var i=r.value;if(i.match||(i.match=function(){return!0}),i.match(c)){var u=i.process(c);u&&c.setRumEvent(u)}}}catch(e){n.e(e)}finally{n.f()}l.report(c,t)})),s.forEach((function(e){e.setup(c,u.sendEvent)}))}},{key:"setContext",value:function e(t){this.ctx=t}},{key:"getContext",value:function e(){return this.ctx}},{key:"useCollectors",value:function e(t){this.collectors=t}},{key:"getCollectors",value:function e(){return this.collectors}},{key:"useProcessors",value:function e(t){this.processors=t}},{key:"useReporter",value:function e(t){this.reporter=t}}])}();t.default=h},function(e,t,n){"use strict";var r;Object.defineProperty(t,"__esModule",{value:!0}),t.EventType=void 0,function(e){e.collect="collect"}(r=t.EventType||(t.EventType={}))},function(e,t,n){"use strict";function r(e,t){return c(e)||a(e,t)||i(e,t)||o()}function o(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function i(e,t){if(e){if("string"==typeof e)return u(e,t);var n={}.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?u(e,t):void 0}}function u(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}function a(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var r,o,i,u,a=[],c=!0,s=!1;try{if(i=(n=n.call(e)).next,0===t){if(Object(n)!==n)return;c=!1}else for(;!(c=(r=i.call(n)).done)&&(a.push(r.value),a.length!==t);c=!0);}catch(e){s=!0,o=e}finally{try{if(!c&&null!=n.return&&(u=n.return(),Object(u)!==u))return}finally{if(s)throw o}}return a}}function c(e){if(Array.isArray(e))return e}function s(e){return(s="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function f(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function l(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,v(r.key),r)}}function p(e,t,n){return t&&l(e.prototype,t),n&&l(e,n),Object.defineProperty(e,"prototype",{writable:!1}),e}function v(e){var t=y(e,"string");return"symbol"==s(t)?t:t+""}function y(e,t){if("object"!=s(e)||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,t||"default");if("object"!=s(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}Object.defineProperty(t,"__esModule",{value:!0}),t.convertBundlesToLogGroup=t.Telemetry=void 0;var d=n(4),g=n(6),h=n(14),m=n(15),b=15,w=100,S=12288,O=5e3,E=10,j=100,_=function(){function e(t,n){f(this,e),this.buffer=[],this.queue=[],this.sentEvents=new Set,this.started=!1,this.enabled=!0,this.timer=null,this.isReporting=!1,this.context=t,this.reporter=n,this.endpointParams=(0,g.getUrlParams)(t.endpoint);var r=t.selfMonitor;if("boolean"==typeof r)this.enabled=r,this.sampled=(0,m.performDraw)(100);else if(r&&"object"===s(r)){this.enabled=!1!==r.enable;var o=r.sampling;this.sampled=(0,m.performDraw)("number"==typeof o&&o>=0&&o<=100?o:100),r.console&&d.logger.setConsole(!0),r.reportLevels&&d.logger.setReportLevels(r.reportLevels)}else this.enabled=!0,this.sampled=(0,m.performDraw)(100)}return p(e,[{key:"start",value:function e(){var t=this;this.started||(this.started=!0,d.logger.setOnError((function(e){return t.addEvent(e)})),this.flushBuffer())}},{key:"addEvent",value:function e(t){var n,r,o,i;if(this.enabled&&t){t.content&&t.content.length>12288&&(t=Object.assign(Object.assign({},t),{content:t.content.slice(0,12288)})),t.stack&&t.stack.length>12288&&(t=Object.assign(Object.assign({},t),{stack:t.stack.slice(0,12288)}));var u={event:t,sessionId:null===(r=(n=this.context).getSessionId)||void 0===r?void 0:r.call(n),viewId:null===(i=(o=this.context).getViewId)||void 0===i?void 0:i.call(o),timestamp:Date.now()};this.started&&this.reporter?this.processSnapshot(u):this.buffer.length<100&&this.buffer.push(u)}}},{key:"flush",value:function e(){this.timer&&(clearTimeout(this.timer),this.timer=null),this.sendBatch()}},{key:"setReporter",value:function e(t){this.reporter=t,this.started&&this.flushBuffer()}},{key:"flushBuffer",value:function e(){var t=this,n;this.buffer.splice(0).forEach((function(e){return t.processSnapshot(e)}))}},{key:"processSnapshot",value:function e(t){var n=this;if(this.shouldSend(t.event)){var r=this.buildBundle(t);this.queue.push(r),this.queue.length>=10?this.flush():this.timer||(this.timer=setTimeout((function(){return n.flush()}),5e3))}}},{key:"shouldSend",value:function e(t){if(this.context.getSessionSampled&&!this.context.getSessionSampled())return!1;if(!this.sampled)return!1;if(this.sentEvents.size>=15)return!1;var n=(t.content||"")+(t.stack||"");return!this.sentEvents.has(n)&&(this.sentEvents.add(n),!0)}},{key:"buildBundle",value:function e(t){var n=this.context,r=n.appType,o=n.sdkVersion,i=n.endpoint;return Object.assign({"app.type":r,_v:o,endpoint:i,"session.id":t.sessionId,"view.id":t.viewId,timestamp:t.timestamp,event_type:"log",log:t.event},this.endpointParams)}},{key:"sendBatch",value:function e(){if(0!==this.queue.length&&this.reporter&&!this.isReporting){var t=this.queue.splice(0);this.isReporting=!0;try{this.reporter.send(t)}catch(e){try{console.warn("[RUM-Telemetry] send failed:",e)}catch(e){}}finally{this.isReporting=!1}}}}],[{key:"init",value:function t(n,r){return e.instance&&e.instance.flush(),e.instance=new e(n,r),e.instance.start(),e.instance}},{key:"get",value:function t(){return e.instance}}])}();function T(e){var t=e.map((function(e){for(var t=[],n=0,o=Object.entries(e);n<o.length;n++){var i=r(o[n],2),u=i[0],a=i[1];"timestamp"!==u&&(null!=a&&t.push({key:u,value:"object"===s(a)?JSON.stringify(a):String(a)}))}return{time:Math.floor(e.timestamp/1e3),contents:t}}));return(0,h.encodeLogGroup)(t)}t.Telemetry=_,t.convertBundlesToLogGroup=T},function(e,t,n){"use strict";function r(e){return(r="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function o(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function i(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,a(r.key),r)}}function u(e,t,n){return t&&i(e.prototype,t),n&&i(e,n),Object.defineProperty(e,"prototype",{writable:!1}),e}function a(e){var t=c(e,"string");return"symbol"==r(t)?t:t+""}function c(e,t){if("object"!=r(e)||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var o=n.call(e,t||"default");if("object"!=r(o))return o;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}Object.defineProperty(t,"__esModule",{value:!0}),t.encodeLogGroup=void 0;var s=0,f=2;function l(e){for(var t=[],n=0;n<e.length;n++){var r=e.charCodeAt(n);if(r<128)t.push(r);else if(r<2048)t.push(192|r>>6),t.push(128|63&r);else if(r>=55296&&r<=56319){var o;n++,r=65536+(r-55296<<10)+(e.charCodeAt(n)-56320),t.push(240|r>>18),t.push(128|r>>12&63),t.push(128|r>>6&63),t.push(128|63&r)}else t.push(224|r>>12),t.push(128|r>>6&63),t.push(128|63&r)}return new Uint8Array(t)}var p="undefined"!=typeof TextEncoder?new TextEncoder:{encode:l},v=function(){function e(){o(this,e),this.buf=[]}return u(e,[{key:"writeVarint",value:function e(t){for(var n=t>>>0;n>127;)this.buf.push(127&n|128),n>>>=7;this.buf.push(127&n)}},{key:"writeTag",value:function e(t,n){this.writeVarint(t<<3|n)}},{key:"writeString",value:function e(t,n){var r=p.encode(n);this.writeTag(t,2),this.writeVarint(r.length);for(var o=0;o<r.length;o++)this.buf.push(r[o])}},{key:"writeUint32",value:function e(t,n){this.writeTag(t,0),this.writeVarint(n)}},{key:"writeBytes",value:function e(t,n){this.writeTag(t,2),this.writeVarint(n.length);for(var r=0;r<n.length;r++)this.buf.push(n[r])}},{key:"finish",value:function e(){return new Uint8Array(this.buf)}}])}();function y(e,t){var n=new v;return n.writeString(1,e),n.writeString(2,t),n.finish()}function d(e,t){var n=new v;n.writeUint32(1,e);for(var r=0;r<t.length;r++){var o=t[r];n.writeBytes(2,y(o.key,o.value))}return n.finish()}function g(e,t,n){for(var r=new v,o=0;o<e.length;o++){var i=e[o];r.writeBytes(1,d(i.time,i.contents))}return void 0!==t&&r.writeString(3,t),void 0!==n&&r.writeString(4,n),r.finish()}t.encodeLogGroup=g},function(e,t,n){"use strict";function r(e){return 0!==e&&100*Math.random()<=e}function o(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:3,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0;if(!e)return e;var r=e.toString(),o=r.indexOf(".");r=-1!==o?r.substring(0,t+o+1):r.substring(0);var i=parseFloat(r);return i>=n?i:void 0}Object.defineProperty(t,"__esModule",{value:!0}),t.formatNumber=t.performDraw=t.ONE_DAY=t.ONE_HOUR=t.ONE_MINUTE=t.ONE_SECOND=void 0,t.ONE_SECOND=1e3,t.ONE_MINUTE=60*t.ONE_SECOND,t.ONE_HOUR=60*t.ONE_MINUTE,t.ONE_DAY=24*t.ONE_HOUR,t.performDraw=r,t.formatNumber=o},function(e,t,n){"use strict";function r(e){return(r="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function o(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function i(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,a(r.key),r)}}function u(e,t,n){return t&&i(e.prototype,t),n&&i(e,n),Object.defineProperty(e,"prototype",{writable:!1}),e}function a(e){var t=c(e,"string");return"symbol"==r(t)?t:t+""}function c(e,t){if("object"!=r(e)||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var o=n.call(e,t||"default");if("object"!=r(o))return o;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}Object.defineProperty(t,"__esModule",{value:!0});var s=n(5),f=function(){function e(t,n,r){o(this,e),this.config=t,this.views=[],this.emitter=new s.EventEmitter,n&&(this.session=n,this.session.init(this)),r&&(this.configManager=r)}return u(e,[{key:"getConfig",value:function e(){return this.configManager?this.configManager.getConfig():this.config}},{key:"setConfig",value:function e(t){this.configManager?this.configManager.setConfig(t):this.config=t}},{key:"getViews",value:function e(){return this.views}},{key:"addView",value:function e(t){var n=this.views.findIndex((function(e){return e.id===t.id}));n>=0&&this.views.splice(n,1),this.views.push(t)}},{key:"removeView",value:function e(t){this.views=this.views.filter((function(e){return e.id!==t}))}},{key:"getRumEvent",value:function e(){return this.rumEvent}},{key:"setRumEvent",value:function e(t){this.rumEvent=t}}])}();t.default=f},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.verifyProperties=void 0;var r=n(1);function o(e){if((0,r.isObject)(e)){var t=Object.assign({},e);Object.keys(t).forEach((function(e){var n=t[e];if(e.length>50){var o=e.substring(0,50);t[o]=n,delete t[e],e=o}(0,r.isString)(n)||(0,r.isNumber)(n)?(0,r.isString)(n)&&n.length>2e3&&(t[e]=n.substring(0,2e3)):delete t[e]}));var n=Object.keys(t);if(n.length)return n.length>20&&n.forEach((function(e,n){n>19&&delete t[e]})),t}}t.verifyProperties=o},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.parseRegExpString=t.delay=t.debounce=t.generateEventId=t.generateSpanId=t.generateTraceId=t.generateGUID=t.restoreFunction=t.interceptFunction=void 0;var r=n(1);function o(e,t,n){var o=arguments.length>3&&void 0!==arguments[3]&&arguments[3],i=e[t],u=function t(){for(var u=o?this:e,a=arguments.length,c=new Array(a),s=0;s<a;s++)c[s]=arguments[s];if(n.apply(u,c),(0,r.isFunction)(i))return i.apply(u,c)};u._rum_intercepted=i,e[t]=u}function i(e,t){var n=e[t];if((0,r.isFunction)(n)){var o=n._rum_intercepted;(0,r.isFunction)(o)&&(e[t]=o)}}function u(){var e="";try{if(crypto&&crypto.randomUUID)e=crypto.randomUUID();else if(crypto&&crypto.getRandomValues){var t=new Uint8Array(16);crypto.getRandomValues(t),t[6]=15&t[6]|64,t[8]=63&t[8]|128,e=t.reduce((function(e,t){return e+t.toString(16).padStart(2,"0")}),"").replace(/^(.{8})(.{4})(.{4})(.{4})(.{12})$/,"$1-$2-$3-$4-$5")}}catch(t){e=""}return e||(e="xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,(function(e){var t=16*Math.random()|0,n;return("x"==e?t:3&t|8).toString(16)}))),e}function a(){var e=u().replace(/-/g,"");return"0"===e[0]&&(e="1"+e.substring(1)),"0"===e[16]&&(e=e.substring(0,16)+"1"+e.substring(17)),e}function c(){for(var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:16,t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:16,n="",r=0;r<e;r++)n+=Math.floor(Math.random()*t).toString(t);return n}function s(e){var t=c();return"00-".concat(e,"-").concat(t)}function f(e,t){var n;if((0,r.isFunction)(e))return function(){var r=this,o=arguments;n&&clearTimeout(n),n=setTimeout((function(){e.apply(r,o)}),t)}}function l(e,t){if((0,r.isFunction)(e)){for(var n=arguments.length,o=new Array(n>2?n-2:0),i=2;i<n;i++)o[i-2]=arguments[i];return setTimeout.apply(void 0,[e,+t||0].concat(o))}}function p(e){if("string"!=typeof e)throw new TypeError("input must be a string");if(e.length>2&&"/"===e[0]){var t=e.lastIndexOf("/");if(t>0){var n=e.substring(1,t),r=e.substring(t+1);return new RegExp(n,r)}return new RegExp(e.substring(1,e.length-1))}return new RegExp(e)}t.interceptFunction=o,t.restoreFunction=i,t.generateGUID=u,t.generateTraceId=a,t.generateSpanId=c,t.generateEventId=s,t.debounce=f,t.delay=l,t.parseRegExpString=p},function(e,t,n){"use strict";function r(e,t){for(var n=0;n<e.length;n+=1){var r=e[n];if(t(r,n))return r}}function o(e,t){return e.slice(0,t.length)===t}function i(e,t){return e.slice(-t.length)===t}function u(e){for(var t=arguments.length,n=new Array(t>1?t-1:0),r=1;r<t;r++)n[r-1]=arguments[r];return n.forEach((function(t){for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n])})),e}Object.defineProperty(t,"__esModule",{value:!0}),t.assign=t.endsWith=t.startsWith=t.find=void 0,t.find=r,t.startsWith=o,t.endsWith=i,t.assign=u},function(e,t,n){"use strict";function r(e){return a(e)||u(e)||i(e)||o()}function o(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function i(e,t){if(e){if("string"==typeof e)return c(e,t);var n={}.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?c(e,t):void 0}}function u(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}function a(e){if(Array.isArray(e))return c(e)}function c(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}Object.defineProperty(t,"__esModule",{value:!0}),t.parseRule2Match=t.urlMatch=t.matchList=t.isMatchOption=void 0;var s=n(1),f=n(19),l=n(18);function p(e){return(0,s.isString)(e)||(0,s.isFunction)(e)||(0,s.isRegExp)(e)}function v(e,t){var n=!(arguments.length>2&&void 0!==arguments[2])||arguments[2],r=arguments.length>3?arguments[3]:void 0;return e.some((function(e){try{if("function"==typeof e)return e(t,r);if(e instanceof RegExp)return e.test(t);if("string"==typeof e)return n?(0,f.startsWith)(t,e):e===t}catch(e){}return!1}))}function y(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[];try{(0,s.isArray)(t)||(t=[t]);var n=[/^(https?:)?\/\/.*rum|retcode|log-global|log\.aliyuncs\.com/,/^(https?:)?\/\/.*\.mmstat\.com/,/^(https?:)?\/\/.*hm\.baidu\.com/,/^(https?:)?\/\/.*google-analytics\.com/,/data:(.+?)(;base64)?,(.+)$/].concat(r(t));return v(n,e)}catch(e){return!1}}function d(e){if(p(e))return e;var t;switch(e.match_exp){case"equals":t=function t(n){return n===e.match};break;case"not_equals":t=function t(n){return n!==e.match};break;case"regex":t=(0,l.parseRegExpString)(e.match);break;case"includes":t=function t(n){return n.includes(e.match)};break;case"starts_with":default:t=function t(n){return(0,f.startsWith)(n,e.match)}}return t}t.isMatchOption=p,t.matchList=v,t.urlMatch=y,t.parseRule2Match=d},function(e,t){var n;n=function(){return this}();try{n=n||new Function("return this")()}catch(e){"object"==typeof window&&(n=window)}e.exports=n},function(e,t,n){e.exports=n(23)},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.ArmsRum=void 0;var r=n(24);Object.defineProperty(t,"ArmsRum",{enumerable:!0,get:function(){return r.ArmsRum}}),t.default=r.default},function(e,t,n){"use strict";function r(e){return(r="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function o(e,t,n){return(t=c(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function i(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function u(e,t){for(var n,r=0;r<t.length;r++)(n=t[r]).enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,c(n.key),n)}function a(e,t,n){return t&&u(e.prototype,t),n&&u(e,n),Object.defineProperty(e,"prototype",{writable:!1}),e}function c(e){var t=s(e,"string");return"symbol"==r(t)?t:t+""}function s(e,t){if("object"!=r(e)||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var o=n.call(e,t||"default");if("object"!=r(o))return o;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}function f(e,t,n){return t=y(t),l(e,v()?Reflect.construct(t,n||[],y(e).constructor):t.apply(e,n))}function l(e,t){if(t&&("object"==r(t)||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return p(e)}function p(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function v(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(e){}return(v=function(){return!!e})()}function y(e){return(y=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function d(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&g(e,t)}function g(e,t){return(g=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e})(e,t)}Object.defineProperty(t,"__esModule",{value:!0}),t.ArmsRum=void 0;var h=n(0),m=n(38),b=n(39),w=n(40),S=n(42),O=n(43),E=n(44),j=n(45),_=n(46),T=n(2),k=n(47),P=n(8),C=n(3),x=n(48),R=function(e){function t(){var e;return i(this,t),(e=f(this,t,arguments)).version=T.VERSION,e}return d(t,e),a(t,[{key:"init",value:function(e){var t=this;return this.configManager=new x.default,Promise.resolve().then((function(){return t.configManager.init(e)})).catch((function(e){h.logger.warn("shell","configManager init error",e)})).then((function(){var e=t.configManager.getConfig(),n;return!1===e.enable||(e.vue&&t.setVue(e.vue),t.client.useCollectors([new m.default,new b.default,new w.default,new S.default]),t.client.useProcessors([new O.default,new E.default]),t.client.useReporter(new j.default),t.client.init(e,new k.RumSession,t.configManager,new _.UniMonitorReporter(e.endpoint)),t.client.getContext().getViews=C.getCurViews,(0,h.isFunction)(T.sdk.onAppHide)&&T.sdk.onAppHide((function(){var e;null===(e=h.Telemetry.get())||void 0===e||e.flush()}))),t}))}},{key:"getConfig",value:function(){var e;return null===(e=this.configManager)||void 0===e?void 0:e.getConfig()}},{key:"setConfig",value:function(){var e=this.configManager;if(e)if(2===arguments.length){var t=e.getConfig();e.setConfig(Object.assign({},t,o({},0>=arguments.length?void 0:arguments[0],1>=arguments.length?void 0:arguments[1])))}else e.setConfig(0>=arguments.length?void 0:arguments[0])}},{key:"setVue",value:function(e){this.setConfig("vue",e),(0,P.mixin)(e)}}])}(h.Shell);t.ArmsRum=R,t.default=new R},function(e,t,n){"use strict";function r(e){return(r="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function o(){/*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/babel/babel/blob/main/packages/babel-helpers/LICENSE */var e,t,n="function"==typeof Symbol?Symbol:{},r=n.iterator||"@@iterator",u=n.toStringTag||"@@toStringTag";function a(n,r,o,u){var a=r&&r.prototype instanceof s?r:s,f=Object.create(a.prototype);return i(f,"_invoke",function(n,r,o){var i,u,a,s=0,f=o||[],l=!1,p={p:0,n:0,v:e,a:v,f:v.bind(e,4),d:function t(n,r){return i=n,u=0,a=e,p.n=r,c}};function v(n,r){for(u=n,a=r,t=0;!l&&s&&!o&&t<f.length;t++){var o,i=f[t],v=p.p,y=i[2];n>3?(o=y===r)&&(a=i[(u=i[4])?5:(u=3,3)],i[4]=i[5]=e):i[0]<=v&&((o=n<2&&v<i[1])?(u=0,p.v=r,p.n=i[1]):v<y&&(o=n<3||i[0]>r||r>y)&&(i[4]=n,i[5]=r,p.n=y,u=0))}if(o||n>1)return c;throw l=!0,r}return function(o,f,y){if(s>1)throw TypeError("Generator is already running");for(l&&1===f&&v(f,y),u=f,a=y;(t=u<2?e:a)||!l;){i||(u?u<3?(u>1&&(p.n=-1),v(u,a)):p.n=a:p.v=a);try{if(s=2,i){if(u||(o="next"),t=i[o]){if(!(t=t.call(i,a)))throw TypeError("iterator result is not an object");if(!t.done)return t;a=t.value,u<2&&(u=0)}else 1===u&&(t=i.return)&&t.call(i),u<2&&(a=TypeError("The iterator does not provide a '"+o+"' method"),u=1);i=e}else if((t=(l=p.n<0)?a:n.call(r,p))!==c)break}catch(t){i=e,u=1,a=t}finally{s=1}}return{value:t,done:l}}}(n,o,u),!0),f}var c={};function s(){}function f(){}function l(){}t=Object.getPrototypeOf;var p=[][r]?t(t([][r]())):(i(t={},r,(function(){return this})),t),v=l.prototype=s.prototype=Object.create(p);function y(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,l):(e.__proto__=l,i(e,u,"GeneratorFunction")),e.prototype=Object.create(v),e}return f.prototype=l,i(v,"constructor",l),i(l,"constructor",f),f.displayName="GeneratorFunction",i(l,u,"GeneratorFunction"),i(v),i(v,u,"Generator"),i(v,r,(function(){return this})),i(v,"toString",(function(){return"[object Generator]"})),(o=function e(){return{w:a,m:y}})()}function i(e,t,n,r){var o=Object.defineProperty;try{o({},"",{})}catch(e){o=0}(i=function e(t,n,r,u){function a(e,n){i(t,e,(function(t){return this._invoke(e,n,t)}))}n?o?o(t,n,{value:r,enumerable:!u,configurable:!u,writable:!u}):t[n]=r:(a("next",0),a("throw",1),a("return",2))})(e,t,n,r)}function u(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function a(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,s(r.key),r)}}function c(e,t,n){return t&&a(e.prototype,t),n&&a(e,n),Object.defineProperty(e,"prototype",{writable:!1}),e}function s(e){var t=f(e,"string");return"symbol"==r(t)?t:t+""}function f(e,t){if("object"!=r(e)||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var o=n.call(e,t||"default");if("object"!=r(o))return o;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}var l=this&&this.__awaiter||function(e,t,n,r){function o(e){return e instanceof n?e:new n((function(t){t(e)}))}return new(n||(n=Promise))((function(n,i){function u(e){try{c(r.next(e))}catch(e){i(e)}}function a(e){try{c(r.throw(e))}catch(e){i(e)}}function c(e){e.done?n(e.value):o(e.value).then(u,a)}c((r=r.apply(e,t||[])).next())}))};Object.defineProperty(t,"__esModule",{value:!0});var p=n(4),v=n(7),y=n(26),d=n(1),g=n(17),h=n(6),m=3e3,b=20,w=["app","user","device","os","geo","isp","net","properties"],S=function(){function e(){u(this,e),this.name="reporter",this.eventQueue=[],this._init=!1}return c(e,[{key:"getReportCfg",value:function e(){var t=this.ctx.getConfig().reportConfig;return(0,d.isObject)(t)||(t={}),(!t.flushTime||t.flushTime<0||t.flushTime>1e4)&&(t.flushTime=3e3),(!t.maxEventCount||t.maxEventCount<1||t.maxEventCount>100)&&(t.maxEventCount=20),t}},{key:"report",value:function e(t,n){var r=this;if(this.ctx=t,this._init||(this.init(t),this._init=!0),n&&n.single)this.flushSingleEvent(t);else{clearTimeout(this.timer),this.pushToQueue();var o=this.getReportCfg();n&&n.immediate||this.eventQueue.length>=o.maxEventCount?this.flushEventQueue():this.timer=setTimeout((function(){r.flushEventQueue()}),o.flushTime)}}},{key:"flushSingleEvent",value:function e(t){var n,r=t.session,o;if(!r||r.getSampled()){var i=t.getRumEvent(),u=t.getViews(),a=u[u.length-1];(null===(n=i.view)||void 0===n?void 0:n.id)===a.id&&delete i.view,this.dispatchEvents(t,[i],a)}}},{key:"pushToQueue",value:function e(){var t=this.ctx,n=this.eventQueue,r=t.getRumEvent();if(r.event_type===v.RumEventType.EXCEPTION){var o=r.message,i=r.stack,u=(0,y.getErrorID)({message:o,stack:i}),a=this.eventQueue.find((function(e){if(e.event_type===v.RumEventType.EXCEPTION){var t=e.message,n=e.stack;return(0,y.getErrorID)({message:t,stack:n})===u}}));if(a)return void a.times++}if(r.event_type===v.RumEventType.ACTION){var c=r.target_name,s=this.eventQueue.find((function(e){if(e.event_type===v.RumEventType.ACTION)return c===e.target_name}));if(s)return void s.times++}n.push(r)}},{key:"flushEventQueue",value:function e(){var t=this.ctx,n=this.eventQueue;if(n.length){var r=t.getViews(),o=r[r.length-1];r.forEach((function(e){var t;e.id===o.id&&n.filter((function(t){var n;return(null===(n=t.view)||void 0===n?void 0:n.id)===e.id})).forEach((function(e){delete e.view}))}));var i=t.session,u;(!i||i.getSampled())&&this.dispatchEvents(t,n,o),this.eventQueue=[]}}},{key:"dispatchEvents",value:function e(t,n,r){for(var o=t.getConfig(),i=t.session,u=i.getSessionId(),a=[],c={},s=0;s<n.length;s++){var f=n[s];if(f.session_id&&f.session_id!==u){var l=f.session_id;c[l]||(c[l]=[]),delete f.session_id,c[l].push(f)}else delete f.session_id,a.push(f)}a.length>0&&this.buildAndSend(t,o,i,u,a,r);for(var p=Object.keys(c),v=0;v<p.length;v++){var y=p[v];this.buildAndSend(t,o,i,y,c[y],r)}}},{key:"buildAndSend",value:function e(t,n,r,o,i,u){var a=(0,h.getUrlParams)(n.endpoint),c=Object.assign({app:{id:n.pid,env:n.env||"prod",version:n.version,type:""},user:{id:r.getUserId()},session:{id:o},net:{},view:u,events:i},a);w.forEach((function(e){var t=n[e];(0,d.isObject)(t)&&Object.keys(t).forEach((function(n){var r=t[n];"user"===e&&"id"===n||("properties"===e?c[e]=(0,g.verifyProperties)(t):((0,d.isString)(r)||(0,d.isNumber)(r))&&(e in c||(c[e]={}),c[e][n]=r))}))})),("function"!=typeof n.beforeReport||(c=n.beforeReport(c)))&&this.tryRequest(c)}},{key:"tryRequest",value:function e(t){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,r,i,u;return l(this,void 0,void 0,o().m((function e(){var a=this,c,s,f,l;return o().w((function(e){for(;;)switch(e.p=e.n){case 0:return c=null===(r=this.ctx.getConfig())||void 0===r?void 0:r.reportConfig,s=null!==(i=null==c?void 0:c.maxRetryCount)&&void 0!==i?i:0,f=null!==(u=null==c?void 0:c.retryDelay)&&void 0!==u?u:3e3,e.p=1,t._retry=n,e.n=2,this.request(this.ctx,t);case 2:e.n=4;break;case 3:e.p=3,l=e.v,n<s-1?setTimeout((function(){return a.tryRequest(t,n+1)}),f):p.logger.error("reporter","Request failed after ".concat(n+1," attempts"),l);case 4:return e.a(2)}}),e,this,[[1,3]])})))}},{key:"init",value:function e(t){}}])}();t.default=S},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.getErrorID=void 0;var r=function e(t){var n=t.message,r=void 0===n?"":n,o=t.stack,i;return r+(void 0===o?"":o)};t.getErrorID=r},function(e,t,n){"use strict";function r(e){return(r="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function o(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function i(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,a(r.key),r)}}function u(e,t,n){return t&&i(e.prototype,t),n&&i(e,n),Object.defineProperty(e,"prototype",{writable:!1}),e}function a(e){var t=c(e,"string");return"symbol"==r(t)?t:t+""}function c(e,t){if("object"!=r(e)||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var o=n.call(e,t||"default");if("object"!=r(o))return o;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}Object.defineProperty(t,"__esModule",{value:!0});var s=n(7),f=n(11),l=n(1),p=function(){function e(t){o(this,e),this.client=new f.default,t&&this.init&&this.init(t)}return u(e,[{key:"sendEvent",value:function e(t,n){this.client&&this.client.sendEvent(t,n)}},{key:"getConfig",value:function e(){if(this.client)return this.client.getContext().getConfig()}},{key:"sendCustom",value:function e(t){if(t.name&&t.type){var n=Object.assign(Object.assign({},t),{event_type:s.RumEventType.CUSTOM});this.sendEvent(n)}}},{key:"sendView",value:function e(t){if((0,l.isObject)(t)){if(t.type||(t.type="custom"),"custom"===t.type){var n=0;if(["t1","t2","t3"].forEach((function(e){(0,l.isNumber)(t[e])||delete t[e],e in t&&n++})),0===n)return}var r=Object.assign(Object.assign({},t),{event_type:s.RumEventType.VIEW});this.sendEvent(r)}}},{key:"sendException",value:function e(t){if(t.name&&t.message){var n=t.name,r=t.message,o=t.stack,i=Object.assign(Object.assign({times:1,name:n,message:r,stack:o},t),{event_type:s.RumEventType.EXCEPTION,type:"custom",source:"custom"});this.sendEvent(i)}}},{key:"sendResource",value:function e(t){if(t.name&&t.type&&(0,l.isNumber)(t.duration)){var n=Object.assign(Object.assign({times:1},t),{event_type:s.RumEventType.RESOURCE});this.sendEvent(n)}}}])}();t.default=p},function(e,t,n){"use strict";function r(e){return(r="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function o(){/*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/babel/babel/blob/main/packages/babel-helpers/LICENSE */var e,t,n="function"==typeof Symbol?Symbol:{},r=n.iterator||"@@iterator",u=n.toStringTag||"@@toStringTag";function a(n,r,o,u){var a=r&&r.prototype instanceof s?r:s,f=Object.create(a.prototype);return i(f,"_invoke",function(n,r,o){var i,u,a,s=0,f=o||[],l=!1,p={p:0,n:0,v:e,a:v,f:v.bind(e,4),d:function t(n,r){return i=n,u=0,a=e,p.n=r,c}};function v(n,r){for(u=n,a=r,t=0;!l&&s&&!o&&t<f.length;t++){var o,i=f[t],v=p.p,y=i[2];n>3?(o=y===r)&&(a=i[(u=i[4])?5:(u=3,3)],i[4]=i[5]=e):i[0]<=v&&((o=n<2&&v<i[1])?(u=0,p.v=r,p.n=i[1]):v<y&&(o=n<3||i[0]>r||r>y)&&(i[4]=n,i[5]=r,p.n=y,u=0))}if(o||n>1)return c;throw l=!0,r}return function(o,f,y){if(s>1)throw TypeError("Generator is already running");for(l&&1===f&&v(f,y),u=f,a=y;(t=u<2?e:a)||!l;){i||(u?u<3?(u>1&&(p.n=-1),v(u,a)):p.n=a:p.v=a);try{if(s=2,i){if(u||(o="next"),t=i[o]){if(!(t=t.call(i,a)))throw TypeError("iterator result is not an object");if(!t.done)return t;a=t.value,u<2&&(u=0)}else 1===u&&(t=i.return)&&t.call(i),u<2&&(a=TypeError("The iterator does not provide a '"+o+"' method"),u=1);i=e}else if((t=(l=p.n<0)?a:n.call(r,p))!==c)break}catch(t){i=e,u=1,a=t}finally{s=1}}return{value:t,done:l}}}(n,o,u),!0),f}var c={};function s(){}function f(){}function l(){}t=Object.getPrototypeOf;var p=[][r]?t(t([][r]())):(i(t={},r,(function(){return this})),t),v=l.prototype=s.prototype=Object.create(p);function y(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,l):(e.__proto__=l,i(e,u,"GeneratorFunction")),e.prototype=Object.create(v),e}return f.prototype=l,i(v,"constructor",l),i(l,"constructor",f),f.displayName="GeneratorFunction",i(l,u,"GeneratorFunction"),i(v),i(v,u,"Generator"),i(v,r,(function(){return this})),i(v,"toString",(function(){return"[object Generator]"})),(o=function e(){return{w:a,m:y}})()}function i(e,t,n,r){var o=Object.defineProperty;try{o({},"",{})}catch(e){o=0}(i=function e(t,n,r,u){function a(e,n){i(t,e,(function(t){return this._invoke(e,n,t)}))}n?o?o(t,n,{value:r,enumerable:!u,configurable:!u,writable:!u}):t[n]=r:(a("next",0),a("throw",1),a("return",2))})(e,t,n,r)}function u(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function a(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,s(r.key),r)}}function c(e,t,n){return t&&a(e.prototype,t),n&&a(e,n),Object.defineProperty(e,"prototype",{writable:!1}),e}function s(e){var t=f(e,"string");return"symbol"==r(t)?t:t+""}function f(e,t){if("object"!=r(e)||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var o=n.call(e,t||"default");if("object"!=r(o))return o;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}var l=this&&this.__awaiter||function(e,t,n,r){function o(e){return e instanceof n?e:new n((function(t){t(e)}))}return new(n||(n=Promise))((function(n,i){function u(e){try{c(r.next(e))}catch(e){i(e)}}function a(e){try{c(r.throw(e))}catch(e){i(e)}}function c(e){e.done?n(e.value):o(e.value).then(u,a)}c((r=r.apply(e,t||[])).next())}))};function p(e){var t=e.remoteConfig||{},n=!1;return"enable"in t?n=!!t.enable:(t.region||t.url)&&(n=!0),{enable:n,url:t.url||"",mode:t.mode||"launch-first",cacheTimeout:t.cacheTimeout||36e5,region:t.region}}Object.defineProperty(t,"__esModule",{value:!0}),t.ConfigManager=void 0;var v=function(){function e(){u(this,e),this.currentConfig=null,this.initialized=!1}return c(e,[{key:"init",value:function e(t){return l(this,void 0,void 0,o().m((function e(){var n=this,r,i,u;return o().w((function(e){for(;;)switch(e.n){case 0:if(!this.initialized){e.n=1;break}return e.a(2);case 1:if(this.currentConfig=Object.assign({},t),this.initialized=!0,r=p(t),this.currentConfig.remoteConfig=r,r.enable){e.n=2;break}return e.a(2);case 2:return e.n=3,this.getCacheConfig();case 3:if((i=e.v)&&i.content&&(this.currentConfig=this.mergeRemoteCfg(i.content)),!this.isCacheValid(i,r.cacheTimeout)){e.n=4;break}return e.a(2);case 4:if(u=this.fetchRemoteCfg(this.currentConfig).then((function(e){if(e){var t=n.parseConfig(e);n.currentConfig=n.mergeRemoteCfg(t),n.setCacheConfig({timestamp:Date.now(),content:e})}})),"remote-first"!==r.mode){e.n=5;break}return e.n=5,u;case 5:return e.a(2)}}),e,this)})))}},{key:"getConfig",value:function e(){if(!this.currentConfig)throw new Error("Config not initialized");return this.currentConfig}},{key:"setConfig",value:function e(t){return l(this,void 0,void 0,o().m((function e(){return o().w((function(e){for(;;)switch(e.n){case 0:if(this.currentConfig){e.n=1;break}return e.a(2);case 1:this.currentConfig=Object.assign(Object.assign({},this.currentConfig),t);case 2:return e.a(2)}}),e,this)})))}},{key:"isCacheValid",value:function e(t,n){if(!t||!t.timestamp)return!1;var r=n||36e5;return Date.now()-t.timestamp<r}},{key:"mergeRemoteCfg",value:function e(t){var n=this.currentConfig,r=n.pid,o=n.app,i=n.endpoint,u=n.remoteConfig,a=n.beforeReport,c=n.properties;return Object.assign(Object.assign(Object.assign({},this.currentConfig),t),{pid:r,app:o,endpoint:i,remoteConfig:u,beforeReport:a,properties:c})}},{key:"destroy",value:function e(){this.currentConfig=null,this.initialized=!1}}])}();t.ConfigManager=v},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0})},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0})},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0})},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0})},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0})},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.parseTracingOptions=t.makeTracingHeaders=t.isTraceOption=void 0;var r=n(20),o=n(1);function i(e){return e&&(0,r.isMatchOption)(e.match)&&(0,o.isArray)(e.propagatorTypes)}function u(e,t,n,r){var i=arguments.length>4&&void 0!==arguments[4]?arguments[4]:{},u={},a=n?"1":"0";return r.includes("sw8")&&(r=["sw8"]),(0,o.isArray)(r)||(r=[r]),r.forEach((function(n){switch(n){case"jaeger":u["uber-trace-id"]="".concat(e,":").concat(t,":0:").concat(a);break;case"b3":u.b3="".concat(e,"-").concat(t,"-").concat(a);break;case"b3multi":u["X-B3-TraceId"]=e,u["X-B3-SpanId"]=t,u["X-B3-Sampled"]=a;break;case"sw8":if((0,o.isFunction)(btoa)){var r=btoa(e),c=btoa(t),s=btoa(i.appId),f=btoa(i.appVersion),l=btoa(i.viewName),p=btoa(i.host);u.sw8="".concat(a,"-").concat(r,"-").concat(c,"-",0,"-").concat(s,"-").concat(f,"-").concat(l,"-").concat(p)}break;case"tracecontext":default:u.traceparent="00-".concat(e,"-").concat(t,"-0").concat(a),i.tracestate&&(u.tracestate=i.tracestate)}})),i.baggage&&(u.baggage=i.baggage),u}function a(e){var t=["tracecontext"];if((0,o.isBoolean)(e)||!e)return{enable:!!e,sample:100,propagatorTypes:t,allowedUrls:[],tracestate:!0,baggage:!1};var n=e.enable,u=void 0===n||n,a=e.sample,c=void 0===a?100:a,s=e.propagatorTypes,f=void 0===s?t:s,l=e.allowedUrls,p=void 0===l?[]:l,v=e.tracestate,y=void 0===v||v,d=e.baggage,g=void 0!==d&&d,h=[];return(0,o.isArray)(p)&&p.length&&p.forEach((function(e){(0,r.isMatchOption)(e)?h.push({match:e,propagatorTypes:f}):i(e)&&h.push(e)})),{enable:!(0,o.isBoolean)(u)||u,sample:(0,o.isNumber)(c)?c:100,propagatorTypes:f,allowedUrls:h,tracestate:y,baggage:g}}t.isTraceOption=i,t.makeTracingHeaders=u,t.parseTracingOptions=a},function(e,t,n){"use strict";function r(e,t){var n=0,r=null,o=function t(){n=Date.now(),r=null,e()},i=function e(){var i=t-(Date.now()-n);i<=0?(r&&(clearTimeout(r),r=null),o()):r||(r=setTimeout(o,i))};return i.cancel=function(){r&&(clearTimeout(r),r=null),n=0},i}Object.defineProperty(t,"__esModule",{value:!0}),t.throttle=void 0,t.throttle=r},function(e,t,n){"use strict";function r(){var e=[];return{add:function t(){e.push.apply(e,arguments)},dispose:function t(){e.forEach((function(e){return e()})),e.length=0}}}Object.defineProperty(t,"__esModule",{value:!0}),t.createDisposableGroup=void 0,t.createDisposableGroup=r},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.encodeLogGroup=t.convertBundlesToLogGroup=t.Telemetry=t.callMonitored=t.logger=void 0;var r=n(4);Object.defineProperty(t,"logger",{enumerable:!0,get:function e(){return r.logger}}),Object.defineProperty(t,"callMonitored",{enumerable:!0,get:function e(){return r.callMonitored}});var o=n(13);Object.defineProperty(t,"Telemetry",{enumerable:!0,get:function e(){return o.Telemetry}}),Object.defineProperty(t,"convertBundlesToLogGroup",{enumerable:!0,get:function e(){return o.convertBundlesToLogGroup}});var i=n(14);Object.defineProperty(t,"encodeLogGroup",{enumerable:!0,get:function e(){return i.encodeLogGroup}})},function(e,t,n){"use strict";function r(e){return(r="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function o(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function i(e,t){for(var n,r=0;r<t.length;r++)(n=t[r]).enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,a(n.key),n)}function u(e,t,n){return t&&i(e.prototype,t),n&&i(e,n),Object.defineProperty(e,"prototype",{writable:!1}),e}function a(e){var t=c(e,"string");return"symbol"==r(t)?t:t+""}function c(e,t){if("object"!=r(e)||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var o=n.call(e,t||"default");if("object"!=r(o))return o;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}Object.defineProperty(t,"__esModule",{value:!0});var s=n(0),f=n(3),l=n(2),p=["navigateTo","redirectTo","switchTab"],v=function(){function e(){var t=this;o(this,e),this.name="pv-collector",this.sendPv=s.logger.wrap((function(){var e=(0,f.getCurView)(t.ctx);e&&clearInterval(t.timer),e&&"_noReport"in e&&(delete e._noReport,t.sendEvent(Object.assign({event_type:s.RumEventType.VIEW,type:"pv",loading_type:"initial_load"},e)))}),"pv-collector","sendPv failed")}return u(e,[{key:"setup",value:function(e,t){var n=this;this.ctx=e,this.sendEvent=t,setTimeout(this.sendPv,100),this.timer=setInterval((function(){n.sendPv()}),100),(0,s.isFunction)(l.sdk.addInterceptor)&&p.forEach((function(e){l.sdk.addInterceptor(e,{success:n.sendPv})}))}},{key:"destroy",value:function(){}}])}();t.default=v},function(e,t,n){"use strict";(function(e){function r(e){return(r="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function o(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function i(e,t){for(var n,r=0;r<t.length;r++)(n=t[r]).enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,a(n.key),n)}function u(e,t,n){return t&&i(e.prototype,t),n&&i(e,n),Object.defineProperty(e,"prototype",{writable:!1}),e}function a(e){var t=c(e,"string");return"symbol"==r(t)?t:t+""}function c(e,t){if("object"!=r(e)||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var o=n.call(e,t||"default");if("object"!=r(o))return o;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}Object.defineProperty(t,"__esModule",{value:!0});var s=n(0),f=n(8),l=n(2),p=function(){function t(){var e=this;o(this,t),this.name="exception-collector",this.vueError=function(t,n){e.errorHandle(n,"Vue.onError")},this.uniError=function(t){e.errorHandle(t,"uni.onError")},this.onError=function(t){e.errorHandle(t,"onError")},this.onUnhandledRejection=function(t){if(t){var n=t.reason;if(n){var r=n.errMsg;if(r&&(0,s.isString)(r)){(n=new Error(r)).name="",n.stack="";for(var o,i,u=0,a=["navigateTo","redirectTo","appLaunch","switchTab","getLocation","onLocationChange"];u<a.length;u++)if(o=a[u],r.startsWith(o)){n.name=o;break}n.name||(n.name=r.split(":")[0])}e.errorHandle(n,"onUnhandledRejection")}}},this.errorHandle=function(t){var n,r,o,i,u,a,c=1<arguments.length&&void 0!==arguments[1]?arguments[1]:"";if(t instanceof Object){if(n=t.name,r=t.message,o=t.filename||t.fileName,i=t.stack,u=t.lineno||t.lineNumber,a=t.colno||t.columnNumber,t.error instanceof Error){var f=t.error;n=f.name,r=f.message,i=f.stack}}else if("string"==typeof t){i=t;var l=e.getErrorByStack(t);l&&(n=l.name,r=l.message),n&&r||(n=n||"Error",r=r||t)}n&&r&&e.sendEvent({event_type:s.RumEventType.EXCEPTION,source:c,type:"error",name:n,message:r,file:o,stack:i,line:u,column:a,times:1})}}return u(t,[{key:"setup",value:function(e,t){this.ctx=e,this.sendEvent=t,this.hackOrigin()}},{key:"hackOrigin",value:function(){var t=this,n,r=this.ctx.getConfig().collectors,o=void 0===r?{}:r;if(!1!==o.jsError)try{(0,f.addEventListener)("onError",this.vueError),e.addEventListener("error",this.onError),e.addEventListener("unhandledrejection",this.onUnhandledRejection),(0,s.isFunction)(l.sdk.onError)&&l.sdk.onError(this.uniError)}catch(t){s.logger.error("exception-collector","setup error listeners failed",t)}!1!==o.consoleError&&(0,s.interceptFunction)(console,"error",(function(e){t.errorHandle(e,"console.error")}))}},{key:"getErrorByStack",value:function(){var e=0<arguments.length&&void 0!==arguments[0]?arguments[0]:"",t=e.split("\n");if(!(2>t.length))for(var n=function e(t){var n=t.trim();return n.startsWith("at ")||/@.+:\d+:\d+/.test(n)},r=1;r<t.length;r++)if(n(t[r])){var o=t[r-1],i=o.indexOf(": ");return-1===i?{name:"",message:o}:{name:o.substring(0,i),message:o.substring(i+2)}}}},{key:"destroy",value:function t(){(0,s.restoreFunction)(e.console,"error")}}])}();t.default=p}).call(this,n(21))},function(e,t,n){"use strict";function r(e){return(r="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function o(){function e(e,n,r,o){var u=n&&n.prototype instanceof t?n:t,s=Object.create(u.prototype);return i(s,"_invoke",function(e,t,n){function r(e,t){for(i=e,u=t,c=0;!l&&s&&!n&&c<f.length;c++){var n,r=f[c],o=v.p,y=r[2];3<e?(n=y===t)&&(u=r[(i=r[4])?5:(i=3,3)],r[4]=r[5]=a):r[0]<=o&&((n=2>e&&o<r[1])?(i=0,v.v=t,v.n=r[1]):o<y&&(n=3>e||r[0]>t||t>y)&&(r[4]=e,r[5]=t,v.n=y,i=0))}if(n||1<e)return p;throw l=!0,t}var o,i,u,s=0,f=n||[],l=!1,v={p:0,n:0,v:a,a:r,f:r.bind(a,4),d:function e(t,n){return o=t,i=0,u=a,v.n=n,p}};return function(n,f,y){if(1<s)throw TypeError("Generator is already running");for(l&&1===f&&r(f,y),i=f,u=y;(c=2>i?a:u)||!l;){o||(i?3>i?(1<i&&(v.n=-1),r(i,u)):v.n=u:v.v=u);try{if(s=2,o){if(i||(n="next"),c=o[n]){if(!(c=c.call(o,u)))throw TypeError("iterator result is not an object");if(!c.done)return c;u=c.value,2>i&&(i=0)}else 1===i&&(c=o.return)&&c.call(o),2>i&&(u=TypeError("The iterator does not provide a '"+n+"' method"),i=1);o=a}else if((c=(l=0>v.n)?u:e.call(t,v))!==p)break}catch(e){o=a,i=1,u=e}finally{s=1}}return{value:c,done:l}}}(e,r,o),!0),s}function t(){}function n(){}function r(){}function u(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,r):(e.__proto__=r,i(e,l,"GeneratorFunction")),e.prototype=Object.create(y),e}/*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/babel/babel/blob/main/packages/babel-helpers/LICENSE */var a,c,s="function"==typeof Symbol?Symbol:{},f=s.iterator||"@@iterator",l=s.toStringTag||"@@toStringTag",p={};c=Object.getPrototypeOf;var v=[][f]?c(c([][f]())):(i(c={},f,(function(){return this})),c),y=r.prototype=t.prototype=Object.create(v);return n.prototype=r,i(y,"constructor",r),i(r,"constructor",n),n.displayName="GeneratorFunction",i(r,l,"GeneratorFunction"),i(y),i(y,l,"Generator"),i(y,f,(function(){return this})),i(y,"toString",(function(){return"[object Generator]"})),(o=function t(){return{w:e,m:u}})()}function i(e,t,n,r){var o=Object.defineProperty;try{o({},"",{})}catch(e){o=0}(i=function e(t,n,r,u){function a(e,n){i(t,e,(function(t){return this._invoke(e,n,t)}))}n?o?o(t,n,{value:r,enumerable:!u,configurable:!u,writable:!u}):t[n]=r:(a("next",0),a("throw",1),a("return",2))})(e,t,n,r)}function u(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function a(e,t){for(var n,r=0;r<t.length;r++)(n=t[r]).enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,s(n.key),n)}function c(e,t,n){return t&&a(e.prototype,t),n&&a(e,n),Object.defineProperty(e,"prototype",{writable:!1}),e}function s(e){var t=f(e,"string");return"symbol"==r(t)?t:t+""}function f(e,t){if("object"!=r(e)||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var o=n.call(e,t||"default");if("object"!=r(o))return o;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}var l=this&&this.__awaiter||function(e,t,n,r){function o(e){return e instanceof n?e:new n((function(t){t(e)}))}return new(n||(n=Promise))((function(n,i){function u(e){try{c(r.next(e))}catch(e){i(e)}}function a(e){try{c(r.throw(e))}catch(e){i(e)}}function c(e){e.done?n(e.value):o(e.value).then(u,a)}c((r=r.apply(e,t||[])).next())}))};Object.defineProperty(t,"__esModule",{value:!0});var p=n(0),v=n(2),y=n(9),d=n(10),g=n(3),h=n(41),m=function(){function e(){var t=this;u(this,e),this.name="api-collector",this.sendApi=function(e,n,r){return l(t,void 0,void 0,o().m((function t(){var i,u,a,c,s,f,l,v,y,g,m;return o().w((function(t){for(;;)switch(t.p=t.n){case 0:if(i=this.ctx.getConfig(),u=i.evaluateApi,a=n.statusCode,c=n.status,s=n.errMsg,f=n.errorMessage,l=n.message,!(0,p.isFunction)(u)){t.n=4;break}return t.p=1,0===e.success&&(v=new Error("request error")),t.n=2,u(r,n,v);case 2:y=t.v,e=Object.assign(Object.assign({},e),(0,h.reviseApiAttr)(y)),t.n=4;break;case 3:t.p=3,m=t.v,p.logger.error("api-collector","evaluateApi failed",m);case 4:if(!((g=Object.assign({event_type:p.RumEventType.RESOURCE,type:"api",status_code:c||a,message:f||s||l,duration:(0,d.getCurrentTime)()-e.timestamp,times:1},e)).duration>p.ONE_DAY)){t.n=5;break}return t.a(2);case 5:this.sendEvent(g);case 6:return t.a(2)}}),t,this,[[1,3]])})))}}return c(e,[{key:"setup",value:function e(t,n){var r,o=t.getConfig().collectors,i;!1===(void 0===o?{}:o).api||(this.ctx=t,this.sendEvent=n,this.interceptorRequest())}},{key:"interceptorRequest",value:function e(){if((0,p.isFunction)(v.sdk.addInterceptor)){var t=this;v.sdk.addInterceptor("request",{invoke:p.logger.wrap((function(e){t.rebuildRequestOptions(e)}),"api-collector","intercept request failed")})}}},{key:"injectTracing",value:function e(t,n){var r,o=this.ctx.getConfig(),i=o.tracing,u=o.pid,a=o.version,c=void 0===a?"1.0.0":a,s=(0,p.parseTracingOptions)(i),f=s.enable,l=s.sample,y=s.propagatorTypes,d=s.allowedUrls,g=s.tracestate,h=!(void 0!==g)||g,m=s.baggage,b=void 0!==m&&m;if(f){var w=(0,p.find)(d,(function(e){return(0,p.matchList)([e.match],t.url)}));if(w){var S=w.propagatorTypes;0===S.length&&(S=y);var O=!1;S.includes("sw8")&&(S=["sw8"],O=!0);var E=O?(0,p.generateGUID)():(0,p.generateTraceId)(),j=O?(0,p.generateGUID)():(0,p.generateSpanId)(),_=(0,p.performDraw)(l),T=this.ctx.session.getUserId(),k=this.ctx.session.getSessionId(),P=h?"rum=v2&uniapp&".concat(u,"&").concat(k,"&").concat(T):void 0,C=b?"rum=v2,appType=uniapp,pid=".concat(u,",sid=").concat(k,",uid=").concat(T):void 0,x=(0,p.makeTracingHeaders)(E,j,_,S,{tracestate:P,baggage:C,appId:u,appVersion:c,viewName:null===(r=t.view)||void 0===r?void 0:r.name,host:v.appName});_&&(t.trace_id=E,t.trace_data=JSON.stringify({spanId:j,sample:l,sampled:_,header:x})),n(x)}}}},{key:"rebuildRequestOptions",value:function e(t){var n=this,r=t.url,o=t.success,i=t.fail,u=t.complete,a=t.header,c=(0,d.getCurrentTime)();if((0,y.isEndpoint)(this.ctx,r)||(0,p.urlMatch)(r))return t;var s={view:(0,g.getCurView)(this.ctx),timestamp:c,url:r,name:this.getResourceName(r),method:t.method||"GET"};return this.injectTracing(s,(function(e){t.header=Object.assign(Object.assign({},a),e)})),t.success=function(){s.success=1;for(var e=arguments.length,t=Array(e),n=0;n<e;n++)t[n]=arguments[n];o&&o.apply(this,t)},t.fail=function(){s.success=0;for(var e=arguments.length,t=Array(e),n=0;n<e;n++)t[n]=arguments[n];i&&i.apply(this,t)},t.complete=function(){for(var e=arguments.length,r=Array(e),o=0;o<e;o++)r[o]=arguments[o];var i=Object.assign({},r[0]);try{s.success=s.success&&200<=i.statusCode&&300>i.statusCode?1:0,s.size=(0,d.getStringSize)(JSON.stringify(i)),n.sendApi(s,i,t)}catch(e){p.logger.error("api-collector","process response failed",e)}u&&u.apply(this,r)},t}},{key:"getResourceName",value:function e(t){var n,r,o=this.ctx.getConfig().parseResourceName;return n=(0,p.isFunction)(o)?o(t):(0,y.getPathByURL)(t)}}])}();t.default=m},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.reviseApiAttr=void 0;var r=n(0);function o(e){if(e&&(0,r.isObject)(e)){var t={};return(0,r.isString)(e.name)&&(t.name=e.name.substring(0,1e3)),(0,r.isString)(e.message)&&(t.message=e.message.substring(0,1e3)),"success"in e&&(t.success=e.success?1:0),(0,r.isNumber)(e.duration)&&0<=e.duration&&(t.duration=e.duration),(0,r.isString)(e.status_code)&&(t.status_code=e.status_code.substring(0,100)),(0,r.isNumber)(e.status_code)&&(t.status_code=e.status_code),(0,r.isString)(e.snapshots)&&(t.snapshots=e.snapshots.substring(0,5e3)),t}}t.reviseApiAttr=o},function(e,t,n){"use strict";function r(e){return(r="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function o(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function i(e,t){for(var n,r=0;r<t.length;r++)(n=t[r]).enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,a(n.key),n)}function u(e,t,n){return t&&i(e.prototype,t),n&&i(e,n),Object.defineProperty(e,"prototype",{writable:!1}),e}function a(e){var t=c(e,"string");return"symbol"==r(t)?t:t+""}function c(e,t){if("object"!=r(e)||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var o=n.call(e,t||"default");if("object"!=r(o))return o;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}Object.defineProperty(t,"__esModule",{value:!0});var s=n(0),f=n(8),l=n(3),p=function(){function e(){var t=this;o(this,e),this.name="action-collector",this.DELAY_TIME=300,this.events=["tap","click"],this.onEvent=function(e,n){if(n&&t.events.includes(n.type)){var r=n.currentTarget||n.target||{},o=r.id,i=r.dataset;if(!o&&n.target&&(o=n.target.id,i=n.target.dataset),o){var u=(0,l.getCurView)(t.ctx),a={event_type:s.RumEventType.ACTION,type:n.type,name:o,snapshots:i?JSON.stringify({dataset:i}).substring(0,1e3):void 0,times:1,view:u};clearTimeout(t.timer),t.lastEvent?t.lastEvent.name===a.name?t.lastEvent.times+=1:(t.sendAction(),t.lastEvent=a):t.lastEvent=a,t.timer=setTimeout(t.sendAction,t.DELAY_TIME)}}},this.sendAction=function(){t.lastEvent&&(t.sendEvent(t.lastEvent),t.lastEvent=null)}}return u(e,[{key:"setup",value:function(e,t){var n,r=e.getConfig().collectors,o;!1===(void 0===r?{}:r).action||(this.ctx=e,this.sendEvent=t,(0,f.addEventListener)("action",this.onEvent))}},{key:"destroy",value:function(){(0,f.removeEventListener)("action",this.onEvent)}}])}();t.default=p},function(e,t,n){"use strict";function r(e){return(r="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function o(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function i(e,t){for(var n,r=0;r<t.length;r++)(n=t[r]).enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,a(n.key),n)}function u(e,t,n){return t&&i(e.prototype,t),n&&i(e,n),Object.defineProperty(e,"prototype",{writable:!1}),e}function a(e){var t=c(e,"string");return"symbol"==r(t)?t:t+""}function c(e,t){if("object"!=r(e)||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var o=n.call(e,t||"default");if("object"!=r(o))return o;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}Object.defineProperty(t,"__esModule",{value:!0});var s=n(10),f=n(3),l=function(){function e(){o(this,e),this.name="default-processor"}return u(e,[{key:"process",value:function(e){var t=e.getRumEvent(),n=(0,f.getCurView)(e),r;return Object.assign({timestamp:(0,s.getCurrentTime)(),session_id:e.session.getSessionId(),event_id:e.session.getEventId(),view:n},t)}}])}();t.default=l},function(e,t,n){"use strict";function r(e){return(r="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function o(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function i(e,t){for(var n,r=0;r<t.length;r++)(n=t[r]).enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,a(n.key),n)}function u(e,t,n){return t&&i(e.prototype,t),n&&i(e,n),Object.defineProperty(e,"prototype",{writable:!1}),e}function a(e){var t=c(e,"string");return"symbol"==r(t)?t:t+""}function c(e,t){if("object"!=r(e)||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var o=n.call(e,t||"default");if("object"!=r(o))return o;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}Object.defineProperty(t,"__esModule",{value:!0});var s=n(0),f=function(){function e(){var t=this;o(this,e),this.name="session-processor",this.update=function(e){e&&!e.isTrusted||t.ctx.session.updateSession()}}return u(e,[{key:"setup",value:function(e){this.ctx=e,this.update=(0,s.debounce)(this.update,s.ONE_SECOND)}},{key:"process",value:function(e){return this.update(),e.getRumEvent()}}])}();t.default=f},function(e,t,n){"use strict";function r(e){return(r="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function o(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function i(e,t){for(var n,r=0;r<t.length;r++)(n=t[r]).enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,a(n.key),n)}function u(e,t,n){return t&&i(e.prototype,t),n&&i(e,n),Object.defineProperty(e,"prototype",{writable:!1}),e}function a(e){var t=c(e,"string");return"symbol"==r(t)?t:t+""}function c(e,t){if("object"!=r(e)||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var o=n.call(e,t||"default");if("object"!=r(o))return o;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}function s(e,t,n){return t=v(t),f(e,p()?Reflect.construct(t,n||[],v(e).constructor):t.apply(e,n))}function f(e,t){if(t&&("object"==r(t)||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return l(e)}function l(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function p(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(e){}return(p=function(){return!!e})()}function v(e){return(v=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function y(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&d(e,t)}function d(e,t){return(d=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e})(e,t)}Object.defineProperty(t,"__esModule",{value:!0});var g=n(0),h=n(2),m=function(e){function t(){var e;return o(this,t),(e=s(this,t,arguments)).name="uni-reporter",e}return y(t,e),u(t,[{key:"init",value:function(){var e=this;(0,g.isFunction)(h.sdk.onAppHide)&&h.sdk.onAppHide((function(){e.flushEventQueue()}))}},{key:"request",value:function(e,t){var n=e.getConfig();(0,h.fixAttrs)(t).then((function(e){h.sdk.request({url:n.endpoint,method:"POST",header:{"Content-Type":"text/plain"},dataType:"text",data:JSON.stringify(e)})})).catch((function(e){g.logger.error("uni-reporter","request failed",e)}))}}])}(g.Reporter);t.default=m},function(e,t,n){"use strict";function r(e){return(r="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function o(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function i(e,t){for(var n,r=0;r<t.length;r++)(n=t[r]).enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,a(n.key),n)}function u(e,t,n){return t&&i(e.prototype,t),n&&i(e,n),Object.defineProperty(e,"prototype",{writable:!1}),e}function a(e){var t=c(e,"string");return"symbol"==r(t)?t:t+""}function c(e,t){if("object"!=r(e)||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var o=n.call(e,t||"default");if("object"!=r(o))return o;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}Object.defineProperty(t,"__esModule",{value:!0}),t.UniMonitorReporter=void 0;var s=n(0),f=n(2),l=n(9),p=function(){function e(t){o(this,e),this.endpoint=this.buildMonitorEndpoint(t)}return u(e,[{key:"send",value:function(e){if(e&&0!==e.length)try{var t=(0,s.convertBundlesToLogGroup)(e);f.sdk.request({url:this.endpoint,method:"POST",header:{"Content-Type":"application/x-protobuf","x-log-apiversion":"0.6.0","x-log-compresstype":"","x-log-date":(new Date).toUTCString()},data:t.buffer})}catch(e){s.logger.warn("monitor-reporter","Monitor data send failed",e)}}},{key:"buildMonitorEndpoint",value:function(e){try{var t=(0,l.getURL)(e);return"".concat(t.protocol,"://").concat(t.host,"/rum/monitor")}catch(t){return e}}}])}();t.UniMonitorReporter=p},function(e,t,n){"use strict";function r(e){return(r="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function o(e,t){return s(e)||c(e,t)||u(e,t)||i()}function i(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function u(e,t){if(e){if("string"==typeof e)return a(e,t);var n={}.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?a(e,t):void 0}}function a(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}function c(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var r,o,i,u,a=[],c=!0,s=!1;try{if(i=(n=n.call(e)).next,0===t){if(Object(n)!==n)return;c=!1}else for(;!(c=(r=i.call(n)).done)&&(a.push(r.value),a.length!==t);c=!0);}catch(c){s=!0,o=c}finally{try{if(!c&&null!=n.return&&(u=n.return(),Object(u)!==u))return}finally{if(s)throw o}}return a}}function s(e){if(Array.isArray(e))return e}function f(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function l(e,t){for(var n,r=0;r<t.length;r++)(n=t[r]).enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,v(n.key),n)}function p(e,t,n){return t&&l(e.prototype,t),n&&l(e,n),Object.defineProperty(e,"prototype",{writable:!1}),e}function v(e){var t=y(e,"string");return"symbol"==r(t)?t:t+""}function y(e,t){if("object"!=r(e)||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var o=n.call(e,t||"default");if("object"!=r(o))return o;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}Object.defineProperty(t,"__esModule",{value:!0}),t.RumSession=void 0;var d=n(0),g=n(10),h=n(3),m=n(2),b="_arms_uid",w="_arms_session",S=function(){function e(){f(this,e),this.appType="uniapp",this.sdkVersion=m.VERSION}return p(e,[{key:"init",value:function(e){var t;this.ctx=e,this.sessionConfig=this.fixSessionConfig(null===(t=e.getConfig())||void 0===t?void 0:t.sessionConfig)}},{key:"getSessionId",value:function(){return this.getSessionInfo().sessionId}},{key:"getSampled",value:function(){return this.getSessionInfo().sampled}},{key:"checkSession",value:function(e){var t=this.sessionConfig,n=t.overtime,r=t.maxDuration,o=(0,g.getCurrentTime)();return!(e.startTime+r<o||e.lastTime+n<o)}},{key:"updateSession",value:function(){var e=this.getSessionInfo();if(!e.isNew){var t=e.startTime,n=(0,g.getCurrentTime)(),r=e.sampled?1:0;(0,m.setStorageSync)(w,"".concat(e.sessionId,"-").concat(r,"-").concat(t,"-").concat(n))}}},{key:"getSessionInfo",value:function(){var e,t=o(((0,m.getStorageSync)(w)||"").split("-"),4),n=t[0],r=t[1],i=t[2],u=t[3],a={sessionId:n,sampled:"0"!==r,startTime:parseInt(i||"")||0,lastTime:parseInt(u||"")||0};return this.checkSession(a)||(a=this.resetSession()),a}},{key:"getEventId",value:function(){return(0,d.generateEventId)(this.getSessionId())}},{key:"getViewId",value:function(){return this.getUUID()}},{key:"getUserId",value:function(){var e=(0,m.getStorageSync)(b);return e&&0===e.indexOf("user_")&&(e=""),e||(e="uid_".concat((0,d.generateSpanId)(16,36)),(0,m.setStorageSync)(b,e)),e}},{key:"resetSession",value:function(){var e=this.sessionConfig.sampling,t=this.getUUID(),n=(0,g.getCurrentTime)(),r=(0,d.performDraw)(e),o="".concat(t,"-").concat(r?1:0,"-").concat(n,"-").concat(n);return(0,m.setStorageSync)(w,o),{sessionId:t,sampled:r,startTime:n,lastTime:n,isNew:!0}}},{key:"getUUID",value:function(){return(0,d.generateGUID)().replace(/-/g,"")}},{key:"fixSessionConfig",value:function(){var e=0<arguments.length&&void 0!==arguments[0]?arguments[0]:{},t=e.sampleRate,n=e.sampling,r=e.maxDuration,o=e.overtime;return(!(0,d.isNumber)(n)||0>n||100<n)&&(n=(0,d.isNumber)(t)&&0<=t&&1>=t?100*t:100),(!(0,d.isNumber)(r)||r<4*d.ONE_HOUR||r>d.ONE_DAY)&&(r=d.ONE_DAY),(!(0,d.isNumber)(o)||o>d.ONE_HOUR||o<10*d.ONE_MINUTE)&&(o=30*d.ONE_MINUTE),{sampling:n,maxDuration:r,overtime:o}}},{key:"getBaseEvent",value:function(){return{timestamp:(0,g.getCurrentTime)(),session_id:this.getSessionId(),event_id:this.getEventId(),view:this.ctx?(0,h.getCurView)(this.ctx):void 0,times:1}}}])}();t.RumSession=S},function(e,t,n){"use strict";function r(e){return(r="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function o(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function i(e,t){for(var n,r=0;r<t.length;r++)(n=t[r]).enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,a(n.key),n)}function u(e,t,n){return t&&i(e.prototype,t),n&&i(e,n),Object.defineProperty(e,"prototype",{writable:!1}),e}function a(e){var t=c(e,"string");return"symbol"==r(t)?t:t+""}function c(e,t){if("object"!=r(e)||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var o=n.call(e,t||"default");if("object"!=r(o))return o;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}function s(e,t,n){return t=v(t),f(e,p()?Reflect.construct(t,n||[],v(e).constructor):t.apply(e,n))}function f(e,t){if(t&&("object"==r(t)||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return l(e)}function l(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function p(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(e){}return(p=function(){return!!e})()}function v(e){return(v=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function y(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&d(e,t)}function d(e,t){return(d=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e})(e,t)}Object.defineProperty(t,"__esModule",{value:!0}),t.checkEnable=void 0;var g=n(0),h=n(2),m=n(9),b="arms_rum2_local_config";function w(e){var t,n,r,o,i={};i.enable=null===(t=e.enable)||void 0===t||t;var u=e.session;if(u){var a={};a.sampling=null!==(n=u.sampling)&&void 0!==n?n:100,a.storage=null!==(r=u.storage)&&void 0!==r?r:"auto",i.sessionConfig=a}var c=e.report;if(c){var s={};s.flushTime=c.flush_interval,s.maxEventCount=c.max_batch_count,i.reportConfig=s}var f=e.tracing;if(f){var l={enable:null===(o=f.enable)||void 0===o||o},p=[];(f.rules||[]).forEach((function(e){var t={enable:e.enable,tracestate:e.tracestate,baggage:e.baggage,propagatorTypes:e.protocols,sampling:e.sampling};return"{location.origin}"===e.match?void(l=Object.assign({},l,t)):(t.match=(0,g.parseRule2Match)(e),void p.push(t))})),l.allowedUrls=p,i.tracing=l}var v=e.collectors;if(v&&Array.isArray(v)&&0<v.length){var y={};v.forEach((function(e){var t=e.name;if(t){var n=Object.assign({},e),r=e.filters;0<(null==r?void 0:r.length)&&(n.filters=n.filters.map((function(e){return(0,g.parseRule2Match)(e)}))),y[t]=n}})),i.collectors=Object.assign({},i.collectors,y)}return i}var S=function(e){function t(){var e;return o(this,t),(e=s(this,t,arguments)).version="v2",e}return y(t,e),u(t,[{key:"fetchRemoteCfg",value:function(){var e=this.getRemoteConfigUrl();return e?e.includes(".rum.aliyuncs.com")?(this.version="v1",this.getV1Config(e)):this.getV2Config(e):void 0}},{key:"getV1Config",value:function(e){return new Promise((function(t,n){h.sdk.request({url:e,method:"GET",success:function(e){t(e)},fail:function(e){n(e)}})}))}},{key:"getV2Config",value:function(e){var t,n={instanceId:"",agentType:"rum_web_sdk",attributes:(0,g.getUrlParams)(e),instanceConfigs:[{configType:"rum_web_config",version:1}],capabilities:2};return new Promise((function(t,r){h.sdk.request({url:e,method:"POST",data:JSON.stringify(n),header:{"Content-Type":"application/json","x-log-apiversion":"0.6.0"},success:function(e){t(e)},fail:function(e){r(e)}})}))}},{key:"getCacheConfig",value:function(){var e=(0,h.getStorageSync)(b);if(e){var t=this.currentConfig;try{var n=JSON.parse(e);if("pid"in n&&n.pid===t.pid||"endpoint"in n&&n.endpoint)return n.content=this.parseConfig(n.content),n}catch(e){g.logger.warn("configManager","Failed to read cache config",e)}}}},{key:"setCacheConfig",value:function(e){var t=this.currentConfig,n=Object.assign({},e,{pid:t.pid,endpoint:t.endpoint});(0,h.setStorageSync)(b,JSON.stringify(n))}},{key:"getRemoteConfigUrl",value:function(){var e=this.currentConfig,t=e.pid,n=e.remoteConfig,r=e.endpoint,o=n||{},i=o.url,u=o.region;if(i)return i;if(t){var a=t.split("@");return!a||2>a.length?void 0:"https://".concat(a[0],"-sdk.rum.aliyuncs.com/config/").concat(u||"cn-hangzhou","/").concat(a[1],"?t=").concat(Date.now())}var c=(0,m.getURL)(r),s=(0,g.getUrlParams)(r);return"".concat(c.protocol,"://").concat(c.hostname,"/agentconfig?workspace=").concat(s.workspace,"&service=").concat(s.service_id)}},{key:"parseConfig",value:function(e){try{var t,n=(e.data||e).instanceConfigs[0].config;return"v2"===this.version?w(JSON.parse(n)):e}catch(t){return e}}}])}(g.ConfigManager);function O(e,t){var n,r=!(2<arguments.length&&void 0!==arguments[2])||arguments[2],o=e.getConfig();if(!1===o.enable)return!1;var i=null===(n=o.collectors)||void 0===n?void 0:n[t];return(0,g.isBoolean)(i)?i:(0,g.isObject)(i)&&"enable"in i?i.enable:r}t.default=S,t.checkEnable=O}]);
|
|
1
|
+
module.exports=function(e){var t={};function n(r){if(t[r])return t[r].exports;var o=t[r]={i:r,l:!1,exports:{}};return e[r].call(o.exports,o,o.exports,n),o.l=!0,o.exports}return n.m=e,n.c=t,n.d=function(e,t,r){n.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:r})},n.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},n.t=function(e,t){if(1&t&&(e=n(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var r=Object.create(null);if(n.r(r),Object.defineProperty(r,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var o in e)n.d(r,o,function(t){return e[t]}.bind(null,o));return r},n.n=function(e){var t=e&&e.__esModule?function t(){return e.default}:function t(){return e};return n.d(t,"a",t),t},n.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},n.p="./dist/",n(n.s=22)}([function(e,t,n){"use strict";var r=this&&this.__createBinding||(Object.create?function(e,t,n,r){void 0===r&&(r=n);var o=Object.getOwnPropertyDescriptor(t,n);o&&!("get"in o?!t.__esModule:o.writable||o.configurable)||(o={enumerable:!0,get:function e(){return t[n]}}),Object.defineProperty(e,r,o)}:function(e,t,n,r){void 0===r&&(r=n),e[r]=t[n]}),o=this&&this.__exportStar||function(e,t){for(var n in e)"default"===n||Object.prototype.hasOwnProperty.call(t,n)||r(t,e,n)};Object.defineProperty(t,"__esModule",{value:!0}),t.Shell=t.Reporter=t.Context=t.Client=void 0;var i=n(11);t.Client=i.default;var u=n(16);t.Context=u.default;var a=n(25);t.Reporter=a.default;var c=n(27);t.Shell=c.default,o(n(28),t),o(n(12),t),o(n(29),t),o(n(18),t),o(n(30),t),o(n(31),t),o(n(7),t),o(n(32),t),o(n(33),t),o(n(19),t),o(n(20),t),o(n(1),t),o(n(15),t),o(n(21),t),o(n(34),t),o(n(17),t),o(n(6),t),o(n(5),t),o(n(35),t),o(n(36),t),o(n(37),t)},function(e,t,n){"use strict";function r(e){return(r="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function o(e,t){return r(e)===t}Object.defineProperty(t,"__esModule",{value:!0}),t.isZero=t.isObject=t.isNull=t.isNumber=t.isBoolean=t.isRegExp=t.isArray=t.isToString=t.isString=t.isFunction=t.isTypeof=void 0,t.isTypeof=o;var i=function e(t){return"function"==typeof t};function u(e,t){return Object.prototype.toString.call(e)==="[object ".concat(t,"]")}function a(){for(var e=0;e<arguments.length;e++)if(0!==(e<0||arguments.length<=e?void 0:arguments[e]))return!1;return!0}t.isFunction=i,t.isString=function(e){return o(e,"string")},t.isToString=u,t.isArray=function(e){return u(e,"Array")},t.isRegExp=function(e){return u(e,"RegExp")},t.isBoolean=function(e){return o(e,"boolean")},t.isNumber=function(e){return o(e,"number")&&!isNaN(e)||o(e,"bigint")},t.isNull=function(e){return null===e},t.isObject=function(e){return!(0,t.isNull)(e)&&o(e,"object")},t.isZero=a},function(e,t,n){"use strict";(function(e){function r(){function e(e,n,r,i){var u=n&&n.prototype instanceof t?n:t,s=Object.create(u.prototype);return o(s,"_invoke",function(e,t,n){function r(e,t){for(i=e,u=t,c=0;!l&&s&&!n&&c<f.length;c++){var n,r=f[c],o=v.p,y=r[2];3<e?(n=y===t)&&(u=r[(i=r[4])?5:(i=3,3)],r[4]=r[5]=a):r[0]<=o&&((n=2>e&&o<r[1])?(i=0,v.v=t,v.n=r[1]):o<y&&(n=3>e||r[0]>t||t>y)&&(r[4]=e,r[5]=t,v.n=y,i=0))}if(n||1<e)return p;throw l=!0,t}var o,i,u,s=0,f=n||[],l=!1,v={p:0,n:0,v:a,a:r,f:r.bind(a,4),d:function e(t,n){return o=t,i=0,u=a,v.n=n,p}};return function(n,f,y){if(1<s)throw TypeError("Generator is already running");for(l&&1===f&&r(f,y),i=f,u=y;(c=2>i?a:u)||!l;){o||(i?3>i?(1<i&&(v.n=-1),r(i,u)):v.n=u:v.v=u);try{if(s=2,o){if(i||(n="next"),c=o[n]){if(!(c=c.call(o,u)))throw TypeError("iterator result is not an object");if(!c.done)return c;u=c.value,2>i&&(i=0)}else 1===i&&(c=o.return)&&c.call(o),2>i&&(u=TypeError("The iterator does not provide a '"+n+"' method"),i=1);o=a}else if((c=(l=0>v.n)?u:e.call(t,v))!==p)break}catch(e){o=a,i=1,u=e}finally{s=1}}return{value:c,done:l}}}(e,r,i),!0),s}function t(){}function n(){}function i(){}function u(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,i):(e.__proto__=i,o(e,l,"GeneratorFunction")),e.prototype=Object.create(y),e}/*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/babel/babel/blob/main/packages/babel-helpers/LICENSE */var a,c,s="function"==typeof Symbol?Symbol:{},f=s.iterator||"@@iterator",l=s.toStringTag||"@@toStringTag",p={};c=Object.getPrototypeOf;var v=[][f]?c(c([][f]())):(o(c={},f,(function(){return this})),c),y=i.prototype=t.prototype=Object.create(v);return n.prototype=i,o(y,"constructor",i),o(i,"constructor",n),n.displayName="GeneratorFunction",o(i,l,"GeneratorFunction"),o(y),o(y,l,"Generator"),o(y,f,(function(){return this})),o(y,"toString",(function(){return"[object Generator]"})),(r=function t(){return{w:e,m:u}})()}function o(e,t,n,r){var i=Object.defineProperty;try{i({},"",{})}catch(e){i=0}(o=function e(t,n,r,u){function a(e,n){o(t,e,(function(t){return this._invoke(e,n,t)}))}n?i?i(t,n,{value:r,enumerable:!u,configurable:!u,writable:!u}):t[n]=r:(a("next",0),a("throw",1),a("return",2))})(e,t,n,r)}var i=this&&this.__awaiter||function(e,t,n,r){function o(e){return e instanceof n?e:new n((function(t){t(e)}))}return new(n||(n=Promise))((function(n,i){function u(e){try{c(r.next(e))}catch(e){i(e)}}function a(e){try{c(r.throw(e))}catch(e){i(e)}}function c(e){e.done?n(e.value):o(e.value).then(u,a)}c((r=r.apply(e,t||[])).next())}))};Object.defineProperty(t,"__esModule",{value:!0}),t.fixAttrs=t.getNetType=t.getPerformance=t.setStorageSync=t.getStorageSync=t.appName=t.sdk=t.VERSION=t.global2=void 0;var u=n(0);function a(e){return"function"==typeof t.sdk.getStorageSync?t.sdk.getStorageSync(e):void 0}function c(e,n){return"function"==typeof t.sdk.setStorageSync?t.sdk.setStorageSync(e,n):void 0}function s(){return"performance"in t.global2?t.global2.performance:void 0}function f(){return new Promise((function(e){try{t.sdk.getNetworkType({success:function t(n){var r=n.networkType||n.subtype;e(r?r.toLowerCase():void 0)},fail:function t(n){e(void 0)}})}catch(t){e(void 0)}}))}t.global2=e||window,t.VERSION="0.1.5",t.sdk=uni,t.appName="uniapp",t.getStorageSync=a,t.setStorageSync=c,t.getPerformance=s,t.getNetType=f;var l=function e(n){return i(this,void 0,void 0,r().m((function e(){var o,i,a,c,s;return r().w((function(e){for(;;)switch(e.n){case 0:if(n){e.n=1;break}return e.a(2);case 1:return e.n=2,f();case 2:return o=e.v,n.app.type=u.AppType.uniapp,n._v=t.VERSION,n.net=Object.assign({model:o},n.net),i=t.sdk.getDeviceInfo()||{},a=t.sdk.getAppBaseInfo()||{},c={brand:i.brand,model:i.model},s={type:i.platform,version:i.system,container:t.appName,container_version:a.SDKVersion},n.device=Object.assign(Object.assign({},c),n.device),n.os=Object.assign(Object.assign({},s),n.os),e.a(2,n)}}),e)})))};t.fixAttrs=l}).call(this,n(39))},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.getCurViews=t.getCurView=t.getCurrentPage=void 0;var r=n(0),o="__rum_view";function i(){if("function"==typeof getCurrentPages)try{var e=getCurrentPages()||[];return e[e.length-1]}catch(e){r.logger.warn("view","getCurrentPage failed",e)}}function u(e){if(e){var t=i();if(t){if(o in t)return t[o];var n=t.$page||{},u=n.fullPath,a=n.route,c=n.openType,s=e.session.getViewId(),f=u||a||t.route,l=a||t.route,p,v=e.getConfig().parseViewName;return(0,r.isFunction)(v)&&(l=v(f)),t[o]={id:s,name:l,url:f,loading_type:c,_noReport:!0}}}}function a(){var e=[];if("function"==typeof getCurrentPages)try{(getCurrentPages()||[]).forEach((function(t){o in t&&e.push(t[o])}))}catch(e){r.logger.warn("view","getCurViews failed",e)}return e}t.getCurrentPage=i,t.getCurView=u,t.getCurViews=a},function(e,t,n){"use strict";function r(e){return(r="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function o(e,t){return s(e)||c(e,t)||u(e,t)||i()}function i(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function u(e,t){if(e){if("string"==typeof e)return a(e,t);var n={}.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?a(e,t):void 0}}function a(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}function c(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var r,o,i,u,a=[],c=!0,s=!1;try{if(i=(n=n.call(e)).next,0===t){if(Object(n)!==n)return;c=!1}else for(;!(c=(r=i.call(n)).done)&&(a.push(r.value),a.length!==t);c=!0);}catch(e){s=!0,o=e}finally{try{if(!c&&null!=n.return&&(u=n.return(),Object(u)!==u))return}finally{if(s)throw o}}return a}}function s(e){if(Array.isArray(e))return e}function f(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function l(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,v(r.key),r)}}function p(e,t,n){return t&&l(e.prototype,t),n&&l(e,n),Object.defineProperty(e,"prototype",{writable:!1}),e}function v(e){var t=y(e,"string");return"symbol"==r(t)?t:t+""}function y(e,t){if("object"!=r(e)||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var o=n.call(e,t||"default");if("object"!=r(o))return o;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}Object.defineProperty(t,"__esModule",{value:!0}),t.callMonitored=t.logger=void 0;var d=["debug","error","crash"],g=function(){function e(){f(this,e),this.console=!1,this.reportLevels=d}return p(e,[{key:"setConsole",value:function e(t){this.console=t}},{key:"setReportLevels",value:function e(t){this.reportLevels=t}},{key:"setOnError",value:function e(t){this.onError=t}},{key:"debug",value:function e(){for(var t=arguments.length,n=new Array(t),r=0;r<t;r++)n[r]=arguments[r];this.log("debug",n)}},{key:"info",value:function e(){for(var t=arguments.length,n=new Array(t),r=0;r<t;r++)n[r]=arguments[r];this.log("info",n)}},{key:"warn",value:function e(){for(var t=arguments.length,n=new Array(t),r=0;r<t;r++)n[r]=arguments[r];this.log("warn",n)}},{key:"error",value:function e(){for(var t=arguments.length,n=new Array(t),r=0;r<t;r++)n[r]=arguments[r];this.log("error",n)}},{key:"crash",value:function e(){for(var t=arguments.length,n=new Array(t),r=0;r<t;r++)n[r]=arguments[r];this.log("crash",n)}},{key:"log",value:function e(t,n){var i=o(n,4),u=i[0],a=i[1],c=i[2],s=i[3],f,l,p;this.console&&console["crash"===t?"error":"debug"===t?"log":t]("[RUM-SDK][".concat(u,"]"),a,c||"");-1!==this.reportLevels.indexOf(t)&&(c instanceof Error?p=c.stack:c&&"object"===r(c)&&"stack"in c&&(p=String(c.stack)),p&&p.length>12288&&(p=p.slice(0,12288)),null===(f=this.onError)||void 0===f||f.call(this,Object.assign({level:t,content:a,type:u,stack:p},s)))}},{key:"wrap",value:function e(t,n,r){return function(){for(var e=arguments.length,o=new Array(e),i=0;i<e;i++)o[i]=arguments[i];return h(t,this,o,n,r)}}}])}();function h(e,n,r,o,i){try{var u=e.apply(n,r);return u&&"function"==typeof u.catch&&u.catch((function(e){t.logger.error(o||"unknown",i||(e instanceof Error?e.message:String(e)),e)})),u}catch(e){t.logger.error(o||"unknown",i||(e instanceof Error?e.message:String(e)),e)}}t.logger=new g,t.callMonitored=h},function(e,t,n){"use strict";function r(e){return(r="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function o(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function i(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,a(r.key),r)}}function u(e,t,n){return t&&i(e.prototype,t),n&&i(e,n),Object.defineProperty(e,"prototype",{writable:!1}),e}function a(e){var t=c(e,"string");return"symbol"==r(t)?t:t+""}function c(e,t){if("object"!=r(e)||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var o=n.call(e,t||"default");if("object"!=r(o))return o;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}Object.defineProperty(t,"__esModule",{value:!0}),t.EventEmitter=void 0;var s=n(4),f=function(){function e(){o(this,e),this.events={}}return u(e,[{key:"on",value:function e(t,n){this.events[t]||(this.events[t]=[]),this.events[t].push(n)}},{key:"emit",value:function e(t){var n=this.events[t];if(n){for(var r=n.slice(),o=arguments.length,i=new Array(o>1?o-1:0),u=1;u<o;u++)i[u-1]=arguments[u];for(var a=0;a<r.length;a++)try{r[a].apply(r,i)}catch(e){s.logger.error("EventEmitter",'Error in handler for "'.concat(t,'"'),e)}}}},{key:"off",value:function e(t,n){var r=this.events[t];if(r)if(n){for(var o=r.length;o--;)r[o]===n&&r.splice(o,1);0===r.length&&delete this.events[t]}else delete this.events[t]}},{key:"once",value:function e(t,n){var r=this,o=function e(){r.off(t,o),n.apply(void 0,arguments)};this.on(t,o)}}])}();t.EventEmitter=f},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.getUrlParams=void 0;var r=function e(t){if(0===t.length)return"";try{return decodeURIComponent(t.replace(/\+/g," "))}catch(e){return t.replace(/\+/g," ").replace(/%20/g," ").replace(/%2F/g,"/").replace(/%3D/g,"=").replace(/%26/g,"&").replace(/%3F/g,"?")}},o=function e(t){if(0===t.length)return"";var n=t.indexOf("#"),r=n>=0?t.slice(0,n):t,o=r.indexOf("?");return-1===o?"":r.slice(o+1)};function i(e){if("string"!=typeof e||!e.trim())return{};var t={},n=o(e);if(!n)return t;for(var i=n.split("&"),u=0;u<i.length;u++){var a=i[u];if(a){var c=a.indexOf("=");if(!(c<=0)){var s=r(a.slice(0,c)),f=c<a.length-1?r(a.slice(c+1)):"",l=t[s];void 0!==l?Array.isArray(l)?l.push(f):t[s]=[l,f]:t[s]=f}}}return t}t.getUrlParams=i},function(e,t,n){"use strict";var r,o,i;Object.defineProperty(t,"__esModule",{value:!0}),t.AppType=t.ResourceStatus=t.RumEventType=void 0,function(e){e.VIEW="view",e.RESOURCE="resource",e.EXCEPTION="exception",e.LONG_TASK="longTask",e.ACTION="action",e.CUSTOM="custom",e.APPLICATION="application"}(r=t.RumEventType||(t.RumEventType={})),function(e){e[e.Unknown=-1]="Unknown",e[e.Failed=0]="Failed",e[e.Success=1]="Success"}(o=t.ResourceStatus||(t.ResourceStatus={})),function(e){e.browser="browser",e.miniapp="miniapp",e.minigame="minigame",e.uniapp="uniapp",e.reactnative="reactnative"}(i=t.AppType||(t.AppType={}))},function(e,t,n){"use strict";function r(e){return(r="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}Object.defineProperty(t,"__esModule",{value:!0}),t.removeEventListener=t.addEventListener=t.mixin=t.getVueRuntimeKind=void 0;var o,i=n(0);function u(e){return null==e?null:"function"==typeof e.mixin?"function"==typeof e?"vue2":"object"===r(e)?"vue3":null:null}t.getVueRuntimeKind=u;var a=["onLaunch","onLoad","onShow","beforeCreate","mounted"],c={onError:[]};function s(e,t,n){var r=c[e];if(null!=r&&r.length)for(var o=0;o<r.length;o++)try{r[o](t,n)}catch(t){i.logger.warn("vue-mixin","vue listener failed",t,{hook:e})}}a.forEach((function(e){c[e]=[]}));var f=["tap","click"];function l(e){return!!e&&"object"===r(e)&&-1!==f.indexOf(e.type)&&(null!=e.currentTarget||null!=e.target)}function p(e){if(c.action&&c.action.length){var t=e&&e.$options&&e.$options.methods;if(t)for(var n=Object.keys(t),r=function e(){var r=n[o],i=t[r];if("function"!=typeof i||i.__armsActionWrapped)return 1;var u=function e(){var t=arguments[0];return l(t)&&s("action",this,t),i.apply(this,arguments)};u.__armsActionWrapped=!0,t[r]=u},o=0;o<n.length;o++)r()}}function v(e){function t(e,t,n){s("onError",this,{error:e,instance:t,info:n})}for(var n={},r=function e(){var t=a[i];n[t]=function(e){s(t,this,e)}},i=0;i<a.length;i++)r();var u=n.beforeCreate;return n.beforeCreate=function(e){u.call(this,e),p(this)},"vue2"===e?Object.defineProperty(o.config,"errorHandler",{get:function e(){var n=this;return function(e,r,o){t(e,r,o),n.__errorHandler&&n.__errorHandler(e,r,o)}},set:function e(t){this.__errorHandler=t}}):Object.defineProperty(o.config,"onErrorCaptured",{get:function e(){var n=this;return function(e,r,o){t(e,r,o),n.__onErrorCaptured&&n.__onErrorCaptured(e,r,o)}},set:function e(t){this.__onErrorCaptured=t}}),n}function y(e){if(!o){o=e;var t=u(e);if(t)try{e.mixin(v(t))}catch(e){i.logger.error("vue-mixin","vue.mixin failed",e)}}}function d(e,t){e in c||(c[e]=[]),c[e].push(t)}function g(e,t){if(e in c&&t){var n=c[e],r=n.indexOf(t);return n.splice(r,1),!0}return!1}t.mixin=y,t.addEventListener=d,t.removeEventListener=g},function(e,t,n){"use strict";function r(e){var t=!!(1<arguments.length&&void 0!==arguments[1])&&arguments[1];try{var n=u(e);return t?n.hash:n.pathname}catch(e){return""}}function o(e,t){var n,r=e.getConfig().endpoint;try{return u(t).hostname===u(r).hostname}catch(e){return!1}}Object.defineProperty(t,"__esModule",{value:!0}),t.getURL=t.isEndpoint=t.getPathByURL=void 0,t.getPathByURL=r,t.isEndpoint=o;var i=/^(?:([^:\/?#]+):\/\/)?((?:([^\/?#@]*)@)?([^\/?#:]*)(?:\:(\d*))?)?([^?#]*)(?:\?([^#]*))?(?:#((?:.|\n)*))?/i;function u(e){var t=decodeURIComponent(e).match(i),n,r=(t[3]||"").split(":").length?(t[2]||"").replace(/(.*\@)/,""):t[2];return{uri:t[0],protocol:t[1],host:r,hostname:t[4],port:t[5],pathname:t[6],search:t[7],hash:t[8]}}t.getURL=u},function(e,t,n){"use strict";function r(){return(new Date).getTime()}function o(e){var t=1<arguments.length&&void 0!==arguments[1]?arguments[1]:"utf8";if("string"!=typeof e)throw new TypeError("Input must be a string");var n=t.toLowerCase();if("utf16"===n){for(var r,o=0,i=0;i<e.length;i++){if(55296<=(r=e.charCodeAt(i))&&56319>=r&&i+1<e.length){var u=e.charCodeAt(i+1);if(56320<=u&&57343>=u){o+=4,i++;continue}}o+=2}return o}if("utf8"===n){for(var a,c=0,s=0;s<e.length;s++){if(55296<=(a=e.charCodeAt(s))&&56319>=a&&s+1<e.length){var f=e.charCodeAt(s+1);56320<=f&&57343>=f&&(a=1024*(a-55296)+(f-56320)+65536,s++)}c+=127>=a?1:2047>=a?2:65535>=a?3:1114111>=a?4:3}return c}throw new Error('Unsupported encoding. Use "utf8" or "utf16".')}Object.defineProperty(t,"__esModule",{value:!0}),t.getStringSize=t.getCurrentTime=void 0,t.getCurrentTime=r,t.getStringSize=o},function(e,t,n){"use strict";function r(e){return(r="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function o(e,t){var n="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(!n){if(Array.isArray(e)||(n=i(e))||t&&e&&"number"==typeof e.length){n&&(e=n);var r=0,o=function e(){};return{s:o,n:function t(){return r>=e.length?{done:!0}:{done:!1,value:e[r++]}},e:function e(t){throw t},f:o}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var u,a=!0,c=!1;return{s:function t(){n=n.call(e)},n:function e(){var t=n.next();return a=t.done,t},e:function e(t){c=!0,u=t},f:function e(){try{a||null==n.return||n.return()}finally{if(c)throw u}}}}function i(e,t){if(e){if("string"==typeof e)return u(e,t);var n={}.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?u(e,t):void 0}}function u(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}function a(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function c(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,f(r.key),r)}}function s(e,t,n){return t&&c(e.prototype,t),n&&c(e,n),Object.defineProperty(e,"prototype",{writable:!1}),e}function f(e){var t=l(e,"string");return"symbol"==r(t)?t:t+""}function l(e,t){if("object"!=r(e)||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var o=n.call(e,t||"default");if("object"!=r(o))return o;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}Object.defineProperty(t,"__esModule",{value:!0});var p=n(12),v=n(5),y=n(13),d=n(16),g=n(1),h=function(){function e(){var t=this;a(this,e),this.emitter=new v.EventEmitter,this.sendEvent=function(e,n){t.emitter.emit(p.EventType.collect,e,n)}}return s(e,[{key:"init",value:function e(t,n,r,i){var u=this;if(this.ctx=new d.default(t,n,r),i){var a={appType:(null==n?void 0:n.appType)||"",sdkVersion:(null==n?void 0:n.sdkVersion)||"",endpoint:t.endpoint,getSessionId:n?function(){return n.getSessionId()}:void 0,getSessionSampled:n?function(){return n.getSampled()}:void 0,getViewId:function e(){var t,n=null===(t=u.ctx)||void 0===t?void 0:t.getViews();return n&&n.length?n[n.length-1].id:void 0},selfMonitor:t.selfMonitor};t.pid&&(a["app.id"]=t.pid),y.Telemetry.init(a,i)}var c=this.ctx,s=this.collectors,f=this.processors,l=this.reporter;f.forEach((function(e){(0,g.isFunction)(e.setup)&&e.setup(c)})),this.emitter.on(p.EventType.collect,(function(e,t){c.setRumEvent(e);var n=o(f),r;try{for(n.s();!(r=n.n()).done;){var i=r.value;if(i.match||(i.match=function(){return!0}),i.match(c)){var u=i.process(c);c.setRumEvent(u)}}}catch(e){n.e(e)}finally{n.f()}l.report(c,t)})),(s||[]).forEach((function(e){e.setup(c,u.sendEvent)}))}},{key:"setContext",value:function e(t){this.ctx=t}},{key:"getContext",value:function e(){return this.ctx}},{key:"useCollectors",value:function e(t){this.collectors=t}},{key:"getCollectors",value:function e(){return this.collectors}},{key:"useProcessors",value:function e(t){this.processors=t}},{key:"useReporter",value:function e(t){this.reporter=t}}])}();t.default=h},function(e,t,n){"use strict";var r;Object.defineProperty(t,"__esModule",{value:!0}),t.EventType=void 0,function(e){e.collect="collect"}(r=t.EventType||(t.EventType={}))},function(e,t,n){"use strict";function r(e){return(r="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function o(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function i(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,a(r.key),r)}}function u(e,t,n){return t&&i(e.prototype,t),n&&i(e,n),Object.defineProperty(e,"prototype",{writable:!1}),e}function a(e){var t=c(e,"string");return"symbol"==r(t)?t:t+""}function c(e,t){if("object"!=r(e)||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var o=n.call(e,t||"default");if("object"!=r(o))return o;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}Object.defineProperty(t,"__esModule",{value:!0}),t.convertBundlesToLogGroup=t.Telemetry=void 0;var s=n(4),f=n(6),l=n(14),p=n(15),v=15,y=100,d=12288,g=5e3,h=10,m=100,b=function(){function e(t,n){o(this,e),this.buffer=[],this.queue=[],this.sentEvents=new Set,this.started=!1,this.enabled=!0,this.timer=null,this.isReporting=!1,this.context=t,this.reporter=n,this.endpointParams=(0,f.getUrlParams)(t.endpoint);var i=t.selfMonitor;if("boolean"==typeof i)this.enabled=i,this.sampled=(0,p.performDraw)(100);else if(i&&"object"===r(i)){this.enabled=!1!==i.enable;var u=i.sampling;this.sampled=(0,p.performDraw)("number"==typeof u&&u>=0&&u<=100?u:100),i.console&&s.logger.setConsole(!0),i.reportLevels&&s.logger.setReportLevels(i.reportLevels)}else this.enabled=!0,this.sampled=(0,p.performDraw)(100)}return u(e,[{key:"start",value:function e(){var t=this;this.started||(this.started=!0,s.logger.setOnError((function(e){return t.addEvent(e)})),this.flushBuffer())}},{key:"addEvent",value:function e(t){var n,r,o,i;if(this.enabled&&t){t.content&&t.content.length>12288&&(t=Object.assign({},t,{content:t.content.slice(0,12288)})),t.stack&&t.stack.length>12288&&(t=Object.assign({},t,{stack:t.stack.slice(0,12288)}));var u={event:t,sessionId:null===(r=(n=this.context).getSessionId)||void 0===r?void 0:r.call(n),viewId:null===(i=(o=this.context).getViewId)||void 0===i?void 0:i.call(o),timestamp:Date.now()};this.started&&this.reporter?this.processSnapshot(u):this.buffer.length<100&&this.buffer.push(u)}}},{key:"flush",value:function e(){this.timer&&(clearTimeout(this.timer),this.timer=null),this.sendBatch()}},{key:"setReporter",value:function e(t){this.reporter=t,this.started&&this.flushBuffer()}},{key:"flushBuffer",value:function e(){var t=this,n;this.buffer.splice(0).forEach((function(e){return t.processSnapshot(e)}))}},{key:"processSnapshot",value:function e(t){var n=this;if(this.shouldSend(t.event)){var r=this.buildBundle(t);this.queue.push(r),this.queue.length>=10?this.flush():this.timer||(this.timer=setTimeout((function(){return n.flush()}),5e3))}}},{key:"shouldSend",value:function e(t){if(this.context.getSessionSampled&&!this.context.getSessionSampled())return!1;if(!this.sampled)return!1;if(this.sentEvents.size>=15)return!1;var n=(t.content||"")+(t.stack||"");return!this.sentEvents.has(n)&&(this.sentEvents.add(n),!0)}},{key:"buildBundle",value:function e(t){var n=this.context,r=n.appType,o=n.sdkVersion,i=n.endpoint;return Object.assign({"app.type":r,_v:o,endpoint:i,"session.id":t.sessionId,"view.id":t.viewId,timestamp:t.timestamp,event_type:"log",log:t.event},this.endpointParams)}},{key:"sendBatch",value:function e(){if(0!==this.queue.length&&this.reporter&&!this.isReporting){var t=this.queue.splice(0);this.isReporting=!0;try{this.reporter.send(t)}catch(e){try{console.warn("[RUM-Telemetry] send failed:",e)}catch(e){}}finally{this.isReporting=!1}}}}],[{key:"init",value:function t(n,r){return e.instance&&e.instance.flush(),e.instance=new e(n,r),e.instance.start(),e.instance}},{key:"get",value:function t(){return e.instance}}])}();function w(e){var t=e.map((function(e){for(var t=[],n=Object.keys(e),o=0;o<n.length;o++){var i=n[o];if("timestamp"!==i){var u=e[i];null!=u&&t.push({key:i,value:"object"===r(u)?JSON.stringify(u):String(u)})}}return{time:Math.floor(e.timestamp/1e3),contents:t}}));return(0,l.encodeLogGroup)(t)}t.Telemetry=b,t.convertBundlesToLogGroup=w},function(e,t,n){"use strict";function r(e){return(r="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function o(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function i(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,a(r.key),r)}}function u(e,t,n){return t&&i(e.prototype,t),n&&i(e,n),Object.defineProperty(e,"prototype",{writable:!1}),e}function a(e){var t=c(e,"string");return"symbol"==r(t)?t:t+""}function c(e,t){if("object"!=r(e)||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var o=n.call(e,t||"default");if("object"!=r(o))return o;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}Object.defineProperty(t,"__esModule",{value:!0}),t.encodeLogGroup=void 0;var s=0,f=2;function l(e){for(var t=[],n=0;n<e.length;n++){var r=e.charCodeAt(n);if(r<128)t.push(r);else if(r<2048)t.push(192|r>>6),t.push(128|63&r);else if(r>=55296&&r<=56319){var o;n++,r=65536+(r-55296<<10)+(e.charCodeAt(n)-56320),t.push(240|r>>18),t.push(128|r>>12&63),t.push(128|r>>6&63),t.push(128|63&r)}else t.push(224|r>>12),t.push(128|r>>6&63),t.push(128|63&r)}return new Uint8Array(t)}var p="undefined"!=typeof TextEncoder?new TextEncoder:{encode:l},v=function(){function e(){o(this,e),this.buf=[]}return u(e,[{key:"writeVarint",value:function e(t){for(var n=t>>>0;n>127;)this.buf.push(127&n|128),n>>>=7;this.buf.push(127&n)}},{key:"writeTag",value:function e(t,n){this.writeVarint(t<<3|n)}},{key:"writeString",value:function e(t,n){var r=p.encode(n);this.writeTag(t,2),this.writeVarint(r.length);for(var o=0;o<r.length;o++)this.buf.push(r[o])}},{key:"writeUint32",value:function e(t,n){this.writeTag(t,0),this.writeVarint(n)}},{key:"writeBytes",value:function e(t,n){this.writeTag(t,2),this.writeVarint(n.length);for(var r=0;r<n.length;r++)this.buf.push(n[r])}},{key:"finish",value:function e(){return new Uint8Array(this.buf)}}])}();function y(e,t){var n=new v;return n.writeString(1,e),n.writeString(2,t),n.finish()}function d(e,t){var n=new v;n.writeUint32(1,e);for(var r=0;r<t.length;r++){var o=t[r];n.writeBytes(2,y(o.key,o.value))}return n.finish()}function g(e,t,n){for(var r=new v,o=0;o<e.length;o++){var i=e[o];r.writeBytes(1,d(i.time,i.contents))}return void 0!==t&&r.writeString(3,t),void 0!==n&&r.writeString(4,n),r.finish()}t.encodeLogGroup=g},function(e,t,n){"use strict";function r(e){return 0!==e&&100*Math.random()<=e}function o(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:3,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0;if(!e)return e;var r=e.toString(),o=r.indexOf(".");r=-1!==o?r.substring(0,t+o+1):r.substring(0);var i=parseFloat(r);return i>=n?i:void 0}Object.defineProperty(t,"__esModule",{value:!0}),t.formatNumber=t.performDraw=t.ONE_DAY=t.ONE_HOUR=t.ONE_MINUTE=t.ONE_SECOND=void 0,t.ONE_SECOND=1e3,t.ONE_MINUTE=60*t.ONE_SECOND,t.ONE_HOUR=60*t.ONE_MINUTE,t.ONE_DAY=24*t.ONE_HOUR,t.performDraw=r,t.formatNumber=o},function(e,t,n){"use strict";function r(e){return(r="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function o(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function i(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,a(r.key),r)}}function u(e,t,n){return t&&i(e.prototype,t),n&&i(e,n),Object.defineProperty(e,"prototype",{writable:!1}),e}function a(e){var t=c(e,"string");return"symbol"==r(t)?t:t+""}function c(e,t){if("object"!=r(e)||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var o=n.call(e,t||"default");if("object"!=r(o))return o;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}Object.defineProperty(t,"__esModule",{value:!0});var s=n(5),f=function(){function e(t,n,r){o(this,e),this.config=t,this.views=[],this.emitter=new s.EventEmitter,n&&(this.session=n,this.session.init(this)),r&&(this.configManager=r)}return u(e,[{key:"getConfig",value:function e(){return this.configManager?this.configManager.getConfig():this.config}},{key:"setConfig",value:function e(t){this.configManager?this.configManager.setConfig(t):this.config=t}},{key:"getViews",value:function e(){return this.views}},{key:"addView",value:function e(t){var n=this.views.findIndex((function(e){return e.id===t.id}));n>=0&&this.views.splice(n,1),this.views.push(t)}},{key:"removeView",value:function e(t){this.views=this.views.filter((function(e){return e.id!==t}))}},{key:"getRumEvent",value:function e(){return this.rumEvent}},{key:"setRumEvent",value:function e(t){this.rumEvent=t}}])}();t.default=f},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.verifyProperties=void 0;var r=n(1);function o(e){if((0,r.isObject)(e)){var t=Object.assign({},e);Object.keys(t).forEach((function(e){var n=t[e];if(e.length>50){var o=e.substring(0,50);t[o]=n,delete t[e],e=o}(0,r.isString)(n)||(0,r.isNumber)(n)?(0,r.isString)(n)&&n.length>2e3&&(t[e]=n.substring(0,2e3)):delete t[e]}));var n=Object.keys(t);if(n.length)return n.length>20&&n.forEach((function(e,n){n>19&&delete t[e]})),t}}t.verifyProperties=o},function(e,t,n){"use strict";var r;Object.defineProperty(t,"__esModule",{value:!0}),t.LifeCycleEventType=void 0,function(e){e.VIEW_CREATED="VIEW_CREATED",e.VIEW_ENDED="VIEW_ENDED"}(r=t.LifeCycleEventType||(t.LifeCycleEventType={}))},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.parseRegExpString=t.delay=t.debounce=t.generateEventId=t.generateSpanId=t.generateTraceId=t.generateGUID=t.restoreFunction=t.interceptFunction=void 0;var r=n(1),o=n(4);function i(e,t,n){var i=arguments.length>3&&void 0!==arguments[3]&&arguments[3];try{var a=e[t];if(!(0,r.isFunction)(a))return;var c=function u(){for(var c=i?this:e,s=arguments.length,f=new Array(s),l=0;l<s;l++)f[l]=arguments[l];try{n.apply(c,f)}catch(e){o.logger.warn("interceptFunction",'callback error in "'.concat(t,'"'),e)}if((0,r.isFunction)(a))return a.apply(c,f)};u(c,a),e[t]=c}catch(e){o.logger.warn("interceptFunction",'install proxy failed for "'.concat(t,'"'),e)}}function u(e,t){try{(0,r.isFunction)(t)&&(Object.defineProperty(e,"toString",{value:function e(){return t.toString()},writable:!0,configurable:!0}),Object.defineProperty(e,"name",{value:t.name,configurable:!0}),Object.defineProperty(e,"length",{value:t.length,configurable:!0})),Object.defineProperty(e,"_rum_intercepted",{value:t,enumerable:!1,writable:!0,configurable:!0})}catch(n){try{e._rum_intercepted=t}catch(e){o.logger.warn("interceptFunction","disguiseProxy fallback failed",e)}}}function a(e,t){var n=e[t];if((0,r.isFunction)(n)){var o=n._rum_intercepted;(0,r.isFunction)(o)&&(e[t]=o)}}function c(){var e="";try{if(crypto&&crypto.randomUUID)e=crypto.randomUUID();else if(crypto&&crypto.getRandomValues){var t=new Uint8Array(16);crypto.getRandomValues(t),t[6]=15&t[6]|64,t[8]=63&t[8]|128,e=t.reduce((function(e,t){return e+t.toString(16).padStart(2,"0")}),"").replace(/^(.{8})(.{4})(.{4})(.{4})(.{12})$/,"$1-$2-$3-$4-$5")}}catch(t){e=""}return e||(e="xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,(function(e){var t=16*Math.random()|0,n;return("x"==e?t:3&t|8).toString(16)}))),e}function s(){var e=c().replace(/-/g,"");return"0"===e[0]&&(e="1"+e.substring(1)),"0"===e[16]&&(e=e.substring(0,16)+"1"+e.substring(17)),e}function f(){for(var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:16,t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:16,n="",r=0;r<e;r++)n+=Math.floor(Math.random()*t).toString(t);return n}function l(e){var t=f();return"00-".concat(e,"-").concat(t)}function p(e,t){var n;if((0,r.isFunction)(e))return function(){var r=this,o=arguments;n&&clearTimeout(n),n=setTimeout((function(){e.apply(r,o)}),t)}}function v(e,t){if((0,r.isFunction)(e)){for(var n=arguments.length,o=new Array(n>2?n-2:0),i=2;i<n;i++)o[i-2]=arguments[i];return setTimeout.apply(void 0,[e,+t||0].concat(o))}}function y(e){if("string"!=typeof e)throw new TypeError("input must be a string");if(e.length>2&&"/"===e[0]){var t=e.lastIndexOf("/");if(t>0){var n=e.substring(1,t),r=e.substring(t+1);return new RegExp(n,r)}return new RegExp(e.substring(1,e.length-1))}return new RegExp(e)}t.interceptFunction=i,t.restoreFunction=a,t.generateGUID=c,t.generateTraceId=s,t.generateSpanId=f,t.generateEventId=l,t.debounce=p,t.delay=v,t.parseRegExpString=y},function(e,t,n){"use strict";function r(e,t){for(var n=0;n<e.length;n+=1){var r=e[n];if(t(r,n))return r}}function o(e,t){return e.slice(0,t.length)===t}function i(e,t){return e.slice(-t.length)===t}function u(e){for(var t=arguments.length,n=new Array(t>1?t-1:0),r=1;r<t;r++)n[r-1]=arguments[r];return n.forEach((function(t){for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n])})),e}Object.defineProperty(t,"__esModule",{value:!0}),t.assign=t.endsWith=t.startsWith=t.find=void 0,t.find=r,t.startsWith=o,t.endsWith=i,t.assign=u},function(e,t,n){"use strict";function r(e){return a(e)||u(e)||i(e)||o()}function o(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function i(e,t){if(e){if("string"==typeof e)return c(e,t);var n={}.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?c(e,t):void 0}}function u(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}function a(e){if(Array.isArray(e))return c(e)}function c(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}Object.defineProperty(t,"__esModule",{value:!0}),t.parseRule2Match=t.urlMatch=t.matchList=t.isMatchOption=void 0;var s=n(1),f=n(20),l=n(19);function p(e){return(0,s.isString)(e)||(0,s.isFunction)(e)||(0,s.isRegExp)(e)}function v(e,t){var n=!(arguments.length>2&&void 0!==arguments[2])||arguments[2],r=arguments.length>3?arguments[3]:void 0;return e.some((function(e){try{if("function"==typeof e)return e(t,r);if(e instanceof RegExp)return e.test(t);if("string"==typeof e)return n?(0,f.startsWith)(t,e):e===t}catch(e){}return!1}))}function y(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[];try{(0,s.isArray)(t)||(t=[t]);var n=[/^(https?:)?\/\/.*rum|retcode|log-global|log\.aliyuncs\.com/,/^(https?:)?\/\/.*\.mmstat\.com/,/^(https?:)?\/\/.*hm\.baidu\.com/,/^(https?:)?\/\/.*google-analytics\.com/,/data:(.+?)(;base64)?,(.+)$/].concat(r(t));return v(n,e)}catch(e){return!1}}function d(e){if(p(e))return e;var t;switch(e.match_exp){case"equals":t=function t(n){return n===e.match};break;case"not_equals":t=function t(n){return n!==e.match};break;case"regex":t=(0,l.parseRegExpString)(e.match);break;case"includes":t=function t(n){return n.includes(e.match)};break;case"starts_with":default:t=function t(n){return(0,f.startsWith)(n,e.match)}}return t}t.isMatchOption=p,t.matchList=v,t.urlMatch=y,t.parseRule2Match=d},function(e,t,n){e.exports=n(23)},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.ArmsRum=void 0;var r=n(24);Object.defineProperty(t,"ArmsRum",{enumerable:!0,get:function(){return r.ArmsRum}}),t.default=r.default},function(e,t,n){"use strict";function r(e){return(r="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function o(e,t,n){return(t=c(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function i(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function u(e,t){for(var n,r=0;r<t.length;r++)(n=t[r]).enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,c(n.key),n)}function a(e,t,n){return t&&u(e.prototype,t),n&&u(e,n),Object.defineProperty(e,"prototype",{writable:!1}),e}function c(e){var t=s(e,"string");return"symbol"==r(t)?t:t+""}function s(e,t){if("object"!=r(e)||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var o=n.call(e,t||"default");if("object"!=r(o))return o;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}function f(e,t,n){return t=y(t),l(e,v()?Reflect.construct(t,n||[],y(e).constructor):t.apply(e,n))}function l(e,t){if(t&&("object"==r(t)||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return p(e)}function p(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function v(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(e){}return(v=function(){return!!e})()}function y(e){return(y=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function d(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&g(e,t)}function g(e,t){return(g=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e})(e,t)}Object.defineProperty(t,"__esModule",{value:!0}),t.ArmsRum=void 0;var h=n(0),m=n(38),b=n(40),w=n(41),E=n(43),S=n(44),O=n(45),j=n(46),_=n(47),k=n(2),T=n(48),C=n(8),P=n(3),x=n(49),R=function(e){function t(){var e;return i(this,t),(e=f(this,t,arguments)).version=k.VERSION,e}return d(t,e),a(t,[{key:"init",value:function(e){var t=this;return this.configManager=new x.default,Promise.resolve().then((function(){return t.configManager.init(e)})).catch((function(e){h.logger.warn("shell","configManager init error",e)})).then((function(){var e=t.configManager.getConfig(),n;return!1===e.enable||(e.vue&&t.setVue(e.vue),t.client.useCollectors([new m.default,new b.default,new w.default,new E.default]),t.client.useProcessors([new S.default,new O.default]),t.client.useReporter(new j.default),t.client.init(e,new T.RumSession,t.configManager,new _.UniMonitorReporter(e.endpoint)),t.client.getContext().getViews=P.getCurViews,(0,h.isFunction)(k.sdk.onAppHide)&&k.sdk.onAppHide((function(){var e;null===(e=h.Telemetry.get())||void 0===e||e.flush()}))),t}))}},{key:"getConfig",value:function(){var e;return null===(e=this.configManager)||void 0===e?void 0:e.getConfig()}},{key:"setConfig",value:function(){var e=this.configManager;if(e)if(2===arguments.length){var t=e.getConfig();e.setConfig(Object.assign({},t,o({},0>=arguments.length?void 0:arguments[0],1>=arguments.length?void 0:arguments[1])))}else e.setConfig(0>=arguments.length?void 0:arguments[0])}},{key:"setVue",value:function(e){this.setConfig("vue",e),(0,C.mixin)(e)}}])}(h.Shell);t.ArmsRum=R,t.default=new R},function(e,t,n){"use strict";function r(e){return(r="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function o(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function i(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,a(r.key),r)}}function u(e,t,n){return t&&i(e.prototype,t),n&&i(e,n),Object.defineProperty(e,"prototype",{writable:!1}),e}function a(e){var t=c(e,"string");return"symbol"==r(t)?t:t+""}function c(e,t){if("object"!=r(e)||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var o=n.call(e,t||"default");if("object"!=r(o))return o;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}Object.defineProperty(t,"__esModule",{value:!0});var s=n(4),f=n(7),l=n(26),p=n(1),v=n(17),y=n(6),d=3e3,g=20,h=["app","user","device","os","geo","isp","net","properties"],m=function(){function e(){o(this,e),this.name="reporter",this.eventQueue=[],this._init=!1}return u(e,[{key:"getReportCfg",value:function e(){var t=this.ctx.getConfig().reportConfig;return(0,p.isObject)(t)||(t={}),(!t.flushTime||t.flushTime<0||t.flushTime>1e4)&&(t.flushTime=3e3),(!t.maxEventCount||t.maxEventCount<1||t.maxEventCount>100)&&(t.maxEventCount=20),t}},{key:"report",value:function e(t,n){var r=this;if(this.ctx=t,this._init||(this.init(t),this._init=!0),n&&n.single)this.flushSingleEvent(t);else{clearTimeout(this.timer),this.pushToQueue();var o=this.getReportCfg();n&&n.immediate||this.eventQueue.length>=o.maxEventCount?this.flushEventQueue():this.timer=setTimeout((function(){r.flushEventQueue()}),o.flushTime)}}},{key:"flushSingleEvent",value:function e(t){var n,r=t.session,o;if(!r||r.getSampled()){var i=t.getRumEvent();if(i){var u=t.getViews(),a=u[u.length-1];(null===(n=i.view)||void 0===n?void 0:n.id)===a.id&&delete i.view,this.dispatchEvents(t,[i],a)}}}},{key:"pushToQueue",value:function e(){var t=this.ctx,n=this.eventQueue,r=t.getRumEvent();if(r){if(r.event_type===f.RumEventType.EXCEPTION){var o=r.message,i=r.stack,u=(0,l.getErrorID)({message:o,stack:i}),a=this.eventQueue.find((function(e){if(e.event_type===f.RumEventType.EXCEPTION){var t=e.message,n=e.stack;return(0,l.getErrorID)({message:t,stack:n})===u}}));if(a)return void a.times++}if(r.event_type===f.RumEventType.ACTION){var c=r.target_name,s=this.eventQueue.find((function(e){if(e.event_type===f.RumEventType.ACTION)return c===e.target_name}));if(s)return void s.times++}n.push(r)}}},{key:"flushEventQueue",value:function e(){var t=this.ctx,n=this.eventQueue;if(n.length){var r=t.getViews(),o=r[r.length-1];r.forEach((function(e){var t;e.id===o.id&&n.filter((function(t){var n;return(null===(n=t.view)||void 0===n?void 0:n.id)===e.id})).forEach((function(e){delete e.view}))}));var i=t.session,u;(!i||i.getSampled())&&this.dispatchEvents(t,n,o),this.eventQueue=[]}}},{key:"dispatchEvents",value:function e(t,n,r){for(var o=t.getConfig(),i=t.session,u=i.getSessionId(),a=[],c={},s=0;s<n.length;s++){var f=n[s];if(f.session_id&&f.session_id!==u){var l=f.session_id;c[l]||(c[l]=[]),delete f.session_id,c[l].push(f)}else delete f.session_id,a.push(f)}a.length>0&&this.buildAndSend(t,o,i,u,a,r);for(var p=Object.keys(c),v=0;v<p.length;v++){var y=p[v];this.buildAndSend(t,o,i,y,c[y],r)}}},{key:"buildAndSend",value:function e(t,n,r,o,i,u){var a=(0,y.getUrlParams)(n.endpoint),c=Object.assign({app:{id:n.pid,env:n.env||"prod",version:n.version,type:""},user:{id:r.getUserId()},session:{id:o},net:{},view:u,events:i},a);h.forEach((function(e){var t=n[e];(0,p.isObject)(t)&&Object.keys(t).forEach((function(n){var r=t[n];"user"===e&&"id"===n||("properties"===e?c[e]=(0,v.verifyProperties)(t):((0,p.isString)(r)||(0,p.isNumber)(r))&&(e in c||(c[e]={}),c[e][n]=r))}))})),("function"!=typeof n.beforeReport||(c=n.beforeReport(c)))&&this.tryRequest(c)}},{key:"tryRequest",value:function e(t){var n=this,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,o,i,u,a=null===(o=this.ctx.getConfig())||void 0===o?void 0:o.reportConfig,c=null!==(i=null==a?void 0:a.maxRetryCount)&&void 0!==i?i:0,f=null!==(u=null==a?void 0:a.retryDelay)&&void 0!==u?u:3e3;t._retry=r,Promise.resolve(this.request(this.ctx,t)).catch((function(e){r<c-1?setTimeout((function(){return n.tryRequest(t,r+1)}),f):s.logger.error("reporter","Request failed after ".concat(r+1," attempts"),e)}))}},{key:"init",value:function e(t){}}])}();t.default=m},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.getErrorID=void 0;var r=function e(t){var n=t.message,r=void 0===n?"":n,o=t.stack,i;return r+(void 0===o?"":o)};t.getErrorID=r},function(e,t,n){"use strict";function r(e){return(r="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function o(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function i(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,a(r.key),r)}}function u(e,t,n){return t&&i(e.prototype,t),n&&i(e,n),Object.defineProperty(e,"prototype",{writable:!1}),e}function a(e){var t=c(e,"string");return"symbol"==r(t)?t:t+""}function c(e,t){if("object"!=r(e)||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var o=n.call(e,t||"default");if("object"!=r(o))return o;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}Object.defineProperty(t,"__esModule",{value:!0});var s=n(7),f=n(18),l=n(11),p=n(1),v=function(){function e(t){var n=this;o(this,e),this.initialized=!1,this.extensionCollectors=[],this.client=new l.default;var r=this.client.init.bind(this.client);this.client.init=function(){r.apply(void 0,arguments),n.initClient()},t&&this.init&&this.init(t)}return u(e,[{key:"useCollectors",value:function e(){for(var t,n=this,r=arguments.length,o=new Array(r),i=0;i<r;i++)o[i]=arguments[i];if((t=this.extensionCollectors).push.apply(t,o),this.initialized&&this.client){var u=this.client.getContext();u&&o.forEach((function(e){e.setup(u,n.client.sendEvent)}))}}},{key:"getCollectors",value:function e(){var t;return(this.client&&this.client.getCollectors()||[]).concat(this.extensionCollectors)}},{key:"initClient",value:function t(){var n=this;if(this.extensionCollectors.length>0){var r=this.client.getContext();r&&this.extensionCollectors.forEach((function(e){e.setup(r,n.client.sendEvent)}))}this.initialized=!0,e.instances.push(this)}},{key:"sendEvent",value:function e(t,n){this.client&&this.client.sendEvent(t,n)}},{key:"startView",value:function e(t,n){if(t){var r=this.client.getContext();if(r&&r.session){var o=r.getViews(),i=o&&o.length?o[o.length-1]:void 0;if(!i||i.name!==t){i&&r.emitter.emit(f.LifeCycleEventType.VIEW_ENDED,Object.assign({type:"pv"},i));var u={id:r.session.getViewId(),name:t,loading_type:n&&n.loading_type||"route_change"};r.addView(u);var a=r.session.getBaseEvent?r.session.getBaseEvent():{},c=Object.assign({},a,{event_type:s.RumEventType.VIEW,type:"pv",name:t,url:n&&n.url,referrer:n&&n.referrer,loading_type:u.loading_type});r.emitter.emit(f.LifeCycleEventType.VIEW_CREATED,c),this.sendEvent(c)}}}}},{key:"getConfig",value:function e(){if(this.client)return this.client.getContext().getConfig()}},{key:"sendCustom",value:function e(t){if(t.name&&t.type){var n=Object.assign({},t,{event_type:s.RumEventType.CUSTOM});this.sendEvent(n)}}},{key:"sendView",value:function e(t){if((0,p.isObject)(t)){if(t.type||(t.type="custom"),"custom"===t.type){var n=0;if(["t1","t2","t3"].forEach((function(e){(0,p.isNumber)(t[e])||delete t[e],e in t&&n++})),0===n)return}var r=Object.assign({},t,{event_type:s.RumEventType.VIEW});this.sendEvent(r)}}},{key:"sendException",value:function e(t){if(t.name&&t.message){var n=t.name,r=t.message,o=t.stack,i=t.source||"custom",u=Object.assign({times:1,name:n,message:r,stack:o},t,{event_type:s.RumEventType.EXCEPTION,type:"custom",source:i});this.sendEvent(u)}}},{key:"sendResource",value:function e(t){if(t.name&&t.type&&(0,p.isNumber)(t.duration)){var n=Object.assign({times:1},t,{event_type:s.RumEventType.RESOURCE});this.sendEvent(n)}}}],[{key:"broadcastEvent",value:function t(n,r){e.instances.forEach((function(e){e.initialized&&e.client&&e.client.sendEvent(n,r)}))}}])}();t.default=v,v.instances=[]},function(e,t,n){"use strict";function r(e){return(r="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function o(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function i(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,a(r.key),r)}}function u(e,t,n){return t&&i(e.prototype,t),n&&i(e,n),Object.defineProperty(e,"prototype",{writable:!1}),e}function a(e){var t=c(e,"string");return"symbol"==r(t)?t:t+""}function c(e,t){if("object"!=r(e)||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var o=n.call(e,t||"default");if("object"!=r(o))return o;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}function s(e){var t=e.remoteConfig||{},n=!1;return"enable"in t?n=!!t.enable:(t.region||t.url)&&(n=!0),{enable:n,url:t.url||"",mode:t.mode||"launch-first",cacheTimeout:t.cacheTimeout||36e5,region:t.region}}Object.defineProperty(t,"__esModule",{value:!0}),t.ConfigManager=void 0;var f=function(){function e(){o(this,e),this.currentConfig=null,this.initialized=!1}return u(e,[{key:"init",value:function e(t){var n=this;if(this.initialized)return Promise.resolve();this.currentConfig=Object.assign({},t),this.initialized=!0;var r=s(t);return this.currentConfig.remoteConfig=r,r.enable?Promise.resolve(this.getCacheConfig()).then((function(e){if(e&&e.content&&(n.currentConfig=n.mergeRemoteCfg(e.content)),!n.isCacheValid(e,r.cacheTimeout)){var t=n.fetchRemoteCfg(n.currentConfig).then((function(e){if(e){var t=n.parseConfig(e);n.currentConfig=n.mergeRemoteCfg(t),n.setCacheConfig({timestamp:Date.now(),content:e})}}));return"remote-first"===r.mode?t:void 0}})):Promise.resolve()}},{key:"getConfig",value:function e(){if(!this.currentConfig)throw new Error("Config not initialized");return this.currentConfig}},{key:"setConfig",value:function e(t){this.currentConfig&&(this.currentConfig=Object.assign({},this.currentConfig,t))}},{key:"isCacheValid",value:function e(t,n){if(!t||!t.timestamp)return!1;var r=n||36e5;return Date.now()-t.timestamp<r}},{key:"mergeRemoteCfg",value:function e(t){var n=this.currentConfig,r=n.pid,o=n.app,i=n.endpoint,u=n.remoteConfig,a=n.beforeReport,c=n.properties;return Object.assign({},this.currentConfig,t,{pid:r,app:o,endpoint:i,remoteConfig:u,beforeReport:a,properties:c})}},{key:"destroy",value:function e(){this.currentConfig=null,this.initialized=!1}}])}();t.ConfigManager=f},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0})},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0})},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0})},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0})},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0})},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.parseTracingOptions=t.makeTracingHeaders=t.isTraceOption=void 0;var r=n(21),o=n(1);function i(e){return e&&(0,r.isMatchOption)(e.match)&&(0,o.isArray)(e.propagatorTypes)}function u(e,t,n,r){var i=arguments.length>4&&void 0!==arguments[4]?arguments[4]:{},u={},a=n?"1":"0";return r.includes("sw8")&&(r=["sw8"]),(0,o.isArray)(r)||(r=[r]),r.forEach((function(n){switch(n){case"jaeger":u["uber-trace-id"]="".concat(e,":").concat(t,":0:").concat(a);break;case"b3":u.b3="".concat(e,"-").concat(t,"-").concat(a);break;case"b3multi":u["X-B3-TraceId"]=e,u["X-B3-SpanId"]=t,u["X-B3-Sampled"]=a;break;case"sw8":if((0,o.isFunction)(btoa)){var r=btoa(e),c=btoa(t),s=btoa(i.appId),f=btoa(i.appVersion),l=btoa(i.viewName),p=btoa(i.host);u.sw8="".concat(a,"-").concat(r,"-").concat(c,"-",0,"-").concat(s,"-").concat(f,"-").concat(l,"-").concat(p)}break;case"tracecontext":default:u.traceparent="00-".concat(e,"-").concat(t,"-0").concat(a),i.tracestate&&(u.tracestate=i.tracestate)}})),i.baggage&&(u.baggage=i.baggage),u}function a(e){var t=["tracecontext"];if((0,o.isBoolean)(e)||!e)return{enable:!!e,sample:100,propagatorTypes:t,allowedUrls:[],tracestate:!0,baggage:!1};var n=e.enable,u=void 0===n||n,a=e.sample,c=void 0===a?100:a,s=e.propagatorTypes,f=void 0===s?t:s,l=e.allowedUrls,p=void 0===l?[]:l,v=e.tracestate,y=void 0===v||v,d=e.baggage,g=void 0!==d&&d,h=[];return(0,o.isArray)(p)&&p.length&&p.forEach((function(e){(0,r.isMatchOption)(e)?h.push({match:e,propagatorTypes:f}):i(e)&&h.push(e)})),{enable:!(0,o.isBoolean)(u)||u,sample:(0,o.isNumber)(c)?c:100,propagatorTypes:f,allowedUrls:h,tracestate:y,baggage:g}}t.isTraceOption=i,t.makeTracingHeaders=u,t.parseTracingOptions=a},function(e,t,n){"use strict";function r(e,t){var n=0,r=null,o=function t(){n=Date.now(),r=null,e()},i=function e(){var i=t-(Date.now()-n);i<=0?(r&&(clearTimeout(r),r=null),o()):r||(r=setTimeout(o,i))};return i.cancel=function(){r&&(clearTimeout(r),r=null),n=0},i}Object.defineProperty(t,"__esModule",{value:!0}),t.throttle=void 0,t.throttle=r},function(e,t,n){"use strict";function r(){var e=[];return{add:function t(){e.push.apply(e,arguments)},dispose:function t(){e.forEach((function(e){return e()})),e.length=0}}}Object.defineProperty(t,"__esModule",{value:!0}),t.createDisposableGroup=void 0,t.createDisposableGroup=r},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.encodeLogGroup=t.convertBundlesToLogGroup=t.Telemetry=t.callMonitored=t.logger=void 0;var r=n(4);Object.defineProperty(t,"logger",{enumerable:!0,get:function e(){return r.logger}}),Object.defineProperty(t,"callMonitored",{enumerable:!0,get:function e(){return r.callMonitored}});var o=n(13);Object.defineProperty(t,"Telemetry",{enumerable:!0,get:function e(){return o.Telemetry}}),Object.defineProperty(t,"convertBundlesToLogGroup",{enumerable:!0,get:function e(){return o.convertBundlesToLogGroup}});var i=n(14);Object.defineProperty(t,"encodeLogGroup",{enumerable:!0,get:function e(){return i.encodeLogGroup}})},function(e,t,n){"use strict";function r(e){return(r="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function o(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function i(e,t){for(var n,r=0;r<t.length;r++)(n=t[r]).enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,a(n.key),n)}function u(e,t,n){return t&&i(e.prototype,t),n&&i(e,n),Object.defineProperty(e,"prototype",{writable:!1}),e}function a(e){var t=c(e,"string");return"symbol"==r(t)?t:t+""}function c(e,t){if("object"!=r(e)||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var o=n.call(e,t||"default");if("object"!=r(o))return o;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}Object.defineProperty(t,"__esModule",{value:!0});var s=n(0),f=n(3),l=n(2),p=["navigateTo","redirectTo","switchTab"],v=function(){function e(){var t=this;o(this,e),this.name="pv-collector",this.sendPv=s.logger.wrap((function(){var e=(0,f.getCurView)(t.ctx);e&&clearInterval(t.timer),e&&"_noReport"in e&&(delete e._noReport,t.sendEvent(Object.assign({event_type:s.RumEventType.VIEW,type:"pv",loading_type:"initial_load"},e)))}),"pv-collector","sendPv failed")}return u(e,[{key:"setup",value:function(e,t){var n=this;this.ctx=e,this.sendEvent=t,setTimeout(this.sendPv,100),this.timer=setInterval((function(){n.sendPv()}),100),(0,s.isFunction)(l.sdk.addInterceptor)&&p.forEach((function(e){l.sdk.addInterceptor(e,{success:n.sendPv})}))}},{key:"destroy",value:function(){}}])}();t.default=v},function(e,t){var n;n=function(){return this}();try{n=n||new Function("return this")()}catch(e){"object"==typeof window&&(n=window)}e.exports=n},function(e,t,n){"use strict";function r(e){return(r="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function o(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function i(e,t){for(var n,r=0;r<t.length;r++)(n=t[r]).enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,a(n.key),n)}function u(e,t,n){return t&&i(e.prototype,t),n&&i(e,n),Object.defineProperty(e,"prototype",{writable:!1}),e}function a(e){var t=c(e,"string");return"symbol"==r(t)?t:t+""}function c(e,t){if("object"!=r(e)||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var o=n.call(e,t||"default");if("object"!=r(o))return o;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}Object.defineProperty(t,"__esModule",{value:!0});var s=n(0),f=n(8),l=n(2),p=5e3,v=50,y=function(){function e(){var t=this;o(this,e),this.name="exception-collector",this.recentErrors=[],this.timerWrappers=[],this.reportJSExceptionHandler=function(){for(var e,n,r=[],o=0;o<arguments.length;o++)(n=0>o||arguments.length<=o?void 0:arguments[o])instanceof Error||n&&n.message?!e&&(e=n):(0,s.isString)(n)&&n&&r.push(n);return e?void t.errorHandle(e,"reportJSException",!0):void(!r.length||t.errorHandle(r.join("\n"),"reportJSException",!0))},this.vueError=function(e,n){t.errorHandle(n,"Vue.onError")},this.uniError=function(e){t.errorHandle(e,"uni.onError")},this.onError=function(e){t.errorHandle(e,"onError")},this.onUnhandledRejection=function(e){if(e){var n=e.reason;if(n){var r=n.errMsg;if(r&&(0,s.isString)(r)){(n=new Error(r)).name="",n.stack="";for(var o,i,u=0,a=["navigateTo","redirectTo","appLaunch","switchTab","getLocation","onLocationChange"];u<a.length;u++)if(o=a[u],r.startsWith(o)){n.name=o;break}n.name||(n.name=r.split(":")[0])}t.errorHandle(n,"onUnhandledRejection")}}},this.errorHandle=function(e){var n,r,o,i,u,a,c=1<arguments.length&&void 0!==arguments[1]?arguments[1]:"",f=!!(2<arguments.length&&void 0!==arguments[2])&&arguments[2];if(e instanceof Object){if(n=e.name,r=e.message,o=e.filename||e.fileName,i=e.stack,u=e.lineno||e.lineNumber,a=e.colno||e.columnNumber,e.error instanceof Error){var l=e.error;n=l.name,r=l.message,i=l.stack}if(!n&&(0,s.isString)(r)){var p=t.getErrorByStack(i||r);p&&p.name&&p.message&&(n=p.name,r=p.message),n=n||"Error",i=i||r}}else if("string"==typeof e){i=e;var v=t.getErrorByStack(e);v&&(n=v.name,r=v.message)}!n||!r||f&&t.isDuplicated(n,r)||t.sendEvent({event_type:s.RumEventType.EXCEPTION,source:c,type:"error",name:n,message:r,file:o,stack:i,line:u,column:a,times:1})}}return u(e,[{key:"setup",value:function(e,t){this.ctx=e,this.sendEvent=t,this.hackOrigin()}},{key:"hackOrigin",value:function(){var e=this,t,n=this.ctx.getConfig().collectors,r=void 0===n?{}:n;if(!1!==r.jsError){try{(0,f.addEventListener)("onError",this.vueError)}catch(e){s.logger.warn("exception-collector","add vue onError listener failed",e)}if(this.safeAddEventListener("error",this.onError),this.safeAddEventListener("unhandledrejection",this.onUnhandledRejection),(0,s.isFunction)(l.sdk.onError))try{l.sdk.onError(this.uniError)}catch(e){s.logger.warn("exception-collector","uni.onError register failed",e)}if(!(0,s.isFunction)(l.global2.addEventListener)&&(0,s.isFunction)(l.sdk.onUnhandledRejection))try{l.sdk.onUnhandledRejection(this.onUnhandledRejection)}catch(e){s.logger.warn("exception-collector","uni.onUnhandledRejection register failed",e)}this.hackAppRuntime()}!1!==r.consoleError&&(0,s.interceptFunction)(console,"error",(function(t){e.errorHandle(t,"console.error")}))}},{key:"safeAddEventListener",value:function(e,t){try{(0,s.isFunction)(l.global2.addEventListener)&&l.global2.addEventListener(e,t)}catch(t){s.logger.warn("exception-collector","add ".concat(e," listener failed"),t)}}},{key:"hackAppRuntime",value:function(){var e,t=this;try{if("undefined"==typeof plus||!plus)return;plus.globalEvent&&(e=plus.globalEvent)}catch(e){return}if((0,s.interceptFunction)(l.global2,"reportJSException",this.reportJSExceptionHandler),this.wrapTimers(),e&&(0,s.isFunction)(e.addEventListener))try{e.addEventListener("error",(function(e){try{t.errorHandle(e,"plus.globalEvent",!0)}catch(e){s.logger.warn("exception-collector","plus.globalEvent error failed",e)}})),e.addEventListener("unhandledrejection",(function(e){if(e&&e.reason)try{t.errorHandle(e.reason,"plus.globalEvent",!0)}catch(e){s.logger.warn("exception-collector","plus.globalEvent unhandledrejection failed",e)}}))}catch(e){s.logger.warn("exception-collector","plus.globalEvent register failed",e)}}},{key:"wrapTimers",value:function(){for(var e,t=this,n=this,r=["setTimeout","setInterval","setImmediate"],o=function e(){var o,u=r[i];try{o=l.global2[u]}catch(e){return 0}if(!(0,s.isFunction)(o)||o.__armsTimerWrapped)return 0;var a=function e(){for(var t=arguments.length,r=Array(t),i=0;i<t;i++)r[i]=arguments[i];var a=r[0];if(!(0,s.isFunction)(a))return o.apply(this,r);var c=function e(){try{return a.apply(this,arguments)}catch(e){try{n.errorHandle(e,u,!0)}catch(e){s.logger.warn("exception-collector","report timer error failed",e)}throw e}};return c.__armsOriginalCallback=a,r[0]=c,o.apply(this,r)};try{Object.defineProperty(a,"name",{value:u,configurable:!0})}catch(e){}a.toString=function(){return o.toString()},a.__armsTimerWrapped=!0;try{l.global2[u]=a,t.timerWrappers.push({name:u,original:o})}catch(e){s.logger.warn("exception-collector","wrap ".concat(u," failed"),e)}},i=0;i<r.length;i++)e=o()}},{key:"isDuplicated",value:function e(t,n){for(var r=Date.now(),o=this.recentErrors;o.length&&r-o[0].time>5e3;)o.shift();for(var i=t+"|"+n,u=0;u<o.length;u++)if(o[u].key===i)return!0;return o.push({key:i,time:r}),o.length>50&&o.shift(),!1}},{key:"getErrorByStack",value:function e(){var t=0<arguments.length&&void 0!==arguments[0]?arguments[0]:"",n=t.split("\n");if(!(2>n.length)){for(var r,o=function e(t){var n=t.trim();return n.startsWith("at ")||/@.+:\d+:\d+/.test(n)||/@(\[native code\])?$/.test(n)},i=/^\s*([\w$]*(?:Error|Exception))\s*:\s*(.+)$/,u=0;u<n.length;u++)if(r=i.exec(n[u]))return{name:r[1],message:r[2]};for(var a=1;a<n.length;a++)if(o(n[a])){var c=n[a-1];if(o(c))return;var s=c.indexOf(": ");return-1===s?{name:"",message:c}:{name:c.substring(0,s),message:c.substring(s+2)}}}}},{key:"destroy",value:function e(){(0,s.restoreFunction)(console,"error"),(0,s.restoreFunction)(l.global2,"reportJSException");for(var t=0;t<this.timerWrappers.length;t++){var n=this.timerWrappers[t],r=n.name,o=n.original;try{l.global2[r]&&l.global2[r].__armsTimerWrapped&&(l.global2[r]=o)}catch(e){}}this.timerWrappers=[],this.recentErrors=[]}}])}();t.default=y},function(e,t,n){"use strict";function r(e){return(r="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function o(){function e(e,n,r,o){var u=n&&n.prototype instanceof t?n:t,s=Object.create(u.prototype);return i(s,"_invoke",function(e,t,n){function r(e,t){for(i=e,u=t,c=0;!l&&s&&!n&&c<f.length;c++){var n,r=f[c],o=v.p,y=r[2];3<e?(n=y===t)&&(u=r[(i=r[4])?5:(i=3,3)],r[4]=r[5]=a):r[0]<=o&&((n=2>e&&o<r[1])?(i=0,v.v=t,v.n=r[1]):o<y&&(n=3>e||r[0]>t||t>y)&&(r[4]=e,r[5]=t,v.n=y,i=0))}if(n||1<e)return p;throw l=!0,t}var o,i,u,s=0,f=n||[],l=!1,v={p:0,n:0,v:a,a:r,f:r.bind(a,4),d:function e(t,n){return o=t,i=0,u=a,v.n=n,p}};return function(n,f,y){if(1<s)throw TypeError("Generator is already running");for(l&&1===f&&r(f,y),i=f,u=y;(c=2>i?a:u)||!l;){o||(i?3>i?(1<i&&(v.n=-1),r(i,u)):v.n=u:v.v=u);try{if(s=2,o){if(i||(n="next"),c=o[n]){if(!(c=c.call(o,u)))throw TypeError("iterator result is not an object");if(!c.done)return c;u=c.value,2>i&&(i=0)}else 1===i&&(c=o.return)&&c.call(o),2>i&&(u=TypeError("The iterator does not provide a '"+n+"' method"),i=1);o=a}else if((c=(l=0>v.n)?u:e.call(t,v))!==p)break}catch(e){o=a,i=1,u=e}finally{s=1}}return{value:c,done:l}}}(e,r,o),!0),s}function t(){}function n(){}function r(){}function u(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,r):(e.__proto__=r,i(e,l,"GeneratorFunction")),e.prototype=Object.create(y),e}/*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/babel/babel/blob/main/packages/babel-helpers/LICENSE */var a,c,s="function"==typeof Symbol?Symbol:{},f=s.iterator||"@@iterator",l=s.toStringTag||"@@toStringTag",p={};c=Object.getPrototypeOf;var v=[][f]?c(c([][f]())):(i(c={},f,(function(){return this})),c),y=r.prototype=t.prototype=Object.create(v);return n.prototype=r,i(y,"constructor",r),i(r,"constructor",n),n.displayName="GeneratorFunction",i(r,l,"GeneratorFunction"),i(y),i(y,l,"Generator"),i(y,f,(function(){return this})),i(y,"toString",(function(){return"[object Generator]"})),(o=function t(){return{w:e,m:u}})()}function i(e,t,n,r){var o=Object.defineProperty;try{o({},"",{})}catch(e){o=0}(i=function e(t,n,r,u){function a(e,n){i(t,e,(function(t){return this._invoke(e,n,t)}))}n?o?o(t,n,{value:r,enumerable:!u,configurable:!u,writable:!u}):t[n]=r:(a("next",0),a("throw",1),a("return",2))})(e,t,n,r)}function u(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function a(e,t){for(var n,r=0;r<t.length;r++)(n=t[r]).enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,s(n.key),n)}function c(e,t,n){return t&&a(e.prototype,t),n&&a(e,n),Object.defineProperty(e,"prototype",{writable:!1}),e}function s(e){var t=f(e,"string");return"symbol"==r(t)?t:t+""}function f(e,t){if("object"!=r(e)||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var o=n.call(e,t||"default");if("object"!=r(o))return o;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}var l=this&&this.__awaiter||function(e,t,n,r){function o(e){return e instanceof n?e:new n((function(t){t(e)}))}return new(n||(n=Promise))((function(n,i){function u(e){try{c(r.next(e))}catch(e){i(e)}}function a(e){try{c(r.throw(e))}catch(e){i(e)}}function c(e){e.done?n(e.value):o(e.value).then(u,a)}c((r=r.apply(e,t||[])).next())}))};Object.defineProperty(t,"__esModule",{value:!0});var p=n(0),v=n(2),y=n(9),d=n(10),g=n(3),h=n(42),m=function(){function e(){var t=this;u(this,e),this.name="api-collector",this.sendApi=function(e,n,r){return l(t,void 0,void 0,o().m((function t(){var i,u,a,c,s,f,l,v,y,g,m;return o().w((function(t){for(;;)switch(t.p=t.n){case 0:if(i=this.ctx.getConfig(),u=i.evaluateApi,a=n.statusCode,c=n.status,s=n.errMsg,f=n.errorMessage,l=n.message,!(0,p.isFunction)(u)){t.n=4;break}return t.p=1,0===e.success&&(v=new Error("request error")),t.n=2,u(r,n,v);case 2:y=t.v,e=Object.assign(Object.assign({},e),(0,h.reviseApiAttr)(y)),t.n=4;break;case 3:t.p=3,m=t.v,p.logger.error("api-collector","evaluateApi failed",m);case 4:if(!((g=Object.assign({event_type:p.RumEventType.RESOURCE,type:"api",status_code:c||a,message:f||s||l,duration:(0,d.getCurrentTime)()-e.timestamp,times:1},e)).duration>p.ONE_DAY)){t.n=5;break}return t.a(2);case 5:this.sendEvent(g);case 6:return t.a(2)}}),t,this,[[1,3]])})))}}return c(e,[{key:"setup",value:function e(t,n){var r,o=t.getConfig().collectors,i;!1===(void 0===o?{}:o).api||(this.ctx=t,this.sendEvent=n,this.interceptorRequest())}},{key:"interceptorRequest",value:function e(){if((0,p.isFunction)(v.sdk.addInterceptor)){var t=this;v.sdk.addInterceptor("request",{invoke:p.logger.wrap((function(e){t.rebuildRequestOptions(e)}),"api-collector","intercept request failed")})}}},{key:"injectTracing",value:function e(t,n){var r,o=this.ctx.getConfig(),i=o.tracing,u=o.pid,a=o.version,c=void 0===a?"1.0.0":a,s=(0,p.parseTracingOptions)(i),f=s.enable,l=s.sample,y=s.propagatorTypes,d=s.allowedUrls,g=s.tracestate,h=!(void 0!==g)||g,m=s.baggage,b=void 0!==m&&m;if(f){var w=(0,p.find)(d,(function(e){return(0,p.matchList)([e.match],t.url)}));if(w){var E=w.propagatorTypes;0===E.length&&(E=y);var S=!1;E.includes("sw8")&&(E=["sw8"],S=!0);var O=S?(0,p.generateGUID)():(0,p.generateTraceId)(),j=S?(0,p.generateGUID)():(0,p.generateSpanId)(),_=(0,p.performDraw)(l),k=this.ctx.session.getUserId(),T=this.ctx.session.getSessionId(),C=h?"rum=v2&uniapp&".concat(u,"&").concat(T,"&").concat(k):void 0,P=b?"rum=v2,appType=uniapp,pid=".concat(u,",sid=").concat(T,",uid=").concat(k):void 0,x=(0,p.makeTracingHeaders)(O,j,_,E,{tracestate:C,baggage:P,appId:u,appVersion:c,viewName:null===(r=t.view)||void 0===r?void 0:r.name,host:v.appName});_&&(t.trace_id=O,t.trace_data=JSON.stringify({spanId:j,sample:l,sampled:_,header:x})),n(x)}}}},{key:"rebuildRequestOptions",value:function e(t){var n=this,r=t.url,o=t.success,i=t.fail,u=t.complete,a=t.header,c=(0,d.getCurrentTime)();if((0,y.isEndpoint)(this.ctx,r)||(0,p.urlMatch)(r))return t;var s={view:(0,g.getCurView)(this.ctx),timestamp:c,url:r,name:this.getResourceName(r),method:t.method||"GET"};return this.injectTracing(s,(function(e){t.header=Object.assign(Object.assign({},a),e)})),t.success=function(){s.success=1;for(var e=arguments.length,t=Array(e),n=0;n<e;n++)t[n]=arguments[n];o&&o.apply(this,t)},t.fail=function(){s.success=0;for(var e=arguments.length,t=Array(e),n=0;n<e;n++)t[n]=arguments[n];i&&i.apply(this,t)},t.complete=function(){for(var e=arguments.length,r=Array(e),o=0;o<e;o++)r[o]=arguments[o];var i=Object.assign({},r[0]);try{var a=i.statusCode;if(a){var c=+a;s.success=200<=c&&300>c?1:0}s.size=(0,d.getStringSize)(JSON.stringify(i)),n.sendApi(s,i,t)}catch(e){p.logger.error("api-collector","process response failed",e)}u&&u.apply(this,r)},t}},{key:"getResourceName",value:function e(t){var n,r,o=this.ctx.getConfig().parseResourceName;return n=(0,p.isFunction)(o)?o(t):(0,y.getPathByURL)(t)}}])}();t.default=m},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.reviseApiAttr=void 0;var r=n(0);function o(e){if(e&&(0,r.isObject)(e)){var t={};return(0,r.isString)(e.name)&&(t.name=e.name.substring(0,1e3)),(0,r.isString)(e.message)&&(t.message=e.message.substring(0,1e3)),(0,r.isNumber)(e.success)&&-1<=e.success&&1>=e.success&&(t.success=e.success),(0,r.isNumber)(e.duration)&&0<=e.duration&&(t.duration=e.duration),(0,r.isString)(e.status_code)&&(t.status_code=e.status_code.substring(0,100)),(0,r.isNumber)(e.status_code)&&(t.status_code=e.status_code),(0,r.isString)(e.snapshots)&&(t.snapshots=e.snapshots.substring(0,5e3)),t}}t.reviseApiAttr=o},function(e,t,n){"use strict";function r(e){return(r="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function o(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function i(e,t){for(var n,r=0;r<t.length;r++)(n=t[r]).enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,a(n.key),n)}function u(e,t,n){return t&&i(e.prototype,t),n&&i(e,n),Object.defineProperty(e,"prototype",{writable:!1}),e}function a(e){var t=c(e,"string");return"symbol"==r(t)?t:t+""}function c(e,t){if("object"!=r(e)||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var o=n.call(e,t||"default");if("object"!=r(o))return o;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}Object.defineProperty(t,"__esModule",{value:!0});var s=n(0),f=n(8),l=n(3),p=function(){function e(){var t=this;o(this,e),this.name="action-collector",this.DELAY_TIME=300,this.events=["tap","click"],this.onEvent=function(e,n){if(n&&t.events.includes(n.type)){var r=n.currentTarget||n.target||{},o=r.id,i=r.dataset;if(!o&&n.target&&(o=n.target.id,i=n.target.dataset),o){var u=(0,l.getCurView)(t.ctx),a={event_type:s.RumEventType.ACTION,type:n.type,name:o,snapshots:i?JSON.stringify({dataset:i}).substring(0,1e3):void 0,times:1,view:u};clearTimeout(t.timer),t.lastEvent?t.lastEvent.name===a.name?t.lastEvent.times+=1:(t.sendAction(),t.lastEvent=a):t.lastEvent=a,t.timer=setTimeout(t.sendAction,t.DELAY_TIME)}}},this.sendAction=function(){t.lastEvent&&(t.sendEvent(t.lastEvent),t.lastEvent=null)}}return u(e,[{key:"setup",value:function(e,t){var n,r=e.getConfig().collectors,o;!1===(void 0===r?{}:r).action||(this.ctx=e,this.sendEvent=t,(0,f.addEventListener)("action",this.onEvent))}},{key:"destroy",value:function(){(0,f.removeEventListener)("action",this.onEvent)}}])}();t.default=p},function(e,t,n){"use strict";function r(e){return(r="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function o(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function i(e,t){for(var n,r=0;r<t.length;r++)(n=t[r]).enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,a(n.key),n)}function u(e,t,n){return t&&i(e.prototype,t),n&&i(e,n),Object.defineProperty(e,"prototype",{writable:!1}),e}function a(e){var t=c(e,"string");return"symbol"==r(t)?t:t+""}function c(e,t){if("object"!=r(e)||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var o=n.call(e,t||"default");if("object"!=r(o))return o;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}Object.defineProperty(t,"__esModule",{value:!0});var s=n(10),f=n(3),l=function(){function e(){o(this,e),this.name="default-processor"}return u(e,[{key:"process",value:function(e){var t=e.getRumEvent(),n=(0,f.getCurView)(e),r;return Object.assign({timestamp:(0,s.getCurrentTime)(),session_id:e.session.getSessionId(),event_id:e.session.getEventId(),view:n},t)}}])}();t.default=l},function(e,t,n){"use strict";function r(e){return(r="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function o(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function i(e,t){for(var n,r=0;r<t.length;r++)(n=t[r]).enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,a(n.key),n)}function u(e,t,n){return t&&i(e.prototype,t),n&&i(e,n),Object.defineProperty(e,"prototype",{writable:!1}),e}function a(e){var t=c(e,"string");return"symbol"==r(t)?t:t+""}function c(e,t){if("object"!=r(e)||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var o=n.call(e,t||"default");if("object"!=r(o))return o;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}Object.defineProperty(t,"__esModule",{value:!0});var s=n(0),f=function(){function e(){var t=this;o(this,e),this.name="session-processor",this.update=function(e){e&&!e.isTrusted||t.ctx.session.updateSession()}}return u(e,[{key:"setup",value:function(e){this.ctx=e,this.update=(0,s.debounce)(this.update,s.ONE_SECOND)}},{key:"process",value:function(e){return this.update(),e.getRumEvent()}}])}();t.default=f},function(e,t,n){"use strict";function r(e){return(r="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function o(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function i(e,t){for(var n,r=0;r<t.length;r++)(n=t[r]).enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,a(n.key),n)}function u(e,t,n){return t&&i(e.prototype,t),n&&i(e,n),Object.defineProperty(e,"prototype",{writable:!1}),e}function a(e){var t=c(e,"string");return"symbol"==r(t)?t:t+""}function c(e,t){if("object"!=r(e)||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var o=n.call(e,t||"default");if("object"!=r(o))return o;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}function s(e,t,n){return t=v(t),f(e,p()?Reflect.construct(t,n||[],v(e).constructor):t.apply(e,n))}function f(e,t){if(t&&("object"==r(t)||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return l(e)}function l(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function p(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(e){}return(p=function(){return!!e})()}function v(e){return(v=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function y(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&d(e,t)}function d(e,t){return(d=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e})(e,t)}Object.defineProperty(t,"__esModule",{value:!0});var g=n(0),h=n(2),m=function(e){function t(){var e;return o(this,t),(e=s(this,t,arguments)).name="uni-reporter",e}return y(t,e),u(t,[{key:"init",value:function(){var e=this;(0,g.isFunction)(h.sdk.onAppHide)&&h.sdk.onAppHide((function(){e.flushEventQueue()}))}},{key:"request",value:function(e,t){var n=e.getConfig();(0,h.fixAttrs)(t).then((function(e){h.sdk.request({url:n.endpoint,method:"POST",header:{"Content-Type":"text/plain"},dataType:"text",data:JSON.stringify(e)})})).catch((function(e){g.logger.warn("uni-reporter","request failed",e)}))}}])}(g.Reporter);t.default=m},function(e,t,n){"use strict";function r(e){return(r="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function o(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function i(e,t){for(var n,r=0;r<t.length;r++)(n=t[r]).enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,a(n.key),n)}function u(e,t,n){return t&&i(e.prototype,t),n&&i(e,n),Object.defineProperty(e,"prototype",{writable:!1}),e}function a(e){var t=c(e,"string");return"symbol"==r(t)?t:t+""}function c(e,t){if("object"!=r(e)||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var o=n.call(e,t||"default");if("object"!=r(o))return o;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}Object.defineProperty(t,"__esModule",{value:!0}),t.UniMonitorReporter=void 0;var s=n(0),f=n(2),l=n(9),p=function(){function e(t){o(this,e),this.endpoint=this.buildMonitorEndpoint(t)}return u(e,[{key:"send",value:function(e){if(e&&0!==e.length)try{var t=(0,s.convertBundlesToLogGroup)(e);f.sdk.request({url:this.endpoint,method:"POST",header:{"Content-Type":"application/x-protobuf","x-log-apiversion":"0.6.0","x-log-compresstype":"","x-log-date":(new Date).toUTCString()},data:t.buffer})}catch(e){s.logger.warn("monitor-reporter","Monitor data send failed",e)}}},{key:"buildMonitorEndpoint",value:function(e){try{var t=(0,l.getURL)(e);return"".concat(t.protocol,"://").concat(t.host,"/rum/monitor")}catch(t){return e}}}])}();t.UniMonitorReporter=p},function(e,t,n){"use strict";function r(e){return(r="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function o(e,t){return s(e)||c(e,t)||u(e,t)||i()}function i(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function u(e,t){if(e){if("string"==typeof e)return a(e,t);var n={}.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?a(e,t):void 0}}function a(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}function c(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var r,o,i,u,a=[],c=!0,s=!1;try{if(i=(n=n.call(e)).next,0===t){if(Object(n)!==n)return;c=!1}else for(;!(c=(r=i.call(n)).done)&&(a.push(r.value),a.length!==t);c=!0);}catch(c){s=!0,o=c}finally{try{if(!c&&null!=n.return&&(u=n.return(),Object(u)!==u))return}finally{if(s)throw o}}return a}}function s(e){if(Array.isArray(e))return e}function f(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function l(e,t){for(var n,r=0;r<t.length;r++)(n=t[r]).enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,v(n.key),n)}function p(e,t,n){return t&&l(e.prototype,t),n&&l(e,n),Object.defineProperty(e,"prototype",{writable:!1}),e}function v(e){var t=y(e,"string");return"symbol"==r(t)?t:t+""}function y(e,t){if("object"!=r(e)||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var o=n.call(e,t||"default");if("object"!=r(o))return o;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}Object.defineProperty(t,"__esModule",{value:!0}),t.RumSession=void 0;var d=n(0),g=n(10),h=n(3),m=n(2),b="_arms_uid",w="_arms_session",E=function(){function e(){f(this,e),this.appType="uniapp",this.sdkVersion=m.VERSION}return p(e,[{key:"init",value:function(e){var t;this.ctx=e,this.sessionConfig=this.fixSessionConfig(null===(t=e.getConfig())||void 0===t?void 0:t.sessionConfig)}},{key:"getSessionId",value:function(){return this.getSessionInfo().sessionId}},{key:"getSampled",value:function(){return this.getSessionInfo().sampled}},{key:"checkSession",value:function(e){var t=this.sessionConfig,n=t.overtime,r=t.maxDuration,o=(0,g.getCurrentTime)();return!(e.startTime+r<o||e.lastTime+n<o)}},{key:"updateSession",value:function(){var e=this.getSessionInfo();if(!e.isNew){var t=e.startTime,n=(0,g.getCurrentTime)(),r=e.sampled?1:0;(0,m.setStorageSync)(w,"".concat(e.sessionId,"-").concat(r,"-").concat(t,"-").concat(n))}}},{key:"getSessionInfo",value:function(){var e,t=o(((0,m.getStorageSync)(w)||"").split("-"),4),n=t[0],r=t[1],i=t[2],u=t[3],a={sessionId:n,sampled:"0"!==r,startTime:parseInt(i||"")||0,lastTime:parseInt(u||"")||0};return this.checkSession(a)||(a=this.resetSession()),a}},{key:"getEventId",value:function(){return(0,d.generateEventId)(this.getSessionId())}},{key:"getViewId",value:function(){return this.getUUID()}},{key:"getUserId",value:function(){var e=(0,m.getStorageSync)(b);return e&&0===e.indexOf("user_")&&(e=""),e||(e="uid_".concat((0,d.generateSpanId)(16,36)),(0,m.setStorageSync)(b,e)),e}},{key:"resetSession",value:function(){var e=this.sessionConfig.sampling,t=this.getUUID(),n=(0,g.getCurrentTime)(),r=(0,d.performDraw)(e),o="".concat(t,"-").concat(r?1:0,"-").concat(n,"-").concat(n);return(0,m.setStorageSync)(w,o),{sessionId:t,sampled:r,startTime:n,lastTime:n,isNew:!0}}},{key:"getUUID",value:function(){return(0,d.generateGUID)().replace(/-/g,"")}},{key:"fixSessionConfig",value:function(){var e=0<arguments.length&&void 0!==arguments[0]?arguments[0]:{},t=e.sampleRate,n=e.sampling,r=e.maxDuration,o=e.overtime;return(!(0,d.isNumber)(n)||0>n||100<n)&&(n=(0,d.isNumber)(t)&&0<=t&&1>=t?100*t:100),(!(0,d.isNumber)(r)||r<4*d.ONE_HOUR||r>d.ONE_DAY)&&(r=d.ONE_DAY),(!(0,d.isNumber)(o)||o>d.ONE_HOUR||o<10*d.ONE_MINUTE)&&(o=30*d.ONE_MINUTE),{sampling:n,maxDuration:r,overtime:o}}},{key:"getBaseEvent",value:function(){return{timestamp:(0,g.getCurrentTime)(),session_id:this.getSessionId(),event_id:this.getEventId(),view:this.ctx?(0,h.getCurView)(this.ctx):void 0,times:1}}}])}();t.RumSession=E},function(e,t,n){"use strict";function r(e){return(r="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function o(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function i(e,t){for(var n,r=0;r<t.length;r++)(n=t[r]).enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,a(n.key),n)}function u(e,t,n){return t&&i(e.prototype,t),n&&i(e,n),Object.defineProperty(e,"prototype",{writable:!1}),e}function a(e){var t=c(e,"string");return"symbol"==r(t)?t:t+""}function c(e,t){if("object"!=r(e)||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var o=n.call(e,t||"default");if("object"!=r(o))return o;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}function s(e,t,n){return t=v(t),f(e,p()?Reflect.construct(t,n||[],v(e).constructor):t.apply(e,n))}function f(e,t){if(t&&("object"==r(t)||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return l(e)}function l(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function p(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(e){}return(p=function(){return!!e})()}function v(e){return(v=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function y(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&d(e,t)}function d(e,t){return(d=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e})(e,t)}Object.defineProperty(t,"__esModule",{value:!0}),t.checkEnable=void 0;var g=n(0),h=n(2),m=n(9),b="arms_rum2_local_config";function w(e){var t,n,r,o,i={};i.enable=null===(t=e.enable)||void 0===t||t;var u=e.session;if(u){var a={};a.sampling=null!==(n=u.sampling)&&void 0!==n?n:100,a.storage=null!==(r=u.storage)&&void 0!==r?r:"auto",i.sessionConfig=a}var c=e.report;if(c){var s={};s.flushTime=c.flush_interval,s.maxEventCount=c.max_batch_count,i.reportConfig=s}var f=e.tracing;if(f){var l={enable:null===(o=f.enable)||void 0===o||o},p=[];(f.rules||[]).forEach((function(e){var t={enable:e.enable,tracestate:e.tracestate,baggage:e.baggage,propagatorTypes:e.protocols,sampling:e.sampling};return"{location.origin}"===e.match?void(l=Object.assign({},l,t)):(t.match=(0,g.parseRule2Match)(e),void p.push(t))})),l.allowedUrls=p,i.tracing=l}var v=e.collectors;if(v&&Array.isArray(v)&&0<v.length){var y={};v.forEach((function(e){var t=e.name;if(t){var n=Object.assign({},e),r=e.filters;0<(null==r?void 0:r.length)&&(n.filters=n.filters.map((function(e){return(0,g.parseRule2Match)(e)}))),y[t]=n}})),i.collectors=Object.assign({},i.collectors,y)}return i}var E=function(e){function t(){var e;return o(this,t),(e=s(this,t,arguments)).version="v2",e}return y(t,e),u(t,[{key:"fetchRemoteCfg",value:function(){var e=this.getRemoteConfigUrl();return e?e.includes(".rum.aliyuncs.com")?(this.version="v1",this.getV1Config(e)):this.getV2Config(e):void 0}},{key:"getV1Config",value:function(e){return new Promise((function(t,n){h.sdk.request({url:e,method:"GET",success:function(e){t(e)},fail:function(e){n(e)}})}))}},{key:"getV2Config",value:function(e){var t,n={instanceId:"",agentType:"rum_web_sdk",attributes:(0,g.getUrlParams)(e),instanceConfigs:[{configType:"rum_web_config",version:1}],capabilities:2};return new Promise((function(t,r){h.sdk.request({url:e,method:"POST",data:JSON.stringify(n),header:{"Content-Type":"application/json","x-log-apiversion":"0.6.0"},success:function(e){t(e)},fail:function(e){r(e)}})}))}},{key:"getCacheConfig",value:function(){var e=(0,h.getStorageSync)(b);if(e){var t=this.currentConfig;try{var n=JSON.parse(e);if("pid"in n&&n.pid===t.pid||"endpoint"in n&&n.endpoint)return n.content=this.parseConfig(n.content),n}catch(e){g.logger.warn("configManager","Failed to read cache config",e)}}}},{key:"setCacheConfig",value:function(e){var t=this.currentConfig,n=Object.assign({},e,{pid:t.pid,endpoint:t.endpoint});(0,h.setStorageSync)(b,JSON.stringify(n))}},{key:"getRemoteConfigUrl",value:function(){var e=this.currentConfig,t=e.pid,n=e.remoteConfig,r=e.endpoint,o=n||{},i=o.url,u=o.region;if(i)return i;if(t){var a=t.split("@");return!a||2>a.length?void 0:"https://".concat(a[0],"-sdk.rum.aliyuncs.com/config/").concat(u||"cn-hangzhou","/").concat(a[1],"?t=").concat(Date.now())}var c=(0,m.getURL)(r),s=(0,g.getUrlParams)(r);return"".concat(c.protocol,"://").concat(c.hostname,"/agentconfig?workspace=").concat(s.workspace,"&service=").concat(s.service_id)}},{key:"parseConfig",value:function(e){try{var t,n=(e.data||e).instanceConfigs[0].config;return"v2"===this.version?w(JSON.parse(n)):e}catch(t){return e}}}])}(g.ConfigManager);function S(e,t){var n,r=!(2<arguments.length&&void 0!==arguments[2])||arguments[2],o=e.getConfig();if(!1===o.enable)return!1;var i=null===(n=o.collectors)||void 0===n?void 0:n[t];return(0,g.isBoolean)(i)?i:(0,g.isObject)(i)&&"enable"in i?i.enable:r}t.default=E,t.checkEnable=S}]);
|
|
@@ -3,13 +3,48 @@ export default class ExceptionCollector implements ICollector {
|
|
|
3
3
|
name: string;
|
|
4
4
|
ctx: IContext;
|
|
5
5
|
sendEvent: (payload: RumEvent) => void;
|
|
6
|
+
private recentErrors;
|
|
7
|
+
private timerWrappers;
|
|
6
8
|
setup(ctx: IContext, sendEvent: (payload: RumEvent) => void): void;
|
|
7
9
|
hackOrigin(): void;
|
|
10
|
+
/**
|
|
11
|
+
* 仅在支持 addEventListener 的宿主(H5 window)上注册全局事件,
|
|
12
|
+
* App / 小程序环境安全跳过而非抛错中断后续注册
|
|
13
|
+
*/
|
|
14
|
+
safeAddEventListener(type: string, handler: Function): void;
|
|
15
|
+
/**
|
|
16
|
+
* App 端(plus 存在)补充引擎级异常通道。
|
|
17
|
+
* uni-app App 端的 App.onError 仅由 Vue errorHandler 触发,异步回调(timers、
|
|
18
|
+
* 原生回调等 Vue 管理范围外)中的未捕获异常由引擎异常处理器进入原生
|
|
19
|
+
* reportJSException 后终结,不回流 uni.onError / global error 事件:
|
|
20
|
+
* 1. 劫持 reportJSException(runtime 注入的全局函数):引擎级未捕获异常的收口,
|
|
21
|
+
* 原生按全局名调用时可被截获(机会性通道,取决于 runtime 调用方式),原函数照常执行
|
|
22
|
+
* 2. 包装 setTimeout / setInterval / setImmediate:确定性捕获 timers 回调异常,
|
|
23
|
+
* 上报后原样 rethrow 保持引擎原有行为
|
|
24
|
+
* 3. plus.globalEvent 的 error / unhandledrejection:防御式注册,若端上派发则自动生效
|
|
25
|
+
*/
|
|
26
|
+
hackAppRuntime(): void;
|
|
27
|
+
/**
|
|
28
|
+
* reportJSException 收口处理:参数形态无公开契约(观察为函数名 + 异常文本,
|
|
29
|
+
* 部分实现含 instanceId / errCode),逐参数解析:Error 对象优先,字符串拼接后
|
|
30
|
+
* 经 getErrorByStack 解析;字符串解析失败遵循既定的丢弃策略
|
|
31
|
+
*/
|
|
32
|
+
reportJSExceptionHandler: (...args: any[]) => void;
|
|
33
|
+
/**
|
|
34
|
+
* 包装 timers 全局函数:回调异常确定性捕获(App 端异步异常主场景),
|
|
35
|
+
* 上报后原样 rethrow,保持引擎对异常的原有处理路径
|
|
36
|
+
*/
|
|
37
|
+
wrapTimers(): void;
|
|
38
|
+
/**
|
|
39
|
+
* App 端多通道去重:timers 包装与 reportJSException 收口会对同一异常各触发
|
|
40
|
+
* 一次,窗口内 name+message 相同视为重复;环形清理 + 数量上限防泄漏
|
|
41
|
+
*/
|
|
42
|
+
isDuplicated(name: string, message: string): boolean;
|
|
8
43
|
vueError: (_: any, error: Error) => void;
|
|
9
44
|
uniError: (error: string) => void;
|
|
10
45
|
onError: (error: Error) => void;
|
|
11
46
|
onUnhandledRejection: (e: PromiseRejectionEvent) => void;
|
|
12
|
-
errorHandle: (event: any, source?: string) => void;
|
|
47
|
+
errorHandle: (event: any, source?: string, dedupe?: boolean) => void;
|
|
13
48
|
/**
|
|
14
49
|
* 根据stack获取Error信息
|
|
15
50
|
* TODO: 增加基于Stack解析filename和lineNumber的能力
|
|
@@ -1,10 +1,53 @@
|
|
|
1
|
-
import{interceptFunction,isFunction,isString,logger,restoreFunction,RumEventType}from"@arms/rum-core";import{addEventListener}from"../../utils/mixin";import{sdk}from"../../utils/platform"
|
|
2
|
-
|
|
1
|
+
import{interceptFunction,isFunction,isString,logger,restoreFunction,RumEventType}from"@arms/rum-core";import{addEventListener}from"../../utils/mixin";import{global2,sdk}from"../../utils/platform";// App 端 HTML5+ 运行时注入的全局对象,其余端(H5 / 小程序)不存在
|
|
2
|
+
// App 端多通道去重窗口:同一异常可能先被 timers 包装捕获并 rethrow,
|
|
3
|
+
// 随后又被 reportJSException 收口捕获,5s 内 name+message 相同视为同一事件
|
|
4
|
+
var DEDUPE_WINDOW=5e3,DEDUPE_MAX=50,ExceptionCollector=/*#__PURE__*/function(){function a(){var a=this;this.name="exception-collector",this.ctx=void 0,this.sendEvent=void 0,this.recentErrors=[],this.timerWrappers=[],this.reportJSExceptionHandler=function(){for(var b,c,d=[],e=0;e<arguments.length;e++)c=0>e||arguments.length<=e?void 0:arguments[e],c instanceof Error?!b&&(b=c):c&&c.message?!b&&(b=c):isString(c)&&c&&d.push(c);return b?void a.errorHandle(b,"reportJSException",!0):void(!d.length||a.errorHandle(d.join("\n"),"reportJSException",!0))},this.vueError=function(b,c){a.errorHandle(c,"Vue.onError")},this.uniError=function(b){a.errorHandle(b,"uni.onError")},this.onError=function(b){a.errorHandle(b,"onError")},this.onUnhandledRejection=function(b){if(b){var c=b.reason;if(c){var d=c.errMsg;// 对 Uniapp 内置错误进行解析
|
|
5
|
+
if(d&&isString(d)){c=new Error(d),c.name="",c.stack="";for(var e,f=["navigateTo","redirectTo","appLaunch","switchTab","getLocation","onLocationChange"],g=0,h=f;g<h.length;g++)if(e=h[g],d.startsWith(e)){c.name=e;break}c.name||(c.name=d.split(":")[0])}a.errorHandle(c,"onUnhandledRejection")}}},this.errorHandle=function(b,c,d){void 0===c&&(c=""),void 0===d&&(d=!1);var e,f,g,h,i,j;if(b instanceof Object){if(e=b.name,f=b.message,g=b.filename||b.fileName,h=b.stack,i=b.lineno||b.lineNumber,j=b.colno||b.columnNumber,b.error instanceof Error){var k=b.error;e=k.name,f=k.message,h=k.stack}// 兜底:wx.onError 回调入参为 { message, stack } 对象(无 name 字段),
|
|
6
|
+
// 尝试从堆栈反解,仍失败则用 'Error' 兜底,避免异常被静默丢弃
|
|
7
|
+
if(!e&&isString(f)){var l=a.getErrorByStack(h||f);l&&l.name&&l.message&&(e=l.name,f=l.message),e=e||"Error",h=h||f}}else if("string"==typeof b){h=b;var m=a.getErrorByStack(b);m&&(e=m.name,f=m.message)}!e||!f||d&&a.isDuplicated(e,f)||a.sendEvent({event_type:RumEventType.EXCEPTION,source:c,type:"error",name:e,message:f,file:g,stack:h,line:i,column:j,times:1})}}var b=a.prototype;return b.setup=function(a,b){this.ctx=a,this.sendEvent=b,this.hackOrigin()},b.hackOrigin=function(){var a=this,b=this.ctx.getConfig(),c=b.collectors,d=void 0===c?{}:c;if(!1!==d.jsError){// 各注册点独立防护:原先共用一个 try 块,App 端(Weex JS 引擎)global 无
|
|
8
|
+
// addEventListener 抛 TypeError,导致 unhandledrejection 与 uni.onError
|
|
9
|
+
// 注册被整体跳过(Vue 同步异常经 mixin 通道不受影响,与其余通道全静默的现象一致)
|
|
10
|
+
try{addEventListener("onError",this.vueError)}catch(a){logger.warn("exception-collector","add vue onError listener failed",a)}if(this.safeAddEventListener("error",this.onError),this.safeAddEventListener("unhandledrejection",this.onUnhandledRejection),isFunction(sdk.onError))try{sdk.onError(this.uniError)}catch(a){logger.warn("exception-collector","uni.onError register failed",a)}// 无 window 级 unhandledrejection 的端(小程序等)退回 uni API 通道;
|
|
11
|
+
// H5 端已有 window 事件,跳过避免双通道重复上报
|
|
12
|
+
if(!isFunction(global2.addEventListener)&&isFunction(sdk.onUnhandledRejection))try{sdk.onUnhandledRejection(this.onUnhandledRejection)}catch(a){logger.warn("exception-collector","uni.onUnhandledRejection register failed",a)}this.hackAppRuntime()}!1!==d.consoleError&&interceptFunction(console,"error",function(b){a.errorHandle(b,"console.error")})}/**
|
|
13
|
+
* 仅在支持 addEventListener 的宿主(H5 window)上注册全局事件,
|
|
14
|
+
* App / 小程序环境安全跳过而非抛错中断后续注册
|
|
15
|
+
*/,b.safeAddEventListener=function(a,b){try{isFunction(global2.addEventListener)&&global2.addEventListener(a,b)}catch(b){logger.warn("exception-collector","add "+a+" listener failed",b)}}/**
|
|
16
|
+
* App 端(plus 存在)补充引擎级异常通道。
|
|
17
|
+
* uni-app App 端的 App.onError 仅由 Vue errorHandler 触发,异步回调(timers、
|
|
18
|
+
* 原生回调等 Vue 管理范围外)中的未捕获异常由引擎异常处理器进入原生
|
|
19
|
+
* reportJSException 后终结,不回流 uni.onError / global error 事件:
|
|
20
|
+
* 1. 劫持 reportJSException(runtime 注入的全局函数):引擎级未捕获异常的收口,
|
|
21
|
+
* 原生按全局名调用时可被截获(机会性通道,取决于 runtime 调用方式),原函数照常执行
|
|
22
|
+
* 2. 包装 setTimeout / setInterval / setImmediate:确定性捕获 timers 回调异常,
|
|
23
|
+
* 上报后原样 rethrow 保持引擎原有行为
|
|
24
|
+
* 3. plus.globalEvent 的 error / unhandledrejection:防御式注册,若端上派发则自动生效
|
|
25
|
+
*/,b.hackAppRuntime=function(){var a,b=this;try{// 无 plus(H5 / 小程序)时整体跳过,App 专属通道不注入
|
|
26
|
+
if("undefined"==typeof plus||!plus)return;plus.globalEvent&&(a=plus.globalEvent)}catch(a){return}if(interceptFunction(global2,"reportJSException",this.reportJSExceptionHandler),this.wrapTimers(),a&&isFunction(a.addEventListener))try{a.addEventListener("error",function(a){try{b.errorHandle(a,"plus.globalEvent",!0)}catch(a){logger.warn("exception-collector","plus.globalEvent error failed",a)}}),a.addEventListener("unhandledrejection",function(a){if(a&&a.reason)try{b.errorHandle(a.reason,"plus.globalEvent",!0)}catch(a){logger.warn("exception-collector","plus.globalEvent unhandledrejection failed",a)}})}catch(a){logger.warn("exception-collector","plus.globalEvent register failed",a)}}/**
|
|
27
|
+
* reportJSException 收口处理:参数形态无公开契约(观察为函数名 + 异常文本,
|
|
28
|
+
* 部分实现含 instanceId / errCode),逐参数解析:Error 对象优先,字符串拼接后
|
|
29
|
+
* 经 getErrorByStack 解析;字符串解析失败遵循既定的丢弃策略
|
|
30
|
+
*/,b.wrapTimers=/**
|
|
31
|
+
* 包装 timers 全局函数:回调异常确定性捕获(App 端异步异常主场景),
|
|
32
|
+
* 上报后原样 rethrow,保持引擎对异常的原有处理路径
|
|
33
|
+
*/function(){for(var a,b=this,c=this,d=["setTimeout","setInterval","setImmediate"],e=function a(){var e,g=d[f];try{e=global2[g]}catch(a){return 0;// continue
|
|
34
|
+
}if(!isFunction(e)||e.__armsTimerWrapped)return 0;// continue
|
|
35
|
+
var h=function a(){for(var b=arguments.length,d=Array(b),f=0;f<b;f++)d[f]=arguments[f];var h=d[0];if(!isFunction(h))return e.apply(this,d);var i=function a(){try{return h.apply(this,arguments)}catch(a){try{c.errorHandle(a,g,!0)}catch(a){logger.warn("exception-collector","report timer error failed",a)}throw a}};return i.__armsOriginalCallback=h,d[0]=i,e.apply(this,d)};try{Object.defineProperty(h,"name",{value:g,configurable:!0})}catch(a){// 部分引擎 name 不可写,不影响包装
|
|
36
|
+
}h.toString=function(){return e.toString()},h.__armsTimerWrapped=!0;try{global2[g]=h,b.timerWrappers.push({name:g,original:e})}catch(a){logger.warn("exception-collector","wrap "+g+" failed",a)}},f=0;f<d.length;f++)a=e(),0===a}/**
|
|
37
|
+
* App 端多通道去重:timers 包装与 reportJSException 收口会对同一异常各触发
|
|
38
|
+
* 一次,窗口内 name+message 相同视为重复;环形清理 + 数量上限防泄漏
|
|
39
|
+
*/,b.isDuplicated=function c(a,b){for(var d=Date.now(),e=this.recentErrors;e.length&&d-e[0].time>DEDUPE_WINDOW;)e.shift();for(var f=a+"|"+b,g=0;g<e.length;g++)if(e[g].key===f)return!0;return e.push({key:f,time:d}),e.length>DEDUPE_MAX&&e.shift(),!1},b.getErrorByStack=/**
|
|
3
40
|
* 根据stack获取Error信息
|
|
4
41
|
* TODO: 增加基于Stack解析filename和lineNumber的能力
|
|
5
42
|
* @param stack
|
|
6
43
|
* @returns
|
|
7
|
-
*/function(a){void 0===a&&(a="");var
|
|
8
|
-
//
|
|
9
|
-
|
|
10
|
-
|
|
44
|
+
*/function b(a){void 0===a&&(a="");var c=a.split("\n");if(!(2>c.length)){// 优先直接扫描 'Name: message' 错误头部行,不依赖其与首帧的位置关系
|
|
45
|
+
// (V8 位于首行、微信 iOS/JSC 位于第三行,一次实现覆盖双端);类名前缀可选,兼容纯 'Error: msg'
|
|
46
|
+
for(var d,e=function b(a){var c=a.trim();return c.startsWith("at ")||/@.+:\d+:\d+/.test(c)||/@(\[native code\])?$/.test(c)},f=/^\s*([\w$]*(?:Error|Exception))\s*:\s*(.+)$/,g=0;g<c.length;g++)if(d=f.exec(c[g]),d)return{name:d[1],message:d[2]};// 后备:按 '首帧上一行即头部行' 的位置关系解析(覆盖自定义错误名等非 Error/Exception 后缀场景)
|
|
47
|
+
for(var h=1;h<c.length;h++)if(e(c[h])){var j=c[h-1];// 上一行也是堆栈帧(如 Safari 扩展的纯帧堆栈),说明无头部行,交由上层兜底
|
|
48
|
+
if(e(j))return;var k=j.indexOf(": ");return-1===k?{name:"",message:j}:{name:j.substring(0,k),message:j.substring(k+2)}}}// 兼容多引擎堆栈帧格式(参考 Sentry chrome/gecko StackLineParser):
|
|
49
|
+
// 1. V8/Chrome:'at fn (url:line:col)' / 'at url:line:col'
|
|
50
|
+
// 2. JavaScriptCore/Gecko(App 端/iOS):'fn@url:line:col' / '@url:line:col'
|
|
51
|
+
// 3. 无行列号帧:'forEach@[native code]' / '_onNativeTimer@'
|
|
52
|
+
},b.destroy=function a(){restoreFunction(console,"error"),restoreFunction(global2,"reportJSException");for(var b=0;b<this.timerWrappers.length;b++){var c=this.timerWrappers[b],d=c.name,e=c.original;try{global2[d]&&global2[d].__armsTimerWrapped&&(global2[d]=e)}catch(a){// 还原失败静默忽略
|
|
53
|
+
}}this.timerWrappers=[],this.recentErrors=[]},a}();export{ExceptionCollector as default};
|
|
@@ -26,7 +26,9 @@ var r=!1;q.includes("sw8")&&(q=["sw8"],r=!0);var s=r?generateGUID():generateTrac
|
|
|
26
26
|
if(isEndpoint(this.ctx,c)||urlMatch(c))return a;// const newOptions = {
|
|
27
27
|
// ...options,
|
|
28
28
|
// };
|
|
29
|
-
var i={view:getCurView(this.ctx),timestamp:h,url:c,name:this.getResourceName(c),method:a.method||"GET"};return this.injectTracing(i,function(b){a.header=_extends({},g,b)}),a.success=function(){i.success=1;for(var a=arguments.length,b=Array(a),c=0;c<a;c++)b[c]=arguments[c];d&&d.apply(this,b)},a.fail=function(){i.success=0;for(var a=arguments.length,b=Array(a),c=0;c<a;c++)b[c]=arguments[c];e&&e.apply(this,b)},a.complete=function(){for(var c=arguments.length,d=Array(c),e=0;e<c;e++)d[e]=arguments[e];var g=_extends({},d[0]);try{
|
|
29
|
+
var i={view:getCurView(this.ctx),timestamp:h,url:c,name:this.getResourceName(c),method:a.method||"GET"};return this.injectTracing(i,function(b){a.header=_extends({},g,b)}),a.success=function(){i.success=1;for(var a=arguments.length,b=Array(a),c=0;c<a;c++)b[c]=arguments[c];d&&d.apply(this,b)},a.fail=function(){i.success=0;for(var a=arguments.length,b=Array(a),c=0;c<a;c++)b[c]=arguments[c];e&&e.apply(this,b)},a.complete=function(){for(var c=arguments.length,d=Array(c),e=0;e<c;e++)d[e]=arguments[e];var g=_extends({},d[0]);try{// 对齐 Browser 端 getResourceSuccessByCode:有 HTTP 状态码时按 [200, 300) 判定,
|
|
30
|
+
// 无状态码时保留原网络回调结果(success=1/fail=0)作为兜底
|
|
31
|
+
var h=g.statusCode;if(h){var j=+h;i.success=200<=j&&300>j?1:0}i.size=getStringSize(JSON.stringify(g)),b.sendApi(i,g,a)}catch(a){logger.error("api-collector","process response failed",a)}f&&f.apply(this,d)},a},b.getResourceName=function(a){var b,c=this.ctx.getConfig(),d=c.parseResourceName;return b=isFunction(d)?d(a):getPathByURL(a),b}// /**
|
|
30
32
|
// * 解析小程序的性能数据
|
|
31
33
|
// * 参考:https://developers.weixin.qq.com/miniprogram/dev/api/network/request/wx.request.html
|
|
32
34
|
// * https://opendocs.alipay.com/mini/api/owycmh?pathHash=c91640f8
|
package/es/reporter/index.js
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import _inheritsLoose from"@babel/runtime/helpers/inheritsLoose";import{isFunction,logger,Reporter}from"@arms/rum-core";import{sdk,fixAttrs}from"../utils/platform";/**
|
|
2
2
|
* uni-app reporter
|
|
3
|
-
*/var UniReporter=/*#__PURE__*/function(a){function b(){for(var b,c=arguments.length,d=Array(c),e=0;e<c;e++)d[e]=arguments[e];return b=a.call.apply(a,[this].concat(d))||this,b.name="uni-reporter",b}_inheritsLoose(b,a);var c=b.prototype;return c.init=function(){var a=this;isFunction(sdk.onAppHide)&&sdk.onAppHide(function(){a.flushEventQueue()})},c.request=function(a,b){var c=a.getConfig();fixAttrs(b).then(function(a){sdk.request({url:c.endpoint,method:"POST",header:{"Content-Type":"text/plain"},dataType:"text",data:JSON.stringify(a)})})["catch"](function(a){logger.
|
|
3
|
+
*/var UniReporter=/*#__PURE__*/function(a){function b(){for(var b,c=arguments.length,d=Array(c),e=0;e<c;e++)d[e]=arguments[e];return b=a.call.apply(a,[this].concat(d))||this,b.name="uni-reporter",b}_inheritsLoose(b,a);var c=b.prototype;return c.init=function(){var a=this;isFunction(sdk.onAppHide)&&sdk.onAppHide(function(){a.flushEventQueue()})},c.request=function(a,b){var c=a.getConfig();fixAttrs(b).then(function(a){sdk.request({url:c.endpoint,method:"POST",header:{"Content-Type":"text/plain"},dataType:"text",data:JSON.stringify(a)})})["catch"](function(a){logger.warn("uni-reporter","request failed",a)})},b}(Reporter);export default UniReporter;
|
package/es/utils/api.d.ts
CHANGED
package/es/utils/api.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{isNumber,isObject,isString}from"@arms/rum-core";export function reviseApiAttr(a){if(a&&isObject(a)){var b={};return isString(a.name)&&(b.name=a.name.substring(0,1e3)),isString(a.message)&&(b.message=a.message.substring(0,1e3)),
|
|
1
|
+
import{isNumber,isObject,isString}from"@arms/rum-core";export function reviseApiAttr(a){if(a&&isObject(a)){var b={};return isString(a.name)&&(b.name=a.name.substring(0,1e3)),isString(a.message)&&(b.message=a.message.substring(0,1e3)),isNumber(a.success)&&-1<=a.success&&1>=a.success&&(b.success=a.success),isNumber(a.duration)&&0<=a.duration&&(b.duration=a.duration),isString(a.status_code)&&(b.status_code=a.status_code.substring(0,100)),isNumber(a.status_code)&&(b.status_code=a.status_code),isString(a.snapshots)&&(b.snapshots=a.snapshots.substring(0,5e3)),b}}
|
package/es/utils/platform.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { RumEventBundle } from
|
|
1
|
+
import { RumEventBundle } from '@arms/rum-core';
|
|
2
2
|
export declare const global2: any;
|
|
3
3
|
export declare const VERSION: string;
|
|
4
4
|
interface CommonOption {
|
|
@@ -14,7 +14,9 @@ interface SDK {
|
|
|
14
14
|
setStorageSync: (key: any, data?: string) => void;
|
|
15
15
|
onError: (listener: Function) => void;
|
|
16
16
|
onPageNotFound: (listener: Function) => void;
|
|
17
|
-
|
|
17
|
+
onUnhandledRejection?: (listener: Function) => void;
|
|
18
|
+
offError?: (listener: Function) => void;
|
|
19
|
+
offUnhandledRejection?: (listener: Function) => void;
|
|
18
20
|
navigateTo: (options: any) => void;
|
|
19
21
|
redirectTo: (options: any) => void;
|
|
20
22
|
switchTab: (options: any) => void;
|
package/es/utils/platform.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import _extends from"@babel/runtime/helpers/extends";import _asyncToGenerator from"@babel/runtime/helpers/asyncToGenerator";import _regeneratorRuntime from"@babel/runtime/regenerator";import{AppType}from"@arms/rum-core";export var global2=global||window;export var VERSION='npm-0.1.
|
|
1
|
+
import _extends from"@babel/runtime/helpers/extends";import _asyncToGenerator from"@babel/runtime/helpers/asyncToGenerator";import _regeneratorRuntime from"@babel/runtime/regenerator";import{AppType}from"@arms/rum-core";export var global2=global||window;export var VERSION='npm-0.1.5';export var sdk=uni;export var appName="uniapp";// export {
|
|
2
2
|
// // sdk: global.uni,
|
|
3
3
|
// appName: 'uniapp',
|
|
4
4
|
// }
|
|
@@ -3,13 +3,48 @@ export default class ExceptionCollector implements ICollector {
|
|
|
3
3
|
name: string;
|
|
4
4
|
ctx: IContext;
|
|
5
5
|
sendEvent: (payload: RumEvent) => void;
|
|
6
|
+
private recentErrors;
|
|
7
|
+
private timerWrappers;
|
|
6
8
|
setup(ctx: IContext, sendEvent: (payload: RumEvent) => void): void;
|
|
7
9
|
hackOrigin(): void;
|
|
10
|
+
/**
|
|
11
|
+
* 仅在支持 addEventListener 的宿主(H5 window)上注册全局事件,
|
|
12
|
+
* App / 小程序环境安全跳过而非抛错中断后续注册
|
|
13
|
+
*/
|
|
14
|
+
safeAddEventListener(type: string, handler: Function): void;
|
|
15
|
+
/**
|
|
16
|
+
* App 端(plus 存在)补充引擎级异常通道。
|
|
17
|
+
* uni-app App 端的 App.onError 仅由 Vue errorHandler 触发,异步回调(timers、
|
|
18
|
+
* 原生回调等 Vue 管理范围外)中的未捕获异常由引擎异常处理器进入原生
|
|
19
|
+
* reportJSException 后终结,不回流 uni.onError / global error 事件:
|
|
20
|
+
* 1. 劫持 reportJSException(runtime 注入的全局函数):引擎级未捕获异常的收口,
|
|
21
|
+
* 原生按全局名调用时可被截获(机会性通道,取决于 runtime 调用方式),原函数照常执行
|
|
22
|
+
* 2. 包装 setTimeout / setInterval / setImmediate:确定性捕获 timers 回调异常,
|
|
23
|
+
* 上报后原样 rethrow 保持引擎原有行为
|
|
24
|
+
* 3. plus.globalEvent 的 error / unhandledrejection:防御式注册,若端上派发则自动生效
|
|
25
|
+
*/
|
|
26
|
+
hackAppRuntime(): void;
|
|
27
|
+
/**
|
|
28
|
+
* reportJSException 收口处理:参数形态无公开契约(观察为函数名 + 异常文本,
|
|
29
|
+
* 部分实现含 instanceId / errCode),逐参数解析:Error 对象优先,字符串拼接后
|
|
30
|
+
* 经 getErrorByStack 解析;字符串解析失败遵循既定的丢弃策略
|
|
31
|
+
*/
|
|
32
|
+
reportJSExceptionHandler: (...args: any[]) => void;
|
|
33
|
+
/**
|
|
34
|
+
* 包装 timers 全局函数:回调异常确定性捕获(App 端异步异常主场景),
|
|
35
|
+
* 上报后原样 rethrow,保持引擎对异常的原有处理路径
|
|
36
|
+
*/
|
|
37
|
+
wrapTimers(): void;
|
|
38
|
+
/**
|
|
39
|
+
* App 端多通道去重:timers 包装与 reportJSException 收口会对同一异常各触发
|
|
40
|
+
* 一次,窗口内 name+message 相同视为重复;环形清理 + 数量上限防泄漏
|
|
41
|
+
*/
|
|
42
|
+
isDuplicated(name: string, message: string): boolean;
|
|
8
43
|
vueError: (_: any, error: Error) => void;
|
|
9
44
|
uniError: (error: string) => void;
|
|
10
45
|
onError: (error: Error) => void;
|
|
11
46
|
onUnhandledRejection: (e: PromiseRejectionEvent) => void;
|
|
12
|
-
errorHandle: (event: any, source?: string) => void;
|
|
47
|
+
errorHandle: (event: any, source?: string, dedupe?: boolean) => void;
|
|
13
48
|
/**
|
|
14
49
|
* 根据stack获取Error信息
|
|
15
50
|
* TODO: 增加基于Stack解析filename和lineNumber的能力
|
|
@@ -1,10 +1,52 @@
|
|
|
1
|
-
"use strict";exports.__esModule=!0,exports["default"]=void 0;var _rumCore=require("@arms/rum-core"),_mixin=require("../../utils/mixin"),_platform=require("../../utils/platform"),ExceptionCollector=exports["default"]=/*#__PURE__*/function(){function a(){var a=this;this.name="exception-collector",this.ctx=void 0,this.sendEvent=void 0,this.vueError=function(b,c){a.errorHandle(c,"Vue.onError")},this.uniError=function(b){a.errorHandle(b,"uni.onError")},this.onError=function(b){a.errorHandle(b,"onError")},this.onUnhandledRejection=function(b){if(b){var c=b.reason;if(c){var d=c.errMsg;// 对 Uniapp 内置错误进行解析
|
|
2
|
-
if(d&&(0,_rumCore.isString)(d)){c=new Error(d),c.name="",c.stack="";for(var e,f=["navigateTo","redirectTo","appLaunch","switchTab","getLocation","onLocationChange"],g=0,h=f;g<h.length;g++)if(e=h[g],d.startsWith(e)){c.name=e;break}c.name||(c.name=d.split(":")[0])}a.errorHandle(c,"onUnhandledRejection")}}},this.errorHandle=function(b,c){void 0===c&&(c="");var
|
|
1
|
+
"use strict";exports.__esModule=!0,exports["default"]=void 0;var _rumCore=require("@arms/rum-core"),_mixin=require("../../utils/mixin"),_platform=require("../../utils/platform"),DEDUPE_WINDOW=5e3,DEDUPE_MAX=50,ExceptionCollector=exports["default"]=/*#__PURE__*/function(){function a(){var a=this;this.name="exception-collector",this.ctx=void 0,this.sendEvent=void 0,this.recentErrors=[],this.timerWrappers=[],this.reportJSExceptionHandler=function(){for(var b,c,d=[],e=0;e<arguments.length;e++)c=0>e||arguments.length<=e?void 0:arguments[e],c instanceof Error?!b&&(b=c):c&&c.message?!b&&(b=c):(0,_rumCore.isString)(c)&&c&&d.push(c);return b?void a.errorHandle(b,"reportJSException",!0):void(!d.length||a.errorHandle(d.join("\n"),"reportJSException",!0))},this.vueError=function(b,c){a.errorHandle(c,"Vue.onError")},this.uniError=function(b){a.errorHandle(b,"uni.onError")},this.onError=function(b){a.errorHandle(b,"onError")},this.onUnhandledRejection=function(b){if(b){var c=b.reason;if(c){var d=c.errMsg;// 对 Uniapp 内置错误进行解析
|
|
2
|
+
if(d&&(0,_rumCore.isString)(d)){c=new Error(d),c.name="",c.stack="";for(var e,f=["navigateTo","redirectTo","appLaunch","switchTab","getLocation","onLocationChange"],g=0,h=f;g<h.length;g++)if(e=h[g],d.startsWith(e)){c.name=e;break}c.name||(c.name=d.split(":")[0])}a.errorHandle(c,"onUnhandledRejection")}}},this.errorHandle=function(b,c,d){void 0===c&&(c=""),void 0===d&&(d=!1);var e,f,g,h,i,j;if(b instanceof Object){if(e=b.name,f=b.message,g=b.filename||b.fileName,h=b.stack,i=b.lineno||b.lineNumber,j=b.colno||b.columnNumber,b.error instanceof Error){var k=b.error;e=k.name,f=k.message,h=k.stack}// 兜底:wx.onError 回调入参为 { message, stack } 对象(无 name 字段),
|
|
3
|
+
// 尝试从堆栈反解,仍失败则用 'Error' 兜底,避免异常被静默丢弃
|
|
4
|
+
if(!e&&(0,_rumCore.isString)(f)){var l=a.getErrorByStack(h||f);l&&l.name&&l.message&&(e=l.name,f=l.message),e=e||"Error",h=h||f}}else if("string"==typeof b){h=b;var m=a.getErrorByStack(b);m&&(e=m.name,f=m.message)}!e||!f||d&&a.isDuplicated(e,f)||a.sendEvent({event_type:_rumCore.RumEventType.EXCEPTION,source:c,type:"error",name:e,message:f,file:g,stack:h,line:i,column:j,times:1})}}var b=a.prototype;return b.setup=function(a,b){this.ctx=a,this.sendEvent=b,this.hackOrigin()},b.hackOrigin=function(){var a=this,b=this.ctx.getConfig(),c=b.collectors,d=void 0===c?{}:c;if(!1!==d.jsError){// 各注册点独立防护:原先共用一个 try 块,App 端(Weex JS 引擎)global 无
|
|
5
|
+
// addEventListener 抛 TypeError,导致 unhandledrejection 与 uni.onError
|
|
6
|
+
// 注册被整体跳过(Vue 同步异常经 mixin 通道不受影响,与其余通道全静默的现象一致)
|
|
7
|
+
try{(0,_mixin.addEventListener)("onError",this.vueError)}catch(a){_rumCore.logger.warn("exception-collector","add vue onError listener failed",a)}if(this.safeAddEventListener("error",this.onError),this.safeAddEventListener("unhandledrejection",this.onUnhandledRejection),(0,_rumCore.isFunction)(_platform.sdk.onError))try{_platform.sdk.onError(this.uniError)}catch(a){_rumCore.logger.warn("exception-collector","uni.onError register failed",a)}// 无 window 级 unhandledrejection 的端(小程序等)退回 uni API 通道;
|
|
8
|
+
// H5 端已有 window 事件,跳过避免双通道重复上报
|
|
9
|
+
if(!(0,_rumCore.isFunction)(_platform.global2.addEventListener)&&(0,_rumCore.isFunction)(_platform.sdk.onUnhandledRejection))try{_platform.sdk.onUnhandledRejection(this.onUnhandledRejection)}catch(a){_rumCore.logger.warn("exception-collector","uni.onUnhandledRejection register failed",a)}this.hackAppRuntime()}!1!==d.consoleError&&(0,_rumCore.interceptFunction)(console,"error",function(b){a.errorHandle(b,"console.error")})}/**
|
|
10
|
+
* 仅在支持 addEventListener 的宿主(H5 window)上注册全局事件,
|
|
11
|
+
* App / 小程序环境安全跳过而非抛错中断后续注册
|
|
12
|
+
*/,b.safeAddEventListener=function(a,b){try{(0,_rumCore.isFunction)(_platform.global2.addEventListener)&&_platform.global2.addEventListener(a,b)}catch(b){_rumCore.logger.warn("exception-collector","add "+a+" listener failed",b)}}/**
|
|
13
|
+
* App 端(plus 存在)补充引擎级异常通道。
|
|
14
|
+
* uni-app App 端的 App.onError 仅由 Vue errorHandler 触发,异步回调(timers、
|
|
15
|
+
* 原生回调等 Vue 管理范围外)中的未捕获异常由引擎异常处理器进入原生
|
|
16
|
+
* reportJSException 后终结,不回流 uni.onError / global error 事件:
|
|
17
|
+
* 1. 劫持 reportJSException(runtime 注入的全局函数):引擎级未捕获异常的收口,
|
|
18
|
+
* 原生按全局名调用时可被截获(机会性通道,取决于 runtime 调用方式),原函数照常执行
|
|
19
|
+
* 2. 包装 setTimeout / setInterval / setImmediate:确定性捕获 timers 回调异常,
|
|
20
|
+
* 上报后原样 rethrow 保持引擎原有行为
|
|
21
|
+
* 3. plus.globalEvent 的 error / unhandledrejection:防御式注册,若端上派发则自动生效
|
|
22
|
+
*/,b.hackAppRuntime=function(){var a,b=this;try{// 无 plus(H5 / 小程序)时整体跳过,App 专属通道不注入
|
|
23
|
+
if("undefined"==typeof plus||!plus)return;plus.globalEvent&&(a=plus.globalEvent)}catch(a){return}if((0,_rumCore.interceptFunction)(_platform.global2,"reportJSException",this.reportJSExceptionHandler),this.wrapTimers(),a&&(0,_rumCore.isFunction)(a.addEventListener))try{a.addEventListener("error",function(a){try{b.errorHandle(a,"plus.globalEvent",!0)}catch(a){_rumCore.logger.warn("exception-collector","plus.globalEvent error failed",a)}}),a.addEventListener("unhandledrejection",function(a){if(a&&a.reason)try{b.errorHandle(a.reason,"plus.globalEvent",!0)}catch(a){_rumCore.logger.warn("exception-collector","plus.globalEvent unhandledrejection failed",a)}})}catch(a){_rumCore.logger.warn("exception-collector","plus.globalEvent register failed",a)}}/**
|
|
24
|
+
* reportJSException 收口处理:参数形态无公开契约(观察为函数名 + 异常文本,
|
|
25
|
+
* 部分实现含 instanceId / errCode),逐参数解析:Error 对象优先,字符串拼接后
|
|
26
|
+
* 经 getErrorByStack 解析;字符串解析失败遵循既定的丢弃策略
|
|
27
|
+
*/,b.wrapTimers=/**
|
|
28
|
+
* 包装 timers 全局函数:回调异常确定性捕获(App 端异步异常主场景),
|
|
29
|
+
* 上报后原样 rethrow,保持引擎对异常的原有处理路径
|
|
30
|
+
*/function(){for(var a,b=this,c=this,d=["setTimeout","setInterval","setImmediate"],e=function a(){var e,g=d[f];try{e=_platform.global2[g]}catch(a){return 0;// continue
|
|
31
|
+
}if(!(0,_rumCore.isFunction)(e)||e.__armsTimerWrapped)return 0;// continue
|
|
32
|
+
var h=function a(){for(var b=arguments.length,d=Array(b),f=0;f<b;f++)d[f]=arguments[f];var h=d[0];if(!(0,_rumCore.isFunction)(h))return e.apply(this,d);var i=function a(){try{return h.apply(this,arguments)}catch(a){try{c.errorHandle(a,g,!0)}catch(a){_rumCore.logger.warn("exception-collector","report timer error failed",a)}throw a}};return i.__armsOriginalCallback=h,d[0]=i,e.apply(this,d)};try{Object.defineProperty(h,"name",{value:g,configurable:!0})}catch(a){// 部分引擎 name 不可写,不影响包装
|
|
33
|
+
}h.toString=function(){return e.toString()},h.__armsTimerWrapped=!0;try{_platform.global2[g]=h,b.timerWrappers.push({name:g,original:e})}catch(a){_rumCore.logger.warn("exception-collector","wrap "+g+" failed",a)}},f=0;f<d.length;f++)a=e(),0===a}/**
|
|
34
|
+
* App 端多通道去重:timers 包装与 reportJSException 收口会对同一异常各触发
|
|
35
|
+
* 一次,窗口内 name+message 相同视为重复;环形清理 + 数量上限防泄漏
|
|
36
|
+
*/,b.isDuplicated=function c(a,b){for(var d=Date.now(),e=this.recentErrors;e.length&&d-e[0].time>DEDUPE_WINDOW;)e.shift();for(var f=a+"|"+b,g=0;g<e.length;g++)if(e[g].key===f)return!0;return e.push({key:f,time:d}),e.length>DEDUPE_MAX&&e.shift(),!1},b.getErrorByStack=/**
|
|
3
37
|
* 根据stack获取Error信息
|
|
4
38
|
* TODO: 增加基于Stack解析filename和lineNumber的能力
|
|
5
39
|
* @param stack
|
|
6
40
|
* @returns
|
|
7
|
-
*/function(a){void 0===a&&(a="");var
|
|
8
|
-
//
|
|
9
|
-
|
|
10
|
-
|
|
41
|
+
*/function b(a){void 0===a&&(a="");var c=a.split("\n");if(!(2>c.length)){// 优先直接扫描 'Name: message' 错误头部行,不依赖其与首帧的位置关系
|
|
42
|
+
// (V8 位于首行、微信 iOS/JSC 位于第三行,一次实现覆盖双端);类名前缀可选,兼容纯 'Error: msg'
|
|
43
|
+
for(var d,e=function b(a){var c=a.trim();return c.startsWith("at ")||/@.+:\d+:\d+/.test(c)||/@(\[native code\])?$/.test(c)},f=/^\s*([\w$]*(?:Error|Exception))\s*:\s*(.+)$/,g=0;g<c.length;g++)if(d=f.exec(c[g]),d)return{name:d[1],message:d[2]};// 后备:按 '首帧上一行即头部行' 的位置关系解析(覆盖自定义错误名等非 Error/Exception 后缀场景)
|
|
44
|
+
for(var h=1;h<c.length;h++)if(e(c[h])){var j=c[h-1];// 上一行也是堆栈帧(如 Safari 扩展的纯帧堆栈),说明无头部行,交由上层兜底
|
|
45
|
+
if(e(j))return;var k=j.indexOf(": ");return-1===k?{name:"",message:j}:{name:j.substring(0,k),message:j.substring(k+2)}}}// 兼容多引擎堆栈帧格式(参考 Sentry chrome/gecko StackLineParser):
|
|
46
|
+
// 1. V8/Chrome:'at fn (url:line:col)' / 'at url:line:col'
|
|
47
|
+
// 2. JavaScriptCore/Gecko(App 端/iOS):'fn@url:line:col' / '@url:line:col'
|
|
48
|
+
// 3. 无行列号帧:'forEach@[native code]' / '_onNativeTimer@'
|
|
49
|
+
},b.destroy=function a(){(0,_rumCore.restoreFunction)(console,"error"),(0,_rumCore.restoreFunction)(_platform.global2,"reportJSException");for(var b=0;b<this.timerWrappers.length;b++){var c=this.timerWrappers[b],d=c.name,e=c.original;try{_platform.global2[d]&&_platform.global2[d].__armsTimerWrapped&&(_platform.global2[d]=e)}catch(a){// 还原失败静默忽略
|
|
50
|
+
}}this.timerWrappers=[],this.recentErrors=[]},a}();// App 端 HTML5+ 运行时注入的全局对象,其余端(H5 / 小程序)不存在
|
|
51
|
+
// App 端多通道去重窗口:同一异常可能先被 timers 包装捕获并 rethrow,
|
|
52
|
+
// 随后又被 reportJSException 收口捕获,5s 内 name+message 相同视为同一事件
|
|
@@ -26,7 +26,9 @@ var r=!1;q.includes("sw8")&&(q=["sw8"],r=!0);var s=r?(0,_rumCore.generateGUID)()
|
|
|
26
26
|
if((0,_url.isEndpoint)(this.ctx,c)||(0,_rumCore.urlMatch)(c))return a;// const newOptions = {
|
|
27
27
|
// ...options,
|
|
28
28
|
// };
|
|
29
|
-
var i={view:(0,_view.getCurView)(this.ctx),timestamp:h,url:c,name:this.getResourceName(c),method:a.method||"GET"};return this.injectTracing(i,function(b){a.header=(0,_extends2["default"])({},g,b)}),a.success=function(){i.success=1;for(var a=arguments.length,b=Array(a),c=0;c<a;c++)b[c]=arguments[c];d&&d.apply(this,b)},a.fail=function(){i.success=0;for(var a=arguments.length,b=Array(a),c=0;c<a;c++)b[c]=arguments[c];e&&e.apply(this,b)},a.complete=function(){for(var c=arguments.length,d=Array(c),e=0;e<c;e++)d[e]=arguments[e];var g=(0,_extends2["default"])({},d[0]);try{
|
|
29
|
+
var i={view:(0,_view.getCurView)(this.ctx),timestamp:h,url:c,name:this.getResourceName(c),method:a.method||"GET"};return this.injectTracing(i,function(b){a.header=(0,_extends2["default"])({},g,b)}),a.success=function(){i.success=1;for(var a=arguments.length,b=Array(a),c=0;c<a;c++)b[c]=arguments[c];d&&d.apply(this,b)},a.fail=function(){i.success=0;for(var a=arguments.length,b=Array(a),c=0;c<a;c++)b[c]=arguments[c];e&&e.apply(this,b)},a.complete=function(){for(var c=arguments.length,d=Array(c),e=0;e<c;e++)d[e]=arguments[e];var g=(0,_extends2["default"])({},d[0]);try{// 对齐 Browser 端 getResourceSuccessByCode:有 HTTP 状态码时按 [200, 300) 判定,
|
|
30
|
+
// 无状态码时保留原网络回调结果(success=1/fail=0)作为兜底
|
|
31
|
+
var h=g.statusCode;if(h){var j=+h;i.success=200<=j&&300>j?1:0}i.size=(0,_base.getStringSize)(JSON.stringify(g)),b.sendApi(i,g,a)}catch(a){_rumCore.logger.error("api-collector","process response failed",a)}f&&f.apply(this,d)},a},b.getResourceName=function(a){var b,c=this.ctx.getConfig(),d=c.parseResourceName;return b=(0,_rumCore.isFunction)(d)?d(a):(0,_url.getPathByURL)(a),b}// /**
|
|
30
32
|
// * 解析小程序的性能数据
|
|
31
33
|
// * 参考:https://developers.weixin.qq.com/miniprogram/dev/api/network/request/wx.request.html
|
|
32
34
|
// * https://opendocs.alipay.com/mini/api/owycmh?pathHash=c91640f8
|
package/lib/reporter/index.js
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
"use strict";var _interopRequireDefault=require("@babel/runtime/helpers/interopRequireDefault");exports.__esModule=!0,exports["default"]=void 0;var _inheritsLoose2=_interopRequireDefault(require("@babel/runtime/helpers/inheritsLoose")),_rumCore=require("@arms/rum-core"),_platform=require("../utils/platform"),UniReporter=/*#__PURE__*/function(a){function b(){for(var b,c=arguments.length,d=Array(c),e=0;e<c;e++)d[e]=arguments[e];return b=a.call.apply(a,[this].concat(d))||this,b.name="uni-reporter",b}(0,_inheritsLoose2["default"])(b,a);var c=b.prototype;return c.init=function(){var a=this;(0,_rumCore.isFunction)(_platform.sdk.onAppHide)&&_platform.sdk.onAppHide(function(){a.flushEventQueue()})},c.request=function(a,b){var c=a.getConfig();(0,_platform.fixAttrs)(b).then(function(a){_platform.sdk.request({url:c.endpoint,method:"POST",header:{"Content-Type":"text/plain"},dataType:"text",data:JSON.stringify(a)})})["catch"](function(a){_rumCore.logger.
|
|
1
|
+
"use strict";var _interopRequireDefault=require("@babel/runtime/helpers/interopRequireDefault");exports.__esModule=!0,exports["default"]=void 0;var _inheritsLoose2=_interopRequireDefault(require("@babel/runtime/helpers/inheritsLoose")),_rumCore=require("@arms/rum-core"),_platform=require("../utils/platform"),UniReporter=/*#__PURE__*/function(a){function b(){for(var b,c=arguments.length,d=Array(c),e=0;e<c;e++)d[e]=arguments[e];return b=a.call.apply(a,[this].concat(d))||this,b.name="uni-reporter",b}(0,_inheritsLoose2["default"])(b,a);var c=b.prototype;return c.init=function(){var a=this;(0,_rumCore.isFunction)(_platform.sdk.onAppHide)&&_platform.sdk.onAppHide(function(){a.flushEventQueue()})},c.request=function(a,b){var c=a.getConfig();(0,_platform.fixAttrs)(b).then(function(a){_platform.sdk.request({url:c.endpoint,method:"POST",header:{"Content-Type":"text/plain"},dataType:"text",data:JSON.stringify(a)})})["catch"](function(a){_rumCore.logger.warn("uni-reporter","request failed",a)})},b}(_rumCore.Reporter),_default=exports["default"]=UniReporter;/**
|
|
2
2
|
* uni-app reporter
|
|
3
3
|
*/
|
package/lib/utils/api.d.ts
CHANGED
package/lib/utils/api.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";var _rumCore=require("@arms/rum-core");exports.__esModule=!0,exports.reviseApiAttr=reviseApiAttr;function reviseApiAttr(a){if(a&&(0,_rumCore.isObject)(a)){var b={};return(0,_rumCore.isString)(a.name)&&(b.name=a.name.substring(0,1e3)),(0,_rumCore.isString)(a.message)&&(b.message=a.message.substring(0,1e3)),
|
|
1
|
+
"use strict";var _rumCore=require("@arms/rum-core");exports.__esModule=!0,exports.reviseApiAttr=reviseApiAttr;function reviseApiAttr(a){if(a&&(0,_rumCore.isObject)(a)){var b={};return(0,_rumCore.isString)(a.name)&&(b.name=a.name.substring(0,1e3)),(0,_rumCore.isString)(a.message)&&(b.message=a.message.substring(0,1e3)),(0,_rumCore.isNumber)(a.success)&&-1<=a.success&&1>=a.success&&(b.success=a.success),(0,_rumCore.isNumber)(a.duration)&&0<=a.duration&&(b.duration=a.duration),(0,_rumCore.isString)(a.status_code)&&(b.status_code=a.status_code.substring(0,100)),(0,_rumCore.isNumber)(a.status_code)&&(b.status_code=a.status_code),(0,_rumCore.isString)(a.snapshots)&&(b.snapshots=a.snapshots.substring(0,5e3)),b}}
|
package/lib/utils/platform.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { RumEventBundle } from
|
|
1
|
+
import { RumEventBundle } from '@arms/rum-core';
|
|
2
2
|
export declare const global2: any;
|
|
3
3
|
export declare const VERSION: string;
|
|
4
4
|
interface CommonOption {
|
|
@@ -14,7 +14,9 @@ interface SDK {
|
|
|
14
14
|
setStorageSync: (key: any, data?: string) => void;
|
|
15
15
|
onError: (listener: Function) => void;
|
|
16
16
|
onPageNotFound: (listener: Function) => void;
|
|
17
|
-
|
|
17
|
+
onUnhandledRejection?: (listener: Function) => void;
|
|
18
|
+
offError?: (listener: Function) => void;
|
|
19
|
+
offUnhandledRejection?: (listener: Function) => void;
|
|
18
20
|
navigateTo: (options: any) => void;
|
|
19
21
|
redirectTo: (options: any) => void;
|
|
20
22
|
switchTab: (options: any) => void;
|
package/lib/utils/platform.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
"use strict";var _interopRequireDefault=require("@babel/runtime/helpers/interopRequireDefault");exports.__esModule=!0,exports.fixAttrs=exports.appName=exports.VERSION=void 0,exports.getNetType=getNetType,exports.getPerformance=getPerformance,exports.getStorageSync=getStorageSync,exports.sdk=exports.global2=void 0,exports.setStorageSync=setStorageSync;var _regenerator=_interopRequireDefault(require("@babel/runtime/regenerator")),_extends2=_interopRequireDefault(require("@babel/runtime/helpers/extends")),_asyncToGenerator2=_interopRequireDefault(require("@babel/runtime/helpers/asyncToGenerator")),_rumCore=require("@arms/rum-core"),global2=exports.global2=global||window,VERSION=exports.VERSION='npm-0.1.
|
|
1
|
+
"use strict";var _interopRequireDefault=require("@babel/runtime/helpers/interopRequireDefault");exports.__esModule=!0,exports.fixAttrs=exports.appName=exports.VERSION=void 0,exports.getNetType=getNetType,exports.getPerformance=getPerformance,exports.getStorageSync=getStorageSync,exports.sdk=exports.global2=void 0,exports.setStorageSync=setStorageSync;var _regenerator=_interopRequireDefault(require("@babel/runtime/regenerator")),_extends2=_interopRequireDefault(require("@babel/runtime/helpers/extends")),_asyncToGenerator2=_interopRequireDefault(require("@babel/runtime/helpers/asyncToGenerator")),_rumCore=require("@arms/rum-core"),global2=exports.global2=global||window,VERSION=exports.VERSION='npm-0.1.5',sdk=exports.sdk=uni,appName=exports.appName="uniapp";// export {
|
|
2
2
|
// // sdk: global.uni,
|
|
3
3
|
// appName: 'uniapp',
|
|
4
4
|
// }
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@arms/rum-uniapp",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.5",
|
|
4
4
|
"description": "arms rum javascript sdk for uniapp native",
|
|
5
5
|
"author": "guangli.fj <guangli.fj@alibaba-inc.com>",
|
|
6
6
|
"license": "ISC",
|
|
@@ -25,7 +25,7 @@
|
|
|
25
25
|
"prepublishOnly": "npm run build"
|
|
26
26
|
},
|
|
27
27
|
"dependencies": {
|
|
28
|
-
"@arms/rum-core": "0.1.
|
|
28
|
+
"@arms/rum-core": "0.1.11"
|
|
29
29
|
},
|
|
30
30
|
"devDependencies": {
|
|
31
31
|
"typescript": "^4.9.4"
|