@qiu_jun/monitors 0.0.6 → 0.0.8

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/monitor.js CHANGED
@@ -1,176 +1,171 @@
1
1
  "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- const exception_1 = require("./exception");
4
- const modules_1 = require("./modules");
5
- const index_1 = require("./utils/index");
6
- const toExcEvent_1 = require("./utils/toExcEvent");
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: !0
5
+ });
6
+
7
+ const exception_1 = require("./exception"), modules_1 = require("./modules"), index_1 = require("./utils/index"), toExcEvent_1 = require("./utils/toExcEvent"), replay_1 = require("./replay");
8
+
7
9
  class Monitor {
8
- constructor(options) {
9
- var _a, _b;
10
- /** 异常平台上报地址 */
11
- Object.defineProperty(this, "endpoint", {
12
- enumerable: true,
13
- configurable: true,
14
- writable: true,
15
- value: void 0
16
- });
17
- /** 接入项目 projectKey */
18
- Object.defineProperty(this, "projectKey", {
19
- enumerable: true,
20
- configurable: true,
21
- writable: true,
22
- value: void 0
23
- });
24
- Object.defineProperty(this, "timeoutDuration", {
25
- enumerable: true,
26
- configurable: true,
27
- writable: true,
28
- value: void 0
29
- });
30
- Object.defineProperty(this, "errorQueue", {
31
- enumerable: true,
32
- configurable: true,
33
- writable: true,
34
- value: void 0
35
- });
36
- Object.defineProperty(this, "requestQueue", {
37
- enumerable: true,
38
- configurable: true,
39
- writable: true,
40
- value: void 0
41
- });
42
- Object.defineProperty(this, "maxQueueSize", {
43
- enumerable: true,
44
- configurable: true,
45
- writable: true,
46
- value: void 0
47
- });
48
- Object.defineProperty(this, "sendTimer", {
49
- enumerable: true,
50
- configurable: true,
51
- writable: true,
52
- value: void 0
53
- });
54
- Object.defineProperty(this, "reporter", {
55
- enumerable: true,
56
- configurable: true,
57
- writable: true,
58
- value: void 0
59
- });
60
- Object.defineProperty(this, "options", {
61
- enumerable: true,
62
- configurable: true,
63
- writable: true,
64
- value: void 0
65
- });
66
- Object.defineProperty(this, "originalXHR", {
67
- enumerable: true,
68
- configurable: true,
69
- writable: true,
70
- value: void 0
71
- });
72
- Object.defineProperty(this, "originalFetch", {
73
- enumerable: true,
74
- configurable: true,
75
- writable: true,
76
- value: void 0
77
- });
78
- Object.defineProperty(this, "originalOnerror", {
79
- enumerable: true,
80
- configurable: true,
81
- writable: true,
82
- value: void 0
83
- });
84
- this.options = options;
85
- this.endpoint = options.endpoint;
86
- this.projectKey = options.projectKey;
87
- this.timeoutDuration = (_a = options.timeoutDuration) !== null && _a !== void 0 ? _a : 60000;
88
- this.errorQueue = [];
89
- this.requestQueue = [];
90
- this.maxQueueSize = (_b = options.maxQueueSize) !== null && _b !== void 0 ? _b : 10;
91
- this.sendTimer = null;
92
- this.reporter = (0, exception_1.createReporter)({
93
- endpoint: options.endpoint,
94
- projectKey: options.projectKey,
95
- release: options.release,
96
- environment: options.environment,
97
- maxBatch: options.maxBatch,
98
- flushInterval: options.flushInterval,
99
- }, (0, exception_1.makeH5Transport)(options.endpoint));
100
- this.init();
101
- this.originalXHR = window.XMLHttpRequest;
102
- this.originalFetch = window.fetch;
103
- this.originalOnerror = window.onerror;
104
- }
105
- init() {
106
- modules_1.onWindowErr.call(this);
107
- modules_1.onLongTask.call(this);
108
- modules_1.onPaint.call(this);
109
- modules_1.onTiming.call(this);
110
- modules_1.onXHR.call(this);
111
- }
112
- /** 统一上报:转异常平台格式 → reporter 批量 POST */
113
- send(data) {
114
- const baseData = (0, index_1.getLogBaseData)();
115
- const events = (0, toExcEvent_1.toExcEvents)(data, baseData, this.options);
116
- for (const event of events)
117
- this.reporter.capture(event);
118
- }
119
- /** 手动上报自定义事件 */
120
- capture(event) {
121
- this.reporter.capture(event);
122
- }
123
- reportRequest() {
124
- if (this.requestQueue.length === 0)
125
- return;
126
- this.send({ type: 'batchXHR', requests: [...this.requestQueue] });
127
- this.requestQueue = [];
128
- }
129
- reportError() {
130
- if (this.errorQueue.length === 0)
131
- return;
132
- this.send({ type: 'batchXHR', requests: [...this.errorQueue] });
133
- this.errorQueue = [];
134
- }
135
- captureRequest(requestInfo) {
136
- var _a;
137
- const validRequestTypes = ['xhr', 'fetch'];
138
- if (!requestInfo.type || !validRequestTypes.includes(requestInfo.type)) {
139
- console.warn(`监控系统: 无效的请求类型 ${requestInfo.type},无法上报`);
140
- return;
141
- }
142
- if ((0, toExcEvent_1.isExceptionReportUrl)(String((_a = requestInfo.url) !== null && _a !== void 0 ? _a : ''), this.endpoint))
143
- return;
144
- const requiredFields = ['url', 'method', 'duration', 'status', 'success', 'startTime'];
145
- for (const field of requiredFields) {
146
- if (requestInfo[field] === undefined) {
147
- console.warn(`监控系统: 请求信息中缺少必填字段 ${field},无法上报`);
148
- return;
149
- }
150
- }
151
- requestInfo.page = window.location.href;
152
- this.requestQueue.push(requestInfo);
153
- if (this.requestQueue.length >= this.maxQueueSize)
154
- this.reportRequest();
155
- }
156
- sendQueuedData() {
157
- if (this.errorQueue.length > 0)
158
- this.reportError();
159
- if (this.requestQueue.length > 0)
160
- this.reportRequest();
161
- }
162
- destroy() {
163
- this.sendQueuedData();
164
- this.reporter.destroy();
165
- window.XMLHttpRequest = this.originalXHR;
166
- window.fetch = this.originalFetch;
167
- window.onerror = this.originalOnerror;
168
- if (this.sendTimer) {
169
- clearInterval(this.sendTimer);
170
- this.sendTimer = null;
171
- }
172
- this.errorQueue = [];
173
- this.requestQueue = [];
174
- }
10
+ constructor(e) {
11
+ var t, r;
12
+ Object.defineProperty(this, "endpoint", {
13
+ enumerable: !0,
14
+ configurable: !0,
15
+ writable: !0,
16
+ value: void 0
17
+ }), Object.defineProperty(this, "projectKey", {
18
+ enumerable: !0,
19
+ configurable: !0,
20
+ writable: !0,
21
+ value: void 0
22
+ }), Object.defineProperty(this, "timeoutDuration", {
23
+ enumerable: !0,
24
+ configurable: !0,
25
+ writable: !0,
26
+ value: void 0
27
+ }), Object.defineProperty(this, "errorQueue", {
28
+ enumerable: !0,
29
+ configurable: !0,
30
+ writable: !0,
31
+ value: void 0
32
+ }), Object.defineProperty(this, "requestQueue", {
33
+ enumerable: !0,
34
+ configurable: !0,
35
+ writable: !0,
36
+ value: void 0
37
+ }), Object.defineProperty(this, "maxQueueSize", {
38
+ enumerable: !0,
39
+ configurable: !0,
40
+ writable: !0,
41
+ value: void 0
42
+ }), Object.defineProperty(this, "sendTimer", {
43
+ enumerable: !0,
44
+ configurable: !0,
45
+ writable: !0,
46
+ value: void 0
47
+ }), Object.defineProperty(this, "reporter", {
48
+ enumerable: !0,
49
+ configurable: !0,
50
+ writable: !0,
51
+ value: void 0
52
+ }), Object.defineProperty(this, "replay", {
53
+ enumerable: !0,
54
+ configurable: !0,
55
+ writable: !0,
56
+ value: null
57
+ }), Object.defineProperty(this, "options", {
58
+ enumerable: !0,
59
+ configurable: !0,
60
+ writable: !0,
61
+ value: void 0
62
+ }), Object.defineProperty(this, "errorSentAt", {
63
+ enumerable: !0,
64
+ configurable: !0,
65
+ writable: !0,
66
+ value: new Map
67
+ }), Object.defineProperty(this, "originalXHR", {
68
+ enumerable: !0,
69
+ configurable: !0,
70
+ writable: !0,
71
+ value: void 0
72
+ }), Object.defineProperty(this, "originalFetch", {
73
+ enumerable: !0,
74
+ configurable: !0,
75
+ writable: !0,
76
+ value: void 0
77
+ }), Object.defineProperty(this, "originalOnerror", {
78
+ enumerable: !0,
79
+ configurable: !0,
80
+ writable: !0,
81
+ value: void 0
82
+ }), this.options = e, this.endpoint = e.endpoint, this.projectKey = e.projectKey,
83
+ this.timeoutDuration = null !== (t = e.timeoutDuration) && void 0 !== t ? t : 6e4,
84
+ this.errorQueue = [], this.requestQueue = [], this.maxQueueSize = null !== (r = e.maxQueueSize) && void 0 !== r ? r : 10,
85
+ this.sendTimer = null, this.reporter = (0, exception_1.createReporter)({
86
+ endpoint: e.endpoint,
87
+ projectKey: e.projectKey,
88
+ release: e.release,
89
+ environment: e.environment,
90
+ maxBatch: e.maxBatch,
91
+ flushInterval: e.flushInterval
92
+ }, (0, exception_1.makeH5Transport)(e.endpoint)), this.init(), this.initReplay(),
93
+ this.originalXHR = window.XMLHttpRequest, this.originalFetch = window.fetch, this.originalOnerror = window.onerror;
94
+ }
95
+ init() {
96
+ modules_1.onWindowErr.call(this), modules_1.onLongTask.call(this), modules_1.onPaint.call(this),
97
+ modules_1.onTiming.call(this), modules_1.onXHR.call(this);
98
+ }
99
+ initReplay() {
100
+ var e, t;
101
+ const r = this.options.replay;
102
+ if (!(null == r ? void 0 : r.enabled)) return;
103
+ const i = null !== (e = r.sampleRate) && void 0 !== e ? e : 1;
104
+ if (Math.random() >= i) return;
105
+ const o = null !== (t = r.replayEndpoint) && void 0 !== t ? t : (0, replay_1.deriveReplayEndpoint)(this.endpoint);
106
+ o && (this.replay = new replay_1.ReplayController({
107
+ replayEndpoint: o,
108
+ projectKey: this.projectKey,
109
+ bufferSeconds: r.bufferSeconds,
110
+ maxUploadsPerSession: r.maxUploadsPerSession,
111
+ minUploadIntervalMs: r.minUploadIntervalMs,
112
+ maxReplayBytes: r.maxReplayBytes,
113
+ captureRequest: r.captureRequest,
114
+ maskTextClass: r.maskTextClass
115
+ }), this.replay.start());
116
+ }
117
+ isDuplicateError(e) {
118
+ var t, r;
119
+ const i = null !== (t = this.options.errorDedupeMs) && void 0 !== t ? t : 0;
120
+ if (i <= 0 || "error" !== e.type) return !1;
121
+ const o = `${e.errorType}|${e.message}|${null !== (r = e.filename) && void 0 !== r ? r : ""}`, n = Date.now(), s = this.errorSentAt.get(o);
122
+ if (void 0 !== s && n - s < i) return !0;
123
+ if (this.errorSentAt.size >= 100) for (const [e, t] of this.errorSentAt) n - t >= i && this.errorSentAt.delete(e);
124
+ return this.errorSentAt.set(o, n), !1;
125
+ }
126
+ send(e) {
127
+ var t;
128
+ if (this.isDuplicateError(e)) return;
129
+ const r = (0, index_1.getLogBaseData)(), i = (0, toExcEvent_1.toExcEvents)(e, r, this.options), o = null === (t = this.replay) || void 0 === t ? void 0 : t.captureIfTriggered(e);
130
+ if (o) for (const e of i) e.device = {
131
+ ...e.device,
132
+ replayId: o
133
+ };
134
+ for (const e of i) this.reporter.capture(e);
135
+ }
136
+ capture(e) {
137
+ this.reporter.capture(e);
138
+ }
139
+ reportRequest() {
140
+ 0 !== this.requestQueue.length && (this.send({
141
+ type: "batchXHR",
142
+ requests: [ ...this.requestQueue ]
143
+ }), this.requestQueue = []);
144
+ }
145
+ reportError() {
146
+ 0 !== this.errorQueue.length && (this.send({
147
+ type: "batchXHR",
148
+ requests: [ ...this.errorQueue ]
149
+ }), this.errorQueue = []);
150
+ }
151
+ captureRequest(e) {
152
+ var t;
153
+ if (!e.type || ![ "xhr", "fetch" ].includes(e.type)) return;
154
+ if ((0, toExcEvent_1.isExceptionReportUrl)(String(null !== (t = e.url) && void 0 !== t ? t : ""), this.endpoint)) return;
155
+ const r = [ "url", "method", "duration", "status", "success", "startTime" ];
156
+ for (const t of r) if (void 0 === e[t]) return;
157
+ e.page = window.location.href, this.requestQueue.push(e), this.requestQueue.length >= this.maxQueueSize && this.reportRequest();
158
+ }
159
+ sendQueuedData() {
160
+ this.errorQueue.length > 0 && this.reportError(), this.requestQueue.length > 0 && this.reportRequest();
161
+ }
162
+ destroy() {
163
+ var e;
164
+ null === (e = this.replay) || void 0 === e || e.stop(), this.sendQueuedData(), this.reporter.destroy(),
165
+ window.XMLHttpRequest = this.originalXHR, window.fetch = this.originalFetch, window.onerror = this.originalOnerror,
166
+ this.sendTimer && (clearInterval(this.sendTimer), this.sendTimer = null), this.errorQueue = [],
167
+ this.requestQueue = [], this.errorSentAt.clear();
168
+ }
175
169
  }
