@huyooo/analytics 0.2.0 → 0.2.1
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 +0 -4
- package/dist/index.js +1 -1
- package/package.json +2 -3
package/README.md
CHANGED
package/dist/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{CLSThresholds as e,FCPThresholds as t,INPThresholds as n,LCPThresholds as r,TTFBThresholds as i,onCLS as a,onFCP as o,onINP as s,onLCP as c,onTTFB as l}from"web-vitals";import{UAParser as u}from"ua-parser-js";import{v4 as d}from"uuid";function f(){return typeof window<`u`&&typeof document<`u`}const p=`_analytics_session_id`;function m(){if(!f())return``;let e=sessionStorage.getItem(p);return e||(e=d(),sessionStorage.setItem(p,e)),e}function h(){return{ua:``,browser:{name:void 0,version:void 0,major:void 0},cpu:{architecture:void 0},device:{model:void 0,type:void 0,vendor:void 0},engine:{name:void 0,version:void 0},os:{name:void 0,version:void 0},screenResolution:``,platform:`Unknown`,language:`Unknown`}}function g(){return{host:``,hostname:``,href:``,origin:``,pathname:``,port:``,protocol:``,referrer:`direct`,sessionId:``}}function _(){return f()?{...new u().getResult(),screenResolution:`${window.screen.width}x${window.screen.height}`,platform:/Android|iOS|iPad|iPhone/i.test(navigator.userAgent)?`Mobile App`:`Web`,language:navigator.language||`Unknown`}:h()}function v(e){if(!f())return g();let t=e??location.pathname;return{host:location.host,hostname:location.hostname,href:`${location.origin}${t}${location.search}${location.hash}`,origin:location.origin,pathname:t,port:location.port,protocol:location.protocol,referrer:document.referrer||`direct`,sessionId:m()}}function y(e){let t=e.getToken?.();return t?t.startsWith(`Bearer `)?t:`Bearer ${t}`:``}function b(a,o){return{appId:a.appId,authorization:y(a),device:_(),location:v(),metric:o,reports:{CLSThresholds:e,FCPThresholds:t,INPThresholds:n,LCPThresholds:r,TTFBThresholds:i}}}function x(e,t){let n=n=>{t(b(e,n))};a(n),o(n),s(n),c(n),l(n)}function S(e){let t=e.getToken?.();if(t)return t.startsWith(`Bearer `)?t:`Bearer ${t}`}function C(e,t){let n={appId:e.appId,device:_(),location:v(t)},r=S(e);return r&&(n.authorization=r),n}function w(e){if(!f())return()=>{};e();let t=history.pushState.bind(history),n=history.replaceState.bind(history);function r(){e()}return history.pushState=(...e)=>{t(...e),r()},history.replaceState=(...e)=>{n(...e),r()},window.addEventListener(`popstate`,r),window.addEventListener(`hashchange`,r),()=>{history.pushState=t,history.replaceState=n,window.removeEventListener(`popstate`,r),window.removeEventListener(`hashchange`,r)}}function T(e){let t=e.logPrefixUrl?.replace(/\/$/,``)??``;return{analytics:e.analyticsEndpoint??`${t}/analytics/add`,performance:e.performanceEndpoint??`${t}/performance/add`}}function E(e,t){let n=JSON.stringify(t);typeof navigator<`u`&&typeof navigator.sendBeacon==`function`&&navigator.sendBeacon(e,new Blob([n],{type:`application/json`}))||D(e,n)}function D(e,t){fetch(e,{method:`POST`,headers:{"Content-Type":`application/json`},body:t,keepalive:!0}).catch(e=>{})}function O(e){let t=T(e),n=!1,r=``,i=null;function a(t,n){e.debug}function o(n){if(!f())return;let i=C(e,n?.pathname),o=i.location.pathname;e.dedupePageView!==!1&&o===r||(r=o,a(`trackPageView`,i),E(t.analytics,i))}function s(){i||(i=w(o),a(`trackNavigation`))}function c(){!f()||n||e.enablePerformance===!1||(n=!0,a(`startPerformance`),x(e,e=>{a(`performance metric`,e.metric),E(t.performance,e)}))}function l(){i?.(),i=null,n=!1,r=``}return{trackPageView:o,trackNavigation:s,startPerformance:c,destroy:l}}export{O as createAnalyticsClient,T as resolveEndpoints};
|
|
1
|
+
var e=(e,t)=>()=>(t||(e((t={exports:{}}).exports,t),e=null),t.exports),t,n,r,i,a,o=-1,s=function(e){addEventListener(`pageshow`,(function(t){t.persisted&&(o=t.timeStamp,e(t))}),!0)},c=function(){var e=self.performance&&performance.getEntriesByType&&performance.getEntriesByType(`navigation`)[0];if(e&&e.responseStart>0&&e.responseStart<performance.now())return e},l=function(){var e=c();return e&&e.activationStart||0},u=function(e,t){var n=c(),r=`navigate`;return o>=0?r=`back-forward-cache`:n&&(document.prerendering||l()>0?r=`prerender`:document.wasDiscarded?r=`restore`:n.type&&(r=n.type.replace(/_/g,`-`))),{name:e,value:t===void 0?-1:t,rating:`good`,delta:0,entries:[],id:`v4-${Date.now()}-${Math.floor(8999999999999*Math.random())+0xe8d4a51000}`,navigationType:r}},d=function(e,t,n){try{if(PerformanceObserver.supportedEntryTypes.includes(e)){var r=new PerformanceObserver((function(e){Promise.resolve().then((function(){t(e.getEntries())}))}));return r.observe(Object.assign({type:e,buffered:!0},n||{})),r}}catch{}},f=function(e,t,n,r){var i,a;return function(o){t.value>=0&&(o||r)&&((a=t.value-(i||0))||i===void 0)&&(i=t.value,t.delta=a,t.rating=function(e,t){return e>t[1]?`poor`:e>t[0]?`needs-improvement`:`good`}(t.value,n),e(t))}},p=function(e){requestAnimationFrame((function(){return requestAnimationFrame((function(){return e()}))}))},m=function(e){document.addEventListener(`visibilitychange`,(function(){document.visibilityState===`hidden`&&e()}))},h=function(e){var t=!1;return function(){t||=(e(),!0)}},g=-1,_=function(){return document.visibilityState!==`hidden`||document.prerendering?1/0:0},v=function(e){document.visibilityState===`hidden`&&g>-1&&(g=e.type===`visibilitychange`?e.timeStamp:0,b())},y=function(){addEventListener(`visibilitychange`,v,!0),addEventListener(`prerenderingchange`,v,!0)},b=function(){removeEventListener(`visibilitychange`,v,!0),removeEventListener(`prerenderingchange`,v,!0)},x=function(){return g<0&&(g=_(),y(),s((function(){setTimeout((function(){g=_(),y()}),0)}))),{get firstHiddenTime(){return g}}},S=function(e){document.prerendering?addEventListener(`prerenderingchange`,(function(){return e()}),!0):e()},C=[1800,3e3],w=function(e,t){t||={},S((function(){var n,r=x(),i=u(`FCP`),a=d(`paint`,(function(e){e.forEach((function(e){e.name===`first-contentful-paint`&&(a.disconnect(),e.startTime<r.firstHiddenTime&&(i.value=Math.max(e.startTime-l(),0),i.entries.push(e),n(!0)))}))}));a&&(n=f(e,i,C,t.reportAllChanges),s((function(r){i=u(`FCP`),n=f(e,i,C,t.reportAllChanges),p((function(){i.value=performance.now()-r.timeStamp,n(!0)}))})))}))},T=[.1,.25],E=function(e,t){t||={},w(h((function(){var n,r=u(`CLS`,0),i=0,a=[],o=function(e){e.forEach((function(e){if(!e.hadRecentInput){var t=a[0],n=a[a.length-1];i&&e.startTime-n.startTime<1e3&&e.startTime-t.startTime<5e3?(i+=e.value,a.push(e)):(i=e.value,a=[e])}})),i>r.value&&(r.value=i,r.entries=a,n())},c=d(`layout-shift`,o);c&&(n=f(e,r,T,t.reportAllChanges),m((function(){o(c.takeRecords()),n(!0)})),s((function(){i=0,r=u(`CLS`,0),n=f(e,r,T,t.reportAllChanges),p((function(){return n()}))})),setTimeout(n,0))})))},ee=0,D=1/0,O=0,k=function(e){e.forEach((function(e){e.interactionId&&(D=Math.min(D,e.interactionId),O=Math.max(O,e.interactionId),ee=O?(O-D)/7+1:0)}))},te=function(){return t?ee:performance.interactionCount||0},A=function(){`interactionCount`in performance||t||(t=d(`event`,k,{type:`event`,buffered:!0,durationThreshold:0}))},j=[],M=new Map,ne=0,re=function(){return j[Math.min(j.length-1,Math.floor((te()-ne)/50))]},N=[],P=function(e){if(N.forEach((function(t){return t(e)})),e.interactionId||e.entryType===`first-input`){var t=j[j.length-1],n=M.get(e.interactionId);if(n||j.length<10||e.duration>t.latency){if(n)e.duration>n.latency?(n.entries=[e],n.latency=e.duration):e.duration===n.latency&&e.startTime===n.entries[0].startTime&&n.entries.push(e);else{var r={id:e.interactionId,latency:e.duration,entries:[e]};M.set(r.id,r),j.push(r)}j.sort((function(e,t){return t.latency-e.latency})),j.length>10&&j.splice(10).forEach((function(e){return M.delete(e.id)}))}}},F=function(e){var t=self.requestIdleCallback||self.setTimeout,n=-1;return e=h(e),document.visibilityState===`hidden`?e():(n=t(e),m(e)),n},I=[200,500],ie=function(e,t){`PerformanceEventTiming`in self&&`interactionId`in PerformanceEventTiming.prototype&&(t||={},S((function(){A();var n,r=u(`INP`),i=function(e){F((function(){e.forEach(P);var t=re();t&&t.latency!==r.value&&(r.value=t.latency,r.entries=t.entries,n())}))},a=d(`event`,i,{durationThreshold:t.durationThreshold??40});n=f(e,r,I,t.reportAllChanges),a&&(a.observe({type:`first-input`,buffered:!0}),m((function(){i(a.takeRecords()),n(!0)})),s((function(){ne=te(),j.length=0,M.clear(),r=u(`INP`),n=f(e,r,I,t.reportAllChanges)})))})))},L=[2500,4e3],R={},z=function(e,t){t||={},S((function(){var n,r=x(),i=u(`LCP`),a=function(e){t.reportAllChanges||(e=e.slice(-1)),e.forEach((function(e){e.startTime<r.firstHiddenTime&&(i.value=Math.max(e.startTime-l(),0),i.entries=[e],n())}))},o=d(`largest-contentful-paint`,a);if(o){n=f(e,i,L,t.reportAllChanges);var c=h((function(){R[i.id]||(a(o.takeRecords()),o.disconnect(),R[i.id]=!0,n(!0))}));[`keydown`,`click`].forEach((function(e){addEventListener(e,(function(){return F(c)}),{once:!0,capture:!0})})),m(c),s((function(r){i=u(`LCP`),n=f(e,i,L,t.reportAllChanges),p((function(){i.value=performance.now()-r.timeStamp,R[i.id]=!0,n(!0)}))}))}}))},B=[800,1800],V=function e(t){document.prerendering?S((function(){return e(t)})):document.readyState===`complete`?setTimeout(t,0):addEventListener(`load`,(function(){return e(t)}),!0)},H=function(e,t){t||={};var n=u(`TTFB`),r=f(e,n,B,t.reportAllChanges);V((function(){var i=c();i&&(n.value=Math.max(i.responseStart-l(),0),n.entries=[i],r(!0),s((function(){n=u(`TTFB`,0),(r=f(e,n,B,t.reportAllChanges))(!0)})))}))},U={passive:!0,capture:!0},ae=new Date,W=function(e,t){n||(n=t,r=e,i=new Date,ce(removeEventListener),oe())},oe=function(){if(r>=0&&r<i-ae){var e={entryType:`first-input`,name:n.type,target:n.target,cancelable:n.cancelable,startTime:n.timeStamp,processingStart:n.timeStamp+r};a.forEach((function(t){t(e)})),a=[]}},se=function(e){if(e.cancelable){var t=(e.timeStamp>0xe8d4a51000?new Date:performance.now())-e.timeStamp;e.type==`pointerdown`?function(e,t){var n=function(){W(e,t),i()},r=function(){i()},i=function(){removeEventListener(`pointerup`,n,U),removeEventListener(`pointercancel`,r,U)};addEventListener(`pointerup`,n,U),addEventListener(`pointercancel`,r,U)}(t,e):W(t,e)}},ce=function(e){[`mousedown`,`keydown`,`touchstart`,`pointerdown`].forEach((function(t){return e(t,se,U)}))},G=e(((e,t)=>{(function(n,r){var i=`1.0.41`,a=``,o=`?`,s=`function`,c=`undefined`,l=`object`,u=`string`,d=`major`,f=`model`,p=`name`,m=`type`,h=`vendor`,g=`version`,_=`architecture`,v=`console`,y=`mobile`,b=`tablet`,x=`smarttv`,S=`wearable`,C=`embedded`,w=500,T=`Amazon`,E=`Apple`,ee=`ASUS`,D=`BlackBerry`,O=`Browser`,k=`Chrome`,te=`Edge`,A=`Firefox`,j=`Google`,M=`Honor`,ne=`Huawei`,re=`Lenovo`,N=`LG`,P=`Microsoft`,F=`Motorola`,I=`Nvidia`,ie=`OnePlus`,L=`Opera`,R=`OPPO`,z=`Samsung`,B=`Sharp`,V=`Sony`,H=`Xiaomi`,U=`Zebra`,ae=`Facebook`,W=`Chromium OS`,oe=`Mac OS`,se=` Browser`,ce=function(e,t){var n={};for(var r in e)t[r]&&t[r].length%2==0?n[r]=t[r].concat(e[r]):n[r]=e[r];return n},G=function(e){for(var t={},n=0;n<e.length;n++)t[e[n].toUpperCase()]=e[n];return t},K=function(e,t){return typeof e===u?q(t).indexOf(q(e))!==-1:!1},q=function(e){return e.toLowerCase()},le=function(e){return typeof e===u?e.replace(/[^\d\.]/g,a).split(`.`)[0]:r},J=function(e,t){if(typeof e===u)return e=e.replace(/^\s\s*/,a),typeof t===c?e:e.substring(0,w)},Y=function(e,t){for(var n=0,i,a,o,c,u,d;n<t.length&&!u;){var f=t[n],p=t[n+1];for(i=a=0;i<f.length&&!u&&f[i];)if(u=f[i++].exec(e),u)for(o=0;o<p.length;o++)d=u[++a],c=p[o],typeof c===l&&c.length>0?c.length===2?typeof c[1]==s?this[c[0]]=c[1].call(this,d):this[c[0]]=c[1]:c.length===3?typeof c[1]===s&&!(c[1].exec&&c[1].test)?this[c[0]]=d?c[1].call(this,d,c[2]):r:this[c[0]]=d?d.replace(c[1],c[2]):r:c.length===4&&(this[c[0]]=d?c[3].call(this,d.replace(c[1],c[2])):r):this[c]=d||r;n+=2}},X=function(e,t){for(var n in t)if(typeof t[n]===l&&t[n].length>0){for(var i=0;i<t[n].length;i++)if(K(t[n][i],e))return n===o?r:n}else if(K(t[n],e))return n===o?r:n;return t.hasOwnProperty(`*`)?t[`*`]:e},ue={"1.0":`/8`,"1.2":`/1`,"1.3":`/3`,"2.0":`/412`,"2.0.2":`/416`,"2.0.3":`/417`,"2.0.4":`/419`,"?":`/`},de={ME:`4.90`,"NT 3.11":`NT3.51`,"NT 4.0":`NT4.0`,2e3:`NT 5.0`,XP:[`NT 5.1`,`NT 5.2`],Vista:`NT 6.0`,7:`NT 6.1`,8:`NT 6.2`,"8.1":`NT 6.3`,10:[`NT 6.4`,`NT 10.0`],RT:`ARM`},fe={browser:[[/\b(?:crmo|crios)\/([\w\.]+)/i],[g,[p,`Chrome`]],[/edg(?:e|ios|a)?\/([\w\.]+)/i],[g,[p,`Edge`]],[/(opera mini)\/([-\w\.]+)/i,/(opera [mobiletab]{3,6})\b.+version\/([-\w\.]+)/i,/(opera)(?:.+version\/|[\/ ]+)([\w\.]+)/i],[p,g],[/opios[\/ ]+([\w\.]+)/i],[g,[p,L+` Mini`]],[/\bop(?:rg)?x\/([\w\.]+)/i],[g,[p,L+` GX`]],[/\bopr\/([\w\.]+)/i],[g,[p,L]],[/\bb[ai]*d(?:uhd|[ub]*[aekoprswx]{5,6})[\/ ]?([\w\.]+)/i],[g,[p,`Baidu`]],[/\b(?:mxbrowser|mxios|myie2)\/?([-\w\.]*)\b/i],[g,[p,`Maxthon`]],[/(kindle)\/([\w\.]+)/i,/(lunascape|maxthon|netfront|jasmine|blazer|sleipnir)[\/ ]?([\w\.]*)/i,/(avant|iemobile|slim(?:browser|boat|jet))[\/ ]?([\d\.]*)/i,/(?:ms|\()(ie) ([\w\.]+)/i,/(flock|rockmelt|midori|epiphany|silk|skyfire|ovibrowser|bolt|iron|vivaldi|iridium|phantomjs|bowser|qupzilla|falkon|rekonq|puffin|brave|whale(?!.+naver)|qqbrowserlite|duckduckgo|klar|helio|(?=comodo_)?dragon)\/([-\w\.]+)/i,/(heytap|ovi|115)browser\/([\d\.]+)/i,/(weibo)__([\d\.]+)/i],[p,g],[/quark(?:pc)?\/([-\w\.]+)/i],[g,[p,`Quark`]],[/\bddg\/([\w\.]+)/i],[g,[p,`DuckDuckGo`]],[/(?:\buc? ?browser|(?:juc.+)ucweb)[\/ ]?([\w\.]+)/i],[g,[p,`UC`+O]],[/microm.+\bqbcore\/([\w\.]+)/i,/\bqbcore\/([\w\.]+).+microm/i,/micromessenger\/([\w\.]+)/i],[g,[p,`WeChat`]],[/konqueror\/([\w\.]+)/i],[g,[p,`Konqueror`]],[/trident.+rv[: ]([\w\.]{1,9})\b.+like gecko/i],[g,[p,`IE`]],[/ya(?:search)?browser\/([\w\.]+)/i],[g,[p,`Yandex`]],[/slbrowser\/([\w\.]+)/i],[g,[p,`Smart Lenovo `+O]],[/(avast|avg)\/([\w\.]+)/i],[[p,/(.+)/,`$1 Secure `+O],g],[/\bfocus\/([\w\.]+)/i],[g,[p,A+` Focus`]],[/\bopt\/([\w\.]+)/i],[g,[p,L+` Touch`]],[/coc_coc\w+\/([\w\.]+)/i],[g,[p,`Coc Coc`]],[/dolfin\/([\w\.]+)/i],[g,[p,`Dolphin`]],[/coast\/([\w\.]+)/i],[g,[p,L+` Coast`]],[/miuibrowser\/([\w\.]+)/i],[g,[p,`MIUI`+se]],[/fxios\/([\w\.-]+)/i],[g,[p,A]],[/\bqihoobrowser\/?([\w\.]*)/i],[g,[p,`360`]],[/\b(qq)\/([\w\.]+)/i],[[p,/(.+)/,`$1Browser`],g],[/(oculus|sailfish|huawei|vivo|pico)browser\/([\w\.]+)/i],[[p,/(.+)/,`$1`+se],g],[/samsungbrowser\/([\w\.]+)/i],[g,[p,z+` Internet`]],[/metasr[\/ ]?([\d\.]+)/i],[g,[p,`Sogou Explorer`]],[/(sogou)mo\w+\/([\d\.]+)/i],[[p,`Sogou Mobile`],g],[/(electron)\/([\w\.]+) safari/i,/(tesla)(?: qtcarbrowser|\/(20\d\d\.[-\w\.]+))/i,/m?(qqbrowser|2345(?=browser|chrome|explorer))\w*[\/ ]?v?([\w\.]+)/i],[p,g],[/(lbbrowser|rekonq)/i,/\[(linkedin)app\]/i],[p],[/ome\/([\w\.]+) \w* ?(iron) saf/i,/ome\/([\w\.]+).+qihu (360)[es]e/i],[g,p],[/((?:fban\/fbios|fb_iab\/fb4a)(?!.+fbav)|;fbav\/([\w\.]+);)/i],[[p,ae],g],[/(Klarna)\/([\w\.]+)/i,/(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,/(chromium|instagram|snapchat)[\/ ]([-\w\.]+)/i],[p,g],[/\bgsa\/([\w\.]+) .*safari\//i],[g,[p,`GSA`]],[/musical_ly(?:.+app_?version\/|_)([\w\.]+)/i],[g,[p,`TikTok`]],[/headlesschrome(?:\/([\w\.]+)| )/i],[g,[p,k+` Headless`]],[/ wv\).+(chrome)\/([\w\.]+)/i],[[p,k+` WebView`],g],[/droid.+ version\/([\w\.]+)\b.+(?:mobile safari|safari)/i],[g,[p,`Android `+O]],[/(chrome|omniweb|arora|[tizenoka]{5} ?browser)\/v?([\w\.]+)/i],[p,g],[/version\/([\w\.\,]+) .*mobile\/\w+ (safari)/i],[g,[p,`Mobile Safari`]],[/version\/([\w(\.|\,)]+) .*(mobile ?safari|safari)/i],[g,p],[/webkit.+?(mobile ?safari|safari)(\/[\w\.]+)/i],[p,[g,X,ue]],[/(webkit|khtml)\/([\w\.]+)/i],[p,g],[/(navigator|netscape\d?)\/([-\w\.]+)/i],[[p,`Netscape`],g],[/(wolvic|librewolf)\/([\w\.]+)/i],[p,g],[/mobile vr; rv:([\w\.]+)\).+firefox/i],[g,[p,A+` Reality`]],[/ekiohf.+(flow)\/([\w\.]+)/i,/(swiftfox)/i,/(icedragon|iceweasel|camino|chimera|fennec|maemo browser|minimo|conkeror)[\/ ]?([\w\.\+]+)/i,/(seamonkey|k-meleon|icecat|iceape|firebird|phoenix|palemoon|basilisk|waterfox)\/([-\w\.]+)$/i,/(firefox)\/([\w\.]+)/i,/(mozilla)\/([\w\.]+) .+rv\:.+gecko\/\d+/i,/(amaya|dillo|doris|icab|ladybird|lynx|mosaic|netsurf|obigo|polaris|w3m|(?:go|ice|up)[\. ]?browser)[-\/ ]?v?([\w\.]+)/i,/\b(links) \(([\w\.]+)/i],[p,[g,/_/g,`.`]],[/(cobalt)\/([\w\.]+)/i],[p,[g,/master.|lts./,``]]],cpu:[[/\b((amd|x|x86[-_]?|wow|win)64)\b/i],[[_,`amd64`]],[/(ia32(?=;))/i,/\b((i[346]|x)86)(pc)?\b/i],[[_,`ia32`]],[/\b(aarch64|arm(v?[89]e?l?|_?64))\b/i],[[_,`arm64`]],[/\b(arm(v[67])?ht?n?[fl]p?)\b/i],[[_,`armhf`]],[/( (ce|mobile); ppc;|\/[\w\.]+arm\b)/i],[[_,`arm`]],[/((ppc|powerpc)(64)?)( mac|;|\))/i],[[_,/ower/,a,q]],[/ sun4\w[;\)]/i],[[_,`sparc`]],[/\b(avr32|ia64(?=;)|68k(?=\))|\barm(?=v([1-7]|[5-7]1)l?|;|eabi)|(irix|mips|sparc)(64)?\b|pa-risc)/i],[[_,q]]],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],[f,[h,z],[m,b]],[/\b((?:s[cgp]h|gt|sm)-(?![lr])\w+|sc[g-]?[\d]+a?|galaxy nexus)/i,/samsung[- ]((?!sm-[lr])[-\w]+)/i,/sec-(sgh\w+)/i],[f,[h,z],[m,y]],[/(?:\/|\()(ip(?:hone|od)[\w, ]*)(?:\/|;)/i],[f,[h,E],[m,y]],[/\((ipad);[-\w\),; ]+apple/i,/applecoremedia\/[\w\.]+ \((ipad)/i,/\b(ipad)\d\d?,\d\d?[;\]].+ios/i],[f,[h,E],[m,b]],[/(macintosh);/i],[f,[h,E]],[/\b(sh-?[altvz]?\d\d[a-ekm]?)/i],[f,[h,B],[m,y]],[/\b((?:brt|eln|hey2?|gdi|jdn)-a?[lnw]09|(?:ag[rm]3?|jdn2|kob2)-a?[lw]0[09]hn)(?: bui|\)|;)/i],[f,[h,M],[m,b]],[/honor([-\w ]+)[;\)]/i],[f,[h,M],[m,y]],[/\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],[f,[h,ne],[m,b]],[/(?:huawei)([-\w ]+)[;\)]/i,/\b(nexus 6p|\w{2,4}e?-[atu]?[ln][\dx][012359c][adn]?)\b(?!.+d\/s)/i],[f,[h,ne],[m,y]],[/oid[^\)]+; (2[\dbc]{4}(182|283|rp\w{2})[cgl]|m2105k81a?c)(?: bui|\))/i,/\b((?:red)?mi[-_ ]?pad[\w- ]*)(?: bui|\))/i],[[f,/_/g,` `],[h,H],[m,b]],[/\b(poco[\w ]+|m2\d{3}j\d\d[a-z]{2})(?: bui|\))/i,/\b; (\w+) build\/hm\1/i,/\b(hm[-_ ]?note?[_ ]?(?:\d\w)?) bui/i,/\b(redmi[\-_ ]?(?:note|k)?[\w_ ]+)(?: bui|\))/i,/oid[^\)]+; (m?[12][0-389][01]\w{3,6}[c-y])( bui|; wv|\))/i,/\b(mi[-_ ]?(?:a\d|one|one[_ ]plus|note lte|max|cc)?[_ ]?(?:\d?\w?)[_ ]?(?:plus|se|lite|pro)?)(?: bui|\))/i,/ ([\w ]+) miui\/v?\d/i],[[f,/_/g,` `],[h,H],[m,y]],[/; (\w+) bui.+ oppo/i,/\b(cph[12]\d{3}|p(?:af|c[al]|d\w|e[ar])[mt]\d0|x9007|a101op)\b/i],[f,[h,R],[m,y]],[/\b(opd2(\d{3}a?))(?: bui|\))/i],[f,[h,X,{OnePlus:[`304`,`403`,`203`],"*":R}],[m,b]],[/vivo (\w+)(?: bui|\))/i,/\b(v[12]\d{3}\w?[at])(?: bui|;)/i],[f,[h,`Vivo`],[m,y]],[/\b(rmx[1-3]\d{3})(?: bui|;|\))/i],[f,[h,`Realme`],[m,y]],[/\b(milestone|droid(?:[2-4x]| (?:bionic|x2|pro|razr))?:?( 4g)?)\b[\w ]+build\//i,/\bmot(?:orola)?[- ](\w*)/i,/((?:moto(?! 360)[\w\(\) ]+|xt\d{3,4}|nexus 6)(?= bui|\)))/i],[f,[h,F],[m,y]],[/\b(mz60\d|xoom[2 ]{0,2}) build\//i],[f,[h,F],[m,b]],[/((?=lg)?[vl]k\-?\d{3}) bui| 3\.[-\w; ]{10}lg?-([06cv9]{3,4})/i],[f,[h,N],[m,b]],[/(lm(?:-?f100[nv]?|-[\w\.]+)(?= bui|\))|nexus [45])/i,/\blg[-e;\/ ]+((?!browser|netcast|android tv|watch)\w+)/i,/\blg-?([\d\w]+) bui/i],[f,[h,N],[m,y]],[/(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],[f,[h,re],[m,b]],[/(nokia) (t[12][01])/i],[h,f,[m,b]],[/(?:maemo|nokia).*(n900|lumia \d+|rm-\d+)/i,/nokia[-_ ]?(([-\w\. ]*))/i],[[f,/_/g,` `],[m,y],[h,`Nokia`]],[/(pixel (c|tablet))\b/i],[f,[h,j],[m,b]],[/droid.+; (pixel[\daxl ]{0,6})(?: bui|\))/i],[f,[h,j],[m,y]],[/droid.+; (a?\d[0-2]{2}so|[c-g]\d{4}|so[-gl]\w+|xq-a\w[4-7][12])(?= bui|\).+chrome\/(?![1-6]{0,1}\d\.))/i],[f,[h,V],[m,y]],[/sony tablet [ps]/i,/\b(?:sony)?sgp\w+(?: bui|\))/i],[[f,`Xperia Tablet`],[h,V],[m,b]],[/ (kb2005|in20[12]5|be20[12][59])\b/i,/(?:one)?(?:plus)? (a\d0\d\d)(?: b|\))/i],[f,[h,ie],[m,y]],[/(alexa)webm/i,/(kf[a-z]{2}wi|aeo(?!bc)\w\w)( bui|\))/i,/(kf[a-z]+)( bui|\)).+silk\//i],[f,[h,T],[m,b]],[/((?:sd|kf)[0349hijorstuw]+)( bui|\)).+silk\//i],[[f,/(.+)/g,`Fire Phone $1`],[h,T],[m,y]],[/(playbook);[-\w\),; ]+(rim)/i],[f,h,[m,b]],[/\b((?:bb[a-f]|st[hv])100-\d)/i,/\(bb10; (\w+)/i],[f,[h,D],[m,y]],[/(?:\b|asus_)(transfo[prime ]{4,10} \w+|eeepc|slider \w+|nexus 7|padfone|p00[cj])/i],[f,[h,ee],[m,b]],[/ (z[bes]6[027][012][km][ls]|zenfone \d\w?)\b/i],[f,[h,ee],[m,y]],[/(nexus 9)/i],[f,[h,`HTC`],[m,b]],[/(htc)[-;_ ]{1,2}([\w ]+(?=\)| bui)|\w+)/i,/(zte)[- ]([\w ]+?)(?: bui|\/|\))/i,/(alcatel|geeksphone|nexian|panasonic(?!(?:;|\.))|sony(?!-bra))[-_ ]?([-\w]*)/i],[h,[f,/_/g,` `],[m,y]],[/droid [\w\.]+; ((?:8[14]9[16]|9(?:0(?:48|60|8[01])|1(?:3[27]|66)|2(?:6[69]|9[56])|466))[gqswx])\w*(\)| bui)/i],[f,[h,`TCL`],[m,b]],[/(itel) ((\w+))/i],[[h,q],f,[m,X,{tablet:[`p10001l`,`w7001`],"*":`mobile`}]],[/droid.+; ([ab][1-7]-?[0178a]\d\d?)/i],[f,[h,`Acer`],[m,b]],[/droid.+; (m[1-5] note) bui/i,/\bmz-([-\w]{2,})/i],[f,[h,`Meizu`],[m,y]],[/; ((?:power )?armor(?:[\w ]{0,8}))(?: bui|\))/i],[f,[h,`Ulefone`],[m,y]],[/; (energy ?\w+)(?: bui|\))/i,/; energizer ([\w ]+)(?: bui|\))/i],[f,[h,`Energizer`],[m,y]],[/; cat (b35);/i,/; (b15q?|s22 flip|s48c|s62 pro)(?: bui|\))/i],[f,[h,`Cat`],[m,y]],[/((?:new )?andromax[\w- ]+)(?: bui|\))/i],[f,[h,`Smartfren`],[m,y]],[/droid.+; (a(?:015|06[35]|142p?))/i],[f,[h,`Nothing`],[m,y]],[/; (x67 5g|tikeasy \w+|ac[1789]\d\w+)( b|\))/i,/archos ?(5|gamepad2?|([\w ]*[t1789]|hello) ?\d+[\w ]*)( b|\))/i],[f,[h,`Archos`],[m,b]],[/archos ([\w ]+)( b|\))/i,/; (ac[3-6]\d\w{2,8})( b|\))/i],[f,[h,`Archos`],[m,y]],[/(imo) (tab \w+)/i,/(infinix) (x1101b?)/i],[h,f,[m,b]],[/(blackberry|benq|palm(?=\-)|sonyericsson|acer|asus(?! zenw)|dell|jolla|meizu|motorola|polytron|infinix|tecno|micromax|advan)[-_ ]?([-\w]*)/i,/; (hmd|imo) ([\w ]+?)(?: bui|\))/i,/(hp) ([\w ]+\w)/i,/(microsoft); (lumia[\w ]+)/i,/(lenovo)[-_ ]?([-\w ]+?)(?: bui|\)|\/)/i,/(oppo) ?([\w ]+) bui/i],[h,f,[m,y]],[/(kobo)\s(ereader|touch)/i,/(hp).+(touchpad(?!.+tablet)|tablet)/i,/(kindle)\/([\w\.]+)/i,/(nook)[\w ]+build\/(\w+)/i,/(dell) (strea[kpr\d ]*[\dko])/i,/(le[- ]+pan)[- ]+(\w{1,9}) bui/i,/(trinity)[- ]*(t\d{3}) bui/i,/(gigaset)[- ]+(q\w{1,9}) bui/i,/(vodafone) ([\w ]+)(?:\)| bui)/i],[h,f,[m,b]],[/(surface duo)/i],[f,[h,P],[m,b]],[/droid [\d\.]+; (fp\du?)(?: b|\))/i],[f,[h,`Fairphone`],[m,y]],[/(u304aa)/i],[f,[h,`AT&T`],[m,y]],[/\bsie-(\w*)/i],[f,[h,`Siemens`],[m,y]],[/\b(rct\w+) b/i],[f,[h,`RCA`],[m,b]],[/\b(venue[\d ]{2,7}) b/i],[f,[h,`Dell`],[m,b]],[/\b(q(?:mv|ta)\w+) b/i],[f,[h,`Verizon`],[m,b]],[/\b(?:barnes[& ]+noble |bn[rt])([\w\+ ]*) b/i],[f,[h,`Barnes & Noble`],[m,b]],[/\b(tm\d{3}\w+) b/i],[f,[h,`NuVision`],[m,b]],[/\b(k88) b/i],[f,[h,`ZTE`],[m,b]],[/\b(nx\d{3}j) b/i],[f,[h,`ZTE`],[m,y]],[/\b(gen\d{3}) b.+49h/i],[f,[h,`Swiss`],[m,y]],[/\b(zur\d{3}) b/i],[f,[h,`Swiss`],[m,b]],[/\b((zeki)?tb.*\b) b/i],[f,[h,`Zeki`],[m,b]],[/\b([yr]\d{2}) b/i,/\b(dragon[- ]+touch |dt)(\w{5}) b/i],[[h,`Dragon Touch`],f,[m,b]],[/\b(ns-?\w{0,9}) b/i],[f,[h,`Insignia`],[m,b]],[/\b((nxa|next)-?\w{0,9}) b/i],[f,[h,`NextBook`],[m,b]],[/\b(xtreme\_)?(v(1[045]|2[015]|[3469]0|7[05])) b/i],[[h,`Voice`],f,[m,y]],[/\b(lvtel\-)?(v1[12]) b/i],[[h,`LvTel`],f,[m,y]],[/\b(ph-1) /i],[f,[h,`Essential`],[m,y]],[/\b(v(100md|700na|7011|917g).*\b) b/i],[f,[h,`Envizen`],[m,b]],[/\b(trio[-\w\. ]+) b/i],[f,[h,`MachSpeed`],[m,b]],[/\btu_(1491) b/i],[f,[h,`Rotor`],[m,b]],[/((?:tegranote|shield t(?!.+d tv))[\w- ]*?)(?: b|\))/i],[f,[h,I],[m,b]],[/(sprint) (\w+)/i],[h,f,[m,y]],[/(kin\.[onetw]{3})/i],[[f,/\./g,` `],[h,P],[m,y]],[/droid.+; (cc6666?|et5[16]|mc[239][23]x?|vc8[03]x?)\)/i],[f,[h,U],[m,b]],[/droid.+; (ec30|ps20|tc[2-8]\d[kx])\)/i],[f,[h,U],[m,y]],[/smart-tv.+(samsung)/i],[h,[m,x]],[/hbbtv.+maple;(\d+)/i],[[f,/^/,`SmartTV`],[h,z],[m,x]],[/(nux; netcast.+smarttv|lg (netcast\.tv-201\d|android tv))/i],[[h,N],[m,x]],[/(apple) ?tv/i],[h,[f,E+` TV`],[m,x]],[/crkey/i],[[f,k+`cast`],[h,j],[m,x]],[/droid.+aft(\w+)( bui|\))/i],[f,[h,T],[m,x]],[/(shield \w+ tv)/i],[f,[h,I],[m,x]],[/\(dtv[\);].+(aquos)/i,/(aquos-tv[\w ]+)\)/i],[f,[h,B],[m,x]],[/(bravia[\w ]+)( bui|\))/i],[f,[h,V],[m,x]],[/(mi(tv|box)-?\w+) bui/i],[f,[h,H],[m,x]],[/Hbbtv.*(technisat) (.*);/i],[h,f,[m,x]],[/\b(roku)[\dx]*[\)\/]((?:dvp-)?[\d\.]*)/i,/hbbtv\/\d+\.\d+\.\d+ +\([\w\+ ]*; *([\w\d][^;]*);([^;]*)/i],[[h,J],[f,J],[m,x]],[/droid.+; ([\w- ]+) (?:android tv|smart[- ]?tv)/i],[f,[m,x]],[/\b(android tv|smart[- ]?tv|opera tv|tv; rv:)\b/i],[[m,x]],[/(ouya)/i,/(nintendo) ([wids3utch]+)/i],[h,f,[m,v]],[/droid.+; (shield)( bui|\))/i],[f,[h,I],[m,v]],[/(playstation \w+)/i],[f,[h,V],[m,v]],[/\b(xbox(?: one)?(?!; xbox))[\); ]/i],[f,[h,P],[m,v]],[/\b(sm-[lr]\d\d[0156][fnuw]?s?|gear live)\b/i],[f,[h,z],[m,S]],[/((pebble))app/i,/(asus|google|lg|oppo) ((pixel |zen)?watch[\w ]*)( bui|\))/i],[h,f,[m,S]],[/(ow(?:19|20)?we?[1-3]{1,3})/i],[f,[h,R],[m,S]],[/(watch)(?: ?os[,\/]|\d,\d\/)[\d\.]+/i],[f,[h,E],[m,S]],[/(opwwe\d{3})/i],[f,[h,ie],[m,S]],[/(moto 360)/i],[f,[h,F],[m,S]],[/(smartwatch 3)/i],[f,[h,V],[m,S]],[/(g watch r)/i],[f,[h,N],[m,S]],[/droid.+; (wt63?0{2,3})\)/i],[f,[h,U],[m,S]],[/droid.+; (glass) \d/i],[f,[h,j],[m,S]],[/(pico) (4|neo3(?: link|pro)?)/i],[h,f,[m,S]],[/; (quest( \d| pro)?)/i],[f,[h,ae],[m,S]],[/(tesla)(?: qtcarbrowser|\/[-\w\.]+)/i],[h,[m,C]],[/(aeobc)\b/i],[f,[h,T],[m,C]],[/(homepod).+mac os/i],[f,[h,E],[m,C]],[/windows iot/i],[[m,C]],[/droid .+?; ([^;]+?)(?: bui|; wv\)|\) applew).+? mobile safari/i],[f,[m,y]],[/droid .+?; ([^;]+?)(?: bui|\) applew).+?(?! mobile) safari/i],[f,[m,b]],[/\b((tablet|tab)[;\/]|focus\/\d(?!.+mobile))/i],[[m,b]],[/(phone|mobile(?:[;\/]| [ \w\/\.]*safari)|pda(?=.+windows ce))/i],[[m,y]],[/droid .+?; ([\w\. -]+)( bui|\))/i],[f,[h,`Generic`]]],engine:[[/windows.+ edge\/([\w\.]+)/i],[g,[p,te+`HTML`]],[/(arkweb)\/([\w\.]+)/i],[p,g],[/webkit\/537\.36.+chrome\/(?!27)([\w\.]+)/i],[g,[p,`Blink`]],[/(presto)\/([\w\.]+)/i,/(webkit|trident|netfront|netsurf|amaya|lynx|w3m|goanna|servo)\/([\w\.]+)/i,/ekioh(flow)\/([\w\.]+)/i,/(khtml|tasman|links)[\/ ]\(?([\w\.]+)/i,/(icab)[\/ ]([23]\.[\d\.]+)/i,/\b(libweb)/i],[p,g],[/ladybird\//i],[[p,`LibWeb`]],[/rv\:([\w\.]{1,9})\b.+(gecko)/i],[g,p]],os:[[/microsoft (windows) (vista|xp)/i],[p,g],[/(windows (?:phone(?: os)?|mobile|iot))[\/ ]?([\d\.\w ]*)/i],[p,[g,X,de]],[/windows nt 6\.2; (arm)/i,/windows[\/ ]([ntce\d\. ]+\w)(?!.+xbox)/i,/(?:win(?=3|9|n)|win 9x )([nt\d\.]+)/i],[[g,X,de],[p,`Windows`]],[/[adehimnop]{4,7}\b(?:.*os ([\w]+) like mac|; opera)/i,/(?:ios;fbsv\/|iphone.+ios[\/ ])([\d\.]+)/i,/cfnetwork\/.+darwin/i],[[g,/_/g,`.`],[p,`iOS`]],[/(mac os x) ?([\w\. ]*)/i,/(macintosh|mac_powerpc\b)(?!.+haiku)/i],[[p,oe],[g,/_/g,`.`]],[/droid ([\w\.]+)\b.+(android[- ]x86|harmonyos)/i],[g,p],[/(ubuntu) ([\w\.]+) like android/i],[[p,/(.+)/,`$1 Touch`],g],[/(android|bada|blackberry|kaios|maemo|meego|openharmony|qnx|rim tablet os|sailfish|series40|symbian|tizen|webos)\w*[-\/; ]?([\d\.]*)/i],[p,g],[/\(bb(10);/i],[g,[p,D]],[/(?:symbian ?os|symbos|s60(?=;)|series ?60)[-\/ ]?([\w\.]*)/i],[g,[p,`Symbian`]],[/mozilla\/[\d\.]+ \((?:mobile|tablet|tv|mobile; [\w ]+); rv:.+ gecko\/([\w\.]+)/i],[g,[p,A+` OS`]],[/web0s;.+rt(tv)/i,/\b(?:hp)?wos(?:browser)?\/([\w\.]+)/i],[g,[p,`webOS`]],[/watch(?: ?os[,\/]|\d,\d\/)([\d\.]+)/i],[g,[p,`watchOS`]],[/crkey\/([\d\.]+)/i],[g,[p,k+`cast`]],[/(cros) [\w]+(?:\)| ([\w\.]+)\b)/i],[[p,W],g],[/panasonic;(viera)/i,/(netrange)mmh/i,/(nettv)\/(\d+\.[\w\.]+)/i,/(nintendo|playstation) ([wids345portablevuch]+)/i,/(xbox); +xbox ([^\);]+)/i,/\b(joli|palm)\b ?(?:os)?\/?([\w\.]*)/i,/(mint)[\/\(\) ]?(\w*)/i,/(mageia|vectorlinux)[; ]/i,/([kxln]?ubuntu|debian|suse|opensuse|gentoo|arch(?= linux)|slackware|fedora|mandriva|centos|pclinuxos|red ?hat|zenwalk|linpus|raspbian|plan 9|minix|risc os|contiki|deepin|manjaro|elementary os|sabayon|linspire)(?: gnu\/linux)?(?: enterprise)?(?:[- ]linux)?(?:-gnu)?[-\/ ]?(?!chrom|package)([-\w\.]*)/i,/(hurd|linux)(?: arm\w*| x86\w*| ?)([\w\.]*)/i,/(gnu) ?([\w\.]*)/i,/\b([-frentopcghs]{0,5}bsd|dragonfly)[\/ ]?(?!amd|[ix346]{1,2}86)([\w\.]*)/i,/(haiku) (\w+)/i],[p,g],[/(sunos) ?([\w\.\d]*)/i],[[p,`Solaris`],g],[/((?:open)?solaris)[-\/ ]?([\w\.]*)/i,/(aix) ((\d)(?=\.|\)| )[\w\.])*/i,/\b(beos|os\/2|amigaos|morphos|openvms|fuchsia|hp-ux|serenityos)/i,/(unix) ?([\w\.]*)/i],[p,g]]},Z=function(e,t){if(typeof e===l&&(t=e,e=r),!(this instanceof Z))return new Z(e,t).getResult();var i=typeof n!==c&&n.navigator?n.navigator:r,o=e||(i&&i.userAgent?i.userAgent:a),v=i&&i.userAgentData?i.userAgentData:r,x=t?ce(fe,t):fe,S=i&&i.userAgent==o;return this.getBrowser=function(){var e={};return e[p]=r,e[g]=r,Y.call(e,o,x.browser),e[d]=le(e[g]),S&&i&&i.brave&&typeof i.brave.isBrave==s&&(e[p]=`Brave`),e},this.getCPU=function(){var e={};return e[_]=r,Y.call(e,o,x.cpu),e},this.getDevice=function(){var e={};return e[h]=r,e[f]=r,e[m]=r,Y.call(e,o,x.device),S&&!e[m]&&v&&v.mobile&&(e[m]=y),S&&e[f]==`Macintosh`&&i&&typeof i.standalone!==c&&i.maxTouchPoints&&i.maxTouchPoints>2&&(e[f]=`iPad`,e[m]=b),e},this.getEngine=function(){var e={};return e[p]=r,e[g]=r,Y.call(e,o,x.engine),e},this.getOS=function(){var e={};return e[p]=r,e[g]=r,Y.call(e,o,x.os),S&&!e[p]&&v&&v.platform&&v.platform!=`Unknown`&&(e[p]=v.platform.replace(/chrome os/i,W).replace(/macos/i,oe)),e},this.getResult=function(){return{ua:this.getUA(),browser:this.getBrowser(),engine:this.getEngine(),os:this.getOS(),device:this.getDevice(),cpu:this.getCPU()}},this.getUA=function(){return o},this.setUA=function(e){return o=typeof e===u&&e.length>w?J(e,w):e,this},this.setUA(o),this};Z.VERSION=i,Z.BROWSER=G([p,g,d]),Z.CPU=G([_]),Z.DEVICE=G([f,h,m,v,y,x,b,S,C]),Z.ENGINE=Z.OS=G([p,g]),typeof e===c?typeof define===s&&define.amd?define(function(){return Z}):typeof n!==c&&(n.UAParser=Z):(typeof t!==c&&t.exports&&(e=t.exports=Z),e.UAParser=Z);var Q=typeof n!==c&&(n.jQuery||n.Zepto);if(Q&&!Q.ua){var $=new Z;Q.ua=$.getResult(),Q.ua.get=function(){return $.getUA()},Q.ua.set=function(e){$.setUA(e);var t=$.getResult();for(var n in t)Q.ua[n]=t[n]}}})(typeof window==`object`?window:e)}))();function K(){return typeof window<`u`&&typeof document<`u`}const q=`_analytics_session_id`;function le(){return typeof crypto<`u`&&typeof crypto.randomUUID==`function`?crypto.randomUUID():`${Date.now()}-${Math.random().toString(16).slice(2)}`}function J(){if(!K())return``;let e=sessionStorage.getItem(q);return e||(e=le(),sessionStorage.setItem(q,e)),e}function Y(){return{ua:``,browser:{name:void 0,version:void 0,major:void 0},cpu:{architecture:void 0},device:{model:void 0,type:void 0,vendor:void 0},engine:{name:void 0,version:void 0},os:{name:void 0,version:void 0},screenResolution:``,platform:`Unknown`,language:`Unknown`}}function X(){return{host:``,hostname:``,href:``,origin:``,pathname:``,port:``,protocol:``,referrer:`direct`,sessionId:``}}function ue(){return K()?{...new G.UAParser().getResult(),screenResolution:`${window.screen.width}x${window.screen.height}`,platform:/Android|iOS|iPad|iPhone/i.test(navigator.userAgent)?`Mobile App`:`Web`,language:navigator.language||`Unknown`}:Y()}function de(e){if(!K())return X();let t=e??location.pathname;return{host:location.host,hostname:location.hostname,href:`${location.origin}${t}${location.search}${location.hash}`,origin:location.origin,pathname:t,port:location.port,protocol:location.protocol,referrer:document.referrer||`direct`,sessionId:J()}}function fe(e){let t=e.getToken?.();return t?t.startsWith(`Bearer `)?t:`Bearer ${t}`:``}function Z(e,t){return{appId:e.appId,authorization:fe(e),device:ue(),location:de(),metric:t,reports:{CLSThresholds:T,FCPThresholds:C,INPThresholds:I,LCPThresholds:L,TTFBThresholds:B}}}function Q(e,t){let n=n=>{t(Z(e,n))};E(n),w(n),ie(n),z(n),H(n)}function $(e){let t=e.getToken?.();if(t)return t.startsWith(`Bearer `)?t:`Bearer ${t}`}function pe(e,t){let n={appId:e.appId,device:ue(),location:de(t)},r=$(e);return r&&(n.authorization=r),n}function me(e){if(!K())return()=>{};e();let t=history.pushState.bind(history),n=history.replaceState.bind(history);function r(){e()}return history.pushState=(...e)=>{t(...e),r()},history.replaceState=(...e)=>{n(...e),r()},window.addEventListener(`popstate`,r),window.addEventListener(`hashchange`,r),()=>{history.pushState=t,history.replaceState=n,window.removeEventListener(`popstate`,r),window.removeEventListener(`hashchange`,r)}}function he(e){let t=e.logPrefixUrl?.replace(/\/$/,``)??``;return{analytics:e.analyticsEndpoint??`${t}/analytics/add`,performance:e.performanceEndpoint??`${t}/performance/add`}}function ge(e,t){let n=JSON.stringify(t);typeof navigator<`u`&&typeof navigator.sendBeacon==`function`&&navigator.sendBeacon(e,new Blob([n],{type:`application/json`}))||_e(e,n)}function _e(e,t){fetch(e,{method:`POST`,headers:{"Content-Type":`application/json`},body:t,keepalive:!0}).catch(e=>{})}function ve(e){let t=he(e),n=!1,r=``,i=null;function a(t,n){e.debug}function o(n){if(!K())return;let i=pe(e,n?.pathname),o=i.location.pathname;e.dedupePageView!==!1&&o===r||(r=o,a(`trackPageView`,i),ge(t.analytics,i))}function s(){i||(i=me(o),a(`trackNavigation`))}function c(){!K()||n||e.enablePerformance===!1||(n=!0,a(`startPerformance`),Q(e,e=>{a(`performance metric`,e.metric),ge(t.performance,e)}))}function l(){i?.(),i=null,n=!1,r=``}return{trackPageView:o,trackNavigation:s,startPerformance:c,destroy:l}}export{ve as createAnalyticsClient,he as resolveEndpoints};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@huyooo/analytics",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.1",
|
|
4
4
|
"description": "ONES 数据中心配套的前端采集 SDK(流量 PV/UV + Web Vitals 性能)",
|
|
5
5
|
"private": false,
|
|
6
6
|
"type": "module",
|
|
@@ -28,14 +28,13 @@
|
|
|
28
28
|
"build:js": "tsdown",
|
|
29
29
|
"build:types": "tsc -b tsconfig.json --emitDeclarationOnly",
|
|
30
30
|
"clean": "rm -rf dist tsconfig.tsbuildinfo",
|
|
31
|
-
"typecheck": "tsc --noEmit",
|
|
31
|
+
"typecheck": "tsc --noEmit -p tsconfig.json && tsc --noEmit -p tsconfig.node.json",
|
|
32
32
|
"pub": "npm version patch --force && npm publish --access public",
|
|
33
33
|
"release": "bumpp && npm publish --access public",
|
|
34
34
|
"prepublishOnly": "npm run build"
|
|
35
35
|
},
|
|
36
36
|
"dependencies": {
|
|
37
37
|
"ua-parser-js": "^1.0.38",
|
|
38
|
-
"uuid": "^11.1.0",
|
|
39
38
|
"web-vitals": "^4.2.3"
|
|
40
39
|
},
|
|
41
40
|
"devDependencies": {
|