@qiu_jun/monitors 0.0.6 → 0.0.7

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -2,8 +2,6 @@
2
2
 
3
3
  前端监控 SDK:采集异常 + 性能指标,上报至异常分析平台(main-server `/api/exception/report`)。
4
4
 
5
- 内置 reporter(与 main-server `exception-sdk` 协议对齐),**无外部 SDK 依赖**,可独立打包发布 npm。
6
-
7
5
  ## 安装
8
6
 
9
7
  ```bash
@@ -49,12 +47,35 @@ const monitor = new Monitor({
49
47
  |---|---|---|
50
48
  | JS 错误 | `error` | 含选择器、白屏检测 |
51
49
  | Promise 未捕获 | `unhandledrejection` | |
52
- | 资源加载失败 | `resource` | img/script/css 等 |
53
50
  | XHR 失败/超时 | `request` | message 格式 `Request failed [500]: GET /api/...` |
54
51
  | FP/FCP/FMP/LCP | `paint` | 指标在 `device` |
55
52
  | DOMContentLoaded/load | `timing` | |
56
53
  | 长任务 | `longTask` | duration ≥ 100ms 时 level=WARN |
57
54
 
55
+ ## 错误回放(可选,Web/H5)
56
+
57
+ 基于 rrweb 环形录制用户操作,**出错时**上传最近 30~60 秒回放(独立接口),错误事件通过 `device.replayId` 关联,异常平台用 rrweb-player 播放。小程序无 DOM 不支持。
58
+
59
+ ```ts
60
+ new Monitor({
61
+ // ...
62
+ replay: {
63
+ enabled: true,
64
+ sampleRate: 1, // 会话采样 0-1,默认 1
65
+ bufferSeconds: 60, // 环形缓冲长度,默认 60
66
+ maxUploadsPerSession: 10, // 单会话上传上限,默认 10
67
+ minUploadIntervalMs: 30_000,
68
+ captureRequest: false, // 请求失败是否也触发,默认 false
69
+ maskTextClass: 'rr-mask', // 文本脱敏类名
70
+ // replayEndpoint: '...', // 默认由 endpoint 末尾 /report 换成 /replay
71
+ },
72
+ })
73
+ ```
74
+
75
+ - 仅 `error` / `unhandledrejection` 触发上传;回放走独立 `POST {endpoint 前缀}/replay`,失败静默不影响错误上报
76
+ - 隐私默认:输入值全脱敏;敏感文本加 `.rr-mask`、敏感区域加 `.rr-block`
77
+ - 回放上传需服务端支持(契约见 [backend-integration.md](./backend-integration.md) §2.3);script 标签(UMD)接入需页面提供 rrweb / pako 的 import map,否则回放静默禁用
78
+
58
79
  ## 手动上报
59
80
 
60
81
  ```ts
@@ -15,6 +15,29 @@ export interface IMonitorOptions {
15
15
  /** XHR 超时阈值 ms,默认 60000(1 分钟) */
16
16
  timeoutDuration?: number;
17
17
  maxQueueSize?: number;
18
+ /** 错误回放(仅 Web/H5,小程序无 DOM 不支持),默认关闭 */
19
+ replay?: ReplayOptions;
20
+ }
21
+ /** 错误回放配置:环形录制最近操作,出错时上传最近 30~60 秒,经独立接口 + device.replayId 关联异常事件 */
22
+ export interface ReplayOptions {
23
+ /** 开启回放,默认 false */
24
+ enabled?: boolean;
25
+ /** 会话采样率 0-1,默认 1(命中才录制) */
26
+ sampleRate?: number;
27
+ /** 环形缓冲长度(秒),默认 60(实际覆盖 bufferSeconds/2 ~ bufferSeconds) */
28
+ bufferSeconds?: number;
29
+ /** 单会话回放上传上限,默认 10 */
30
+ maxUploadsPerSession?: number;
31
+ /** 两次上传最小间隔(ms),默认 30000 */
32
+ minUploadIntervalMs?: number;
33
+ /** 单条回放解压前体积上限(字节),默认 2MB,超出只保留最新快照段 */
34
+ maxReplayBytes?: number;
35
+ /** 请求失败是否也触发回放上传,默认 false(仅 error/unhandledrejection 触发) */
36
+ captureRequest?: boolean;
37
+ /** 文本脱敏类名,默认 'rr-mask';输入值默认全脱敏(maskAllInputs) */
38
+ maskTextClass?: string;
39
+ /** 回放上传地址;默认由 endpoint 末尾 /report 换成 /replay,推导不出时必须显式传 */
40
+ replayEndpoint?: string;
18
41
  }