176
- exports.default = Monitor;
170
+
171
+ exports.default = Monitor;
@@ -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",A="type",I="vendor",H="version",$="architecture",U="major",_="model",F="console",L="mobile",z="tablet",N="smarttv",D="wearable",B="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,$,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",Ae="Opera",Ie="Facebook",He="Sogou",$e="Mobile ",Ue=" Browser",_e="Windows",Fe=typeof window!==C&&window.navigator?window.navigator:void 0,Le=Fe&&Fe.userAgentData?Fe.userAgentData:void 0,ze=function(e){for(var t={},i=0;i<e.length;i++)t[e[i].toUpperCase()]=e[i];return t},Ne=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!!Be(e)&&Qe(t)==Qe(e)},De=function(e,t){for(var i in e)return/^(browser|cpu|device|engine|os)$/.test(i)||!!t&&De(e[i])},Be=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 Be(e)?e.toLowerCase():e},Xe=function(e){return Be(e)?Ke(/[^\d\.]/g,e).split(".")[0]:void 0},We=function(e){return Be(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 Be(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(Ne(t[i][r],e))return"?"===i?void 0:i}else if(Ne(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],[H,[M,$e+"Chrome"]],[/webview.+edge\/([\w\.]+)/i],[H,[M,je+" WebView"],[A,Q]],[/edg(?:e|ios|a)?\/([\w\.]+)/i],[H,[M,"Edge"]],[/(opera mini)\/([-\w\.]+)/i,/(opera [mobiletab]{3,6})\b.+version\/([-\w\.]+)/i,/(opera)(?:.+version\/|[\/ ]+)([\w\.]+)/i],[M,H],[/opios[\/ ]+([\w\.]+)/i],[H,[M,Ae+" Mini"]],[/\bop(?:rg)?x\/([\w\.]+)/i],[H,[M,Ae+" GX"]],[/\bopr\/([\w\.]+)/i],[H,[M,Ae]],[/\bb[ai]*d(?:uhd|[ub]*[aekoprswx]{5,6})[\/ ]?([\w\.]+)/i],[H,[M,"Baidu"]],[/\b(?:mxbrowser|mxios|myie2)\/?([-\w\.]*)\b/i],[H,[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,H],[/quark(?:pc)?\/([-\w\.]+)/i],[H,[M,"Quark"]],[/\bddg\/([\w\.]+)/i],[H,[M,"DuckDuckGo"]],[/(?:\buc? ?browser|(?:juc.+)ucweb| ucpc)[\/ ]?([\w\.]+)/i],[H,[M,"UCBrowser"]],[/microm.+\bqbcore\/([\w\.]+)/i,/\bqbcore\/([\w\.]+).+microm/i,/micromessenger\/([\w\.]+)/i],[H,[M,"WeChat"]],[/konqueror\/([\w\.]+)/i],[H,[M,"Konqueror"]],[/trident.+rv[: ]([\w\.]{1,9})\b.+like gecko/i],[H,[M,"IE"]],[/ya(?:search)?browser\/([\w\.]+)/i],[H,[M,"Yandex"]],[/slbrowser\/([\w\.]+)/i],[H,[M,"Smart "+me+Ue]],[/(av(?:ast|g|ira))\/([\w\.]+)/i],[[M,/(.+)/,"$1 Secure"+Ue],H],[/norton\/([\w\.]+)/i],[H,[M,"Norton Private"+Ue]],[/\bfocus\/([\w\.]+)/i],[H,[M,Me+" Focus"]],[/ mms\/([\w\.]+)$/i],[H,[M,Ae+" Neon"]],[/ opt\/([\w\.]+)$/i],[H,[M,Ae+" Touch"]],[/coc_coc\w+\/([\w\.]+)/i],[H,[M,"Coc Coc"]],[/dolfin\/([\w\.]+)/i],[H,[M,"Dolphin"]],[/coast\/([\w\.]+)/i],[H,[M,Ae+" Coast"]],[/miuibrowser\/([\w\.]+)/i],[H,[M,"MIUI"+Ue]],[/fxios\/([\w\.-]+)/i],[H,[M,$e+Me]],[/\bqihoobrowser\/?([\w\.]*)/i],[H,[M,"360"]],[/\b(qq)\/([\w\.]+)/i],[[M,/(.+)/,"$1Browser"],H],[/(oculus|sailfish|huawei|vivo|pico)browser\/([\w\.]+)/i],[[M,/(.+)/,"$1"+Ue],H],[/ HBPC\/([\w\.]+)/],[H,[M,we+Ue]],[/samsungbrowser\/([\w\.]+)/i],[H,[M,Te+" Internet"]],[/metasr[\/ ]?([\d\.]+)/i],[H,[M,He+" Explorer"]],[/(sogou)mo\w+\/([\d\.]+)/i],[[M,He+" Mobile"],H],[/(electron)\/([\w\.]+) safari/i,/(tesla)(?: qtcarbrowser|\/(20\d\d\.[-\w\.]+))/i,/m?(qqbrowser|2345(?=browser|chrome|explorer))\w*[\/ ]?v?([\w\.]+)/i],[M,H],[/(lbbrowser|luakit|rekonq|steam(?= (clie|tenf|gameo)))/i],[M],[/ome\/([\w\.]+).+(iron(?= saf)|360(?=[es]e$))/i],[H,M],[/((?:fban\/fbios|fb_iab\/fb4a)(?!.+fbav)|;fbav\/([\w\.]+);)/i],[[M,Ie],H,[A,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,H,[A,Q]],[/\bgsa\/([\w\.]+) .*safari\//i],[H,[M,"GSA"],[A,Q]],[/(?:musical_ly|trill)(?:.+app_?version\/|_)([\w\.]+)/i],[H,[M,"TikTok"],[A,Q]],[/\[(linkedin)app\]/i],[M,[A,Q]],[/(zalo(?:app)?)[\/\sa-z]*([\w\.-]+)/i],[[M,/(.+)/,"Zalo"],H,[A,Q]],[/(chromium)[\/ ]([-\w\.]+)/i],[M,H],[/ome-(lighthouse)$/i],[M,[A,"fetcher"]],[/headlesschrome(?:\/([\w\.]+)| )/i],[H,[M,Ee+" Headless"]],[/wv\).+chrome\/([\w\.]+).+edgw\//i],[H,[M,je+" WebView2"],[A,Q]],[/; wv\).+(chrome)\/([\w\.]+)/i],[[M,Ee+" WebView"],H,[A,Q]],[/droid.+ version\/([\w\.]+)\b.+(?:mobile safari|safari)/i],[H,[M,"Android"+Ue]],[/chrome\/([\w\.]+) mobile/i],[H,[M,$e+"Chrome"]],[/(chrome|omniweb|arora|[tizenoka]{5} ?browser)\/v?([\w\.]+)/i],[M,H],[/version\/([\w\.\,]+) .*mobile(?:\/\w+ | ?)safari/i],[H,[M,$e+"Safari"]],[/iphone .*mobile(?:\/\w+ | ?)safari/i],[[M,$e+"Safari"]],[/version\/([\w\.\,]+) .*(safari)/i],[H,M],[/webkit.+?(mobile ?safari|safari)(\/[\w\.]+)/i],[M,[H,"1"]],[/(webkit|khtml)\/([\w\.]+)/i],[M,H],[/(?:mobile|tablet);.*(firefox)\/([\w\.-]+)/i],[[M,$e+Me],H],[/(navigator|netscape\d?)\/([-\w\.]+)/i],[[M,"Netscape"],H],[/(wolvic|librewolf)\/([\w\.]+)/i],[M,H],[/mobile vr; rv:([\w\.]+)\).+firefox/i],[H,[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,[H,/_/g,"."]],[/(cobalt)\/([\w\.]+)/i],[M,[H,/[^\d\.]+./,k]]],cpu:[[/\b((amd|x|x86[-_]?|wow|win)64)\b/i],[[$,"amd64"]],[/(ia32(?=;))/i,/\b((i[346]|x)86)(pc)?\b/i],[[$,"ia32"]],[/\b(aarch64|arm(v?[89]e?l?|_?64))\b/i],[[$,"arm64"]],[/\b(arm(v[67])?ht?n?[fl]p?)\b/i],[[$,"armhf"]],[/( (ce|mobile); ppc;|\/[\w\.]+arm\b)/i],[[$,"arm"]],[/ sun4\w[;\)]/i],[[$,"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],[[$,/ower/,k,Qe]],[/mc680.0/i],[[$,"68k"]],[/winnt.+\[axp/i],[[$,"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],[_,[I,Te],[A,z]],[/\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],[_,[I,Te],[A,L]],[/(?:\/|\()(ip(?:hone|od)[\w, ]*)[\/\);]/i],[_,[I,ce],[A,L]],[/\b(?:ios|apple\w+)\/.+[\(\/](ipad)/i,/\b(ipad)[\d,]*[;\] ].+(mac |i(pad)?)os/i],[_,[I,ce],[A,z]],[/(macintosh);/i],[_,[I,ce]],[/\b(sh-?[altvz]?\d\d[a-ekm]?)/i],[_,[I,Se],[A,L]],[/\b((?:brt|eln|hey2?|gdi|jdn)-a?[lnw]09|(?:ag[rm]3?|jdn2|kob2)-a?[lw]0[09]hn)(?: bui|\)|;)/i],[_,[I,be],[A,z]],[/honor([-\w ]+)[;\)]/i],[_,[I,be],[A,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],[_,[I,we],[A,z]],[/(?:huawei) ?([-\w ]+)[;\)]/i,/\b(nexus 6p|\w{2,4}e?-[atu]?[ln][\dx][\dc][adnt]?)\b(?!.+d\/s)/i],[_,[I,we],[A,L]],[/oid[^\)]+; (2[\dbc]{4}(182|283|rp\w{2})[cgl]|m2105k81a?c)(?: bui|\))/i,/\b(?:xiao)?((?:red)?mi[-_ ]?pad[\w- ]*)(?: bui|\))/i],[[_,/_/g," "],[I,Oe],[A,z]],[/\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," "],[I,Oe],[A,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],[_,[I,ke],[A,L]],[/; (\w+) bui.+ oppo/i,/\b(cph[12]\d{3}|p(?:af|c[al]|d\w|e[ar])[mt]\d0|x9007|a101op)\b/i],[_,[I,xe],[A,L]],[/\b(opd2(\d{3}a?))(?: bui|\))/i],[_,[I,Ze,{OnePlus:["203","304","403","404","413","415"],"*":xe}],[A,z]],[/(vivo (5r?|6|8l?|go|one|s|x[il]?[2-4]?)[\w\+ ]*)(?: bui|\))/i],[_,[I,"BLU"],[A,L]],[/; vivo (\w+)(?: bui|\))/i,/\b(v[12]\d{3}\w?[at])(?: bui|;)/i],[_,[I,"Vivo"],[A,L]],[/\b(rmx[1-3]\d{3})(?: bui|;|\))/i],[_,[I,"Realme"],[A,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],[_,[I,me],[A,z]],[/lenovo[-_ ]?([-\w ]+?)(?: bui|\)|\/)/i],[_,[I,me],[A,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],[_,[I,ve],[A,L]],[/\b(mz60\d|xoom[2 ]{0,2}) build\//i],[_,[I,ve],[A,z]],[/\b(?:lg)?([vl]k\-?\d{3}) bui| 3\.[-\w; ]{10}lg?-([06cv9]{3,4})/i],[_,[I,fe],[A,z]],[/(lm(?:-?f100[nv]?|-[\w\.]+)(?= bui|\))|nexus [45])/i,/\blg[-e;\/ ]+(?!.*(?:browser|netcast|android tv|watch|webos))(\w+)/i,/\blg-?([\d\w]+) bui/i],[_,[I,fe],[A,L]],[/(nokia) (t[12][01])/i],[I,_,[A,z]],[/(?:maemo|nokia).*(n900|lumia \d+|rm-\d+)/i,/nokia[-_ ]?(([-\w\. ]*?))( bui|\)|;|\/)/i],[[_,/_/g," "],[A,L],[I,"Nokia"]],[/(pixel (c|tablet))\b/i],[_,[I,pe],[A,z]],[/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],[_,[I,pe],[A,L]],[/(google) (pixelbook( go)?)/i],[I,_],[/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],[_,[I,Ce],[A,L]],[/sony tablet [ps]/i,/\b(?:sony)?sgp\w+(?: bui|\))/i],[[_,"Xperia Tablet"],[I,Ce],[A,z]],[/(alexa)webm/i,/(kf[a-z]{2}wi|aeo(?!bc)\w\w)( bui|\))/i,/(kf[a-z]+)( bui|\)).+silk\//i],[_,[I,ue],[A,z]],[/((?:sd|kf)[0349hijorstuw]+)( bui|\)).+silk\//i],[[_,/(.+)/g,"Fire Phone $1"],[I,ue],[A,L]],[/(playbook);[-\w\),; ]+(rim)/i],[_,I,[A,z]],[/\b((?:bb[a-f]|st[hv])100-\d)/i,/(?:blackberry|\(bb10;) (\w+)/i],[_,[I,he],[A,L]],[/(?:\b|asus_)(transfo[prime ]{4,10} \w+|eeepc|slider \w+|nexus 7|padfone|p00[cj])/i],[_,[I,de],[A,z]],[/ (z[bes]6[027][012][km][ls]|zenfone \d\w?)\b/i],[_,[I,de],[A,L]],[/(nexus 9)/i],[_,[I,"HTC"],[A,z]],[/(htc)[-;_ ]{1,2}([\w ]+(?=\)| bui)|\w+)/i,/(zte)[- ]([\w ]+?)(?: bui|\/|\))/i,/(alcatel|geeksphone|nexian|panasonic(?!(?:;|\.))|sony(?!-bra))[-_ ]?([-\w]*)/i],[I,[_,/_/g," "],[A,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],[_,[I,"TCL"],[A,z]],[/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],[_,[I,"TCL"],[A,L]],[/(itel) ((\w+))/i],[[I,Qe],_,[A,Ze,{tablet:["p10001l","w7001"],"*":"mobile"}]],[/droid.+; ([ab][1-7]-?[0178a]\d\d?)/i],[_,[I,"Acer"],[A,z]],[/droid.+; (m[1-5] note) bui/i,/\bmz-([-\w]{2,})/i],[_,[I,"Meizu"],[A,L]],[/; ((?:power )?armor(?:[\w ]{0,8}))(?: bui|\))/i],[_,[I,"Ulefone"],[A,L]],[/; (energy ?\w+)(?: bui|\))/i,/; energizer ([\w ]+)(?: bui|\))/i],[_,[I,"Energizer"],[A,L]],[/; cat (b35);/i,/; (b15q?|s22 flip|s48c|s62 pro)(?: bui|\))/i],[_,[I,"Cat"],[A,L]],[/((?:new )?andromax[\w- ]+)(?: bui|\))/i],[_,[I,"Smartfren"],[A,L]],[/droid.+; (a(in)?(0(15|59|6[35])|142)p?)/i],[_,[I,"Nothing"],[A,L]],[/; (x67 5g|tikeasy \w+|ac[1789]\d\w+)( b|\))/i,/archos ?(5|gamepad2?|([\w ]*[t1789]|hello) ?\d+[\w ]*)( b|\))/i],[_,[I,"Archos"],[A,z]],[/archos ([\w ]+)( b|\))/i,/; (ac[3-6]\d\w{2,8})( b|\))/i],[_,[I,"Archos"],[A,L]],[/blackview ([-\w ]+)( b|\))/i,/; (bv\d{4}[-\w ]*)( b|\))/i],[_,[I,"Blackview"],[A,L]],[/; (n159v)/i],[_,[I,"HMD"],[A,L]],[/((revvl[ \w\+]+|tm(?:rv|af)\w*[45]g(?:tb)?))( b|\))/i],[_,[A,function(e,t){return t.test.test(e)?t.ifTrue:t.ifFalse},{test:/ta?b/i,ifTrue:z,ifFalse:L}],[I,"T-Mobile"]],[/(imo) (tab \w+)/i,/(infinix|tecno) (x1101b?|p904|dp(7c|8d|10a)( pro)?|p70[1-3]a?|p904|t1101)/i],[I,_,[A,z]],[/(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],[I,_,[A,L]],[/(kobo)\s(ereader|touch)/i,/(hp).+(touchpad(?!.+tablet)|tablet)/i,/(kindle)\/([\w\.]+)/i],[I,_,[A,z]],[/(surface duo)/i],[_,[I,ge],[A,z]],[/droid [\d\.]+; (fp\du?)(?: b|\))/i],[_,[I,"Fairphone"],[A,L]],[/((?:tegranote|shield t(?!.+d tv))[\w- ]*?)(?: b|\))/i],[_,[I,ye],[A,z]],[/(sprint) (\w+)/i],[I,_,[A,L]],[/(kin\.[onetw]{3})/i],[[_,/\./g," "],[I,ge],[A,L]],[/droid.+; ([c6]+|et5[16]|mc[239][23]x?|vc8[03]x?)\)/i],[_,[I,Re],[A,z]],[/droid.+; (ec30|ps20|tc[2-8]\d[kx])\)/i],[_,[I,Re],[A,L]],[/(philips)[\w ]+tv/i,/smart-tv.+(samsung)/i],[I,[A,N]],[/hbbtv.+maple;(\d+)/i],[[_,/^/,"SmartTV"],[I,Te],[A,N]],[/(vizio)(?: |.+model\/)(\w+-\w+)/i,/tcast.+(lg)e?. ([-\w]+)/i],[I,_,[A,N]],[/(nux; netcast.+smarttv|lg (netcast\.tv-201\d|android tv))/i],[[I,fe],[A,N]],[/(apple) ?tv/i],[I,[_,ce+" TV"],[A,N]],[/crkey.*devicetype\/chromecast/i],[[_,Pe+" Third Generation"],[I,pe],[A,N]],[/crkey.*devicetype\/([^/]*)/i],[[_,/^/,"Chromecast "],[I,pe],[A,N]],[/fuchsia.*crkey/i],[[_,Pe+" Nest Hub"],[I,pe],[A,N]],[/crkey/i],[[_,Pe],[I,pe],[A,N]],[/(portaltv)/i],[_,[I,Ie],[A,N]],[/droid.+aft(\w+)( bui|\))/i],[_,[I,ue],[A,N]],[/(shield \w+ tv)/i],[_,[I,ye],[A,N]],[/\(dtv[\);].+(aquos)/i,/(aquos-tv[\w ]+)\)/i],[_,[I,Se],[A,N]],[/(bravia[\w ]+)( bui|\))/i],[_,[I,Ce],[A,N]],[/(mi(tv|box)-?\w+) bui/i],[_,[I,Oe],[A,N]],[/Hbbtv.*(technisat) (.*);/i],[I,_,[A,N]],[/\b(roku)[\dx]*[\)\/]((?:dvp-)?[\d\.]*)/i,/hbbtv\/\d+\.\d+\.\d+ +\([\w\+ ]*; *([\w\d][^;]*);([^;]*)/i],[[I,/.+\/(\w+)/,"$1",Ze,{LG:"lge"}],[_,Je],[A,N]],[/(playstation \w+)/i],[_,[I,Ce],[A,F]],[/\b(xbox(?: one)?(?!; xbox))[\); ]/i],[_,[I,ge],[A,F]],[/(ouya)/i,/(nintendo) (\w+)/i,/(retroid) (pocket ([^\)]+))/i,/(valve).+(steam deck)/i,/droid.+; ((shield|rgcube|gr0006))( bui|\))/i],[[I,Ze,{Nvidia:"Shield",Anbernic:"RGCUBE",Logitech:"GR0006"}],_,[A,F]],[/\b(sm-[lr]\d\d[0156][fnuw]?s?|gear live)\b/i],[_,[I,Te],[A,D]],[/((pebble))app/i,/(asus|google|lg|oppo|xiaomi) ((pixel |zen)?watch[\w ]*)( bui|\))/i],[I,_,[A,D]],[/(ow(?:19|20)?we?[1-3]{1,3})/i],[_,[I,xe],[A,D]],[/(watch)(?: ?os[,\/]|\d,\d\/)[\d\.]+/i],[_,[I,ce],[A,D]],[/(opwwe\d{3})/i],[_,[I,ke],[A,D]],[/(moto 360)/i],[_,[I,ve],[A,D]],[/(smartwatch 3)/i],[_,[I,Ce],[A,D]],[/(g watch r)/i],[_,[I,fe],[A,D]],[/droid.+; (wt63?0{2,3})\)/i],[_,[I,Re],[A,D]],[/droid.+; (glass) \d/i],[_,[I,pe],[A,B]],[/(pico) ([\w ]+) os\d/i],[I,_,[A,B]],[/(quest( \d| pro)?s?).+vr/i],[_,[I,Ie],[A,B]],[/mobile vr; rv.+firefox/i],[[A,B]],[/(tesla)(?: qtcarbrowser|\/[-\w\.]+)/i],[I,[A,V]],[/(aeobc)\b/i],[_,[I,ue],[A,V]],[/(homepod).+mac os/i],[_,[I,ce],[A,V]],[/windows iot/i],[[A,V]],[/droid.+; ([\w- ]+) (4k|android|smart|google)[- ]?tv/i],[_,[A,N]],[/\b((4k|android|smart|opera)[- ]?tv|tv; rv:|large screen[\w ]+safari)\b/i],[[A,N]],[/droid .+?; ([^;]+?)(?: bui|; wv\)|\) applew|; hmsc).+?(mobile|vr|\d) safari/i],[_,[A,Ze,{mobile:"Mobile",xr:"VR","*":z}]],[/\b((tablet|tab)[;\/]|focus\/\d(?!.+mobile))/i],[[A,z]],[/(phone|mobile(?:[;\/]| [ \w\/\.]*safari)|pda(?=.+windows ce))/i],[[A,L]],[/droid .+?; ([\w\. -]+)( bui|\))/i],[_,[I,"Generic"]]],engine:[[/windows.+ edge\/([\w\.]+)/i],[H,[M,je+"HTML"]],[/(arkweb)\/([\w\.]+)/i],[M,H],[/webkit\/537\.36.+chrome\/(?!27)([\w\.]+)/i],[H,[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,H],[/ladybird\//i],[[M,"LibWeb"]],[/rv\:([\w\.]{1,9})\b.+(gecko)/i],[H,M]],os:[[/(windows nt) (6\.[23]); arm/i],[[M,/N/,"R"],[H,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,H],[/windows nt ?([\d\.\)]*)(?!.+xbox)/i,/\bwin(?=3| ?9|n)(?:nt| 9x )?([\d\.;]*)/i],[[H,/(;|\))/g,"",Ze,et],[M,_e]],[/(windows ce)\/?([\d\.]*)/i],[M,H],[/[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],[[H,/_/g,"."],[M,"iOS"]],[/(mac os x) ?([\w\. ]*)/i,/(macintosh|mac_powerpc\b)(?!.+(haiku|morphos))/i],[[M,"macOS"],[H,/_/g,"."]],[/android ([\d\.]+).*crkey/i],[H,[M,Pe+" Android"]],[/fuchsia.*crkey\/([\d\.]+)/i],[H,[M,Pe+" Fuchsia"]],[/crkey\/([\d\.]+).*devicetype\/smartspeaker/i],[H,[M,Pe+" SmartSpeaker"]],[/linux.*crkey\/([\d\.]+)/i],[H,[M,Pe+" Linux"]],[/crkey\/([\d\.]+)/i],[H,[M,Pe]],[/droid ([\w\.]+)\b.+(android[- ]x86)/i],[H,M],[/(ubuntu) ([\w\.]+) like android/i],[[M,/(.+)/,"$1 Touch"],H],[/(harmonyos)[\/ ]?([\d\.]*)/i,/(android|bada|blackberry|kaios|maemo|meego|openharmony|qnx|rim tablet os|sailfish|series40|symbian|tizen)\w*[-\/\.; ]?([\d\.]*)/i],[M,H],[/\(bb(10);/i],[H,[M,he]],[/(?:symbian ?os|symbos|s60(?=;)|series ?60)[-\/ ]?([\w\.]*)/i],[H,[M,"Symbian"]],[/mozilla\/[\d\.]+ \((?:mobile[;\w ]*|tablet|tv|[^\)]*(?:viera|lg(?:l25|-d300)|alcatel ?o.+|y300-f1)); rv:([\w\.]+)\).+gecko\//i],[H,[M,Me+" OS"]],[/\b(?:hp)?wos(?:browser)?\/([\w\.]+)/i,/webos(?:[ \/]?|\.tv-20(?=2[2-9]))(\d[\d\.]*)/i],[H,[M,"webOS"]],[/web0s;.+?(?:chr[o0]me|safari)\/(\d+)/i],[[H,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],[H,[M,"watchOS"]],[/cros [\w]+(?:\)| ([\w\.]+)\b)/i],[H,[M,"Chrome OS"]],[/kepler ([\w\.]+); (aft|aeo)/i],[H,[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,H],[/(sunos) ?([\d\.]*)/i],[[M,"Solaris"],H],[/\b(beos|os\/2|amigaos|openvms|hp-ux|serenityos)/i,/(unix) ?([\w\.]*)/i],[M,H]]},ot=(Ge.call((v={init:{},isIgnore:{},isIgnoreRgx:{},toString:{}}).init,[[O,[M,H,U,A]],[R,[$]],[E,[A,_,I]],[q,[M,H]],[P,[M,H]]]),Ge.call(v.isIgnore,[[O,[H,U]],[q,[H]],[P,[H]]]),Ge.call(v.isIgnoreRgx,[[O,/ ?browser$/i],[P,/ ?os$/i]]),Ge.call(v.toString,[[O,[M,H]],[R,[$]],[E,[I,_]],[q,[M,H]],[P,[M,H]]]),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)&&!Ne(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])],[$,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?(De(e,!0)?(typeof t===T&&(i=t),t=e):(i=e,t=void 0),e=void 0):typeof e!==S||De(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 Be(e)&&(s=Je(e,500)),this}],["useExtension",function(e){return e&&(l=function(e,t){var i={},r=t;if(!De(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(A)&&Le&&Le[L]&&this.set(A,L),"Macintosh"==this.get(_)&&Fe&&typeof Fe.standalone!==C&&Fe.maxTouchPoints&&Fe.maxTouchPoints>2&&this.set(_,"iPad").set(A,z);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(U,Xe(this.get(H)));break;case P:if("iOS"==this.get(M)&&this.get(H)&&/^1[89][^\d]/.exec(this.get(H))){var e=/\) Version\/((\d+)[\d\.]*)/.exec(this.ua);e&&parseInt(e[2],10)>=26&&this.set(H,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(H,s).set(U,Xe(s)),i=n),this.itemType==q&&n==qe&&this.set(H,s)}break;case R:var a=e[$];a&&(a&&"64"==e[Y]&&(a+="64"),Ye.call(this.data,a+";",t));break;case E:if(e[L]&&this.set(A,L),e[_]&&(this.set(_,e[_]),!this.get(A)||!this.get(I))){var l={};Ye.call(l,"droid 9; "+e[_]+")",t),!this.get(A)&&l.type&&this.set(A,l.type),!this.get(I)&&l.vendor&&this.set(I,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(A,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(H,h)}this.get(M)==_e&&"Xbox"==e[_]&&this.set(M,"Xbox").set(H,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=ze([M,H,U,A]),lt.CPU=ze([$]),lt.DEVICE=ze([_,I,A,F,L,N,z,D,V]),lt.ENGINE=lt.OS=ze([M,H]);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:30,maxUploadsPerSession:10,minUploadIntervalMs:3e4,maxReplayBytes:2097152};class At{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:It(r(i))})}catch(i){}})}}function It(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,"errorSentAt",new Map),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 At({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())}isDuplicateError(e){var t,i;const r=null!=(t=this.options.errorDedupeMs)?t:0;if(r<=0||"error"!==e.type)return!1;const o=`${e.errorType}|${e.message}|${null!=(i=e.filename)?i:""}`,n=Date.now(),s=this.errorSentAt.get(o);if(void 0!==s&&n-s<r)return!0;if(this.errorSentAt.size>=100)for(const[a,l]of this.errorSentAt)n-l>=r&&this.errorSentAt.delete(a);return this.errorSentAt.set(o,n),!1}send(e){var t;if(this.isDuplicateError(e))return;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=[],this.errorSentAt.clear()}},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
+ }