aegis-mp-sdk 1.38.6 → 1.39.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (71) hide show
  1. package/README.md +11 -11
  2. package/lib/aegis.min.js +5 -5
  3. package/lib/packages/cocos-sdk/src/aegis.d.ts +1 -0
  4. package/lib/packages/core/src/constant/config.d.ts +3 -0
  5. package/lib/packages/core/src/constant/index.d.ts +1 -1
  6. package/lib/packages/core/src/core.d.ts +58 -22
  7. package/lib/packages/core/src/hooks/afterRequestHooks.d.ts +1 -1
  8. package/lib/packages/core/src/hooks/beforeRequestHooks.d.ts +1 -1
  9. package/lib/packages/core/src/hooks/modifyRequestHooks.d.ts +1 -1
  10. package/lib/packages/core/src/index.d.ts +1 -1
  11. package/lib/packages/core/src/interface/config.d.ts +10 -2
  12. package/lib/packages/core/src/interface/log.d.ts +32 -0
  13. package/lib/packages/core/src/interface/send.d.ts +3 -1
  14. package/lib/packages/core/src/pipes/group-by-from.d.ts +8 -0
  15. package/lib/packages/core/src/pipes/index.d.ts +3 -1
  16. package/lib/packages/core/src/pipes/length-limit.d.ts +5 -0
  17. package/lib/packages/core/src/pipes/pv.d.ts +5 -0
  18. package/lib/packages/core/src/pipes/report.d.ts +2 -0
  19. package/lib/packages/core/src/{util/trace.d.ts → pipes/trace/index.d.ts} +12 -4
  20. package/lib/packages/core/src/pipes/trace/jwt.d.ts +12 -0
  21. package/lib/packages/core/src/{util → pipes/trace}/ot-js.d.ts +2 -0
  22. package/lib/packages/core/src/pipes/whitelist.d.ts +9 -0
  23. package/lib/packages/core/src/util/destroy.d.ts +2 -0
  24. package/lib/packages/core/src/util/index.d.ts +21 -4
  25. package/lib/packages/hippy-sdk/src/aegis.d.ts +1 -0
  26. package/lib/packages/liteapp-sdk/src/aegis.d.ts +1 -0
  27. package/lib/packages/mp-sdk/src/adaptor/index.d.ts +37 -1
  28. package/lib/packages/mp-sdk/src/aegis.d.ts +11 -1
  29. package/lib/packages/mp-sdk/src/index.d.ts +1 -1
  30. package/lib/packages/mp-sdk/src/plugins/aid.d.ts +2 -1
  31. package/lib/packages/mp-sdk/src/plugins/assets-speed.d.ts +3 -2
  32. package/lib/packages/mp-sdk/src/plugins/load-package.d.ts +3 -2
  33. package/lib/packages/mp-sdk/src/util/hack-api.d.ts +15 -8
  34. package/lib/packages/mp-sdk/src/util/hack-cloud.d.ts +4 -0
  35. package/lib/packages/mp-sdk/src/util/index.d.ts +1 -0
  36. package/lib/packages/mp-sdk/src/util/wxApi.d.ts +2 -4
  37. package/lib/packages/node-sdk/src/index.d.ts +2 -1
  38. package/lib/packages/quickapp-sdk/src/aegis.d.ts +1 -0
  39. package/lib/packages/rn-sdk/src/aegis.d.ts +1 -0
  40. package/lib/packages/viola-sdk/src/aegis.d.ts +1 -0
  41. package/lib/packages/web-sdk/src/aegis.d.ts +29 -26
  42. package/lib/packages/web-sdk/src/constant/index.d.ts +3 -0
  43. package/lib/packages/web-sdk/src/index.d.ts +1 -1
  44. package/lib/packages/web-sdk/src/interface/index.d.ts +106 -0
  45. package/lib/packages/web-sdk/src/plugins/blank-screen/constant.d.ts +78 -0
  46. package/lib/packages/web-sdk/src/plugins/blank-screen/index.d.ts +3 -0
  47. package/lib/packages/web-sdk/src/plugins/blank-screen/utils.d.ts +73 -0
  48. package/lib/packages/web-sdk/src/plugins/cgi-speed/hack-http.d.ts +4 -8
  49. package/lib/packages/web-sdk/src/plugins/cgi-speed/utils.d.ts +2 -1
  50. package/lib/packages/web-sdk/src/plugins/click-element.d.ts +8 -0
  51. package/lib/packages/web-sdk/src/plugins/console-info.d.ts +6 -0
  52. package/lib/packages/web-sdk/src/plugins/device-info.d.ts +0 -5
  53. package/lib/packages/web-sdk/src/plugins/finger/finger-print.d.ts +8 -0
  54. package/lib/packages/web-sdk/src/plugins/finger/murmur-hash-32.d.ts +9 -0
  55. package/lib/packages/web-sdk/src/plugins/index.d.ts +6 -1
  56. package/lib/packages/web-sdk/src/plugins/lag-monitor.d.ts +16 -0
  57. package/lib/packages/web-sdk/src/plugins/memory-monitor.d.ts +24 -0
  58. package/lib/packages/web-sdk/src/plugins/tti.d.ts +1 -0
  59. package/lib/packages/web-sdk/src/plugins/web-vitals.d.ts +2 -0
  60. package/lib/packages/web-sdk/src/util/event.d.ts +1 -0
  61. package/lib/packages/web-sdk/src/util/hack-websocket.d.ts +1 -11
  62. package/lib/packages/web-sdk/src/util/index.d.ts +0 -2
  63. package/lib/packages/web-sdk/src/util/ot-js.d.ts +2 -0
  64. package/lib/packages/web-sdk/src/utils/math.d.ts +26 -0
  65. package/lib/packages/weex-sdk/src/aegis.d.ts +1 -0
  66. package/package.json +1 -1
  67. package/lib/packages/core/src/util/jwt.d.ts +0 -2
  68. package/lib/packages/web-sdk/__tests__/util/index.spec.d.ts +0 -1
  69. package/lib/packages/web-sdk/__tests__/util/polyfill.spec.d.ts +0 -1
  70. /package/lib/packages/core/src/pipes/{removePayload.d.ts → remove-payload.d.ts} +0 -0
  71. /package/lib/packages/core/src/{util → pipes/trace}/uuid.d.ts +0 -0
