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