19
42
  export interface BaseLog {
20
43
  title: string;
@@ -26,14 +49,13 @@ export interface BaseLog {
26
49
  }
27
50
  export interface ErrorLog {
28
51
  type: "error";
29
- errorType: "jsError" | "promiseError" | "loadResourceError" | "xhrError";
52
+ errorType: "jsError" | "promiseError" | "xhrError";
30
53
  message: string;
31
54
  filename?: string;
32
55
  position?: string;
33
56
  stack?: string;
34
57
  selector?: string;
35
58
  isWhiteScreen?: boolean;
36
- tagName?: string;
37
59
  xhrData?: {
38
60
  eventType: "load" | "error";
39
61
  url: string;
@@ -5,48 +5,31 @@ const utils_1 = require("../utils");
5
5
  function onWindowErr() {
6
6
  window.addEventListener('error', event => {
7
7
  console.log("error event: ", event);
8
- // 监听 JS/CSS 资源文件加载错误
8
+ // 资源加载失败(target 带 src/href,如 img/script/link)噪声多、价值低,不再上报
9
9
  const target = event.target;
10
- let filename;
11
10
  if (target &&
12
- (filename =
13
- target.src || target.href)) {
14
- // 1、数据建模存储
15
- const log = {
16
- type: "error",
17
- errorType: "loadResourceError", // 错误类型 - JS/CSS 资源加载错误
18
- message: `${filename} resource loading fail.`,
19
- filename, // 报错的文件
20
- tagName: target.tagName, // 资源标签名称
21
- // body script
22
- selector: (0, utils_1.getSelector)(event.target),
23
- };
24
- console.log("log: ", log);
25
- // 2、上报数据
26
- // @ts-ignore
27
- this.send(log);
28
- }
29
- else {
30
- // 监听 JS 代码执行出错
31
- const lastEvent = (0, utils_1.getLastEvent)(); // 监听到错误后,获取到最后一个交互事件
32
- const isWhiteScreen = (0, utils_1.checkWhiteScreen)(); // 检查是否白屏
33
- // 1.1、数据建模存储
34
- const errorLog = {
35
- // kind: "stability", // 监控指标的大类
36
- type: "error",
37
- errorType: "jsError",
38
- message: event.message,
39
- filename: event.filename,
40
- position: `${event.lineno}:${event.colno}`,
41
- stack: (0, utils_1.formatStack)(event.error.stack),
42
- selector: lastEvent ? (0, utils_1.getSelector)() : "",
43
- isWhiteScreen,
44
- };
45
- console.log("js error log: ", errorLog);
46
- // 1.2、上报数据
47
- // @ts-ignore
48
- this.send(errorLog);
11
+ (target.src || target.href)) {
12
+ return;
49
13
  }
14
+ // 监听 JS 代码执行出错
15
+ const lastEvent = (0, utils_1.getLastEvent)(); // 监听到错误后,获取到最后一个交互事件
16
+ const isWhiteScreen = (0, utils_1.checkWhiteScreen)(); // 检查是否白屏
17
+ // 1.1、数据建模存储
18
+ const errorLog = {
19
+ // kind: "stability", // 监控指标的大类
20
+ type: "error",
21
+ errorType: "jsError",
22
+ message: event.message,
23
+ filename: event.filename,
24
+ position: `${event.lineno}:${event.colno}`,
25
+ stack: (0, utils_1.formatStack)(event.error.stack),
26
+ selector: lastEvent ? (0, utils_1.getSelector)() : "",
27
+ isWhiteScreen,
28
+ };
29
+ console.log("js error log: ", errorLog);
30
+ // 1.2、上报数据
31
+ // @ts-ignore
32
+ this.send(errorLog);
50
33
  }, true);
51
34
  // promise
52
35
  window.addEventListener('unhandledrejection', event => {
package/dist/monitor.d.ts CHANGED
@@ -12,6 +12,7 @@ export default class Monitor {
12
12
  maxQueueSize: number;
13
13
  sendTimer: number | null;
14
14
  reporter: ExcReporter;
15
+ private replay;
15
16
  private readonly options;
16
17
  originalXHR: {
17
18
  new (): XMLHttpRequest;
@@ -29,7 +30,9 @@ export default class Monitor {
29
30
  originalOnerror: OnErrorEventHandler;
30
31
  constructor(options: IMonitorOptions);
31
32
  init(): void;
32
- /** 统一上报:转异常平台格式 → reporter 批量 POST */
33
+ /** 回放初始化:显式开启 + 采样命中 + 回放地址可解析 */
34
+ private initReplay;
35
+ /** 统一上报:转异常平台格式 → reporter 批量 POST;错误触发回放切片上传并回填 device.replayId */
33
36
  send(data: MonitorTypeLog): void;
34
37
  /** 手动上报自定义事件 */
35
38
  capture(event: ExcEventPayload): void;
package/dist/monitor.js CHANGED
@@ -4,6 +4,7 @@ const exception_1 = require("./exception");
4
4
  const modules_1 = require("./modules");
5
5
  const index_1 = require("./utils/index");
6
6
  const toExcEvent_1 = require("./utils/toExcEvent");
7
+ const replay_1 = require("./replay");
7
8
  class Monitor {
8
9
  constructor(options) {
9
10
  var _a, _b;
@@ -57,6 +58,12 @@ class Monitor {
57
58
  writable: true,
58
59
  value: void 0
59
60
  });
61
+ Object.defineProperty(this, "replay", {
62
+ enumerable: true,
63
+ configurable: true,
64
+ writable: true,
65
+ value: null
66
+ });
60
67
  Object.defineProperty(this, "options", {
61
68
  enumerable: true,
62
69
  configurable: true,
@@ -98,6 +105,7 @@ class Monitor {
98
105
  flushInterval: options.flushInterval,
99
106
  }, (0, exception_1.makeH5Transport)(options.endpoint));
100
107
  this.init();
108
+ this.initReplay();
101
109
  this.originalXHR = window.XMLHttpRequest;
102
110
  this.originalFetch = window.fetch;
103
111
  this.originalOnerror = window.onerror;
@@ -109,10 +117,42 @@ class Monitor {
109
117
  modules_1.onTiming.call(this);
110
118
  modules_1.onXHR.call(this);
111
119
  }
112
- /** 统一上报:转异常平台格式 → reporter 批量 POST */
120
+ /** 回放初始化:显式开启 + 采样命中 + 回放地址可解析 */
121
+ initReplay() {
122
+ var _a, _b;
123
+ const replayOptions = this.options.replay;
124
+ if (!(replayOptions === null || replayOptions === void 0 ? void 0 : replayOptions.enabled))
125
+ return;
126
+ const sampleRate = (_a = replayOptions.sampleRate) !== null && _a !== void 0 ? _a : 1;
127
+ if (Math.random() >= sampleRate)
128
+ return;
129
+ const replayEndpoint = (_b = replayOptions.replayEndpoint) !== null && _b !== void 0 ? _b : (0, replay_1.deriveReplayEndpoint)(this.endpoint);
130
+ if (!replayEndpoint) {
131
+ console.warn('monitor: replay.replayEndpoint 未配置且无法从 endpoint(需以 /report 结尾)推导,回放已禁用');
132
+ return;
133
+ }
134
+ this.replay = new replay_1.ReplayController({
135
+ replayEndpoint,
136
+ projectKey: this.projectKey,
137
+ bufferSeconds: replayOptions.bufferSeconds,
138
+ maxUploadsPerSession: replayOptions.maxUploadsPerSession,
139
+ minUploadIntervalMs: replayOptions.minUploadIntervalMs,
140
+ maxReplayBytes: replayOptions.maxReplayBytes,
141
+ captureRequest: replayOptions.captureRequest,
142
+ maskTextClass: replayOptions.maskTextClass,
143
+ });
144
+ void this.replay.start();
145
+ }
146
+ /** 统一上报:转异常平台格式 → reporter 批量 POST;错误触发回放切片上传并回填 device.replayId */
113
147
  send(data) {
148
+ var _a;
114
149
  const baseData = (0, index_1.getLogBaseData)();
115
150
  const events = (0, toExcEvent_1.toExcEvents)(data, baseData, this.options);
151
+ const replayId = (_a = this.replay) === null || _a === void 0 ? void 0 : _a.captureIfTriggered(data);
152
+ if (replayId) {
153
+ for (const event of events)
154
+ event.device = { ...event.device, replayId };
155
+ }
116
156
  for (const event of events)
117
157
  this.reporter.capture(event);
118
158
  }
@@ -160,6 +200,8 @@ class Monitor {
160
200
  this.reportRequest();
161
201
  }
162
202
  destroy() {
203
+ var _a;
204
+ (_a = this.replay) === null || _a === void 0 ? void 0 : _a.stop();
163
205
  this.sendQueuedData();
164
206
  this.reporter.destroy();
165
207
  window.XMLHttpRequest = this.originalXHR;
@@ -1 +1 @@
1
- !function(e,i){"object"==typeof exports&&"undefined"!=typeof module?i(exports):"function"==typeof define&&define.amd?define(["exports"],i):i((e="undefined"!=typeof globalThis?globalThis:e||self).Monitor={})}(this,function(e){"use strict";var i=Object.defineProperty,t=Object.defineProperties,r=Object.getOwnPropertyDescriptors,o=Object.getOwnPropertySymbols,n=Object.prototype.hasOwnProperty,s=Object.prototype.propertyIsEnumerable,a=(e,t,r)=>t in e?i(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,l=(e,i)=>{for(var t in i||(i={}))n.call(i,t)&&a(e,t,i[t]);if(o)for(var t of o(i))s.call(i,t)&&a(e,t,i[t]);return e},u=(e,i)=>t(e,r(i)),c=(e,i,t)=>a(e,"symbol"!=typeof i?i+"":i,t),d=(e,i,t)=>new Promise((r,o)=>{var n=e=>{try{a(t.next(e))}catch(i){o(i)}},s=e=>{try{a(t.throw(e))}catch(i){o(i)}},a=e=>e.done?r(e.value):Promise.resolve(e.value).then(n,s);a((t=t.apply(e,i)).next())});const h="0.0.1";class w{constructor(e,i){c(this,"buffer",[]),c(this,"timer",null),c(this,"sending",!1),this.options=e,this.transport=i}capture(e){var i,t,r,o,n;const s=null!=(i=this.options.sampleRate)?i:100;s<100&&100*Math.random()>=s||(this.buffer.push(u(l({},e),{level:null!=(t=e.level)?t:"ERROR",occurredAt:null!=(r=e.occurredAt)?r:(new Date).toISOString(),sdkVersion:null!=(o=e.sdkVersion)?o:h})),this.buffer.length>100&&(this.buffer=this.buffer.slice(-100)),this.buffer.length>=(null!=(n=this.options.maxBatch)?n:20)?this.flush():this.ensureTimer())}flush(){return d(this,null,function*(){if(this.sending||0===this.buffer.length)return;this.clearTimer(),this.sending=!0;const e=this.buffer;this.buffer=[];try{yield this.transport({events:e},this.options.projectKey)}catch(i){403!==(null==i?void 0:i.statusCode)&&(this.buffer=[...e,...this.buffer].slice(-100),this.ensureTimer())}finally{this.sending=!1}})}destroy(){this.clearTimer(),this.flush()}ensureTimer(){var e;this.timer||(this.timer=setTimeout(()=>{this.timer=null,this.flush()},null!=(e=this.options.flushInterval)?e:3e4))}clearTimer(){this.timer&&(clearTimeout(this.timer),this.timer=null)}}function p(e,i){return new w(e,i)}function b(e){return(i,t)=>d(null,null,function*(){const r=yield fetch(e,{method:"POST",headers:{"content-type":"application/json","X-Project-Key":t},body:JSON.stringify(i),keepalive:!0});if(!r.ok)throw Object.assign(new Error(`monitor: 上报失败 ${r.status}`),{statusCode:r.status})})}let m,f;function g(){return m}["click","touchstart","mousedown","keydown"].forEach(e=>{document.addEventListener(e,e=>{m=e,f=e.path||e.composedPath()},{capture:!0,passive:!0})});var v,y="user-agent",k="",x="function",T="undefined",S="object",C="string",O="browser",E="cpu",R="device",q="engine",P="os",j="result",H="name",M="type",_="vendor",L="version",I="architecture",$="major",N="model",z="console",A="mobile",F="tablet",D="smarttv",V="wearable",B="xr",Q="embedded",X="inapp",W="brands",U="formFactors",G="fullVersionList",K="platform",Y="platformVersion",J="bitness",Z="sec-ch-ua",ee=Z+"-full-version-list",ie=Z+"-arch",te=Z+"-"+J,re=Z+"-form-factors",oe=Z+"-"+A,ne=Z+"-"+N,se=Z+"-"+K,ae=se+"-version",le=[W,G,A,N,K,Y,I,U,J],ue="Amazon",ce="Apple",de="ASUS",he="BlackBerry",we="Google",pe="Huawei",be="Lenovo",me="Honor",fe="LG",ge="Microsoft",ve="Motorola",ye="Nvidia",ke="OnePlus",xe="OPPO",Te="Samsung",Se="Sharp",Ce="Sony",Oe="Xiaomi",Ee="Zebra",Re="Chrome",qe="Chromium",Pe="Chromecast",je="Edge",He="Firefox",Me="Opera",_e="Facebook",Le="Sogou",Ie="Mobile ",$e=" Browser",Ne="Windows",ze=typeof window!==T&&window.navigator?window.navigator:void 0,Ae=ze&&ze.userAgentData?ze.userAgentData:void 0,Fe=function(e){for(var i={},t=0;t<e.length;t++)i[e[t].toUpperCase()]=e[t];return i},De=function(e,i){if(typeof e===S&&e.length>0){for(var t in e)if(Xe(i)==Xe(e[t]))return!0;return!1}return!!Be(e)&&Xe(i)==Xe(e)},Ve=function(e,i){for(var t in e)return/^(browser|cpu|device|engine|os)$/.test(t)||!!i&&Ve(e[t])},Be=function(e){return typeof e===C},Qe=function(e){if(e){for(var i=[],t=Ge(/\\?\"/g,e).split(","),r=0;r<t.length;r++)if(t[r].indexOf(";")>-1){var o=Ye(t[r]).split(";v=");i[r]={brand:o[0],version:o[1]}}else i[r]=Ye(t[r]);return i}},Xe=function(e){return Be(e)?e.toLowerCase():e},We=function(e){return Be(e)?Ge(/[^\d\.]/g,e).split(".")[0]:void 0},Ue=function(e){for(var i in e){var t=e[i];typeof t==S&&2==t.length?this[t[0]]=t[1]:this[t]=void 0}return this},Ge=function(e,i){return Be(i)?i.replace(e,k):i},Ke=function(e){return Ge(/\\?\"/g,e)},Ye=function(e,i){if(Be(e))return e=Ge(/^\s\s*/,e),typeof i===T?e:e.substring(0,500)},Je=function(e,i){if(e&&i)for(var t,r,o,n,s,a,l=0;l<i.length&&!s;){var u=i[l],c=i[l+1];for(t=r=0;t<u.length&&!s&&u[t];)if(s=u[t++].exec(e))for(o=0;o<c.length;o++)a=s[++r],typeof(n=c[o])===S&&n.length>0?2===n.length?typeof n[1]==x?this[n[0]]=n[1].call(this,a):this[n[0]]=n[1]:n.length>=3&&(typeof n[1]!==x||n[1].exec&&n[1].test?3==n.length?this[n[0]]=a?a.replace(n[1],n[2]):void 0:4==n.length?this[n[0]]=a?n[3].call(this,a.replace(n[1],n[2])):void 0:n.length>4&&(this[n[0]]=a?n[3].apply(this,[a.replace(n[1],n[2])].concat(n.slice(4))):void 0):n.length>3?this[n[0]]=a?n[1].apply(this,n.slice(2)):void 0:this[n[0]]=a?n[1].call(this,a,n[2]):void 0):this[n]=a||void 0;l+=2}},Ze=function(e,i){for(var t in i)if(typeof i[t]===S&&i[t].length>0){for(var r=0;r<i[t].length;r++)if(De(i[t][r],e))return"?"===t?void 0:t}else if(De(i[t],e))return"?"===t?void 0:t;return i.hasOwnProperty("*")?i["*"]:e},ei={ME:"4.90","NT 3.51":"3.51","NT 4.0":"4.0",2e3:["5.0","5.01"],XP:["5.1","5.2"],Vista:"6.0",7:"6.1",8:"6.2",8.1:"6.3",10:["6.4","10.0"],NT:""},ii={embedded:"Automotive",mobile:"Mobile",tablet:["Tablet","EInk"],smarttv:"TV",wearable:"Watch",xr:["VR","XR"],"?":["Desktop","Unknown"],"*":void 0},ti={Chrome:"Google Chrome",Edge:"Microsoft Edge","Edge WebView2":"Microsoft Edge WebView2","Chrome WebView":"Android WebView","Chrome Headless":"HeadlessChrome","Huawei Browser":"HuaweiBrowser","MIUI Browser":"Miui Browser","Opera Mobi":"OperaMobile",Yandex:"YaBrowser"},ri={browser:[[/\b(?:crmo|crios)\/([\w\.]+)/i],[L,[H,Ie+"Chrome"]],[/webview.+edge\/([\w\.]+)/i],[L,[H,je+" WebView"]],[/edg(?:e|ios|a)?\/([\w\.]+)/i],[L,[H,"Edge"]],[/(opera mini)\/([-\w\.]+)/i,/(opera [mobiletab]{3,6})\b.+version\/([-\w\.]+)/i,/(opera)(?:.+version\/|[\/ ]+)([\w\.]+)/i],[H,L],[/opios[\/ ]+([\w\.]+)/i],[L,[H,Me+" Mini"]],[/\bop(?:rg)?x\/([\w\.]+)/i],[L,[H,Me+" GX"]],[/\bopr\/([\w\.]+)/i],[L,[H,Me]],[/\bb[ai]*d(?:uhd|[ub]*[aekoprswx]{5,6})[\/ ]?([\w\.]+)/i],[L,[H,"Baidu"]],[/\b(?:mxbrowser|mxios|myie2)\/?([-\w\.]*)\b/i],[L,[H,"Maxthon"]],[/(kindle)\/([\w\.]+)/i,/(lunascape|maxthon|netfront|jasmine|blazer|sleipnir)[\/ ]?([\w\.]*)/i,/(avant|iemobile|slim(?:browser|boat|jet))[\/ ]?([\d\.]*)/i,/(?:ms|\()(ie) ([\w\.]+)/i,/(flock|rockmelt|midori|epiphany|silk|skyfire|ovibrowser|bolt|iron|vivaldi|iridium|phantomjs|bowser|qupzilla|falkon|rekonq|puffin|brave|whale(?!.+naver)|qqbrowserlite|duckduckgo|klar|helio|(?=comodo_)?dragon|otter|dooble|(?:lg |qute)browser)\/([-\w\.]+)/i,/(heytap|ovi|115|surf)browser\/([\d\.]+)/i,/(ecosia|weibo)(?:__| \w+@)([\d\.]+)/i],[H,L],[/quark(?:pc)?\/([-\w\.]+)/i],[L,[H,"Quark"]],[/\bddg\/([\w\.]+)/i],[L,[H,"DuckDuckGo"]],[/(?:\buc? ?browser|(?:juc.+)ucweb)[\/ ]?([\w\.]+)/i],[L,[H,"UCBrowser"]],[/microm.+\bqbcore\/([\w\.]+)/i,/\bqbcore\/([\w\.]+).+microm/i,/micromessenger\/([\w\.]+)/i],[L,[H,"WeChat"]],[/konqueror\/([\w\.]+)/i],[L,[H,"Konqueror"]],[/trident.+rv[: ]([\w\.]{1,9})\b.+like gecko/i],[L,[H,"IE"]],[/ya(?:search)?browser\/([\w\.]+)/i],[L,[H,"Yandex"]],[/slbrowser\/([\w\.]+)/i],[L,[H,"Smart "+be+$e]],[/(avast|avg)\/([\w\.]+)/i],[[H,/(.+)/,"$1 Secure"+$e],L],[/\bfocus\/([\w\.]+)/i],[L,[H,He+" Focus"]],[/\bopt\/([\w\.]+)/i],[L,[H,Me+" Touch"]],[/coc_coc\w+\/([\w\.]+)/i],[L,[H,"Coc Coc"]],[/dolfin\/([\w\.]+)/i],[L,[H,"Dolphin"]],[/coast\/([\w\.]+)/i],[L,[H,Me+" Coast"]],[/miuibrowser\/([\w\.]+)/i],[L,[H,"MIUI"+$e]],[/fxios\/([\w\.-]+)/i],[L,[H,Ie+He]],[/\bqihoobrowser\/?([\w\.]*)/i],[L,[H,"360"]],[/\b(qq)\/([\w\.]+)/i],[[H,/(.+)/,"$1Browser"],L],[/(oculus|sailfish|huawei|vivo|pico)browser\/([\w\.]+)/i],[[H,/(.+)/,"$1"+$e],L],[/samsungbrowser\/([\w\.]+)/i],[L,[H,Te+" Internet"]],[/metasr[\/ ]?([\d\.]+)/i],[L,[H,Le+" Explorer"]],[/(sogou)mo\w+\/([\d\.]+)/i],[[H,Le+" Mobile"],L],[/(electron)\/([\w\.]+) safari/i,/(tesla)(?: qtcarbrowser|\/(20\d\d\.[-\w\.]+))/i,/m?(qqbrowser|2345(?=browser|chrome|explorer))\w*[\/ ]?v?([\w\.]+)/i],[H,L],[/(lbbrowser|rekonq)/i],[H],[/ome\/([\w\.]+) \w* ?(iron) saf/i,/ome\/([\w\.]+).+qihu (360)[es]e/i],[L,H],[/((?:fban\/fbios|fb_iab\/fb4a)(?!.+fbav)|;fbav\/([\w\.]+);)/i],[[H,_e],L,[M,X]],[/(kakao(?:talk|story))[\/ ]([\w\.]+)/i,/(naver)\(.*?(\d+\.[\w\.]+).*\)/i,/(daum)apps[\/ ]([\w\.]+)/i,/safari (line)\/([\w\.]+)/i,/\b(line)\/([\w\.]+)\/iab/i,/(alipay)client\/([\w\.]+)/i,/(twitter)(?:and| f.+e\/([\w\.]+))/i,/(instagram|snapchat|klarna)[\/ ]([-\w\.]+)/i],[H,L,[M,X]],[/\bgsa\/([\w\.]+) .*safari\//i],[L,[H,"GSA"],[M,X]],[/musical_ly(?:.+app_?version\/|_)([\w\.]+)/i],[L,[H,"TikTok"],[M,X]],[/\[(linkedin)app\]/i],[H,[M,X]],[/(chromium)[\/ ]([-\w\.]+)/i],[H,L],[/headlesschrome(?:\/([\w\.]+)| )/i],[L,[H,Re+" Headless"]],[/wv\).+chrome\/([\w\.]+).+edgw\//i],[L,[H,je+" WebView2"]],[/ wv\).+(chrome)\/([\w\.]+)/i],[[H,Re+" WebView"],L],[/droid.+ version\/([\w\.]+)\b.+(?:mobile safari|safari)/i],[L,[H,"Android"+$e]],[/chrome\/([\w\.]+) mobile/i],[L,[H,Ie+"Chrome"]],[/(chrome|omniweb|arora|[tizenoka]{5} ?browser)\/v?([\w\.]+)/i],[H,L],[/version\/([\w\.\,]+) .*mobile(?:\/\w+ | ?)safari/i],[L,[H,Ie+"Safari"]],[/iphone .*mobile(?:\/\w+ | ?)safari/i],[[H,Ie+"Safari"]],[/version\/([\w\.\,]+) .*(safari)/i],[L,H],[/webkit.+?(mobile ?safari|safari)(\/[\w\.]+)/i],[H,[L,"1"]],[/(webkit|khtml)\/([\w\.]+)/i],[H,L],[/(?:mobile|tablet);.*(firefox)\/([\w\.-]+)/i],[[H,Ie+He],L],[/(navigator|netscape\d?)\/([-\w\.]+)/i],[[H,"Netscape"],L],[/(wolvic|librewolf)\/([\w\.]+)/i],[H,L],[/mobile vr; rv:([\w\.]+)\).+firefox/i],[L,[H,He+" Reality"]],[/ekiohf.+(flow)\/([\w\.]+)/i,/(swiftfox)/i,/(icedragon|iceweasel|camino|chimera|fennec|maemo browser|minimo|conkeror)[\/ ]?([\w\.\+]+)/i,/(seamonkey|k-meleon|icecat|iceape|firebird|phoenix|palemoon|basilisk|waterfox)\/([-\w\.]+)$/i,/(firefox)\/([\w\.]+)/i,/(mozilla)\/([\w\.]+) .+rv\:.+gecko\/\d+/i,/(amaya|dillo|doris|icab|ladybird|lynx|mosaic|netsurf|obigo|polaris|w3m|(?:go|ice|up)[\. ]?browser)[-\/ ]?v?([\w\.]+)/i,/\b(links) \(([\w\.]+)/i],[H,[L,/_/g,"."]],[/(cobalt)\/([\w\.]+)/i],[H,[L,/[^\d\.]+./,k]]],cpu:[[/\b((amd|x|x86[-_]?|wow|win)64)\b/i],[[I,"amd64"]],[/(ia32(?=;))/i,/\b((i[346]|x)86)(pc)?\b/i],[[I,"ia32"]],[/\b(aarch64|arm(v?[89]e?l?|_?64))\b/i],[[I,"arm64"]],[/\b(arm(v[67])?ht?n?[fl]p?)\b/i],[[I,"armhf"]],[/( (ce|mobile); ppc;|\/[\w\.]+arm\b)/i],[[I,"arm"]],[/((ppc|powerpc)(64)?)( mac|;|\))/i],[[I,/ower/,k,Xe]],[/ sun4\w[;\)]/i],[[I,"sparc"]],[/\b(avr32|ia64(?=;)|68k(?=\))|\barm(?=v([1-7]|[5-7]1)l?|;|eabi)|(irix|mips|sparc)(64)?\b|pa-risc)/i],[[I,Xe]]],device:[[/\b(sch-i[89]0\d|shw-m380s|sm-[ptx]\w{2,4}|gt-[pn]\d{2,4}|sgh-t8[56]9|nexus 10)/i],[N,[_,Te],[M,F]],[/\b((?:s[cgp]h|gt|sm)-(?![lr])\w+|sc[g-]?[\d]+a?|galaxy nexus)/i,/samsung[- ]((?!sm-[lr]|browser)[-\w]+)/i,/sec-(sgh\w+)/i],[N,[_,Te],[M,A]],[/(?:\/|\()(ip(?:hone|od)[\w, ]*)(?:\/|;)/i],[N,[_,ce],[M,A]],[/\((ipad);[-\w\),; ]+apple/i,/applecoremedia\/[\w\.]+ \((ipad)/i,/\b(ipad)\d\d?,\d\d?[;\]].+ios/i],[N,[_,ce],[M,F]],[/(macintosh);/i],[N,[_,ce]],[/\b(sh-?[altvz]?\d\d[a-ekm]?)/i],[N,[_,Se],[M,A]],[/\b((?:brt|eln|hey2?|gdi|jdn)-a?[lnw]09|(?:ag[rm]3?|jdn2|kob2)-a?[lw]0[09]hn)(?: bui|\)|;)/i],[N,[_,me],[M,F]],[/honor([-\w ]+)[;\)]/i],[N,[_,me],[M,A]],[/\b((?:ag[rs][2356]?k?|bah[234]?|bg[2o]|bt[kv]|cmr|cpn|db[ry]2?|jdn2|got|kob2?k?|mon|pce|scm|sht?|[tw]gr|vrd)-[ad]?[lw][0125][09]b?|605hw|bg2-u03|(?:gem|fdr|m2|ple|t1)-[7a]0[1-4][lu]|t1-a2[13][lw]|mediapad[\w\. ]*(?= bui|\)))\b(?!.+d\/s)/i],[N,[_,pe],[M,F]],[/(?:huawei)([-\w ]+)[;\)]/i,/\b(nexus 6p|\w{2,4}e?-[atu]?[ln][\dx][012359c][adn]?)\b(?!.+d\/s)/i],[N,[_,pe],[M,A]],[/oid[^\)]+; (2[\dbc]{4}(182|283|rp\w{2})[cgl]|m2105k81a?c)(?: bui|\))/i,/\b((?:red)?mi[-_ ]?pad[\w- ]*)(?: bui|\))/i],[[N,/_/g," "],[_,Oe],[M,F]],[/\b(poco[\w ]+|m2\d{3}j\d\d[a-z]{2})(?: bui|\))/i,/\b; (\w+) build\/hm\1/i,/\b(hm[-_ ]?note?[_ ]?(?:\d\w)?) bui/i,/\b(redmi[\-_ ]?(?:note|k)?[\w_ ]+)(?: bui|\))/i,/oid[^\)]+; (m?[12][0-389][01]\w{3,6}[c-y])( bui|; wv|\))/i,/\b(mi[-_ ]?(?:a\d|one|one[_ ]plus|note lte|max|cc)?[_ ]?(?:\d?\w?)[_ ]?(?:plus|se|lite|pro)?)(?: bui|\))/i,/ ([\w ]+) miui\/v?\d/i],[[N,/_/g," "],[_,Oe],[M,A]],[/droid.+; (cph2[3-6]\d[13579]|((gm|hd)19|(ac|be|in|kb)20|(d[en]|eb|le|mt)21|ne22)[0-2]\d|p[g-k]\w[1m]10)\b/i,/(?:one)?(?:plus)? (a\d0\d\d)(?: b|\))/i],[N,[_,ke],[M,A]],[/; (\w+) bui.+ oppo/i,/\b(cph[12]\d{3}|p(?:af|c[al]|d\w|e[ar])[mt]\d0|x9007|a101op)\b/i],[N,[_,xe],[M,A]],[/\b(opd2(\d{3}a?))(?: bui|\))/i],[N,[_,Ze,{OnePlus:["203","304","403","404","413","415"],"*":xe}],[M,F]],[/(vivo (5r?|6|8l?|go|one|s|x[il]?[2-4]?)[\w\+ ]*)(?: bui|\))/i],[N,[_,"BLU"],[M,A]],[/; vivo (\w+)(?: bui|\))/i,/\b(v[12]\d{3}\w?[at])(?: bui|;)/i],[N,[_,"Vivo"],[M,A]],[/\b(rmx[1-3]\d{3})(?: bui|;|\))/i],[N,[_,"Realme"],[M,A]],[/(ideatab[-\w ]+|602lv|d-42a|a101lv|a2109a|a3500-hv|s[56]000|pb-6505[my]|tb-?x?\d{3,4}(?:f[cu]|xu|[av])|yt\d?-[jx]?\d+[lfmx])( bui|;|\)|\/)/i,/lenovo ?(b[68]0[08]0-?[hf]?|tab(?:[\w- ]+?)|tb[\w-]{6,7})( bui|;|\)|\/)/i],[N,[_,be],[M,F]],[/lenovo[-_ ]?([-\w ]+?)(?: bui|\)|\/)/i],[N,[_,be],[M,A]],[/\b(milestone|droid(?:[2-4x]| (?:bionic|x2|pro|razr))?:?( 4g)?)\b[\w ]+build\//i,/\bmot(?:orola)?[- ]([\w\s]+)(\)| bui)/i,/((?:moto(?! 360)[-\w\(\) ]+|xt\d{3,4}[cgkosw\+]?[-\d]*|nexus 6)(?= bui|\)))/i],[N,[_,ve],[M,A]],[/\b(mz60\d|xoom[2 ]{0,2}) build\//i],[N,[_,ve],[M,F]],[/((?=lg)?[vl]k\-?\d{3}) bui| 3\.[-\w; ]{10}lg?-([06cv9]{3,4})/i],[N,[_,fe],[M,F]],[/(lm(?:-?f100[nv]?|-[\w\.]+)(?= bui|\))|nexus [45])/i,/\blg[-e;\/ ]+(?!.*(?:browser|netcast|android tv|watch|webos))(\w+)/i,/\blg-?([\d\w]+) bui/i],[N,[_,fe],[M,A]],[/(nokia) (t[12][01])/i],[_,N,[M,F]],[/(?:maemo|nokia).*(n900|lumia \d+|rm-\d+)/i,/nokia[-_ ]?(([-\w\. ]*))/i],[[N,/_/g," "],[M,A],[_,"Nokia"]],[/(pixel (c|tablet))\b/i],[N,[_,we],[M,F]],[/droid.+;(?: google)? (g(01[13]a|020[aem]|025[jn]|1b60|1f8f|2ybb|4s1m|576d|5nz6|8hhn|8vou|a02099|c15s|d1yq|e2ae|ec77|gh2x|kv4x|p4bc|pj41|r83y|tt9q|ur25|wvk6)|pixel[\d ]*a?( pro)?( xl)?( fold)?( \(5g\))?)( bui|\))/i],[N,[_,we],[M,A]],[/(google) (pixelbook( go)?)/i],[_,N],[/droid.+; (a?\d[0-2]{2}so|[c-g]\d{4}|so[-gl]\w+|xq-\w\w\d\d)(?= bui|\).+chrome\/(?![1-6]{0,1}\d\.))/i],[N,[_,Ce],[M,A]],[/sony tablet [ps]/i,/\b(?:sony)?sgp\w+(?: bui|\))/i],[[N,"Xperia Tablet"],[_,Ce],[M,F]],[/(alexa)webm/i,/(kf[a-z]{2}wi|aeo(?!bc)\w\w)( bui|\))/i,/(kf[a-z]+)( bui|\)).+silk\//i],[N,[_,ue],[M,F]],[/((?:sd|kf)[0349hijorstuw]+)( bui|\)).+silk\//i],[[N,/(.+)/g,"Fire Phone $1"],[_,ue],[M,A]],[/(playbook);[-\w\),; ]+(rim)/i],[N,_,[M,F]],[/\b((?:bb[a-f]|st[hv])100-\d)/i,/\(bb10; (\w+)/i],[N,[_,he],[M,A]],[/(?:\b|asus_)(transfo[prime ]{4,10} \w+|eeepc|slider \w+|nexus 7|padfone|p00[cj])/i],[N,[_,de],[M,F]],[/ (z[bes]6[027][012][km][ls]|zenfone \d\w?)\b/i],[N,[_,de],[M,A]],[/(nexus 9)/i],[N,[_,"HTC"],[M,F]],[/(htc)[-;_ ]{1,2}([\w ]+(?=\)| bui)|\w+)/i,/(zte)[- ]([\w ]+?)(?: bui|\/|\))/i,/(alcatel|geeksphone|nexian|panasonic(?!(?:;|\.))|sony(?!-bra))[-_ ]?([-\w]*)/i],[_,[N,/_/g," "],[M,A]],[/tcl (xess p17aa)/i,/droid [\w\.]+; ((?:8[14]9[16]|9(?:0(?:48|60|8[01])|1(?:3[27]|66)|2(?:6[69]|9[56])|466))[gqswx])(_\w(\w|\w\w))?(\)| bui)/i],[N,[_,"TCL"],[M,F]],[/droid [\w\.]+; (418(?:7d|8v)|5087z|5102l|61(?:02[dh]|25[adfh]|27[ai]|56[dh]|59k|65[ah])|a509dl|t(?:43(?:0w|1[adepqu])|50(?:6d|7[adju])|6(?:09dl|10k|12b|71[efho]|76[hjk])|7(?:66[ahju]|67[hw]|7[045][bh]|71[hk]|73o|76[ho]|79w|81[hks]?|82h|90[bhsy]|99b)|810[hs]))(_\w(\w|\w\w))?(\)| bui)/i],[N,[_,"TCL"],[M,A]],[/(itel) ((\w+))/i],[[_,Xe],N,[M,Ze,{tablet:["p10001l","w7001"],"*":"mobile"}]],[/droid.+; ([ab][1-7]-?[0178a]\d\d?)/i],[N,[_,"Acer"],[M,F]],[/droid.+; (m[1-5] note) bui/i,/\bmz-([-\w]{2,})/i],[N,[_,"Meizu"],[M,A]],[/; ((?:power )?armor(?:[\w ]{0,8}))(?: bui|\))/i],[N,[_,"Ulefone"],[M,A]],[/; (energy ?\w+)(?: bui|\))/i,/; energizer ([\w ]+)(?: bui|\))/i],[N,[_,"Energizer"],[M,A]],[/; cat (b35);/i,/; (b15q?|s22 flip|s48c|s62 pro)(?: bui|\))/i],[N,[_,"Cat"],[M,A]],[/((?:new )?andromax[\w- ]+)(?: bui|\))/i],[N,[_,"Smartfren"],[M,A]],[/droid.+; (a(in)?(0(15|59|6[35])|142)p?)/i],[N,[_,"Nothing"],[M,A]],[/; (x67 5g|tikeasy \w+|ac[1789]\d\w+)( b|\))/i,/archos ?(5|gamepad2?|([\w ]*[t1789]|hello) ?\d+[\w ]*)( b|\))/i],[N,[_,"Archos"],[M,F]],[/archos ([\w ]+)( b|\))/i,/; (ac[3-6]\d\w{2,8})( b|\))/i],[N,[_,"Archos"],[M,A]],[/; (n159v)/i],[N,[_,"HMD"],[M,A]],[/(imo) (tab \w+)/i,/(infinix|tecno) (x1101b?|p904|dp(7c|8d|10a)( pro)?|p70[1-3]a?|p904|t1101)/i],[_,N,[M,F]],[/(blackberry|benq|palm(?=\-)|sonyericsson|acer|asus(?! zenw)|dell|jolla|meizu|motorola|polytron|tecno|micromax|advan)[-_ ]?([-\w]*)/i,/; (blu|hmd|imo|infinix|lava|oneplus|tcl)[_ ]([\w\+ ]+?)(?: bui|\)|; r)/i,/(hp) ([\w ]+\w)/i,/(microsoft); (lumia[\w ]+)/i,/(oppo) ?([\w ]+) bui/i],[_,N,[M,A]],[/(kobo)\s(ereader|touch)/i,/(hp).+(touchpad(?!.+tablet)|tablet)/i,/(kindle)\/([\w\.]+)/i],[_,N,[M,F]],[/(surface duo)/i],[N,[_,ge],[M,F]],[/droid [\d\.]+; (fp\du?)(?: b|\))/i],[N,[_,"Fairphone"],[M,A]],[/((?:tegranote|shield t(?!.+d tv))[\w- ]*?)(?: b|\))/i],[N,[_,ye],[M,F]],[/(sprint) (\w+)/i],[_,N,[M,A]],[/(kin\.[onetw]{3})/i],[[N,/\./g," "],[_,ge],[M,A]],[/droid.+; ([c6]+|et5[16]|mc[239][23]x?|vc8[03]x?)\)/i],[N,[_,Ee],[M,F]],[/droid.+; (ec30|ps20|tc[2-8]\d[kx])\)/i],[N,[_,Ee],[M,A]],[/smart-tv.+(samsung)/i],[_,[M,D]],[/hbbtv.+maple;(\d+)/i],[[N,/^/,"SmartTV"],[_,Te],[M,D]],[/(vizio)(?: |.+model\/)(\w+-\w+)/i,/tcast.+(lg)e?. ([-\w]+)/i],[_,N,[M,D]],[/(nux; netcast.+smarttv|lg (netcast\.tv-201\d|android tv))/i],[[_,fe],[M,D]],[/(apple) ?tv/i],[_,[N,ce+" TV"],[M,D]],[/crkey.*devicetype\/chromecast/i],[[N,Pe+" Third Generation"],[_,we],[M,D]],[/crkey.*devicetype\/([^/]*)/i],[[N,/^/,"Chromecast "],[_,we],[M,D]],[/fuchsia.*crkey/i],[[N,Pe+" Nest Hub"],[_,we],[M,D]],[/crkey/i],[[N,Pe],[_,we],[M,D]],[/(portaltv)/i],[N,[_,_e],[M,D]],[/droid.+aft(\w+)( bui|\))/i],[N,[_,ue],[M,D]],[/(shield \w+ tv)/i],[N,[_,ye],[M,D]],[/\(dtv[\);].+(aquos)/i,/(aquos-tv[\w ]+)\)/i],[N,[_,Se],[M,D]],[/(bravia[\w ]+)( bui|\))/i],[N,[_,Ce],[M,D]],[/(mi(tv|box)-?\w+) bui/i],[N,[_,Oe],[M,D]],[/Hbbtv.*(technisat) (.*);/i],[_,N,[M,D]],[/\b(roku)[\dx]*[\)\/]((?:dvp-)?[\d\.]*)/i,/hbbtv\/\d+\.\d+\.\d+ +\([\w\+ ]*; *([\w\d][^;]*);([^;]*)/i],[[_,/.+\/(\w+)/,"$1",Ze,{LG:"lge"}],[N,Ye],[M,D]],[/droid.+; ([\w- ]+) (?:android tv|smart[- ]?tv)/i],[N,[M,D]],[/\b(android tv|smart[- ]?tv|opera tv|tv; rv:|large screen[\w ]+safari)\b/i],[[M,D]],[/(playstation \w+)/i],[N,[_,Ce],[M,z]],[/\b(xbox(?: one)?(?!; xbox))[\); ]/i],[N,[_,ge],[M,z]],[/(ouya)/i,/(nintendo) (\w+)/i,/(retroid) (pocket ([^\)]+))/i],[_,N,[M,z]],[/droid.+; (shield)( bui|\))/i],[N,[_,ye],[M,z]],[/\b(sm-[lr]\d\d[0156][fnuw]?s?|gear live)\b/i],[N,[_,Te],[M,V]],[/((pebble))app/i,/(asus|google|lg|oppo) ((pixel |zen)?watch[\w ]*)( bui|\))/i],[_,N,[M,V]],[/(ow(?:19|20)?we?[1-3]{1,3})/i],[N,[_,xe],[M,V]],[/(watch)(?: ?os[,\/]|\d,\d\/)[\d\.]+/i],[N,[_,ce],[M,V]],[/(opwwe\d{3})/i],[N,[_,ke],[M,V]],[/(moto 360)/i],[N,[_,ve],[M,V]],[/(smartwatch 3)/i],[N,[_,Ce],[M,V]],[/(g watch r)/i],[N,[_,fe],[M,V]],[/droid.+; (wt63?0{2,3})\)/i],[N,[_,Ee],[M,V]],[/droid.+; (glass) \d/i],[N,[_,we],[M,B]],[/(pico) (4|neo3(?: link|pro)?)/i],[_,N,[M,B]],[/(quest( \d| pro)?s?).+vr/i],[N,[_,_e],[M,B]],[/mobile vr; rv.+firefox/i],[[M,B]],[/(tesla)(?: qtcarbrowser|\/[-\w\.]+)/i],[_,[M,Q]],[/(aeobc)\b/i],[N,[_,ue],[M,Q]],[/(homepod).+mac os/i],[N,[_,ce],[M,Q]],[/windows iot/i],[[M,Q]],[/droid .+?; ([^;]+?)(?: bui|; wv\)|\) applew).+?(mobile|vr|\d) safari/i],[N,[M,Ze,{mobile:"Mobile",xr:"VR","*":F}]],[/\b((tablet|tab)[;\/]|focus\/\d(?!.+mobile))/i],[[M,F]],[/(phone|mobile(?:[;\/]| [ \w\/\.]*safari)|pda(?=.+windows ce))/i],[[M,A]],[/droid .+?; ([\w\. -]+)( bui|\))/i],[N,[_,"Generic"]]],engine:[[/windows.+ edge\/([\w\.]+)/i],[L,[H,je+"HTML"]],[/(arkweb)\/([\w\.]+)/i],[H,L],[/webkit\/537\.36.+chrome\/(?!27)([\w\.]+)/i],[L,[H,"Blink"]],[/(presto)\/([\w\.]+)/i,/(webkit|trident|netfront|netsurf|amaya|lynx|w3m|goanna|servo)\/([\w\.]+)/i,/ekioh(flow)\/([\w\.]+)/i,/(khtml|tasman|links)[\/ ]\(?([\w\.]+)/i,/(icab)[\/ ]([23]\.[\d\.]+)/i,/\b(libweb)/i],[H,L],[/ladybird\//i],[[H,"LibWeb"]],[/rv\:([\w\.]{1,9})\b.+(gecko)/i],[L,H]],os:[[/(windows nt) (6\.[23]); arm/i],[[H,/N/,"R"],[L,Ze,ei]],[/(windows (?:phone|mobile|iot))(?: os)?[\/ ]?([\d\.]*( se)?)/i,/(windows)[\/ ](1[01]|2000|3\.1|7|8(\.1)?|9[58]|me|server 20\d\d( r2)?|vista|xp)/i],[H,L],[/windows nt ?([\d\.\)]*)(?!.+xbox)/i,/\bwin(?=3| ?9|n)(?:nt| 9x )?([\d\.;]*)/i],[[L,/(;|\))/g,"",Ze,ei],[H,Ne]],[/(windows ce)\/?([\d\.]*)/i],[H,L],[/[adehimnop]{4,7}\b(?:.*os ([\w]+) like mac|; opera)/i,/(?:ios;fbsv\/|iphone.+ios[\/ ])([\d\.]+)/i,/cfnetwork\/.+darwin/i],[[L,/_/g,"."],[H,"iOS"]],[/(mac os x) ?([\w\. ]*)/i,/(macintosh|mac_powerpc\b)(?!.+(haiku|morphos))/i],[[H,"macOS"],[L,/_/g,"."]],[/android ([\d\.]+).*crkey/i],[L,[H,Pe+" Android"]],[/fuchsia.*crkey\/([\d\.]+)/i],[L,[H,Pe+" Fuchsia"]],[/crkey\/([\d\.]+).*devicetype\/smartspeaker/i],[L,[H,Pe+" SmartSpeaker"]],[/linux.*crkey\/([\d\.]+)/i],[L,[H,Pe+" Linux"]],[/crkey\/([\d\.]+)/i],[L,[H,Pe]],[/droid ([\w\.]+)\b.+(android[- ]x86)/i],[L,H],[/(ubuntu) ([\w\.]+) like android/i],[[H,/(.+)/,"$1 Touch"],L],[/(harmonyos)[\/ ]?([\d\.]*)/i,/(android|bada|blackberry|kaios|maemo|meego|openharmony|qnx|rim tablet os|sailfish|series40|symbian|tizen)\w*[-\/\.; ]?([\d\.]*)/i],[H,L],[/\(bb(10);/i],[L,[H,he]],[/(?:symbian ?os|symbos|s60(?=;)|series ?60)[-\/ ]?([\w\.]*)/i],[L,[H,"Symbian"]],[/mozilla\/[\d\.]+ \((?:mobile|tablet|tv|mobile; [\w ]+); rv:.+ gecko\/([\w\.]+)/i],[L,[H,He+" OS"]],[/\b(?:hp)?wos(?:browser)?\/([\w\.]+)/i,/webos(?:[ \/]?|\.tv-20(?=2[2-9]))(\d[\d\.]*)/i],[L,[H,"webOS"]],[/web0s;.+?(?:chr[o0]me|safari)\/(\d+)/i],[[L,Ze,{25:"120",24:"108",23:"94",22:"87",6:"79",5:"68",4:"53",3:"38",2:"538",1:"537","*":"TV"}],[H,"webOS"]],[/watch(?: ?os[,\/]|\d,\d\/)([\d\.]+)/i],[L,[H,"watchOS"]],[/(cros) [\w]+(?:\)| ([\w\.]+)\b)/i],[[H,"Chrome OS"],L],[/panasonic;(viera)/i,/(netrange)mmh/i,/(nettv)\/(\d+\.[\w\.]+)/i,/(nintendo|playstation) (\w+)/i,/(xbox); +xbox ([^\);]+)/i,/(pico) .+os([\w\.]+)/i,/\b(joli|palm)\b ?(?:os)?\/?([\w\.]*)/i,/linux.+(mint)[\/\(\) ]?([\w\.]*)/i,/(mageia|vectorlinux|fuchsia|arcaos|arch(?= ?linux))[;l ]([\d\.]*)/i,/([kxln]?ubuntu|debian|suse|opensuse|gentoo|slackware|fedora|mandriva|centos|pclinuxos|red ?hat|zenwalk|linpus|raspbian|plan 9|minix|risc os|contiki|deepin|manjaro|elementary os|sabayon|linspire|knoppix)(?: gnu[\/ ]linux)?(?: enterprise)?(?:[- ]linux)?(?:-gnu)?[-\/ ]?(?!chrom|package)([-\w\.]*)/i,/((?:open)?solaris)[-\/ ]?([\w\.]*)/i,/\b(aix)[; ]([1-9\.]{0,4})/i,/(hurd|linux|morphos)(?: (?:arm|x86|ppc)\w*| ?)([\w\.]*)/i,/(gnu) ?([\w\.]*)/i,/\b([-frentopcghs]{0,5}bsd|dragonfly)[\/ ]?(?!amd|[ix346]{1,2}86)([\w\.]*)/i,/(haiku) ?(r\d)?/i],[H,L],[/(sunos) ?([\d\.]*)/i],[[H,"Solaris"],L],[/\b(beos|os\/2|amigaos|openvms|hp-ux|serenityos)/i,/(unix) ?([\w\.]*)/i],[H,L]]},oi=(Ue.call((v={init:{},isIgnore:{},isIgnoreRgx:{},toString:{}}).init,[[O,[H,L,$,M]],[E,[I]],[R,[M,N,_]],[q,[H,L]],[P,[H,L]]]),Ue.call(v.isIgnore,[[O,[L,$]],[q,[L]],[P,[L]]]),Ue.call(v.isIgnoreRgx,[[O,/ ?browser$/i],[P,/ ?os$/i]]),Ue.call(v.toString,[[O,[H,L]],[E,[I]],[R,[_,N]],[q,[H,L]],[P,[H,L]]]),v),ni=function(e,i){var t=oi.init[i],r=oi.isIgnore[i]||0,o=oi.isIgnoreRgx[i]||0,n=oi.toString[i]||0;function s(){Ue.call(this,t)}return s.prototype.getItem=function(){return e},s.prototype.withClientHints=function(){return Ae?Ae.getHighEntropyValues(le).then(function(i){return e.setCH(new si(i,!1)).parseCH().get()}):e.parseCH().get()},s.prototype.withFeatureCheck=function(){return e.detectFeature().get()},i!=j&&(s.prototype.is=function(e){var i=!1;for(var t in this)if(this.hasOwnProperty(t)&&!De(r,t)&&Xe(o?Ge(o,this[t]):this[t])==Xe(o?Ge(o,e):e)){if(i=!0,e!=T)break}else if(e==T&&i){i=!i;break}return i},s.prototype.toString=function(){var e=k;for(var i in n)typeof this[n[i]]!==T&&(e+=(e?" ":k)+this[n[i]]);return e||T}),Ae||(s.prototype.then=function(e){var i=this,t=function(){for(var e in i)i.hasOwnProperty(e)&&(this[e]=i[e])};t.prototype={is:s.prototype.is,toString:s.prototype.toString};var r=new t;return e(r),r}),new s};function si(e,i){if(e=e||{},Ue.call(this,le),i)Ue.call(this,[[W,Qe(e[Z])],[G,Qe(e[ee])],[A,/\?1/.test(e[oe])],[N,Ke(e[ne])],[K,Ke(e[se])],[Y,Ke(e[ae])],[I,Ke(e[ie])],[U,Qe(e[re])],[J,Ke(e[te])]]);else for(var t in e)this.hasOwnProperty(t)&&typeof e[t]!==T&&(this[t]=e[t])}function ai(e,i,t,r){return this.get=function(e){return e?this.data.hasOwnProperty(e)?this.data[e]:void 0:this.data},this.set=function(e,i){return this.data[e]=i,this},this.setCH=function(e){return this.uaCH=e,this},this.detectFeature=function(){if(ze&&ze.userAgent==this.ua)switch(this.itemType){case O:ze.brave&&typeof ze.brave.isBrave==x&&this.set(H,"Brave");break;case R:!this.get(M)&&Ae&&Ae[A]&&this.set(M,A),"Macintosh"==this.get(N)&&ze&&typeof ze.standalone!==T&&ze.maxTouchPoints&&ze.maxTouchPoints>2&&this.set(N,"iPad").set(M,F);break;case P:!this.get(H)&&Ae&&Ae[K]&&this.set(H,Ae[K]);break;case j:var e=this.data,i=function(i){return e[i].getItem().detectFeature().get()};this.set(O,i(O)).set(E,i(E)).set(R,i(R)).set(q,i(q)).set(P,i(P))}return this},this.parseUA=function(){return this.itemType!=j&&Je.call(this.data,this.ua,this.rgxMap),this.itemType==O&&this.set($,We(this.get(L))),this},this.parseCH=function(){var e=this.uaCH,i=this.rgxMap;switch(this.itemType){case O:case q:var t,r=e[G]||e[W];if(r)for(var o in r){var n=r[o].brand||r[o],s=r[o].version;this.itemType==O&&!/not.a.brand/i.test(n)&&(!t||/Chrom/.test(t)&&n!=qe||t==je&&/WebView2/.test(n))&&(n=Ze(n,ti),(t=this.get(H))&&!/Chrom/.test(t)&&/Chrom/.test(n)||this.set(H,n).set(L,s).set($,We(s)),t=n),this.itemType==q&&n==qe&&this.set(L,s)}break;case E:var a=e[I];a&&(a&&"64"==e[J]&&(a+="64"),Je.call(this.data,a+";",i));break;case R:if(e[A]&&this.set(M,A),e[N]&&(this.set(N,e[N]),!this.get(M)||!this.get(_))){var l={};Je.call(l,"droid 9; "+e[N]+")",i),!this.get(M)&&l.type&&this.set(M,l.type),!this.get(_)&&l.vendor&&this.set(_,l.vendor)}if(e[U]){var u;if("string"!=typeof e[U])for(var c=0;!u&&c<e[U].length;)u=Ze(e[U][c++],ii);else u=Ze(e[U],ii);this.set(M,u)}break;case P:var d=e[K];if(d){var h=e[Y];d==Ne&&(h=parseInt(We(h),10)>=13?"11":"10"),this.set(H,d).set(L,h)}this.get(H)==Ne&&"Xbox"==e[N]&&this.set(H,"Xbox").set(L,void 0);break;case j:var w=this.data,p=function(i){return w[i].getItem().setCH(e).parseCH().get()};this.set(O,p(O)).set(E,p(E)).set(R,p(R)).set(q,p(q)).set(P,p(P))}return this},Ue.call(this,[["itemType",e],["ua",i],["uaCH",r],["rgxMap",t],["data",ni(this,e)]]),this}function li(e,i,t){if(typeof e===S?(Ve(e,!0)?(typeof i===S&&(t=i),i=e):(t=e,i=void 0),e=void 0):typeof e!==C||Ve(i,!0)||(t=i,i=void 0),t&&typeof t.append===x){var r={};t.forEach(function(e,i){r[i]=e}),t=r}if(!(this instanceof li))return new li(e,i,t).getResult();var o=typeof e===C?e:t&&t[y]?t[y]:ze&&ze.userAgent?ze.userAgent:k,n=new si(t,!0),s=i?function(e,i){var t={},r=i;if(!Ve(i))for(var o in r={},i)for(var n in i[o])r[n]=i[o][n].concat(r[n]?r[n]:[]);for(var s in e)t[s]=r[s]&&r[s].length%2==0?r[s].concat(e[s]):e[s];return t}(ri,i):ri,a=function(e){return e==j?function(){return new ai(e,o,s,n).set("ua",o).set(O,this.getBrowser()).set(E,this.getCPU()).set(R,this.getDevice()).set(q,this.getEngine()).set(P,this.getOS()).get()}:function(){return new ai(e,o,s[e],n).parseUA().get()}};return Ue.call(this,[["getBrowser",a(O)],["getCPU",a(E)],["getDevice",a(R)],["getEngine",a(q)],["getOS",a(P)],["getResult",a(j)],["getUA",function(){return o}],["setUA",function(e){return Be(e)&&(o=e.length>500?Ye(e,500):e),this}]]).setUA(o),this}li.VERSION="2.0.4",li.BROWSER=Fe([H,L,$,M]),li.CPU=Fe([I]),li.DEVICE=Fe([N,_,M,z,A,D,F,V,Q]),li.ENGINE=li.OS=Fe([H,L]);const{browser:ui,device:ci,os:di}=li(navigator.userAgent);function hi(e){return e!==window&&e!==document&&e!==document.documentElement}function wi(e){return e.id?`${e.nodeName.toLowerCase()}#${e.id}`:e.className&&"string"==typeof e.className?`${e.nodeName.toLowerCase()}#${e.className}`:e.nodeName.toLowerCase()}function pi(e){const i=f;return Array.isArray(i)?function(e){return e.reverse().filter(hi).map(wi).join(" ")}(i):e?function(e){let i=e;const t=[];for(;i&&hi(i);)t.unshift(wi(i)),i=i.parentElement;return t.join(" ")}(e):void 0}function bi(e){return e.split("\n").slice(1).map(e=>e.replace(/^\s+at\s+/g,"")).join("\n")}function mi(){try{return location.href}catch(e){return""}}function fi(e){return{title:e.title,url:e.url,browser:e.browser,os:e.os,deviceInfo:e.device,userAgent:e.userAgent}}function gi(e,i){return{page:mi(),userId:i.userId,release:i.release,environment:i.environment,device:fi(e)}}function vi(e,i,t){var r;const o=gi(i,t);if("promiseError"===e.errorType)return u(l({type:"unhandledrejection",level:"ERROR",message:e.message,stack:e.stack},o),{device:u(l({},o.device),{selector:e.selector,filename:e.filename,position:e.position,errorType:e.errorType})});if("loadResourceError"===e.errorType){const i=null!=(r=e.filename)?r:e.message;return u(l({type:"resource",level:"ERROR",message:i?`Resource failed: ${i}`:e.message},o),{device:u(l({},o.device),{tagName:e.tagName,selector:e.selector,errorType:e.errorType})})}return u(l({type:"error",level:"ERROR",message:e.message,stack:e.stack},o),{device:u(l({},o.device),{selector:e.selector,isWhiteScreen:e.isWhiteScreen,filename:e.filename,position:e.position,errorType:e.errorType})})}function yi(e,i,t){const r=gi(i,t);return u(l({type:"paint",level:"INFO",message:"paint metrics"},r),{device:u(l({},r.device),{FP:e.FP,FCP:e.FCP,FMP:e.FMP,LCP:e.LCP})})}function ki(e,i,t){const r=gi(i,t);return u(l({type:"timing",level:"INFO",message:"timing metrics"},r),{device:u(l({},r.device),{DOMContentLoadedTime:e.DOMContentLoadedTime,loadTime:e.loadTime})})}function xi(e,i,t){const r=gi(i,t);return u(l({type:"longTask",level:e.duration>=100?"WARN":"INFO",message:`long task ${e.duration}ms`},r),{device:u(l({},r.device),{startTime:e.startTime,duration:e.duration,selector:e.selector,eventType:e.eventType})})}function Ti(e,i,t){var r,o,n;if(!1!==e.success)return null;const s=String(null!=(r=e.url)?r:""),a=String(null!=(o=e.method)?o:"GET").toUpperCase(),c=null!=(n=e.status)?n:0,d=0===c?"network":String(c),h=gi(i,t);return u(l({type:"request",level:"ERROR",message:`Request failed [${d}]: ${a} ${s}`},h),{device:u(l({},h.device),{durationMs:e.duration,msg:e.msg})})}function Si(e,i,t){if("error"===e.type)return[vi(e,i,t)];if("paint"===e.type)return[yi(e,i,t)];if("timing"===e.type)return[ki(e,i,t)];if("longTask"===e.type)return[xi(e,i,t)];if("batchXHR"===e.type)return function(e,i,t){return e.requests.map(e=>Ti(e,i,t)).filter(e=>null!=e)}(e,i,t);if("xhr"===e.type||"fetch"===e.type){const r=Ti(e,i,t);return r?[r]:[]}return[]}function Ci(){window.addEventListener("error",e=>{const i=e.target;let t;if(i&&(t=i.src||i.href)){const r={type:"error",errorType:"loadResourceError",message:`${t} resource loading fail.`,filename:t,tagName:i.tagName,selector:pi(e.target)};this.send(r)}else{const i=g(),t=function(){const e=["html","body","#root"];let i=0;function t(t){const r=function(e){let i;return i=e.id?`#${e.id}`:e.className&&"string"==typeof e.className?"."+e.className.split(" ").filter(e=>!!e).join("."):e.nodeName.toLowerCase(),i}(t);e.indexOf(r)>-1&&i++}for(let r=1;r<=9;r++){const e=document.elementFromPoint(window.innerWidth/10*r,window.innerHeight/2),i=document.elementFromPoint(window.innerWidth/2,window.innerHeight/10*r);t(e),t(i)}return 18===i}(),r={type:"error",errorType:"jsError",message:e.message,filename:e.filename,position:`${e.lineno}:${e.colno}`,stack:bi(e.error.stack),selector:i?pi():"",isWhiteScreen:t};this.send(r)}},!0),window.addEventListener("unhandledrejection",e=>{const i=g();let t;const r=e.reason;let o,n=0,s=0,a="";if("string"==typeof e.reason)t=r;else if("object"==typeof r&&(t=r.message,r.stack)){const e=r.stack.match(/at\s+(.+):(\d+):(\d+)/);o=e[1],n=e[2],s=e[3],a=bi(r.stack)}const l={type:"error",errorType:"promiseError",message:t,filename:o,position:`${n}:${s}`,stack:a,selector:i?pi():""};this.send(l)},!0)}function Oi(){if(PerformanceObserver){new PerformanceObserver(e=>{e.getEntries().forEach(e=>{if(e.duration>100){const i=g(),t={type:"longTask",startTime:e.startTime,duration:e.duration,selector:i?pi():"",eventType:null==i?void 0:i.type};this.send(t)}})}).observe({entryTypes:["longtask"]})}}function Ei(e,i){if("undefined"==typeof PerformanceObserver)return null;try{const t=new PerformanceObserver(e=>{i(e.getEntries())});return t.observe({type:e,buffered:!0}),t}catch(t){return null}}function Ri(){if("undefined"==typeof PerformanceObserver)return;let e=null,i=null,t=null,r=null;const o=Ei("paint",t=>{for(const r of t)"first-paint"===r.name?e=r:"first-contentful-paint"===r.name&&(i=r)}),n=Ei("element",e=>{e.length>0&&(t=e[0],null==n||n.disconnect())}),s=Ei("largest-contentful-paint",e=>{e.length>0&&(r=e[e.length-1])}),a=()=>{setTimeout(()=>{null==s||s.disconnect(),null==o||o.disconnect(),null==n||n.disconnect();const a={type:"paint",FP:null==e?void 0:e.startTime,FCP:null==i?void 0:i.startTime,FMP:null==t?void 0:t.startTime,LCP:null==r?void 0:r.startTime};this.send(a)},3e3)};"complete"!==document.readyState?window.addEventListener("load",a):a()}function qi(){let e=0,i=0;if(performance.getEntriesByType){const t=performance.getEntriesByType("navigation");if(t.length>0){const r=t[0],{domContentLoadedEventStart:o,loadEventStart:n,fetchStart:s}=r;e=o-s,i=n-s}}else{const{fetchStart:t,domContentLoadedEventStart:r,loadEventStart:o}=performance.timing;e=r-t,i=o-t}const t={type:"timing",DOMContentLoadedTime:e,loadTime:i};this.send(t)}function Pi(){const e=()=>qi.call(this);"complete"!==document.readyState?window.addEventListener("load",e):e()}function ji(){const e=window.XMLHttpRequest,i=this;window.XMLHttpRequest=function(){const t=new e,r=t.open,o=t.send;let n,s,a;return t.open=function(e,i,...t){return s=i,a=e,r.apply(this,[e,i,...t])},t.send=function(){return n=(new Date).getTime(),t.addEventListener("error",function(){const e=(new Date).getTime()-n,r=t.status,o=String(null!=s?s:"");i.endpoint&&o===i.endpoint||i.captureRequest({type:"xhr",url:s,method:a||"GET",duration:e,status:r||0,success:!1,msg:`XHR请求错误: ${s}`,startTime:(new Date).getTime()})}),t.addEventListener("timeout",function(){const e=(new Date).getTime()-n,r=t.status,o=String(null!=s?s:"");i.endpoint&&o===i.endpoint||i.captureRequest({type:"xhr",url:s,method:a||"GET",msg:"XHR请求超时",duration:e,status:r||0,success:!1,startTime:(new Date).getTime()})}),o.apply(this,arguments)},t}}e.ExcReporter=w,e.Monitor=class{constructor(e){var i,t;c(this,"endpoint"),c(this,"projectKey"),c(this,"timeoutDuration"),c(this,"errorQueue"),c(this,"requestQueue"),c(this,"maxQueueSize"),c(this,"sendTimer"),c(this,"reporter"),c(this,"options"),c(this,"originalXHR"),c(this,"originalFetch"),c(this,"originalOnerror"),this.options=e,this.endpoint=e.endpoint,this.projectKey=e.projectKey,this.timeoutDuration=null!=(i=e.timeoutDuration)?i:6e4,this.errorQueue=[],this.requestQueue=[],this.maxQueueSize=null!=(t=e.maxQueueSize)?t:10,this.sendTimer=null,this.reporter=p({endpoint:e.endpoint,projectKey:e.projectKey,release:e.release,environment:e.environment,maxBatch:e.maxBatch,flushInterval:e.flushInterval},b(e.endpoint)),this.init(),this.originalXHR=window.XMLHttpRequest,this.originalFetch=window.fetch,this.originalOnerror=window.onerror}init(){Ci.call(this),Oi.call(this),Ri.call(this),Pi.call(this),ji.call(this)}send(e){const i=Si(e,{title:document.title,url:location.href,userAgent:navigator.userAgent,browser:`${ui.name} ${ui.version}`,device:`${ci.model} ${ci.vendor}`,os:`${di.name} ${di.version}`},this.options);for(const t of i)this.reporter.capture(t)}capture(e){this.reporter.capture(e)}reportRequest(){0!==this.requestQueue.length&&(this.send({type:"batchXHR",requests:[...this.requestQueue]}),this.requestQueue=[])}reportError(){0!==this.errorQueue.length&&(this.send({type:"batchXHR",requests:[...this.errorQueue]}),this.errorQueue=[])}captureRequest(e){var i;if(!e.type||!["xhr","fetch"].includes(e.type))return;if(t=String(null!=(i=e.url)?i:""),(r=this.endpoint)&&String(t)===r)return;var t,r;const o=["url","method","duration","status","success","startTime"];for(const n of o)if(void 0===e[n])return;e.page=window.location.href,this.requestQueue.push(e),this.requestQueue.length>=this.maxQueueSize&&this.reportRequest()}sendQueuedData(){this.errorQueue.length>0&&this.reportError(),this.requestQueue.length>0&&this.reportRequest()}destroy(){this.sendQueuedData(),this.reporter.destroy(),window.XMLHttpRequest=this.originalXHR,window.fetch=this.originalFetch,window.onerror=this.originalOnerror,this.sendTimer&&(clearInterval(this.sendTimer),this.sendTimer=null),this.errorQueue=[],this.requestQueue=[]}},e.SDK_VERSION=h,e.createReporter=p,e.makeH5Transport=b,Object.defineProperty(e,Symbol.toStringTag,{value:"Module"})});
1
+ !function(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).Monitor={})}(this,function(e){"use strict";var t=Object.defineProperty,i=Object.defineProperties,r=Object.getOwnPropertyDescriptors,o=Object.getOwnPropertySymbols,n=Object.prototype.hasOwnProperty,s=Object.prototype.propertyIsEnumerable,a=(e,i,r)=>i in e?t(e,i,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[i]=r,l=(e,t)=>{for(var i in t||(t={}))n.call(t,i)&&a(e,i,t[i]);if(o)for(var i of o(t))s.call(t,i)&&a(e,i,t[i]);return e},u=(e,t)=>i(e,r(t)),c=(e,t,i)=>a(e,"symbol"!=typeof t?t+"":t,i),d=(e,t,i)=>new Promise((r,o)=>{var n=e=>{try{a(i.next(e))}catch(t){o(t)}},s=e=>{try{a(i.throw(e))}catch(t){o(t)}},a=e=>e.done?r(e.value):Promise.resolve(e.value).then(n,s);a((i=i.apply(e,t)).next())});const h="0.0.1";class p{constructor(e,t){c(this,"buffer",[]),c(this,"timer",null),c(this,"sending",!1),this.options=e,this.transport=t}capture(e){var t,i,r,o,n;const s=null!=(t=this.options.sampleRate)?t:100;s<100&&100*Math.random()>=s||(this.buffer.push(u(l({},e),{level:null!=(i=e.level)?i:"ERROR",occurredAt:null!=(r=e.occurredAt)?r:(new Date).toISOString(),sdkVersion:null!=(o=e.sdkVersion)?o:h})),this.buffer.length>100&&(this.buffer=this.buffer.slice(-100)),this.buffer.length>=(null!=(n=this.options.maxBatch)?n:20)?this.flush():this.ensureTimer())}flush(){return d(this,null,function*(){if(this.sending||0===this.buffer.length)return;this.clearTimer(),this.sending=!0;const e=this.buffer;this.buffer=[];try{yield this.transport({events:e},this.options.projectKey)}catch(t){403!==(null==t?void 0:t.statusCode)&&(this.buffer=[...e,...this.buffer].slice(-100),this.ensureTimer())}finally{this.sending=!1}})}destroy(){this.clearTimer(),this.flush()}ensureTimer(){var e;this.timer||(this.timer=setTimeout(()=>{this.timer=null,this.flush()},null!=(e=this.options.flushInterval)?e:3e4))}clearTimer(){this.timer&&(clearTimeout(this.timer),this.timer=null)}}function w(e,t){return new p(e,t)}function m(e){return(t,i)=>d(null,null,function*(){const r=yield fetch(e,{method:"POST",headers:{"content-type":"application/json","X-Project-Key":i},body:JSON.stringify(t),keepalive:!0});if(!r.ok)throw Object.assign(new Error(`monitor: 上报失败 ${r.status}`),{statusCode:r.status})})}let b,f;function g(){return b}["click","touchstart","mousedown","keydown"].forEach(e=>{document.addEventListener(e,e=>{b=e,f=e.path||e.composedPath()},{capture:!0,passive:!0})});var v,y="user-agent",k="",x="function",T="object",S="string",C="undefined",O="browser",R="cpu",E="device",q="engine",P="os",j="result",M="name",I="type",H="vendor",A="version",U="architecture",$="major",_="model",F="console",L="mobile",N="tablet",z="smarttv",B="wearable",D="xr",V="embedded",Q="inapp",X="brands",W="formFactors",G="fullVersionList",K="platform",J="platformVersion",Y="bitness",Z="sec-ch-ua",ee=Z+"-full-version-list",te=Z+"-arch",ie=Z+"-"+Y,re=Z+"-form-factors",oe=Z+"-"+L,ne=Z+"-"+_,se=Z+"-"+K,ae=se+"-version",le=[X,G,L,_,K,J,U,W,Y],ue="Amazon",ce="Apple",de="ASUS",he="BlackBerry",pe="Google",we="Huawei",me="Lenovo",be="Honor",fe="LG",ge="Microsoft",ve="Motorola",ye="Nvidia",ke="OnePlus",xe="OPPO",Te="Samsung",Se="Sharp",Ce="Sony",Oe="Xiaomi",Re="Zebra",Ee="Chrome",qe="Chromium",Pe="Chromecast",je="Edge",Me="Firefox",Ie="Opera",He="Facebook",Ae="Sogou",Ue="Mobile ",$e=" Browser",_e="Windows",Fe=typeof window!==C&&window.navigator?window.navigator:void 0,Le=Fe&&Fe.userAgentData?Fe.userAgentData:void 0,Ne=function(e){for(var t={},i=0;i<e.length;i++)t[e[i].toUpperCase()]=e[i];return t},ze=function(e,t){if(typeof e===T&&e.length>0){for(var i in e)if(Qe(t)==Qe(e[i]))return!0;return!1}return!!De(e)&&Qe(t)==Qe(e)},Be=function(e,t){for(var i in e)return/^(browser|cpu|device|engine|os)$/.test(i)||!!t&&Be(e[i])},De=function(e){return typeof e===S},Ve=function(e){if(e){for(var t=[],i=We(e).split(","),r=0;r<i.length;r++)if(i[r].indexOf(";")>-1){var o=Je(i[r]).split(";v=");t[r]={brand:o[0],version:o[1]}}else t[r]=Je(i[r]);return t}},Qe=function(e){return De(e)?e.toLowerCase():e},Xe=function(e){return De(e)?Ke(/[^\d\.]/g,e).split(".")[0]:void 0},We=function(e){return De(e)?Je(Ke(/\\?\"/g,e),500):void 0},Ge=function(e){for(var t in e)if(e.hasOwnProperty(t)){var i=e[t];typeof i==T&&2==i.length?this[i[0]]=i[1]:this[i]=void 0}return this},Ke=function(e,t){return De(t)?t.replace(e,k):t},Je=function(e,t){return e=Ke(/^\s\s*/,String(e)),typeof t===C?e:e.substring(0,t)},Ye=function(e,t){if(e&&t)for(var i,r,o,n,s,a,l=0;l<t.length&&!s;){var u=t[l],c=t[l+1];for(i=r=0;i<u.length&&!s&&u[i];)if(s=u[i++].exec(e))for(o=0;o<c.length;o++)a=s[++r],typeof(n=c[o])===T&&n.length>0?2===n.length?typeof n[1]==x?this[n[0]]=n[1].call(this,a):this[n[0]]=n[1]:n.length>=3&&(typeof n[1]!==x||n[1].exec&&n[1].test?3==n.length?this[n[0]]=a?a.replace(n[1],n[2]):void 0:4==n.length?this[n[0]]=a?n[3].call(this,a.replace(n[1],n[2])):void 0:n.length>4&&(this[n[0]]=a?n[3].apply(this,[a.replace(n[1],n[2])].concat(n.slice(4))):void 0):n.length>3?this[n[0]]=a?n[1].apply(this,n.slice(2)):void 0:this[n[0]]=a?n[1].call(this,a,n[2]):void 0):this[n]=a||void 0;l+=2}},Ze=function(e,t){for(var i in t)if(typeof t[i]===T&&t[i].length>0){for(var r=0;r<t[i].length;r++)if(ze(t[i][r],e))return"?"===i?void 0:i}else if(ze(t[i],e))return"?"===i?void 0:i;return t.hasOwnProperty("*")?t["*"]:e},et={ME:"4.90","NT 3.51":"3.51","NT 4.0":"4.0",2e3:["5.0","5.01"],XP:["5.1","5.2"],Vista:"6.0",7:"6.1",8:"6.2",8.1:"6.3",10:["6.4","10.0"],NT:""},tt={embedded:"Automotive",mobile:"Mobile",tablet:["Tablet","EInk"],smarttv:"TV",wearable:"Watch",xr:["VR","XR"],"?":["Desktop","Unknown"],"*":void 0},it={Chrome:"Google Chrome",Edge:"Microsoft Edge","Edge WebView2":"Microsoft Edge WebView2","Chrome WebView":"Android WebView","Chrome Headless":"HeadlessChrome","Huawei Browser":"HuaweiBrowser","MIUI Browser":"Miui Browser","Opera Mobi":"OperaMobile",Yandex:"YaBrowser"},rt={browser:[[/\b(?:crmo|crios)\/([\w\.]+)/i],[A,[M,Ue+"Chrome"]],[/webview.+edge\/([\w\.]+)/i],[A,[M,je+" WebView"],[I,Q]],[/edg(?:e|ios|a)?\/([\w\.]+)/i],[A,[M,"Edge"]],[/(opera mini)\/([-\w\.]+)/i,/(opera [mobiletab]{3,6})\b.+version\/([-\w\.]+)/i,/(opera)(?:.+version\/|[\/ ]+)([\w\.]+)/i],[M,A],[/opios[\/ ]+([\w\.]+)/i],[A,[M,Ie+" Mini"]],[/\bop(?:rg)?x\/([\w\.]+)/i],[A,[M,Ie+" GX"]],[/\bopr\/([\w\.]+)/i],[A,[M,Ie]],[/\bb[ai]*d(?:uhd|[ub]*[aekoprswx]{5,6})[\/ ]?([\w\.]+)/i],[A,[M,"Baidu"]],[/\b(?:mxbrowser|mxios|myie2)\/?([-\w\.]*)\b/i],[A,[M,"Maxthon"]],[/(kindle)\/([\w\.]+)/i,/(lunascape|maxthon|netfront|jasmine|blazer|sleipnir)[\/ ]?([\w\.]*)/i,/(avant|iemobile|slim(?:browser|boat|jet))[\/ ]?([\d\.]*)/i,/(?:ms|\()(ie) ([\w\.]+)/i,/(atlas|flock|rockmelt|midori|epiphany|silk|skyfire|bolt|iron|vivaldi|iridium|phantomjs|bowser|qupzilla|falkon|rekonq|puffin|whale(?!.+naver)|qqbrowserlite|duckduckgo|klar|helio|(?=comodo_)?dragon|otter|dooble|(?:hi|lg |ovi|qute)browser|palemoon)\/v?([-\w\.]+)/i,/(brave)(?: chrome)?\/([\d\.]+)/i,/(aloha|heytap|ovi|115|surf|qwant)browser\/([\d\.]+)/i,/(qwant)(?:ios|mobile)\/([\d\.]+)/i,/(ecosia|weibo)(?:__| \w+@)([\d\.]+)/i],[M,A],[/quark(?:pc)?\/([-\w\.]+)/i],[A,[M,"Quark"]],[/\bddg\/([\w\.]+)/i],[A,[M,"DuckDuckGo"]],[/(?:\buc? ?browser|(?:juc.+)ucweb| ucpc)[\/ ]?([\w\.]+)/i],[A,[M,"UCBrowser"]],[/microm.+\bqbcore\/([\w\.]+)/i,/\bqbcore\/([\w\.]+).+microm/i,/micromessenger\/([\w\.]+)/i],[A,[M,"WeChat"]],[/konqueror\/([\w\.]+)/i],[A,[M,"Konqueror"]],[/trident.+rv[: ]([\w\.]{1,9})\b.+like gecko/i],[A,[M,"IE"]],[/ya(?:search)?browser\/([\w\.]+)/i],[A,[M,"Yandex"]],[/slbrowser\/([\w\.]+)/i],[A,[M,"Smart "+me+$e]],[/(av(?:ast|g|ira))\/([\w\.]+)/i],[[M,/(.+)/,"$1 Secure"+$e],A],[/norton\/([\w\.]+)/i],[A,[M,"Norton Private"+$e]],[/\bfocus\/([\w\.]+)/i],[A,[M,Me+" Focus"]],[/ mms\/([\w\.]+)$/i],[A,[M,Ie+" Neon"]],[/ opt\/([\w\.]+)$/i],[A,[M,Ie+" Touch"]],[/coc_coc\w+\/([\w\.]+)/i],[A,[M,"Coc Coc"]],[/dolfin\/([\w\.]+)/i],[A,[M,"Dolphin"]],[/coast\/([\w\.]+)/i],[A,[M,Ie+" Coast"]],[/miuibrowser\/([\w\.]+)/i],[A,[M,"MIUI"+$e]],[/fxios\/([\w\.-]+)/i],[A,[M,Ue+Me]],[/\bqihoobrowser\/?([\w\.]*)/i],[A,[M,"360"]],[/\b(qq)\/([\w\.]+)/i],[[M,/(.+)/,"$1Browser"],A],[/(oculus|sailfish|huawei|vivo|pico)browser\/([\w\.]+)/i],[[M,/(.+)/,"$1"+$e],A],[/ HBPC\/([\w\.]+)/],[A,[M,we+$e]],[/samsungbrowser\/([\w\.]+)/i],[A,[M,Te+" Internet"]],[/metasr[\/ ]?([\d\.]+)/i],[A,[M,Ae+" Explorer"]],[/(sogou)mo\w+\/([\d\.]+)/i],[[M,Ae+" Mobile"],A],[/(electron)\/([\w\.]+) safari/i,/(tesla)(?: qtcarbrowser|\/(20\d\d\.[-\w\.]+))/i,/m?(qqbrowser|2345(?=browser|chrome|explorer))\w*[\/ ]?v?([\w\.]+)/i],[M,A],[/(lbbrowser|luakit|rekonq|steam(?= (clie|tenf|gameo)))/i],[M],[/ome\/([\w\.]+).+(iron(?= saf)|360(?=[es]e$))/i],[A,M],[/((?:fban\/fbios|fb_iab\/fb4a)(?!.+fbav)|;fbav\/([\w\.]+);)/i],[[M,He],A,[I,Q]],[/(kakao(?:talk|story))[\/ ]([\w\.]+)/i,/(naver)\(.*?(\d+\.[\w\.]+).*\)/i,/(daum)apps[\/ ]([\w\.]+)/i,/safari (line)\/([\w\.]+)/i,/\b(line)\/([\w\.]+)\/iab/i,/(alipay)client\/([\w\.]+)/i,/(twitter)(?:and| f.+e\/([\w\.]+))/i,/(bing)(?:web|sapphire)\/([\w\.]+)/i,/(instagram|snapchat|klarna)[\/ ]([-\w\.]+)/i],[M,A,[I,Q]],[/\bgsa\/([\w\.]+) .*safari\//i],[A,[M,"GSA"],[I,Q]],[/(?:musical_ly|trill)(?:.+app_?version\/|_)([\w\.]+)/i],[A,[M,"TikTok"],[I,Q]],[/\[(linkedin)app\]/i],[M,[I,Q]],[/(zalo(?:app)?)[\/\sa-z]*([\w\.-]+)/i],[[M,/(.+)/,"Zalo"],A,[I,Q]],[/(chromium)[\/ ]([-\w\.]+)/i],[M,A],[/ome-(lighthouse)$/i],[M,[I,"fetcher"]],[/headlesschrome(?:\/([\w\.]+)| )/i],[A,[M,Ee+" Headless"]],[/wv\).+chrome\/([\w\.]+).+edgw\//i],[A,[M,je+" WebView2"],[I,Q]],[/; wv\).+(chrome)\/([\w\.]+)/i],[[M,Ee+" WebView"],A,[I,Q]],[/droid.+ version\/([\w\.]+)\b.+(?:mobile safari|safari)/i],[A,[M,"Android"+$e]],[/chrome\/([\w\.]+) mobile/i],[A,[M,Ue+"Chrome"]],[/(chrome|omniweb|arora|[tizenoka]{5} ?browser)\/v?([\w\.]+)/i],[M,A],[/version\/([\w\.\,]+) .*mobile(?:\/\w+ | ?)safari/i],[A,[M,Ue+"Safari"]],[/iphone .*mobile(?:\/\w+ | ?)safari/i],[[M,Ue+"Safari"]],[/version\/([\w\.\,]+) .*(safari)/i],[A,M],[/webkit.+?(mobile ?safari|safari)(\/[\w\.]+)/i],[M,[A,"1"]],[/(webkit|khtml)\/([\w\.]+)/i],[M,A],[/(?:mobile|tablet);.*(firefox)\/([\w\.-]+)/i],[[M,Ue+Me],A],[/(navigator|netscape\d?)\/([-\w\.]+)/i],[[M,"Netscape"],A],[/(wolvic|librewolf)\/([\w\.]+)/i],[M,A],[/mobile vr; rv:([\w\.]+)\).+firefox/i],[A,[M,Me+" Reality"]],[/ekiohf.+(flow)\/([\w\.]+)/i,/(swiftfox)/i,/(icedragon|iceweasel|camino|chimera|fennec|maemo browser|minimo|conkeror)[\/ ]?([\w\.\+]+)/i,/(seamonkey|k-meleon|icecat|iceape|firebird|phoenix|basilisk|waterfox)\/([-\w\.]+)$/i,/(firefox)\/([\w\.]+)/i,/(mozilla)\/([\w\.]+(?= .+rv\:.+gecko\/\d+)|[0-4][\w\.]+(?!.+compatible))/i,/(amaya|dillo|doris|icab|ladybird|lynx|mosaic|netsurf|obigo|polaris|w3m|(?:go|ice|up)[\. ]?browser)[-\/ ]?v?([\w\.]+)/i,/\b(links) \(([\w\.]+)/i],[M,[A,/_/g,"."]],[/(cobalt)\/([\w\.]+)/i],[M,[A,/[^\d\.]+./,k]]],cpu:[[/\b((amd|x|x86[-_]?|wow|win)64)\b/i],[[U,"amd64"]],[/(ia32(?=;))/i,/\b((i[346]|x)86)(pc)?\b/i],[[U,"ia32"]],[/\b(aarch64|arm(v?[89]e?l?|_?64))\b/i],[[U,"arm64"]],[/\b(arm(v[67])?ht?n?[fl]p?)\b/i],[[U,"armhf"]],[/( (ce|mobile); ppc;|\/[\w\.]+arm\b)/i],[[U,"arm"]],[/ sun4\w[;\)]/i],[[U,"sparc"]],[/\b(avr32|ia64(?=;)|68k(?=\))|\barm(?=v([1-7]|[5-7]1)l?|;|eabi)|(irix|mips|sparc)(64)?\b|pa-risc)/i,/((ppc|powerpc)(64)?)( mac|;|\))/i,/(?:osf1|[freopnt]{3,4}bsd) (alpha)/i],[[U,/ower/,k,Qe]],[/mc680.0/i],[[U,"68k"]],[/winnt.+\[axp/i],[[U,"alpha"]]],device:[[/\b(sch-i[89]0\d|shw-m380s|sm-[ptx]\w{2,4}|gt-[pn]\d{2,4}|sgh-t8[56]9|nexus 10)/i],[_,[H,Te],[I,N]],[/\b((?:s[cgp]h|gt|sm)-(?![lr])\w+|sc[g-]?[\d]+a?|galaxy nexus)/i,/samsung[- ]((?!sm-[lr]|browser)[-\w]+)/i,/sec-(sgh\w+)/i],[_,[H,Te],[I,L]],[/(?:\/|\()(ip(?:hone|od)[\w, ]*)[\/\);]/i],[_,[H,ce],[I,L]],[/\b(?:ios|apple\w+)\/.+[\(\/](ipad)/i,/\b(ipad)[\d,]*[;\] ].+(mac |i(pad)?)os/i],[_,[H,ce],[I,N]],[/(macintosh);/i],[_,[H,ce]],[/\b(sh-?[altvz]?\d\d[a-ekm]?)/i],[_,[H,Se],[I,L]],[/\b((?:brt|eln|hey2?|gdi|jdn)-a?[lnw]09|(?:ag[rm]3?|jdn2|kob2)-a?[lw]0[09]hn)(?: bui|\)|;)/i],[_,[H,be],[I,N]],[/honor([-\w ]+)[;\)]/i],[_,[H,be],[I,L]],[/\b((?:ag[rs][2356]?k?|bah[234]?|bg[2o]|bt[kv]|cmr|cpn|db[ry]2?|jdn2|got|kob2?k?|mon|pce|scm|sht?|[tw]gr|vrd)-[ad]?[lw][0125][09]b?|605hw|bg2-u03|(?:gem|fdr|m2|ple|t1)-[7a]0[1-4][lu]|t1-a2[13][lw]|mediapad[\w\. ]*(?= bui|\)))\b(?!.+d\/s)/i],[_,[H,we],[I,N]],[/(?:huawei) ?([-\w ]+)[;\)]/i,/\b(nexus 6p|\w{2,4}e?-[atu]?[ln][\dx][\dc][adnt]?)\b(?!.+d\/s)/i],[_,[H,we],[I,L]],[/oid[^\)]+; (2[\dbc]{4}(182|283|rp\w{2})[cgl]|m2105k81a?c)(?: bui|\))/i,/\b(?:xiao)?((?:red)?mi[-_ ]?pad[\w- ]*)(?: bui|\))/i],[[_,/_/g," "],[H,Oe],[I,N]],[/\b; (\w+) build\/hm\1/i,/\b(hm[-_ ]?note?[_ ]?(?:\d\w)?) bui/i,/oid[^\)]+; (redmi[\-_ ]?(?:note|k)?[\w_ ]+|m?[12]\d[01]\d\w{3,6}|poco[\w ]+|(shark )?\w{3}-[ah]0|qin ?[1-3](s\+|ultra| pro)?)( bui|; wv|\))/i,/\b(mi[-_ ]?(?:a\d|one|one[_ ]plus|note|max|cc)?[_ ]?(?:\d{0,2}\w?)[_ ]?(?:plus|se|lite|pro)?( 5g|lte)?)(?: bui|\))/i,/; ([\w ]+) miui\/v?\d/i],[[_,/_/g," "],[H,Oe],[I,L]],[/droid.+; (cph2[3-6]\d[13579]|((gm|hd)19|(ac|be|in|kb)20|(d[en]|eb|le|mt)21|ne22)[0-2]\d|p[g-l]\w[1m]10)\b/i,/(?:one)?(?:plus)? (a\d0\d\d)(?: b|\))/i],[_,[H,ke],[I,L]],[/; (\w+) bui.+ oppo/i,/\b(cph[12]\d{3}|p(?:af|c[al]|d\w|e[ar])[mt]\d0|x9007|a101op)\b/i],[_,[H,xe],[I,L]],[/\b(opd2(\d{3}a?))(?: bui|\))/i],[_,[H,Ze,{OnePlus:["203","304","403","404","413","415"],"*":xe}],[I,N]],[/(vivo (5r?|6|8l?|go|one|s|x[il]?[2-4]?)[\w\+ ]*)(?: bui|\))/i],[_,[H,"BLU"],[I,L]],[/; vivo (\w+)(?: bui|\))/i,/\b(v[12]\d{3}\w?[at])(?: bui|;)/i],[_,[H,"Vivo"],[I,L]],[/\b(rmx[1-3]\d{3})(?: bui|;|\))/i],[_,[H,"Realme"],[I,L]],[/(ideatab[-\w ]+|602lv|d-42a|a101lv|a2109a|a3500-hv|s[56]000|pb-6505[my]|tb-?x?\d{3,4}(?:f[cu]|xu|[av])|yt\d?-[jx]?\d+[lfmx])( bui|;|\)|\/)/i,/lenovo ?(b[68]0[08]0-?[hf]?|tab(?:[\w- ]+?)|tb[\w-]{6,7})( bui|;|\)|\/)/i],[_,[H,me],[I,N]],[/lenovo[-_ ]?([-\w ]+?)(?: bui|\)|\/)/i],[_,[H,me],[I,L]],[/\b(milestone|droid(?:[2-4x]| (?:bionic|x2|pro|razr))?:?( 4g)?)\b[\w ]+build\//i,/\bmot(?:orola)?[- ]([\w\s]+)(\)| bui)/i,/((?:moto(?! 360)[-\w\(\) ]+|xt\d{3,4}[cgkosw\+]?[-\d]*|nexus 6)(?= bui|\)))/i],[_,[H,ve],[I,L]],[/\b(mz60\d|xoom[2 ]{0,2}) build\//i],[_,[H,ve],[I,N]],[/\b(?:lg)?([vl]k\-?\d{3}) bui| 3\.[-\w; ]{10}lg?-([06cv9]{3,4})/i],[_,[H,fe],[I,N]],[/(lm(?:-?f100[nv]?|-[\w\.]+)(?= bui|\))|nexus [45])/i,/\blg[-e;\/ ]+(?!.*(?:browser|netcast|android tv|watch|webos))(\w+)/i,/\blg-?([\d\w]+) bui/i],[_,[H,fe],[I,L]],[/(nokia) (t[12][01])/i],[H,_,[I,N]],[/(?:maemo|nokia).*(n900|lumia \d+|rm-\d+)/i,/nokia[-_ ]?(([-\w\. ]*?))( bui|\)|;|\/)/i],[[_,/_/g," "],[I,L],[H,"Nokia"]],[/(pixel (c|tablet))\b/i],[_,[H,pe],[I,N]],[/droid.+;(?: google)? (g(01[13]a|020[aem]|025[jn]|1b60|1f8f|2ybb|4s1m|576d|5nz6|8hhn|8vou|a02099|c15s|d1yq|e2ae|ec77|gh2x|kv4x|p4bc|pj41|r83y|tt9q|ur25|wvk6)|pixel[\d ]*a?( pro)?( xl)?( fold)?( \(5g\))?)( bui|\))/i],[_,[H,pe],[I,L]],[/(google) (pixelbook( go)?)/i],[H,_],[/droid.+; (a?\d[0-2]{2}so|[c-g]\d{4}|so[-gl]\w+|xq-\w\w\d\d)(?= bui|\).+chrome\/(?![1-6]{0,1}\d\.))/i],[_,[H,Ce],[I,L]],[/sony tablet [ps]/i,/\b(?:sony)?sgp\w+(?: bui|\))/i],[[_,"Xperia Tablet"],[H,Ce],[I,N]],[/(alexa)webm/i,/(kf[a-z]{2}wi|aeo(?!bc)\w\w)( bui|\))/i,/(kf[a-z]+)( bui|\)).+silk\//i],[_,[H,ue],[I,N]],[/((?:sd|kf)[0349hijorstuw]+)( bui|\)).+silk\//i],[[_,/(.+)/g,"Fire Phone $1"],[H,ue],[I,L]],[/(playbook);[-\w\),; ]+(rim)/i],[_,H,[I,N]],[/\b((?:bb[a-f]|st[hv])100-\d)/i,/(?:blackberry|\(bb10;) (\w+)/i],[_,[H,he],[I,L]],[/(?:\b|asus_)(transfo[prime ]{4,10} \w+|eeepc|slider \w+|nexus 7|padfone|p00[cj])/i],[_,[H,de],[I,N]],[/ (z[bes]6[027][012][km][ls]|zenfone \d\w?)\b/i],[_,[H,de],[I,L]],[/(nexus 9)/i],[_,[H,"HTC"],[I,N]],[/(htc)[-;_ ]{1,2}([\w ]+(?=\)| bui)|\w+)/i,/(zte)[- ]([\w ]+?)(?: bui|\/|\))/i,/(alcatel|geeksphone|nexian|panasonic(?!(?:;|\.))|sony(?!-bra))[-_ ]?([-\w]*)/i],[H,[_,/_/g," "],[I,L]],[/tcl (xess p17aa)/i,/droid [\w\.]+; ((?:8[14]9[16]|9(?:0(?:48|60|8[01])|1(?:3[27]|66)|2(?:6[69]|9[56])|466))[gqswx])(_\w(\w|\w\w))?(\)| bui)/i],[_,[H,"TCL"],[I,N]],[/droid [\w\.]+; (418(?:7d|8v)|5087z|5102l|61(?:02[dh]|25[adfh]|27[ai]|56[dh]|59k|65[ah])|a509dl|t(?:43(?:0w|1[adepqu])|50(?:6d|7[adju])|6(?:09dl|10k|12b|71[efho]|76[hjk])|7(?:66[ahju]|67[hw]|7[045][bh]|71[hk]|73o|76[ho]|79w|81[hks]?|82h|90[bhsy]|99b)|810[hs]))(_\w(\w|\w\w))?(\)| bui)/i],[_,[H,"TCL"],[I,L]],[/(itel) ((\w+))/i],[[H,Qe],_,[I,Ze,{tablet:["p10001l","w7001"],"*":"mobile"}]],[/droid.+; ([ab][1-7]-?[0178a]\d\d?)/i],[_,[H,"Acer"],[I,N]],[/droid.+; (m[1-5] note) bui/i,/\bmz-([-\w]{2,})/i],[_,[H,"Meizu"],[I,L]],[/; ((?:power )?armor(?:[\w ]{0,8}))(?: bui|\))/i],[_,[H,"Ulefone"],[I,L]],[/; (energy ?\w+)(?: bui|\))/i,/; energizer ([\w ]+)(?: bui|\))/i],[_,[H,"Energizer"],[I,L]],[/; cat (b35);/i,/; (b15q?|s22 flip|s48c|s62 pro)(?: bui|\))/i],[_,[H,"Cat"],[I,L]],[/((?:new )?andromax[\w- ]+)(?: bui|\))/i],[_,[H,"Smartfren"],[I,L]],[/droid.+; (a(in)?(0(15|59|6[35])|142)p?)/i],[_,[H,"Nothing"],[I,L]],[/; (x67 5g|tikeasy \w+|ac[1789]\d\w+)( b|\))/i,/archos ?(5|gamepad2?|([\w ]*[t1789]|hello) ?\d+[\w ]*)( b|\))/i],[_,[H,"Archos"],[I,N]],[/archos ([\w ]+)( b|\))/i,/; (ac[3-6]\d\w{2,8})( b|\))/i],[_,[H,"Archos"],[I,L]],[/blackview ([-\w ]+)( b|\))/i,/; (bv\d{4}[-\w ]*)( b|\))/i],[_,[H,"Blackview"],[I,L]],[/; (n159v)/i],[_,[H,"HMD"],[I,L]],[/((revvl[ \w\+]+|tm(?:rv|af)\w*[45]g(?:tb)?))( b|\))/i],[_,[I,function(e,t){return t.test.test(e)?t.ifTrue:t.ifFalse},{test:/ta?b/i,ifTrue:N,ifFalse:L}],[H,"T-Mobile"]],[/(imo) (tab \w+)/i,/(infinix|tecno) (x1101b?|p904|dp(7c|8d|10a)( pro)?|p70[1-3]a?|p904|t1101)/i],[H,_,[I,N]],[/(blackberry|benq|palm(?=\-)|sonyericsson|acer|asus(?! zenw)|dell|jolla|meizu|motorola|polytron|tecno|micromax|advan)[-_ ]?([-\w]*)/i,/; (blu|coolpad|cubot|hmd|imo|infinix|lava|oneplus|tcl|wiko)[_ ]([-\w\+ ]+?)(?: bui|\)|; r)/i,/(hp) ([\w ]+\w)/i,/(microsoft); (lumia[\w ]+)/i,/(oppo) ?([\w ]+) bui/i,/(hisense) ([ehv][\w ]+)\)/i,/droid[^;]+; (philips)[_ ]([sv-x][\d]{3,4}[xz]?)/i],[H,_,[I,L]],[/(kobo)\s(ereader|touch)/i,/(hp).+(touchpad(?!.+tablet)|tablet)/i,/(kindle)\/([\w\.]+)/i],[H,_,[I,N]],[/(surface duo)/i],[_,[H,ge],[I,N]],[/droid [\d\.]+; (fp\du?)(?: b|\))/i],[_,[H,"Fairphone"],[I,L]],[/((?:tegranote|shield t(?!.+d tv))[\w- ]*?)(?: b|\))/i],[_,[H,ye],[I,N]],[/(sprint) (\w+)/i],[H,_,[I,L]],[/(kin\.[onetw]{3})/i],[[_,/\./g," "],[H,ge],[I,L]],[/droid.+; ([c6]+|et5[16]|mc[239][23]x?|vc8[03]x?)\)/i],[_,[H,Re],[I,N]],[/droid.+; (ec30|ps20|tc[2-8]\d[kx])\)/i],[_,[H,Re],[I,L]],[/(philips)[\w ]+tv/i,/smart-tv.+(samsung)/i],[H,[I,z]],[/hbbtv.+maple;(\d+)/i],[[_,/^/,"SmartTV"],[H,Te],[I,z]],[/(vizio)(?: |.+model\/)(\w+-\w+)/i,/tcast.+(lg)e?. ([-\w]+)/i],[H,_,[I,z]],[/(nux; netcast.+smarttv|lg (netcast\.tv-201\d|android tv))/i],[[H,fe],[I,z]],[/(apple) ?tv/i],[H,[_,ce+" TV"],[I,z]],[/crkey.*devicetype\/chromecast/i],[[_,Pe+" Third Generation"],[H,pe],[I,z]],[/crkey.*devicetype\/([^/]*)/i],[[_,/^/,"Chromecast "],[H,pe],[I,z]],[/fuchsia.*crkey/i],[[_,Pe+" Nest Hub"],[H,pe],[I,z]],[/crkey/i],[[_,Pe],[H,pe],[I,z]],[/(portaltv)/i],[_,[H,He],[I,z]],[/droid.+aft(\w+)( bui|\))/i],[_,[H,ue],[I,z]],[/(shield \w+ tv)/i],[_,[H,ye],[I,z]],[/\(dtv[\);].+(aquos)/i,/(aquos-tv[\w ]+)\)/i],[_,[H,Se],[I,z]],[/(bravia[\w ]+)( bui|\))/i],[_,[H,Ce],[I,z]],[/(mi(tv|box)-?\w+) bui/i],[_,[H,Oe],[I,z]],[/Hbbtv.*(technisat) (.*);/i],[H,_,[I,z]],[/\b(roku)[\dx]*[\)\/]((?:dvp-)?[\d\.]*)/i,/hbbtv\/\d+\.\d+\.\d+ +\([\w\+ ]*; *([\w\d][^;]*);([^;]*)/i],[[H,/.+\/(\w+)/,"$1",Ze,{LG:"lge"}],[_,Je],[I,z]],[/(playstation \w+)/i],[_,[H,Ce],[I,F]],[/\b(xbox(?: one)?(?!; xbox))[\); ]/i],[_,[H,ge],[I,F]],[/(ouya)/i,/(nintendo) (\w+)/i,/(retroid) (pocket ([^\)]+))/i,/(valve).+(steam deck)/i,/droid.+; ((shield|rgcube|gr0006))( bui|\))/i],[[H,Ze,{Nvidia:"Shield",Anbernic:"RGCUBE",Logitech:"GR0006"}],_,[I,F]],[/\b(sm-[lr]\d\d[0156][fnuw]?s?|gear live)\b/i],[_,[H,Te],[I,B]],[/((pebble))app/i,/(asus|google|lg|oppo|xiaomi) ((pixel |zen)?watch[\w ]*)( bui|\))/i],[H,_,[I,B]],[/(ow(?:19|20)?we?[1-3]{1,3})/i],[_,[H,xe],[I,B]],[/(watch)(?: ?os[,\/]|\d,\d\/)[\d\.]+/i],[_,[H,ce],[I,B]],[/(opwwe\d{3})/i],[_,[H,ke],[I,B]],[/(moto 360)/i],[_,[H,ve],[I,B]],[/(smartwatch 3)/i],[_,[H,Ce],[I,B]],[/(g watch r)/i],[_,[H,fe],[I,B]],[/droid.+; (wt63?0{2,3})\)/i],[_,[H,Re],[I,B]],[/droid.+; (glass) \d/i],[_,[H,pe],[I,D]],[/(pico) ([\w ]+) os\d/i],[H,_,[I,D]],[/(quest( \d| pro)?s?).+vr/i],[_,[H,He],[I,D]],[/mobile vr; rv.+firefox/i],[[I,D]],[/(tesla)(?: qtcarbrowser|\/[-\w\.]+)/i],[H,[I,V]],[/(aeobc)\b/i],[_,[H,ue],[I,V]],[/(homepod).+mac os/i],[_,[H,ce],[I,V]],[/windows iot/i],[[I,V]],[/droid.+; ([\w- ]+) (4k|android|smart|google)[- ]?tv/i],[_,[I,z]],[/\b((4k|android|smart|opera)[- ]?tv|tv; rv:|large screen[\w ]+safari)\b/i],[[I,z]],[/droid .+?; ([^;]+?)(?: bui|; wv\)|\) applew|; hmsc).+?(mobile|vr|\d) safari/i],[_,[I,Ze,{mobile:"Mobile",xr:"VR","*":N}]],[/\b((tablet|tab)[;\/]|focus\/\d(?!.+mobile))/i],[[I,N]],[/(phone|mobile(?:[;\/]| [ \w\/\.]*safari)|pda(?=.+windows ce))/i],[[I,L]],[/droid .+?; ([\w\. -]+)( bui|\))/i],[_,[H,"Generic"]]],engine:[[/windows.+ edge\/([\w\.]+)/i],[A,[M,je+"HTML"]],[/(arkweb)\/([\w\.]+)/i],[M,A],[/webkit\/537\.36.+chrome\/(?!27)([\w\.]+)/i],[A,[M,"Blink"]],[/(presto)\/([\w\.]+)/i,/(webkit|trident|netfront|netsurf|amaya|lynx|w3m|goanna|servo)\/([\w\.]+)/i,/ekioh(flow)\/([\w\.]+)/i,/(khtml|tasman|links|dillo)[\/ ]\(?([\w\.]+)/i,/(icab)[\/ ]([23]\.[\d\.]+)/i,/\b(libweb)/i],[M,A],[/ladybird\//i],[[M,"LibWeb"]],[/rv\:([\w\.]{1,9})\b.+(gecko)/i],[A,M]],os:[[/(windows nt) (6\.[23]); arm/i],[[M,/N/,"R"],[A,Ze,et]],[/(windows (?:phone|mobile|iot))(?: os)?[\/ ]?([\d\.]*( se)?)/i,/(windows)[\/ ](1[01]|2000|3\.1|7|8(\.1)?|9[58]|me|server 20\d\d( r2)?|vista|xp)/i],[M,A],[/windows nt ?([\d\.\)]*)(?!.+xbox)/i,/\bwin(?=3| ?9|n)(?:nt| 9x )?([\d\.;]*)/i],[[A,/(;|\))/g,"",Ze,et],[M,_e]],[/(windows ce)\/?([\d\.]*)/i],[M,A],[/[adehimnop]{4,7}\b(?:.*os ([\w]+) like mac|; opera)/i,/(?:ios;fbsv|ios(?=.+ip(?:ad|hone)|.+apple ?tv)|ip(?:ad|hone)(?: |.+i(?:pad)?)os|apple ?tv.+ios)[\/ ]([\w\.]+)/i,/\btvos ?([\w\.]+)/i,/cfnetwork\/.+darwin/i],[[A,/_/g,"."],[M,"iOS"]],[/(mac os x) ?([\w\. ]*)/i,/(macintosh|mac_powerpc\b)(?!.+(haiku|morphos))/i],[[M,"macOS"],[A,/_/g,"."]],[/android ([\d\.]+).*crkey/i],[A,[M,Pe+" Android"]],[/fuchsia.*crkey\/([\d\.]+)/i],[A,[M,Pe+" Fuchsia"]],[/crkey\/([\d\.]+).*devicetype\/smartspeaker/i],[A,[M,Pe+" SmartSpeaker"]],[/linux.*crkey\/([\d\.]+)/i],[A,[M,Pe+" Linux"]],[/crkey\/([\d\.]+)/i],[A,[M,Pe]],[/droid ([\w\.]+)\b.+(android[- ]x86)/i],[A,M],[/(ubuntu) ([\w\.]+) like android/i],[[M,/(.+)/,"$1 Touch"],A],[/(harmonyos)[\/ ]?([\d\.]*)/i,/(android|bada|blackberry|kaios|maemo|meego|openharmony|qnx|rim tablet os|sailfish|series40|symbian|tizen)\w*[-\/\.; ]?([\d\.]*)/i],[M,A],[/\(bb(10);/i],[A,[M,he]],[/(?:symbian ?os|symbos|s60(?=;)|series ?60)[-\/ ]?([\w\.]*)/i],[A,[M,"Symbian"]],[/mozilla\/[\d\.]+ \((?:mobile[;\w ]*|tablet|tv|[^\)]*(?:viera|lg(?:l25|-d300)|alcatel ?o.+|y300-f1)); rv:([\w\.]+)\).+gecko\//i],[A,[M,Me+" OS"]],[/\b(?:hp)?wos(?:browser)?\/([\w\.]+)/i,/webos(?:[ \/]?|\.tv-20(?=2[2-9]))(\d[\d\.]*)/i],[A,[M,"webOS"]],[/web0s;.+?(?:chr[o0]me|safari)\/(\d+)/i],[[A,Ze,{25:"120",24:"108",23:"94",22:"87",6:"79",5:"68",4:"53",3:"38",2:"538",1:"537","*":"TV"}],[M,"webOS"]],[/watch(?: ?os[,\/ ]|\d,\d\/)([\d\.]+)/i],[A,[M,"watchOS"]],[/cros [\w]+(?:\)| ([\w\.]+)\b)/i],[A,[M,"Chrome OS"]],[/kepler ([\w\.]+); (aft|aeo)/i],[A,[M,"Vega OS"]],[/(netrange)mmh/i,/(nettv)\/(\d+\.[\w\.]+)/i,/(nintendo|playstation) (\w+)/i,/(xbox); +xbox ([^\);]+)/i,/(pico) .+os([\w\.]+)/i,/\b(joli|palm)\b ?(?:os)?\/?([\w\.]*)/i,/linux.+(mint)[\/\(\) ]?([\w\.]*)/i,/(mageia|vectorlinux|fuchsia|arcaos|arch(?= ?linux))[;l ]([\d\.]*)/i,/([kxln]?ubuntu|debian|suse|opensuse|gentoo|slackware|fedora|mandriva|centos|pclinuxos|red ?hat|zenwalk|linpus|raspbian|plan 9|minix|risc os|contiki|deepin|manjaro|elementary os|sabayon|linspire|knoppix)(?: gnu[\/ ]linux)?(?: enterprise)?(?:[- ]linux)?(?:-gnu)?[-\/ ]?(?!chrom|package)([-\w\.]*)/i,/((?:open)?solaris)[-\/ ]?([\w\.]*)/i,/\b(aix)[; ]([1-9\.]{0,4})/i,/(hurd|linux|morphos)(?: (?:arm|x86|ppc)\w*| ?)([\w\.]*)/i,/(gnu) ?([\w\.]*)/i,/\b([-frentopcghs]{0,5}bsd|dragonfly)[\/ ]?(?!amd|[ix346]{1,2}86)([\w\.]*)/i,/(haiku) ?(r\d)?/i],[M,A],[/(sunos) ?([\d\.]*)/i],[[M,"Solaris"],A],[/\b(beos|os\/2|amigaos|openvms|hp-ux|serenityos)/i,/(unix) ?([\w\.]*)/i],[M,A]]},ot=(Ge.call((v={init:{},isIgnore:{},isIgnoreRgx:{},toString:{}}).init,[[O,[M,A,$,I]],[R,[U]],[E,[I,_,H]],[q,[M,A]],[P,[M,A]]]),Ge.call(v.isIgnore,[[O,[A,$]],[q,[A]],[P,[A]]]),Ge.call(v.isIgnoreRgx,[[O,/ ?browser$/i],[P,/ ?os$/i]]),Ge.call(v.toString,[[O,[M,A]],[R,[U]],[E,[H,_]],[q,[M,A]],[P,[M,A]]]),v),nt=function(e,t){var i=ot.init[t],r=ot.isIgnore[t]||0,o=ot.isIgnoreRgx[t]||0,n=ot.toString[t]||0;function s(){Ge.call(this,i)}return s.prototype.getItem=function(){return e},s.prototype.withClientHints=function(){return Le?Le.getHighEntropyValues(le).then(function(t){return e.setCH(new st(t,!1)).parseCH().get()}):e.parseCH().get()},s.prototype.withFeatureCheck=function(){return e.detectFeature().get()},t!=j&&(s.prototype.is=function(e){var t=!1;for(var i in this)if(this.hasOwnProperty(i)&&!ze(r,i)&&Qe(o?Ke(o,this[i]):this[i])==Qe(o?Ke(o,e):e)){if(t=!0,e!=C)break}else if(e==C&&t){t=!t;break}return t},s.prototype.toString=function(){var e=k;for(var t in n)typeof this[n[t]]!==C&&(e+=(e?" ":k)+this[n[t]]);return e||C}),s.prototype.then=function(e){var t=this,i=function(){for(var e in t)t.hasOwnProperty(e)&&(this[e]=t[e])};i.prototype={is:s.prototype.is,toString:s.prototype.toString,withClientHints:s.prototype.withClientHints,withFeatureCheck:s.prototype.withFeatureCheck};var r=new i;return e(r),r},new s};function st(e,t){if(e=e||{},Ge.call(this,le),t)Ge.call(this,[[X,Ve(e[Z])],[G,Ve(e[ee])],[L,/\?1/.test(e[oe])],[_,We(e[ne])],[K,We(e[se])],[J,We(e[ae])],[U,We(e[te])],[W,Ve(e[re])],[Y,We(e[ie])]]);else for(var i in e)this.hasOwnProperty(i)&&typeof e[i]!==C&&(this[i]=e[i])}function at(e,t,i,r){return Ge.call(this,[["itemType",e],["ua",t],["uaCH",r],["rgxMap",i],["data",nt(this,e)]]),this}function lt(e,t,i){if(typeof e===T?(Be(e,!0)?(typeof t===T&&(i=t),t=e):(i=e,t=void 0),e=void 0):typeof e!==S||Be(t,!0)||(i=t,t=void 0),i)if(typeof i.append===x){var r={};i.forEach(function(e,t){r[String(t).toLowerCase()]=e}),i=r}else{var o={};for(var n in i)i.hasOwnProperty(n)&&(o[String(n).toLowerCase()]=i[n]);i=o}if(!(this instanceof lt))return new lt(e,t,i).getResult();var s=typeof e===S?e:i&&i[y]?i[y]:Fe&&Fe.userAgent?Fe.userAgent:k,a=new st(i,!0),l=rt,u=function(e){return e==j?function(){return new at(e,s,l,a).set("ua",s).set(O,this.getBrowser()).set(R,this.getCPU()).set(E,this.getDevice()).set(q,this.getEngine()).set(P,this.getOS()).get()}:function(){return new at(e,s,l[e],a).parseUA().get()}};return Ge.call(this,[["getBrowser",u(O)],["getCPU",u(R)],["getDevice",u(E)],["getEngine",u(q)],["getOS",u(P)],["getResult",u(j)],["getUA",function(){return s}],["setUA",function(e){return De(e)&&(s=Je(e,500)),this}],["useExtension",function(e){return e&&(l=function(e,t){var i={},r=t;if(!Be(t))for(var o in r={},t)for(var n in t[o])r[n]=t[o][n].concat(r[n]?r[n]:[]);for(var s in e)i[s]=r[s]&&r[s].length%2==0?r[s].concat(e[s]):e[s];return i}(l,e)),this}]]).setUA(s).useExtension(t),this}at.prototype.get=function(e){return e?this.data.hasOwnProperty(e)?this.data[e]:void 0:this.data},at.prototype.set=function(e,t){return this.data[e]=t,this},at.prototype.setCH=function(e){return this.uaCH=e,this},at.prototype.detectFeature=function(){if(Fe&&Fe.userAgent==this.ua)switch(this.itemType){case O:Fe.brave&&typeof Fe.brave.isBrave==x&&this.set(M,"Brave");break;case E:!this.get(I)&&Le&&Le[L]&&this.set(I,L),"Macintosh"==this.get(_)&&Fe&&typeof Fe.standalone!==C&&Fe.maxTouchPoints&&Fe.maxTouchPoints>2&&this.set(_,"iPad").set(I,N);break;case P:!this.get(M)&&Le&&Le[K]&&this.set(M,Le[K]);break;case j:var e=this.data,t=function(t){return e[t].getItem().detectFeature().get()};this.set(O,t(O)).set(R,t(R)).set(E,t(E)).set(q,t(q)).set(P,t(P))}return this},at.prototype.parseUA=function(){switch(this.itemType!=j&&Ye.call(this.data,this.ua,this.rgxMap),this.itemType){case O:this.set($,Xe(this.get(A)));break;case P:if("iOS"==this.get(M)&&this.get(A)&&/^1[89][^\d]/.exec(this.get(A))){var e=/\) Version\/((\d+)[\d\.]*)/.exec(this.ua);e&&parseInt(e[2],10)>=26&&this.set(A,e[1])}}return this},at.prototype.parseCH=function(){var e=this.uaCH,t=this.rgxMap;switch(this.itemType){case O:case q:var i,r=e[G]||e[X];if(r)for(var o=0;o<r.length;o++){var n=r[o].brand||r[o],s=r[o].version;this.itemType==O&&!/not.a.brand/i.test(n)&&(!i||/Chrom/.test(i)&&n!=qe||i==je&&/WebView2/.test(n))&&(n=Ze(n,it),(i=this.get(M))&&!/Chrom/.test(i)&&/Chrom/.test(n)||this.set(M,n).set(A,s).set($,Xe(s)),i=n),this.itemType==q&&n==qe&&this.set(A,s)}break;case R:var a=e[U];a&&(a&&"64"==e[Y]&&(a+="64"),Ye.call(this.data,a+";",t));break;case E:if(e[L]&&this.set(I,L),e[_]&&(this.set(_,e[_]),!this.get(I)||!this.get(H))){var l={};Ye.call(l,"droid 9; "+e[_]+")",t),!this.get(I)&&l.type&&this.set(I,l.type),!this.get(H)&&l.vendor&&this.set(H,l.vendor)}if(e[W]){var u;if("string"!=typeof e[W])for(var c=0;!u&&c<e[W].length;)u=Ze(e[W][c++],tt);else u=Ze(e[W],tt);this.set(I,u)}break;case P:var d=e[K];if(d){var h=e[J];d==_e&&(h=parseInt(Xe(h),10)>=13?"11":"10"),this.set(M,d).set(A,h)}this.get(M)==_e&&"Xbox"==e[_]&&this.set(M,"Xbox").set(A,void 0);break;case j:var p=this.data,w=function(t){return p[t].getItem().setCH(e).parseCH().get()};this.set(O,w(O)).set(R,w(R)).set(E,w(E)).set(q,w(q)).set(P,w(P))}return this},lt.VERSION="2.0.10",lt.BROWSER=Ne([M,A,$,I]),lt.CPU=Ne([U]),lt.DEVICE=Ne([_,H,I,F,L,z,N,B,V]),lt.ENGINE=lt.OS=Ne([M,A]);const{browser:ut,device:ct,os:dt}=lt(navigator.userAgent);function ht(e){return e!==window&&e!==document&&e!==document.documentElement}function pt(e){return e.id?`${e.nodeName.toLowerCase()}#${e.id}`:e.className&&"string"==typeof e.className?`${e.nodeName.toLowerCase()}#${e.className}`:e.nodeName.toLowerCase()}function wt(e){const t=f;if(Array.isArray(t))return function(e){return e.reverse().filter(ht).map(pt).join(" ")}(t)}function mt(e){return e.split("\n").slice(1).map(e=>e.replace(/^\s+at\s+/g,"")).join("\n")}function bt(){try{return location.href}catch(e){return""}}function ft(e){return{title:e.title,url:e.url,browser:e.browser,os:e.os,deviceInfo:e.device,userAgent:e.userAgent}}function gt(e,t){return{page:bt(),userId:t.userId,release:t.release,environment:t.environment,device:ft(e)}}function vt(e,t,i){const r=gt(t,i);return"promiseError"===e.errorType?u(l({type:"unhandledrejection",level:"ERROR",message:e.message,stack:e.stack},r),{device:u(l({},r.device),{selector:e.selector,filename:e.filename,position:e.position,errorType:e.errorType})}):u(l({type:"error",level:"ERROR",message:e.message,stack:e.stack},r),{device:u(l({},r.device),{selector:e.selector,isWhiteScreen:e.isWhiteScreen,filename:e.filename,position:e.position,errorType:e.errorType})})}function yt(e,t,i){const r=gt(t,i);return u(l({type:"paint",level:"INFO",message:"paint metrics"},r),{device:u(l({},r.device),{FP:e.FP,FCP:e.FCP,FMP:e.FMP,LCP:e.LCP})})}function kt(e,t,i){const r=gt(t,i);return u(l({type:"timing",level:"INFO",message:"timing metrics"},r),{device:u(l({},r.device),{DOMContentLoadedTime:e.DOMContentLoadedTime,loadTime:e.loadTime})})}function xt(e,t,i){const r=gt(t,i);return u(l({type:"longTask",level:e.duration>=100?"WARN":"INFO",message:`long task ${e.duration}ms`},r),{device:u(l({},r.device),{startTime:e.startTime,duration:e.duration,selector:e.selector,eventType:e.eventType})})}function Tt(e,t,i){var r,o,n;if(!1!==e.success)return null;const s=String(null!=(r=e.url)?r:""),a=String(null!=(o=e.method)?o:"GET").toUpperCase(),c=null!=(n=e.status)?n:0,d=0===c?"network":String(c),h=gt(t,i);return u(l({type:"request",level:"ERROR",message:`Request failed [${d}]: ${a} ${s}`},h),{device:u(l({},h.device),{durationMs:e.duration,msg:e.msg})})}function St(e,t,i){if("error"===e.type)return[vt(e,t,i)];if("paint"===e.type)return[yt(e,t,i)];if("timing"===e.type)return[kt(e,t,i)];if("longTask"===e.type)return[xt(e,t,i)];if("batchXHR"===e.type)return function(e,t,i){return e.requests.map(e=>Tt(e,t,i)).filter(e=>null!=e)}(e,t,i);if("xhr"===e.type||"fetch"===e.type){const r=Tt(e,t,i);return r?[r]:[]}return[]}function Ct(){window.addEventListener("error",e=>{const t=e.target;if(t&&(t.src||t.href))return;const i=g(),r=function(){const e=["html","body","#root"];let t=0;function i(i){const r=function(e){let t;return t=e.id?`#${e.id}`:e.className&&"string"==typeof e.className?"."+e.className.split(" ").filter(e=>!!e).join("."):e.nodeName.toLowerCase(),t}(i);e.indexOf(r)>-1&&t++}for(let r=1;r<=9;r++){const e=document.elementFromPoint(window.innerWidth/10*r,window.innerHeight/2),t=document.elementFromPoint(window.innerWidth/2,window.innerHeight/10*r);i(e),i(t)}return 18===t}(),o={type:"error",errorType:"jsError",message:e.message,filename:e.filename,position:`${e.lineno}:${e.colno}`,stack:mt(e.error.stack),selector:i?wt():"",isWhiteScreen:r};this.send(o)},!0),window.addEventListener("unhandledrejection",e=>{const t=g();let i;const r=e.reason;let o,n=0,s=0,a="";if("string"==typeof e.reason)i=r;else if("object"==typeof r&&(i=r.message,r.stack)){const e=r.stack.match(/at\s+(.+):(\d+):(\d+)/);o=e[1],n=e[2],s=e[3],a=mt(r.stack)}const l={type:"error",errorType:"promiseError",message:i,filename:o,position:`${n}:${s}`,stack:a,selector:t?wt():""};this.send(l)},!0)}function Ot(){if(PerformanceObserver){new PerformanceObserver(e=>{e.getEntries().forEach(e=>{if(e.duration>100){const t=g(),i={type:"longTask",startTime:e.startTime,duration:e.duration,selector:t?wt():"",eventType:null==t?void 0:t.type};this.send(i)}})}).observe({entryTypes:["longtask"]})}}function Rt(e,t){if("undefined"==typeof PerformanceObserver)return null;try{const i=new PerformanceObserver(e=>{t(e.getEntries())});return i.observe({type:e,buffered:!0}),i}catch(i){return null}}function Et(){if("undefined"==typeof PerformanceObserver)return;let e=null,t=null,i=null,r=null;const o=Rt("paint",i=>{for(const r of i)"first-paint"===r.name?e=r:"first-contentful-paint"===r.name&&(t=r)}),n=Rt("element",e=>{e.length>0&&(i=e[0],null==n||n.disconnect())}),s=Rt("largest-contentful-paint",e=>{e.length>0&&(r=e[e.length-1])}),a=()=>{setTimeout(()=>{null==s||s.disconnect(),null==o||o.disconnect(),null==n||n.disconnect();const a={type:"paint",FP:null==e?void 0:e.startTime,FCP:null==t?void 0:t.startTime,FMP:null==i?void 0:i.startTime,LCP:null==r?void 0:r.startTime};this.send(a)},3e3)};"complete"!==document.readyState?window.addEventListener("load",a):a()}function qt(){let e=0,t=0;if(performance.getEntriesByType){const i=performance.getEntriesByType("navigation");if(i.length>0){const r=i[0],{domContentLoadedEventStart:o,loadEventStart:n,fetchStart:s}=r;e=o-s,t=n-s}}else{const{fetchStart:i,domContentLoadedEventStart:r,loadEventStart:o}=performance.timing;e=r-i,t=o-i}const i={type:"timing",DOMContentLoadedTime:e,loadTime:t};this.send(i)}function Pt(){const e=()=>qt.call(this);"complete"!==document.readyState?window.addEventListener("load",e):e()}function jt(){const e=window.XMLHttpRequest,t=this;window.XMLHttpRequest=function(){const i=new e,r=i.open,o=i.send;let n,s,a;return i.open=function(e,t,...i){return s=t,a=e,r.apply(this,[e,t,...i])},i.send=function(){return n=(new Date).getTime(),i.addEventListener("error",function(){const e=(new Date).getTime()-n,r=i.status,o=String(null!=s?s:"");t.endpoint&&o===t.endpoint||t.captureRequest({type:"xhr",url:s,method:a||"GET",duration:e,status:r||0,success:!1,msg:`XHR请求错误: ${s}`,startTime:(new Date).getTime()})}),i.addEventListener("timeout",function(){const e=(new Date).getTime()-n,r=i.status,o=String(null!=s?s:"");t.endpoint&&o===t.endpoint||t.captureRequest({type:"xhr",url:s,method:a||"GET",msg:"XHR请求超时",duration:e,status:r||0,success:!1,startTime:(new Date).getTime()})}),o.apply(this,arguments)},i}}const Mt={bufferSeconds:60,maxUploadsPerSession:10,minUploadIntervalMs:3e4,maxReplayBytes:2097152};class It{constructor(e){c(this,"segments",[]),c(this,"stopFn",null),c(this,"starting",!1),c(this,"lastUploadAt",0),c(this,"uploadCount",0),this.opts=e}start(){return d(this,null,function*(){var e,t,i;if(!this.stopFn&&!this.starting){this.starting=!0;try{const{record:r}=yield import("rrweb");this.stopFn=null!=(i=r({emit:(e,t)=>{for((t||0===this.segments.length)&&this.segments.push([]),this.segments[this.segments.length-1].push(e);this.segments.length>2;)this.segments.shift()},checkoutEveryNms:Math.max(500*(null!=(e=this.opts.bufferSeconds)?e:Mt.bufferSeconds),1e4),maskAllInputs:!0,maskTextClass:null!=(t=this.opts.maskTextClass)?t:"rr-mask",blockClass:"rr-block",sampling:{mousemove:50,scroll:150,input:"last"}}))?i:null}catch(r){}}})}captureIfTriggered(e){var t,i,r;if(!this.isTrigger(e))return;const o=Date.now();if(o-this.lastUploadAt<(null!=(t=this.opts.minUploadIntervalMs)?t:Mt.minUploadIntervalMs))return;if(this.uploadCount>=(null!=(i=this.opts.maxUploadsPerSession)?i:Mt.maxUploadsPerSession))return;const n=[].concat(...this.segments);if(0===n.length)return;const s=function(){const e=globalThis.crypto;if("function"==typeof(null==e?void 0:e.randomUUID))return e.randomUUID();if("function"==typeof(null==e?void 0:e.getRandomValues)){const t=new Uint8Array(16);return e.getRandomValues(t),Array.from(t,e=>e.toString(16).padStart(2,"0")).join("")}return Array.from({length:32},()=>Math.floor(16*Math.random()).toString(16)).join("")}();this.lastUploadAt=o,this.uploadCount++;const a=null!=(r=this.opts.maxReplayBytes)?r:Mt.maxReplayBytes,l=this.segments.length>1&&JSON.stringify(n).length>a?[...this.segments[this.segments.length-1]]:n;return this.compressAndUpload(s,l),s}stop(){var e;null==(e=this.stopFn)||e.call(this),this.stopFn=null}isTrigger(e){return"error"===e.type||!!this.opts.captureRequest&&("xhr"===e.type||"fetch"===e.type||"batchXHR"===e.type)}compressAndUpload(e,t){return d(this,null,function*(){try{const i=JSON.stringify(t),{deflate:r}=yield import("pako");yield function(e,t,i){return d(this,null,function*(){const r=yield fetch(e,{method:"POST",headers:{"content-type":"application/json","X-Project-Key":t},body:JSON.stringify(i)});if(!r.ok)throw Object.assign(new Error(`monitor: 回放上传失败 ${r.status}`),{statusCode:r.status})})}(this.opts.replayEndpoint,this.opts.projectKey,{replayId:e,format:"rrweb@2",codec:"deflate-base64",size:i.length,durationMs:t.length>1?t[t.length-1].timestamp-t[0].timestamp:0,occurredAt:(new Date).toISOString(),data:Ht(r(i))})}catch(i){}})}}function Ht(e){let t="";for(let i=0;i<e.length;i+=32768)t+=String.fromCharCode(...e.subarray(i,i+32768));return btoa(t)}e.ExcReporter=p,e.Monitor=class{constructor(e){var t,i;c(this,"endpoint"),c(this,"projectKey"),c(this,"timeoutDuration"),c(this,"errorQueue"),c(this,"requestQueue"),c(this,"maxQueueSize"),c(this,"sendTimer"),c(this,"reporter"),c(this,"replay",null),c(this,"options"),c(this,"originalXHR"),c(this,"originalFetch"),c(this,"originalOnerror"),this.options=e,this.endpoint=e.endpoint,this.projectKey=e.projectKey,this.timeoutDuration=null!=(t=e.timeoutDuration)?t:6e4,this.errorQueue=[],this.requestQueue=[],this.maxQueueSize=null!=(i=e.maxQueueSize)?i:10,this.sendTimer=null,this.reporter=w({endpoint:e.endpoint,projectKey:e.projectKey,release:e.release,environment:e.environment,maxBatch:e.maxBatch,flushInterval:e.flushInterval},m(e.endpoint)),this.init(),this.initReplay(),this.originalXHR=window.XMLHttpRequest,this.originalFetch=window.fetch,this.originalOnerror=window.onerror}init(){Ct.call(this),Ot.call(this),Et.call(this),Pt.call(this),jt.call(this)}initReplay(){var e,t;const i=this.options.replay;if(!(null==i?void 0:i.enabled))return;const r=null!=(e=i.sampleRate)?e:1;if(Math.random()>=r)return;const o=null!=(t=i.replayEndpoint)?t:function(e){const t=e.replace(/\/+$/,"");return t.endsWith("/report")?`${t.slice(0,-7)}/replay`:void 0}(this.endpoint);o&&(this.replay=new It({replayEndpoint:o,projectKey:this.projectKey,bufferSeconds:i.bufferSeconds,maxUploadsPerSession:i.maxUploadsPerSession,minUploadIntervalMs:i.minUploadIntervalMs,maxReplayBytes:i.maxReplayBytes,captureRequest:i.captureRequest,maskTextClass:i.maskTextClass}),this.replay.start())}send(e){var t;const i=St(e,{title:document.title,url:location.href,userAgent:navigator.userAgent,browser:`${ut.name} ${ut.version}`,device:`${ct.model} ${ct.vendor}`,os:`${dt.name} ${dt.version}`},this.options),r=null==(t=this.replay)?void 0:t.captureIfTriggered(e);if(r)for(const o of i)o.device=u(l({},o.device),{replayId:r});for(const o of i)this.reporter.capture(o)}capture(e){this.reporter.capture(e)}reportRequest(){0!==this.requestQueue.length&&(this.send({type:"batchXHR",requests:[...this.requestQueue]}),this.requestQueue=[])}reportError(){0!==this.errorQueue.length&&(this.send({type:"batchXHR",requests:[...this.errorQueue]}),this.errorQueue=[])}captureRequest(e){var t;if(!e.type||!["xhr","fetch"].includes(e.type))return;if(i=String(null!=(t=e.url)?t:""),(r=this.endpoint)&&String(i)===r)return;var i,r;const o=["url","method","duration","status","success","startTime"];for(const n of o)if(void 0===e[n])return;e.page=window.location.href,this.requestQueue.push(e),this.requestQueue.length>=this.maxQueueSize&&this.reportRequest()}sendQueuedData(){this.errorQueue.length>0&&this.reportError(),this.requestQueue.length>0&&this.reportRequest()}destroy(){var e;null==(e=this.replay)||e.stop(),this.sendQueuedData(),this.reporter.destroy(),window.XMLHttpRequest=this.originalXHR,window.fetch=this.originalFetch,window.onerror=this.originalOnerror,this.sendTimer&&(clearInterval(this.sendTimer),this.sendTimer=null),this.errorQueue=[],this.requestQueue=[]}},e.SDK_VERSION=h,e.createReporter=w,e.makeH5Transport=m,Object.defineProperty(e,Symbol.toStringTag,{value:"Module"})});
@@ -0,0 +1,26 @@
1
+ import type { MonitorTypeLog, ReplayOptions } from '../interface';
2
+ /** 由上报地址推导回放地址:末尾 /report 换成 /replay,匹配不到返回 undefined */
3
+ export declare function deriveReplayEndpoint(endpoint: string): string | undefined;
4
+ /** 运行时回放配置(ReplayOptions 去掉采样/开关后传入) */
5
+ export interface ReplayRuntimeOptions extends Pick<ReplayOptions, 'bufferSeconds' | 'maxUploadsPerSession' | 'minUploadIntervalMs' | 'maxReplayBytes' | 'captureRequest' | 'maskTextClass'> {
6
+ replayEndpoint: string;
7
+ projectKey: string;
8
+ }
9
+ export declare class ReplayController {
10
+ private readonly opts;
11
+ /** 每个 segment 以一份完整 DOM 快照开头 */
12
+ private segments;
13
+ private stopFn;
14
+ private starting;
15
+ private lastUploadAt;
16
+ private uploadCount;
17
+ constructor(opts: ReplayRuntimeOptions);
18
+ /** 动态加载 rrweb 并开始录制;加载失败静默降级(错误上报不受影响) */
19
+ start(): Promise<void>;
20
+ /** 出错时由 Monitor.send 调用:命中触发条件且限流通过 → 同步返回 replayId,异步上传 */
21
+ captureIfTriggered(data: MonitorTypeLog): string | undefined;
22
+ stop(): void;
23
+ /** error / unhandledrejection 触发;request 失败按配置开启(batchXHR 内均为失败请求) */
24
+ private isTrigger;
25
+ private compressAndUpload;
26
+ }
@@ -0,0 +1,158 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.ReplayController = void 0;
4
+ exports.deriveReplayEndpoint = deriveReplayEndpoint;
5
+ const uuid_1 = require("../utils/uuid");
6
+ const upload_1 = require("./upload");
7
+ /** 环形缓冲保留的 segment 数:2 个 × (bufferSeconds/2) 的快照间隔 ⇒ 覆盖 bufferSeconds/2 ~ bufferSeconds */
8
+ const MAX_SEGMENTS = 2;
9
+ const DEFAULTS = {
10
+ bufferSeconds: 60,
11
+ maxUploadsPerSession: 10,
12
+ minUploadIntervalMs: 30000,
13
+ maxReplayBytes: 2 * 1024 * 1024,
14
+ };
15
+ /** 由上报地址推导回放地址:末尾 /report 换成 /replay,匹配不到返回 undefined */
16
+ function deriveReplayEndpoint(endpoint) {
17
+ const trimmed = endpoint.replace(/\/+$/, '');
18
+ return trimmed.endsWith('/report')
19
+ ? `${trimmed.slice(0, -'/report'.length)}/replay`
20
+ : undefined;
21
+ }
22
+ class ReplayController {
23
+ constructor(opts) {
24
+ Object.defineProperty(this, "opts", {
25
+ enumerable: true,
26
+ configurable: true,
27
+ writable: true,
28
+ value: opts
29
+ });
30
+ /** 每个 segment 以一份完整 DOM 快照开头 */
31
+ Object.defineProperty(this, "segments", {
32
+ enumerable: true,
33
+ configurable: true,
34
+ writable: true,
35
+ value: []
36
+ });
37
+ Object.defineProperty(this, "stopFn", {
38
+ enumerable: true,
39
+ configurable: true,
40
+ writable: true,
41
+ value: null
42
+ });
43
+ Object.defineProperty(this, "starting", {
44
+ enumerable: true,
45
+ configurable: true,
46
+ writable: true,
47
+ value: false
48
+ });
49
+ Object.defineProperty(this, "lastUploadAt", {
50
+ enumerable: true,
51
+ configurable: true,
52
+ writable: true,
53
+ value: 0
54
+ });
55
+ Object.defineProperty(this, "uploadCount", {
56
+ enumerable: true,
57
+ configurable: true,
58
+ writable: true,
59
+ value: 0
60
+ });
61
+ }
62
+ /** 动态加载 rrweb 并开始录制;加载失败静默降级(错误上报不受影响) */
63
+ async start() {
64
+ var _a, _b, _c;
65
+ if (this.stopFn || this.starting)
66
+ return;
67
+ this.starting = true;
68
+ try {
69
+ const { record } = await import('rrweb');
70
+ this.stopFn = (_c = record({
71
+ emit: (event, isCheckout) => {
72
+ // 首个事件或 checkout 事件开启新 segment(首个事件即初始完整快照)
73
+ if (isCheckout || this.segments.length === 0)
74
+ this.segments.push([]);
75
+ this.segments[this.segments.length - 1].push(event);
76
+ while (this.segments.length > MAX_SEGMENTS)
77
+ this.segments.shift();
78
+ },
79
+ // 快照间隔 = bufferSeconds/2,配合保留 2 个 segment 实现环形覆盖
80
+ checkoutEveryNms: Math.max(((_a = this.opts.bufferSeconds) !== null && _a !== void 0 ? _a : DEFAULTS.bufferSeconds) * 500, 10000),
81
+ // 隐私默认:输入值全脱敏;.rr-mask 脱敏文本、.rr-block 整块打码(均可按需加到业务元素上)
82
+ maskAllInputs: true,
83
+ maskTextClass: (_b = this.opts.maskTextClass) !== null && _b !== void 0 ? _b : 'rr-mask',
84
+ blockClass: 'rr-block',
85
+ sampling: { mousemove: 50, scroll: 150, input: 'last' },
86
+ })) !== null && _c !== void 0 ? _c : null;
87
+ }
88
+ catch (err) {
89
+ console.warn('monitor: rrweb 加载失败,回放不可用(错误上报不受影响)', err);
90
+ }
91
+ }
92
+ /** 出错时由 Monitor.send 调用:命中触发条件且限流通过 → 同步返回 replayId,异步上传 */
93
+ captureIfTriggered(data) {
94
+ var _a, _b, _c;
95
+ if (!this.isTrigger(data))
96
+ return undefined;
97
+ const now = Date.now();
98
+ if (now - this.lastUploadAt < ((_a = this.opts.minUploadIntervalMs) !== null && _a !== void 0 ? _a : DEFAULTS.minUploadIntervalMs))
99
+ return undefined;
100
+ if (this.uploadCount >= ((_b = this.opts.maxUploadsPerSession) !== null && _b !== void 0 ? _b : DEFAULTS.maxUploadsPerSession))
101
+ return undefined;
102
+ const all = [].concat(...this.segments);
103
+ if (all.length === 0)
104
+ return undefined;
105
+ const replayId = (0, uuid_1.randomId)();
106
+ this.lastUploadAt = now;
107
+ this.uploadCount++;
108
+ // 体积超限只保留最新 segment(自带完整快照,仍可播放)
109
+ const maxBytes = (_c = this.opts.maxReplayBytes) !== null && _c !== void 0 ? _c : DEFAULTS.maxReplayBytes;
110
+ const events = this.segments.length > 1 && JSON.stringify(all).length > maxBytes
111
+ ? [...this.segments[this.segments.length - 1]]
112
+ : all;
113
+ void this.compressAndUpload(replayId, events);
114
+ return replayId;
115
+ }
116
+ stop() {
117
+ var _a;
118
+ (_a = this.stopFn) === null || _a === void 0 ? void 0 : _a.call(this);
119
+ this.stopFn = null;
120
+ }
121
+ /** error / unhandledrejection 触发;request 失败按配置开启(batchXHR 内均为失败请求) */
122
+ isTrigger(data) {
123
+ if (data.type === 'error')
124
+ return true;
125
+ if (!this.opts.captureRequest)
126
+ return false;
127
+ return data.type === 'xhr' || data.type === 'fetch' || data.type === 'batchXHR';
128
+ }
129
+ async compressAndUpload(replayId, events) {
130
+ try {
131
+ const json = JSON.stringify(events);
132
+ const { deflate } = await import('pako');
133
+ await (0, upload_1.uploadReplay)(this.opts.replayEndpoint, this.opts.projectKey, {
134
+ replayId,
135
+ format: 'rrweb@2',
136
+ codec: 'deflate-base64',
137
+ size: json.length,
138
+ durationMs: events.length > 1
139
+ ? events[events.length - 1].timestamp - events[0].timestamp
140
+ : 0,
141
+ occurredAt: new Date().toISOString(),
142
+ data: toBase64(deflate(json)),
143
+ });
144
+ }
145
+ catch (_a) {
146
+ // 回放是可丢数据:失败静默,不重试、不进队列
147
+ }
148
+ }
149
+ }
150
+ exports.ReplayController = ReplayController;
151
+ /** Uint8Array → base64(分块拼接避免 btoa 单次参数超限) */
152
+ function toBase64(bytes) {
153
+ let binary = '';
154
+ const CHUNK = 0x8000;
155
+ for (let i = 0; i < bytes.length; i += CHUNK)
156
+ binary += String.fromCharCode(...bytes.subarray(i, i + CHUNK));
157
+ return btoa(binary);
158
+ }
@@ -0,0 +1,17 @@
1
+ /** 回放上传 payload(契约见 backend-integration.md「回放接口」) */
2
+ export interface ReplayUploadPayload {
3
+ replayId: string;
4
+ /** 事件流格式+版本,播放器按此选择解析方式 */
5
+ format: 'rrweb@2';
6
+ /** data 编码方式 */
7
+ codec: 'deflate-base64';
8
+ /** 解压前 JSON 字节数 */
9
+ size: number;
10
+ /** 回放覆盖时长(首末事件时间差 ms) */
11
+ durationMs: number;
12
+ occurredAt: string;
13
+ /** pako deflate + base64 后的 rrweb 事件流 */
14
+ data: string;
15
+ }
16
+ /** 回放独立上传:与事件上报共用鉴权头;失败由调用方静默处理(回放是可丢数据) */
17
+ export declare function uploadReplay(replayEndpoint: string, projectKey: string, payload: ReplayUploadPayload): Promise<void>;
@@ -0,0 +1,13 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.uploadReplay = uploadReplay;
4
+ /** 回放独立上传:与事件上报共用鉴权头;失败由调用方静默处理(回放是可丢数据) */
5
+ async function uploadReplay(replayEndpoint, projectKey, payload) {
6
+ const res = await fetch(replayEndpoint, {
7
+ method: 'POST',
8
+ headers: { 'content-type': 'application/json', 'X-Project-Key': projectKey },
9
+ body: JSON.stringify(payload),
10
+ });
11
+ if (!res.ok)
12
+ throw Object.assign(new Error(`monitor: 回放上传失败 ${res.status}`), { statusCode: res.status });
13
+ }
@@ -4,4 +4,5 @@ export { default as getSelector } from './getSelector';
4
4
  export { default as checkWhiteScreen } from './checkWhiteScreen';
5
5
  export { default as parseQueryString } from './parseQueryString';
6
6
  export { default as formatStack } from './formatStack';
7
+ export { randomId } from './uuid';
7
8
  export { toExcEvents, isExceptionReportUrl, mapRequestLog } from './toExcEvent';
@@ -3,7 +3,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
3
3
  return (mod && mod.__esModule) ? mod : { "default": mod };
4
4
  };
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
- exports.mapRequestLog = exports.isExceptionReportUrl = exports.toExcEvents = exports.formatStack = exports.parseQueryString = exports.checkWhiteScreen = exports.getSelector = exports.getLogBaseData = exports.getLastEvent = void 0;
6
+ exports.mapRequestLog = exports.isExceptionReportUrl = exports.toExcEvents = exports.randomId = exports.formatStack = exports.parseQueryString = exports.checkWhiteScreen = exports.getSelector = exports.getLogBaseData = exports.getLastEvent = void 0;
7
7
  var getLastEvent_1 = require("./getLastEvent");
8
8
  Object.defineProperty(exports, "getLastEvent", { enumerable: true, get: function () { return __importDefault(getLastEvent_1).default; } });
9
9
  var getLogBaseData_1 = require("./getLogBaseData");
@@ -16,6 +16,8 @@ var parseQueryString_1 = require("./parseQueryString");
16
16
  Object.defineProperty(exports, "parseQueryString", { enumerable: true, get: function () { return __importDefault(parseQueryString_1).default; } });
17
17
  var formatStack_1 = require("./formatStack");
18
18
  Object.defineProperty(exports, "formatStack", { enumerable: true, get: function () { return __importDefault(formatStack_1).default; } });
19
+ var uuid_1 = require("./uuid");
20
+ Object.defineProperty(exports, "randomId", { enumerable: true, get: function () { return uuid_1.randomId; } });
19
21
  var toExcEvent_1 = require("./toExcEvent");
20
22
  Object.defineProperty(exports, "toExcEvents", { enumerable: true, get: function () { return toExcEvent_1.toExcEvents; } });
21
23
  Object.defineProperty(exports, "isExceptionReportUrl", { enumerable: true, get: function () { return toExcEvent_1.isExceptionReportUrl; } });
@@ -32,7 +32,6 @@ function contextFields(base, opts) {
32
32
  };
33
33
  }
34
34
  function mapErrorLog(log, base, opts) {
35
- var _a;
36
35
  const ctx = contextFields(base, opts);
37
36
  if (log.errorType === 'promiseError') {
38
37
  return {
@@ -44,16 +43,6 @@ function mapErrorLog(log, base, opts) {
44
43
  device: { ...ctx.device, selector: log.selector, filename: log.filename, position: log.position, errorType: log.errorType },
45
44
  };
46
45
  }
47
- if (log.errorType === 'loadResourceError') {
48
- const url = (_a = log.filename) !== null && _a !== void 0 ? _a : log.message;
49
- return {
50
- type: 'resource',
51
- level: 'ERROR',
52
- message: url ? `Resource failed: ${url}` : log.message,
53
- ...ctx,
54
- device: { ...ctx.device, tagName: log.tagName, selector: log.selector, errorType: log.errorType },
55
- };
56
- }
57
46
  return {
58
47
  type: 'error',
59
48
  level: 'ERROR',
@@ -0,0 +1,2 @@
1
+ /** 生成关联用随机 id:优先 crypto.randomUUID,非安全上下文(http)降级为 getRandomValues 拼十六进制 */
2
+ export declare function randomId(): string;
@@ -0,0 +1,17 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.randomId = randomId;
4
+ /** 生成关联用随机 id:优先 crypto.randomUUID,非安全上下文(http)降级为 getRandomValues 拼十六进制 */
5
+ function randomId() {
6
+ const cryptoApi = globalThis.crypto;
7
+ if (typeof (cryptoApi === null || cryptoApi === void 0 ? void 0 : cryptoApi.randomUUID) === 'function')
8
+ return cryptoApi.randomUUID();
9
+ // randomUUID 仅安全上下文(HTTPS)可用;getRandomValues 在 http 下依然可用
10
+ if (typeof (cryptoApi === null || cryptoApi === void 0 ? void 0 : cryptoApi.getRandomValues) === 'function') {
11
+ const bytes = new Uint8Array(16);
12
+ cryptoApi.getRandomValues(bytes);
13
+ return Array.from(bytes, b => b.toString(16).padStart(2, '0')).join('');
14
+ }
15
+ // 极老环境兜底:仅作关联键用途,非安全场景
16
+ return Array.from({ length: 32 }, () => Math.floor(Math.random() * 16).toString(16)).join('');
17
+ }
package/package.json CHANGED
@@ -1,62 +1,65 @@
1
- {
2
- "name": "@qiu_jun/monitors",
3
- "version": "0.0.6",
4
- "description": "前端监控,用于捕获,分析,和报告网站或应用程序中的异常,错误和性能问题的方法",
5
- "sideEffects": false,
6
- "main": "dist/index.js",
7
- "types": "dist/index.d.ts",
8
- "exports": {
9
- ".": {
10
- "types": "./dist/index.d.ts",
11
- "import": "./dist/index.js",
12
- "require": "./dist/monitor.umd.js",
13
- "default": "./dist/index.js"
14
- },
15
- "./h5": {
16
- "types": "./dist/h5.d.ts",
17
- "default": "./dist/h5.js"
18
- },
19
- "./miniprogram": {
20
- "types": "./dist/miniprogram.d.ts",
21
- "default": "./dist/miniprogram.js"
22
- },
23
- "./reporter": {
24
- "types": "./dist/reporter.d.ts",
25
- "default": "./dist/reporter.js"
26
- }
27
- },
28
- "files": [
29
- "dist"
30
- ],
31
- "scripts": {
32
- "preinstall": "npx only-allow pnpm",
33
- "build": "pnpm run clean && pnpm run compile && pnpm run bundle",
34
- "prepublishOnly": "pnpm run build",
35
- "clean": "rimraf dist",
36
- "compile": "tsc -p tsconfig.build.json",
37
- "bundle": "vite build"
38
- },
39
- "publishConfig": {
40
- "access": "public",
41
- "registry": "https://registry.npmjs.org/"
42
- },
43
- "repository": {
44
- "type": "git",
45
- "url": "git+https://github.com/Qiu-Jun/monitor.git"
46
- },
47
- "author": "June",
48
- "license": "ISC",
49
- "bugs": {
50
- "url": "https://github.com/Qiu-Jun/monitor/issues"
51
- },
52
- "homepage": "https://github.com/Qiu-Jun/monitor#readme",
53
- "devDependencies": {
54
- "rimraf": "^6.0.1",
55
- "terser": "^5.43.1",
56
- "typescript": "~6.0.3",
57
- "vite": "^6.2.0"
58
- },
59
- "dependencies": {
60
- "ua-parser-js": "^2.0.4"
61
- }
62
- }
1
+ {
2
+ "name": "@qiu_jun/monitors",
3
+ "version": "0.0.7",
4
+ "description": "前端监控,用于捕获,分析,和报告网站或应用程序中的异常,错误和性能问题的方法",
5
+ "sideEffects": false,
6
+ "main": "dist/index.js",
7
+ "types": "dist/index.d.ts",
8
+ "exports": {
9
+ ".": {
10
+ "types": "./dist/index.d.ts",
11
+ "import": "./dist/index.js",
12
+ "require": "./dist/monitor.umd.js",
13
+ "default": "./dist/index.js"
14
+ },
15
+ "./h5": {
16
+ "types": "./dist/h5.d.ts",
17
+ "default": "./dist/h5.js"
18
+ },
19
+ "./miniprogram": {
20
+ "types": "./dist/miniprogram.d.ts",
21
+ "default": "./dist/miniprogram.js"
22
+ },
23
+ "./reporter": {
24
+ "types": "./dist/reporter.d.ts",
25
+ "default": "./dist/reporter.js"
26
+ }
27
+ },
28
+ "files": [
29
+ "dist"
30
+ ],
31
+ "scripts": {
32
+ "preinstall": "npx only-allow pnpm",
33
+ "build": "pnpm run clean && pnpm run compile && pnpm run bundle",
34
+ "prepublishOnly": "pnpm run build",
35
+ "clean": "rimraf dist",
36
+ "compile": "tsc -p tsconfig.build.json",
37
+ "bundle": "vite build"
38
+ },
39
+ "publishConfig": {
40
+ "access": "public",
41
+ "registry": "https://registry.npmjs.org/"
42
+ },
43
+ "repository": {
44
+ "type": "git",
45
+ "url": "git+https://github.com/Qiu-Jun/monitor.git"
46
+ },
47
+ "author": "June",
48
+ "license": "ISC",
49
+ "bugs": {
50
+ "url": "https://github.com/Qiu-Jun/monitor/issues"
51
+ },
52
+ "homepage": "https://github.com/Qiu-Jun/monitor#readme",
53
+ "devDependencies": {
54
+ "@types/pako": "^3.0.0",
55
+ "rimraf": "^6.0.1",
56
+ "terser": "^5.43.1",
57
+ "typescript": "~6.0.3",
58
+ "vite": "^6.2.0"
59
+ },
60
+ "dependencies": {
61
+ "pako": "^3.0.2",
62
+ "rrweb": "^2.1.7",
63
+ "ua-parser-js": "^2.0.4"
64
+ }
65
+ }