package/README.md CHANGED
@@ -48,7 +48,7 @@ const aegis = new Aegis({
48
48
  ::: warning 注意 ⚠️
49
49
  为了不遗漏数据,须尽早进行初始化;
50
50
 
51
- aegis-sdk 默认使用 `https://aegis.qq.com` 作为上报域名,您也可以选择使用 `https://rumt-zh.com` 作为上报域名。
51
+ aegis-sdk 默认使用 `https://rumt-zh.com` 作为上报域名,您也可以选择使用 `https://rumt-zh.com` 作为上报域名。
52
52
 
53
53
  小程序接入,正式环境需要将上报域名添加到安全域名中。
54
54
  :::
@@ -530,17 +530,17 @@ aegis-mp-sdk 在微信小游戏中的用法跟小程序中的用法基本一样
530
530
  | urlHandler | 可选,Function。 <br> 动态修改上报数据中页面地址 from,可以配合 pageUrl 参数使用|
531
531
  | websocketHack | 可选,boolean,默认 false <br>是否开启websocket监控。 |
532
532
  | enableHttp2 | 可选,boolean,默认 false。<br> 上报数据是否支持 HTTP2,默认没有开启。 |
533
- | hostUrl | 可选,默认是 `https://aegis.qq.com`。<br>影响全部上报数据的 host 地址,下面几个 url 地址设置后会覆盖对应的上报地址 |
534
- | url | 可选,string,默认 'https://aegis.qq.com/collect'。<br>日志上报地址 |
535
- | pvUrl | 可选,string, 默认 'https://aegis.qq.com/collect/pv' <br> pv 上报地址 |
536
- | whiteListUrl | 可选,string,默认 'https://aegis.qq.com/collect/whitelist'。<br>白名单确认接口 <br>如果想要关闭白名单接口请求,可以传空字符串|
537
- | offlineUrl | 可选,string,默认 'https://aegis.qq.com/collect/offline'。<br> 离线日志上报地址 |
538
- | eventUrl | 可选,string,默认 'https://aegis.qq.com/collect/events'。<br> 自定义事件上报地址 |
539
- | speedUrl | 可选,string,默认 'https://aegis.qq.com/speed'。<br>测速日志上报地址 |
540
- | customTimeUrl | 可选,string,默认 'https://aegis.qq.com/speed/custom'。<br>自定义测速上报地址 |
541
- | performanceUrl | 可选,string,默认 'https://aegis.qq.com/speed/performance'。<br>页面性能日志上报地址 |
533
+ | hostUrl | 可选,默认是 `https://rumt-zh.com`。<br>影响全部上报数据的 host 地址,下面几个 url 地址设置后会覆盖对应的上报地址 |
534
+ | url | 可选,string,默认 'https://rumt-zh.com/collect'。<br>日志上报地址 |
535
+ | pvUrl | 可选,string, 默认 'https://rumt-zh.com/collect/pv' <br> pv 上报地址 |
536
+ | whiteListUrl | 可选,string,默认 'https://rumt-zh.com/collect/whitelist'。<br>白名单确认接口 <br>如果想要关闭白名单接口请求,可以传空字符串|
537
+ | offlineUrl | 可选,string,默认 'https://rumt-zh.com/collect/offline'。<br> 离线日志上报地址 |
538
+ | eventUrl | 可选,string,默认 'https://rumt-zh.com/collect/events'。<br> 自定义事件上报地址 |
539
+ | speedUrl | 可选,string,默认 'https://rumt-zh.com/speed'。<br>测速日志上报地址 |
540
+ | customTimeUrl | 可选,string,默认 'https://rumt-zh.com/speed/custom'。<br>自定义测速上报地址 |
541
+ | performanceUrl | 可选,string,默认 'https://rumt-zh.com/speed/performance'。<br>页面性能日志上报地址 |
542
542
  | setDataReportConfig | 可选,object,默认为{}。相关的配置: <br> disabled: 可选,Boolean,默认false。是否禁用setData数据上报; <br> timeThreshold: 可选,Number,单位为ms,默认值为30。上报的耗时阈值,表示仅上报更新耗时超过该阈值的数据;<br> withDataPaths: 可选,Boolean,默认为true。是否上报本次更新的字段信息;|
543
- | api | 可选,object,默认为 {}。相关的配置: <br> apiDetail : 可选,boolean,默认false。上报 api 信息的时候,是否上报 api 的请求参数和返回值; <br><br> retCodeHandler: Function(data: String, url: String, xhr: Object):{isErr: boolean, code: string}, 返回码上报钩子函数。 会传入接口返回数据,请求url和xhr对象; <br><br> reqParamHandler: Function(data: any, url: String) 上报请求参数的处理函数,可以对接口的请求参数进行处理,方便用户过滤上报请求参数的信息; <br><br> resBodyHandler: Function(data: any, url: String) 上报 response 返回 body 的处理函数,可以对接口返回值的 response body 进行处理,只上报关键信息; <br><br> reqHeaders: Array 需要上报的 http 请求 request headers 列表。 <br><br> resHeaders: Array 需要上报的 http 请求 response headers 列表。注意使用小写。 <br><br> resourceTypeHandler: Function,请求资源类型修正钩子函数 会传入接口url,返回值为‘static’或‘fetch’。<span id="jump">[见示例[1]](#exp1)</span> <br><br> reportRequest: boolean, 默认为false。 开启aegis.info全量上报, 不需要白名单配置。并上报所有接口请求信息(请开启reportApiSpeed)<br><br> injectTraceHeader: 可选,string,且必须为枚举值 'traceparent', 'sw8', 'b3', 'sentry-trace' 中的一种,开启该参数后,Aegis 会在用户请求头中注入相关 trace header。<br><br> injectTraceUrls: 可选,Array, 数组中传入 string 或者 RegExp。标记哪些请求 url 需要注入 trace 请求头。 <br><br> injectTraceIgnoreUrls: 可选,Array, 数组中传入 string 或者 RegExp。标记哪些请求 url 不需要注入 trace 请求头。|
543
+ | api | 可选,object,默认为 {}。相关的配置: <br> apiDetail : 可选,boolean,默认false。上报 api 信息的时候,是否上报 api 的请求参数和返回值; <br><br> enableResDetail : 可选,boolean,默认false。上报 api 信息的时候,是否上报 api 返回体中除了data之外的包体属性; <br><br> retCodeHandler: Function(data: String, url: String, xhr: Object):{isErr: boolean, code: string}, 返回码上报钩子函数。 会传入接口返回数据,请求url和xhr对象; <br><br> reqParamHandler: Function(data: any, url: String) 上报请求参数的处理函数,可以对接口的请求参数进行处理,方便用户过滤上报请求参数的信息; <br><br> resBodyHandler: Function(data: any, url: String) 上报 response 返回 body 的处理函数,可以对接口返回值的 response body 进行处理,只上报关键信息; <br><br> reqHeaders: Array 需要上报的 http 请求 request headers 列表。 <br><br> resHeaders: Array 需要上报的 http 请求 response headers 列表。注意使用小写。 <br><br> resourceTypeHandler: Function,请求资源类型修正钩子函数 会传入接口url,返回值为‘static’或‘fetch’。<span id="jump">[见示例[1]](#exp1)</span> <br><br> reportRequest: boolean, 默认为false。 开启aegis.info全量上报, 不需要白名单配置。并上报所有接口请求信息(请开启reportApiSpeed)<br><br> injectTraceHeader: 可选,string,且必须为枚举值 'traceparent', 'sw8', 'b3', 'sentry-trace' 中的一种,开启该参数后,Aegis 会在用户请求头中注入相关 trace header。<br><br> injectTraceUrls: 可选,Array, 数组中传入 string 或者 RegExp。标记哪些请求 url 需要注入 trace 请求头。 <br><br> injectTraceIgnoreUrls: 可选,Array, 数组中传入 string 或者 RegExp。标记哪些请求 url 不需要注入 trace 请求头。 <br><br> traceFlag: 可选,`boolean` 或 `number`, 标记trace请求的flag设置 |
544
544
  | ext1 | 可选,string,自定义上报的额外维度,上报的时候可以被覆盖 |
545
545
  | ext2 | 可选,string,自定义上报的额外维度,上报的时候可以被覆盖 |
546
546
  | ext3 | 可选,string,自定义上报的额外维度,上报的时候可以被覆盖 |
package/lib/aegis.min.js CHANGED
@@ -1,10 +1,10 @@
1
1
  /**
2
- * ================================================================
3
- * aegis-mp-sdk@1.38.6 (c) 2023 TencentCloud Real User Monitoring.
2
+ * ===========================================================================
3
+ * aegis-mp-sdk@1.39.2 (c) 2025 TencentCloud Real User Monitoring.
4
4
  * Author pumpkincai.
5
- * Last Release Time Wed Nov 29 2023 00:04:52 GMT+0800 (中国标准时间).
5
+ * Last Release Time Mon Dec 01 2025 14:46:00 GMT+0800 (China Standard Time).
6
6
  * Released under the MIT License.
7
7
  * Thanks for supporting RUM & Aegis!
8
- * ================================================================
8
+ * ===========================================================================
9
9
  **/
10
- !function(e,t){"object"==typeof exports&&"undefined"!=typeof module?module.exports=t():"function"==typeof define&&define.amd?define(t):(e="undefined"!=typeof globalThis?globalThis:e||self).Aegis=t()}(this,function(){"use strict";var j=function(e,t){return(j=Object.setPrototypeOf||({__proto__:[]}instanceof Array?function(e,t){e.__proto__=t}:function(e,t){for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n])}))(e,t)};function e(e,t){function n(){this.constructor=e}j(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)}var p=function(){return(p=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var o in t=arguments[n])Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o]);return e}).apply(this,arguments)};function H(r,o){var i,a,s,c={label:0,sent:function(){if(1&s[0])throw s[1];return s[1]},trys:[],ops:[]},e={next:t(0),throw:t(1),return:t(2)};return"function"==typeof Symbol&&(e[Symbol.iterator]=function(){return this}),e;function t(n){return function(e){var t=[n,e];if(i)throw new TypeError("Generator is already executing.");for(;c;)try{if(i=1,a&&(s=2&t[0]?a.return:t[0]?a.throw||((s=a.return)&&s.call(a),0):a.next)&&!(s=s.call(a,t[1])).done)return s;switch(a=0,(t=s?[2&t[0],s.value]:t)[0]){case 0:case 1:s=t;break;case 4:return c.label++,{value:t[1],done:!1};case 5:c.label++,a=t[1],t=[0];continue;case 7:t=c.ops.pop(),c.trys.pop();continue;default:if(!((s=0<(s=c.trys).length&&s[s.length-1])||6!==t[0]&&2!==t[0])){c=0;continue}if(3===t[0]&&(!s||t[1]>s[0]&&t[1]<s[3]))c.label=t[1];else if(6===t[0]&&c.label<s[1])c.label=s[1],s=t;else{if(!(s&&c.label<s[2])){s[2]&&c.ops.pop(),c.trys.pop();continue}c.label=s[2],c.ops.push(t)}}t=o.call(r,c)}catch(e){t=[6,e],a=0}finally{i=s=0}if(5&t[0])throw t[1];return{value:t[0]?t[1]:void 0,done:!0}}}}function _(){for(var e=0,t=0,n=arguments.length;t<n;t++)e+=arguments[t].length;for(var r=Array(e),o=0,t=0;t<n;t++)for(var i=arguments[t],a=0,s=i.length;a<s;a++,o++)r[o]=i[a];return r}Object.assign||Object.defineProperty(Object,"assign",{enumerable:!1,configurable:!0,writable:!0,value:function(e){if(null==e)throw new TypeError("Cannot convert first argument to object");for(var t=Object(e),n=1;n<arguments.length;n++)if(null!=(r=arguments[n]))for(var r=Object(r),o=Object.keys(Object(r)),i=0,a=o.length;i<a;i++){var s=o[i],c=Object.getOwnPropertyDescriptor(r,s);null!=c&&c.enumerable&&(t[s]=r[s])}return t}});var M=/_?t(\d)?(imestamp)?=\d+&?/g,D=["aegis.qq.com","tamaegis.com","/aegis-sdk","rumt-","/flog.core.min.js","pingfore.qq.com","pingfore.tencent.com","zhiyan.tencent-cloud.net","h.trace.qq.com","btrace.qq.com","beacon.qq.com","dmplog.qq.com","qq.com/report","svibeacon.onezapp.com","cube.weixinbridge.com","doubleclick.net","pcmgrmonitor.3g.qq.com","tdm.qq.com","report.qqweb.qq.com","tpstelemetry.tencent.com","insight.cloud.tencent.com","facebook.com","facebook.net","google","yahoo.com","twitter.com","ga-audiences","report.idqqimg.com","arms-retcode.aliyuncs.com","px.effirst.com","sentry","baidu.com","hot-update.json","u.c.b.r.o.w.s.e.r","report.url.cn","sockjs-node","m3u8"],F=["ext1","ext2","ext3","level","trace","tag","seq","code"],B=(r.prototype.indexOf=function(e,t){for(var n=0;n<e.length;n++)if(e[n].callback===t)return n;return-1},r.prototype.on=function(e,t,n){var r;if(void 0===n&&(n=0),this)return(r=this.eventsList[e])||(this.eventsList[e]=[],r=this.eventsList[e]),-1===this.indexOf(r,t)&&r.push({name:e,type:n||0,callback:t}),this},r.prototype.one=function(e,t){this.on(e,t,1)},r.prototype.remove=function(e,t){if(this){var n=this.eventsList[e];if(n){if(t)return n.length&&(t=this.indexOf(n,t),n.splice(t,1)),this;try{delete this.eventsList[e]}catch(e){}}return null}},r.prototype.clear=function(){this.eventsList={}},r),t={generateTraceId:W(16),generateSpanId:W(8)},n=Array(32);function r(){var a=this;this.emit=function(e,t){if(a){var n;if(null!=(r=a.eventsList[e])&&r.length)for(var r=r.slice(),o=0;o<r.length;o++){n=r[o];try{var i=n.callback.apply(a,[t]);if(1===n.type&&a.remove(e,n.callback),!1===i)break}catch(e){throw e}}return a}},this.eventsList={}}function W(t){return function(){for(var e=0;e<2*t;e++)n[e]=Math.floor(16*Math.random())+48,58<=n[e]&&(n[e]+=39);return String.fromCharCode.apply(null,n.slice(0,2*t))}}function V(){return([1e7]+1e3+4e3+8e3+1e11).replace(/[018]/g,function(e){return(e^(16*Math.random()&15)>>e/4).toString(16)})}function G(){return"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,function(e){var t=16*Math.random()|0;return("x"===e?t:3&t|8).toString(16)})}function J(e){for(var t,n,r,o="",i=0,a=(e=String(e)).length%3;i<e.length;){if(255<(t=e.charCodeAt(i++))||255<(n=e.charCodeAt(i++))||255<(r=e.charCodeAt(i++)))throw new TypeError("Failed to execute 'btoa': The string to be encoded contains characters outside of the Latin1 range.");o+=s.charAt((t=t<<16|n<<8|r)>>18&63)+s.charAt(t>>12&63)+s.charAt(t>>6&63)+s.charAt(63&t)}return a?o.slice(0,a-3)+"===".substring(a):o}function z(e){if(e=String(e).replace(/[\t\n\f\r ]+/g,""),!$.test(e))throw new TypeError("Failed to execute 'atob': The string to be decoded is not correctly encoded.");var t;e+="==".slice(2-(3&e.length));for(var n,r,o="",i=0;i<e.length;)t=s.indexOf(e.charAt(i++))<<18|s.indexOf(e.charAt(i++))<<12|(n=s.indexOf(e.charAt(i++)))<<6|(r=s.indexOf(e.charAt(i++))),o+=64===n?String.fromCharCode(t>>16&255):64===r?String.fromCharCode(t>>16&255,t>>8&255):String.fromCharCode(t>>16&255,t>>8&255,255&t);return o}function K(e){var t,n="";return n="object"==typeof e&&(t=(e=function(e,t){for(var n=0;n<t.length;n++){var r=t[n],o=e[r]||"function"==typeof e.get&&e.get(r);if(o)return[r,o]}return["",""]}(e,Object.keys(Y)))[0],e=e[1],t)?Y[t](e):n}var s="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",$=/^(?:[A-Za-z\d+\/]{4})*?(?:[A-Za-z\d+\/]{2}(?:==)?|[A-Za-z\d+\/]{3}=?)?$/,Z=(o.prototype.generate=function(e,t,n){if(void 0===t&&(t={}),this.url=e,!this.isUrlIgnored()&&this.isUrlInTraceUrls()&&this.traceType){switch(this.traceType){case"traceparent":this.traceId=this.createTraceparent();break;case"b3":this.traceId=this.createB3();break;case"sw8":this.traceId=this.createSw8(n);break;case"sentry-trace":this.traceId=this.createSentryTrace();break;default:return console.warn("this trace key "+this.traceType+" is not supported"),void(this.traceId="")}return t[this.traceType]&&(this.traceId=t[this.traceType]),{name:this.traceType,value:this.traceId}}},o.prototype.createTraceparent=function(){var e=t.generateSpanId();return"00-"+t.generateTraceId()+"-"+e+"-0"+Number(1).toString(16)},o.prototype.createB3=function(){var e=t.generateSpanId();return t.generateTraceId()+"-"+e+"-1"},o.prototype.createSw8=function(e){var t="function"==typeof btoa?btoa:J,e=e||{},n=e.host,n=void 0===n?"":n,e=e.pathname,e=void 0===e?"":e,r=G(),o=G();return"1-"+String(t(o))+"-"+String(t(r))+"-1-"+String(t("aegis"))+"-"+String(t("1.38.6"))+"-"+String(t(encodeURI(e)))+"-"+String(t(n))},o.prototype.createSentryTrace=function(){var e=V().substring(16);return V()+"-"+e+"-1"},o.prototype.isUrlIgnored=function(){if(Array.isArray(this.ignoreUrls)&&0!==this.ignoreUrls.length)for(var e=0,t=this.ignoreUrls;e<t.length;e++){var n=t[e];if(this.urlMatches(this.url,n))return!0}return!1},o.prototype.isUrlInTraceUrls=function(){if(!this.urls)return!0;if(Array.isArray(this.urls)){if(0===this.urls.length)return!1;for(var e=0,t=this.urls;e<t.length;e++){var n=t[e];if(this.urlMatches(this.url,n))return!0}}return!1},o.prototype.urlMatches=function(e,t){return"string"==typeof t?e===t:!!e.match(t)},o),Y={sw8:function(e){var t="function"==typeof atob?atob:z,e=e.split("-")[1];return e?t(e):""},traceparent:function(e){return e.split("-")[1]},b3:function(e){return e.split("-")[0]},"sentry-trace":function(e){return e.split("-")[0]}},Q=function(e){if(!e||0===e.length)return"{}";e=Array.isArray(e)?e:[e];var t=Object.keys(e[0]),n={},r=(t.forEach(function(t){n[t]=e.map(function(e){return e[t]})}),n.count=e.length,n);if("string"==typeof r)return r;try{return JSON.stringify(r,ve())||"undefined"}catch(r){return"error happen when aegis stringify: \n "+r.message+" \n "+r.stack}};function o(e,t,n){void 0===n&&(n=null),this.traceType=e,this.ignoreUrls=t,this.urls=n}function X(e,t){return"string"==typeof e?e.split("?")[t?1:0]||"":e}function ee(e){return"string"==typeof e&&/^\//.test(e)?"https:"===(null===location||void 0===location?void 0:location.protocol):/^https/.test(e)}function te(e,t,n){var r,o;try{if("function"==typeof(null==t?void 0:t.retCodeHandler))return{code:void 0===(i=(o=t.retCodeHandler(e,null==n?void 0:n.url,null==n?void 0:n.ctx,null==n?void 0:n.payload)||{}).code)?"unknown":i,isErr:o.isErr};if(!(e="string"==typeof e?JSON.parse(e):e))return{code:"unknown",isErr:!1};"function"==typeof(null==(r=null==t?void 0:t.ret)?void 0:r.join)&&(ye=[].concat(t.ret.map(function(e){return e.toLowerCase()})));var i,a=Object.getOwnPropertyNames(e).filter(function(e){return-1!==ye.indexOf(e.toLowerCase())});return a.length?{code:""+(i="未知"!==(i=e[a[0]])&&""!==i?i:"unknown"),isErr:0!==i&&"0"!==i&&"unknown"!==i}:{code:"unknown",isErr:!1}}catch(e){return{code:"unknown",isErr:!1}}}function d(e,t,n){try{var r="function"==typeof t?t(e,null==n?void 0:n.url)||"":e;return be(r).slice(0,102400)}catch(e){return""}}function h(t,e){return"string"!=typeof t||!t||e&&-1<t.indexOf(e)||Re.test(t)||D.some(function(e){return-1<t.indexOf(e)})}function m(n,r){var o,i=[],a=n.config;return n.lifeCycle.on("destroy",function(){i.length=0}),function(e,t){Array.isArray(e)?i=i.concat(e):i.push(e),r&&i.length>=r||n.sendNow&&0<i.length?(i=we(i),t(i.splice(0,i.length)),o&&clearTimeout(o)):(o&&clearTimeout(o),o=setTimeout(function(){o=null,0<(i=we(i)).length&&t(i.splice(0,i.length))},a.delay))}}function ne(e,t){return Array.isArray(e)?t(e.map(function(e){return t=p(p({},e),{msg:"string"==typeof e.msg?e.msg:[].concat(e.msg).map(E).join(" ")}),F.forEach(function(e){t[e]||delete t[e]}),t;var t})):t([p(p({},e),{msg:"string"==typeof e.msg?e.msg:E(e.msg)})])}function re(c,l){return function(e,t){var n,r,o,i=Array.isArray(e),a=i?e:[e],s=(c.lifeCycle.emit("beforeRequest",e),c.config.beforeRequest);(a="function"==typeof s?a.map(function(t){try{var e=s({logs:t,logType:l});return(null==e?void 0:e.logType)===l&&null!=e&&e.logs?e.logs:!1!==e&&t}catch(e){return t}}).filter(function(e){return!1!==e}):a).length&&(n=a,e=F,!Array.isArray(n)||n.length<=1||(r=[],o=[],!(o="string"==typeof e?[e]:e))||o.length<=0||(o.forEach(function(t){n.forEach(function(e){null!=e&&e[t]&&r.push(t)})}),0<r.length&&(n=n.map(function(e){var t={};return r.forEach(function(e){t[e]=""}),p(p({},t),e)}))),a=n,t(i?a:a[0]))}}function oe(o){return function(e,t){o.lifeCycle.emit("modifyRequest",e);var n=o.config.modifyRequest;if("function"==typeof n)try{var r=n(e);"object"==typeof r&&"url"in r&&(e=r)}catch(e){console.error(e)}t(e)}}function ie(r){return function(e,t){null!=(n=r.lifeCycle)&&n.emit("afterRequest",e);var n=(r.config||{}).afterRequest;"function"==typeof n&&!1===n(e)||t(e)}}function y(n){if(n&&n.reduce&&n.length)return 1===n.length?function(e,t){n[0](e,t||ke)}:n.reduce(function(n,r){return function(e,t){return void 0===t&&(t=ke),n(e,function(e){return null==r?void 0:r(e,t)})}});throw new TypeError("createPipeline need at least one function param")}function ae(t,n){Object.getOwnPropertyNames(t).forEach(function(e){"function"==typeof t[e]&&"constructor"!==e&&(n?n[e]="sendPipeline"===e?function(){return function(){}}:function(){}:t[e]=function(){})})}function se(e){try{var t,n,r,o="";return o=e.pageUrl||(n=(t=getCurrentPages())[t.length-1]||{},i=n.options,r=Object.keys(i).length?"?"+Object.keys(i).map(function(e){return e+"="+i[e]}).join("&"):"",n.route?n.route+r:""),(o="function"==typeof e.urlHandler?e.urlHandler():o).slice(0,2048)}catch(e){return""}var i}function ce(e,t){if("string"==typeof e&&"string"==typeof t){if(e===t)return 1;for(var n=e.split("."),r=t.split("."),o=Math.max(n.length,r.length),i=0;i<o;i++){var a=~~n[i],s=~~r[i];if(a<s)return;if(s<a)return 1}}}function le(e,t){var n=this;this.taskQueue=[],this.count=1,this.maxCount=2,this.addTask=function(e){n.taskQueue.push(e)},this.fireTask=function(){var e=n.taskQueue.length;n.count>n.maxCount||0===e||(n.count=n.count+1,(e=n.taskQueue.shift())&&n.sendRequest(e.options,null==e?void 0:e.success,null==e?void 0:e.fail))},this.complete=function(){1<n.count&&(n.count=n.count-1),n.fireTask()},t&&(this.maxCount=t),this.sendRequest=e}function i(e){return Ce=Ce||g.getSystemInfoSync().SDKVersion,ce(Ce,"1.1.1")&&g.canIUse?g.canIUse(e):!!g[e]}function ue(e){for(var t,n={unknown:/unknown|none/i,wifi:/wifi/i,net2g:/2g/i,net3g:/3g/i,net4g:/4g/i,net5g:/5g/i,net6g:/6g/i},r=c.unknown,o=0;o<Object.keys(n).length;o++){var i=Object.keys(n)[o];if(null!=(t=n[i])&&t.test(e)){r=c[i];break}}return r}function fe(e){var t=e.apiName,n=S[t];n?n.hackCloudReq.addCallback(e):(n=x.cloud[t],S[t]={hackCloudReq:new qe(e),originApi:n}),S[t]}function pe(e){var t=e.apiName,n=T[t];n?n.hackReq.addCallback(e):(n=wx[t],T[t]={hackReq:new Ie(e),originApi:n}),T[t]}var v,a,c,b,u,de,he,ge,me,ye=["ret","retcode","code","errcode"],ve=function(){var n=new WeakSet;return function(e,t){if(t instanceof Error)return"Error.message: "+t.message+" \n Error.stack: "+t.stack;if("object"==typeof t&&null!==t){if(n.has(t))return"[Circular "+(e||"root")+"]";n.add(t)}return t}},E=function(e){if("string"==typeof e)return e;try{return e instanceof Error?(JSON.stringify(e,ve(),4)||"undefined").replace(/"/gim,""):JSON.stringify(e,ve(),4)||"undefined"}catch(e){return"error happen when aegis stringify: \n "+e.message+" \n "+e.stack}},be=function(n,r){void 0===r&&(r=3);var o,i,a,s="";return Array.isArray(n)?(s+="[",o=n.length,n.forEach(function(e,t){s=(s+="object"==typeof e&&1<r?be(e,r-1):Oe(e))+(t===o-1?"":",")}),s+="]"):n instanceof Object?(s="{",i=Object.keys(n),a=i.length,i.forEach(function(e,t){"object"==typeof n[e]&&1<r?s+='"'+e+'":'+be(n[e],r-1):s+=Ee(e,n[e]),s+=t===a-1||t<a-1&&void 0===n[i[t+1]]?"":","}),s+="}"):s+=n,s},Ee=function(e,t){var n=typeof t,r="";return"string"==n||"object"==n?r+='"'+e+'":"'+t+'"':"function"==typeof t?r+='"'+e+'":"function '+t.name+'"':"symbol"==typeof t?r+='"'+e+'":"symbol"':"number"!=typeof t&&"boolean"!=n||(r+='"'+e+'": '+t),r},Oe=function(e){var t=typeof e;return""+("undefined"==t||"symbol"==t||"function"==t?"null":"string"==t||"object"==t?'"'+e+'"':e)},Re=/data:(image|text|application|font)\/.*;base64/,we=((l=v=v||{}).INFO_ALL="-1",l.API_RESPONSE="1",l.INFO="2",l.ERROR="4",l.PROMISE_ERROR="8",l.AJAX_ERROR="16",l.SCRIPT_ERROR="32",l.IMAGE_ERROR="64",l.CSS_ERROR="128",l.CONSOLE_ERROR="256",l.MEDIA_ERROR="512",l.RET_ERROR="1024",l.REPORT="2048",l.PV="4096",l.EVENT="8192",l.PAGE_NOT_FOUND_ERROR="16384",l.WEBSOCKET_ERROR="32768",l.BRIDGE_ERROR="65536",l.LAZY_LOAD_ERROR="131072",(l=a=a||{})[l.android=1]="android",l[l.ios=2]="ios",l[l.windows=3]="windows",l[l.macos=4]="macos",l[l.linux=5]="linux",l[l.devtools=6]="devtools",l[l.other=100]="other",(l=c=c||{})[l.unknown=100]="unknown",l[l.wifi=1]="wifi",l[l.net2g=2]="net2g",l[l.net3g=3]="net3g",l[l.net4g=4]="net4g",l[l.net5g=5]="net5g",l[l.net6g=6]="net6g",(l=b=b||{}).LOG="log",l.SPEED="speed",l.PERFORMANCE="performance",l.OFFLINE="offline",l.WHITE_LIST="whiteList",l.VITALS="vitals",l.PV="pv",l.CUSTOM_PV="customPV",l.EVENT="event",l.CUSTOM="custom",l.SDK_ERROR="sdkError",l.SET_DATA="setData",l.LOAD_PACKAGE="loadPackage",(l=u=u||{}).production="production",l.development="development",l.gray="gray",l.pre="pre",l.daily="daily",l.local="local",l.test="test",l.others="others",function(e){return e.filter(function(n,r){return"static"!==n.type||!e.find(function(e,t){return n.url===e.url&&200===n.status&&r<t})})}),xe=function(e){e.level===v.INFO_ALL&&(e.level=v.INFO)},O={},R={},Se=function(e){return O[e]||(O[e]=setTimeout(function(){R[e]={},O[e]=null},6e4)),O[e]},Te=function(e){return(Array.isArray(e)?e:[e]).map(function(n){return Object.getOwnPropertyNames(n).reduce(function(e,t){return"ctx"!==t&&(e[t]=n[t]),e},{level:v.INFO,msg:""})})},Pe=function(r){return function(e){return r.sendPipeline([function(e,n){return n({url:r.config.url||"",data:Q(Te(e)),method:"post",contentType:"application/json",type:b.LOG,log:e,requestConfig:{timeout:5e3},success:function(){var t=r.config.onReport;"function"==typeof t&&e.forEach(function(e){t(e)}),"function"==typeof n&&n([])}})}],b.LOG)(e)}},ke=function(){},l=(Object.defineProperty(L.prototype,"__version__",{get:function(){return"1.38.6"},enumerable:!1,configurable:!0}),Object.defineProperty(L.prototype,"LogType",{get:function(){return v},enumerable:!1,configurable:!0}),L.prototype.init=function(e){this.setConfig(e);for(var t=0;t<L.installedPlugins.length;t++)try{L.installedPlugins[t].patch(this)}catch(e){this.sendSDKError(e)}this.lifeCycle.emit("onInited")},L.prototype.setConfig=function(e){Object.assign(this.config,e);var e=this.config,t=e.id,n=e.uin,r=e.version,o=e.ext1,i=e.ext2,a=e.ext3,s=e.aid,c=e.env,l=void 0===c?"production":c,c=e.pageUrl,e=this.bean.id!==t||this.bean.uin!==n||this.bean.aid!==s;return this.bean.id=t||"",this.bean.uin=n||"",this.bean.version=r||"1.38.6",this.bean.aid=s||"",this.bean.env=function(){switch(l){case u.production:case u.development:case u.gray:case u.pre:case u.daily:case u.local:case u.test:case u.others:return 1;default:return}}()?l:u.others,c&&this.extendBean("from",encodeURIComponent(c.slice(0,2048))),o&&this.extendBean("ext1",encodeURIComponent(o)),i&&this.extendBean("ext2",encodeURIComponent(i)),a&&this.extendBean("ext3",encodeURIComponent(a)),e&&this.lifeCycle.emit("onConfigChange",this.config),this.config},L.use=function(e){-1===L.installedPlugins.indexOf(e)&&e.aegisPlugin&&L.installedPlugins.push(e)},L.unuse=function(e){e=L.installedPlugins.indexOf(e);-1!==e&&L.installedPlugins.splice(e,1)},L.prototype.info=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];var n={level:v.INFO,msg:e};1===e.length&&e[0].msg&&Object.assign(n,p({},e[0]),{level:v.INFO}),this.normalLogPipeline(n)},L.prototype.infoAll=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];var n={level:v.INFO_ALL,msg:e};1===e.length&&e[0].msg&&Object.assign(n,p({},e[0]),{level:v.INFO_ALL}),this.normalLogPipeline(n)},L.prototype.report=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];var n={level:v.REPORT,msg:e};1===e.length&&e[0].msg&&Object.assign(n,p({},e[0])),this.normalLogPipeline(n)},L.prototype.error=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];var n={level:v.ERROR,msg:e};1===e.length&&e[0].msg&&Object.assign(n,p({},e[0]),{level:v.ERROR}),this.normalLogPipeline(n)},L.prototype.speedLogPipeline=function(e){throw new Error('You need to override "speedLogPipeline" method')},L.prototype.reportPv=function(e){e&&console.warn("reportPv is deprecated, please use reportEvent")},L.prototype.reportEvent=function(e){e&&((e="string"==typeof e?{name:e,ext1:this.config.ext1||"",ext2:this.config.ext2||"",ext3:this.config.ext3||""}:e).name?("string"!=typeof e.name&&(console.warn("reportEvent params name must be string"),e.name=String(e.name)),this.eventPipeline(e)):console.warn("reportEvent params error"))},L.prototype.reportTime=function(e,t){if("object"==typeof e)return this.reportT(e);"string"==typeof e?"number"==typeof t?t<0||6e4<t?console.warn("reportTime: duration must between 0 and 60000"):this.submitCustomTime(e,t):console.warn("reportTime: second param must be number"):console.warn("reportTime: first param must be a string")},L.prototype.reportT=function(e){var t=e.name,n=e.duration,r=e.ext1,r=void 0===r?"":r,o=e.ext2,o=void 0===o?"":o,i=e.ext3,i=void 0===i?"":i,e=e.from;if("string"==typeof t&&"number"==typeof n&&"string"==typeof r&&"string"==typeof o&&"string"==typeof i){if(!(n<0||6e4<n))return this.submitCustomTime(t,n,r,o,i,void 0===e?"":e);console.warn("reportTime: duration must between 0 and 60000")}else console.warn("reportTime: params error")},L.prototype.time=function(e){"string"==typeof e?this.timeMap[e]?console.warn("Timer "+e+" already exists"):this.timeMap[e]=Date.now():console.warn("time: first param must be a string")},L.prototype.timeEnd=function(e){"string"==typeof e?this.timeMap[e]?(this.submitCustomTime(e,Date.now()-this.timeMap[e]),delete this.timeMap[e]):console.warn("Timer "+e+" does not exist"):console.warn("timeEnd: first param must be a string")},L.prototype.submitCustomTime=function(e,t,n,r,o,i){this.customTimePipeline({name:e,duration:t,ext1:n||this.config.ext1,ext2:r||this.config.ext2,ext3:o||this.config.ext3,from:i||void 0})},L.prototype.extendBean=function(e,t){this.bean[e]=t},L.prototype.sendPipeline=function(e,t){var n,i=this;return y(_([function(e,t){if("number"!=typeof n.config.random&&(console.warn("random must in [0, 1], default is 1."),n.config.random=1),!n.isHidden||!n.isGetSample)if(n.isGetSample)n.isHidden||t(e);else{if(n.isGetSample=!0,Math.random()<n.config.random)return n.isHidden=!1,t(e);n.isHidden=!0}},re(n=this,t)],e,[oe(this),function(r,o){i.request(r,function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];var n=!1;-1<(""+e[i.failRequestCount=0]).indexOf("403 forbidden")&&(n=!0,i.destroy()),o({isErr:n,result:e,logType:null==r?void 0:r.type,logs:null==r?void 0:r.log}),null!=(n=null==r?void 0:r.success)&&n.call.apply(n,_([r],e))},function(){for(var e,t=[],n=0;n<arguments.length;n++)t[n]=arguments[n];60<=++i.failRequestCount&&i.destroy(),-1<(""+t[0]).indexOf("403 forbidden")&&i.destroy(),o({isErr:!0,result:t,logType:null==r?void 0:r.type,logs:null==r?void 0:r.log}),null!=(e=null==r?void 0:r.fail)&&e.call.apply(e,_([r],t))})},ie(this)]))},L.prototype.send=function(e,o,i){var t=this;return y([oe(this),function(n,r){t.request(n,function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];r({isErr:!1,result:e,logType:n.type,logs:n.log}),null!=o&&o.apply(void 0,e)},function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];r({isErr:!0,result:e,logType:n.type,logs:n.log}),null!=i&&i.apply(void 0,e)})},ie(this)])(e)},L.prototype.ready=function(e,t,n){throw new Error('You need to override "ready" method')},L.prototype.request=function(e,t,n){throw new Error('You need to override "request" method')},L.prototype.sendSDKError=function(e){var n=this;this.sendPipeline([function(e,t){t({url:n.config.url+"?id=1085&msg[0]="+encodeURIComponent(E(e))+"&level[0]=2&from="+n.config.id+"&count=1&version="+n.config.id+"(1.38.6)",addBean:!1,method:"get",type:b.SDK_ERROR,log:e})}],b.SDK_ERROR)(e)},L.prototype.destroy=function(e){void 0===e&&(e=!1);var t,n,r=L.instances.indexOf(this);-1!==r&&L.instances.splice(r,1);for(var o=L.installedPlugins.length-1;0<=o;o--)try{L.installedPlugins[o].unpatch(this)}catch(e){this.sendSDKError(e)}if(this.lifeCycle.emit("destroy"),this.lifeCycle.clear(),e)t=this,n=Object.getOwnPropertyDescriptors(t),Object.keys(n).forEach(function(e){n[e].writable&&(t[e]=null)}),Object.setPrototypeOf(this,null);else{for(var i=this;i.constructor!==Object&&ae(i,this),i=Object.getPrototypeOf(i););0===L.instances.length&&(r=Object.getPrototypeOf(this).constructor,ae(r),ae(L))}},L.version="1.38.6",L.instances=[],L.logType=v,L.environment=u,L.installedPlugins=[],L),f=(A.prototype.patch=function(e){this.canUse(e)&&this.exist(e)&&(this.instances.push(e),this.triggerInit(e),this.triggerOnNewAegis(e))},A.prototype.unpatch=function(e){var t=this.instances.indexOf(e);-1!==t&&(this.instances.splice(t,1),0===this.instances.length)&&this.uninstall(e)},A.prototype.countInstance=function(){return this.instances.length},A.prototype.uninstall=function(e){var t;null!=(t=null==(t=this.option)?void 0:t.destroy)&&t.apply(this,[e])},A.prototype.walk=function(n){var r=this;this.instances.forEach(function(e){var t=r.canUse(e);t&&n(e,t)})},A.prototype.canUse=function(e){e=this.getConfig(e);return!(!e||"object"!=typeof e)||!!e},A.prototype.getConfig=function(e){return null==(e=e.config)?void 0:e[this.name]},A.prototype.exist=function(e){return-1===this.instances.indexOf(e)},A.prototype.triggerInit=function(e){var t;this.inited||(this.inited=!0,null==(t=null==(t=this.option)?void 0:t.init))||t.call(this.option,this.getConfig(e))},A.prototype.triggerOnNewAegis=function(e){var t;null!=(t=null==(t=this.option)?void 0:t.onNewAegis)&&t.call(this.option,e,this.getConfig(e))},A),g=wx||qq,Ce="",Ne=new f({name:"device",onNewAegis:function(t){return e=this,c=function(){return H(this,function(e){return this.setSystemInfo(t),this.setNetworkType(t),this.setNetworkChange(t),[2]})},new(s=(s=a=void 0)||Promise)(function(n,t){function r(e){try{i(c.next(e))}catch(e){t(e)}}function o(e){try{i(c.throw(e))}catch(e){t(e)}}function i(e){var t;e.done?n(e.value):((t=e.value)instanceof s?t:new s(function(e){e(t)})).then(r,o)}i((c=c.apply(e,a||[])).next())});var e,a,s,c},setSystemInfo:function(a){var s=this;try{i("getSystemInfo")&&g.getSystemInfo({success:function(e){var t=e.platform,n=e.model,r=e.windowHeight,o=e.windowWidth,i=e.screenWidth,i=void 0===i?0:i,e=e.screenHeight,e=void 0===e?0:e;a.extendBean("platform",s.getPlatFormType(t)),a.extendBean("model",n),a.extendBean("vp",Math.round(o)+" * "+Math.round(r)),a.extendBean("sr",Math.round(i)+" * "+Math.round(e))}})}catch(a){}},getPlatFormType:function(e){for(var t,n={android:/android/i,ios:/ios/i,windows:/windows/i,macos:/mac/i,devtools:/devtools/i},r=a.other,o=0;o<Object.keys(n).length;o++){var i=Object.keys(n)[o];if(null!=(t=n[i])&&t.test(e)){r=a[i];break}}return r},setNetworkChange:function(t){i("onNetworkStatusChange")&&g.onNetworkStatusChange(function(e){e=ue(e.networkType);t.extendBean("netType",e)})},setNetworkType:function(t){i("getNetworkType")&&g.getNetworkType({success:function(e){e=ue(e.networkType);t.extendBean("netType",e)}})}}),Ae=g.request,l=(e(N,ge=l),Object.defineProperty(N.prototype,"getBean",{get:function(){var t=this;return this.bean?Object.getOwnPropertyNames(this.bean).map(function(e){return e+"="+t.bean[e]}).join("&")+"&from="+encodeURIComponent(se(this.config)):"from="+encodeURIComponent(se(this.config))},enumerable:!1,configurable:!0}),N.prototype.initRequestSchedule=function(){this.requestSchedule=new le(this.sendRequest)},N.prototype.uploadLogs=function(e,t){this.lifeCycle.emit("uploadLogs",e=void 0===e?{}:e,t=void 0===t?{}:t)},N.prototype.reportPv=function(e){var t,n=this;e&&(t=Object.getOwnPropertyNames(this.bean).filter(function(e){return"id"!==e}).map(function(e){return e+"="+n.bean[e]}).join("&")+"&from="+encodeURIComponent(se(this.config)),this.send({url:this.config.url+"/"+e+"?"+t,addBean:!1,type:b.CUSTOM_PV,log:b.CUSTOM_PV},function(){},function(){}))},N.sessionID="session-"+Date.now(),N.asyncPluginIndex=0,N),Le=new f({name:"aid",onNewAegis:function(t){this.initAid(function(e){t.bean.aid=e,t.config.aid=e})},initAid:function(t){g.getStorage({key:"AEGIS_ID",success:function(e){t(e.data)},fail:function(){var e="xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,function(e){var t=16*Math.random()|0;return("x"===e?t:3&t|8).toString(16)});g.setStorage({key:"AEGIS_ID",data:e,success:function(){t(e)}})}})}}),w=(C.prototype.addCallback=function(e){e&&this.callbacks.push(e)},C.prototype.prefixHandler=function(e){return p(p({},e),{aegisRequestStartTime:+new Date})},C.prototype.onStartHandler=function(n){var e;this.callbacks.forEach(function(e){var t;try{null!=(t=e.onStart)&&t.call(e,n)}catch(e){}}),null!=(e=n.onStart)&&e.call(n,n)},C.prototype.successHandler=function(n,r){var e;this.callbacks.forEach(function(e){var t;try{null!=(t=e.success)&&t.call(e,n,r)}catch(e){}}),null!=(e=r.success)&&e.call(r,n,r)},C.prototype.failHandler=function(n,r){var e;this.callbacks.forEach(function(e){var t;try{null!=(t=e.fail)&&t.call(e,n,r)}catch(e){}}),null!=(e=r.fail)&&e.call(r,n,r)},C.prototype.completeHandler=function(n,r){var e;this.callbacks.forEach(function(e){var t;try{null!=(t=e.complete)&&t.call(e,n,r)}catch(e){}}),null!=(e=r.complete)&&e.call(r,n,r)},C.prototype.override=function(){try{this.defineApiProperty()}catch(e){console.warn("cannot override `"+this.apiName+"`, error is: "+e)}finally{this.isOverride=!0}},C),x=wx||qq,S={},qe=(e(k,he=w),k.prototype.defineApiProperty=function(){var e=this;x.cloud&&x.cloud[this.apiName]&&Object.defineProperty(x.cloud,this.apiName,{get:function(){return e.hackHandler.bind(e)}})},k.prototype.hackHandler=function(e){var r=this,o=this.prefixHandler(e);return new Promise(function(t,n){var e=null==(e=S[r.apiName])?void 0:e.originApi;null!=e&&e(p(p({},o),{success:function(e){r.successHandler(e,o),t(e)},fail:function(e){r.failHandler(e,o),n(e)},complete:function(e){r.completeHandler(e,o)}}))})},k),Ue=wx||qq,T={},Ie=(e(P,de=w),P.prototype.defineApiProperty=function(){var e=this;Object.defineProperty(Ue,this.apiName,{get:function(){return e.hackHandler.bind(e)}})},P.prototype.hackHandler=function(e){var t=this,n=this.prefixHandler(e),e=(this.onStartHandler(n),null==(e=T[this.apiName])?void 0:e.originApi);return null==e?void 0:e(p(p({},n),{success:function(e){t.successHandler(e,n)},fail:function(e){t.failHandler(e,n)},complete:function(e){t.completeHandler(e,n)}}))},P),je=wx||qq,He=je.request;function P(){return null!==de&&de.apply(this,arguments)||this}function k(){return null!==he&&he.apply(this,arguments)||this}function C(e){this.callbacks=[],this.isOverride=!1;var t=e.apiName;this.apiName=t,this.isOverride||this.override(),this.callbacks.push(e)}function N(e){var r,a,u=ge.call(this,e)||this;u.originRequest=Ae,u.speedLogPipeline=y([(a=u.config,function(e,t){var n,r,o,i="number"==typeof a.repeat?a.repeat:60;!a.speedSample||i<=0?t(e):(n=(null==a?void 0:a.id)||"0",r=R[n]||{},Array.isArray(e)?(o=e.filter(function(e){var t=!r[e.url]||r[e.url]<i;return t?(r[e.url]=1+~~r[e.url],R[n]=r):O[n]||Se(n),t})).length&&t(o):!r[e.url]||r[e.url]<i?(r[e.url]=1+~~r[e.url],R[n]=r,t(e)):O[n]||Se(n))}),m(u),function(t,n){i("getNetworkType")?g.getNetworkType({success:function(e){e=ue(e.networkType);r.extendBean("netType",e),n(t)}}):n(t)},function(e,t){u.lifeCycle.emit("beforeReportSpeed",e);var n=u.config.beforeReportSpeed;if((e="function"==typeof n?e.filter(function(e){return!1!==n(e)}):e).length)return t(e)},re(r=u,b.SPEED),function(e,t){t(e.map(function(e){return void 0!==e.payload&&delete e.payload,e}))},function(e){var t,n,r,o;u.send({url:""+u.config.speedUrl,method:"post",data:(e=e,t=u.bean,r={fetch:[],static:[],bridge:[]},o={},Array.isArray(e)?e.forEach(function(e){var t;null!=(t=r[e.type])&&t.push(e)}):null!=(n=r[e.type])&&n.push(e),o.payload=JSON.stringify(p({duration:r},t)),o)})}]),u.request=function(e,t,n){e.url&&u.bean.id&&(!/^\w{8}-\w{4}-\w{4}-\w{4}-\w{12}$/.test(String(u.bean.aid))||i("getNetworkType")&&void 0===u.bean.netType?u.requestSchedule.addTask({options:e,success:t,fail:n}):(u.requestSchedule.addTask({options:e,success:t,fail:n}),u.requestSchedule.fireTask()))},u.sendRequest=function(e,t,n){var r,o,i,a=e.url,s=(u.config.whiteListUrl===a&&(r=t,t=function(e){null!=r&&r(JSON.stringify(e.data))}),e.method),s=void 0===s?"get":s,c=(!1!==e.addBean&&(a=a+(-1===(null==a?void 0:a.indexOf("?"))?"?":"&")+u.getBean),e),l=u.config.onBeforeRequest;return(c=l?l(e,u):c)&&c.url?(l=u.config.enableHttp2||!1,"get"===s?(s=a,o=c.data,a="string"!=typeof s?"":"object"==typeof o&&o?(i=Object.getOwnPropertyNames(o).map(function(e){var t=o[e];return e+"="+("string"==typeof t?encodeURIComponent(t):encodeURIComponent(JSON.stringify(t)))}).join("&").replace(/eval/gi,"evaI"),s+(-1===s.indexOf("?")?"?":"&")+i):s,u.originRequest(p({url:a,enableHttp2:l,success:t,fail:n,complete:u.requestSchedule.complete},e.requestConfig))):("string"==typeof c.data&&(c.data=c.data.replace(/eval/gi,"evaI")),u.originRequest(p({url:a,enableHttp2:l,header:c.contentType?{"content-type":c.contentType}:void 0,method:"POST",data:c.data,success:t,fail:n,complete:u.requestSchedule.complete},e.requestConfig))),!0):(i="",c&&c.url||(i="Sending request blocked. Please handle the parameters reasonably, options.url is necessary",console.log(i)),null!=n&&n(i),u.requestSchedule.complete(),!1)};try{u.initRequestSchedule(),u.init(e),u.extendBean("sessionId",N.sessionID),u.extendBean("referer",(i("getLaunchOptionsSync")?g.getLaunchOptionsSync():{scene:""}).scene||"")}catch(e){console.warn(e),console.log("%cThe above error occurred in the process of initializing Aegis, which will affect your normal use of Aegis.\nIt is recommended that you contact us for feedback and thank you for your support.","color: red"),u.sendSDKError(e)}return u}function A(e){this.aegisPlugin=!0,this.name="",this.instances=[],this.inited=!1,e.$walk=this.walk.bind(this),e.$getConfig=this.getConfig.bind(this),this.option=e,this.name=e.name}function L(e){var n,t,r,o,a,i,s,c,l,u,f,p,d,h,g=this;this.isGetSample=!1,this.isHidden=!1,this.config={version:0,delay:1e3,onError:!0,repeat:60,random:1,aid:!0,device:!0,pagePerformance:!0,webVitals:!0,speedSample:!0,onClose:!0,reportLoadPackageSpeed:!0,hostUrl:"https://aegis.qq.com",env:"production",url:"",offlineUrl:"",whiteListUrl:"",pvUrl:"",speedUrl:"",customTimeUrl:"",performanceUrl:"",performanceUrlForHippy:"",webVitalsUrl:"",eventUrl:"",setDataReportUrl:"",reportImmediately:!0},this.isWhiteList=!1,this.lifeCycle=new B,this.bean={},this.normalLogPipeline=y([m(this,5),ne,function(e,t){var r=n.config;t(e=e.map(function(e){var t,n=r.maxLength||102400;try{if(!e.msg||e.msg.length<=n)return e;e.msg=null==(t=e.msg)?void 0:t.substring(0,n)}catch(t){e.msg=E(e.msg).substring(0,r.maxLength)}return e}))},(h=(n=this).config,function(e,t){var n="number"==typeof h.repeat?h.repeat:60;if(n<=0)return t(e);var r=(null==h?void 0:h.id)+"_error",o=R[r]||{};t(e.filter(function(e){if(e.level===v.ERROR||e.level===v.PROMISE_ERROR||e.level===v.AJAX_ERROR||e.level===v.SCRIPT_ERROR||e.level===v.IMAGE_ERROR||e.level===v.CSS_ERROR||e.level===v.MEDIA_ERROR||e.level===v.RET_ERROR||e.level===v.BRIDGE_ERROR||e.level===v.PAGE_NOT_FOUND_ERROR||e.level===v.WEBSOCKET_ERROR||e.level===v.LAZY_LOAD_ERROR){e=e.msg.slice(0,200);if(o[e]>n)return O[r]||Se(r),!1;o[e]=1+~~o[e],R[r]=o}return!0}))}),(p=this.lifeCycle.emit,d=this.config,function(e,t){var n,r=d.logCreated;return"function"==typeof r?(n=e.filter(function(e){return!1!==r(e)}),p("beforeWrite",n),t(n)):(p("beforeWrite",e),t(e))}),(f=this,setTimeout(function(){var e=f.config,t=e.pvUrl,n=void 0===t?"":t,t=e.spa,e=-1<["web-sdk","mp-sdk"].indexOf("mp-sdk");n&&(e&&!t||!e)&&f.sendPipeline([function(e,t){t({url:n,type:b.PV})}],b.PV)(null)},100),function(e,t){t(e)}),(l=c=s=!1,u=[],(a=this).lifeCycle.on("onConfigChange",function(){i&&clearTimeout(i),i=setTimeout(function(){var e,n;!l&&a.config&&(l=!0,e=a.config.whiteListUrl,(n=void 0===e?"":e)&&a.sendPipeline([function(e,t){t({url:n,type:b.WHITE_LIST,success:function(e){c=!0;try{var t=e.data||JSON.parse(e),n=t.retcode,r=t.result,o=void 0===r?{}:r,i=(0===n&&(s=o.is_in_white_list,a.isWhiteList=s,0<=o.rate)&&o.rate<=1&&(a.config.random=o.rate,a.isGetSample=!1),a.isWhiteList&&u.length?Pe(a)(u.splice(0),function(){}):!a.isWhiteList&&u.length&&(u.length=0),a.config.onWhitelist);"function"==typeof i&&i(s)}catch(e){}},fail:function(){c=!0}})}],b.WHITE_LIST)(null),l=!1)},a.config.uin?50:500)}),a.lifeCycle.on("destroy",function(){u.length=0}),function(e,t){var n;s||null!=(n=null==(n=a.config)?void 0:n.api)&&n.reportRequest?t(e.concat(u.splice(0)).map(function(e){return xe(e),e})):(n=e.filter(function(e){return e.level!==v.INFO&&e.level!==v.API_RESPONSE?(xe(e),!0):(c||(u.push(e),200<=u.length&&(u.length=200)),!1)})).length&&t(n)}),function(e,t){try{var n=JSON.parse(JSON.stringify(e)),r=(g.lifeCycle.emit("beforeReport",n),g.config.beforeReport);(e="function"==typeof r?e.filter(function(e){return!1!==r(e)}):e).length&&t(e)}catch(e){}},Pe(this)]),this.eventPipeline=y([m(this,10),(o=this,function(e){o.sendPipeline([function(e,t){var n=e.map(function(e){return{name:e.name,ext1:e.ext1||o.config.ext1||"",ext2:e.ext2||o.config.ext2||"",ext3:e.ext3||o.config.ext3||""}});t({url:o.config.eventUrl+"?payload="+encodeURIComponent(JSON.stringify(n)),type:b.EVENT,log:e})}],b.EVENT)(e)})]),this.timeMap={},this.failRequestCount=0,this.customTimePipeline=y([m(this,10),(r=this,function(e){return r.sendPipeline([function(e,t){t({url:r.config.customTimeUrl+"?payload="+encodeURIComponent(JSON.stringify({custom:e})),type:b.CUSTOM,log:e})}],b.CUSTOM)(e)})]),this.config=(t=this.config,void 0===(e=e.hostUrl)&&(e="https://aegis.qq.com"),t.url=t.url||e+"/collect",t.offlineUrl=t.offlineUrl||e+"/offline",t.whiteListUrl=t.whiteListUrl||e+"/collect/whitelist",t.pvUrl=t.pvUrl||e+"/collect/pv",t.eventUrl=t.eventUrl||e+"/collect/events",t.speedUrl=t.speedUrl||e+"/speed",t.customTimeUrl=t.customTimeUrl||e+"/speed/custom",t.performanceUrl=t.performanceUrl||e+"/speed/performance",t.performanceUrlForHippy=t.performanceUrlForHippy||e+"/speed/hippyPerformance",t.webVitalsUrl=t.webVitalsUrl||e+"/speed/webvitals",t.setDataReportUrl=t.SetDataReportUrl||e+"/speed/miniProgramData",t),L.instances.push(this)}function _e(){return null!==me&&me.apply(this,arguments)||this}e(_e,me=w),_e.prototype.defineApiProperty=function(){var e=this;Object.defineProperty(je,"request",{get:function(){return e.hackHandler.bind(e)}})};function q(r,e,o){return null!=e&&e.length&&"object"==typeof r?e.reduce(function(e,t){var n=r[t];return n?e+(""===e?"\n":"\n\n")+o+" header "+t+": "+n:e},""):""}var U,Me,De=new f({name:"reportApiSpeed",override:!(_e.prototype.hackHandler=function(e){var t=this,n=this.prefixHandler(e);return this.onStartHandler(n),He(p(p({},n),{success:function(e){t.successHandler(e,n)},fail:function(e){t.failHandler(e,n)},complete:function(e){t.completeHandler(e,n)}}))}),onNewAegis:function(e){var t,n;this.override||(null!=(n=(e.config||{}).api)&&n.injectTraceHeader&&(this.traceRequestHeader=new Z(n.injectTraceHeader,null!=(t=null==n?void 0:n.injectTraceIgnoreUrls)?t:[],null==n?void 0:n.injectTraceUrls)),this.override=!0,this.hackRequest(e.config),this.overrideCallFunction(e.config),this.overrideCallContainer(e.config))},hackRequest:function(u){var f=this;pe({apiName:"request",onStart:function(e){var t=((null==u?void 0:u.api)||{}).injectTraceHeader,n=(e||{}).url;t&&(t={host:((t=/^(?:([A-Za-z]+):)?(\/{0,3})([0-9.\-A-Za-z]+)(?::(\d+))?(?:\/([^?#]*))?(?:\?([^#]*))?(?:#(.*))?$/.exec(t=n)||[])[1],t[2],[t[3],t[4],t[5]][0]),pathname:(t=getCurrentPages()).length?t[t.length-1].route:""},t=(n=f.traceRequestHeader.generate(n,{},{host:t.host,pathname:t.pathname})||{}).name,n=n.value,t)&&n&&e&&(e.header=p(p({},e.header),((e={})[t]=n,e)))},success:function(e,t){var n,r,o,i,a,s,c,l;h(t.url,u.hostUrl)||(n={method:t.method||"get",url:X(t.url),duration:Date.now()-t.aegisRequestStartTime,status:e.statusCode||0,nextHopProtocol:"",isHttps:ee(t.url),type:"fetch"},i=null==(i=u.api)?void 0:i.apiDetail,r=(o=te(e.data,u.api,{url:t.url,ctx:e,payload:t.data})||{}).code,o=o.isErr,l=i?d(t.data,null==(l=u.api)?void 0:l.reqParamHandler,{url:t.url}):"",i=i?d(e.data,null==(i=u.api)?void 0:i.resBodyHandler,{url:t.url}):"",a=(null==(a=u.api)?void 0:a.reqHeaders)||[],a=q(null==t?void 0:t.header,a,"req"),s=(null==(s=u.api)?void 0:s.resHeaders)||[],s=q(null==e?void 0:e.header,s,"res"),c=K(null==t?void 0:t.header),l="req url: "+n.url+" \n \nres status: "+(e.statusCode||0)+" \n \nres duration: "+n.duration+"ms \n \nreq method: "+n.method+" \n \nreq param: "+l+" \n \nres retcode: "+r+" \n \nres data: "+i+"\n "+a+"\n "+s,n.ret=r,n.isErr=+o,n.payload=t.data,f.publishNormalLog({msg:l,level:o?v.RET_ERROR:v.API_RESPONSE,ctx:e,trace:c}),f.publishSpeedLog(n))},fail:function(e,t){h(t.url,u.hostUrl)||(t={method:t.method||"get",url:X(t.url),duration:Date.now()-t.aegisRequestStartTime,status:0,nextHopProtocol:"",isHttps:ee(t.url),type:"fetch"},f.publishSpeedLog(t))}})},overrideCallFunction:function(n){var r=this;fe({apiName:"callFunction",success:function(e,t){r.cloudSuccessCallback(n,t,e,"callFunction")},fail:function(e,t){t={method:"call",url:"wx.cloud.callFunction."+t.name,duration:Date.now()-t.aegisRequestStartTime,status:0,nextHopProtocol:"",type:"fetch",errMsg:e.errMsg,isHttps:!0};r.publishSpeedLog(t)}})},overrideCallContainer:function(n){var r=this;fe({apiName:"callContainer",success:function(e,t){r.cloudSuccessCallback(n,t,e,"callContainer")},fail:function(e,t){t={method:"call",url:"wx.cloud.callContainer."+t.path,duration:Date.now()-t.aegisRequestStartTime,status:0,nextHopProtocol:"",type:"fetch",errMsg:e.errMsg,isHttps:!0};r.publishSpeedLog(t)}})},cloudSuccessCallback:function(e,n,t,r){var o="callFunction"===r?n.name:n.path,i="callFunction"===r?t.result:t.data,o={method:"call",url:"wx.cloud."+r+"."+o,duration:Date.now()-n.aegisRequestStartTime,status:200,nextHopProtocol:"",type:"fetch",isHttps:!0},a=["apiName","aegisRequestStartTime","config","success","fail","complete"],s=Object.keys(n).reduce(function(e,t){return a.includes(t)||(e[t]=n[t]),e},{}),r="callFunction"===r?(null==(r=t.data)?void 0:r.code)||0:t.statusCode,c=te(i,e.api,{url:o.url,ctx:t,payload:s})||{},l=c.code,c=c.isErr,c=void 0!==c&&c,l=(o.ret=l,o.isErr=+c,o.payload=s,null==(l=e.api)?void 0:l.apiDetail),s=l?d(s,null==(s=e.api)?void 0:s.reqParamHandler,{url:o.url}):"",i=l?d(i,null==(l=e.api)?void 0:l.resBodyHandler,{url:o.url}):"",l=(null==(l=e.api)?void 0:l.reqHeaders)||[],l=q(null==n?void 0:n.header,l,"req"),e=(null==(e=e.api)?void 0:e.resHeaders)||[],e=q(null==t?void 0:t.header,e,"res"),u=K(null==n?void 0:n.header),r="req url: "+o.url+"\n \nres status: "+r+"\n \nres duration: "+o.duration+"ms \n \nreq type: "+o.type+"\n \nreq params: "+s+"\n \nres retcode: "+o.ret+"\n \nres data: "+i+"\n "+l+"\n "+e;this.publishNormalLog({msg:r,level:c?v.RET_ERROR:v.API_RESPONSE,ctx:t,trace:u}),this.publishSpeedLog(o)},publishSpeedLog:function(t){this.$walk(function(e){e.speedLogPipeline(t)})},publishNormalLog:function(t){this.$walk(function(e){e.normalLogPipeline(t)})}}),Fe=wx||qq,Be=Fe.connectSocket,We=(Ke.prototype.addConfig=function(e){var t=e.send,e=e.onError;t&&this.sends.push(t),e&&this.onErrors.push(e)},Ke.prototype.toHack=function(t){var o=this,n=(this.onErrors.forEach(function(e){t.onError(e)}),t.send);return Object.defineProperty(t,"send",{get:function(){return function(r){return new Promise(function(e){n.call(t,p(p({},r),{fail:function(n){o.sends.forEach(function(e){var t;null!=(t=e.fail)&&t.call(e,n,r)}),e(n)}}))})}}}),t},Ke),Ve=(e(I,Me=w),I.prototype.addTaskConf=function(e){this.taskHack.addConfig(e)},I.prototype.defineApiProperty=function(){var e=this;Object.defineProperty(Fe,"connectSocket",{get:function(){return e.hackHandler.bind(e)}})},I.prototype.hackHandler=function(e){var t=this,n=this.prefixHandler(e),e=Be(p(p({},n),{success:function(e){t.successHandler(e,n)},fail:function(e){t.failHandler(e,n)},complete:function(e){t.completeHandler(e,n)}}));return this.taskHack.toHack(e),e},I),w=new f({name:"onError",onNewAegis:function(e){var t=g.getSystemInfoSync().SDKVersion;this.listenError(),this.hackNetWork(e),this.hackCloud(e),e.config.websocketHack&&ce(t,"1.7.0")&&this.hackWsConnect()},listenError:function(){var t=this;"function"==typeof g.onError&&g.onError(function(e){e&&t.publishErrorLog({msg:e,level:v.ERROR})}),i("onUnhandledRejection")&&g.onUnhandledRejection(function(e){e=e.reason;!e||-1<JSON.stringify(e).indexOf("request:fail")||t.publishErrorLog({msg:e,level:v.PROMISE_ERROR})}),i("onPageNotFound")&&g.onPageNotFound(function(e){e&&t.publishErrorLog({msg:e,level:v.PAGE_NOT_FOUND_ERROR})}),i("onLazyLoadError")&&g.onLazyLoadError(function(e){e&&t.publishErrorLog({msg:e,level:v.LAZY_LOAD_ERROR})})},publishErrorLog:function(t){this.$walk(function(e){e.normalLogPipeline(t)})},hackNetWork:function(e){for(var n=this,r=e.config,t=0,o=[{apiName:"request",complete:function(e,t){return n.requestCompleteError(e,t,r)}},{apiName:"uploadFile",complete:function(e,t){return n.uploadFileCompleteError(e,t,r)}},{apiName:"downloadFile",complete:function(e,t){return n.downloadFileCompleteError(e,t,r)}}];t<o.length;t++){var i=o[t],a=i.apiName,i=i.complete;pe({apiName:a,complete:i})}},requestCompleteError:function(e,t,n){var r=e.errMsg,o=e.statusCode;h(t.url,n.hostUrl)||(r=this.getErrorType({errMsg:r,statusCode:o}))&&this.publishNetWorkError({apiName:"request",opts:t,res:e,config:n,type:r})},downloadFileCompleteError:function(e,t,n){var r=e.errMsg,o=e.statusCode,i=e.filePath,a=e.tempFilePath,r=this.getErrorType({errMsg:r,statusCode:o});r&&this.publishNetWorkError({apiName:"downloadFile",opts:t,res:e,config:n,type:r},{extraInfo:"\nres filePath: "+i+"\nres tempFilePath: "+a})},uploadFileCompleteError:function(e,t,n){var r=e.errMsg,o=e.statusCode,r=this.getErrorType({errMsg:r,statusCode:o});r&&this.publishNetWorkError({apiName:"uploadFile",opts:t,res:e,config:n,type:r})},hackCloud:function(e){for(var n=this,r=e.config,t=0,o=[{apiName:"callFunction",complete:function(e,t){return n.callFunctionCompleteError(e,t,r)}},{apiName:"callContainer",complete:function(e,t){return n.callContainerCompleteError(e,t,r)}}];t<o.length;t++){var i=o[t],a=i.apiName,i=i.complete;fe({apiName:a,complete:i})}},callFunctionCompleteError:function(e,t,n){var r=e.errMsg,r=this.getErrorType({errMsg:r});r&&this.publishNetWorkError({apiName:"cloud.callFunction",opts:t,res:e,config:n,type:r})},callContainerCompleteError:function(e,t,n){var r=e.errMsg,o=e.statusCode,r=this.getErrorType({errMsg:r,statusCode:o});r&&this.publishNetWorkError({apiName:"cloud.callContainer",opts:t,res:e,config:n,type:r})},publishNetWorkError:function(e,t){var t=(null==t?void 0:t.extraInfo)||"",n=e.apiName,r=e.opts,o=e.res,i=e.config,e=e.type,a=o.errMsg,s=o.statusCode,c=o.data,l=r.url,u=te(c,i.api,{url:l,ctx:o,payload:r.data}).code,f=null==(f=i.api)?void 0:f.apiDetail,p=f?d(r.data,null==(p=i.api)?void 0:p.reqParamHandler,{url:l}):"",c=f?d(c,null==(f=i.api)?void 0:f.resBodyHandler,{url:l}):"",l=(null==(f=i.api)?void 0:f.reqHeaders)||[],f=q(null==r?void 0:r.header,l,"req"),i=(null==(l=i.api)?void 0:l.resHeaders)||[],l=q(null==o?void 0:o.header,i,"res"),o=K(null==r?void 0:r.header);this.publishErrorLog({msg:"AJAX_ERROR: "+n+" "+e+"\n \nreq url: "+r.url+"\n \nres status: "+(s||0)+"\n \nres duration: "+(Date.now()-r.aegisRequestStartTime)+"ms\n \nreq method: "+(r.method||"get")+"\n \nreq param: "+p+"\n \nres retcode: "+u+"\n \nres data: "+c+"\n \nerrMsg: "+a.slice(0,1e3)+"\n "+t+"\n "+f+"\n "+l,level:v.AJAX_ERROR,trace:o})},getErrorType:function(e){var t=e.errMsg,e=e.statusCode,n="",r=t;return["timeout","time out","ERR_CONNECTION_TIMED_OUT","ERR_TIMED_OUT","超时"].some(function(e){return String(r||"").includes(e)})?n="timeout":400<=e?n="error":(-1<t.indexOf("fail")||!e||e<0)&&(n="failed"),n},hackWsConnect:function(){var e,t,n=this;pe({apiName:"sendSocketMessage",fail:function(e){n.publishSocketError(e)}}),e=(t={connectCallback:{fail:function(e){n.publishSocketError(e)}},taskOpt:{onError:function(e){n.publishSocketError(e)},send:{fail:function(e){n.publishSocketError(e)}}}}).connectCallback,t=t.taskOpt,U?U.addCallback(e):U=new Ve(e),t&&U.addTaskConf(t)},publishSocketError:function(e){e&&this.publishErrorLog({msg:e.errMsg,level:v.WEBSOCKET_ERROR})}}),Ge=new f({name:"reportAssetSpeed",isStart:!1,onNewAegis:function(e){this.isStart||(this.isStart=!0,this.start(e))},start:function(t){var e,n=this;g.getPerformance&&"function"==typeof(e=g.getPerformance()).createObserver&&e.createObserver(function(e){e=e.getEntries();null!=e&&e.forEach(function(e){h(e.uri,t.config.hostUrl)||"number"!=typeof e.duration||e.duration<=0||n.publishAssetLog(e)})}).observe({entryTypes:["resource"]})},generateLog:function(e){var t,n,r=e.transferSize;return{url:(t=e.uri,void 0===n&&(n=2048),String(t).replace(M,"").slice(0,n)),method:"get",duration:Math.round(100*e.duration)/100,status:200,type:"static",isHttps:!0,urlQuery:X(e.uri,!0),nextHopProtocol:"",domainLookup:0,connectTime:0,transferSize:0<r?r:-1}},publishAssetLog:function(t){var n=this;this.$walk(function(e){e.speedLogPipeline(n.generateLog(t))})}}),Je=["onLaunch","onHide","onError","onLoad","onReady","onShow","onUnload"],ze=new f({name:"pagePerformance",pageNavigationStartTime:{},onNewAegis:function(e){try{i("getPerformance")&&this.reportPerformance(e),this.setPagePV(e),this.reportSetDataTiming(e)}catch(e){}},reportPerformance:function(f){var p=this,e=g.getPerformance();"function"==typeof e.createObserver&&null!=(e=null==e?void 0:e.createObserver(function(e){var t={},n=null==(n=e.getEntriesByName("appLaunch"))?void 0:n[0],r=null==(r=e.getEntriesByName("firstRender"))?void 0:r[0],o=null==(o=e.getEntriesByName("evaluateScript"))?void 0:o[0],i=null==(i=e.getEntriesByName("route"))?void 0:i[0],a=null==(a=null==(a=e.getEntriesByName("firstPaint"))?void 0:a[0])?void 0:a.startTime,s=null==(s=null==(s=e.getEntriesByName("largestContentfulPaint"))?void 0:s[0])?void 0:s.startTime,c=null==(c=null==(c=e.getEntriesByName("firstContentfulPaint"))?void 0:c[0])?void 0:c.startTime,l=null==(l=(null==(l=e.getEntriesByName("firstPaint"))?void 0:l[0])||(null==(l=e.getEntriesByName("route"))?void 0:l[0])||(null==(l=e.getEntriesByName("appLaunch"))?void 0:l[0]))?void 0:l.pageId,u=null==(e=(null==(u=e.getEntriesByName("route"))?void 0:u[0])||(null==(u=e.getEntriesByName("appLaunch"))?void 0:u[0]))?void 0:e.startTime;l&&(p.pageNavigationStartTime[l]=null,u)&&(p.pageNavigationStartTime[l]=u),n&&(t.appLaunch=n.duration||-1),r&&(t.firstScreenTiming=r.duration||-1),o&&(t.scriptEvaluateTiming=o.duration||-1),i&&(t.pageRouteTiming=i.duration||-1),a&&u?t.firstPaintTiming=Math.max(a-u,-1):a&&p.pageNavigationStartTime[l]&&(t.firstPaintTiming=Math.max(a-p.pageNavigationStartTime[l],-1)),s&&u?t.LCP=Math.max(s-u,-1):s&&p.pageNavigationStartTime[l]&&(t.LCP=Math.max(s-p.pageNavigationStartTime[l],-1)),c&&u?t.FCP=Math.max(c-u,-1):c&&p.pageNavigationStartTime[l]&&(t.FCP=Math.max(c-p.pageNavigationStartTime[l],-1)),0<Object.keys(t).length&&p.publish(t,f)}))&&e.observe({entryTypes:["navigation","render","script"]})},publish:function(t,n){var e,r,o,i=[],a=n.config,s=-1===(null==(e=n.config.performanceUrl)?void 0:e.indexOf("?"))?"?":"&";for(r in t)i.push(r+"="+t[r]);"function"==typeof a.urlHandler?(o=a.urlHandler()||window.location.href,this.$walk(function(e){e.send({url:n.config.performanceUrl+s+i.join("&")+"&from="+encodeURIComponent(o),beanFilter:["from"],type:b.PERFORMANCE,log:t})})):this.$walk(function(e){e.send({url:n.config.performanceUrl+s+i.join("&"),type:b.PERFORMANCE,log:t})})},setPagePV:function(t){var n=this;g.onAppRoute&&g.onAppRoute(function(e){"appLaunch"===e.openType&&!t.config.spa||(n.$walk(function(e){e.send({url:""+e.config.pvUrl,type:b.PV})}),n.reportPageLoaded(e))})},reportPageLoaded:function(e){e="infoType: behaviorBacktracking\ndataType: pageLoadAndRoute\npageLoadedPath: "+e.path+"\nopenType: "+e.openType;this.publishNormalLog({msg:e,level:v.INFO})},publishNormalLog:function(t){this.$walk(function(e){e.normalLogPipeline(t)})},reportSetDataTiming:function(t){var e,o,s,c,n,i,a,l,u=this,r=t.config.setDataReportConfig,r=void 0===r?{}:r;!0!==r.disabled&&(e=r.timeThreshold,o=!1!==r.withDataPaths,s=e&&0<+e?+e:30,c=y([m(t,10),function(e){e=e.map(function(e){return{type:b.SET_DATA,component:e.from,duration:e.duration,fields:e.dataPaths&&e.dataPaths.length?e.dataPaths.sort().join(";"):void 0,size:e.size}});t.send({url:t.config.setDataReportUrl+"?payload="+encodeURIComponent(JSON.stringify({miniProgramData:e})),type:b.SET_DATA,log:e})}]),n=Page,i=Component,a=function(e,t){var i,a,n=t.updateStartTimestamp,r=t.updateEndTimestamp,t=t.dataPaths,t=void 0===t?[]:t,r=r-n;isNaN(r)||r<s||(n={from:e.is,duration:r},o&&0<t.length&&Object.assign(n,{dataPaths:t.slice(0,30),size:(r=t,a=0,null!=(i=e)&&i.data?(r.forEach(function(e){for(var t=i.data[e[0]],n=1,r=e.length;n<r;n++)t[e[n]]&&(t=t[e[n]]);var o="";try{o=JSON.stringify(t)}catch(e){o=""}a+=2*(void 0===o?"":o).replace(/[\u4e00-\u9fa5]/g,"aa").length}),a=Math.min(a,10485760)):a)}),c(n))},l=function(r){var e="infoType: behaviorBacktracking\ndataType: tapEvent"+Object.keys(r[0]).reduce(function(e,t){var n="";try{n=t+": "+JSON.stringify(r[0][t])}catch(e){n=""}return e+"\n"+n},"");u.publishNormalLog({msg:e,level:v.INFO})},Page=function(t){var e=t.onReady;return t.onReady=function(){var t=this;return"function"==typeof this.setUpdatePerformanceListener&&this.setUpdatePerformanceListener({withDataPaths:o},function(e){a(t,e)}),null==e?void 0:e.call(this)},Object.keys(t).forEach(function(e){var n;"function"!=typeof t[e]||Je.includes(e)||(n=t[e],t[e]=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];return null!=e&&e[0]&&"tap"===e[0].type&&l(e),null==n?void 0:n.apply(this,e)})}),n(t)},Component=function(e){e.lifetimes&&e.lifetimes.attached?(n=e.lifetimes.attached,e.lifetimes.attached=function(){var t=this;return"function"==typeof this.setUpdatePerformanceListener&&this.setUpdatePerformanceListener({withDataPaths:o},function(e){a(t,e)}),null==n?void 0:n.call(this)}):(r=e.attached,e.attached=function(){var t=this;return"function"==typeof this.setUpdatePerformanceListener&&this.setUpdatePerformanceListener({withDataPaths:o},function(e){a(t,e)}),null==r?void 0:r.call(this)});var n,r,t=e.methods;return t&&"[object Object]"===Object.prototype.toString.call(t)&&Object.keys(t).forEach(function(e){var n;"function"==typeof t[e]&&(n=t[e],t[e]=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];return null!=e&&e[0]&&"tap"===e[0].type&&l(e),null==n?void 0:n.apply(this,e)})}),i(e)})}}),f=new f({name:"reportLoadPackageSpeed",isLoaded:!1,onNewAegis:function(e){this.isLoaded||(this.isLoaded=!0,this.start(e))},start:function(){var e,t=this;g.getPerformance&&"function"==typeof(e=g.getPerformance()).createObserver&&e.createObserver(function(e){e=e.getEntries();null!=e&&e.forEach(function(e){"number"!=typeof e.duration||e.duration<=0||t.publishPackageLog(e)})}).observe({entryTypes:["loadPackage"]})},generateLog:function(e){return[{type:b.LOAD_PACKAGE,packageName:e.packageName,size:Math.round(100*e.packageSize)/100,duration:Math.round(100*e.duration)/100}]},publishPackageLog:function(n){var r=this;this.$walk(function(e){var t=r.generateLog(n);e.send({url:e.config.setDataReportUrl+"?payload="+encodeURIComponent(JSON.stringify({miniProgramData:t})),type:b.LOAD_PACKAGE,log:t})})}});function I(e){e=Me.call(this,e)||this;return e.taskHack=new We,e}function Ke(){this.onErrors=[],this.sends=[]}return l.use(w),l.use(De),l.use(Le),l.use(Ge),l.use(ze),l.use(f),l.use(Ne),l});
10
+ ((e,t)=>{"object"==typeof exports&&"undefined"!=typeof module?t(exports):"function"==typeof define&&define.amd?define(["exports"],t):t((e="undefined"!=typeof globalThis?globalThis:e||self).Aegis={})})(this,function(e){var I=function(e,t){return(I=Object.setPrototypeOf||({__proto__:[]}instanceof Array?function(e,t){e.__proto__=t}:function(e,t){for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n])}))(e,t)};function t(e,t){function n(){this.constructor=e}I(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)}var f=function(){return(f=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var o in t=arguments[n])Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o]);return e}).apply(this,arguments)};function D(r,o){var i,a,s,c={label:0,sent:function(){if(1&s[0])throw s[1];return s[1]},trys:[],ops:[]},e={next:t(0),throw:t(1),return:t(2)};return"function"==typeof Symbol&&(e[Symbol.iterator]=function(){return this}),e;function t(n){return function(e){var t=[n,e];if(i)throw new TypeError("Generator is already executing.");for(;c;)try{if(i=1,a&&(s=2&t[0]?a.return:t[0]?a.throw||((s=a.return)&&s.call(a),0):a.next)&&!(s=s.call(a,t[1])).done)return s;switch(a=0,(t=s?[2&t[0],s.value]:t)[0]){case 0:case 1:s=t;break;case 4:return c.label++,{value:t[1],done:!1};case 5:c.label++,a=t[1],t=[0];continue;case 7:t=c.ops.pop(),c.trys.pop();continue;default:if(!((s=0<(s=c.trys).length&&s[s.length-1])||6!==t[0]&&2!==t[0])){c=0;continue}if(3===t[0]&&(!s||t[1]>s[0]&&t[1]<s[3]))c.label=t[1];else if(6===t[0]&&c.label<s[1])c.label=s[1],s=t;else{if(!(s&&c.label<s[2])){s[2]&&c.ops.pop(),c.trys.pop();continue}c.label=s[2],c.ops.push(t)}}t=o.call(r,c)}catch(e){t=[6,e],a=0}finally{i=s=0}if(5&t[0])throw t[1];return{value:t[0]?t[1]:void 0,done:!0}}}}function u(){for(var e=0,t=0,n=arguments.length;t<n;t++)e+=arguments[t].length;for(var r=Array(e),o=0,t=0;t<n;t++)for(var i=arguments[t],a=0,s=i.length;a<s;a++,o++)r[o]=i[a];return r}Object.assign||Object.defineProperty(Object,"assign",{enumerable:!1,configurable:!0,writable:!0,value:function(e){if(null==e)throw new TypeError("Cannot convert first argument to object");for(var t=Object(e),n=1;n<arguments.length;n++)if(null!=(r=arguments[n]))for(var r=Object(r),o=Object.keys(Object(r)),i=0,a=o.length;i<a;i++){var s=o[i],c=Object.getOwnPropertyDescriptor(r,s);null!=c&&c.enumerable&&(t[s]=r[s])}return t}});var b,a,s,h,p,U=/_?t(\d)?(imestamp)?=\d+&?/g,j=["aegis.qq.com","tamaegis.com","/aegis-sdk","rumt-","/flog.core.min.js","pingfore.qq.com","pingfore.tencent.com","zhiyan.tencent-cloud.net","h.trace.qq.com","btrace.qq.com","beacon.qq.com","dmplog.qq.com","qq.com/report","svibeacon.onezapp.com","cube.weixinbridge.com","doubleclick.net","pcmgrmonitor.3g.qq.com","tdm.qq.com","report.qqweb.qq.com","tpstelemetry.tencent.com","galileotelemetry.tencent.com","insight.cloud.tencent.com","facebook.com","facebook.net","google","yahoo.com","twitter.com","ga-audiences","report.idqqimg.com","arms-retcode.aliyuncs.com","px.effirst.com","sentry","baidu.com","hot-update.json","u.c.b.r.o.w.s.e.r","report.url.cn","sockjs-node","m3u8","flv"],H=["ext1","ext2","ext3","ext4","ext5","ext6","ext7","ext8","ext9","ext10","level","trace","tag","seq","code"];(r=b=b||{}).INFO_ALL="-1",r.API_RESPONSE="1",r.INFO="2",r.ERROR="4",r.PROMISE_ERROR="8",r.AJAX_ERROR="16",r.SCRIPT_ERROR="32",r.IMAGE_ERROR="64",r.CSS_ERROR="128",r.CONSOLE_ERROR="256",r.MEDIA_ERROR="512",r.RET_ERROR="1024",r.PAGE_LOAD="1025",r.SLOW_PAGE_LOAD="1026",r.SLOW_NET_REQUEST="1027",r.ASSERT_REQUEST="1028",r.SLOW_ASSET_REQUEST="1029",r.CLICK_EVENT="1030",r.CONSOLE_LOG="1031",r.BLANK_SCREEN="1032",r.MEMORY_OOM="1033",r.LAG_MONITOR="1034",r.NORESPONSE_LOG="1035",r.REPORT="2048",r.PV="4096",r.EVENT="8192",r.SPEED_EVENT="8193",r.PAGE_NOT_FOUND_ERROR="16384",r.WEBSOCKET_ERROR="32768",r.BRIDGE_ERROR="65536",r.LAZY_LOAD_ERROR="131072",(r=a=a||{})[r.android=1]="android",r[r.ios=2]="ios",r[r.windows=3]="windows",r[r.macos=4]="macos",r[r.linux=5]="linux",r[r.devtools=6]="devtools",r[r.other=100]="other",(r=s=s||{})[r.unknown=100]="unknown",r[r.wifi=1]="wifi",r[r.net2g=2]="net2g",r[r.net3g=3]="net3g",r[r.net4g=4]="net4g",r[r.net5g=5]="net5g",r[r.net6g=6]="net6g",(r=h=h||{}).LOG="log",r.SPEED="speed",r.PERFORMANCE="performance",r.OFFLINE="offline",r.WHITE_LIST="whiteList",r.VITALS="vitals",r.PV="pv",r.CUSTOM_PV="customPV",r.EVENT="event",r.CUSTOM="custom",r.SDK_ERROR="sdkError",r.SET_DATA="setData",r.LOAD_PACKAGE="loadPackage",r.MEMORY="memory",(r=p=p||{}).production="production",r.development="development",r.gray="gray",r.pre="pre",r.daily="daily",r.local="local",r.test="test",r.others="others";n.prototype.indexOf=function(e,t){for(var n=0;n<e.length;n++)if(e[n].callback===t)return n;return-1},n.prototype.on=function(e,t,n){var r;if(void 0===n&&(n=0),this)return(r=this.eventsList[e])||(this.eventsList[e]=[],r=this.eventsList[e]),-1===this.indexOf(r,t)&&r.push({name:e,type:n||0,callback:t}),this},n.prototype.one=function(e,t){this.on(e,t,1)},n.prototype.remove=function(e,t){if(this){var n=this.eventsList[e];if(n){if(t)return n.length&&(t=this.indexOf(n,t),n.splice(t,1)),this;try{delete this.eventsList[e]}catch(e){}}return null}},n.prototype.clear=function(){this.eventsList={}};var M=n,B=function(e){if(!e||0===e.length)return"{}";e=Array.isArray(e)?e:[e];var t=Array.from(new Set(e.flatMap(function(e){return Object.keys(e)}))),n={};return t.forEach(function(t){n[t]=e.map(function(e){return e[t]||""})}),n.count=e.length,ne(n)};function n(){var a=this;this.emit=function(e,t){if(a){var n;if(null!=(r=a.eventsList[e])&&r.length)for(var r=r.slice(),o=0;o<r.length;o++){n=r[o];try{var i=n.callback.apply(a,[t]);if(1===n.type&&a.remove(e,n.callback),!1===i)break}catch(e){throw e}}return a}},this.eventsList={}}function W(e,t){return"string"==typeof e?e.split("?")[t?1:0]||"":e}function G(e){return"string"==typeof e&&/^\//.test(e)?"https:"===(null==location?void 0:location.protocol):/^https/.test(e)}function V(e,t,n){var r,o;try{if("function"==typeof(null==t?void 0:t.retCodeHandler))return{code:void 0===(i=(o=t.retCodeHandler(e,null==n?void 0:n.url,null==n?void 0:n.ctx,null==n?void 0:n.payload)||{}).code)?"unknown":i,isErr:o.isErr};if(!(e="string"==typeof e?JSON.parse(e):e))return{code:"unknown",isErr:!1};"function"==typeof(null==(r=null==t?void 0:t.ret)?void 0:r.join)&&(ee=[].concat(t.ret.map(function(e){return e.toLowerCase()})));var i,a=Object.getOwnPropertyNames(e).filter(function(e){return-1!==ee.indexOf(e.toLowerCase())});return a.length?{code:""+(i="未知"!==(i=e[a[0]])&&""!==i?i:"unknown"),isErr:0!==i&&"0"!==i&&"unknown"!==i}:{code:"unknown",isErr:!1}}catch(e){return{code:"unknown",isErr:!1}}}function E(e,t,n){try{var r="function"==typeof t?t(e,null==n?void 0:n.url,null==n?void 0:n.ctx)||"":e;return re(r).slice(0,10240)}catch(e){return""}}function J(t){var n;return t.payload?(n={},Object.keys(t).forEach(function(e){"payload"!==e&&(n[e]=t[e])}),n):t}function z(e,t){var n,r={fetch:[],static:[],bridge:[]},o={};return Array.isArray(e)?e.forEach(function(e){var t;null!=(t=r[e.type])&&t.push(e)}):null!=(n=r[e.type])&&n.push(e),o.payload=JSON.stringify(f({duration:r},t)),o}function K(t,e){return"string"!=typeof t||!t||e&&-1<t.indexOf(e)||ae.test(t)||j.some(function(e){return-1<t.indexOf(e)})}function m(n,r){var o,i=[],a=n.config;return n.lifeCycle.on("destroy",function(){i.length=0}),function(e,t){Array.isArray(e)?i=i.concat(e):i.push(e),r&&i.length>=r||n.sendNow&&0<i.length?(i=se(i),0<(i=Array.isArray(i)?i:[]).length&&t(i.splice(0,i.length)),o&&clearTimeout(o)):(o&&clearTimeout(o),o=setTimeout(function(){o=null,i=se(i),0<(i=Array.isArray(i)?i:[]).length&&t(i.splice(0,i.length))},a.delay))}}function $(e,t){return Array.isArray(e)?t(e.map(function(e){return t=f(f({},e),{msg:"string"==typeof e.msg?e.msg:[].concat(e.msg).map(y).join(" ")}),H.forEach(function(e){t[e]||delete t[e]}),t;var t})):t([f(f({},e),{msg:"string"==typeof e.msg?e.msg:y(e.msg)})])}function Q(c,l){return function(o,i){var r,a,s,e,t,n;null!=o&&o.log&&null!=o&&o.type?(r=function(e,t){var n,r,o,i,t=f(f({},c.bean),{from:t}),a=f({},c.bean);return(()=>{try{return"undefined"!=typeof FormData&&"function"==typeof FormData.prototype.append}catch(e){}})()?(n=e,t=t,o={fetch:[],static:[],bridge:[]},i=new FormData,Array.isArray(n)?n.forEach(function(e){var t=J(e);o[e.type].push(t)}):(r=J(n),o[n.type].push(r)),i.append("payload",ne(f({duration:o},t))),i):z(e,a)},a=function(e,t,n){switch(t){case h.LOG:return B(ue(e));case h.SPEED:return r(e,n);default:return{}}},1!==(e=Array.isArray(o.log)?o.log:[o.log]).length?(s={},e.forEach(function(e){var t=e.from||"undefined";delete e.from,s[t]||(s[t]=[]),s[t].push(e)}),Object.keys(s).forEach(function(e){var t,n=s[e],r=null!=(r=o.url)&&r.includes("?")?"&":"?";"undefined"===e?(t=""+o.url,i(f(f({},o),{url:t,log:1===n.length?n[0]:n,data:a(n,l,e)}))):(t=o.url+r+"from="+e,i(f(f({},o),{url:t,log:1===n.length?n[0]:n,beanFilter:u(o.beanFilter||[],["from"]),data:a(n,l,e)})))})):(t=(e=e[0]).from,delete e.from,n=null!=(n=o.url)&&n.includes("?")?"&":"?",t?(n=o.url+n+"from="+t,i(f(f({},o),{url:n,log:e,beanFilter:u(o.beanFilter||[],["from"]),data:a(e,l,t)}))):(n=""+o.url,i(f(f({},o),{url:n,log:e}))))):i(o)}}function Y(c,l){return function(e,t){var n,r,o,i=Array.isArray(e),a=i?e:[e],s=(c.lifeCycle.emit("beforeRequest",e),c.config.beforeRequest);(a="function"==typeof s?a.map(function(t){try{var e=s({logs:t,logType:l});return(null==e?void 0:e.logType)===l&&null!=e&&e.logs?e.logs:!1!==e&&t}catch(e){return t}}).filter(function(e){return!1!==e}):a).length&&(n=a,e=H,!Array.isArray(n)||n.length<=1||(r=[],o=[],!(o="string"==typeof e?[e]:e))||o.length<=0||(o.forEach(function(t){n.forEach(function(e){null!=e&&e[t]&&r.push(t)})}),0<r.length&&(n=n.map(function(e){var t={};return r.forEach(function(e){t[e]=""}),f(f({},t),e)}))),a=n,t(i?a:a[0]))}}function Z(o){return function(e,t){o.lifeCycle.emit("modifyRequest",e);var n=o.config.modifyRequest;if("function"==typeof n)try{var r=n(e);"object"==typeof r&&"url"in r&&(e=r)}catch(e){console.error(e)}t(e)}}function X(r){return function(e,t){null!=(n=r.lifeCycle)&&n.emit("afterRequest",e);var n=(r.config||{}).afterRequest;"function"==typeof n&&!1===n(e)||t(e)}}var ee=["ret","retcode","code","errcode"],te=function(){var n=new WeakSet;return function(e,t){if(t instanceof Error)return"Error.message: "+t.message+" \n Error.stack: "+t.stack;if("object"==typeof t&&null!==t){if(n.has(t))return"[Circular "+(e||"root")+"]";n.add(t)}return t}},y=function(e){if("string"==typeof e)return e;try{return e instanceof Error?(JSON.stringify(e,te(),2)||"undefined").replace(/"/gim,""):JSON.stringify(e,te(),2)||"undefined"}catch(e){return"error happen when aegis stringify: \n "+e.message+" \n "+e.stack}},ne=function(e){if("string"==typeof e)return e;try{return JSON.stringify(e,te())||"undefined"}catch(e){return"error happen when aegis stringify: \n "+e.message+" \n "+e.stack}},re=function(n,r){void 0===r&&(r=3);var o,i,a,s="";return Array.isArray(n)?(s+="[",o=n.length,n.forEach(function(e,t){s=(s+="object"==typeof e&&1<r?re(e,r-1):ie(e))+(t===o-1?"":",")}),s+="]"):n instanceof Object||"object"==typeof n?(s="{",i=Object.keys(n),a=i.length,i.forEach(function(e,t){"object"==typeof n[e]&&1<r?s+='"'+e+'":'+re(n[e],r-1):s+=oe(e,n[e]),s+=t===a-1||t<a-1&&void 0===n[i[t+1]]?"":","}),s+="}"):s+=n,s},oe=function(e,t){var n=typeof t,r="";return"string"==n||"object"==n?r+='"'+e+'":"'+t+'"':"function"==typeof t?r+='"'+e+'":"function '+t.name+'"':"symbol"==typeof t?r+='"'+e+'":"symbol"':"number"!=typeof t&&"boolean"!=n||(r+='"'+e+'": '+t),r},ie=function(e){var t=typeof e;return""+("undefined"==t||"symbol"==t||"function"==t?"null":"string"==t||"object"==t?'"'+e+'"':e)},ae=/data:(image|text|application|font)\/.*;base64/,se=function(e){return e.filter(function(n,r){return"static"!==n.type||!e.find(function(e,t){return n.url===e.url&&200===n.status&&r<t})})},ce=function(e){e.level===b.INFO_ALL&&(e.level=b.INFO)},v={},R={},le=function(e){return v[e]||(v[e]=setTimeout(function(){R[e]={},v[e]=null},6e4)),v[e]},ue=function(e){return(Array.isArray(e)?e:[e]).map(function(n){return Object.getOwnPropertyNames(n).reduce(function(e,t){return"ctx"!==t&&(e[t]=n[t]),e},{level:b.INFO,msg:""})})},fe=function(r){return function(e){return r.sendPipeline([function(e,n){return n({url:r.config.url||"",data:B(ue(e)),method:"post",contentType:"application/json",type:h.LOG,log:e,requestConfig:{timeout:5e3},success:function(){var t=r.config.onReport;"function"==typeof t&&e.forEach(function(e){t(e)}),"function"==typeof n&&n([])}})}],h.LOG)(e)}},pe={generateTraceId:ge(16),generateSpanId:ge(8)},de=Array(32);function ge(t){return function(){for(var e=0;e<2*t;e++)de[e]=Math.floor(16*Math.random())+48,58<=de[e]&&(de[e]+=39);return String.fromCharCode.apply(null,de.slice(0,2*t))}}function he(){return([1e7]+1e3+4e3+8e3+1e11).replace(/[018]/g,function(e){return(e^(16*Math.random()&15)>>e/4).toString(16)})}function i(){return"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,function(e){var t=16*Math.random()|0;return("x"===e?t:3&t|8).toString(16)})}function me(e){for(var t,n,r,o="",i=0,a=(e=String(e)).length%3;i<e.length;){if(255<(t=e.charCodeAt(i++))||255<(n=e.charCodeAt(i++))||255<(r=e.charCodeAt(i++)))throw new TypeError("Failed to execute 'btoa': The string to be encoded contains characters outside of the Latin1 range.");o+=c.charAt((t=t<<16|n<<8|r)>>18&63)+c.charAt(t>>12&63)+c.charAt(t>>6&63)+c.charAt(63&t)}return a?o.slice(0,a-3)+"===".substring(a):o}function ye(e){if(e=String(e).replace(/[\t\n\f\r ]+/g,""),!Re.test(e))throw new TypeError("Failed to execute 'atob': The string to be decoded is not correctly encoded.");var t;e+="==".slice(2-(3&e.length));for(var n,r,o="",i=0;i<e.length;)t=c.indexOf(e.charAt(i++))<<18|c.indexOf(e.charAt(i++))<<12|(n=c.indexOf(e.charAt(i++)))<<6|(r=c.indexOf(e.charAt(i++))),o+=64===n?String.fromCharCode(t>>16&255):64===r?String.fromCharCode(t>>16&255,t>>8&255):String.fromCharCode(t>>16&255,t>>8&255,255&t);return o}function ve(e){var t,n="";return n="object"==typeof e&&(t=(e=((e,t)=>{for(var n=0;n<t.length;n++){var r=t[n],o=e[r]||"function"==typeof e.get&&e.get(r);if(o)return[r,o]}return["",""]})(e,Object.keys(Pe)))[0])?Pe[t](e[1]):n}function O(n){if(n&&n.reduce&&n.length)return 1===n.length?function(e,t){n[0](e,t||Se)}:n.reduce(function(n,r){return function(e,t){return void 0===t&&(t=Se),n(e,function(e){return null==r?void 0:r(e,t)})}});throw new TypeError("createPipeline need at least one function param")}function be(t,n){Object.getOwnPropertyNames(t).forEach(function(e){"function"==typeof t[e]&&"constructor"!==e&&(n?n[e]="sendPipeline"===e?function(){return function(){}}:function(){}:t[e]=function(){})})}function P(e){try{var t,n,r,o="";return o=e.pageUrl||(n=(t=getCurrentPages())[t.length-1]||{},r=(i=n.options)&&Object.keys(i).length?"?"+Object.keys(i).map(function(e){return e+"="+i[e]}).join("&"):"",n.route?n.route+r:""),"function"==typeof e.urlHandler&&(o=e.urlHandler()),encodeURIComponent(o.slice(0,2048))}catch(e){return""}var i}function Ee(e,t){var n=this;this.taskQueue=[],this.count=1,this.maxCount=2,this.addTask=function(e){n.taskQueue.push(e)},this.fireTask=function(){var e=n.taskQueue.length;n.count>n.maxCount||0===e||(n.count=n.count+1,(e=n.taskQueue.shift())&&n.sendRequest(e.options,null==e?void 0:e.success,null==e?void 0:e.fail))},this.complete=function(){1<n.count&&(n.count=n.count-1),n.fireTask()},t&&(this.maxCount=t),this.sendRequest=e}var c="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",Re=/^(?:[A-Za-z\d+\/]{4})*?(?:[A-Za-z\d+\/]{2}(?:==)?|[A-Za-z\d+\/]{3}=?)?$/,Oe=(d.prototype.generate=function(e,t,n){if(void 0===t&&(t={}),this.url=e,!this.isUrlIgnored()&&this.isUrlInTraceUrls()&&this.traceType){switch(this.traceType){case"traceparent":this.traceId=this.createTraceparent();break;case"b3":this.traceId=this.createB3();break;case"sw8":this.traceId=this.createSw8(n);break;case"sentry-trace":this.traceId=this.createSentryTrace();break;default:return console.warn("this trace key "+this.traceType+" is not supported"),void(this.traceId="")}return t[this.traceType]&&(this.traceId=t[this.traceType]),{name:this.traceType,value:this.traceId}}},d.prototype.createTraceparent=function(){var e=pe.generateSpanId();return"00-"+pe.generateTraceId()+"-"+e+"-0"+this.traceFlag.toString(16)},d.prototype.createB3=function(){var e=pe.generateSpanId();return pe.generateTraceId()+"-"+e+"-"+this.traceFlag},d.prototype.createSw8=function(e){var t="function"==typeof btoa?btoa:me,e=e||{},n=e.host,n=void 0===n?"":n,e=e.pathname,e=void 0===e?"":e,r=i(),o=i();return"1-"+String(t(o))+"-"+String(t(r))+"-1-"+String(t("aegis"))+"-"+String(t("1.39.2"))+"-"+String(t(encodeURI(e)))+"-"+String(t(n))},d.prototype.createSentryTrace=function(){var e=he().substring(16);return he()+"-"+e+"-"+this.traceFlag},d.prototype.isUrlIgnored=function(){if(Array.isArray(this.ignoreUrls)&&0!==this.ignoreUrls.length)for(var e=0,t=this.ignoreUrls;e<t.length;e++){var n=t[e];if(this.urlMatches(this.url,n))return!0}return!1},d.prototype.isUrlInTraceUrls=function(){if(!this.urls)return!0;if(Array.isArray(this.urls)){if(0===this.urls.length)return!1;for(var e=0,t=this.urls;e<t.length;e++){var n=t[e];if(this.urlMatches(this.url,n))return!0}}return!1},d.prototype.urlMatches=function(e,t){return"string"==typeof t?e===t:!!e.match(t)},d),Pe={sw8:function(e){var t="function"==typeof atob?atob:ye,e=e.split("-")[1];return e?t(e):""},traceparent:function(e){return e.split("-")[1]},b3:function(e){return e.split("-")[0]},"sentry-trace":function(e){return e.split("-")[0]}},Se=function(){},r=(S.use=function(e){-1===S.installedPlugins.indexOf(e)&&e.aegisPlugin&&S.installedPlugins.push(e)},S.unuse=function(e){e=S.installedPlugins.indexOf(e);-1!==e&&S.installedPlugins.splice(e,1)},S.prototype.init=function(e){var t;this.setConfig(e),this.config=(t=this.config,e=e.hostUrl,t.url=(e="string"!=typeof(e=void 0===e?"https://rumt-zh.com":e)?"https://rumt-zh.com":e)+"/collect",t.offlineUrl=e+"/offline",t.whiteListUrl=e+"/collect/whitelist",t.pvUrl=e+"/collect/pv",t.eventUrl=e+"/collect/events",t.speedUrl=e+"/speed",t.customTimeUrl=e+"/speed/custom",t.performanceUrl=e+"/speed/performance",t.performanceUrlForHippy=e+"/speed/hippyPerformance",t.webVitalsUrl=e+"/speed/webvitals",t.setDataReportUrl=e+"/speed/miniProgramData",t.memoryUrl=e+"/memory",t);for(var n=0;n<S.installedPlugins.length;n++)try{S.installedPlugins[n].patch(this)}catch(e){this.sendSDKError(e)}this.lifeCycle.emit("onInited")},S.prototype.destroy=function(e){void 0===e&&(e=!1);var t,n,r=S.instances.indexOf(this);-1!==r&&S.instances.splice(r,1);for(var o=S.installedPlugins.length-1;0<=o;o--)try{S.installedPlugins[o].unpatch(this)}catch(e){this.sendSDKError(e)}if(this.lifeCycle.emit("destroy"),this.lifeCycle.clear(),e)t=this,n=Object.getOwnPropertyDescriptors(t),Object.keys(n).forEach(function(e){n[e].writable&&(t[e]=null)}),Object.setPrototypeOf(this,null);else{for(var i=this;i.constructor!==Object&&be(i,this),i=Object.getPrototypeOf(i););0===S.instances.length&&(r=Object.getPrototypeOf(this).constructor,be(r),be(S))}},S.prototype.setConfig=function(e){Object.assign(this.config,e);var e=this.config,t=e.id,n=e.uin,r=e.version,o=e.ext1,i=e.ext2,a=e.ext3,s=e.aid,c=e.env,l=void 0===c?"production":c,c=e.pageUrl,e=this.bean.id!==t||this.bean.uin!==n||this.bean.aid!==s;return this.bean.id=t||"",this.bean.uin=n||"",this.bean.version=r||"1.39.2",this.bean.aid=s||"",this.bean.env=(()=>{switch(l){case p.production:case p.development:case p.gray:case p.pre:case p.daily:case p.local:case p.test:case p.others:return 1;default:return}})()?l:p.others,c&&this.extendBean("from",encodeURIComponent(c.slice(0,2048))),o&&this.extendBean("ext1",encodeURIComponent(o)),i&&this.extendBean("ext2",encodeURIComponent(i)),a&&this.extendBean("ext3",encodeURIComponent(a)),e&&this.lifeCycle.emit("onConfigChange",this.config),this.config},S.prototype.extendBean=function(e,t){this.bean[e]=t},S.prototype.send=function(e,o,i){var t=this;return O([Z(this),Q(this,null==e?void 0:e.type),function(n,r){t.request(n,function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];r({isErr:!1,result:e,logType:n.type,logs:n.log}),null!=o&&o.apply(void 0,e)},function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];r({isErr:!0,result:e,logType:n.type,logs:n.log}),null!=i&&i.apply(void 0,e)})},X(this)])(e)},S.prototype.sendSDKError=function(e){var n=this;this.sendPipeline([function(e,t){t({url:n.config.url+"?id=1085&msg[0]="+encodeURIComponent(y(e))+"&level[0]=2&from="+n.config.id+"&count=1&version="+n.config.id+"(1.39.2)",addBean:!1,method:"get",type:h.SDK_ERROR,log:e})}],h.SDK_ERROR)(e)},S.prototype.sendPipeline=function(e,t){var n,i=this;return O(u([function(e,t){if("number"!=typeof n.config.random&&(console.warn("random must in [0, 1], default is 1."),n.config.random=1),!n.isHidden||!n.isGetSample)if(n.isGetSample)n.isHidden||t(e);else{if(n.isGetSample=!0,Math.random()<n.config.random)return n.isHidden=!1,t(e);n.isHidden=!0}},Y(n=this,t)],e,[Q(this,t),Z(this),function(r,o){i.request(r,function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];var n=!1;-1<(""+e[i.failRequestCount=0]).indexOf("403 forbidden")&&(n=!0,i.destroy()),o({isErr:n,result:e,logType:null==r?void 0:r.type,logs:null==r?void 0:r.log}),null!=(n=null==r?void 0:r.success)&&n.call.apply(n,u([r],e))},function(){for(var e,t=[],n=0;n<arguments.length;n++)t[n]=arguments[n];60<=++i.failRequestCount&&i.destroy(),-1<(""+t[0]).indexOf("403 forbidden")&&i.destroy(),o({isErr:!0,result:t,logType:null==r?void 0:r.type,logs:null==r?void 0:r.log}),null!=(e=null==r?void 0:r.fail)&&e.call.apply(e,u([r],t))})},X(this)]))},S.prototype.validateRange=function(e){return 0<=e&&e<=127?e:-1},S.prototype.info=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];var n={level:b.INFO,msg:e,originFrom:this.getOriginFrom()};1===e.length&&e[0].msg&&Object.assign(n,f({},e[0]),{level:b.INFO,originFrom:this.getOriginFrom()}),this.normalLogPipeline(n)},S.prototype.infoAll=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];var n={level:b.INFO_ALL,msg:e,originFrom:this.getOriginFrom()};1===e.length&&e[0].msg&&Object.assign(n,f({},e[0]),{level:b.INFO_ALL,originFrom:this.getOriginFrom()}),this.normalLogPipeline(n)},S.prototype.report=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];var n={level:b.REPORT,msg:e,originFrom:this.getOriginFrom()};1===e.length&&e[0].msg&&Object.assign(n,f({},e[0]),{originFrom:this.getOriginFrom()}),this.normalLogPipeline(n)},S.prototype.error=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];var n={level:b.ERROR,msg:e,originFrom:this.getOriginFrom()};1===e.length&&e[0].msg&&Object.assign(n,f({},e[0]),{level:b.ERROR,originFrom:this.getOriginFrom()}),this.normalLogPipeline(n)},S.prototype.reportEvent=function(e){e&&((e="string"==typeof e?{name:e,ext1:this.config.ext1||"",ext2:this.config.ext2||"",ext3:this.config.ext3||"",originFrom:this.getOriginFrom()}:f(f({},e),{originFrom:e.originFrom||this.getOriginFrom()})).name?("string"!=typeof e.name&&(console.warn("reportEvent params name must be string"),e.name=String(e.name)),this.eventPipeline(e)):console.warn("reportEvent params error"))},S.prototype.reportT=function(e){var t=e.name,n=e.duration,r=e.ext1,r=void 0===r?"":r,o=e.ext2,o=void 0===o?"":o,i=e.ext3,i=void 0===i?"":i,a=e.ext4,s=e.ext5,c=e.ext6,l=e.ext7,u=e.ext8,f=e.ext9,p=e.ext10,e=e.from;if("string"==typeof t&&"number"==typeof n&&"string"==typeof r&&"string"==typeof o&&"string"==typeof i){if(!(n<0||2147483646<n))return this.submitCustomTime(t,n,r,o,i,void 0===a?"":a,void 0===s?"":s,void 0===c?"":c,void 0===l?"":l,void 0===u?"":u,void 0===f?"":f,void 0===p?"":p,void 0===e?"":e);console.warn("reportTime: duration must between 0 and 2147483646")}else console.warn("reportTime: params error")},S.prototype.reportTime=function(e,t){if("object"==typeof e)return this.reportT(e);"string"==typeof e?"number"==typeof t?t<0||2147483646<t?console.warn("reportTime: duration must between 0 and 2147483646"):(this.submitCustomTime(e,t),this.normalLogPipeline({level:b.SPEED_EVENT,msg:"key:"+e+"\\n duration:"+t,errorMsg:"",originFrom:this.getOriginFrom()})):console.warn("reportTime: second param must be number"):console.warn("reportTime: first param must be a string")},S.prototype.time=function(e){"string"==typeof e?this.timeMap[e]?console.warn("Timer "+e+" already exists"):this.timeMap[e]=Date.now():console.warn("time: first param must be a string")},S.prototype.timeEnd=function(e){"string"==typeof e?this.timeMap[e]?(this.submitCustomTime(e,Date.now()-this.timeMap[e]),delete this.timeMap[e]):console.warn("Timer "+e+" does not exist"):console.warn("timeEnd: first param must be a string")},S.prototype.ready=function(e,t,n){throw new Error('You need to override "ready" method')},S.prototype.request=function(e,t,n){throw new Error('You need to override "request" method')},S.prototype.speedLogPipeline=function(e){throw new Error('You need to override "speedLogPipeline" method')},S.prototype.getOriginFrom=function(){throw new Error('You need to override "getOriginFrom" method')},Object.defineProperty(S.prototype,"__version__",{get:function(){return"1.39.2"},enumerable:!1,configurable:!0}),Object.defineProperty(S.prototype,"LogType",{get:function(){return b},enumerable:!1,configurable:!0}),S.prototype.reportPv=function(e){e&&console.warn("reportPv is deprecated, please use reportEvent")},S.prototype.submitCustomTime=function(e,t,n,r,o,i,a,s,c,l,u,f,p){e={name:e,duration:t,ext1:String(n||this.config.ext1||"").slice(0,1024),ext2:String(r||this.config.ext2||"").slice(0,1024),ext3:String(o||this.config.ext3||"").slice(0,1024),ext4:i||this.config.ext4,ext5:a||this.config.ext5,ext6:s||this.config.ext6,ext7:c||this.config.ext7,ext8:l||this.config.ext8,ext9:u||this.config.ext9,ext10:f||this.config.ext10,from:p||void 0};this.customTimePipeline(e)},S.version="1.39.2",S.instances=[],S.logType=b,S.environment=p,S.installedPlugins=[],S),o=(l.prototype.patch=function(e){this.canUse(e)&&this.exist(e)&&(this.instances.push(e),this.triggerInit(e),this.triggerOnNewAegis(e))},l.prototype.unpatch=function(e){var t=this.instances.indexOf(e);-1!==t&&(this.instances.splice(t,1),0===this.instances.length)&&this.uninstall(e)},l.prototype.countInstance=function(){return this.instances.length},l.prototype.uninstall=function(e){var t;null!=(t=null==(t=this.option)?void 0:t.destroy)&&t.apply(this,[e])},l.prototype.walk=function(n){var r=this;this.instances.forEach(function(e){var t=r.canUse(e);t&&n(e,t)})},l.prototype.canUse=function(e){e=this.getConfig(e);return!(!e||"object"!=typeof e)||!!e},l.prototype.getConfig=function(e){return null==(e=e.config)?void 0:e[this.name]},l.prototype.exist=function(e){return-1===this.instances.indexOf(e)},l.prototype.triggerInit=function(e){var t;this.inited||(this.inited=!0,null==(t=null==(t=this.option)?void 0:t.init))||t.call(this.option,this.getConfig(e))},l.prototype.triggerOnNewAegis=function(e){var t;null!=(t=null==(t=this.option)?void 0:t.onNewAegis)&&t.call(this.option,e,this.getConfig(e))},l),xe=null;function l(e){this.aegisPlugin=!0,this.name="",this.instances=[],this.inited=!1,e.$walk=this.walk.bind(this),e.$getConfig=this.getConfig.bind(this),this.option=e,this.name=e.name}function S(e){var n,r,o,a,t,s,c,i,l,u,f,p,d,g=this;this.isGetSample=!1,this.isHidden=!1,this.config={version:0,delay:1e3,onError:!0,repeat:60,random:1,aid:!0,device:!0,pagePerformance:!0,webVitals:!0,speedSample:!0,onClose:!0,reportLoadPackageSpeed:!0,hostUrl:"https://rumt-zh.com",env:"production",url:"",offlineUrl:"",whiteListUrl:"",pvUrl:"",speedUrl:"",customTimeUrl:"",performanceUrl:"",performanceUrlForHippy:"",webVitalsUrl:"",eventUrl:"",setDataReportUrl:"",memoryUrl:"",reportImmediately:!0},this.isWhiteList=!1,this.lifeCycle=new M,this.bean={},this.normalLogPipeline=O([m(this,5),$,function(e,t){var r=n.config;t(e=e.map(function(e){var t,n=r.maxLength||10240;try{if(!e.msg||e.msg.length<=n)return e;e.msg=null==(t=e.msg)?void 0:t.substring(0,n)}catch(t){e.msg=y(e.msg).substring(0,r.maxLength)}return e}))},(d=(n=this).config,function(e,t){var n="number"==typeof d.repeat?d.repeat:60;if(n<=0)return t(e);var r=(null==d?void 0:d.id)+"_error",o=R[r]||{};t(e.filter(function(e){if(e.level===b.ERROR||e.level===b.PROMISE_ERROR||e.level===b.AJAX_ERROR||e.level===b.SCRIPT_ERROR||e.level===b.IMAGE_ERROR||e.level===b.CSS_ERROR||e.level===b.MEDIA_ERROR||e.level===b.RET_ERROR||e.level===b.BRIDGE_ERROR||e.level===b.PAGE_NOT_FOUND_ERROR||e.level===b.WEBSOCKET_ERROR||e.level===b.LAZY_LOAD_ERROR){e=e.msg.slice(0,200);if(o[e]>n)return v[r]||le(r),!1;o[e]=1+~~o[e],R[r]=o}return!0}))}),(f=this.lifeCycle.emit,p=this.config,function(e,t){var n,r=p.logCreated;return"function"==typeof r?(n=e.filter(function(e){return!1!==r(e)}),f("beforeWrite",n),t(n)):(f("beforeWrite",e),t(e))}),(u=this,setTimeout(function(){var e=u.config,t=e.pvUrl,o=void 0===t?"":t,t=e.spa,e=-1<["web-sdk","mp-sdk"].indexOf("mp-sdk");o&&(e&&!t||!e)&&u.sendPipeline([function(e,t){var n=u.getOriginFrom(),r=null!=o&&o.includes("?")?"&":"?";t({url:n?o+r+"originFrom="+encodeURIComponent(n):o,type:h.PV})}],h.PV)(null)},100),function(e,t){t(e)}),(i=c=s=!1,l=[],(a=this).lifeCycle.on("onConfigChange",function(){t&&clearTimeout(t),t=setTimeout(function(){var e,n;!i&&a.config&&(i=!0,e=a.config.whiteListUrl,(n=void 0===e?"":e)&&a.sendPipeline([function(e,t){t({url:n,type:h.WHITE_LIST,success:function(e){c=!0;try{var t=e.data||JSON.parse(e),n=t.retcode,r=t.result,o=void 0===r?{}:r,i=(0===n&&(s=o.is_in_white_list,a.isWhiteList=s,0<=o.rate)&&o.rate<=1&&(a.config.random=o.rate,a.isGetSample=!1),a.isWhiteList&&l.length?fe(a)(l.splice(0),function(){}):!a.isWhiteList&&l.length&&(l.length=0),a.config.onWhitelist);"function"==typeof i&&i(s)}catch(e){}},fail:function(){c=!0}})}],h.WHITE_LIST)(null),i=!1)},a.config.uin?50:500)}),a.lifeCycle.on("destroy",function(){l.length=0}),function(e,t){var n;s||null!=(n=null==(n=a.config)?void 0:n.api)&&n.reportRequest?t(e.concat(l.splice(0)).map(function(e){return ce(e),e})):(n=e.filter(function(e){return e.level!==b.INFO&&e.level!==b.API_RESPONSE?(ce(e),!0):(c||(l.push(e),200<=l.length&&(l.length=200)),!1)})).length&&t(n)}),function(e,t){try{var n=e.filter(function(e){return[b.ERROR,b.PROMISE_ERROR,b.AJAX_ERROR,b.SCRIPT_ERROR,b.IMAGE_ERROR,b.CSS_ERROR,b.MEDIA_ERROR,b.WEBSOCKET_ERROR,b.BRIDGE_ERROR,b.BLANK_SCREEN,b.RET_ERROR,b.PAGE_NOT_FOUND_ERROR,b.LAZY_LOAD_ERROR].includes(e.level)}),r=(n.length&&g.lifeCycle.emit("errorOccurred",n),e.forEach(function(t){["ext1","ext2","ext3"].forEach(function(e){t[e]&&"string"==typeof t[e]&&(t[e]=t[e].slice(0,1024))}),["ext4","ext5","ext6","ext7","ext8","ext9","ext10"].forEach(function(e){t[e]&&"string"!=typeof t[e]&&(t[e]=String(t[e]))})}),JSON.parse(JSON.stringify(e))),o=(g.lifeCycle.emit("beforeReport",r),g.config.beforeReport);(e="function"==typeof o?e.filter(function(e){return!1!==o(e)}):e).length&&t(e)}catch(e){}},fe(this)]),this.eventPipeline=O([m(this,10),(o=this,function(e){o.sendPipeline([function(e,t){var n=e.map(function(e){return{name:e.name,originFrom:e.originFrom,ext1:String(e.ext1||o.config.ext1||"").slice(0,1024),ext2:String(e.ext2||o.config.ext2||"").slice(0,1024),ext3:String(e.ext3||o.config.ext3||"").slice(0,1024),ext4:String(e.ext4||o.config.ext4||""),ext5:String(e.ext5||o.config.ext5||""),ext6:String(e.ext6||o.config.ext6||""),ext7:String(e.ext7||o.config.ext7||""),ext8:String(e.ext8||o.config.ext8||""),ext9:String(e.ext9||o.config.ext9||""),ext10:String(e.ext10||o.config.ext10||"")}});t({url:o.config.eventUrl+"?payload="+encodeURIComponent(JSON.stringify(n)),type:h.EVENT,log:e})}],h.EVENT)(e)})]),this.customTimePipeline=O([m(this,10),(r=this,function(e){return r.sendPipeline([function(e,t){t({url:r.config.customTimeUrl+"?payload="+encodeURIComponent(JSON.stringify({custom:e})),type:h.CUSTOM,log:e})}],h.CUSTOM)(e)})]),this.timeMap={},this.failRequestCount=0,S.instances.push(this)}function d(e,t,n,r){void 0===n&&(n=null),this.traceType=e,this.ignoreUrls=t,this.urls=n,this.traceFlag=null==r?1:Number(!!r)}function Te(){return xe||x()}function g(){return"tt"===Te()}function we(){return"my"===Te()}function x(){return"undefined"!=typeof tt?"tt":"undefined"!=typeof wx?"wx":"undefined"!=typeof my?"my":"undefined"!=typeof qq?"qq":"unknown"}function T(e){switch(e||Te()){case"wx":return wx;case"my":return my;case"qq":return qq;case"tt":return tt;default:return console.warn("Unknown platform detected, falling back to wx"),"undefined"!=typeof wx?wx:{}}}function w(e){var t,n=T();return((e,t)=>{if("string"==typeof e){if(e===t)return 1;for(var n=e.split("."),r=t.split("."),o=Math.max(n.length,r.length),i=0;i<o;i++){var a=~~n[i],s=~~r[i];if(a<s)return;if(s<a)return 1}}})(Ne=Ne||(null==(t=null==n?void 0:n.getSystemInfoSync())?void 0:t.SDKVersion)||(null==n?void 0:n.SDKVersion),"1.1.1")&&n.canIUse?n.canIUse(e):!!n[e]}function Ce(e){for(var t,n={unknown:/unknown|none/i,wifi:/wifi/i,net2g:/2g/i,net3g:/3g/i,net4g:/4g/i,net5g:/5g/i,net6g:/6g/i},r=s.unknown,o=0;o<Object.keys(n).length;o++){var i=Object.keys(n)[o];if(null!=(t=n[i])&&t.test(e)){r=s[i];break}}return r}var ke,Ne="",Ae=new o({name:"device",onNewAegis:function(t){return e=this,c=function(){return D(this,function(e){return this.setSystemInfo(t),this.setNetworkType(t),this.setNetworkChange(t),[2]})},new(s=(s=a=void 0)||Promise)(function(n,t){function r(e){try{i(c.next(e))}catch(e){t(e)}}function o(e){try{i(c.throw(e))}catch(e){t(e)}}function i(e){var t;e.done?n(e.value):((t=e.value)instanceof s?t:new s(function(e){e(t)})).then(r,o)}i((c=c.apply(e,a||[])).next())});var e,a,s,c},setSystemInfo:function(a){var s=this;try{w("getSystemInfo")&&T().getSystemInfo({success:function(e){var t=e.platform,n=e.model,r=e.windowHeight,o=e.windowWidth,i=e.screenWidth,i=void 0===i?0:i,e=e.screenHeight,e=void 0===e?0:e;a.extendBean("platform",s.getPlatFormType(t)),a.extendBean("model",n),a.extendBean("vp",Math.round(o)+" * "+Math.round(r)),a.extendBean("sr",Math.round(i)+" * "+Math.round(e))}})}catch(a){}},getPlatFormType:function(e){for(var t,n={android:/android/i,ios:/ios/i,windows:/windows/i,macos:/mac/i,devtools:/devtools/i},r=a.other,o=0;o<Object.keys(n).length;o++){var i=Object.keys(n)[o];if(null!=(t=n[i])&&t.test(e)){r=a[i];break}}return r},setNetworkChange:function(t){w("onNetworkStatusChange")&&T().onNetworkStatusChange(function(e){e=Ce(e.networkType);t.extendBean("netType",e)})},setNetworkType:function(t){w("getNetworkType")&&T().getNetworkType({success:function(e){e=Ce(e.networkType);t.extendBean("netType",e)}})}}),r=(t(C,ke=r),Object.defineProperty(C.prototype,"getBean",{get:function(){var t=this;return this.bean?Object.getOwnPropertyNames(this.bean).map(function(e){return e+"="+t.bean[e]}).join("&")+"&from="+P(this.config):"from="+P(this.config)},enumerable:!1,configurable:!0}),C.prototype.checkRuntimePlatform=function(e){var t=e||x(),n=e?"(user configured)":"(auto detected)";switch(this.runtimePlatform=t){case"wx":console.log("Running on WeChat miniprogram platform "+n);break;case"my":console.log("Running on Alipay miniprogram platform "+n);break;case"tt":console.log("Running on TikTok miniprogram platform "+n);break;case"qq":console.log("Running on QQ miniprogram platform "+n);break;default:console.warn("Unknown miniprogram platform: "+t+" "+n)}return t},C.prototype.getOriginFrom=function(){return""},C.prototype.initRequestSchedule=function(){this.requestSchedule=new Ee(this.sendRequest)},C.prototype.uploadLogs=function(e,t){this.lifeCycle.emit("uploadLogs",e=void 0===e?{}:e,t=void 0===t?{}:t)},C.prototype.reportPv=function(e){var t,n=this;e&&(t=Object.getOwnPropertyNames(this.bean).filter(function(e){return"id"!==e}).map(function(e){return e+"="+n.bean[e]}).join("&")+"&from="+P(this.config),this.send({url:this.config.url+"/"+e+"?"+t,addBean:!1,type:h.CUSTOM_PV,log:h.CUSTOM_PV},function(){},function(){}))},C.sessionID="session-"+Date.now(),C.asyncPluginIndex=0,C),Le=new o({name:"aid",onNewAegis:function(t){this.initAid(t,function(e){t.bean.aid=e,t.config.aid=e})},initAid:function(e,n){var t,r=T();g()?((t=r.getStorageSync("AEGIS_ID"))||(t=i(),r.setStorageSync("AEGIS_ID",t)),n(t)):r.getStorage({key:"AEGIS_ID",success:function(e){var t;null!=e&&e.data?n(e.data):(t=i(),r.setStorage({key:"AEGIS_ID",data:t,success:function(){n(t)}}))},fail:function(){var e=i();r.setStorage({key:"AEGIS_ID",data:e,success:function(){n(e)}})}})}});function C(e){var r,t,n,a,u=ke.call(this,e)||this;u.runtimePlatform="wx",u.speedLogPipeline=O([(a=u.config,function(e,t){var n,r,o,i="number"==typeof a.repeat?a.repeat:60;!a.speedSample||i<=0?t(e):(n=(null==a?void 0:a.id)||"0",r=R[n]||{},Array.isArray(e)?(o=e.filter(function(e){var t=!r[e.url]||r[e.url]<i;return t?(r[e.url]=1+~~r[e.url],R[n]=r):v[n]||le(n),t})).length&&t(o):!r[e.url]||r[e.url]<i?(r[e.url]=1+~~r[e.url],R[n]=r,t(e)):v[n]||le(n))}),m(u),function(t,n){w("getNetworkType")?T().getNetworkType({success:function(e){e=Ce(e.networkType);r.extendBean("netType",e),n(t)}}):n(t)},function(e,t){u.lifeCycle.emit("beforeReportSpeed",e);var n=u.config.beforeReportSpeed;if((e="function"==typeof n?e.filter(function(e){return!1!==n(e)}):e).length)return t(e)},Y(r=u,h.SPEED),function(e,t){t(e.map(function(e){return void 0!==e.payload&&delete e.payload,e}))},function(e){u.send({url:""+u.config.speedUrl,method:"post",data:z(e,u.bean),log:e,type:h.SPEED})}]),u.request=function(e,t,n){e.url&&u.bean.id&&(!/^\w{8}-\w{4}-\w{4}-\w{4}-\w{12}$/.test(String(u.bean.aid))||w("getNetworkType")&&void 0===u.bean.netType?u.requestSchedule.addTask({options:e,success:t,fail:n}):(u.requestSchedule.addTask({options:e,success:t,fail:n}),u.requestSchedule.fireTask()))},u.sendRequest=function(s,e,t){var n,r,o,i=s.url,a=(u.config.whiteListUrl===i&&(n=e,e=function(e){null!=n&&n(JSON.stringify(e.data))}),s.method),a=void 0===a?"get":a,c=(!1!==s.addBean&&(i=((e,t)=>{var n,r,o,i=e,a=s.beanFilter||[];for(n in t)-1===a.indexOf(n)&&((o=(r=new RegExp("([?&])"+n+"(=([^&]*))?(?=&|$)")).exec(i))?o[2]&&""!==o[3]&&"undefined"!==o[3]||(i=i.replace(r,"$1"+n+"="+t[n])):(o=-1<i.indexOf("?")?"&":"?",i+=o+n+"="+t[n]));return i})(i,f(f({},u.bean),{from:P(u.config)}))),s),l=u.config.onBeforeRequest;return(c=l?l(s,u):c)&&c.url?(l=u.config.enableHttp2||!1,"get"===a?(a=i,r=c.data,i="string"!=typeof a?"":"object"==typeof r&&r?(o=Object.getOwnPropertyNames(r).map(function(e){var t=r[e];return e+"="+("string"==typeof t?encodeURIComponent(t):encodeURIComponent(JSON.stringify(t)))}).join("&").replace(/eval/gi,"evaI"),a+(-1===a.indexOf("?")?"?":"&")+o):a,u.originRequest(f({url:i,enableHttp2:l,success:e,fail:t,complete:u.requestSchedule.complete},s.requestConfig))):("string"==typeof c.data&&(c.data=c.data.replace(/eval/gi,"evaI")),u.originRequest(f({url:i,enableHttp2:l,header:c.contentType?{"content-type":c.contentType}:void 0,method:"POST",data:c.data,success:e,fail:t,complete:u.requestSchedule.complete},s.requestConfig))),!0):(o="",c&&c.url||(o="Sending request blocked. Please handle the parameters reasonably, options.url is necessary",console.log(o)),null!=t&&t(o),u.requestSchedule.complete(),!1)};try{if(u.checkRuntimePlatform(e.platform),n=u.runtimePlatform,xe=n,"unknown"===u.runtimePlatform)return console.warn("Unknown platform detected, Aegis initialization stopped"),u;u.originRequest=T().request,u.initRequestSchedule(),u.init(e),u.extendBean("sessionId",C.sessionID),u.extendBean("referer",(t=T(),(w("getLaunchOptionsSync")?t.getLaunchOptionsSync():{scene:""}).scene||""))}catch(e){console.warn(e),console.log("%cThe above error occurred in the process of initializing Aegis, which will affect your normal use of Aegis.\nIt is recommended that you contact us for feedback and thank you for your support.","color: red"),u.sendSDKError(e)}return u}T();N.prototype.addCallback=function(e){e&&this.callbacks.push(e)},N.prototype.prefixHandler=function(e){return f(f({},e),{aegisRequestStartTime:+new Date})},N.prototype.onStartHandler=function(n){var e;this.callbacks.forEach(function(e){var t;try{null!=(t=e.onStart)&&t.call(e,n)}catch(e){}}),null!=(e=n.onStart)&&e.call(n,n)},N.prototype.successHandler=function(n,r,o){var e;this.callbacks.forEach(function(e){var t;try{null!=(t=e.success)&&t.call(e,n,r,o)}catch(e){}}),null!=(e=r.success)&&e.call(r,n,r)},N.prototype.failHandler=function(n,r,o){var e;this.callbacks.forEach(function(e){var t;try{null!=(t=e.fail)&&t.call(e,n,r,o)}catch(e){}}),null!=(e=r.fail)&&e.call(r,n,r)},N.prototype.completeHandler=function(n,r,o){var e;this.callbacks.forEach(function(e){var t;try{null!=(t=e.complete)&&t.call(e,n,r,o)}catch(e){}}),null!=(e=r.complete)&&e.call(r,n,r)},N.prototype.getCurrentFormFromCallbacks=function(){var e=null==(e=this.callbacks.find(function(e){return e.getCurrentFrom}))?void 0:e.getCurrentFrom;return null==e?void 0:e()},N.prototype.override=function(){try{this.defineApiProperty()}catch(e){console.warn("cannot override `"+this.apiName+"`, error is: "+e)}finally{this.isOverride=!0}};var k=N,_e={};function N(e){this.callbacks=[],this.isOverride=!1;var t=e.apiName;this.apiName=t,this.isOverride||this.override(),this.callbacks.push(e)}function qe(e){var t,n,r=e.apiName,o=_e[r];o?o.hackCloudReq.addCallback(e):(o=r,n=T(),n=we()?null==(t=n.cloud)?void 0:t.createCloudContext:null==(t=n.cloud)?void 0:t[o],t=new je(e),_e[r]={hackCloudReq:t,originApi:n}),_e[r]}function Fe(e){var t=e.apiName,n=He[t];n?n.hackReq.addCallback(e):(n=T()[t],He[t]={hackReq:new Me(e),originApi:n}),He[t]}t(L,De=k),L.prototype.defineApiProperty=function(){we()?this.defineAlipayCloudProperty():this.defineWxCloudProperty()},L.prototype.defineWxCloudProperty=function(){var e=this,t=T();t.cloud&&t.cloud[this.apiName]&&Object.defineProperty(t.cloud,this.apiName,{get:function(){return e.hackHandler.bind(e)}})},L.prototype.defineAlipayCloudProperty=function(){var e,o,i=this,a=T();null!=(e=a.cloud)&&e.createCloudContext&&(o=a.cloud.createCloudContext,Object.defineProperty(a.cloud,"createCloudContext",{get:function(){return function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];var n,r=o.apply(a.cloud,e);return r&&"object"==typeof r&&r[i.apiName]&&(n=r[i.apiName],Object.defineProperty(r,i.apiName,{get:function(){return function(e){return i.hackHandler(e,n)}},configurable:!0})),r}},configurable:!0}))},L.prototype.hackHandler=function(e,r){var o=this,i=this.prefixHandler(e),a=(this.onStartHandler(i),this.getCurrentFormFromCallbacks());return new Promise(function(t,n){var e=r||(null==(e=_e[o.apiName])?void 0:e.originApi);e?null!=e&&e(f(f({},i),{success:function(e){o.successHandler(e,i,a),t(e)},fail:function(e){o.failHandler(e,i,a),n(e)},complete:function(e){o.completeHandler(e,i,a)}})):(e=new Error("Cloud API "+o.apiName+" is not available"),o.failHandler(e,i),n(e))})};var A,Ie,De,Ue,je=L,He={},Me=(t(Be,Ie=k),Be.prototype.defineApiProperty=function(){var e=this,t=T();Object.defineProperty(t,this.apiName,{get:function(){return e.hackHandler.bind(e)}})},Be.prototype.hackHandler=function(e){var t=this,n=this.prefixHandler(e),e=(this.onStartHandler(n),null==(e=He[this.apiName])?void 0:e.originApi),r=this.getCurrentFormFromCallbacks();return null==e?void 0:e(f(f({},n),{success:function(e){t.successHandler(e,n,r)},fail:function(e){t.failHandler(e,n,r)},complete:function(e){t.completeHandler(e,n,r)}}))},Be);function Be(){return null!==Ie&&Ie.apply(this,arguments)||this}function L(){return null!==De&&De.apply(this,arguments)||this}function We(){return null!==Ue&&Ue.apply(this,arguments)||this}t(We,Ue=k),We.prototype.defineApiProperty=function(){var e=this,t=T();A=A||t.request,Object.defineProperty(t,"request",{get:function(){return e.hackHandler.bind(e)}})};function _(r,e,o){return null!=e&&e.length&&"object"==typeof r?e.reduce(function(e,t){var n=r[t];return n?e+(""===e?"\n":"\n\n")+o+" header "+t+": "+n:e},""):""}var q,Ge,Ve,Je=new o({name:"reportApiSpeed",override:!(We.prototype.hackHandler=function(e){var t=this,n=this.prefixHandler(e);return this.onStartHandler(n),A||(e=T(),A=e.request),A(f(f({},n),{success:function(e){t.successHandler(e,n)},fail:function(e){t.failHandler(e,n)},complete:function(e){t.completeHandler(e,n)}}))}),onNewAegis:function(e){var t,n;this.override||(null!=(n=(e.config||{}).api)&&n.injectTraceHeader&&(this.traceRequestHeader=new Oe(n.injectTraceHeader,null!=(t=null==n?void 0:n.injectTraceIgnoreUrls)?t:[],null==n?void 0:n.injectTraceUrls)),this.override=!0,this.hackRequest(e.config),this.overrideCallFunction(e.config),this.overrideCallContainer(e.config))},hackRequest:function(p){var d=this;Fe({apiName:"request",getCurrentFrom:function(){return P(p)},onStart:function(e){var t=((null==p?void 0:p.api)||{}).injectTraceHeader,n=(e||{}).url;t&&(t={host:((t=/^(?:([A-Za-z]+):)?(\/{0,3})([0-9.\-A-Za-z]+)(?::(\d+))?(?:\/([^?#]*))?(?:\?([^#]*))?(?:#(.*))?$/.exec(t=n)||[])[1],t[3]),pathname:(t=getCurrentPages()).length?t[t.length-1].route:""},t=(n=d.traceRequestHeader.generate(n,{},{host:t.host,pathname:t.pathname})||{}).name,n=n.value,t)&&n&&e&&(e.header=f(f({},e.header),((e={})[t]=n,e)))},success:function(e,t,n){var r,o,i,a,s,c,l,u,f;K(t.url,p.hostUrl)||(n=n||P(p),r={method:t.method||"get",url:W(t.url),duration:Date.now()-t.aegisRequestStartTime,status:e.statusCode||0,nextHopProtocol:"",isHttps:G(t.url),type:"fetch",from:n},s=(f=p.api||{}).apiDetail,c=f.enableResDetail,a=f.reqParamHandler,l=f.resBodyHandler,u=void 0===(u=f.reqHeaders)?[]:u,f=void 0===(f=f.resHeaders)?[]:f,o=(i=V(e.data,p.api,{url:t.url,ctx:e,payload:t.data})||{}).code,i=i.isErr,a=s?E(t.data,a,{url:t.url}):"",s=s?E(c?e:e.data,l,{url:t.url}):"",c=_(null==t?void 0:t.header,u,"req"),l=_(null==e?void 0:e.header,f,"res"),u=ve(null==t?void 0:t.header),f="req url: "+r.url+" \n \nres status: "+(e.statusCode||0)+" \n \nres duration: "+r.duration+"ms \n \nreq method: "+r.method+" \n \nreq param: "+a+" \n \nres retcode: "+o+" \n \nres data: "+s+"\n "+c+"\n "+l,r.ret=o,r.isErr=+i,r.payload=t.data,d.publishNormalLog({msg:f,level:i?b.RET_ERROR:b.API_RESPONSE,ctx:e,trace:u,from:n}),d.publishSpeedLog(r))},fail:function(e,t,n){K(t.url,p.hostUrl)||(t={method:t.method||"get",url:W(t.url),duration:Date.now()-t.aegisRequestStartTime,status:0,nextHopProtocol:"",isHttps:G(t.url),type:"fetch",from:n||P(p)},d.publishSpeedLog(t))}})},overrideCallFunction:function(r){var o=this;qe({apiName:"callFunction",getCurrentFrom:function(){return P(r)},success:function(e,t,n){o.cloudSuccessCallback(r,t,e,"callFunction",n)},fail:function(e,t,n){t={method:"call",url:x()+".cloud.callFunction."+t.name,duration:Date.now()-t.aegisRequestStartTime,status:0,nextHopProtocol:"",type:"fetch",errMsg:e.errMsg,isHttps:!0,from:n||P(r)};o.publishSpeedLog(t)}})},overrideCallContainer:function(r){var o=this;qe({apiName:"callContainer",getCurrentFrom:function(){return P(r)},success:function(e,t,n){o.cloudSuccessCallback(r,t,e,"callContainer",n)},fail:function(e,t,n){t={method:"call",url:x()+".cloud.callContainer."+t.path,duration:Date.now()-t.aegisRequestStartTime,status:0,nextHopProtocol:"",type:"fetch",errMsg:e.errMsg,isHttps:!0,from:n||P(r)};o.publishSpeedLog(t)}})},cloudSuccessCallback:function(e,n,t,r,o){var i="callFunction"===r?n.name:n.path,a="callFunction"===r?t.result:t.data,i={method:"call",url:x()+".cloud."+r+"."+i,duration:Date.now()-n.aegisRequestStartTime,status:200,nextHopProtocol:"",type:"fetch",isHttps:!0,from:o||P(e)},s=["apiName","aegisRequestStartTime","config","success","fail","complete"],c=Object.keys(n).reduce(function(e,t){return s.includes(t)||(e[t]=n[t]),e},{}),r="callFunction"===r?(null==(r=t.data)?void 0:r.code)||0:t.statusCode,l=V(a,e.api,{url:i.url,ctx:t,payload:c})||{},u=l.code,l=l.isErr,l=void 0!==l&&l,u=(i.ret=u,i.isErr=+l,i.payload=c,e.api||{}),f=u.apiDetail,p=u.resBodyHandler,d=u.reqHeaders,d=void 0===d?[]:d,g=u.resHeaders,g=void 0===g?[]:g,h=u.enableResDetail,c=f?E(c,u.reqParamHandler,{url:i.url}):"",u=f?E(h?t:a,p,{url:i.url}):"",f=_(null==n?void 0:n.header,d,"req"),h=_(null==t?void 0:t.header,g,"res"),a=ve(null==n?void 0:n.header),p="req url: "+i.url+"\n \nres status: "+r+"\n \nres duration: "+i.duration+"ms \n \nreq type: "+i.type+"\n \nreq params: "+c+"\n \nres retcode: "+i.ret+"\n \nres data: "+u+"\n "+f+"\n "+h;this.publishNormalLog({msg:p,level:l?b.RET_ERROR:b.API_RESPONSE,ctx:t,trace:a,from:o||P(e)}),this.publishSpeedLog(i)},publishSpeedLog:function(t){this.$walk(function(e){e.speedLogPipeline(t)})},publishNormalLog:function(t){this.$walk(function(e){e.normalLogPipeline(t)})}}),ze=(Ze.prototype.addConfig=function(e){var t=e.send,e=e.onError;t&&this.sends.push(t),e&&this.onErrors.push(e)},Ze.prototype.toHack=function(t){var o=this,n=(this.onErrors.forEach(function(e){t.onError(e)}),t.send);return Object.defineProperty(t,"send",{get:function(){return function(r){return new Promise(function(e){n.call(t,f(f({},r),{fail:function(n){o.sends.forEach(function(e){var t;null!=(t=e.fail)&&t.call(e,n,r)}),e(n)}}))})}}}),t},Ze),Ke=(t(F,Ve=k),F.prototype.addTaskConf=function(e){this.taskHack.addConfig(e)},F.prototype.defineApiProperty=function(){var e=this,t=T();q=q||t.connectSocket,Object.defineProperty(t,"connectSocket",{get:function(){return e.hackHandler.bind(e)}})},F.prototype.hackHandler=function(e){var t=this,n=this.prefixHandler(e),e=(q||(e=T(),q=e.connectSocket),q(f(f({},n),{success:function(e){t.successHandler(e,n)},fail:function(e){t.failHandler(e,n)},complete:function(e){t.completeHandler(e,n)}})));return this.taskHack.toHack(e),e},F),k=new o({name:"onError",onNewAegis:function(e){this.listenError(e),this.hackNetWork(e),this.hackCloud(e),e.config.websocketHack&&w("sendSocketMessage")&&this.hackWsConnect()},listenError:function(n){var r,o=this,e=T();"function"==typeof e.onError&&(r=function(e){e&&o.publishErrorLog({msg:e,level:b.ERROR,from:P(n.config)})},we()?e.onError(function(e,t){return r(t||e)}):e.onError(r)),w("onUnhandledRejection")&&e.onUnhandledRejection(function(e){var e=e.reason;if(e&&!(-1<JSON.stringify(e).indexOf("request:fail"))){if(e&&"object"==typeof e&&"error"in e){var t=Number(e.error);if(!isNaN(t)&&[1,2,11,12,13,14,15,19,20,23].includes(t))return}o.publishErrorLog({msg:e,errorMsg:null==(e=null==(t=(null==e?void 0:e.message)||(null==e?void 0:e.errMsg)||y(e))?void 0:t.slice)?void 0:e.call(t,0,150),level:b.PROMISE_ERROR,from:P(n.config)})}}),w("onPageNotFound")&&e.onPageNotFound(function(e){e&&o.publishErrorLog({msg:e,level:b.PAGE_NOT_FOUND_ERROR,from:P(n.config)})}),w("onLazyLoadError")&&e.onLazyLoadError(function(e){e&&o.publishErrorLog({msg:e,level:b.LAZY_LOAD_ERROR,from:P(n.config)})})},publishErrorLog:function(t){this.$walk(function(e){e.normalLogPipeline(t)})},hackNetWork:function(e){for(var r=this,o=e.config,t=0,n=[{apiName:"request",getCurrentFrom:function(){return P(o)},complete:function(e,t,n){return r.requestCompleteError(e,t,o,n)}},{apiName:"uploadFile",getCurrentFrom:function(){return P(o)},complete:function(e,t,n){return r.uploadFileCompleteError(e,t,o,n)}},{apiName:"downloadFile",getCurrentFrom:function(){return P(o)},complete:function(e,t,n){return r.downloadFileCompleteError(e,t,o,n)}}];t<n.length;t++){var i=n[t],a=i.apiName;Fe({apiName:a,complete:i.complete,getCurrentFrom:i.getCurrentFrom})}},requestCompleteError:function(e,t,n,r){var o=e.errMsg,i=e.errorMessage,a=e.statusCode;K(t.url,n.hostUrl)||(o=this.getErrorType({errMsg:o||i,statusCode:a}))&&this.publishNetWorkError({apiName:"request",opts:t,res:e,config:n,type:o},{fromParam:r})},downloadFileCompleteError:function(e,t,n,r){var o=e.errMsg,i=e.filePath,a=e.apFilePath,s=e.tempFilePath,o=this.getErrorType({err:o||e.errorMessage,statusCode:e.statusCode});o&&this.publishNetWorkError({apiName:"downloadFile",opts:t,res:e,config:n,type:o},{extraInfo:"\nres filePath: "+(i||a)+"\nres tempFilePath: "+s,fromParam:r})},uploadFileCompleteError:function(e,t,n,r){var o=e.errMsg,o=this.getErrorType({errMsg:o||e.errorMessage,statusCode:e.statusCode});o&&this.publishNetWorkError({apiName:"uploadFile",opts:t,res:e,config:n,type:o},{fromParam:r})},hackCloud:function(e){for(var r=this,o=e.config,t=0,n=[{apiName:"callFunction",getCurrentFrom:function(){return P(o)},complete:function(e,t,n){return r.callFunctionCompleteError(e,t,o,n)}},{apiName:"callContainer",getCurrentFrom:function(){return P(o)},complete:function(e,t,n){return r.callContainerCompleteError(e,t,o,n)}}];t<n.length;t++){var i=n[t],a=i.apiName;qe({apiName:a,complete:i.complete,getCurrentFrom:i.getCurrentFrom})}},callFunctionCompleteError:function(e,t,n,r){var o=(e.result||e).errMsg,o=this.getErrorType({errMsg:o,statusCode:e.success?200:void 0});o&&this.publishNetWorkError({apiName:"cloud.callFunction",opts:t,res:e,config:n,type:o},{fromParam:r})},callContainerCompleteError:function(e,t,n,r){var o=e.errMsg,o=this.getErrorType({err:o||e.errorMessage,statusCode:e.statusCode});o&&this.publishNetWorkError({apiName:"cloud.callContainer",opts:t,res:e,config:n,type:o},{fromParam:r})},publishNetWorkError:function(e,t){var n=(null==t?void 0:t.extraInfo)||"",r=e.apiName,o=e.opts,i=e.res,a=e.config,e=e.type,s=i.result||i,c=s.errMsg,l=s.errorMessage,u=s.statusCode,s=s.data,f=o.url,p=V(s,a.api,{url:f,ctx:i,payload:o.data}).code,d=a.api||{},g=d.apiDetail,h=d.enableResDetail,m=d.resBodyHandler,y=d.reqHeaders,y=void 0===y?[]:y,v=d.resHeaders,v=void 0===v?[]:v,d=g?E(o.data,d.reqParamHandler,{url:f}):"",g=g?E(h?i:s,m,{url:f}):"",h=_(null==o?void 0:o.header,y,"req"),s=_(null==i?void 0:i.header,v,"res"),m=ve(null==o?void 0:o.header);this.publishErrorLog({msg:"AJAX_ERROR: "+r+" "+e+"\n \nreq url: "+o.url+"\n \nres status: "+(u||0)+"\n \nres duration: "+(Date.now()-o.aegisRequestStartTime)+"ms\n \nreq method: "+(o.method||"get")+"\n \nreq param: "+d+"\n \nres retcode: "+p+"\n \nres data: "+g+"\n \nerrMsg: "+(null==(f=c||l)?void 0:f.slice(0,1e3))+"\n "+n+"\n "+h+"\n "+s,level:b.AJAX_ERROR,trace:m,ctx:i,from:(null==t?void 0:t.fromParam)||P(a)})},getErrorType:function(e){var t=e.errMsg,e=e.statusCode,n="",r=t;return["timeout","time out","ERR_CONNECTION_TIMED_OUT","ERR_TIMED_OUT","超时"].some(function(e){return String(r||"").includes(e)})?n="timeout":400<=e?n="error":(-1<(null==t?void 0:t.indexOf("fail"))||!e||e<0)&&(n="failed"),n},hackWsConnect:function(){var e,t,n=this;Fe({apiName:"sendSocketMessage",fail:function(e){n.publishSocketError(e)}}),e=(t={connectCallback:{fail:function(e){n.publishSocketError(e)}},taskOpt:{onError:function(e){n.publishSocketError(e)},send:{fail:function(e){n.publishSocketError(e)}}}}).connectCallback,t=t.taskOpt,Ge?Ge.addCallback(e):Ge=new Ke(e),t&&Ge.addTaskConf(t)},publishSocketError:function(e){e&&this.publishErrorLog({msg:e.errMsg||e.errorMessage,level:b.WEBSOCKET_ERROR})}}),$e=new o({name:"reportAssetSpeed",isStart:!1,onNewAegis:function(e){this.isStart||(this.isStart=!0,this.start(e))},start:function(n){var t,r=this,e=T();(e.performance||e.getPerformance)&&"function"==typeof(e=e.performance||e.getPerformance()).createObserver&&(t=g(),e.createObserver(function(e){e=t?e:e.getEntries();null!=e&&e.forEach(function(e){var t=e.name;!["resource-timing","resourceTiming"].includes(t)||K(e.uri,n.config.hostUrl)||"number"!=typeof e.duration||e.duration<=0||r.publishAssetLog(e)})}).observe({entryTypes:["resource"]}))},generateLog:function(e,t){var n,r=e.transferSize;return{url:(void 0===n&&(n=2048),String(e.uri).replace(U,"").slice(0,n)),method:"get",duration:Math.round(100*e.duration)/100,status:200,type:"static",isHttps:!0,urlQuery:W(e.uri,!0),nextHopProtocol:"",domainLookup:0,connectTime:0,transferSize:0<r?r:-1,from:t}},publishAssetLog:function(t){var n=this;this.$walk(function(e){e.speedLogPipeline(n.generateLog(t,P(e.config)))})}}),Qe=["onLaunch","onHide","onError","onLoad","onReady","onShow","onUnload"],Ye=new o({name:"pagePerformance",pageNavigationStartTime:{},pagePerformanceData:{},pageDataTimeout:{},reportedPageIds:new Set,onNewAegis:function(e){try{(w("getPerformance")||w("performance"))&&this.reportPerformance(e),this.setPagePV(e),this.reportSetDataTiming(e)}catch(e){}},reportPerformance:function(f){var p=this,e=T(),d=e.performance||e.getPerformance();"function"==typeof(null==d?void 0:d.createObserver)&&null!=(e=null==d?void 0:d.createObserver(function(e){var t,n,r,o,i,a,s,c,l,u;g()?null!=(u=d.getCurrentPageEntries())&&u.forEach(function(e){"navigation"===e.entryType?("appLaunch"===e.navigationType?t=e:o=e,c=e.name,l=e.startTime):c=e.path,"evaluate"===e.entryType&&"view-create-page"===e.name&&(n=e),"evaluate"===e.entryType&&"logic-create-page"===e.name&&(r=e),"paint"===e.entryType&&"first-paint"===e.name&&(i=e.startTime),"paint"===e.entryType&&"first-contentful-paint"===e.name&&(s=e.startTime),"paint"===e.entryType&&"largest-contentful-paint"===e.name&&(a=e.startTime)}):(t=null==(u=e.getEntriesByName("appLaunch"))?void 0:u[0],n=null==(u=e.getEntriesByName("firstRender"))?void 0:u[0],r=null==(u=e.getEntriesByName("evaluateScript"))?void 0:u[0],o=null==(u=e.getEntriesByName("route"))?void 0:u[0],i=null==(u=null==(u=e.getEntriesByName("firstPaint"))?void 0:u[0])?void 0:u.startTime,a=null==(u=null==(u=e.getEntriesByName("largestContentfulPaint"))?void 0:u[0])?void 0:u.startTime,s=null==(u=null==(u=e.getEntriesByName("firstContentfulPaint"))?void 0:u[0])?void 0:u.startTime,c=null==(u=(null==(u=e.getEntriesByName("firstPaint"))?void 0:u[0])||(null==(u=e.getEntriesByName("route"))?void 0:u[0])||(null==(u=e.getEntriesByName("appLaunch"))?void 0:u[0]))?void 0:u.pageId,l=null==(e=(null==(u=e.getEntriesByName("route"))?void 0:u[0])||(null==(u=e.getEntriesByName("appLaunch"))?void 0:u[0]))?void 0:e.startTime),void 0===c||p.reportedPageIds.has(c)||(p.pagePerformanceData[c]||(p.pagePerformanceData[c]={}),l&&(p.pageNavigationStartTime[c]=l),t&&(p.pagePerformanceData[c].appLaunch=t.duration||-1),n&&(p.pagePerformanceData[c].firstScreenTiming=n.duration||-1),r&&(p.pagePerformanceData[c].scriptEvaluateTiming=r.duration||-1),o&&(p.pagePerformanceData[c].pageRouteTiming=o.duration||-1),i&&p.pageNavigationStartTime[c]&&(p.pagePerformanceData[c].firstPaintTiming=Math.max(i-p.pageNavigationStartTime[c],-1)),a&&p.pageNavigationStartTime[c]&&(p.pagePerformanceData[c].LCP=Math.max(a-p.pageNavigationStartTime[c],-1)),s&&p.pageNavigationStartTime[c]&&(p.pagePerformanceData[c].FCP=Math.max(s-p.pageNavigationStartTime[c],-1)),p.checkAndPublishPageData(c,f))}))&&e.observe({entryTypes:g()?["navigation","evaluate","paint"]:["navigation","render","script"]})},checkAndPublishPageData:function(e,t){var n=this,r=this.pagePerformanceData[e];r&&(this.pageDataTimeout[e]&&clearTimeout(this.pageDataTimeout[e]),void 0!==r.firstScreenTiming&&void 0!==r.firstPaintTiming&&void 0!==r.LCP&&void 0!==r.FCP&&void 0!==r.pageRouteTiming?this.publishPageData(e,t):this.pageDataTimeout[e]=setTimeout(function(){n.pagePerformanceData[e]&&0<Object.keys(n.pagePerformanceData[e]).length&&n.publishPageData(e,t)},5e3))},publishPageData:function(e,t){var n=this.pagePerformanceData[e];n&&0!==Object.keys(n).length&&(g()||this.reportedPageIds.add(e),delete this.pagePerformanceData[e],delete this.pageNavigationStartTime[e],this.pageDataTimeout[e]&&(clearTimeout(this.pageDataTimeout[e]),delete this.pageDataTimeout[e]),this.publish(n,t))},publish:function(t,n){var e,r,o,i=[],a=n.config,s=-1===(null==(e=n.config.performanceUrl)?void 0:e.indexOf("?"))?"?":"&";for(r in t)i.push(r+"="+t[r]);"function"==typeof a.urlHandler?(o=a.urlHandler()||window.location.href,this.$walk(function(e){e.send({url:n.config.performanceUrl+s+i.join("&")+"&from="+encodeURIComponent(o),beanFilter:["from"],type:h.PERFORMANCE,log:t})})):this.$walk(function(e){e.send({url:n.config.performanceUrl+s+i.join("&"),type:h.PERFORMANCE,log:t})})},setPagePV:function(r){var o,t=this,e=T(),i="";e.onAppRoute&&"tt"!==x()?e.onAppRoute(function(e){"appLaunch"===e.openType&&!r.config.spa||(t.$walk(function(e){e.send({url:""+e.config.pvUrl,type:h.PV})}),t.reportPageLoaded(e))}):(o=Page,Page=function(e){var t=e.onLoad,n=(e.onLoad=function(e){return this.options=e,null==t?void 0:t.call(this,e)},e.onShow);return e.onShow=function(){var e;return r.config.spa?(e=P(r.config))===i?null==t?void 0:t.call(this):(i=e,r.send({url:""+r.config.pvUrl,type:h.PV}),null==n?void 0:n.call(this)):null==n?void 0:n.call(this)},o(e)})},reportPageLoaded:function(e){e="infoType: behaviorBacktracking\ndataType: pageLoadAndRoute\npageLoadedPath: "+e.path+"\nopenType: "+e.openType;this.publishNormalLog({msg:e,level:b.INFO})},publishNormalLog:function(t){this.$walk(function(e){e.normalLogPipeline(t)})},reportSetDataTiming:function(o){var e,s,c,l,n,i,a,u,t=this,r=o.config.setDataReportConfig,r=void 0===r?{}:r;!0!==r.disabled&&(e=r.timeThreshold,s=!1!==r.withDataPaths,c=e&&0<+e?+e:0,l=O([m(o,10),function(e){e=e.map(function(e){return{type:h.SET_DATA,component:e.from,duration:e.duration,fields:e.dataPaths&&e.dataPaths.length?e.dataPaths.sort().join(";"):void 0,size:e.size}});o.send({url:o.config.setDataReportUrl+"?payload="+encodeURIComponent(JSON.stringify({miniProgramData:e})),type:h.SET_DATA,log:e})}]),n=Page,i=Component,a=function(e,t){var i,a,n=t.updateStartTimestamp,r=t.dataPaths,r=void 0===r?[]:r,t=t.updateEndTimestamp-n;isNaN(t)||t<c||(n={from:e.is||P(o.config),duration:t},s&&0<r.length&&Object.assign(n,{dataPaths:r.slice(0,30),size:(t=r,a=0,null!=(i=e)&&i.data?(t.forEach(function(t){for(var e=Array.isArray(t)?t:[t],n=i.data[e[0]],r=1,o=e.length;r<o;r++)n[e[r]]&&(n=n[e[r]]);t="";try{t=JSON.stringify(n)}catch(e){t=""}a+=2*(void 0===t?"":t).replace(/[\u4e00-\u9fa5]/g,"aa").length}),a=Math.min(a,10485760)):a)}),l(n))},u=function(r){var e="infoType: behaviorBacktracking\ndataType: tapEvent"+Object.keys(r[0]).reduce(function(e,t){var n="";try{n=t+": "+JSON.stringify(r[0][t])}catch(e){n=""}return e+"\n"+n},"");t.publishNormalLog({msg:e,level:b.INFO})},Page=function(t){var e=t.onReady;return t.onReady=function(){var t=this;return"function"==typeof this.setUpdatePerformanceListener&&this.setUpdatePerformanceListener({withDataPaths:s},function(e){a(t,e)}),null==e?void 0:e.call(this)},Object.keys(t).forEach(function(e){var n;"function"!=typeof t[e]||Qe.includes(e)||(n=t[e],t[e]=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];return null!=e&&e[0]&&"tap"===e[0].type&&u(e),null==n?void 0:n.apply(this,e)})}),n(t)},Component=function(e){e.lifetimes&&e.lifetimes.attached?(n=e.lifetimes.attached,e.lifetimes.attached=function(){var t=this;return"function"==typeof this.setUpdatePerformanceListener&&this.setUpdatePerformanceListener({withDataPaths:s},function(e){a(t,e)}),null==n?void 0:n.call(this)}):(r=e.attached,e.attached=function(){var t=this;return"function"==typeof this.setUpdatePerformanceListener&&this.setUpdatePerformanceListener({withDataPaths:s},function(e){a(t,e)}),null==r?void 0:r.call(this)});var n,r,t=e.methods;return t&&"[object Object]"===Object.prototype.toString.call(t)&&Object.keys(t).forEach(function(e){var n;"function"==typeof t[e]&&(n=t[e],t[e]=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];return null!=e&&e[0]&&"tap"===e[0].type&&u(e),null==n?void 0:n.apply(this,e)})}),i(e)})}}),o=new o({name:"reportLoadPackageSpeed",isLoaded:!1,onNewAegis:function(e){this.isLoaded||(this.isLoaded=!0,this.start(e))},start:function(){var t,n=this,e=T();(e.performance||e.getPerformance)&&"function"==typeof(e=e.performance||e.getPerformance()).createObserver&&(t=g(),e.createObserver(function(e){e=t?e:e.getEntries();null!=e&&e.forEach(function(e){var t=e.name;!["miniprogram-package","downloadPackage"].includes(t)||"number"!=typeof e.duration||e.duration<=0||n.publishPackageLog(e)})}).observe({entryTypes:t?["resource"]:["loadPackage"]}))},generateLog:function(e){return[{type:h.LOAD_PACKAGE,packageName:e.packageName,size:Math.round(100*e.packageSize)/100,duration:Math.round(100*e.duration)/100}]},publishPackageLog:function(n){var r=this;this.$walk(function(e){var t=r.generateLog(n);e.send({url:e.config.setDataReportUrl+"?payload="+encodeURIComponent(JSON.stringify({miniProgramData:t})),type:h.LOAD_PACKAGE,log:t})})}});function F(e){e=Ve.call(this,e)||this;return e.taskHack=new ze,e}function Ze(){this.onErrors=[],this.sends=[]}r.use(k),r.use(Je),r.use(Le),r.use($e),r.use(Ye),r.use(o),r.use(Ae),e.MY="my",e.QQ="qq",e.TT="tt",e.WX="wx",e.default=r,Object.defineProperty(e,"__esModule",{value:!0})});
@@ -22,4 +22,5 @@ export default class Aegis extends Core {
22
22
  request: (options: SendOption, success?: SendSuccess | undefined, fail?: SendFail | undefined) => void;
23
23
  speedLogPipeline: import("../../core/src").Pipeline<any, any>;
24
24
  uploadLogs(params?: any, conds?: any): void;
25
+ getOriginFrom(): string;
25
26
  }
@@ -6,6 +6,9 @@ export declare const MAX_FROM_LENGTH: number;
6
6
  export declare const TIMESTAMP_REG: RegExp;
7
7
  export declare const MAX_REPEAT_TIMES = 60;
8
8
  export declare const CLEAR_REPEAT_CACHE_TIMEOUT = 60000;
9
+ export declare const MAX_CUSTOM_TIME = 2147483646;
10
+ export declare const MAX_ERROR_COUNT = 5;
9
11
  export declare const FORBIDDEN_RESPONSE_DATA = "403 forbidden";
12
+ export declare const MAX_PROMISE_ERROR_MSG_LENGTH = 150;
10
13
  export declare const getDefaultConfig: () => Config;
11
14
  export declare const setConfigUrl: (config: Config, hostUrl?: string) => Config;
@@ -1,4 +1,4 @@
1
- export { getDefaultConfig, setConfigUrl, REPORT_TIMEOUT, MAX_FAIL_REQUEST_NUM, MAX_LOG_LENGTH, MAX_FROM_LENGTH, MAX_REPEAT_TIMES, CLEAR_REPEAT_CACHE_TIMEOUT, FORBIDDEN_RESPONSE_DATA, TIMESTAMP_REG, } from './config';
1
+ export { getDefaultConfig, setConfigUrl, REPORT_TIMEOUT, MAX_FAIL_REQUEST_NUM, MAX_LOG_LENGTH, MAX_FROM_LENGTH, MAX_REPEAT_TIMES, CLEAR_REPEAT_CACHE_TIMEOUT, FORBIDDEN_RESPONSE_DATA, TIMESTAMP_REG, MAX_CUSTOM_TIME, MAX_ERROR_COUNT, MAX_PROMISE_ERROR_MSG_LENGTH, } from './config';
2
2
  export { URL_SPEED_IGNORE, ERROR_MSG_IGNORE, } from './report-ignore';
3
3
  export declare const COMPLETION_KEYS: string[];
4
4
  export declare const RESOURCE_TYPE_STATIC = "static";
@@ -2,16 +2,33 @@ import { InterfaceEventEmitter } from './util';
2
2
  import { Config, LogType, Environment, SendOption, SendSuccess, SendFail, SpeedLog, BridgeLog, ReportTimeLog, SendType, EventLog } from './interface';
3
3
  import Plugin from './plugin';
4
4
  import { Pipe } from './pipes';
5
+ /**
6
+ * Aegis 核心逻辑,所有平台的 Aegis 类都继承于 Core
7
+ * 类似 linux 微内核的架构组织代码
8
+ * 所有 Aegis 的功能都是基于 Core 实现
9
+ * 1. 封装了 Aegis 的基本属性和方法
10
+ * 2. 封装了 Aegis 的插件模型,Aegis 中所有数据采集的逻辑均基于插件体系实现
11
+ * 3. 封装了 Aegis 的基础实例方法,包括 info report reportEvent 等,平台无需自己重复实现
12
+ * 4. 封装了 Aegis 的生命周期,实现生命周期管理
13
+ */
5
14
  export default class Core {
6
15
  static version: string;
7
16
  static instances: Core[];
8
- constructor(config: Config);
9
- get __version__(): string;
10
- isGetSample: boolean;
11
- isHidden: boolean;
12
17
  static logType: typeof LogType;
13
- get LogType(): typeof LogType;
14
18
  static environment: typeof Environment;
19
+ static installedPlugins: Plugin[];
20
+ /**
21
+ * 使用插件
22
+ * @param plugin
23
+ */
24
+ static use(plugin: Plugin): void;
25
+ /**
26
+ * 销毁插件
27
+ * @param plugin
28
+ */
29
+ static unuse(plugin: Plugin): void;
30
+ isGetSample: boolean;
31
+ isHidden: boolean;
15
32
  config: Config;
16
33
  isWhiteList: boolean;
17
34
  lifeCycle: InterfaceEventEmitter;
@@ -19,33 +36,52 @@ export default class Core {
19
36
  [key: string]: string | number | boolean;
20
37
  };
21
38
  sendNow: boolean;
39
+ normalLogPipeline: import("./pipes").Pipeline<any, any>;
40
+ eventPipeline: import("./pipes").Pipeline<any, any>;
41
+ customTimePipeline: import("./pipes").Pipeline<any, any>;
42
+ private timeMap;
43
+ private failRequestCount;
44
+ /**
45
+ * 构造函数
46
+ * @param config
47
+ */
48
+ constructor(config: Config);
49
+ /**
50
+ * 初始化方法,用于记录用户传入参数和初始化 SDK 所有插件
51
+ * @param config
52
+ */
22
53
  init(config: Config): void;
54
+ /**
55
+ * 销毁 Aegis 实例,清空 Aegis 实例属性和方法,销毁插件
56
+ * @param force
57
+ */
58
+ destroy(force?: boolean): void;
59
+ /**
60
+ * 设置属性,这个方法也暴露给用户,方便用户动态修改 SDK 属性
61
+ * @param config
62
+ * @returns
63
+ */
23
64
  setConfig(config: Partial<Config>): Config;
24
- static installedPlugins: Plugin[];
25
- static use(plugin: Plugin): void;
26
- static unuse(plugin: Plugin): void;
65
+ extendBean(key: string, value: string | number): void;
66
+ send(options: SendOption, success?: SendSuccess, fail?: SendFail): any;
67
+ sendSDKError(err: Error): void;
68
+ sendPipeline(pipes: Pipe[], type: SendType): import("./pipes").Pipeline<any, any>;
69
+ validateRange(value: number): number;
27
70
  info(...msg: any): void;
28
71
  infoAll(...msg: any): void;
29
72
  report(...msg: any): void;
30
73
  error(...msg: any): void;
31
- normalLogPipeline: import("./pipes").Pipeline<any, any>;
32
- speedLogPipeline(_log?: SpeedLog | SpeedLog[] | BridgeLog | BridgeLog[]): void;
33
- reportPv(id: number): void;
34
74
  reportEvent(event: string | EventLog): void;
35
- eventPipeline: import("./pipes").Pipeline<any, any>;
36
- private timeMap;
37
- private failRequestCount;
38
- reportTime(key: string | ReportTimeLog, duration?: number): void;
39
75
  reportT(obj: ReportTimeLog): void;
76
+ reportTime(key: string | ReportTimeLog, duration?: number): void;
40
77
  time(key: string): void;
41
78
  timeEnd(key: string): void;
42
- private submitCustomTime;
43
- customTimePipeline: import("./pipes").Pipeline<any, any>;
44
- extendBean(key: string, value: string | number): void;
45
- sendPipeline(pipes: Pipe[], type: SendType): import("./pipes").Pipeline<any, any>;
46
- send(options: SendOption, success?: SendSuccess, fail?: SendFail): any;
47
79
  ready(_options: SendOption, _success?: SendSuccess, _fail?: SendFail): void;
48
80
  request(_options: SendOption, _success?: SendSuccess, _fail?: SendFail): void;
49
- sendSDKError(err: any): void;
50
- destroy(force?: boolean): void;
81
+ speedLogPipeline(_log?: SpeedLog | SpeedLog[] | BridgeLog | BridgeLog[]): void;
82
+ getOriginFrom(): string;
83
+ get __version__(): string;
84
+ get LogType(): typeof LogType;
85
+ reportPv(id: number): void;
86
+ private submitCustomTime;
51
87
  }
@@ -1,3 +1,3 @@
1
1
  import Core from '../core';
2
- import { Pipe } from '../pipes/index';
2
+ import { Pipe } from '../pipes';
3
3
  export declare const afterRequestHooks: (aegis: Core) => Pipe;
@@ -1,6 +1,6 @@
1
1
  import Core from '../core';
2
2
  import { SendType } from '../interface';
3
- import { Pipe } from '../pipes/index';
3
+ import { Pipe } from '../pipes';
4
4
  /**
5
5
  * beforeRequest 是 Aegis SDK 中最重要的 hook,可以拦截和修改所有的上报
6
6
  * 当 beforeRequest 返回 false 的时候,这条日志就不会上报
@@ -1,3 +1,3 @@
1
1
  import Core from '../core';
2
- import { Pipe } from '../pipes/index';
2
+ import { Pipe } from '../pipes';
3
3
  export declare const modifyRequestHooks: (aegis: Core) => Pipe;
@@ -4,6 +4,6 @@ import Plugin from './plugin';
4
4
  export { Plugin };
5
5
  export default Core;
6
6
  export { LogType, NormalLog, SpeedLog, BridgeLog, StaticAssetsLog, PagePerformanceLog, PagePerformanceLogForHippy3, HippyPagePerformanceLog, Config, CoreApiConfig, SendOption, SendSuccess, SendFail, SendType, PlatTypeNum, NetworkTypeNum, PagePerformanceStruct, } from './interface';
7
- export { getDefaultConfig, setConfigUrl, globalAny, REPORT_TIMEOUT, MAX_FROM_LENGTH, ERROR_MSG_IGNORE, URL_SPEED_IGNORE, RESOURCE_TYPE_FETCH, RESOURCE_TYPE_STATIC, UNKNOWN, RESOURCE_TYPE, } from './constant';
7
+ export { getDefaultConfig, setConfigUrl, globalAny, REPORT_TIMEOUT, MAX_FROM_LENGTH, ERROR_MSG_IGNORE, URL_SPEED_IGNORE, RESOURCE_TYPE_FETCH, RESOURCE_TYPE_STATIC, UNKNOWN, RESOURCE_TYPE, MAX_PROMISE_ERROR_MSG_LENGTH, } from './constant';
8
8
  export * from './pipes';
9
9
  export * from './util';
@@ -36,6 +36,7 @@ export interface Config {
36
36
  eventUrl?: string;
37
37
  webVitalsUrl?: string;
38
38
  setDataReportUrl?: string;
39
+ memoryUrl?: string;
39
40
  pageUrl?: string;
40
41
  getNetworkType?: Function;
41
42
  websocketHack?: boolean;
@@ -52,11 +53,18 @@ export interface Config {
52
53
  ext1?: string;
53
54
  ext2?: string;
54
55
  ext3?: string;
56
+ ext4?: string;
57
+ ext5?: string;
58
+ ext6?: string;
59
+ ext7?: string;
60
+ ext8?: string;
61
+ ext9?: string;
62
+ ext10?: string;
55
63
  destroy?: Function;
56
64
  pagePerformance?: boolean | PagePerformanceStruct;
57
65
  [key: string]: any;
58
66
  }
59
- export interface PagePerformanceStruct {
67
+ export declare type PagePerformanceStruct = {
60
68
  firstScreenInfo?: false;
61
69
  urlHandler?: () => string;
62
- }
70
+ };