@grafana/faro-web-sdk 1.0.0 → 1.0.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.
Files changed (78) hide show
  1. package/dist/bundle/faro-web-sdk.iife.js +1 -1
  2. package/dist/cjs/instrumentations/errors/registerOnerror.js +0 -3
  3. package/dist/cjs/instrumentations/errors/registerOnerror.js.map +1 -1
  4. package/dist/cjs/instrumentations/session/instrumentation.js +1 -2
  5. package/dist/cjs/instrumentations/session/instrumentation.js.map +1 -1
  6. package/dist/cjs/instrumentations/view/instrumentation.js +1 -2
  7. package/dist/cjs/instrumentations/view/instrumentation.js.map +1 -1
  8. package/dist/cjs/instrumentations/webVitals/instrumentation.js +6 -6
  9. package/dist/cjs/instrumentations/webVitals/instrumentation.js.map +1 -1
  10. package/dist/cjs/metas/browser/meta.js +4 -0
  11. package/dist/cjs/metas/browser/meta.js.map +1 -1
  12. package/dist/cjs/transports/fetch/transport.js +2 -0
  13. package/dist/cjs/transports/fetch/transport.js.map +1 -1
  14. package/dist/cjs/transports/otlp/otlpPayloadLogger.js +6 -0
  15. package/dist/cjs/transports/otlp/otlpPayloadLogger.js.map +1 -0
  16. package/dist/cjs/transports/otlp/payload/OtelPayload.js +56 -0
  17. package/dist/cjs/transports/otlp/payload/OtelPayload.js.map +1 -0
  18. package/dist/cjs/transports/otlp/payload/attribute/attributeUtils.js +53 -0
  19. package/dist/cjs/transports/otlp/payload/attribute/attributeUtils.js.map +1 -0
  20. package/dist/cjs/transports/otlp/payload/attribute/index.js +8 -0
  21. package/dist/cjs/transports/otlp/payload/attribute/index.js.map +1 -0
  22. package/dist/cjs/transports/otlp/payload/index.js +6 -0
  23. package/dist/cjs/transports/otlp/payload/index.js.map +1 -0
  24. package/dist/cjs/transports/otlp/payload/transform/index.js +7 -0
  25. package/dist/cjs/transports/otlp/payload/transform/index.js.map +1 -0
  26. package/dist/cjs/transports/otlp/payload/transform/transform.js +169 -0
  27. package/dist/cjs/transports/otlp/payload/transform/transform.js.map +1 -0
  28. package/dist/cjs/transports/otlp/payload/transform/types.js +3 -0
  29. package/dist/cjs/transports/otlp/payload/transform/types.js.map +1 -0
  30. package/dist/cjs/transports/otlp/payload/types.js +3 -0
  31. package/dist/cjs/transports/otlp/payload/types.js.map +1 -0
  32. package/dist/esm/instrumentations/errors/registerOnerror.js +0 -3
  33. package/dist/esm/instrumentations/errors/registerOnerror.js.map +1 -1
  34. package/dist/esm/instrumentations/session/instrumentation.js +1 -2
  35. package/dist/esm/instrumentations/session/instrumentation.js.map +1 -1
  36. package/dist/esm/instrumentations/view/instrumentation.js +1 -2
  37. package/dist/esm/instrumentations/view/instrumentation.js.map +1 -1
  38. package/dist/esm/instrumentations/webVitals/instrumentation.js +7 -7
  39. package/dist/esm/instrumentations/webVitals/instrumentation.js.map +1 -1
  40. package/dist/esm/metas/browser/meta.js +4 -0
  41. package/dist/esm/metas/browser/meta.js.map +1 -1
  42. package/dist/esm/transports/fetch/transport.js +3 -1
  43. package/dist/esm/transports/fetch/transport.js.map +1 -1
  44. package/dist/esm/transports/otlp/otlpPayloadLogger.js +3 -0
  45. package/dist/esm/transports/otlp/otlpPayloadLogger.js.map +1 -0
  46. package/dist/esm/transports/otlp/payload/OtelPayload.js +45 -0
  47. package/dist/esm/transports/otlp/payload/OtelPayload.js.map +1 -0
  48. package/dist/esm/transports/otlp/payload/attribute/attributeUtils.js +44 -0
  49. package/dist/esm/transports/otlp/payload/attribute/attributeUtils.js.map +1 -0
  50. package/dist/esm/transports/otlp/payload/attribute/index.js +2 -0
  51. package/dist/esm/transports/otlp/payload/attribute/index.js.map +1 -0
  52. package/dist/esm/transports/otlp/payload/index.js +2 -0
  53. package/dist/esm/transports/otlp/payload/index.js.map +1 -0
  54. package/dist/esm/transports/otlp/payload/transform/index.js +2 -0
  55. package/dist/esm/transports/otlp/payload/transform/index.js.map +1 -0
  56. package/dist/esm/transports/otlp/payload/transform/transform.js +158 -0
  57. package/dist/esm/transports/otlp/payload/transform/transform.js.map +1 -0
  58. package/dist/esm/transports/otlp/payload/transform/types.js +2 -0
  59. package/dist/esm/transports/otlp/payload/transform/types.js.map +1 -0
  60. package/dist/esm/transports/otlp/payload/types.js +2 -0
  61. package/dist/esm/transports/otlp/payload/types.js.map +1 -0
  62. package/dist/types/instrumentations/console/instrumentation.d.ts +1 -1
  63. package/dist/types/instrumentations/errors/instrumentation.d.ts +1 -1
  64. package/dist/types/instrumentations/session/instrumentation.d.ts +1 -1
  65. package/dist/types/instrumentations/view/instrumentation.d.ts +1 -1
  66. package/dist/types/instrumentations/webVitals/instrumentation.d.ts +1 -1
  67. package/dist/types/transports/console/transport.d.ts +1 -1
  68. package/dist/types/transports/fetch/transport.d.ts +1 -1
  69. package/dist/types/transports/otlp/otlpPayloadLogger.d.ts +1 -0
  70. package/dist/types/transports/otlp/payload/OtelPayload.d.ts +8 -0
  71. package/dist/types/transports/otlp/payload/attribute/attributeUtils.d.ts +4 -0
  72. package/dist/types/transports/otlp/payload/attribute/index.d.ts +1 -0
  73. package/dist/types/transports/otlp/payload/index.d.ts +2 -0
  74. package/dist/types/transports/otlp/payload/transform/index.d.ts +2 -0
  75. package/dist/types/transports/otlp/payload/transform/transform.d.ts +6 -0
  76. package/dist/types/transports/otlp/payload/transform/types.d.ts +28 -0
  77. package/dist/types/transports/otlp/payload/types.d.ts +6 -0
  78. package/package.json +3 -3
@@ -1 +1 @@
1
- var GrafanaFaroWebSdk=function(e){"use strict";var n="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{},t={},i={get exports(){return t},set exports(e){t=e}};function r(e,n){return typeof e===n}function o(e,n){return Object.prototype.toString.call(e)===`[object ${n}]`}function a(e,n){try{return e instanceof n}catch(e){return!1}}!function(e,t){!function(n,i){var r="function",o="undefined",a="object",s="string",u="model",l="name",c="type",d="vendor",p="version",f="architecture",g="console",b="mobile",m="tablet",v="smarttv",h="wearable",w="embedded",y="Amazon",E="Apple",x="ASUS",k="BlackBerry",T="Browser",L="Chrome",S="Firefox",O="Google",I="Huawei",N="LG",C="Microsoft",R="Motorola",A="Opera",j="Samsung",D="Sharp",P="Sony",z="Xiaomi",M="Zebra",F="Facebook",_=function(e){for(var n={},t=0;t<e.length;t++)n[e[t].toUpperCase()]=e[t];return n},$=function(e,n){return typeof e===s&&-1!==B(n).indexOf(B(e))},B=function(e){return e.toLowerCase()},U=function(e,n){if(typeof e===s)return e=e.replace(/^\s\s*/,"").replace(/\s\s*$/,""),typeof n===o?e:e.substring(0,350)},V=function(e,n){for(var t,o,s,u,l,c,d=0;d<n.length&&!l;){var p=n[d],f=n[d+1];for(t=o=0;t<p.length&&!l;)if(l=p[t++].exec(e))for(s=0;s<f.length;s++)c=l[++o],typeof(u=f[s])===a&&u.length>0?2===u.length?typeof u[1]==r?this[u[0]]=u[1].call(this,c):this[u[0]]=u[1]:3===u.length?typeof u[1]!==r||u[1].exec&&u[1].test?this[u[0]]=c?c.replace(u[1],u[2]):i:this[u[0]]=c?u[1].call(this,c,u[2]):i:4===u.length&&(this[u[0]]=c?u[3].call(this,c.replace(u[1],u[2])):i):this[u]=c||i;d+=2}},q=function(e,n){for(var t in n)if(typeof n[t]===a&&n[t].length>0){for(var r=0;r<n[t].length;r++)if($(n[t][r],e))return"?"===t?i:t}else if($(n[t],e))return"?"===t?i:t;return e},G={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"},W={browser:[[/\b(?:crmo|crios)\/([\w\.]+)/i],[p,[l,"Chrome"]],[/edg(?:e|ios|a)?\/([\w\.]+)/i],[p,[l,"Edge"]],[/(opera mini)\/([-\w\.]+)/i,/(opera [mobiletab]{3,6})\b.+version\/([-\w\.]+)/i,/(opera)(?:.+version\/|[\/ ]+)([\w\.]+)/i],[l,p],[/opios[\/ ]+([\w\.]+)/i],[p,[l,A+" Mini"]],[/\bopr\/([\w\.]+)/i],[p,[l,A]],[/(kindle)\/([\w\.]+)/i,/(lunascape|maxthon|netfront|jasmine|blazer)[\/ ]?([\w\.]*)/i,/(avant |iemobile|slim)(?:browser)?[\/ ]?([\w\.]*)/i,/(ba?idubrowser)[\/ ]?([\w\.]+)/i,/(?:ms|\()(ie) ([\w\.]+)/i,/(flock|rockmelt|midori|epiphany|silk|skyfire|ovibrowser|bolt|iron|vivaldi|iridium|phantomjs|bowser|quark|qupzilla|falkon|rekonq|puffin|brave|whale|qqbrowserlite|qq|duckduckgo)\/([-\w\.]+)/i,/(weibo)__([\d\.]+)/i],[l,p],[/(?:\buc? ?browser|(?:juc.+)ucweb)[\/ ]?([\w\.]+)/i],[p,[l,"UC"+T]],[/microm.+\bqbcore\/([\w\.]+)/i,/\bqbcore\/([\w\.]+).+microm/i],[p,[l,"WeChat(Win) Desktop"]],[/micromessenger\/([\w\.]+)/i],[p,[l,"WeChat"]],[/konqueror\/([\w\.]+)/i],[p,[l,"Konqueror"]],[/trident.+rv[: ]([\w\.]{1,9})\b.+like gecko/i],[p,[l,"IE"]],[/yabrowser\/([\w\.]+)/i],[p,[l,"Yandex"]],[/(avast|avg)\/([\w\.]+)/i],[[l,/(.+)/,"$1 Secure "+T],p],[/\bfocus\/([\w\.]+)/i],[p,[l,S+" Focus"]],[/\bopt\/([\w\.]+)/i],[p,[l,A+" Touch"]],[/coc_coc\w+\/([\w\.]+)/i],[p,[l,"Coc Coc"]],[/dolfin\/([\w\.]+)/i],[p,[l,"Dolphin"]],[/coast\/([\w\.]+)/i],[p,[l,A+" Coast"]],[/miuibrowser\/([\w\.]+)/i],[p,[l,"MIUI "+T]],[/fxios\/([-\w\.]+)/i],[p,[l,S]],[/\bqihu|(qi?ho?o?|360)browser/i],[[l,"360 "+T]],[/(oculus|samsung|sailfish|huawei)browser\/([\w\.]+)/i],[[l,/(.+)/,"$1 "+T],p],[/(comodo_dragon)\/([\w\.]+)/i],[[l,/_/g," "],p],[/(electron)\/([\w\.]+) safari/i,/(tesla)(?: qtcarbrowser|\/(20\d\d\.[-\w\.]+))/i,/m?(qqbrowser|baiduboxapp|2345Explorer)[\/ ]?([\w\.]+)/i],[l,p],[/(metasr)[\/ ]?([\w\.]+)/i,/(lbbrowser)/i,/\[(linkedin)app\]/i],[l],[/((?:fban\/fbios|fb_iab\/fb4a)(?!.+fbav)|;fbav\/([\w\.]+);)/i],[[l,F],p],[/safari (line)\/([\w\.]+)/i,/\b(line)\/([\w\.]+)\/iab/i,/(chromium|instagram)[\/ ]([-\w\.]+)/i],[l,p],[/\bgsa\/([\w\.]+) .*safari\//i],[p,[l,"GSA"]],[/headlesschrome(?:\/([\w\.]+)| )/i],[p,[l,L+" Headless"]],[/ wv\).+(chrome)\/([\w\.]+)/i],[[l,L+" WebView"],p],[/droid.+ version\/([\w\.]+)\b.+(?:mobile safari|safari)/i],[p,[l,"Android "+T]],[/(chrome|omniweb|arora|[tizenoka]{5} ?browser)\/v?([\w\.]+)/i],[l,p],[/version\/([\w\.\,]+) .*mobile\/\w+ (safari)/i],[p,[l,"Mobile Safari"]],[/version\/([\w(\.|\,)]+) .*(mobile ?safari|safari)/i],[p,l],[/webkit.+?(mobile ?safari|safari)(\/[\w\.]+)/i],[l,[p,q,{"1.0":"/8",1.2:"/1",1.3:"/3","2.0":"/412","2.0.2":"/416","2.0.3":"/417","2.0.4":"/419","?":"/"}]],[/(webkit|khtml)\/([\w\.]+)/i],[l,p],[/(navigator|netscape\d?)\/([-\w\.]+)/i],[[l,"Netscape"],p],[/mobile vr; rv:([\w\.]+)\).+firefox/i],[p,[l,S+" Reality"]],[/ekiohf.+(flow)\/([\w\.]+)/i,/(swiftfox)/i,/(icedragon|iceweasel|camino|chimera|fennec|maemo browser|minimo|conkeror|klar)[\/ ]?([\w\.\+]+)/i,/(seamonkey|k-meleon|icecat|iceape|firebird|phoenix|palemoon|basilisk|waterfox)\/([-\w\.]+)$/i,/(firefox)\/([\w\.]+)/i,/(mozilla)\/([\w\.]+) .+rv\:.+gecko\/\d+/i,/(polaris|lynx|dillo|icab|doris|amaya|w3m|netsurf|sleipnir|obigo|mosaic|(?:go|ice|up)[\. ]?browser)[-\/ ]?v?([\w\.]+)/i,/(links) \(([\w\.]+)/i],[l,p]],cpu:[[/(?:(amd|x(?:(?:86|64)[-_])?|wow|win)64)[;\)]/i],[[f,"amd64"]],[/(ia32(?=;))/i],[[f,B]],[/((?:i[346]|x)86)[;\)]/i],[[f,"ia32"]],[/\b(aarch64|arm(v?8e?l?|_?64))\b/i],[[f,"arm64"]],[/\b(arm(?:v[67])?ht?n?[fl]p?)\b/i],[[f,"armhf"]],[/windows (ce|mobile); ppc;/i],[[f,"arm"]],[/((?:ppc|powerpc)(?:64)?)(?: mac|;|\))/i],[[f,/ower/,"",B]],[/(sun4\w)[;\)]/i],[[f,"sparc"]],[/((?:avr32|ia64(?=;))|68k(?=\))|\barm(?=v(?:[1-7]|[5-7]1)l?|;|eabi)|(?=atmel )avr|(?:irix|mips|sparc)(?:64)?\b|pa-risc)/i],[[f,B]]],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,[d,j],[c,m]],[/\b((?:s[cgp]h|gt|sm)-\w+|galaxy nexus)/i,/samsung[- ]([-\w]+)/i,/sec-(sgh\w+)/i],[u,[d,j],[c,b]],[/\((ip(?:hone|od)[\w ]*);/i],[u,[d,E],[c,b]],[/\((ipad);[-\w\),; ]+apple/i,/applecoremedia\/[\w\.]+ \((ipad)/i,/\b(ipad)\d\d?,\d\d?[;\]].+ios/i],[u,[d,E],[c,m]],[/\b((?:ag[rs][23]?|bah2?|sht?|btv)-a?[lw]\d{2})\b(?!.+d\/s)/i],[u,[d,I],[c,m]],[/(?:huawei|honor)([-\w ]+)[;\)]/i,/\b(nexus 6p|\w{2,4}e?-[atu]?[ln][\dx][012359c][adn]?)\b(?!.+d\/s)/i],[u,[d,I],[c,b]],[/\b(poco[\w ]+)(?: bui|\))/i,/\b; (\w+) build\/hm\1/i,/\b(hm[-_ ]?note?[_ ]?(?:\d\w)?) bui/i,/\b(redmi[\-_ ]?(?:note|k)?[\w_ ]+)(?: bui|\))/i,/\b(mi[-_ ]?(?:a\d|one|one[_ ]plus|note lte|max|cc)?[_ ]?(?:\d?\w?)[_ ]?(?:plus|se|lite)?)(?: bui|\))/i],[[u,/_/g," "],[d,z],[c,b]],[/\b(mi[-_ ]?(?:pad)(?:[\w_ ]+))(?: bui|\))/i],[[u,/_/g," "],[d,z],[c,m]],[/; (\w+) bui.+ oppo/i,/\b(cph[12]\d{3}|p(?:af|c[al]|d\w|e[ar])[mt]\d0|x9007|a101op)\b/i],[u,[d,"OPPO"],[c,b]],[/vivo (\w+)(?: bui|\))/i,/\b(v[12]\d{3}\w?[at])(?: bui|;)/i],[u,[d,"Vivo"],[c,b]],[/\b(rmx[12]\d{3})(?: bui|;|\))/i],[u,[d,"Realme"],[c,b]],[/\b(milestone|droid(?:[2-4x]| (?:bionic|x2|pro|razr))?:?( 4g)?)\b[\w ]+build\//i,/\bmot(?:orola)?[- ](\w*)/i,/((?:moto[\w\(\) ]+|xt\d{3,4}|nexus 6)(?= bui|\)))/i],[u,[d,R],[c,b]],[/\b(mz60\d|xoom[2 ]{0,2}) build\//i],[u,[d,R],[c,m]],[/((?=lg)?[vl]k\-?\d{3}) bui| 3\.[-\w; ]{10}lg?-([06cv9]{3,4})/i],[u,[d,N],[c,m]],[/(lm(?:-?f100[nv]?|-[\w\.]+)(?= bui|\))|nexus [45])/i,/\blg[-e;\/ ]+((?!browser|netcast|android tv)\w+)/i,/\blg-?([\d\w]+) bui/i],[u,[d,N],[c,b]],[/(ideatab[-\w ]+)/i,/lenovo ?(s[56]000[-\w]+|tab(?:[\w ]+)|yt[-\d\w]{6}|tb[-\d\w]{6})/i],[u,[d,"Lenovo"],[c,m]],[/(?:maemo|nokia).*(n900|lumia \d+)/i,/nokia[-_ ]?([-\w\.]*)/i],[[u,/_/g," "],[d,"Nokia"],[c,b]],[/(pixel c)\b/i],[u,[d,O],[c,m]],[/droid.+; (pixel[\daxl ]{0,6})(?: bui|\))/i],[u,[d,O],[c,b]],[/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],[u,[d,P],[c,b]],[/sony tablet [ps]/i,/\b(?:sony)?sgp\w+(?: bui|\))/i],[[u,"Xperia Tablet"],[d,P],[c,m]],[/ (kb2005|in20[12]5|be20[12][59])\b/i,/(?:one)?(?:plus)? (a\d0\d\d)(?: b|\))/i],[u,[d,"OnePlus"],[c,b]],[/(alexa)webm/i,/(kf[a-z]{2}wi)( bui|\))/i,/(kf[a-z]+)( bui|\)).+silk\//i],[u,[d,y],[c,m]],[/((?:sd|kf)[0349hijorstuw]+)( bui|\)).+silk\//i],[[u,/(.+)/g,"Fire Phone $1"],[d,y],[c,b]],[/(playbook);[-\w\),; ]+(rim)/i],[u,d,[c,m]],[/\b((?:bb[a-f]|st[hv])100-\d)/i,/\(bb10; (\w+)/i],[u,[d,k],[c,b]],[/(?:\b|asus_)(transfo[prime ]{4,10} \w+|eeepc|slider \w+|nexus 7|padfone|p00[cj])/i],[u,[d,x],[c,m]],[/ (z[bes]6[027][012][km][ls]|zenfone \d\w?)\b/i],[u,[d,x],[c,b]],[/(nexus 9)/i],[u,[d,"HTC"],[c,m]],[/(htc)[-;_ ]{1,2}([\w ]+(?=\)| bui)|\w+)/i,/(zte)[- ]([\w ]+?)(?: bui|\/|\))/i,/(alcatel|geeksphone|nexian|panasonic|sony(?!-bra))[-_ ]?([-\w]*)/i],[d,[u,/_/g," "],[c,b]],[/droid.+; ([ab][1-7]-?[0178a]\d\d?)/i],[u,[d,"Acer"],[c,m]],[/droid.+; (m[1-5] note) bui/i,/\bmz-([-\w]{2,})/i],[u,[d,"Meizu"],[c,b]],[/\b(sh-?[altvz]?\d\d[a-ekm]?)/i],[u,[d,D],[c,b]],[/(blackberry|benq|palm(?=\-)|sonyericsson|acer|asus|dell|meizu|motorola|polytron)[-_ ]?([-\w]*)/i,/(hp) ([\w ]+\w)/i,/(asus)-?(\w+)/i,/(microsoft); (lumia[\w ]+)/i,/(lenovo)[-_ ]?([-\w]+)/i,/(jolla)/i,/(oppo) ?([\w ]+) bui/i],[d,u,[c,b]],[/(archos) (gamepad2?)/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],[d,u,[c,m]],[/(surface duo)/i],[u,[d,C],[c,m]],[/droid [\d\.]+; (fp\du?)(?: b|\))/i],[u,[d,"Fairphone"],[c,b]],[/(u304aa)/i],[u,[d,"AT&T"],[c,b]],[/\bsie-(\w*)/i],[u,[d,"Siemens"],[c,b]],[/\b(rct\w+) b/i],[u,[d,"RCA"],[c,m]],[/\b(venue[\d ]{2,7}) b/i],[u,[d,"Dell"],[c,m]],[/\b(q(?:mv|ta)\w+) b/i],[u,[d,"Verizon"],[c,m]],[/\b(?:barnes[& ]+noble |bn[rt])([\w\+ ]*) b/i],[u,[d,"Barnes & Noble"],[c,m]],[/\b(tm\d{3}\w+) b/i],[u,[d,"NuVision"],[c,m]],[/\b(k88) b/i],[u,[d,"ZTE"],[c,m]],[/\b(nx\d{3}j) b/i],[u,[d,"ZTE"],[c,b]],[/\b(gen\d{3}) b.+49h/i],[u,[d,"Swiss"],[c,b]],[/\b(zur\d{3}) b/i],[u,[d,"Swiss"],[c,m]],[/\b((zeki)?tb.*\b) b/i],[u,[d,"Zeki"],[c,m]],[/\b([yr]\d{2}) b/i,/\b(dragon[- ]+touch |dt)(\w{5}) b/i],[[d,"Dragon Touch"],u,[c,m]],[/\b(ns-?\w{0,9}) b/i],[u,[d,"Insignia"],[c,m]],[/\b((nxa|next)-?\w{0,9}) b/i],[u,[d,"NextBook"],[c,m]],[/\b(xtreme\_)?(v(1[045]|2[015]|[3469]0|7[05])) b/i],[[d,"Voice"],u,[c,b]],[/\b(lvtel\-)?(v1[12]) b/i],[[d,"LvTel"],u,[c,b]],[/\b(ph-1) /i],[u,[d,"Essential"],[c,b]],[/\b(v(100md|700na|7011|917g).*\b) b/i],[u,[d,"Envizen"],[c,m]],[/\b(trio[-\w\. ]+) b/i],[u,[d,"MachSpeed"],[c,m]],[/\btu_(1491) b/i],[u,[d,"Rotor"],[c,m]],[/(shield[\w ]+) b/i],[u,[d,"Nvidia"],[c,m]],[/(sprint) (\w+)/i],[d,u,[c,b]],[/(kin\.[onetw]{3})/i],[[u,/\./g," "],[d,C],[c,b]],[/droid.+; (cc6666?|et5[16]|mc[239][23]x?|vc8[03]x?)\)/i],[u,[d,M],[c,m]],[/droid.+; (ec30|ps20|tc[2-8]\d[kx])\)/i],[u,[d,M],[c,b]],[/(ouya)/i,/(nintendo) ([wids3utch]+)/i],[d,u,[c,g]],[/droid.+; (shield) bui/i],[u,[d,"Nvidia"],[c,g]],[/(playstation [345portablevi]+)/i],[u,[d,P],[c,g]],[/\b(xbox(?: one)?(?!; xbox))[\); ]/i],[u,[d,C],[c,g]],[/smart-tv.+(samsung)/i],[d,[c,v]],[/hbbtv.+maple;(\d+)/i],[[u,/^/,"SmartTV"],[d,j],[c,v]],[/(nux; netcast.+smarttv|lg (netcast\.tv-201\d|android tv))/i],[[d,N],[c,v]],[/(apple) ?tv/i],[d,[u,E+" TV"],[c,v]],[/crkey/i],[[u,L+"cast"],[d,O],[c,v]],[/droid.+aft(\w)( bui|\))/i],[u,[d,y],[c,v]],[/\(dtv[\);].+(aquos)/i,/(aquos-tv[\w ]+)\)/i],[u,[d,D],[c,v]],[/(bravia[\w ]+)( bui|\))/i],[u,[d,P],[c,v]],[/(mitv-\w{5}) bui/i],[u,[d,z],[c,v]],[/\b(roku)[\dx]*[\)\/]((?:dvp-)?[\d\.]*)/i,/hbbtv\/\d+\.\d+\.\d+ +\([\w ]*; *(\w[^;]*);([^;]*)/i],[[d,U],[u,U],[c,v]],[/\b(android tv|smart[- ]?tv|opera tv|tv; rv:)\b/i],[[c,v]],[/((pebble))app/i],[d,u,[c,h]],[/droid.+; (glass) \d/i],[u,[d,O],[c,h]],[/droid.+; (wt63?0{2,3})\)/i],[u,[d,M],[c,h]],[/(quest( 2)?)/i],[u,[d,F],[c,h]],[/(tesla)(?: qtcarbrowser|\/[-\w\.]+)/i],[d,[c,w]],[/droid .+?; ([^;]+?)(?: bui|\) applew).+? mobile safari/i],[u,[c,b]],[/droid .+?; ([^;]+?)(?: bui|\) applew).+?(?! mobile) safari/i],[u,[c,m]],[/\b((tablet|tab)[;\/]|focus\/\d(?!.+mobile))/i],[[c,m]],[/(phone|mobile(?:[;\/]| [ \w\/\.]*safari)|pda(?=.+windows ce))/i],[[c,b]],[/(android[-\w\. ]{0,9});.+buil/i],[u,[d,"Generic"]]],engine:[[/windows.+ edge\/([\w\.]+)/i],[p,[l,"EdgeHTML"]],[/webkit\/537\.36.+chrome\/(?!27)([\w\.]+)/i],[p,[l,"Blink"]],[/(presto)\/([\w\.]+)/i,/(webkit|trident|netfront|netsurf|amaya|lynx|w3m|goanna)\/([\w\.]+)/i,/ekioh(flow)\/([\w\.]+)/i,/(khtml|tasman|links)[\/ ]\(?([\w\.]+)/i,/(icab)[\/ ]([23]\.[\d\.]+)/i],[l,p],[/rv\:([\w\.]{1,9})\b.+(gecko)/i],[p,l]],os:[[/microsoft (windows) (vista|xp)/i],[l,p],[/(windows) nt 6\.2; (arm)/i,/(windows (?:phone(?: os)?|mobile))[\/ ]?([\d\.\w ]*)/i,/(windows)[\/ ]?([ntce\d\. ]+\w)(?!.+xbox)/i],[l,[p,q,G]],[/(win(?=3|9|n)|win 9x )([nt\d\.]+)/i],[[l,"Windows"],[p,q,G]],[/ip[honead]{2,4}\b(?:.*os ([\w]+) like mac|; opera)/i,/cfnetwork\/.+darwin/i],[[p,/_/g,"."],[l,"iOS"]],[/(mac os x) ?([\w\. ]*)/i,/(macintosh|mac_powerpc\b)(?!.+haiku)/i],[[l,"Mac OS"],[p,/_/g,"."]],[/droid ([\w\.]+)\b.+(android[- ]x86|harmonyos)/i],[p,l],[/(android|webos|qnx|bada|rim tablet os|maemo|meego|sailfish)[-\/ ]?([\w\.]*)/i,/(blackberry)\w*\/([\w\.]*)/i,/(tizen|kaios)[\/ ]([\w\.]+)/i,/\((series40);/i],[l,p],[/\(bb(10);/i],[p,[l,k]],[/(?:symbian ?os|symbos|s60(?=;)|series60)[-\/ ]?([\w\.]*)/i],[p,[l,"Symbian"]],[/mozilla\/[\d\.]+ \((?:mobile|tablet|tv|mobile; [\w ]+); rv:.+ gecko\/([\w\.]+)/i],[p,[l,S+" OS"]],[/web0s;.+rt(tv)/i,/\b(?:hp)?wos(?:browser)?\/([\w\.]+)/i],[p,[l,"webOS"]],[/crkey\/([\d\.]+)/i],[p,[l,L+"cast"]],[/(cros) [\w]+ ([\w\.]+\w)/i],[[l,"Chromium OS"],p],[/(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) ?([\w\.]*)/i,/(gnu) ?([\w\.]*)/i,/\b([-frentopcghs]{0,5}bsd|dragonfly)[\/ ]?(?!amd|[ix346]{1,2}86)([\w\.]*)/i,/(haiku) (\w+)/i],[l,p],[/(sunos) ?([\w\.\d]*)/i],[[l,"Solaris"],p],[/((?:open)?solaris)[-\/ ]?([\w\.]*)/i,/(aix) ((\d)(?=\.|\)| )[\w\.])*/i,/\b(beos|os\/2|amigaos|morphos|openvms|fuchsia|hp-ux)/i,/(unix) ?([\w\.]*)/i],[l,p]]},K=function(e,t){if(typeof e===a&&(t=e,e=i),!(this instanceof K))return new K(e,t).getResult();var r=e||(typeof n!==o&&n.navigator&&n.navigator.userAgent?n.navigator.userAgent:""),g=t?function(e,n){var t={};for(var i in e)n[i]&&n[i].length%2==0?t[i]=n[i].concat(e[i]):t[i]=e[i];return t}(W,t):W;return this.getBrowser=function(){var e,n={};return n[l]=i,n[p]=i,V.call(n,r,g.browser),n.major=typeof(e=n.version)===s?e.replace(/[^\d\.]/g,"").split(".")[0]:i,n},this.getCPU=function(){var e={};return e[f]=i,V.call(e,r,g.cpu),e},this.getDevice=function(){var e={};return e[d]=i,e[u]=i,e[c]=i,V.call(e,r,g.device),e},this.getEngine=function(){var e={};return e[l]=i,e[p]=i,V.call(e,r,g.engine),e},this.getOS=function(){var e={};return e[l]=i,e[p]=i,V.call(e,r,g.os),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 r},this.setUA=function(e){return r=typeof e===s&&e.length>350?U(e,350):e,this},this.setUA(r),this};K.VERSION="1.0.32",K.BROWSER=_([l,p,"major"]),K.CPU=_([f]),K.DEVICE=_([u,d,c,g,b,v,m,h,w]),K.ENGINE=K.OS=_([l,p]),e.exports&&(t=e.exports=K),t.UAParser=K;var H=typeof n!==o&&(n.jQuery||n.Zepto);if(H&&!H.ua){var X=new K;H.ua=X.getResult(),H.ua.get=function(){return X.getUA()},H.ua.set=function(e){X.setUA(e);var n=X.getResult();for(var t in n)H.ua[t]=n[t]}}}("object"==typeof window?window:n)}(i,t);const s=e=>r(e,"undefined"),u=e=>r(e,"null"),l=e=>r(e,"string"),c=e=>r(e,"number")&&!isNaN(e)||r(e,"bigint"),d=e=>!u(e)&&r(e,"object"),p=e=>r(e,"function"),f=e=>o(e,"Array"),g=e=>!d(e)&&!p(e),b=!s(Event),m=e=>b&&a(e,Event),v="undefined"!=typeof Error,h=e=>v&&a(e,Error),w=e=>o(e,"ErrorEvent"),y=e=>o(e,"DOMError"),E=e=>o(e,"DOMException"),x="undefined"!=typeof Element,k="undefined"!=typeof Map;function T(e,n){if(e===n)return!0;if(r(e,"number")&&isNaN(e))return r(n,"number")&&isNaN(n);const t=f(e),i=f(n);if(t!==i)return!1;if(t&&i){const t=e.length;if(t!==n.length)return!1;for(let i=t;0!=i--;)if(!T(e[i],n[i]))return!1;return!0}const o=d(e),a=d(n);if(o!==a)return!1;if(e&&n&&o&&a){const t=Object.keys(e),i=Object.keys(n);if(t.length!==i.length)return!1;for(let e of t)if(!i.includes(e))return!1;for(let i of t)if(!T(e[i],n[i]))return!1;return!0}return!1}function L(){return(new Date).toISOString()}var S;e.LogLevel=void 0,(S=e.LogLevel||(e.LogLevel={})).TRACE="trace",S.DEBUG="debug",S.INFO="info",S.LOG="log",S.WARN="warn",S.ERROR="error";const O=e.LogLevel.LOG,I=[e.LogLevel.TRACE,e.LogLevel.DEBUG,e.LogLevel.INFO,e.LogLevel.LOG,e.LogLevel.WARN,e.LogLevel.ERROR];function N(){}function C(e){const{size:n,concurrency:t}=e,i=[];let r=0;const o=()=>{if(r<t&&i.length){const{producer:e,resolve:n,reject:t}=i.shift();r++,e().then((e=>{r--,o(),n(e)}),(e=>{r--,o(),t(e)}))}};return{add:e=>{if(i.length+r>=n)throw new Error("Task buffer full");return new Promise(((n,t)=>{i.push({producer:e,resolve:n,reject:t}),o()}))}}}const R="abcdefghijkmnopqrstuvwxyzABCDEFGHJKLMNPQRSTUVWXYZ0123456789";function A(e=10){return Array.from(Array(e)).map((()=>R[Math.floor(Math.random()*R.length)])).join("")}var j;e.TransportItemType=void 0,(j=e.TransportItemType||(e.TransportItemType={})).EXCEPTION="exception",j.LOG="log",j.MEASUREMENT="measurement",j.TRACE="trace",j.EVENT="event";const D={[e.TransportItemType.EXCEPTION]:"exceptions",[e.TransportItemType.LOG]:"logs",[e.TransportItemType.MEASUREMENT]:"measurements",[e.TransportItemType.TRACE]:"traces",[e.TransportItemType.EVENT]:"events"};function P(n){return t=>{if(t.type===e.TransportItemType.EXCEPTION&&t.payload){const e=t.payload,i=`${e.type}: ${e.value}`;if(function(e,n){return e.some((e=>l(e)?n.includes(e):!!n.match(e)))}(n,i))return null}return t}}var z;e.InternalLoggerLevel=void 0,(z=e.InternalLoggerLevel||(e.InternalLoggerLevel={}))[z.OFF=0]="OFF",z[z.ERROR=1]="ERROR",z[z.WARN=2]="WARN",z[z.INFO=3]="INFO",z[z.VERBOSE=4]="VERBOSE";const M={debug:N,error:N,info:N,prefix:"Faro",warn:N},F=e.InternalLoggerLevel.ERROR,_=Object.assign({},console);let $=_;function B(e){var n;return $=null!==(n=e.unpatchedConsole)&&void 0!==n?n:$,$}function U(n=_,t=F){const i=M;return t>e.InternalLoggerLevel.OFF&&(i.error=t>=e.InternalLoggerLevel.ERROR?function(...e){n.error(`${i.prefix}\n`,...e)}:N,i.warn=t>=e.InternalLoggerLevel.WARN?function(...e){n.warn(`${i.prefix}\n`,...e)}:N,i.info=t>=e.InternalLoggerLevel.INFO?function(...e){n.info(`${i.prefix}\n`,...e)}:N,i.debug=t>=e.InternalLoggerLevel.VERBOSE?function(...e){n.debug(`${i.prefix}\n`,...e)}:N),i}let V=M;function q(e,n){return V=U(e,n.internalLoggerLevel),V}class G{constructor(){this.unpatchedConsole=_,this.internalLogger=M,this.config={},this.metas={}}logDebug(...e){this.internalLogger.debug(`${this.name}\n`,...e)}logInfo(...e){this.internalLogger.info(`${this.name}\n`,...e)}logWarn(...e){this.internalLogger.warn(`${this.name}\n`,...e)}logError(...e){this.internalLogger.error(`${this.name}\n`,...e)}}class W extends G{getIgnoreUrls(){return[]}}function K(n){return{[D[n.type]]:n.type===e.TransportItemType.TRACE?n.payload:[n.payload],meta:n.meta}}const H="Error";let X;function Z(n,t,i,r,o){t.debug("Initializing API");const a=function(n,t,i,r,o){let a;return t.debug("Initializing traces API"),{getOTEL:()=>a,getTraceContext:()=>{const e=null==a?void 0:a.trace.getSpanContext(a.context.active());return e?{trace_id:e.traceId,span_id:e.spanId}:void 0},initOTEL:(e,n)=>{t.debug("Initializing OpenTelemetry"),a={trace:e,context:n}},isOTELInitialized:()=>!!a,pushTraces:n=>{try{const i={type:e.TransportItemType.TRACE,payload:n,meta:r.value};t.debug("Pushing trace\n",i),o.execute(i)}catch(e){t.error("Error pushing trace\n",e)}}}}(0,t,0,r,o);return Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({},a),function(n,t,i,r,o,a){var s;t.debug("Initializing exceptions API");let l=null;X=null!==(s=i.parseStacktrace)&&void 0!==s?s:X;const c=e=>{t.debug("Changing stacktrace parser"),X=null!=e?e:X};return c(i.parseStacktrace),{changeStacktraceParser:c,getStacktraceParser:()=>X,pushError:(n,{skipDedupe:s,stackFrames:c,type:d}={})=>{d=d||n.name||H;const p={meta:r.value,payload:{type:d,value:n.message,timestamp:L(),trace:a.getTraceContext()},type:e.TransportItemType.EXCEPTION};(null==(c=null!=c?c:n.stack?null==X?void 0:X(n).frames:void 0)?void 0:c.length)&&(p.payload.stacktrace={frames:c});const f={type:p.payload.type,value:p.payload.value,stackTrace:p.payload.stacktrace};s||!i.dedupe||u(l)||!T(f,l)?(l=f,t.debug("Pushing exception\n",p),o.execute(p)):t.debug("Skipping error push because it is the same as the last one\n",p.payload)}}}(0,t,i,r,o,a)),function(e,n,t,i,r){let o,a,s;n.debug("Initializing meta API");const u=e=>{a&&i.remove(a),a={user:e},i.add(a)},l=e=>{o&&i.remove(o),o={session:e},i.add(o)};return{setUser:u,resetUser:u,setSession:l,resetSession:l,getSession:()=>i.value.session,setView:e=>{s&&i.remove(s),s={view:e},i.add(s)},getView:()=>i.value.view}}(0,t,0,r)),function(n,t,i,r,o,a){t.debug("Initializing logs API");let s=null;return{pushLog:(n,{context:l,level:c,skipDedupe:d}={})=>{try{const p={type:e.TransportItemType.LOG,payload:{message:n.map((e=>{try{return String(e)}catch(e){return""}})).join(" "),level:null!=c?c:O,context:null!=l?l:{},timestamp:L(),trace:a.getTraceContext()},meta:r.value},f={message:p.payload.message,level:p.payload.level,context:p.payload.context};if(!d&&i.dedupe&&!u(s)&&T(f,s))return void t.debug("Skipping log push because it is the same as the last one\n",p.payload);s=f,t.debug("Pushing log\n",p),o.execute(p)}catch(e){t.error("Error pushing log\n",e)}}}}(0,t,i,r,o,a)),function(n,t,i,r,o,a){t.debug("Initializing measurements API");let s=null;return{pushMeasurement:(n,{skipDedupe:l}={})=>{try{const c={type:e.TransportItemType.MEASUREMENT,payload:Object.assign(Object.assign({},n),{trace:a.getTraceContext()}),meta:r.value},d={type:c.payload.type,values:c.payload.values};if(!l&&i.dedupe&&!u(s)&&T(d,s))return void t.debug("Skipping measurement push because it is the same as the last one\n",c.payload);s=d,t.debug("Pushing measurement\n",c),o.execute(c)}catch(e){t.error("Error pushing measurement\n",e)}}}}(0,t,i,r,o,a)),function(n,t,i,r,o,a){let s=null;return{pushEvent:(n,l,c,{skipDedupe:d}={})=>{try{const p={meta:r.value,payload:{name:n,domain:null!=c?c:i.eventDomain,attributes:l,timestamp:L(),trace:a.getTraceContext()},type:e.TransportItemType.EVENT},f={name:p.payload.name,attributes:p.payload.attributes,domain:p.payload.domain};if(!d&&i.dedupe&&!u(s)&&T(f,s))return void t.debug("Skipping event push because it is the same as the last one\n",p.payload);s=f,t.debug("Pushing event\n",p),o.execute(p)}catch(e){t.error("Error pushing event",e)}}}}(0,t,i,r,o,a))}const J="undefined"==typeof window?global:window;class Q extends G{constructor(){super(...arguments),this.api={},this.transports={}}}const Y="1.0.0";const ee="_faroInternal";function ne(e){e.config.isolate?e.internalLogger.debug("Skipping registering internal Faro instance on global object"):(e.internalLogger.debug("Registering internal Faro instance on global object"),Object.defineProperty(J,ee,{configurable:!1,enumerable:!1,writable:!1,value:e}))}function te(){return ee in J}function ie(n,t,i,r,o,a,s){return t.debug("Initializing Faro"),e.faro={api:a,config:i,instrumentations:s,internalLogger:t,metas:r,pause:o.pause,transports:o,unpatchedConsole:n,unpause:o.unpause},ne(e.faro),function(e){if(e.config.preventGlobalExposure)e.internalLogger.debug("Skipping registering public Faro instance in the global scope");else{if(e.internalLogger.debug(`Registering public faro reference in the global scope using "${e.config.globalObjectKey}" key`),e.config.globalObjectKey in J)return void e.internalLogger.warn(`Skipping global registration due to key "${e.config.globalObjectKey}" being used already. Please set "globalObjectKey" to something else or set "preventGlobalExposure" to "true"`);Object.defineProperty(J,e.config.globalObjectKey,{configurable:!1,writable:!1,value:e})}}(e.faro),e.faro}function re(e){const n=B(e),t=q(n,e);if(te()&&!e.isolate)return void t.error('Faro is already registered. Either add instrumentations, transports etc. to the global faro instance or use the "isolate" property');t.debug("Initializing");const i=function(e,n,t){let i=[],r=[];const o=()=>i.reduce(((e,n)=>Object.assign(e,p(n)?n():n)),{}),a=()=>{if(r.length){const e=o();r.forEach((n=>n(e)))}};return{add:(...e)=>{n.debug("Adding metas\n",e),i.push(...e),a()},remove:(...e)=>{n.debug("Removing metas\n",e),i=i.filter((n=>!e.includes(n))),a()},addListener:e=>{n.debug("Adding metas listener\n",e),r.push(e)},removeListener:e=>{n.debug("Removing metas listener\n",e),r=r.filter((n=>n!==e))},get value(){return o()}}}(0,t),r=function(e,n,t,i){n.debug("Initializing transports");const r=[];let o=t.paused,a=[];return{add:(...o)=>{n.debug("Adding transports"),o.forEach((o=>{n.debug(`Adding "${o.name}" transport`),r.some((e=>e===o))?n.warn(`Transport ${o.name} is already added`):(o.unpatchedConsole=e,o.internalLogger=n,o.config=t,o.metas=i,r.push(o))}))},addBeforeSendHooks:(...e)=>{n.debug("Adding beforeSendHooks\n",a),e.forEach((e=>{e&&a.push(e)}))},addIgnoreErrorsPatterns:(...e)=>{n.debug("Adding ignoreErrorsPatterns\n",e),e.forEach((e=>{e&&a.push(P(e))}))},getBeforeSendHooks:()=>[...a],execute:e=>{if(!o){let t=e;for(const e of a){const n=e(t);if(null===n)return;t=n}for(const e of r)n.debug(`Transporting item using ${e.name}\n`,t),e.send(t)}},isPaused:()=>o,pause:()=>{n.debug("Pausing transports"),o=!0},remove:(...e)=>{n.debug("Removing transports"),e.forEach((e=>{n.debug(`Removing "${e.name}" transport`);const t=r.indexOf(e);-1!==t?r.splice(t,1):n.warn(`Transport "${e.name}" is not added`)}))},removeBeforeSendHooks:(...e)=>{a.filter((n=>!e.includes(n)))},get transports(){return[...r]},unpause:()=>{n.debug("Unpausing transports"),o=!1}}}(n,t,e,i),o=Z(0,t,e,i,r),a=function(e,n,t,i,r,o){n.debug("Initializing instrumentations");const a=[];return{add:(...s)=>{n.debug("Adding instrumentations"),s.forEach((s=>{n.debug(`Adding "${s.name}" instrumentation`),a.some((e=>e.name===s.name))?n.warn(`Instrumentation ${s.name} is already added`):(s.unpatchedConsole=e,s.internalLogger=n,s.config=t,s.metas=i,s.transports=r,s.api=o,a.push(s),s.initialize())}))},get instrumentations(){return[...a]},remove:(...e)=>{n.debug("Removing instrumentations"),e.forEach((e=>{var t,i;n.debug(`Removing "${e.name}" instrumentation`);const r=a.reduce(((n,t,i)=>null===n&&t.name===e.name?i:null),null);r?(null===(i=(t=a[r]).destroy)||void 0===i||i.call(t),a.splice(r,1)):n.warn(`Instrumentation "${e.name}" is not added`)}))}}}(n,t,e,i,r,o),s=ie(n,t,e,i,r,o,a);return function(e){var n;const t={sdk:{name:"@grafana/faro-core",version:Y,integrations:e.config.instrumentations.map((({name:e,version:n})=>({name:e,version:n})))}};e.config.session&&e.api.setSession(e.config.session),e.config.app&&(t.app=e.config.app),e.config.user&&(t.user=e.config.user),e.config.view&&(t.view=e.config.view),e.metas.add(t,...null!==(n=e.config.metas)&&void 0!==n?n:[])}(s),function(e){e.transports.add(...e.config.transports),e.transports.addBeforeSendHooks(e.config.beforeSend),e.transports.addIgnoreErrorsPatterns(e.config.ignoreErrors)}(s),function(e){e.instrumentations.add(...e.config.instrumentations)}(s),s}e.faro={};const oe="faro",ae={EventNames:{CLICK:"click",NAVIGATION:"navigation",SESSION_START:"session_start",VIEW_CHANGED:"view_changed"}};class se extends Q{constructor(){super(...arguments),this.name="@grafana/faro-web-sdk:instrumentation-session",this.version=t.VERSION}sendSessionStartEvent(e){const n=e.session;n&&n!==this.notifiedSession&&(this.notifiedSession=n,this.api.pushEvent(ae.EventNames.SESSION_START,{},void 0,{skipDedupe:!0}))}initialize(){this.sendSessionStartEvent(this.metas.value),this.metas.addListener(this.sendSessionStartEvent.bind(this))}}class ue extends Q{constructor(e={}){super(),this.options=e,this.name="@grafana/faro-web-sdk:instrumentation-console",this.version=Y}initialize(){this.logDebug("Initializing\n",this.options),I.filter((e=>{var n;return!(null!==(n=this.options.disabledLevels)&&void 0!==n?n:ue.defaultDisabledLevels).includes(e)})).forEach((e=>{console[e]=(...n)=>{try{this.api.pushLog(n,{level:e})}catch(e){this.logError(e)}finally{this.unpatchedConsole[e](...n)}}}))}}ue.defaultDisabledLevels=[e.LogLevel.DEBUG,e.LogLevel.TRACE,e.LogLevel.LOG];const le=/^(?:[Uu]ncaught (?:exception: )?)?(?:((?:Eval|Internal|Range|Reference|Syntax|Type|URI|)Error): )?(.*)$/i,ce=/^\s*at (?:(.*\).*?|.*?) ?\((?:address at )?)?((?:file|https?|blob|chrome-extension|address|native|eval|webpack|<anonymous>|[-a-z]+:|.*bundle|\/)?.*?)(?::(\d+))?(?::(\d+))?\)?\s*$/i,de=/\((\S*)(?::(\d+))(?::(\d+))\)/,pe="address at ",fe=pe.length,ge=/^\s*(.*?)(?:\((.*?)\))?(?:^|@)?((?:file|https?|blob|chrome|webpack|resource|moz-extension|safari-extension|safari-web-extension|capacitor)?:\/.*?|\[native code]|[^@]*(?:bundle|\d+\.js)|\/[\w\-. /=]+)(?::(\d+))?(?::(\d+))?\s*$/i,be=/(\S+) line (\d+)(?: > eval line \d+)* > eval/i,me="safari-extension",ve="safari-web-extension",he=/Minified React error #\d+;/i;function we(e,n,t,i){const r={filename:e||document.location.href,function:n||"?"};return void 0!==t&&(r.lineno=t),void 0!==i&&(r.colno=i),r}function ye(e,n){const t=null==e?void 0:e.includes(me),i=!t&&(null==e?void 0:e.includes(ve));return t||i?[(null==e?void 0:e.includes("@"))?e.split("@")[0]:e,t?`${me}:${n}`:`${ve}:${n}`]:[e,n]}function Ee(e){let n=[];e.stacktrace?n=e.stacktrace.split("\n").filter(((e,n)=>n%2==0)):e.stack&&(n=e.stack.split("\n"));const t=n.reduce(((n,t,i)=>{let r,o,a,s,u;if(r=ce.exec(t)){if(o=r[1],a=r[2],s=r[3],u=r[4],null==a?void 0:a.startsWith("eval")){const e=de.exec(a);e&&(a=e[1],s=e[2],u=e[3])}a=(null==a?void 0:a.startsWith(pe))?a.substring(fe):a,[o,a]=ye(o,a)}else if(r=ge.exec(t)){if(o=r[1],a=r[3],s=r[4],u=r[5],a&&a.includes(" > eval")){const e=be.exec(a);e&&(o=o||"eval",a=e[1],s=e[2])}else 0===i&&!u&&c(e.columnNumber)&&(u=String(e.columnNumber+1));[o,a]=ye(o,a)}return(a||o)&&n.push(we(a,o,s?Number(s):void 0,u?Number(u):void 0)),n}),[]);return he.test(e.message)?t.slice(1):t}function xe(e){return{frames:Ee(e)}}function ke(e){let n,t,i,r,o=[];if(w(e)&&e.error)n=e.error.message,t=e.error.name,o=Ee(e.error);else if((i=y(e))||E(e)){const{name:r,message:o}=e;t=null!=r?r:i?"DOMError":"DOMException",n=o?`${t}: ${o}`:t}else h(e)?(n=e.message,o=Ee(e)):(d(e)||(r=m(e)))&&(t=r?e.constructor.name:void 0,n=`Non-Error exception captured with keys: ${Object.keys(e)}`);return[n,t,o]}function Te(e){const n=window.onerror;window.onerror=(...t)=>{try{const[i,r,o,a,s]=t;let u,c,d=[];const p=l(i),f=we(r,"?",o,a);s||!p?([u,c,d]=ke(null!=s?s:i),0===d.length&&(d=[f])):p&&([u,c]=function(e){var n,t;const i=e.match(le),r=null!==(n=null==i?void 0:i[1])&&void 0!==n?n:H;return[null!==(t=null==i?void 0:i[2])&&void 0!==t?t:e,r]}(i),d=[f]),u&&e.pushError(new Error(u),{type:c,stackFrames:d})}finally{null==n||n.apply(window,t)}}}class Le extends Q{constructor(){super(...arguments),this.name="@grafana/faro-web-sdk:instrumentation-errors",this.version=Y}initialize(){var e;this.logDebug("Initializing"),Te(this.api),e=this.api,window.addEventListener("unhandledrejection",(n=>{var t,i;let r,o,a=n;a.reason?a=n.reason:(null===(t=n.detail)||void 0===t?void 0:t.reason)&&(a=null===(i=n.detail)||void 0===i?void 0:i.reason),g(a)?(r=`Non-Error promise rejection captured with value: ${String(a)}`,o="UnhandledRejection"):[r,o]=ke(a),r&&e.pushError(new Error(r),{type:o})}))}}class Se extends Q{constructor(){super(...arguments),this.name="@grafana/faro-web-sdk:instrumentation-view",this.version=t.VERSION}sendViewChangedEvent(e){const n=e.view;n&&n!==this.notifiedView&&(this.notifiedView=n,this.api.pushEvent(ae.EventNames.VIEW_CHANGED,{},void 0,{skipDedupe:!0}))}initialize(){this.sendViewChangedEvent(this.metas.value),this.metas.addListener(this.sendViewChangedEvent.bind(this))}}var Oe,Ie,Ne,Ce,Re,Ae=-1,je=function(e){addEventListener("pageshow",(function(n){n.persisted&&(Ae=n.timeStamp,e(n))}),!0)},De=function(){return window.performance&&performance.getEntriesByType&&performance.getEntriesByType("navigation")[0]},Pe=function(){var e=De();return e&&e.activationStart||0},ze=function(e,n){var t=De(),i="navigate";return Ae>=0?i="back-forward-cache":t&&(i=document.prerendering||Pe()>0?"prerender":document.wasDiscarded?"restore":t.type.replace(/_/g,"-")),{name:e,value:void 0===n?-1:n,rating:"good",delta:0,entries:[],id:"v3-".concat(Date.now(),"-").concat(Math.floor(8999999999999*Math.random())+1e12),navigationType:i}},Me=function(e,n,t){try{if(PerformanceObserver.supportedEntryTypes.includes(e)){var i=new PerformanceObserver((function(e){Promise.resolve().then((function(){n(e.getEntries())}))}));return i.observe(Object.assign({type:e,buffered:!0},t||{})),i}}catch(e){}},Fe=function(e,n,t,i){var r,o;return function(a){n.value>=0&&(a||i)&&((o=n.value-(r||0))||void 0===r)&&(r=n.value,n.delta=o,n.rating=function(e,n){return e>n[1]?"poor":e>n[0]?"needs-improvement":"good"}(n.value,t),e(n))}},_e=function(e){requestAnimationFrame((function(){return requestAnimationFrame((function(){return e()}))}))},$e=function(e){var n=function(n){"pagehide"!==n.type&&"hidden"!==document.visibilityState||e(n)};addEventListener("visibilitychange",n,!0),addEventListener("pagehide",n,!0)},Be=function(e){var n=!1;return function(t){n||(e(t),n=!0)}},Ue=-1,Ve=function(){return"hidden"!==document.visibilityState||document.prerendering?1/0:0},qe=function(e){"hidden"===document.visibilityState&&Ue>-1&&(Ue="visibilitychange"===e.type?e.timeStamp:0,We())},Ge=function(){addEventListener("visibilitychange",qe,!0),addEventListener("prerenderingchange",qe,!0)},We=function(){removeEventListener("visibilitychange",qe,!0),removeEventListener("prerenderingchange",qe,!0)},Ke=function(){return Ue<0&&(Ue=Ve(),Ge(),je((function(){setTimeout((function(){Ue=Ve(),Ge()}),0)}))),{get firstHiddenTime(){return Ue}}},He=function(e){document.prerendering?addEventListener("prerenderingchange",(function(){return e()}),!0):e()},Xe=function(e,n){n=n||{},He((function(){var t,i=[1800,3e3],r=Ke(),o=ze("FCP"),a=Me("paint",(function(e){e.forEach((function(e){"first-contentful-paint"===e.name&&(a.disconnect(),e.startTime<r.firstHiddenTime&&(o.value=Math.max(e.startTime-Pe(),0),o.entries.push(e),t(!0)))}))}));a&&(t=Fe(e,o,i,n.reportAllChanges),je((function(r){o=ze("FCP"),t=Fe(e,o,i,n.reportAllChanges),_e((function(){o.value=performance.now()-r.timeStamp,t(!0)}))})))}))},Ze={passive:!0,capture:!0},Je=new Date,Qe=function(e,n){Oe||(Oe=n,Ie=e,Ne=new Date,nn(removeEventListener),Ye())},Ye=function(){if(Ie>=0&&Ie<Ne-Je){var e={entryType:"first-input",name:Oe.type,target:Oe.target,cancelable:Oe.cancelable,startTime:Oe.timeStamp,processingStart:Oe.timeStamp+Ie};Ce.forEach((function(n){n(e)})),Ce=[]}},en=function(e){if(e.cancelable){var n=(e.timeStamp>1e12?new Date:performance.now())-e.timeStamp;"pointerdown"==e.type?function(e,n){var t=function(){Qe(e,n),r()},i=function(){r()},r=function(){removeEventListener("pointerup",t,Ze),removeEventListener("pointercancel",i,Ze)};addEventListener("pointerup",t,Ze),addEventListener("pointercancel",i,Ze)}(n,e):Qe(n,e)}},nn=function(e){["mousedown","keydown","touchstart","pointerdown"].forEach((function(n){return e(n,en,Ze)}))},tn=0,rn=1/0,on=0,an=function(e){e.forEach((function(e){e.interactionId&&(rn=Math.min(rn,e.interactionId),on=Math.max(on,e.interactionId),tn=on?(on-rn)/7+1:0)}))},sn=function(){return Re?tn:performance.interactionCount||0},un=function(){"interactionCount"in performance||Re||(Re=Me("event",an,{type:"event",buffered:!0,durationThreshold:0}))},ln=0,cn=function(){return sn()-ln},dn=[],pn={},fn=function(e){var n=dn[dn.length-1],t=pn[e.interactionId];if(t||dn.length<10||e.duration>n.latency){if(t)t.entries.push(e),t.latency=Math.max(t.latency,e.duration);else{var i={id:e.interactionId,latency:e.duration,entries:[e]};pn[i.id]=i,dn.push(i)}dn.sort((function(e,n){return n.latency-e.latency})),dn.splice(10).forEach((function(e){delete pn[e.id]}))}},gn={},bn=function e(n){document.prerendering?He((function(){return e(n)})):"complete"!==document.readyState?addEventListener("load",(function(){return e(n)}),!0):setTimeout(n,0)};class mn extends Q{constructor(){super(...arguments),this.name="@grafana/faro-web-sdk:instrumentation-web-vitals",this.version=Y}initialize(){this.logDebug("Initializing"),Object.entries(mn.mapping).forEach((([e,n])=>{n((n=>{this.api.pushMeasurement({type:"web-vitals",values:{[e]:n.value}})}))}))}}function vn(e={}){const n=[new Le,new mn,new se,new Se];return!1!==e.captureConsole&&n.push(new ue({disabledLevels:e.captureConsoleDisabledLevels})),n}mn.mapping={cls:function(e,n){n=n||{},Xe(Be((function(){var t,i=[.1,.25],r=ze("CLS",0),o=0,a=[],s=function(e){e.forEach((function(e){if(!e.hadRecentInput){var n=a[0],t=a[a.length-1];o&&e.startTime-t.startTime<1e3&&e.startTime-n.startTime<5e3?(o+=e.value,a.push(e)):(o=e.value,a=[e])}})),o>r.value&&(r.value=o,r.entries=a,t())},u=Me("layout-shift",s);u&&(t=Fe(e,r,i,n.reportAllChanges),$e((function(){s(u.takeRecords()),t(!0)})),je((function(){o=0,r=ze("CLS",0),t=Fe(e,r,i,n.reportAllChanges),_e((function(){return t()}))})),setTimeout(t,0))})))},fcp:Xe,fid:function(e,n){n=n||{},He((function(){var t,i=[100,300],r=Ke(),o=ze("FID"),a=function(e){e.startTime<r.firstHiddenTime&&(o.value=e.processingStart-e.startTime,o.entries.push(e),t(!0))},s=function(e){e.forEach(a)},u=Me("first-input",s);t=Fe(e,o,i,n.reportAllChanges),u&&$e(Be((function(){s(u.takeRecords()),u.disconnect()}))),u&&je((function(){var r;o=ze("FID"),t=Fe(e,o,i,n.reportAllChanges),Ce=[],Ie=-1,Oe=null,nn(addEventListener),r=a,Ce.push(r),Ye()}))}))},inp:function(e,n){n=n||{},He((function(){var t=[200,500];un();var i,r=ze("INP"),o=function(e){e.forEach((function(e){e.interactionId&&fn(e),"first-input"===e.entryType&&!dn.some((function(n){return n.entries.some((function(n){return e.duration===n.duration&&e.startTime===n.startTime}))}))&&fn(e)}));var n,t=(n=Math.min(dn.length-1,Math.floor(cn()/50)),dn[n]);t&&t.latency!==r.value&&(r.value=t.latency,r.entries=t.entries,i())},a=Me("event",o,{durationThreshold:n.durationThreshold||40});i=Fe(e,r,t,n.reportAllChanges),a&&(a.observe({type:"first-input",buffered:!0}),$e((function(){o(a.takeRecords()),r.value<0&&cn()>0&&(r.value=0,r.entries=[]),i(!0)})),je((function(){dn=[],ln=sn(),r=ze("INP"),i=Fe(e,r,t,n.reportAllChanges)})))}))},lcp:function(e,n){n=n||{},He((function(){var t,i=[2500,4e3],r=Ke(),o=ze("LCP"),a=function(e){var n=e[e.length-1];if(n){var i=Math.max(n.startTime-Pe(),0);i<r.firstHiddenTime&&(o.value=i,o.entries=[n],t())}},s=Me("largest-contentful-paint",a);if(s){t=Fe(e,o,i,n.reportAllChanges);var u=Be((function(){gn[o.id]||(a(s.takeRecords()),s.disconnect(),gn[o.id]=!0,t(!0))}));["keydown","click"].forEach((function(e){addEventListener(e,u,!0)})),$e(u),je((function(r){o=ze("LCP"),t=Fe(e,o,i,n.reportAllChanges),_e((function(){o.value=performance.now()-r.timeStamp,gn[o.id]=!0,t(!0)}))}))}}))},ttfb:function(e,n){n=n||{};var t=[800,1800],i=ze("TTFB"),r=Fe(e,i,t,n.reportAllChanges);bn((function(){var o=De();if(o){var a=o.responseStart;if(a<=0||a>performance.now())return;i.value=Math.max(a-Pe(),0),i.entries=[o],r(!0),je((function(){i=ze("TTFB",0),(r=Fe(e,i,t,n.reportAllChanges))(!0)}))}}))}};const hn="browser",wn=()=>{const e=new t.UAParser,{name:n,version:i}=e.getBrowser(),{name:r,version:o}=e.getOS(),a="unknown";return{browser:{name:null!=n?n:a,version:null!=i?i:a,os:`${null!=r?r:a} ${null!=o?o:a}`,mobile:navigator.userAgent.includes("Mobi")}}},yn=()=>({page:{url:location.href}}),En=[wn,yn];function xn(e){return{id:A(),attributes:e}}const kn={name:"default"};function Tn(e,n,t,i){return new(t||(t=Promise))((function(r,o){function a(e){try{u(i.next(e))}catch(e){o(e)}}function s(e){try{u(i.throw(e))}catch(e){o(e)}}function u(e){var n;e.done?r(e.value):(n=e.value,n instanceof t?n:new t((function(e){e(n)}))).then(a,s)}u((i=i.apply(e,n||[])).next())}))}class Ln extends W{constructor(e){var n,t,i,r;super(),this.options=e,this.name="@grafana/faro-web-sdk:transport-fetch",this.version=Y,this.disabledUntil=new Date,this.rateLimitBackoffMs=null!==(n=e.defaultRateLimitBackoffMs)&&void 0!==n?n:5e3,this.getNow=null!==(t=e.getNow)&&void 0!==t?t:()=>Date.now(),this.promiseBuffer=C({size:null!==(i=e.bufferSize)&&void 0!==i?i:30,concurrency:null!==(r=e.concurrency)&&void 0!==r?r:5})}send(e){return Tn(this,void 0,void 0,(function*(){try{if(this.disabledUntil>new Date(this.getNow()))return this.logWarn(`Dropping transport item due to too many requests. Backoff until ${this.disabledUntil}`),Promise.resolve();yield this.promiseBuffer.add((()=>{const n=JSON.stringify(K(e)),{url:t,requestOptions:i,apiKey:r}=this.options,o=null!=i?i:{},{headers:a}=o,s=function(e,n){var t={};for(var i in e)Object.prototype.hasOwnProperty.call(e,i)&&n.indexOf(i)<0&&(t[i]=e[i]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var r=0;for(i=Object.getOwnPropertySymbols(e);r<i.length;r++)n.indexOf(i[r])<0&&Object.prototype.propertyIsEnumerable.call(e,i[r])&&(t[i[r]]=e[i[r]])}return t}(o,["headers"]);return fetch(t,Object.assign({method:"POST",headers:Object.assign(Object.assign({"Content-Type":"application/json"},null!=a?a:{}),r?{"x-api-key":r}:{}),body:n,keepalive:!0},null!=s?s:{})).then((e=>(429===e.status&&(this.disabledUntil=this.getRetryAfterDate(e),this.logWarn(`Too many requests, backing off until ${this.disabledUntil}`)),e))).catch((e=>{this.logError("Failed sending payload to the receiver\n",JSON.parse(n),e)}))}))}catch(e){this.logError(e)}}))}getIgnoreUrls(){return[this.options.url]}getRetryAfterDate(e){const n=this.getNow(),t=e.headers.get("Retry-After");if(t){const e=Number(t);if(!isNaN(e))return new Date(1e3*e+n);const i=Date.parse(t);if(!isNaN(i))return new Date(i)}return new Date(n+this.rateLimitBackoffMs)}}function Sn(e){var n,t,i,r,o,a,s,u,l,c,d;const p=[],f=U(e.unpatchedConsole,e.internalLoggerLevel);return e.transports?((e.url||e.apiKey)&&f.error('if "transports" is defined, "url" and "apiKey" should not be defined'),p.push(...e.transports)):e.url?p.push(new Ln({url:e.url,apiKey:e.apiKey})):f.error('either "url" or "transports" must be defined'),{app:e.app,dedupe:null===(n=e.dedupe)||void 0===n||n,globalObjectKey:e.globalObjectKey||oe,instrumentations:null!==(t=e.instrumentations)&&void 0!==t?t:vn(),internalLoggerLevel:null!==(i=e.internalLoggerLevel)&&void 0!==i?i:F,isolate:null!==(r=e.isolate)&&void 0!==r&&r,metas:null!==(o=e.metas)&&void 0!==o?o:En,parseStacktrace:xe,paused:null!==(a=e.paused)&&void 0!==a&&a,preventGlobalExposure:null!==(s=e.preventGlobalExposure)&&void 0!==s&&s,transports:p,unpatchedConsole:null!==(u=e.unpatchedConsole)&&void 0!==u?u:_,beforeSend:e.beforeSend,eventDomain:null!==(l=e.eventDomain)&&void 0!==l?l:hn,ignoreErrors:e.ignoreErrors,session:null!==(c=e.session)&&void 0!==c?c:xn(),user:e.user,view:null!==(d=e.view)&&void 0!==d?d:kn}}return e.BaseExtension=G,e.BaseInstrumentation=Q,e.BaseTransport=W,e.ConsoleInstrumentation=ue,e.ConsoleTransport=class extends W{constructor(e={}){super(),this.options=e,this.name="@grafana/faro-web-sdk:transport-console",this.version=Y}send(n){var t;return this.unpatchedConsole[null!==(t=this.options.level)&&void 0!==t?t:e.LogLevel.DEBUG]("New event",K(n))}},e.Conventions=ae,e.ErrorsInstrumentation=Le,e.FetchTransport=Ln,e.VERSION=Y,e.ViewInstrumentation=Se,e.WebVitalsInstrumentation=mn,e.allLogLevels=I,e.browserMeta=wn,e.buildStackFrame=we,e.createInternalLogger=U,e.createPromiseBuffer=C,e.createSession=xn,e.deepEqual=T,e.defaultEventDomain=hn,e.defaultExceptionType=H,e.defaultGlobalObjectKey=oe,e.defaultInternalLoggerLevel=F,e.defaultLogLevel=O,e.defaultMetas=En,e.defaultViewMeta=kn,e.genShortID=A,e.getCurrentTimestamp=L,e.getDataFromSafariExtensions=ye,e.getInternalFaroFromGlobalObject=function(){return J[ee]},e.getStackFramesFromError=Ee,e.getTransportBody=K,e.getWebInstrumentations=vn,e.globalObject=J,e.initializeFaro=function(e){const n=Sn(e);if(n)return re(n)},e.internalGlobalObjectKey=ee,e.isArray=f,e.isBoolean=e=>r(e,"boolean"),e.isDomError=y,e.isDomException=E,e.isElement=e=>x&&a(e,Element),e.isElementDefined=x,e.isError=h,e.isErrorDefined=v,e.isErrorEvent=w,e.isEvent=m,e.isEventDefined=b,e.isFunction=p,e.isInstanceOf=a,e.isInt=e=>c(e)&&Number.isInteger(e),e.isInternalFaroOnGlobalObject=te,e.isMap=e=>k&&a(e,Map),e.isMapDefined=k,e.isNull=u,e.isNumber=c,e.isObject=d,e.isPrimitive=g,e.isRegExp=e=>o(e,"RegExp"),e.isString=l,e.isSymbol=e=>r(e,"symbol"),e.isSyntheticEvent=e=>d(e)&&"nativeEvent"in e&&"preventDefault"in e&&"stopPropagation"in e,e.isThenable=e=>p(null==e?void 0:e.then),e.isToString=o,e.isTypeof=r,e.isUndefined=s,e.makeCoreConfig=Sn,e.noop=N,e.pageMeta=yn,e.parseStacktrace=xe,e.setInternalFaroOnGlobalObject=ne,e.transportItemTypeToBodyKey=D,e}({});
1
+ var GrafanaFaroWebSdk=function(e){"use strict";function n(e,n){return typeof e===n}function t(e,n){return Object.prototype.toString.call(e)===`[object ${n}]`}function i(e,n){try{return e instanceof n}catch(e){return!1}}const r=e=>n(e,"undefined"),o=e=>n(e,"null"),a=e=>n(e,"string"),s=e=>n(e,"number")&&!isNaN(e)||n(e,"bigint"),u=e=>!o(e)&&n(e,"object"),l=e=>n(e,"function"),c=e=>t(e,"Array"),d=e=>!u(e)&&!l(e),p=!r(Event),f=e=>p&&i(e,Event),g="undefined"!=typeof Error,b=e=>g&&i(e,Error),m=e=>t(e,"ErrorEvent"),v=e=>t(e,"DOMError"),h=e=>t(e,"DOMException"),w="undefined"!=typeof Element,y="undefined"!=typeof Map;function E(e,t){if(e===t)return!0;if(n(e,"number")&&isNaN(e))return n(t,"number")&&isNaN(t);const i=c(e),r=c(t);if(i!==r)return!1;if(i&&r){const n=e.length;if(n!==t.length)return!1;for(let i=n;0!=i--;)if(!E(e[i],t[i]))return!1;return!0}const o=u(e),a=u(t);if(o!==a)return!1;if(e&&t&&o&&a){const n=Object.keys(e),i=Object.keys(t);if(n.length!==i.length)return!1;for(let e of n)if(!i.includes(e))return!1;for(let i of n)if(!E(e[i],t[i]))return!1;return!0}return!1}function x(){return(new Date).toISOString()}var k;e.LogLevel=void 0,(k=e.LogLevel||(e.LogLevel={})).TRACE="trace",k.DEBUG="debug",k.INFO="info",k.LOG="log",k.WARN="warn",k.ERROR="error";const T=e.LogLevel.LOG,L=[e.LogLevel.TRACE,e.LogLevel.DEBUG,e.LogLevel.INFO,e.LogLevel.LOG,e.LogLevel.WARN,e.LogLevel.ERROR];function S(){}function O(e){const{size:n,concurrency:t}=e,i=[];let r=0;const o=()=>{if(r<t&&i.length){const{producer:e,resolve:n,reject:t}=i.shift();r++,e().then((e=>{r--,o(),n(e)}),(e=>{r--,o(),t(e)}))}};return{add:e=>{if(i.length+r>=n)throw new Error("Task buffer full");return new Promise(((n,t)=>{i.push({producer:e,resolve:n,reject:t}),o()}))}}}const I="abcdefghijkmnopqrstuvwxyzABCDEFGHJKLMNPQRSTUVWXYZ0123456789";function N(e=10){return Array.from(Array(e)).map((()=>I[Math.floor(Math.random()*I.length)])).join("")}var C;e.TransportItemType=void 0,(C=e.TransportItemType||(e.TransportItemType={})).EXCEPTION="exception",C.LOG="log",C.MEASUREMENT="measurement",C.TRACE="trace",C.EVENT="event";const A={[e.TransportItemType.EXCEPTION]:"exceptions",[e.TransportItemType.LOG]:"logs",[e.TransportItemType.MEASUREMENT]:"measurements",[e.TransportItemType.TRACE]:"traces",[e.TransportItemType.EVENT]:"events"};function R(n){return t=>{if(t.type===e.TransportItemType.EXCEPTION&&t.payload){const e=t.payload,i=`${e.type}: ${e.value}`;if(function(e,n){return e.some((e=>a(e)?n.includes(e):!!n.match(e)))}(n,i))return null}return t}}var j;e.InternalLoggerLevel=void 0,(j=e.InternalLoggerLevel||(e.InternalLoggerLevel={}))[j.OFF=0]="OFF",j[j.ERROR=1]="ERROR",j[j.WARN=2]="WARN",j[j.INFO=3]="INFO",j[j.VERBOSE=4]="VERBOSE";const D={debug:S,error:S,info:S,prefix:"Faro",warn:S},P=e.InternalLoggerLevel.ERROR,z=Object.assign({},console);let M=z;function F(e){var n;return M=null!==(n=e.unpatchedConsole)&&void 0!==n?n:M,M}function _(n=z,t=P){const i=D;return t>e.InternalLoggerLevel.OFF&&(i.error=t>=e.InternalLoggerLevel.ERROR?function(...e){n.error(`${i.prefix}\n`,...e)}:S,i.warn=t>=e.InternalLoggerLevel.WARN?function(...e){n.warn(`${i.prefix}\n`,...e)}:S,i.info=t>=e.InternalLoggerLevel.INFO?function(...e){n.info(`${i.prefix}\n`,...e)}:S,i.debug=t>=e.InternalLoggerLevel.VERBOSE?function(...e){n.debug(`${i.prefix}\n`,...e)}:S),i}let $=D;function B(e,n){return $=_(e,n.internalLoggerLevel),$}class U{constructor(){this.unpatchedConsole=z,this.internalLogger=D,this.config={},this.metas={}}logDebug(...e){this.internalLogger.debug(`${this.name}\n`,...e)}logInfo(...e){this.internalLogger.info(`${this.name}\n`,...e)}logWarn(...e){this.internalLogger.warn(`${this.name}\n`,...e)}logError(...e){this.internalLogger.error(`${this.name}\n`,...e)}}class q extends U{getIgnoreUrls(){return[]}}function V(n){return{[A[n.type]]:n.type===e.TransportItemType.TRACE?n.payload:[n.payload],meta:n.meta}}const G="Error";let W;function K(n,t,i,r,a){t.debug("Initializing API");const s=function(n,t,i,r,o){let a;return t.debug("Initializing traces API"),{getOTEL:()=>a,getTraceContext:()=>{const e=null==a?void 0:a.trace.getSpanContext(a.context.active());return e?{trace_id:e.traceId,span_id:e.spanId}:void 0},initOTEL:(e,n)=>{t.debug("Initializing OpenTelemetry"),a={trace:e,context:n}},isOTELInitialized:()=>!!a,pushTraces:n=>{try{const i={type:e.TransportItemType.TRACE,payload:n,meta:r.value};t.debug("Pushing trace\n",i),o.execute(i)}catch(e){t.error("Error pushing trace\n",e)}}}}(0,t,0,r,a);return Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({},s),function(n,t,i,r,a,s){var u;t.debug("Initializing exceptions API");let l=null;W=null!==(u=i.parseStacktrace)&&void 0!==u?u:W;const c=e=>{t.debug("Changing stacktrace parser"),W=null!=e?e:W};return c(i.parseStacktrace),{changeStacktraceParser:c,getStacktraceParser:()=>W,pushError:(n,{skipDedupe:u,stackFrames:c,type:d}={})=>{d=d||n.name||G;const p={meta:r.value,payload:{type:d,value:n.message,timestamp:x(),trace:s.getTraceContext()},type:e.TransportItemType.EXCEPTION};(null==(c=null!=c?c:n.stack?null==W?void 0:W(n).frames:void 0)?void 0:c.length)&&(p.payload.stacktrace={frames:c});const f={type:p.payload.type,value:p.payload.value,stackTrace:p.payload.stacktrace};u||!i.dedupe||o(l)||!E(f,l)?(l=f,t.debug("Pushing exception\n",p),a.execute(p)):t.debug("Skipping error push because it is the same as the last one\n",p.payload)}}}(0,t,i,r,a,s)),function(e,n,t,i,r){let o,a,s;n.debug("Initializing meta API");const u=e=>{a&&i.remove(a),a={user:e},i.add(a)},l=e=>{o&&i.remove(o),o={session:e},i.add(o)};return{setUser:u,resetUser:u,setSession:l,resetSession:l,getSession:()=>i.value.session,setView:e=>{s&&i.remove(s),s={view:e},i.add(s)},getView:()=>i.value.view}}(0,t,0,r)),function(n,t,i,r,a,s){t.debug("Initializing logs API");let u=null;return{pushLog:(n,{context:l,level:c,skipDedupe:d}={})=>{try{const p={type:e.TransportItemType.LOG,payload:{message:n.map((e=>{try{return String(e)}catch(e){return""}})).join(" "),level:null!=c?c:T,context:null!=l?l:{},timestamp:x(),trace:s.getTraceContext()},meta:r.value},f={message:p.payload.message,level:p.payload.level,context:p.payload.context};if(!d&&i.dedupe&&!o(u)&&E(f,u))return void t.debug("Skipping log push because it is the same as the last one\n",p.payload);u=f,t.debug("Pushing log\n",p),a.execute(p)}catch(e){t.error("Error pushing log\n",e)}}}}(0,t,i,r,a,s)),function(n,t,i,r,a,s){t.debug("Initializing measurements API");let u=null;return{pushMeasurement:(n,{skipDedupe:l}={})=>{var c;try{const d={type:e.TransportItemType.MEASUREMENT,payload:Object.assign(Object.assign({},n),{trace:s.getTraceContext(),timestamp:null!==(c=n.timestamp)&&void 0!==c?c:x()}),meta:r.value},p={type:d.payload.type,values:d.payload.values};if(!l&&i.dedupe&&!o(u)&&E(p,u))return void t.debug("Skipping measurement push because it is the same as the last one\n",d.payload);u=p,t.debug("Pushing measurement\n",d),a.execute(d)}catch(e){t.error("Error pushing measurement\n",e)}}}}(0,t,i,r,a,s)),function(n,t,i,r,a,s){let u=null;return{pushEvent:(n,l,c,{skipDedupe:d}={})=>{try{const p={meta:r.value,payload:{name:n,domain:null!=c?c:i.eventDomain,attributes:l,timestamp:x(),trace:s.getTraceContext()},type:e.TransportItemType.EVENT},f={name:p.payload.name,attributes:p.payload.attributes,domain:p.payload.domain};if(!d&&i.dedupe&&!o(u)&&E(f,u))return void t.debug("Skipping event push because it is the same as the last one\n",p.payload);u=f,t.debug("Pushing event\n",p),a.execute(p)}catch(e){t.error("Error pushing event",e)}}}}(0,t,i,r,a,s))}const H="undefined"==typeof window?global:window;class X extends U{constructor(){super(...arguments),this.api={},this.transports={}}}const Z="1.0.1";const J="_faroInternal";function Q(e){e.config.isolate?e.internalLogger.debug("Skipping registering internal Faro instance on global object"):(e.internalLogger.debug("Registering internal Faro instance on global object"),Object.defineProperty(H,J,{configurable:!1,enumerable:!1,writable:!1,value:e}))}function Y(){return J in H}function ee(n,t,i,r,o,a,s){return t.debug("Initializing Faro"),e.faro={api:a,config:i,instrumentations:s,internalLogger:t,metas:r,pause:o.pause,transports:o,unpatchedConsole:n,unpause:o.unpause},Q(e.faro),function(e){if(e.config.preventGlobalExposure)e.internalLogger.debug("Skipping registering public Faro instance in the global scope");else{if(e.internalLogger.debug(`Registering public faro reference in the global scope using "${e.config.globalObjectKey}" key`),e.config.globalObjectKey in H)return void e.internalLogger.warn(`Skipping global registration due to key "${e.config.globalObjectKey}" being used already. Please set "globalObjectKey" to something else or set "preventGlobalExposure" to "true"`);Object.defineProperty(H,e.config.globalObjectKey,{configurable:!1,writable:!1,value:e})}}(e.faro),e.faro}function ne(e){const n=F(e),t=B(n,e);if(Y()&&!e.isolate)return void t.error('Faro is already registered. Either add instrumentations, transports etc. to the global faro instance or use the "isolate" property');t.debug("Initializing");const i=function(e,n,t){let i=[],r=[];const o=()=>i.reduce(((e,n)=>Object.assign(e,l(n)?n():n)),{}),a=()=>{if(r.length){const e=o();r.forEach((n=>n(e)))}};return{add:(...e)=>{n.debug("Adding metas\n",e),i.push(...e),a()},remove:(...e)=>{n.debug("Removing metas\n",e),i=i.filter((n=>!e.includes(n))),a()},addListener:e=>{n.debug("Adding metas listener\n",e),r.push(e)},removeListener:e=>{n.debug("Removing metas listener\n",e),r=r.filter((n=>n!==e))},get value(){return o()}}}(0,t),r=function(e,n,t,i){n.debug("Initializing transports");const r=[];let o=t.paused,a=[];return{add:(...o)=>{n.debug("Adding transports"),o.forEach((o=>{n.debug(`Adding "${o.name}" transport`),r.some((e=>e===o))?n.warn(`Transport ${o.name} is already added`):(o.unpatchedConsole=e,o.internalLogger=n,o.config=t,o.metas=i,r.push(o))}))},addBeforeSendHooks:(...e)=>{n.debug("Adding beforeSendHooks\n",a),e.forEach((e=>{e&&a.push(e)}))},addIgnoreErrorsPatterns:(...e)=>{n.debug("Adding ignoreErrorsPatterns\n",e),e.forEach((e=>{e&&a.push(R(e))}))},getBeforeSendHooks:()=>[...a],execute:e=>{if(!o){let t=e;for(const e of a){const n=e(t);if(null===n)return;t=n}for(const e of r)n.debug(`Transporting item using ${e.name}\n`,t),e.send(t)}},isPaused:()=>o,pause:()=>{n.debug("Pausing transports"),o=!0},remove:(...e)=>{n.debug("Removing transports"),e.forEach((e=>{n.debug(`Removing "${e.name}" transport`);const t=r.indexOf(e);-1!==t?r.splice(t,1):n.warn(`Transport "${e.name}" is not added`)}))},removeBeforeSendHooks:(...e)=>{a.filter((n=>!e.includes(n)))},get transports(){return[...r]},unpause:()=>{n.debug("Unpausing transports"),o=!1}}}(n,t,e,i),o=K(0,t,e,i,r),a=function(e,n,t,i,r,o){n.debug("Initializing instrumentations");const a=[];return{add:(...s)=>{n.debug("Adding instrumentations"),s.forEach((s=>{n.debug(`Adding "${s.name}" instrumentation`),a.some((e=>e.name===s.name))?n.warn(`Instrumentation ${s.name} is already added`):(s.unpatchedConsole=e,s.internalLogger=n,s.config=t,s.metas=i,s.transports=r,s.api=o,a.push(s),s.initialize())}))},get instrumentations(){return[...a]},remove:(...e)=>{n.debug("Removing instrumentations"),e.forEach((e=>{var t,i;n.debug(`Removing "${e.name}" instrumentation`);const r=a.reduce(((n,t,i)=>null===n&&t.name===e.name?i:null),null);r?(null===(i=(t=a[r]).destroy)||void 0===i||i.call(t),a.splice(r,1)):n.warn(`Instrumentation "${e.name}" is not added`)}))}}}(n,t,e,i,r,o),s=ee(n,t,e,i,r,o,a);return function(e){var n;const t={sdk:{name:"@grafana/faro-core",version:Z,integrations:e.config.instrumentations.map((({name:e,version:n})=>({name:e,version:n})))}};e.config.session&&e.api.setSession(e.config.session),e.config.app&&(t.app=e.config.app),e.config.user&&(t.user=e.config.user),e.config.view&&(t.view=e.config.view),e.metas.add(t,...null!==(n=e.config.metas)&&void 0!==n?n:[])}(s),function(e){e.transports.add(...e.config.transports),e.transports.addBeforeSendHooks(e.config.beforeSend),e.transports.addIgnoreErrorsPatterns(e.config.ignoreErrors)}(s),function(e){e.instrumentations.add(...e.config.instrumentations)}(s),s}e.faro={};const te="faro",ie={EventNames:{CLICK:"click",NAVIGATION:"navigation",SESSION_START:"session_start",VIEW_CHANGED:"view_changed"}};class re extends X{constructor(){super(...arguments),this.name="@grafana/faro-web-sdk:instrumentation-session",this.version=Z}sendSessionStartEvent(e){const n=e.session;n&&n!==this.notifiedSession&&(this.notifiedSession=n,this.api.pushEvent(ie.EventNames.SESSION_START,{},void 0,{skipDedupe:!0}))}initialize(){this.sendSessionStartEvent(this.metas.value),this.metas.addListener(this.sendSessionStartEvent.bind(this))}}class oe extends X{constructor(e={}){super(),this.options=e,this.name="@grafana/faro-web-sdk:instrumentation-console",this.version=Z}initialize(){this.logDebug("Initializing\n",this.options),L.filter((e=>{var n;return!(null!==(n=this.options.disabledLevels)&&void 0!==n?n:oe.defaultDisabledLevels).includes(e)})).forEach((e=>{console[e]=(...n)=>{try{this.api.pushLog(n,{level:e})}catch(e){this.logError(e)}finally{this.unpatchedConsole[e](...n)}}}))}}oe.defaultDisabledLevels=[e.LogLevel.DEBUG,e.LogLevel.TRACE,e.LogLevel.LOG];const ae=/^(?:[Uu]ncaught (?:exception: )?)?(?:((?:Eval|Internal|Range|Reference|Syntax|Type|URI|)Error): )?(.*)$/i,se=/^\s*at (?:(.*\).*?|.*?) ?\((?:address at )?)?((?:file|https?|blob|chrome-extension|address|native|eval|webpack|<anonymous>|[-a-z]+:|.*bundle|\/)?.*?)(?::(\d+))?(?::(\d+))?\)?\s*$/i,ue=/\((\S*)(?::(\d+))(?::(\d+))\)/,le="address at ",ce=le.length,de=/^\s*(.*?)(?:\((.*?)\))?(?:^|@)?((?:file|https?|blob|chrome|webpack|resource|moz-extension|safari-extension|safari-web-extension|capacitor)?:\/.*?|\[native code]|[^@]*(?:bundle|\d+\.js)|\/[\w\-. /=]+)(?::(\d+))?(?::(\d+))?\s*$/i,pe=/(\S+) line (\d+)(?: > eval line \d+)* > eval/i,fe="safari-extension",ge="safari-web-extension",be=/Minified React error #\d+;/i;function me(e,n,t,i){const r={filename:e||document.location.href,function:n||"?"};return void 0!==t&&(r.lineno=t),void 0!==i&&(r.colno=i),r}function ve(e,n){const t=null==e?void 0:e.includes(fe),i=!t&&(null==e?void 0:e.includes(ge));return t||i?[(null==e?void 0:e.includes("@"))?e.split("@")[0]:e,t?`${fe}:${n}`:`${ge}:${n}`]:[e,n]}function he(e){let n=[];e.stacktrace?n=e.stacktrace.split("\n").filter(((e,n)=>n%2==0)):e.stack&&(n=e.stack.split("\n"));const t=n.reduce(((n,t,i)=>{let r,o,a,u,l;if(r=se.exec(t)){if(o=r[1],a=r[2],u=r[3],l=r[4],null==a?void 0:a.startsWith("eval")){const e=ue.exec(a);e&&(a=e[1],u=e[2],l=e[3])}a=(null==a?void 0:a.startsWith(le))?a.substring(ce):a,[o,a]=ve(o,a)}else if(r=de.exec(t)){if(o=r[1],a=r[3],u=r[4],l=r[5],a&&a.includes(" > eval")){const e=pe.exec(a);e&&(o=o||"eval",a=e[1],u=e[2])}else 0===i&&!l&&s(e.columnNumber)&&(l=String(e.columnNumber+1));[o,a]=ve(o,a)}return(a||o)&&n.push(me(a,o,u?Number(u):void 0,l?Number(l):void 0)),n}),[]);return be.test(e.message)?t.slice(1):t}function we(e){return{frames:he(e)}}function ye(e){let n,t,i,r,o=[];if(m(e)&&e.error)n=e.error.message,t=e.error.name,o=he(e.error);else if((i=v(e))||h(e)){const{name:r,message:o}=e;t=null!=r?r:i?"DOMError":"DOMException",n=o?`${t}: ${o}`:t}else b(e)?(n=e.message,o=he(e)):(u(e)||(r=f(e)))&&(t=r?e.constructor.name:void 0,n=`Non-Error exception captured with keys: ${Object.keys(e)}`);return[n,t,o]}function Ee(e){const n=window.onerror;window.onerror=(...t)=>{try{const[i,r,o,s,u]=t;let l,c,d=[];const p=a(i),f=me(r,"?",o,s);u||!p?([l,c,d]=ye(null!=u?u:i),0===d.length&&(d=[f])):p&&([l,c]=function(e){var n,t;const i=e.match(ae),r=null!==(n=null==i?void 0:i[1])&&void 0!==n?n:G;return[null!==(t=null==i?void 0:i[2])&&void 0!==t?t:e,r]}(i),d=[f]),l&&e.pushError(new Error(l),{type:c,stackFrames:d})}finally{null==n||n.apply(window,t)}}}class xe extends X{constructor(){super(...arguments),this.name="@grafana/faro-web-sdk:instrumentation-errors",this.version=Z}initialize(){var e;this.logDebug("Initializing"),Ee(this.api),e=this.api,window.addEventListener("unhandledrejection",(n=>{var t,i;let r,o,a=n;a.reason?a=n.reason:(null===(t=n.detail)||void 0===t?void 0:t.reason)&&(a=null===(i=n.detail)||void 0===i?void 0:i.reason),d(a)?(r=`Non-Error promise rejection captured with value: ${String(a)}`,o="UnhandledRejection"):[r,o]=ye(a),r&&e.pushError(new Error(r),{type:o})}))}}class ke extends X{constructor(){super(...arguments),this.name="@grafana/faro-web-sdk:instrumentation-view",this.version=Z}sendViewChangedEvent(e){const n=e.view;n&&n!==this.notifiedView&&(this.notifiedView=n,this.api.pushEvent(ie.EventNames.VIEW_CHANGED,{},void 0,{skipDedupe:!0}))}initialize(){this.sendViewChangedEvent(this.metas.value),this.metas.addListener(this.sendViewChangedEvent.bind(this))}}var Te,Le,Se,Oe,Ie,Ne=-1,Ce=function(e){addEventListener("pageshow",(function(n){n.persisted&&(Ne=n.timeStamp,e(n))}),!0)},Ae=function(){return window.performance&&performance.getEntriesByType&&performance.getEntriesByType("navigation")[0]},Re=function(){var e=Ae();return e&&e.activationStart||0},je=function(e,n){var t=Ae(),i="navigate";return Ne>=0?i="back-forward-cache":t&&(i=document.prerendering||Re()>0?"prerender":document.wasDiscarded?"restore":t.type.replace(/_/g,"-")),{name:e,value:void 0===n?-1:n,rating:"good",delta:0,entries:[],id:"v3-".concat(Date.now(),"-").concat(Math.floor(8999999999999*Math.random())+1e12),navigationType:i}},De=function(e,n,t){try{if(PerformanceObserver.supportedEntryTypes.includes(e)){var i=new PerformanceObserver((function(e){Promise.resolve().then((function(){n(e.getEntries())}))}));return i.observe(Object.assign({type:e,buffered:!0},t||{})),i}}catch(e){}},Pe=function(e,n,t,i){var r,o;return function(a){n.value>=0&&(a||i)&&((o=n.value-(r||0))||void 0===r)&&(r=n.value,n.delta=o,n.rating=function(e,n){return e>n[1]?"poor":e>n[0]?"needs-improvement":"good"}(n.value,t),e(n))}},ze=function(e){requestAnimationFrame((function(){return requestAnimationFrame((function(){return e()}))}))},Me=function(e){var n=function(n){"pagehide"!==n.type&&"hidden"!==document.visibilityState||e(n)};addEventListener("visibilitychange",n,!0),addEventListener("pagehide",n,!0)},Fe=function(e){var n=!1;return function(t){n||(e(t),n=!0)}},_e=-1,$e=function(){return"hidden"!==document.visibilityState||document.prerendering?1/0:0},Be=function(e){"hidden"===document.visibilityState&&_e>-1&&(_e="visibilitychange"===e.type?e.timeStamp:0,qe())},Ue=function(){addEventListener("visibilitychange",Be,!0),addEventListener("prerenderingchange",Be,!0)},qe=function(){removeEventListener("visibilitychange",Be,!0),removeEventListener("prerenderingchange",Be,!0)},Ve=function(){return _e<0&&(_e=$e(),Ue(),Ce((function(){setTimeout((function(){_e=$e(),Ue()}),0)}))),{get firstHiddenTime(){return _e}}},Ge=function(e){document.prerendering?addEventListener("prerenderingchange",(function(){return e()}),!0):e()},We=function(e,n){n=n||{},Ge((function(){var t,i=[1800,3e3],r=Ve(),o=je("FCP"),a=De("paint",(function(e){e.forEach((function(e){"first-contentful-paint"===e.name&&(a.disconnect(),e.startTime<r.firstHiddenTime&&(o.value=Math.max(e.startTime-Re(),0),o.entries.push(e),t(!0)))}))}));a&&(t=Pe(e,o,i,n.reportAllChanges),Ce((function(r){o=je("FCP"),t=Pe(e,o,i,n.reportAllChanges),ze((function(){o.value=performance.now()-r.timeStamp,t(!0)}))})))}))},Ke={passive:!0,capture:!0},He=new Date,Xe=function(e,n){Te||(Te=n,Le=e,Se=new Date,Qe(removeEventListener),Ze())},Ze=function(){if(Le>=0&&Le<Se-He){var e={entryType:"first-input",name:Te.type,target:Te.target,cancelable:Te.cancelable,startTime:Te.timeStamp,processingStart:Te.timeStamp+Le};Oe.forEach((function(n){n(e)})),Oe=[]}},Je=function(e){if(e.cancelable){var n=(e.timeStamp>1e12?new Date:performance.now())-e.timeStamp;"pointerdown"==e.type?function(e,n){var t=function(){Xe(e,n),r()},i=function(){r()},r=function(){removeEventListener("pointerup",t,Ke),removeEventListener("pointercancel",i,Ke)};addEventListener("pointerup",t,Ke),addEventListener("pointercancel",i,Ke)}(n,e):Xe(n,e)}},Qe=function(e){["mousedown","keydown","touchstart","pointerdown"].forEach((function(n){return e(n,Je,Ke)}))},Ye=0,en=1/0,nn=0,tn=function(e){e.forEach((function(e){e.interactionId&&(en=Math.min(en,e.interactionId),nn=Math.max(nn,e.interactionId),Ye=nn?(nn-en)/7+1:0)}))},rn=function(){return Ie?Ye:performance.interactionCount||0},on=function(){"interactionCount"in performance||Ie||(Ie=De("event",tn,{type:"event",buffered:!0,durationThreshold:0}))},an=0,sn=function(){return rn()-an},un=[],ln={},cn=function(e){var n=un[un.length-1],t=ln[e.interactionId];if(t||un.length<10||e.duration>n.latency){if(t)t.entries.push(e),t.latency=Math.max(t.latency,e.duration);else{var i={id:e.interactionId,latency:e.duration,entries:[e]};ln[i.id]=i,un.push(i)}un.sort((function(e,n){return n.latency-e.latency})),un.splice(10).forEach((function(e){delete ln[e.id]}))}},dn={},pn=function e(n){document.prerendering?Ge((function(){return e(n)})):"complete"!==document.readyState?addEventListener("load",(function(){return e(n)}),!0):setTimeout(n,0)};class fn extends X{constructor(){super(...arguments),this.name="@grafana/faro-web-sdk:instrumentation-web-vitals",this.version=Z}initialize(){this.logDebug("Initializing"),Object.entries(fn.mapping).forEach((([e,n])=>{n((n=>{this.api.pushMeasurement({type:"web-vitals",values:{[e]:n.value}})}))}))}}function gn(e={}){const n=[new xe,new fn,new re,new ke];return!1!==e.captureConsole&&n.push(new oe({disabledLevels:e.captureConsoleDisabledLevels})),n}fn.mapping={cls:function(e,n){n=n||{},We(Fe((function(){var t,i=[.1,.25],r=je("CLS",0),o=0,a=[],s=function(e){e.forEach((function(e){if(!e.hadRecentInput){var n=a[0],t=a[a.length-1];o&&e.startTime-t.startTime<1e3&&e.startTime-n.startTime<5e3?(o+=e.value,a.push(e)):(o=e.value,a=[e])}})),o>r.value&&(r.value=o,r.entries=a,t())},u=De("layout-shift",s);u&&(t=Pe(e,r,i,n.reportAllChanges),Me((function(){s(u.takeRecords()),t(!0)})),Ce((function(){o=0,r=je("CLS",0),t=Pe(e,r,i,n.reportAllChanges),ze((function(){return t()}))})),setTimeout(t,0))})))},fcp:We,fid:function(e,n){n=n||{},Ge((function(){var t,i=[100,300],r=Ve(),o=je("FID"),a=function(e){e.startTime<r.firstHiddenTime&&(o.value=e.processingStart-e.startTime,o.entries.push(e),t(!0))},s=function(e){e.forEach(a)},u=De("first-input",s);t=Pe(e,o,i,n.reportAllChanges),u&&Me(Fe((function(){s(u.takeRecords()),u.disconnect()}))),u&&Ce((function(){var r;o=je("FID"),t=Pe(e,o,i,n.reportAllChanges),Oe=[],Le=-1,Te=null,Qe(addEventListener),r=a,Oe.push(r),Ze()}))}))},inp:function(e,n){n=n||{},Ge((function(){var t=[200,500];on();var i,r=je("INP"),o=function(e){e.forEach((function(e){e.interactionId&&cn(e),"first-input"===e.entryType&&!un.some((function(n){return n.entries.some((function(n){return e.duration===n.duration&&e.startTime===n.startTime}))}))&&cn(e)}));var n,t=(n=Math.min(un.length-1,Math.floor(sn()/50)),un[n]);t&&t.latency!==r.value&&(r.value=t.latency,r.entries=t.entries,i())},a=De("event",o,{durationThreshold:n.durationThreshold||40});i=Pe(e,r,t,n.reportAllChanges),a&&(a.observe({type:"first-input",buffered:!0}),Me((function(){o(a.takeRecords()),r.value<0&&sn()>0&&(r.value=0,r.entries=[]),i(!0)})),Ce((function(){un=[],an=rn(),r=je("INP"),i=Pe(e,r,t,n.reportAllChanges)})))}))},lcp:function(e,n){n=n||{},Ge((function(){var t,i=[2500,4e3],r=Ve(),o=je("LCP"),a=function(e){var n=e[e.length-1];if(n){var i=Math.max(n.startTime-Re(),0);i<r.firstHiddenTime&&(o.value=i,o.entries=[n],t())}},s=De("largest-contentful-paint",a);if(s){t=Pe(e,o,i,n.reportAllChanges);var u=Fe((function(){dn[o.id]||(a(s.takeRecords()),s.disconnect(),dn[o.id]=!0,t(!0))}));["keydown","click"].forEach((function(e){addEventListener(e,u,!0)})),Me(u),Ce((function(r){o=je("LCP"),t=Pe(e,o,i,n.reportAllChanges),ze((function(){o.value=performance.now()-r.timeStamp,dn[o.id]=!0,t(!0)}))}))}}))},ttfb:function(e,n){n=n||{};var t=[800,1800],i=je("TTFB"),r=Pe(e,i,t,n.reportAllChanges);pn((function(){var o=Ae();if(o){var a=o.responseStart;if(a<=0||a>performance.now())return;i.value=Math.max(a-Re(),0),i.entries=[o],r(!0),Ce((function(){i=je("TTFB",0),(r=Pe(e,i,t,n.reportAllChanges))(!0)}))}}))}};const bn="browser";var mn="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{},vn={},hn={get exports(){return vn},set exports(e){vn=e}};!function(e,n){!function(t,i){var r="function",o="undefined",a="object",s="string",u="model",l="name",c="type",d="vendor",p="version",f="architecture",g="console",b="mobile",m="tablet",v="smarttv",h="wearable",w="embedded",y="Amazon",E="Apple",x="ASUS",k="BlackBerry",T="Browser",L="Chrome",S="Firefox",O="Google",I="Huawei",N="LG",C="Microsoft",A="Motorola",R="Opera",j="Samsung",D="Sharp",P="Sony",z="Xiaomi",M="Zebra",F="Facebook",_=function(e){for(var n={},t=0;t<e.length;t++)n[e[t].toUpperCase()]=e[t];return n},$=function(e,n){return typeof e===s&&-1!==B(n).indexOf(B(e))},B=function(e){return e.toLowerCase()},U=function(e,n){if(typeof e===s)return e=e.replace(/^\s\s*/,"").replace(/\s\s*$/,""),typeof n===o?e:e.substring(0,350)},q=function(e,n){for(var t,o,s,u,l,c,d=0;d<n.length&&!l;){var p=n[d],f=n[d+1];for(t=o=0;t<p.length&&!l;)if(l=p[t++].exec(e))for(s=0;s<f.length;s++)c=l[++o],typeof(u=f[s])===a&&u.length>0?2===u.length?typeof u[1]==r?this[u[0]]=u[1].call(this,c):this[u[0]]=u[1]:3===u.length?typeof u[1]!==r||u[1].exec&&u[1].test?this[u[0]]=c?c.replace(u[1],u[2]):i:this[u[0]]=c?u[1].call(this,c,u[2]):i:4===u.length&&(this[u[0]]=c?u[3].call(this,c.replace(u[1],u[2])):i):this[u]=c||i;d+=2}},V=function(e,n){for(var t in n)if(typeof n[t]===a&&n[t].length>0){for(var r=0;r<n[t].length;r++)if($(n[t][r],e))return"?"===t?i:t}else if($(n[t],e))return"?"===t?i:t;return e},G={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"},W={browser:[[/\b(?:crmo|crios)\/([\w\.]+)/i],[p,[l,"Chrome"]],[/edg(?:e|ios|a)?\/([\w\.]+)/i],[p,[l,"Edge"]],[/(opera mini)\/([-\w\.]+)/i,/(opera [mobiletab]{3,6})\b.+version\/([-\w\.]+)/i,/(opera)(?:.+version\/|[\/ ]+)([\w\.]+)/i],[l,p],[/opios[\/ ]+([\w\.]+)/i],[p,[l,R+" Mini"]],[/\bopr\/([\w\.]+)/i],[p,[l,R]],[/(kindle)\/([\w\.]+)/i,/(lunascape|maxthon|netfront|jasmine|blazer)[\/ ]?([\w\.]*)/i,/(avant |iemobile|slim)(?:browser)?[\/ ]?([\w\.]*)/i,/(ba?idubrowser)[\/ ]?([\w\.]+)/i,/(?:ms|\()(ie) ([\w\.]+)/i,/(flock|rockmelt|midori|epiphany|silk|skyfire|ovibrowser|bolt|iron|vivaldi|iridium|phantomjs|bowser|quark|qupzilla|falkon|rekonq|puffin|brave|whale|qqbrowserlite|qq|duckduckgo)\/([-\w\.]+)/i,/(weibo)__([\d\.]+)/i],[l,p],[/(?:\buc? ?browser|(?:juc.+)ucweb)[\/ ]?([\w\.]+)/i],[p,[l,"UC"+T]],[/microm.+\bqbcore\/([\w\.]+)/i,/\bqbcore\/([\w\.]+).+microm/i],[p,[l,"WeChat(Win) Desktop"]],[/micromessenger\/([\w\.]+)/i],[p,[l,"WeChat"]],[/konqueror\/([\w\.]+)/i],[p,[l,"Konqueror"]],[/trident.+rv[: ]([\w\.]{1,9})\b.+like gecko/i],[p,[l,"IE"]],[/yabrowser\/([\w\.]+)/i],[p,[l,"Yandex"]],[/(avast|avg)\/([\w\.]+)/i],[[l,/(.+)/,"$1 Secure "+T],p],[/\bfocus\/([\w\.]+)/i],[p,[l,S+" Focus"]],[/\bopt\/([\w\.]+)/i],[p,[l,R+" Touch"]],[/coc_coc\w+\/([\w\.]+)/i],[p,[l,"Coc Coc"]],[/dolfin\/([\w\.]+)/i],[p,[l,"Dolphin"]],[/coast\/([\w\.]+)/i],[p,[l,R+" Coast"]],[/miuibrowser\/([\w\.]+)/i],[p,[l,"MIUI "+T]],[/fxios\/([-\w\.]+)/i],[p,[l,S]],[/\bqihu|(qi?ho?o?|360)browser/i],[[l,"360 "+T]],[/(oculus|samsung|sailfish|huawei)browser\/([\w\.]+)/i],[[l,/(.+)/,"$1 "+T],p],[/(comodo_dragon)\/([\w\.]+)/i],[[l,/_/g," "],p],[/(electron)\/([\w\.]+) safari/i,/(tesla)(?: qtcarbrowser|\/(20\d\d\.[-\w\.]+))/i,/m?(qqbrowser|baiduboxapp|2345Explorer)[\/ ]?([\w\.]+)/i],[l,p],[/(metasr)[\/ ]?([\w\.]+)/i,/(lbbrowser)/i,/\[(linkedin)app\]/i],[l],[/((?:fban\/fbios|fb_iab\/fb4a)(?!.+fbav)|;fbav\/([\w\.]+);)/i],[[l,F],p],[/safari (line)\/([\w\.]+)/i,/\b(line)\/([\w\.]+)\/iab/i,/(chromium|instagram)[\/ ]([-\w\.]+)/i],[l,p],[/\bgsa\/([\w\.]+) .*safari\//i],[p,[l,"GSA"]],[/headlesschrome(?:\/([\w\.]+)| )/i],[p,[l,L+" Headless"]],[/ wv\).+(chrome)\/([\w\.]+)/i],[[l,L+" WebView"],p],[/droid.+ version\/([\w\.]+)\b.+(?:mobile safari|safari)/i],[p,[l,"Android "+T]],[/(chrome|omniweb|arora|[tizenoka]{5} ?browser)\/v?([\w\.]+)/i],[l,p],[/version\/([\w\.\,]+) .*mobile\/\w+ (safari)/i],[p,[l,"Mobile Safari"]],[/version\/([\w(\.|\,)]+) .*(mobile ?safari|safari)/i],[p,l],[/webkit.+?(mobile ?safari|safari)(\/[\w\.]+)/i],[l,[p,V,{"1.0":"/8",1.2:"/1",1.3:"/3","2.0":"/412","2.0.2":"/416","2.0.3":"/417","2.0.4":"/419","?":"/"}]],[/(webkit|khtml)\/([\w\.]+)/i],[l,p],[/(navigator|netscape\d?)\/([-\w\.]+)/i],[[l,"Netscape"],p],[/mobile vr; rv:([\w\.]+)\).+firefox/i],[p,[l,S+" Reality"]],[/ekiohf.+(flow)\/([\w\.]+)/i,/(swiftfox)/i,/(icedragon|iceweasel|camino|chimera|fennec|maemo browser|minimo|conkeror|klar)[\/ ]?([\w\.\+]+)/i,/(seamonkey|k-meleon|icecat|iceape|firebird|phoenix|palemoon|basilisk|waterfox)\/([-\w\.]+)$/i,/(firefox)\/([\w\.]+)/i,/(mozilla)\/([\w\.]+) .+rv\:.+gecko\/\d+/i,/(polaris|lynx|dillo|icab|doris|amaya|w3m|netsurf|sleipnir|obigo|mosaic|(?:go|ice|up)[\. ]?browser)[-\/ ]?v?([\w\.]+)/i,/(links) \(([\w\.]+)/i],[l,p]],cpu:[[/(?:(amd|x(?:(?:86|64)[-_])?|wow|win)64)[;\)]/i],[[f,"amd64"]],[/(ia32(?=;))/i],[[f,B]],[/((?:i[346]|x)86)[;\)]/i],[[f,"ia32"]],[/\b(aarch64|arm(v?8e?l?|_?64))\b/i],[[f,"arm64"]],[/\b(arm(?:v[67])?ht?n?[fl]p?)\b/i],[[f,"armhf"]],[/windows (ce|mobile); ppc;/i],[[f,"arm"]],[/((?:ppc|powerpc)(?:64)?)(?: mac|;|\))/i],[[f,/ower/,"",B]],[/(sun4\w)[;\)]/i],[[f,"sparc"]],[/((?:avr32|ia64(?=;))|68k(?=\))|\barm(?=v(?:[1-7]|[5-7]1)l?|;|eabi)|(?=atmel )avr|(?:irix|mips|sparc)(?:64)?\b|pa-risc)/i],[[f,B]]],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,[d,j],[c,m]],[/\b((?:s[cgp]h|gt|sm)-\w+|galaxy nexus)/i,/samsung[- ]([-\w]+)/i,/sec-(sgh\w+)/i],[u,[d,j],[c,b]],[/\((ip(?:hone|od)[\w ]*);/i],[u,[d,E],[c,b]],[/\((ipad);[-\w\),; ]+apple/i,/applecoremedia\/[\w\.]+ \((ipad)/i,/\b(ipad)\d\d?,\d\d?[;\]].+ios/i],[u,[d,E],[c,m]],[/\b((?:ag[rs][23]?|bah2?|sht?|btv)-a?[lw]\d{2})\b(?!.+d\/s)/i],[u,[d,I],[c,m]],[/(?:huawei|honor)([-\w ]+)[;\)]/i,/\b(nexus 6p|\w{2,4}e?-[atu]?[ln][\dx][012359c][adn]?)\b(?!.+d\/s)/i],[u,[d,I],[c,b]],[/\b(poco[\w ]+)(?: bui|\))/i,/\b; (\w+) build\/hm\1/i,/\b(hm[-_ ]?note?[_ ]?(?:\d\w)?) bui/i,/\b(redmi[\-_ ]?(?:note|k)?[\w_ ]+)(?: bui|\))/i,/\b(mi[-_ ]?(?:a\d|one|one[_ ]plus|note lte|max|cc)?[_ ]?(?:\d?\w?)[_ ]?(?:plus|se|lite)?)(?: bui|\))/i],[[u,/_/g," "],[d,z],[c,b]],[/\b(mi[-_ ]?(?:pad)(?:[\w_ ]+))(?: bui|\))/i],[[u,/_/g," "],[d,z],[c,m]],[/; (\w+) bui.+ oppo/i,/\b(cph[12]\d{3}|p(?:af|c[al]|d\w|e[ar])[mt]\d0|x9007|a101op)\b/i],[u,[d,"OPPO"],[c,b]],[/vivo (\w+)(?: bui|\))/i,/\b(v[12]\d{3}\w?[at])(?: bui|;)/i],[u,[d,"Vivo"],[c,b]],[/\b(rmx[12]\d{3})(?: bui|;|\))/i],[u,[d,"Realme"],[c,b]],[/\b(milestone|droid(?:[2-4x]| (?:bionic|x2|pro|razr))?:?( 4g)?)\b[\w ]+build\//i,/\bmot(?:orola)?[- ](\w*)/i,/((?:moto[\w\(\) ]+|xt\d{3,4}|nexus 6)(?= bui|\)))/i],[u,[d,A],[c,b]],[/\b(mz60\d|xoom[2 ]{0,2}) build\//i],[u,[d,A],[c,m]],[/((?=lg)?[vl]k\-?\d{3}) bui| 3\.[-\w; ]{10}lg?-([06cv9]{3,4})/i],[u,[d,N],[c,m]],[/(lm(?:-?f100[nv]?|-[\w\.]+)(?= bui|\))|nexus [45])/i,/\blg[-e;\/ ]+((?!browser|netcast|android tv)\w+)/i,/\blg-?([\d\w]+) bui/i],[u,[d,N],[c,b]],[/(ideatab[-\w ]+)/i,/lenovo ?(s[56]000[-\w]+|tab(?:[\w ]+)|yt[-\d\w]{6}|tb[-\d\w]{6})/i],[u,[d,"Lenovo"],[c,m]],[/(?:maemo|nokia).*(n900|lumia \d+)/i,/nokia[-_ ]?([-\w\.]*)/i],[[u,/_/g," "],[d,"Nokia"],[c,b]],[/(pixel c)\b/i],[u,[d,O],[c,m]],[/droid.+; (pixel[\daxl ]{0,6})(?: bui|\))/i],[u,[d,O],[c,b]],[/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],[u,[d,P],[c,b]],[/sony tablet [ps]/i,/\b(?:sony)?sgp\w+(?: bui|\))/i],[[u,"Xperia Tablet"],[d,P],[c,m]],[/ (kb2005|in20[12]5|be20[12][59])\b/i,/(?:one)?(?:plus)? (a\d0\d\d)(?: b|\))/i],[u,[d,"OnePlus"],[c,b]],[/(alexa)webm/i,/(kf[a-z]{2}wi)( bui|\))/i,/(kf[a-z]+)( bui|\)).+silk\//i],[u,[d,y],[c,m]],[/((?:sd|kf)[0349hijorstuw]+)( bui|\)).+silk\//i],[[u,/(.+)/g,"Fire Phone $1"],[d,y],[c,b]],[/(playbook);[-\w\),; ]+(rim)/i],[u,d,[c,m]],[/\b((?:bb[a-f]|st[hv])100-\d)/i,/\(bb10; (\w+)/i],[u,[d,k],[c,b]],[/(?:\b|asus_)(transfo[prime ]{4,10} \w+|eeepc|slider \w+|nexus 7|padfone|p00[cj])/i],[u,[d,x],[c,m]],[/ (z[bes]6[027][012][km][ls]|zenfone \d\w?)\b/i],[u,[d,x],[c,b]],[/(nexus 9)/i],[u,[d,"HTC"],[c,m]],[/(htc)[-;_ ]{1,2}([\w ]+(?=\)| bui)|\w+)/i,/(zte)[- ]([\w ]+?)(?: bui|\/|\))/i,/(alcatel|geeksphone|nexian|panasonic|sony(?!-bra))[-_ ]?([-\w]*)/i],[d,[u,/_/g," "],[c,b]],[/droid.+; ([ab][1-7]-?[0178a]\d\d?)/i],[u,[d,"Acer"],[c,m]],[/droid.+; (m[1-5] note) bui/i,/\bmz-([-\w]{2,})/i],[u,[d,"Meizu"],[c,b]],[/\b(sh-?[altvz]?\d\d[a-ekm]?)/i],[u,[d,D],[c,b]],[/(blackberry|benq|palm(?=\-)|sonyericsson|acer|asus|dell|meizu|motorola|polytron)[-_ ]?([-\w]*)/i,/(hp) ([\w ]+\w)/i,/(asus)-?(\w+)/i,/(microsoft); (lumia[\w ]+)/i,/(lenovo)[-_ ]?([-\w]+)/i,/(jolla)/i,/(oppo) ?([\w ]+) bui/i],[d,u,[c,b]],[/(archos) (gamepad2?)/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],[d,u,[c,m]],[/(surface duo)/i],[u,[d,C],[c,m]],[/droid [\d\.]+; (fp\du?)(?: b|\))/i],[u,[d,"Fairphone"],[c,b]],[/(u304aa)/i],[u,[d,"AT&T"],[c,b]],[/\bsie-(\w*)/i],[u,[d,"Siemens"],[c,b]],[/\b(rct\w+) b/i],[u,[d,"RCA"],[c,m]],[/\b(venue[\d ]{2,7}) b/i],[u,[d,"Dell"],[c,m]],[/\b(q(?:mv|ta)\w+) b/i],[u,[d,"Verizon"],[c,m]],[/\b(?:barnes[& ]+noble |bn[rt])([\w\+ ]*) b/i],[u,[d,"Barnes & Noble"],[c,m]],[/\b(tm\d{3}\w+) b/i],[u,[d,"NuVision"],[c,m]],[/\b(k88) b/i],[u,[d,"ZTE"],[c,m]],[/\b(nx\d{3}j) b/i],[u,[d,"ZTE"],[c,b]],[/\b(gen\d{3}) b.+49h/i],[u,[d,"Swiss"],[c,b]],[/\b(zur\d{3}) b/i],[u,[d,"Swiss"],[c,m]],[/\b((zeki)?tb.*\b) b/i],[u,[d,"Zeki"],[c,m]],[/\b([yr]\d{2}) b/i,/\b(dragon[- ]+touch |dt)(\w{5}) b/i],[[d,"Dragon Touch"],u,[c,m]],[/\b(ns-?\w{0,9}) b/i],[u,[d,"Insignia"],[c,m]],[/\b((nxa|next)-?\w{0,9}) b/i],[u,[d,"NextBook"],[c,m]],[/\b(xtreme\_)?(v(1[045]|2[015]|[3469]0|7[05])) b/i],[[d,"Voice"],u,[c,b]],[/\b(lvtel\-)?(v1[12]) b/i],[[d,"LvTel"],u,[c,b]],[/\b(ph-1) /i],[u,[d,"Essential"],[c,b]],[/\b(v(100md|700na|7011|917g).*\b) b/i],[u,[d,"Envizen"],[c,m]],[/\b(trio[-\w\. ]+) b/i],[u,[d,"MachSpeed"],[c,m]],[/\btu_(1491) b/i],[u,[d,"Rotor"],[c,m]],[/(shield[\w ]+) b/i],[u,[d,"Nvidia"],[c,m]],[/(sprint) (\w+)/i],[d,u,[c,b]],[/(kin\.[onetw]{3})/i],[[u,/\./g," "],[d,C],[c,b]],[/droid.+; (cc6666?|et5[16]|mc[239][23]x?|vc8[03]x?)\)/i],[u,[d,M],[c,m]],[/droid.+; (ec30|ps20|tc[2-8]\d[kx])\)/i],[u,[d,M],[c,b]],[/(ouya)/i,/(nintendo) ([wids3utch]+)/i],[d,u,[c,g]],[/droid.+; (shield) bui/i],[u,[d,"Nvidia"],[c,g]],[/(playstation [345portablevi]+)/i],[u,[d,P],[c,g]],[/\b(xbox(?: one)?(?!; xbox))[\); ]/i],[u,[d,C],[c,g]],[/smart-tv.+(samsung)/i],[d,[c,v]],[/hbbtv.+maple;(\d+)/i],[[u,/^/,"SmartTV"],[d,j],[c,v]],[/(nux; netcast.+smarttv|lg (netcast\.tv-201\d|android tv))/i],[[d,N],[c,v]],[/(apple) ?tv/i],[d,[u,E+" TV"],[c,v]],[/crkey/i],[[u,L+"cast"],[d,O],[c,v]],[/droid.+aft(\w)( bui|\))/i],[u,[d,y],[c,v]],[/\(dtv[\);].+(aquos)/i,/(aquos-tv[\w ]+)\)/i],[u,[d,D],[c,v]],[/(bravia[\w ]+)( bui|\))/i],[u,[d,P],[c,v]],[/(mitv-\w{5}) bui/i],[u,[d,z],[c,v]],[/\b(roku)[\dx]*[\)\/]((?:dvp-)?[\d\.]*)/i,/hbbtv\/\d+\.\d+\.\d+ +\([\w ]*; *(\w[^;]*);([^;]*)/i],[[d,U],[u,U],[c,v]],[/\b(android tv|smart[- ]?tv|opera tv|tv; rv:)\b/i],[[c,v]],[/((pebble))app/i],[d,u,[c,h]],[/droid.+; (glass) \d/i],[u,[d,O],[c,h]],[/droid.+; (wt63?0{2,3})\)/i],[u,[d,M],[c,h]],[/(quest( 2)?)/i],[u,[d,F],[c,h]],[/(tesla)(?: qtcarbrowser|\/[-\w\.]+)/i],[d,[c,w]],[/droid .+?; ([^;]+?)(?: bui|\) applew).+? mobile safari/i],[u,[c,b]],[/droid .+?; ([^;]+?)(?: bui|\) applew).+?(?! mobile) safari/i],[u,[c,m]],[/\b((tablet|tab)[;\/]|focus\/\d(?!.+mobile))/i],[[c,m]],[/(phone|mobile(?:[;\/]| [ \w\/\.]*safari)|pda(?=.+windows ce))/i],[[c,b]],[/(android[-\w\. ]{0,9});.+buil/i],[u,[d,"Generic"]]],engine:[[/windows.+ edge\/([\w\.]+)/i],[p,[l,"EdgeHTML"]],[/webkit\/537\.36.+chrome\/(?!27)([\w\.]+)/i],[p,[l,"Blink"]],[/(presto)\/([\w\.]+)/i,/(webkit|trident|netfront|netsurf|amaya|lynx|w3m|goanna)\/([\w\.]+)/i,/ekioh(flow)\/([\w\.]+)/i,/(khtml|tasman|links)[\/ ]\(?([\w\.]+)/i,/(icab)[\/ ]([23]\.[\d\.]+)/i],[l,p],[/rv\:([\w\.]{1,9})\b.+(gecko)/i],[p,l]],os:[[/microsoft (windows) (vista|xp)/i],[l,p],[/(windows) nt 6\.2; (arm)/i,/(windows (?:phone(?: os)?|mobile))[\/ ]?([\d\.\w ]*)/i,/(windows)[\/ ]?([ntce\d\. ]+\w)(?!.+xbox)/i],[l,[p,V,G]],[/(win(?=3|9|n)|win 9x )([nt\d\.]+)/i],[[l,"Windows"],[p,V,G]],[/ip[honead]{2,4}\b(?:.*os ([\w]+) like mac|; opera)/i,/cfnetwork\/.+darwin/i],[[p,/_/g,"."],[l,"iOS"]],[/(mac os x) ?([\w\. ]*)/i,/(macintosh|mac_powerpc\b)(?!.+haiku)/i],[[l,"Mac OS"],[p,/_/g,"."]],[/droid ([\w\.]+)\b.+(android[- ]x86|harmonyos)/i],[p,l],[/(android|webos|qnx|bada|rim tablet os|maemo|meego|sailfish)[-\/ ]?([\w\.]*)/i,/(blackberry)\w*\/([\w\.]*)/i,/(tizen|kaios)[\/ ]([\w\.]+)/i,/\((series40);/i],[l,p],[/\(bb(10);/i],[p,[l,k]],[/(?:symbian ?os|symbos|s60(?=;)|series60)[-\/ ]?([\w\.]*)/i],[p,[l,"Symbian"]],[/mozilla\/[\d\.]+ \((?:mobile|tablet|tv|mobile; [\w ]+); rv:.+ gecko\/([\w\.]+)/i],[p,[l,S+" OS"]],[/web0s;.+rt(tv)/i,/\b(?:hp)?wos(?:browser)?\/([\w\.]+)/i],[p,[l,"webOS"]],[/crkey\/([\d\.]+)/i],[p,[l,L+"cast"]],[/(cros) [\w]+ ([\w\.]+\w)/i],[[l,"Chromium OS"],p],[/(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) ?([\w\.]*)/i,/(gnu) ?([\w\.]*)/i,/\b([-frentopcghs]{0,5}bsd|dragonfly)[\/ ]?(?!amd|[ix346]{1,2}86)([\w\.]*)/i,/(haiku) (\w+)/i],[l,p],[/(sunos) ?([\w\.\d]*)/i],[[l,"Solaris"],p],[/((?:open)?solaris)[-\/ ]?([\w\.]*)/i,/(aix) ((\d)(?=\.|\)| )[\w\.])*/i,/\b(beos|os\/2|amigaos|morphos|openvms|fuchsia|hp-ux)/i,/(unix) ?([\w\.]*)/i],[l,p]]},K=function(e,n){if(typeof e===a&&(n=e,e=i),!(this instanceof K))return new K(e,n).getResult();var r=e||(typeof t!==o&&t.navigator&&t.navigator.userAgent?t.navigator.userAgent:""),g=n?function(e,n){var t={};for(var i in e)n[i]&&n[i].length%2==0?t[i]=n[i].concat(e[i]):t[i]=e[i];return t}(W,n):W;return this.getBrowser=function(){var e,n={};return n[l]=i,n[p]=i,q.call(n,r,g.browser),n.major=typeof(e=n.version)===s?e.replace(/[^\d\.]/g,"").split(".")[0]:i,n},this.getCPU=function(){var e={};return e[f]=i,q.call(e,r,g.cpu),e},this.getDevice=function(){var e={};return e[d]=i,e[u]=i,e[c]=i,q.call(e,r,g.device),e},this.getEngine=function(){var e={};return e[l]=i,e[p]=i,q.call(e,r,g.engine),e},this.getOS=function(){var e={};return e[l]=i,e[p]=i,q.call(e,r,g.os),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 r},this.setUA=function(e){return r=typeof e===s&&e.length>350?U(e,350):e,this},this.setUA(r),this};K.VERSION="1.0.32",K.BROWSER=_([l,p,"major"]),K.CPU=_([f]),K.DEVICE=_([u,d,c,g,b,v,m,h,w]),K.ENGINE=K.OS=_([l,p]),e.exports&&(n=e.exports=K),n.UAParser=K;var H=typeof t!==o&&(t.jQuery||t.Zepto);if(H&&!H.ua){var X=new K;H.ua=X.getResult(),H.ua.get=function(){return X.getUA()},H.ua.set=function(e){X.setUA(e);var n=X.getResult();for(var t in n)H.ua[t]=n[t]}}}("object"==typeof window?window:mn)}(hn,vn);const wn=()=>{const e=new vn.UAParser,{name:n,version:t}=e.getBrowser(),{name:i,version:r}=e.getOS(),o=e.getUA(),a=navigator.language,s="unknown";return{browser:{name:null!=n?n:s,version:null!=t?t:s,os:`${null!=i?i:s} ${null!=r?r:s}`,userAgent:null!=o?o:s,language:null!=a?a:s,mobile:navigator.userAgent.includes("Mobi")}}},yn=()=>({page:{url:location.href}}),En=[wn,yn];function xn(e){return{id:N(),attributes:e}}const kn={name:"default"};function Tn(e,n,t,i){return new(t||(t=Promise))((function(r,o){function a(e){try{u(i.next(e))}catch(e){o(e)}}function s(e){try{u(i.throw(e))}catch(e){o(e)}}function u(e){var n;e.done?r(e.value):(n=e.value,n instanceof t?n:new t((function(e){e(n)}))).then(a,s)}u((i=i.apply(e,n||[])).next())}))}class Ln extends q{constructor(e){var n,t,i,r;super(),this.options=e,this.name="@grafana/faro-web-sdk:transport-fetch",this.version=Z,this.disabledUntil=new Date,this.rateLimitBackoffMs=null!==(n=e.defaultRateLimitBackoffMs)&&void 0!==n?n:5e3,this.getNow=null!==(t=e.getNow)&&void 0!==t?t:()=>Date.now(),this.promiseBuffer=O({size:null!==(i=e.bufferSize)&&void 0!==i?i:30,concurrency:null!==(r=e.concurrency)&&void 0!==r?r:5})}send(e){return Tn(this,void 0,void 0,(function*(){try{if(this.disabledUntil>new Date(this.getNow()))return this.logWarn(`Dropping transport item due to too many requests. Backoff until ${this.disabledUntil}`),Promise.resolve();yield this.promiseBuffer.add((()=>{const n=JSON.stringify(V(e)),{url:t,requestOptions:i,apiKey:r}=this.options,o=null!=i?i:{},{headers:a}=o,s=function(e,n){var t={};for(var i in e)Object.prototype.hasOwnProperty.call(e,i)&&n.indexOf(i)<0&&(t[i]=e[i]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var r=0;for(i=Object.getOwnPropertySymbols(e);r<i.length;r++)n.indexOf(i[r])<0&&Object.prototype.propertyIsEnumerable.call(e,i[r])&&(t[i[r]]=e[i[r]])}return t}(o,["headers"]);return fetch(t,Object.assign({method:"POST",headers:Object.assign(Object.assign({"Content-Type":"application/json"},null!=a?a:{}),r?{"x-api-key":r}:{}),body:n,keepalive:!0},null!=s?s:{})).then((e=>(429===e.status&&(this.disabledUntil=this.getRetryAfterDate(e),this.logWarn(`Too many requests, backing off until ${this.disabledUntil}`)),e.text().catch(S),e))).catch((e=>{this.logError("Failed sending payload to the receiver\n",JSON.parse(n),e)}))}))}catch(e){this.logError(e)}}))}getIgnoreUrls(){return[this.options.url]}getRetryAfterDate(e){const n=this.getNow(),t=e.headers.get("Retry-After");if(t){const e=Number(t);if(!isNaN(e))return new Date(1e3*e+n);const i=Date.parse(t);if(!isNaN(i))return new Date(i)}return new Date(n+this.rateLimitBackoffMs)}}function Sn(e){var n,t,i,r,o,a,s,u,l,c,d;const p=[],f=_(e.unpatchedConsole,e.internalLoggerLevel);return e.transports?((e.url||e.apiKey)&&f.error('if "transports" is defined, "url" and "apiKey" should not be defined'),p.push(...e.transports)):e.url?p.push(new Ln({url:e.url,apiKey:e.apiKey})):f.error('either "url" or "transports" must be defined'),{app:e.app,dedupe:null===(n=e.dedupe)||void 0===n||n,globalObjectKey:e.globalObjectKey||te,instrumentations:null!==(t=e.instrumentations)&&void 0!==t?t:gn(),internalLoggerLevel:null!==(i=e.internalLoggerLevel)&&void 0!==i?i:P,isolate:null!==(r=e.isolate)&&void 0!==r&&r,metas:null!==(o=e.metas)&&void 0!==o?o:En,parseStacktrace:we,paused:null!==(a=e.paused)&&void 0!==a&&a,preventGlobalExposure:null!==(s=e.preventGlobalExposure)&&void 0!==s&&s,transports:p,unpatchedConsole:null!==(u=e.unpatchedConsole)&&void 0!==u?u:z,beforeSend:e.beforeSend,eventDomain:null!==(l=e.eventDomain)&&void 0!==l?l:bn,ignoreErrors:e.ignoreErrors,session:null!==(c=e.session)&&void 0!==c?c:xn(),user:e.user,view:null!==(d=e.view)&&void 0!==d?d:kn}}return e.BaseExtension=U,e.BaseInstrumentation=X,e.BaseTransport=q,e.ConsoleInstrumentation=oe,e.ConsoleTransport=class extends q{constructor(e={}){super(),this.options=e,this.name="@grafana/faro-web-sdk:transport-console",this.version=Z}send(n){var t;return this.unpatchedConsole[null!==(t=this.options.level)&&void 0!==t?t:e.LogLevel.DEBUG]("New event",V(n))}},e.Conventions=ie,e.ErrorsInstrumentation=xe,e.FetchTransport=Ln,e.VERSION=Z,e.ViewInstrumentation=ke,e.WebVitalsInstrumentation=fn,e.allLogLevels=L,e.browserMeta=wn,e.buildStackFrame=me,e.createInternalLogger=_,e.createPromiseBuffer=O,e.createSession=xn,e.deepEqual=E,e.defaultEventDomain=bn,e.defaultExceptionType=G,e.defaultGlobalObjectKey=te,e.defaultInternalLoggerLevel=P,e.defaultLogLevel=T,e.defaultMetas=En,e.defaultViewMeta=kn,e.genShortID=N,e.getCurrentTimestamp=x,e.getDataFromSafariExtensions=ve,e.getInternalFaroFromGlobalObject=function(){return H[J]},e.getStackFramesFromError=he,e.getTransportBody=V,e.getWebInstrumentations=gn,e.globalObject=H,e.initializeFaro=function(e){const n=Sn(e);if(n)return ne(n)},e.internalGlobalObjectKey=J,e.isArray=c,e.isBoolean=e=>n(e,"boolean"),e.isDomError=v,e.isDomException=h,e.isElement=e=>w&&i(e,Element),e.isElementDefined=w,e.isError=b,e.isErrorDefined=g,e.isErrorEvent=m,e.isEvent=f,e.isEventDefined=p,e.isFunction=l,e.isInstanceOf=i,e.isInt=e=>s(e)&&Number.isInteger(e),e.isInternalFaroOnGlobalObject=Y,e.isMap=e=>y&&i(e,Map),e.isMapDefined=y,e.isNull=o,e.isNumber=s,e.isObject=u,e.isPrimitive=d,e.isRegExp=e=>t(e,"RegExp"),e.isString=a,e.isSymbol=e=>n(e,"symbol"),e.isSyntheticEvent=e=>u(e)&&"nativeEvent"in e&&"preventDefault"in e&&"stopPropagation"in e,e.isThenable=e=>l(null==e?void 0:e.then),e.isToString=t,e.isTypeof=n,e.isUndefined=r,e.makeCoreConfig=Sn,e.noop=S,e.pageMeta=yn,e.parseStacktrace=we,e.setInternalFaroOnGlobalObject=Q,e.transportItemTypeToBodyKey=A,e}({});
@@ -7,9 +7,6 @@ var getErrorDetails_1 = require("./getErrorDetails");
7
7
  var getValueAndTypeFromMessage_1 = require("./getValueAndTypeFromMessage");
8
8
  var stackFrames_1 = require("./stackFrames");
9
9
  function registerOnerror(api) {
10
- // The error event is a little bit different than other events when it comes to the listener
11
- // window.addEventListener does not provide all parameters, hence we need to use the window.onerror syntax
12
- // TODO: investigate https://developer.mozilla.org/en-US/docs/Web/API/GlobalEventHandlers/onerror
13
10
  var oldOnerror = window.onerror;
14
11
  window.onerror = function () {
15
12
  var _a, _b;
@@ -1 +1 @@
1
- {"version":3,"file":"registerOnerror.js","sourceRoot":"","sources":["../../../../src/instrumentations/errors/registerOnerror.ts"],"names":[],"mappings":";;;AAAA,gDAA8C;AAG9C,iCAAwC;AACxC,qDAAoD;AACpD,2EAA0E;AAC1E,6CAAgD;AAEhD,SAAgB,eAAe,CAAC,GAAQ;IACtC,4FAA4F;IAC5F,0GAA0G;IAC1G,iGAAiG;IAEjG,IAAM,UAAU,GAAG,MAAM,CAAC,OAAO,CAAC;IAElC,MAAM,CAAC,OAAO,GAAG;;QAAC,cAAO;aAAP,UAAO,EAAP,qBAAO,EAAP,IAAO;YAAP,yBAAO;;QACvB,IAAI;YACK,IAAA,GAAG,GAAkC,IAAI,GAAtC,EAAE,MAAM,GAA0B,IAAI,GAA9B,EAAE,MAAM,GAAkB,IAAI,GAAtB,EAAE,KAAK,GAAW,IAAI,GAAf,EAAE,KAAK,GAAI,IAAI,GAAR,CAAS;YACjD,IAAI,KAAK,SAAoB,CAAC;YAC9B,IAAI,IAAI,SAAoB,CAAC;YAC7B,IAAI,WAAW,GAA0B,EAAE,CAAC;YAC5C,IAAM,aAAa,GAAG,IAAA,oBAAQ,EAAC,GAAG,CAAC,CAAC;YACpC,IAAM,iBAAiB,GAAG,IAAA,6BAAe,EAAC,MAAM,EAAE,qBAAa,EAAE,MAAM,EAAE,KAAK,CAAC,CAAC;YAEhF,IAAI,KAAK,IAAI,CAAC,aAAa,EAAE;gBAC3B,KAA6B,IAAA,iCAAe,EAAC,CAAC,KAAK,aAAL,KAAK,cAAL,KAAK,GAAI,GAAG,CAAkB,CAAC,EAA5E,KAAK,QAAA,EAAE,IAAI,QAAA,EAAE,WAAW,QAAA,CAAqD;gBAE9E,IAAI,WAAW,CAAC,MAAM,KAAK,CAAC,EAAE;oBAC5B,WAAW,GAAG,CAAC,iBAAiB,CAAC,CAAC;iBACnC;aACF;iBAAM,IAAI,aAAa,EAAE;gBACxB,KAAgB,IAAA,uDAA0B,EAAC,GAAG,CAAC,EAA9C,KAAK,QAAA,EAAE,IAAI,QAAA,CAAoC;gBAChD,WAAW,GAAG,CAAC,iBAAiB,CAAC,CAAC;aACnC;YAED,IAAI,KAAK,EAAE;gBACT,GAAG,CAAC,SAAS,CAAC,IAAI,KAAK,CAAC,KAAK,CAAC,EAAE,EAAE,IAAI,MAAA,EAAE,WAAW,aAAA,EAAE,CAAC,CAAC;aACxD;SACF;gBAAS;YACR,UAAU,aAAV,UAAU,uBAAV,UAAU,CAAE,KAAK,CAAC,MAAM,EAAE,IAAI,CAAC,CAAC;SACjC;IACH,CAAC,CAAC;AACJ,CAAC;AAlCD,0CAkCC","sourcesContent":["import { isString } from '@grafana/faro-core';\nimport type { API, ExceptionStackFrame } from '@grafana/faro-core';\n\nimport { unknownString } from './const';\nimport { getErrorDetails } from './getErrorDetails';\nimport { getValueAndTypeFromMessage } from './getValueAndTypeFromMessage';\nimport { buildStackFrame } from './stackFrames';\n\nexport function registerOnerror(api: API): void {\n // The error event is a little bit different than other events when it comes to the listener\n // window.addEventListener does not provide all parameters, hence we need to use the window.onerror syntax\n // TODO: investigate https://developer.mozilla.org/en-US/docs/Web/API/GlobalEventHandlers/onerror\n\n const oldOnerror = window.onerror;\n\n window.onerror = (...args) => {\n try {\n const [evt, source, lineno, colno, error] = args;\n let value: string | undefined;\n let type: string | undefined;\n let stackFrames: ExceptionStackFrame[] = [];\n const eventIsString = isString(evt);\n const initialStackFrame = buildStackFrame(source, unknownString, lineno, colno);\n\n if (error || !eventIsString) {\n [value, type, stackFrames] = getErrorDetails((error ?? evt) as Error | Event);\n\n if (stackFrames.length === 0) {\n stackFrames = [initialStackFrame];\n }\n } else if (eventIsString) {\n [value, type] = getValueAndTypeFromMessage(evt);\n stackFrames = [initialStackFrame];\n }\n\n if (value) {\n api.pushError(new Error(value), { type, stackFrames });\n }\n } finally {\n oldOnerror?.apply(window, args);\n }\n };\n}\n"]}
1
+ {"version":3,"file":"registerOnerror.js","sourceRoot":"","sources":["../../../../src/instrumentations/errors/registerOnerror.ts"],"names":[],"mappings":";;;AAAA,gDAA8C;AAG9C,iCAAwC;AACxC,qDAAoD;AACpD,2EAA0E;AAC1E,6CAAgD;AAEhD,SAAgB,eAAe,CAAC,GAAQ;IACtC,IAAM,UAAU,GAAG,MAAM,CAAC,OAAO,CAAC;IAElC,MAAM,CAAC,OAAO,GAAG;;QAAC,cAAO;aAAP,UAAO,EAAP,qBAAO,EAAP,IAAO;YAAP,yBAAO;;QACvB,IAAI;YACK,IAAA,GAAG,GAAkC,IAAI,GAAtC,EAAE,MAAM,GAA0B,IAAI,GAA9B,EAAE,MAAM,GAAkB,IAAI,GAAtB,EAAE,KAAK,GAAW,IAAI,GAAf,EAAE,KAAK,GAAI,IAAI,GAAR,CAAS;YACjD,IAAI,KAAK,SAAoB,CAAC;YAC9B,IAAI,IAAI,SAAoB,CAAC;YAC7B,IAAI,WAAW,GAA0B,EAAE,CAAC;YAC5C,IAAM,aAAa,GAAG,IAAA,oBAAQ,EAAC,GAAG,CAAC,CAAC;YACpC,IAAM,iBAAiB,GAAG,IAAA,6BAAe,EAAC,MAAM,EAAE,qBAAa,EAAE,MAAM,EAAE,KAAK,CAAC,CAAC;YAEhF,IAAI,KAAK,IAAI,CAAC,aAAa,EAAE;gBAC3B,KAA6B,IAAA,iCAAe,EAAC,CAAC,KAAK,aAAL,KAAK,cAAL,KAAK,GAAI,GAAG,CAAkB,CAAC,EAA5E,KAAK,QAAA,EAAE,IAAI,QAAA,EAAE,WAAW,QAAA,CAAqD;gBAE9E,IAAI,WAAW,CAAC,MAAM,KAAK,CAAC,EAAE;oBAC5B,WAAW,GAAG,CAAC,iBAAiB,CAAC,CAAC;iBACnC;aACF;iBAAM,IAAI,aAAa,EAAE;gBACxB,KAAgB,IAAA,uDAA0B,EAAC,GAAG,CAAC,EAA9C,KAAK,QAAA,EAAE,IAAI,QAAA,CAAoC;gBAChD,WAAW,GAAG,CAAC,iBAAiB,CAAC,CAAC;aACnC;YAED,IAAI,KAAK,EAAE;gBACT,GAAG,CAAC,SAAS,CAAC,IAAI,KAAK,CAAC,KAAK,CAAC,EAAE,EAAE,IAAI,MAAA,EAAE,WAAW,aAAA,EAAE,CAAC,CAAC;aACxD;SACF;gBAAS;YACR,UAAU,aAAV,UAAU,uBAAV,UAAU,CAAE,KAAK,CAAC,MAAM,EAAE,IAAI,CAAC,CAAC;SACjC;IACH,CAAC,CAAC;AACJ,CAAC;AA9BD,0CA8BC","sourcesContent":["import { isString } from '@grafana/faro-core';\nimport type { API, ExceptionStackFrame } from '@grafana/faro-core';\n\nimport { unknownString } from './const';\nimport { getErrorDetails } from './getErrorDetails';\nimport { getValueAndTypeFromMessage } from './getValueAndTypeFromMessage';\nimport { buildStackFrame } from './stackFrames';\n\nexport function registerOnerror(api: API): void {\n const oldOnerror = window.onerror;\n\n window.onerror = (...args) => {\n try {\n const [evt, source, lineno, colno, error] = args;\n let value: string | undefined;\n let type: string | undefined;\n let stackFrames: ExceptionStackFrame[] = [];\n const eventIsString = isString(evt);\n const initialStackFrame = buildStackFrame(source, unknownString, lineno, colno);\n\n if (error || !eventIsString) {\n [value, type, stackFrames] = getErrorDetails((error ?? evt) as Error | Event);\n\n if (stackFrames.length === 0) {\n stackFrames = [initialStackFrame];\n }\n } else if (eventIsString) {\n [value, type] = getValueAndTypeFromMessage(evt);\n stackFrames = [initialStackFrame];\n }\n\n if (value) {\n api.pushError(new Error(value), { type, stackFrames });\n }\n } finally {\n oldOnerror?.apply(window, args);\n }\n };\n}\n"]}
@@ -16,7 +16,6 @@ var __extends = (this && this.__extends) || (function () {
16
16
  })();
17
17
  Object.defineProperty(exports, "__esModule", { value: true });
18
18
  exports.SessionInstrumentation = void 0;
19
- var ua_parser_js_1 = require("ua-parser-js");
20
19
  var faro_core_1 = require("@grafana/faro-core");
21
20
  // all this does is send SESSION_START event
22
21
  var SessionInstrumentation = /** @class */ (function (_super) {
@@ -24,7 +23,7 @@ var SessionInstrumentation = /** @class */ (function (_super) {
24
23
  function SessionInstrumentation() {
25
24
  var _this = _super !== null && _super.apply(this, arguments) || this;
26
25
  _this.name = '@grafana/faro-web-sdk:instrumentation-session';
27
- _this.version = ua_parser_js_1.VERSION;
26
+ _this.version = faro_core_1.VERSION;
28
27
  return _this;
29
28
  }
30
29
  SessionInstrumentation.prototype.sendSessionStartEvent = function (meta) {
@@ -1 +1 @@
1
- {"version":3,"file":"instrumentation.js","sourceRoot":"","sources":["../../../../src/instrumentations/session/instrumentation.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;AAAA,6CAAuC;AAEvC,gDAAyF;AAEzF,4CAA4C;AAC5C;IAA4C,0CAAmB;IAA/D;QAAA,qEAwBC;QAvBU,UAAI,GAAG,+CAA+C,CAAC;QACvD,aAAO,GAAG,sBAAO,CAAC;;IAsB7B,CAAC;IAhBS,sDAAqB,GAA7B,UAA8B,IAAU;QACtC,IAAM,OAAO,GAAG,IAAI,CAAC,OAAO,CAAC;QAE7B,IAAI,OAAO,IAAI,OAAO,KAAK,IAAI,CAAC,eAAe,EAAE;YAC/C,IAAI,CAAC,eAAe,GAAG,OAAO,CAAC;YAC/B,8EAA8E;YAC9E,gBAAgB;YAChB,IAAI,CAAC,GAAG,CAAC,SAAS,CAAC,uBAAW,CAAC,UAAU,CAAC,aAAa,EAAE,EAAE,EAAE,SAAS,EAAE,EAAE,UAAU,EAAE,IAAI,EAAE,CAAC,CAAC;SAC/F;IACH,CAAC;IAED,2CAAU,GAAV;QACE,IAAI,CAAC,qBAAqB,CAAC,IAAI,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC;QAE7C,IAAI,CAAC,KAAK,CAAC,WAAW,CAAC,IAAI,CAAC,qBAAqB,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC;IAChE,CAAC;IACH,6BAAC;AAAD,CAAC,AAxBD,CAA4C,+BAAmB,GAwB9D;AAxBY,wDAAsB","sourcesContent":["import { VERSION } from 'ua-parser-js';\n\nimport { BaseInstrumentation, Conventions, Meta, MetaSession } from '@grafana/faro-core';\n\n// all this does is send SESSION_START event\nexport class SessionInstrumentation extends BaseInstrumentation {\n readonly name = '@grafana/faro-web-sdk:instrumentation-session';\n readonly version = VERSION;\n\n // previously notified session, to ensure we don't send session start\n // event twice for the same session\n private notifiedSession: MetaSession | undefined;\n\n private sendSessionStartEvent(meta: Meta): void {\n const session = meta.session;\n\n if (session && session !== this.notifiedSession) {\n this.notifiedSession = session;\n // no need to add attributes and session id, they are included as part of meta\n // automatically\n this.api.pushEvent(Conventions.EventNames.SESSION_START, {}, undefined, { skipDedupe: true });\n }\n }\n\n initialize() {\n this.sendSessionStartEvent(this.metas.value);\n\n this.metas.addListener(this.sendSessionStartEvent.bind(this));\n }\n}\n"]}
1
+ {"version":3,"file":"instrumentation.js","sourceRoot":"","sources":["../../../../src/instrumentations/session/instrumentation.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;AAAA,gDAAkG;AAElG,4CAA4C;AAC5C;IAA4C,0CAAmB;IAA/D;QAAA,qEAwBC;QAvBU,UAAI,GAAG,+CAA+C,CAAC;QACvD,aAAO,GAAG,mBAAO,CAAC;;IAsB7B,CAAC;IAhBS,sDAAqB,GAA7B,UAA8B,IAAU;QACtC,IAAM,OAAO,GAAG,IAAI,CAAC,OAAO,CAAC;QAE7B,IAAI,OAAO,IAAI,OAAO,KAAK,IAAI,CAAC,eAAe,EAAE;YAC/C,IAAI,CAAC,eAAe,GAAG,OAAO,CAAC;YAC/B,8EAA8E;YAC9E,gBAAgB;YAChB,IAAI,CAAC,GAAG,CAAC,SAAS,CAAC,uBAAW,CAAC,UAAU,CAAC,aAAa,EAAE,EAAE,EAAE,SAAS,EAAE,EAAE,UAAU,EAAE,IAAI,EAAE,CAAC,CAAC;SAC/F;IACH,CAAC;IAED,2CAAU,GAAV;QACE,IAAI,CAAC,qBAAqB,CAAC,IAAI,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC;QAE7C,IAAI,CAAC,KAAK,CAAC,WAAW,CAAC,IAAI,CAAC,qBAAqB,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC;IAChE,CAAC;IACH,6BAAC;AAAD,CAAC,AAxBD,CAA4C,+BAAmB,GAwB9D;AAxBY,wDAAsB","sourcesContent":["import { BaseInstrumentation, Conventions, Meta, MetaSession, VERSION } from '@grafana/faro-core';\n\n// all this does is send SESSION_START event\nexport class SessionInstrumentation extends BaseInstrumentation {\n readonly name = '@grafana/faro-web-sdk:instrumentation-session';\n readonly version = VERSION;\n\n // previously notified session, to ensure we don't send session start\n // event twice for the same session\n private notifiedSession: MetaSession | undefined;\n\n private sendSessionStartEvent(meta: Meta): void {\n const session = meta.session;\n\n if (session && session !== this.notifiedSession) {\n this.notifiedSession = session;\n // no need to add attributes and session id, they are included as part of meta\n // automatically\n this.api.pushEvent(Conventions.EventNames.SESSION_START, {}, undefined, { skipDedupe: true });\n }\n }\n\n initialize() {\n this.sendSessionStartEvent(this.metas.value);\n\n this.metas.addListener(this.sendSessionStartEvent.bind(this));\n }\n}\n"]}
@@ -16,7 +16,6 @@ var __extends = (this && this.__extends) || (function () {
16
16
  })();
17
17
  Object.defineProperty(exports, "__esModule", { value: true });
18
18
  exports.ViewInstrumentation = void 0;
19
- var ua_parser_js_1 = require("ua-parser-js");
20
19
  var faro_core_1 = require("@grafana/faro-core");
21
20
  // all this does is send VIEW_CHANGED event
22
21
  var ViewInstrumentation = /** @class */ (function (_super) {
@@ -24,7 +23,7 @@ var ViewInstrumentation = /** @class */ (function (_super) {
24
23
  function ViewInstrumentation() {
25
24
  var _this = _super !== null && _super.apply(this, arguments) || this;
26
25
  _this.name = '@grafana/faro-web-sdk:instrumentation-view';
27
- _this.version = ua_parser_js_1.VERSION;
26
+ _this.version = faro_core_1.VERSION;
28
27
  return _this;
29
28
  }
30
29
  ViewInstrumentation.prototype.sendViewChangedEvent = function (meta) {
@@ -1 +1 @@
1
- {"version":3,"file":"instrumentation.js","sourceRoot":"","sources":["../../../../src/instrumentations/view/instrumentation.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;AAAA,6CAAuC;AAEvC,gDAAsF;AAEtF,2CAA2C;AAC3C;IAAyC,uCAAmB;IAA5D;QAAA,qEAuBC;QAtBU,UAAI,GAAG,4CAA4C,CAAC;QACpD,aAAO,GAAG,sBAAO,CAAC;;IAqB7B,CAAC;IAfS,kDAAoB,GAA5B,UAA6B,IAAU;QACrC,IAAM,IAAI,GAAG,IAAI,CAAC,IAAI,CAAC;QAEvB,IAAI,IAAI,IAAI,IAAI,KAAK,IAAI,CAAC,YAAY,EAAE;YACtC,IAAI,CAAC,YAAY,GAAG,IAAI,CAAC;YAEzB,IAAI,CAAC,GAAG,CAAC,SAAS,CAAC,uBAAW,CAAC,UAAU,CAAC,YAAY,EAAE,EAAE,EAAE,SAAS,EAAE,EAAE,UAAU,EAAE,IAAI,EAAE,CAAC,CAAC;SAC9F;IACH,CAAC;IAED,wCAAU,GAAV;QACE,IAAI,CAAC,oBAAoB,CAAC,IAAI,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC;QAE5C,IAAI,CAAC,KAAK,CAAC,WAAW,CAAC,IAAI,CAAC,oBAAoB,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC;IAC/D,CAAC;IACH,0BAAC;AAAD,CAAC,AAvBD,CAAyC,+BAAmB,GAuB3D;AAvBY,kDAAmB","sourcesContent":["import { VERSION } from 'ua-parser-js';\n\nimport { BaseInstrumentation, Conventions, Meta, MetaView } from '@grafana/faro-core';\n\n// all this does is send VIEW_CHANGED event\nexport class ViewInstrumentation extends BaseInstrumentation {\n readonly name = '@grafana/faro-web-sdk:instrumentation-view';\n readonly version = VERSION;\n\n // previously notified view, to ensure we don't send view changed\n // event twice for the same view\n private notifiedView: MetaView | undefined;\n\n private sendViewChangedEvent(meta: Meta): void {\n const view = meta.view;\n\n if (view && view !== this.notifiedView) {\n this.notifiedView = view;\n\n this.api.pushEvent(Conventions.EventNames.VIEW_CHANGED, {}, undefined, { skipDedupe: true });\n }\n }\n\n initialize() {\n this.sendViewChangedEvent(this.metas.value);\n\n this.metas.addListener(this.sendViewChangedEvent.bind(this));\n }\n}\n"]}
1
+ {"version":3,"file":"instrumentation.js","sourceRoot":"","sources":["../../../../src/instrumentations/view/instrumentation.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;AAAA,gDAA+F;AAE/F,2CAA2C;AAC3C;IAAyC,uCAAmB;IAA5D;QAAA,qEAuBC;QAtBU,UAAI,GAAG,4CAA4C,CAAC;QACpD,aAAO,GAAG,mBAAO,CAAC;;IAqB7B,CAAC;IAfS,kDAAoB,GAA5B,UAA6B,IAAU;QACrC,IAAM,IAAI,GAAG,IAAI,CAAC,IAAI,CAAC;QAEvB,IAAI,IAAI,IAAI,IAAI,KAAK,IAAI,CAAC,YAAY,EAAE;YACtC,IAAI,CAAC,YAAY,GAAG,IAAI,CAAC;YAEzB,IAAI,CAAC,GAAG,CAAC,SAAS,CAAC,uBAAW,CAAC,UAAU,CAAC,YAAY,EAAE,EAAE,EAAE,SAAS,EAAE,EAAE,UAAU,EAAE,IAAI,EAAE,CAAC,CAAC;SAC9F;IACH,CAAC;IAED,wCAAU,GAAV;QACE,IAAI,CAAC,oBAAoB,CAAC,IAAI,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC;QAE5C,IAAI,CAAC,KAAK,CAAC,WAAW,CAAC,IAAI,CAAC,oBAAoB,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC;IAC/D,CAAC;IACH,0BAAC;AAAD,CAAC,AAvBD,CAAyC,+BAAmB,GAuB3D;AAvBY,kDAAmB","sourcesContent":["import { BaseInstrumentation, Conventions, Meta, MetaView, VERSION } from '@grafana/faro-core';\n\n// all this does is send VIEW_CHANGED event\nexport class ViewInstrumentation extends BaseInstrumentation {\n readonly name = '@grafana/faro-web-sdk:instrumentation-view';\n readonly version = VERSION;\n\n // previously notified view, to ensure we don't send view changed\n // event twice for the same view\n private notifiedView: MetaView | undefined;\n\n private sendViewChangedEvent(meta: Meta): void {\n const view = meta.view;\n\n if (view && view !== this.notifiedView) {\n this.notifiedView = view;\n\n this.api.pushEvent(Conventions.EventNames.VIEW_CHANGED, {}, undefined, { skipDedupe: true });\n }\n }\n\n initialize() {\n this.sendViewChangedEvent(this.metas.value);\n\n this.metas.addListener(this.sendViewChangedEvent.bind(this));\n }\n}\n"]}
@@ -43,12 +43,12 @@ var WebVitalsInstrumentation = /** @class */ (function (_super) {
43
43
  });
44
44
  };
45
45
  WebVitalsInstrumentation.mapping = {
46
- cls: web_vitals_1.getCLS,
47
- fcp: web_vitals_1.getFCP,
48
- fid: web_vitals_1.getFID,
49
- inp: web_vitals_1.getINP,
50
- lcp: web_vitals_1.getLCP,
51
- ttfb: web_vitals_1.getTTFB,
46
+ cls: web_vitals_1.onCLS,
47
+ fcp: web_vitals_1.onFCP,
48
+ fid: web_vitals_1.onFID,
49
+ inp: web_vitals_1.onINP,
50
+ lcp: web_vitals_1.onLCP,
51
+ ttfb: web_vitals_1.onTTFB,
52
52
  };
53
53
  return WebVitalsInstrumentation;
54
54
  }(faro_core_1.BaseInstrumentation));
@@ -1 +1 @@
1
- {"version":3,"file":"instrumentation.js","sourceRoot":"","sources":["../../../../src/instrumentations/webVitals/instrumentation.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;AAAA,yCAA6E;AAE7E,gDAAkE;AAElE;IAA8C,4CAAmB;IAAjE;QAAA,qEA2BC;QA1BU,UAAI,GAAG,kDAAkD,CAAC;QAC1D,aAAO,GAAG,mBAAO,CAAC;;IAyB7B,CAAC;IAdC,6CAAU,GAAV;QAAA,iBAaC;QAZC,IAAI,CAAC,QAAQ,CAAC,cAAc,CAAC,CAAC;QAE9B,MAAM,CAAC,OAAO,CAAC,wBAAwB,CAAC,OAAO,CAAC,CAAC,OAAO,CAAC,UAAC,EAAqB;gBAApB,SAAS,QAAA,EAAE,QAAQ,QAAA;YAC5E,QAAQ,CAAC,UAAC,MAAM;;gBACd,KAAI,CAAC,GAAG,CAAC,eAAe,CAAC;oBACvB,IAAI,EAAE,YAAY;oBAClB,MAAM;wBACJ,GAAC,SAAS,IAAG,MAAM,CAAC,KAAK;2BAC1B;iBACF,CAAC,CAAC;YACL,CAAC,CAAC,CAAC;QACL,CAAC,CAAC,CAAC;IACL,CAAC;IAtBM,gCAAO,GAAG;QACf,GAAG,EAAE,mBAAM;QACX,GAAG,EAAE,mBAAM;QACX,GAAG,EAAE,mBAAM;QACX,GAAG,EAAE,mBAAM;QACX,GAAG,EAAE,mBAAM;QACX,IAAI,EAAE,oBAAO;KACd,CAAC;IAgBJ,+BAAC;CAAA,AA3BD,CAA8C,+BAAmB,GA2BhE;AA3BY,4DAAwB","sourcesContent":["import { getCLS, getFCP, getFID, getINP, getLCP, getTTFB } from 'web-vitals';\n\nimport { BaseInstrumentation, VERSION } from '@grafana/faro-core';\n\nexport class WebVitalsInstrumentation extends BaseInstrumentation {\n readonly name = '@grafana/faro-web-sdk:instrumentation-web-vitals';\n readonly version = VERSION;\n\n static mapping = {\n cls: getCLS,\n fcp: getFCP,\n fid: getFID,\n inp: getINP,\n lcp: getLCP,\n ttfb: getTTFB,\n };\n\n initialize(): void {\n this.logDebug('Initializing');\n\n Object.entries(WebVitalsInstrumentation.mapping).forEach(([indicator, executor]) => {\n executor((metric) => {\n this.api.pushMeasurement({\n type: 'web-vitals',\n values: {\n [indicator]: metric.value,\n },\n });\n });\n });\n }\n}\n"]}
1
+ {"version":3,"file":"instrumentation.js","sourceRoot":"","sources":["../../../../src/instrumentations/webVitals/instrumentation.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;AAAA,yCAAuE;AAEvE,gDAAkE;AAElE;IAA8C,4CAAmB;IAAjE;QAAA,qEA4BC;QA3BU,UAAI,GAAG,kDAAkD,CAAC;QAC1D,aAAO,GAAG,mBAAO,CAAC;;IA0B7B,CAAC;IAfC,6CAAU,GAAV;QAAA,iBAcC;QAbC,IAAI,CAAC,QAAQ,CAAC,cAAc,CAAC,CAAC;QAE9B,MAAM,CAAC,OAAO,CAAC,wBAAwB,CAAC,OAAO,CAAC,CAAC,OAAO,CAAC,UAAC,EAAqB;gBAApB,SAAS,QAAA,EAAE,QAAQ,QAAA;YAC5E,QAAQ,CAAC,UAAC,MAAM;;gBACd,KAAI,CAAC,GAAG,CAAC,eAAe,CAAC;oBACvB,IAAI,EAAE,YAAY;oBAElB,MAAM;wBACJ,GAAC,SAAS,IAAG,MAAM,CAAC,KAAK;2BAC1B;iBACF,CAAC,CAAC;YACL,CAAC,CAAC,CAAC;QACL,CAAC,CAAC,CAAC;IACL,CAAC;IAvBM,gCAAO,GAAG;QACf,GAAG,EAAE,kBAAK;QACV,GAAG,EAAE,kBAAK;QACV,GAAG,EAAE,kBAAK;QACV,GAAG,EAAE,kBAAK;QACV,GAAG,EAAE,kBAAK;QACV,IAAI,EAAE,mBAAM;KACb,CAAC;IAiBJ,+BAAC;CAAA,AA5BD,CAA8C,+BAAmB,GA4BhE;AA5BY,4DAAwB","sourcesContent":["import { onCLS, onFCP, onFID, onINP, onLCP, onTTFB } from 'web-vitals';\n\nimport { BaseInstrumentation, VERSION } from '@grafana/faro-core';\n\nexport class WebVitalsInstrumentation extends BaseInstrumentation {\n readonly name = '@grafana/faro-web-sdk:instrumentation-web-vitals';\n readonly version = VERSION;\n\n static mapping = {\n cls: onCLS,\n fcp: onFCP,\n fid: onFID,\n inp: onINP,\n lcp: onLCP,\n ttfb: onTTFB,\n };\n\n initialize(): void {\n this.logDebug('Initializing');\n\n Object.entries(WebVitalsInstrumentation.mapping).forEach(([indicator, executor]) => {\n executor((metric) => {\n this.api.pushMeasurement({\n type: 'web-vitals',\n\n values: {\n [indicator]: metric.value,\n },\n });\n });\n });\n }\n}\n"]}
@@ -6,6 +6,8 @@ var browserMeta = function () {
6
6
  var parser = new ua_parser_js_1.UAParser();
7
7
  var _a = parser.getBrowser(), name = _a.name, version = _a.version;
8
8
  var _b = parser.getOS(), osName = _b.name, osVersion = _b.version;
9
+ var userAgent = parser.getUA();
10
+ var language = navigator.language;
9
11
  var mobile = navigator.userAgent.includes('Mobi');
10
12
  var unknown = 'unknown';
11
13
  return {
@@ -13,6 +15,8 @@ var browserMeta = function () {
13
15
  name: name !== null && name !== void 0 ? name : unknown,
14
16
  version: version !== null && version !== void 0 ? version : unknown,
15
17
  os: "".concat(osName !== null && osName !== void 0 ? osName : unknown, " ").concat(osVersion !== null && osVersion !== void 0 ? osVersion : unknown),
18
+ userAgent: userAgent !== null && userAgent !== void 0 ? userAgent : unknown,
19
+ language: language !== null && language !== void 0 ? language : unknown,
16
20
  mobile: mobile,
17
21
  },
18
22
  };
@@ -1 +1 @@
1
- {"version":3,"file":"meta.js","sourceRoot":"","sources":["../../../../src/metas/browser/meta.ts"],"names":[],"mappings":";;;AAAA,6CAAwC;AAIjC,IAAM,WAAW,GAAoC;IAC1D,IAAM,MAAM,GAAG,IAAI,uBAAQ,EAAE,CAAC;IACxB,IAAA,KAAoB,MAAM,CAAC,UAAU,EAAE,EAArC,IAAI,UAAA,EAAE,OAAO,aAAwB,CAAC;IACxC,IAAA,KAAuC,MAAM,CAAC,KAAK,EAAE,EAA7C,MAAM,UAAA,EAAW,SAAS,aAAmB,CAAC;IAC5D,IAAM,MAAM,GAAG,SAAS,CAAC,SAAS,CAAC,QAAQ,CAAC,MAAM,CAAC,CAAC;IACpD,IAAM,OAAO,GAAG,SAAS,CAAC;IAE1B,OAAO;QACL,OAAO,EAAE;YACP,IAAI,EAAE,IAAI,aAAJ,IAAI,cAAJ,IAAI,GAAI,OAAO;YACrB,OAAO,EAAE,OAAO,aAAP,OAAO,cAAP,OAAO,GAAI,OAAO;YAC3B,EAAE,EAAE,UAAG,MAAM,aAAN,MAAM,cAAN,MAAM,GAAI,OAAO,cAAI,SAAS,aAAT,SAAS,cAAT,SAAS,GAAI,OAAO,CAAE;YAClD,MAAM,QAAA;SACP;KACF,CAAC;AACJ,CAAC,CAAC;AAfW,QAAA,WAAW,eAetB","sourcesContent":["import { UAParser } from 'ua-parser-js';\n\nimport type { Meta, MetaItem } from '@grafana/faro-core';\n\nexport const browserMeta: MetaItem<Pick<Meta, 'browser'>> = () => {\n const parser = new UAParser();\n const { name, version } = parser.getBrowser();\n const { name: osName, version: osVersion } = parser.getOS();\n const mobile = navigator.userAgent.includes('Mobi');\n const unknown = 'unknown';\n\n return {\n browser: {\n name: name ?? unknown,\n version: version ?? unknown,\n os: `${osName ?? unknown} ${osVersion ?? unknown}`,\n mobile,\n },\n };\n};\n"]}
1
+ {"version":3,"file":"meta.js","sourceRoot":"","sources":["../../../../src/metas/browser/meta.ts"],"names":[],"mappings":";;;AAAA,6CAAwC;AAIjC,IAAM,WAAW,GAAoC;IAC1D,IAAM,MAAM,GAAG,IAAI,uBAAQ,EAAE,CAAC;IACxB,IAAA,KAAoB,MAAM,CAAC,UAAU,EAAE,EAArC,IAAI,UAAA,EAAE,OAAO,aAAwB,CAAC;IACxC,IAAA,KAAuC,MAAM,CAAC,KAAK,EAAE,EAA7C,MAAM,UAAA,EAAW,SAAS,aAAmB,CAAC;IAC5D,IAAM,SAAS,GAAG,MAAM,CAAC,KAAK,EAAE,CAAC;IACjC,IAAM,QAAQ,GAAG,SAAS,CAAC,QAAQ,CAAC;IACpC,IAAM,MAAM,GAAG,SAAS,CAAC,SAAS,CAAC,QAAQ,CAAC,MAAM,CAAC,CAAC;IACpD,IAAM,OAAO,GAAG,SAAS,CAAC;IAE1B,OAAO;QACL,OAAO,EAAE;YACP,IAAI,EAAE,IAAI,aAAJ,IAAI,cAAJ,IAAI,GAAI,OAAO;YACrB,OAAO,EAAE,OAAO,aAAP,OAAO,cAAP,OAAO,GAAI,OAAO;YAC3B,EAAE,EAAE,UAAG,MAAM,aAAN,MAAM,cAAN,MAAM,GAAI,OAAO,cAAI,SAAS,aAAT,SAAS,cAAT,SAAS,GAAI,OAAO,CAAE;YAClD,SAAS,EAAE,SAAS,aAAT,SAAS,cAAT,SAAS,GAAI,OAAO;YAC/B,QAAQ,EAAE,QAAQ,aAAR,QAAQ,cAAR,QAAQ,GAAI,OAAO;YAC7B,MAAM,QAAA;SACP;KACF,CAAC;AACJ,CAAC,CAAC;AAnBW,QAAA,WAAW,eAmBtB","sourcesContent":["import { UAParser } from 'ua-parser-js';\n\nimport type { Meta, MetaItem } from '@grafana/faro-core';\n\nexport const browserMeta: MetaItem<Pick<Meta, 'browser'>> = () => {\n const parser = new UAParser();\n const { name, version } = parser.getBrowser();\n const { name: osName, version: osVersion } = parser.getOS();\n const userAgent = parser.getUA();\n const language = navigator.language;\n const mobile = navigator.userAgent.includes('Mobi');\n const unknown = 'unknown';\n\n return {\n browser: {\n name: name ?? unknown,\n version: version ?? unknown,\n os: `${osName ?? unknown} ${osVersion ?? unknown}`,\n userAgent: userAgent ?? unknown,\n language: language ?? unknown,\n mobile,\n },\n };\n};\n"]}
@@ -118,6 +118,8 @@ var FetchTransport = /** @class */ (function (_super) {
118
118
  _this.disabledUntil = _this.getRetryAfterDate(response);
119
119
  _this.logWarn("Too many requests, backing off until ".concat(_this.disabledUntil));
120
120
  }
121
+ // read the body so the connection can be closed
122
+ response.text().catch(faro_core_1.noop);
121
123
  return response;
122
124
  })
123
125
  .catch(function (err) {
@@ -1 +1 @@
1
- {"version":3,"file":"transport.js","sourceRoot":"","sources":["../../../../src/transports/fetch/transport.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,gDAAkH;AAKlH,IAAM,mBAAmB,GAAG,EAAE,CAAC;AAC/B,IAAM,mBAAmB,GAAG,CAAC,CAAC,CAAC,uCAAuC;AACtE,IAAM,6BAA6B,GAAG,IAAI,CAAC;AAE3C;IAAoC,kCAAa;IAU/C,wBAAoB,OAA8B;QAAlD,iBAUC;;gBATC,iBAAO;QADW,aAAO,GAAP,OAAO,CAAuB;QATzC,UAAI,GAAG,uCAAuC,CAAC;QAC/C,aAAO,GAAG,mBAAO,CAAC;QAMnB,mBAAa,GAAS,IAAI,IAAI,EAAE,CAAC;QAKvC,KAAI,CAAC,kBAAkB,GAAG,MAAA,OAAO,CAAC,yBAAyB,mCAAI,6BAA6B,CAAC;QAC7F,KAAI,CAAC,MAAM,GAAG,MAAA,OAAO,CAAC,MAAM,mCAAI,CAAC,cAAM,OAAA,IAAI,CAAC,GAAG,EAAE,EAAV,CAAU,CAAC,CAAC;QAEnD,KAAI,CAAC,aAAa,GAAG,IAAA,+BAAmB,EAAC;YACvC,IAAI,EAAE,MAAA,OAAO,CAAC,UAAU,mCAAI,mBAAmB;YAC/C,WAAW,EAAE,MAAA,OAAO,CAAC,WAAW,mCAAI,mBAAmB;SACxD,CAAC,CAAC;;IACL,CAAC;IAEK,6BAAI,GAAV,UAAW,IAAmB;;;;;;;;wBAE1B,IAAI,IAAI,CAAC,aAAa,GAAG,IAAI,IAAI,CAAC,IAAI,CAAC,MAAM,EAAE,CAAC,EAAE;4BAChD,IAAI,CAAC,OAAO,CAAC,0EAAmE,IAAI,CAAC,aAAa,CAAE,CAAC,CAAC;4BAEtG,sBAAO,OAAO,CAAC,OAAO,EAAE,EAAC;yBAC1B;wBAED,qBAAM,IAAI,CAAC,aAAa,CAAC,GAAG,CAAC;gCAC3B,IAAM,IAAI,GAAG,IAAI,CAAC,SAAS,CAAC,IAAA,4BAAgB,EAAC,IAAI,CAAC,CAAC,CAAC;gCAE9C,IAAA,KAAkC,KAAI,CAAC,OAAO,EAA5C,GAAG,SAAA,EAAE,cAAc,oBAAA,EAAE,MAAM,YAAiB,CAAC;gCAErD,IAAM,KAAuC,cAAc,aAAd,cAAc,cAAd,cAAc,GAAI,EAAE,EAAzD,OAAO,aAAA,EAAK,oBAAoB,cAAlC,WAAoC,CAAuB,CAAC;gCAElE,OAAO,KAAK,CAAC,GAAG,aACd,MAAM,EAAE,MAAM,EACd,OAAO,sBACL,cAAc,EAAE,kBAAkB,IAC/B,CAAC,OAAO,aAAP,OAAO,cAAP,OAAO,GAAI,EAAE,CAAC,GACf,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,WAAW,EAAE,MAAM,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC,GAE5C,IAAI,MAAA,EACJ,SAAS,EAAE,IAAI,IACZ,CAAC,oBAAoB,aAApB,oBAAoB,cAApB,oBAAoB,GAAI,EAAE,CAAC,EAC/B;qCACC,IAAI,CAAC,UAAC,QAAQ;oCACb,IAAI,QAAQ,CAAC,MAAM,KAAK,GAAG,EAAE;wCAC3B,KAAI,CAAC,aAAa,GAAG,KAAI,CAAC,iBAAiB,CAAC,QAAQ,CAAC,CAAC;wCACtD,KAAI,CAAC,OAAO,CAAC,+CAAwC,KAAI,CAAC,aAAa,CAAE,CAAC,CAAC;qCAC5E;oCAED,OAAO,QAAQ,CAAC;gCAClB,CAAC,CAAC;qCACD,KAAK,CAAC,UAAC,GAAG;oCACT,KAAI,CAAC,QAAQ,CAAC,0CAA0C,EAAE,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,EAAE,GAAG,CAAC,CAAC;gCACnF,CAAC,CAAC,CAAC;4BACP,CAAC,CAAC,EAAA;;wBA7BF,SA6BE,CAAC;;;;wBAEH,IAAI,CAAC,QAAQ,CAAC,KAAG,CAAC,CAAC;;;;;;KAEtB;IAEQ,sCAAa,GAAtB;QACE,OAAO,CAAC,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC;IAC5B,CAAC;IAEO,0CAAiB,GAAzB,UAA0B,QAAkB;QAC1C,IAAM,GAAG,GAAG,IAAI,CAAC,MAAM,EAAE,CAAC;QAC1B,IAAM,gBAAgB,GAAG,QAAQ,CAAC,OAAO,CAAC,GAAG,CAAC,aAAa,CAAC,CAAC;QAE7D,IAAI,gBAAgB,EAAE;YACpB,IAAM,KAAK,GAAG,MAAM,CAAC,gBAAgB,CAAC,CAAC;YAEvC,IAAI,CAAC,KAAK,CAAC,KAAK,CAAC,EAAE;gBACjB,OAAO,IAAI,IAAI,CAAC,KAAK,GAAG,IAAI,GAAG,GAAG,CAAC,CAAC;aACrC;YAED,IAAM,IAAI,GAAG,IAAI,CAAC,KAAK,CAAC,gBAAgB,CAAC,CAAC;YAE1C,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,EAAE;gBAChB,OAAO,IAAI,IAAI,CAAC,IAAI,CAAC,CAAC;aACvB;SACF;QAED,OAAO,IAAI,IAAI,CAAC,GAAG,GAAG,IAAI,CAAC,kBAAkB,CAAC,CAAC;IACjD,CAAC;IACH,qBAAC;AAAD,CAAC,AAzFD,CAAoC,yBAAa,GAyFhD;AAzFY,wCAAc","sourcesContent":["import { BaseTransport, createPromiseBuffer, getTransportBody, PromiseBuffer, VERSION } from '@grafana/faro-core';\nimport type { TransportItem } from '@grafana/faro-core';\n\nimport type { FetchTransportOptions } from './types';\n\nconst DEFAULT_BUFFER_SIZE = 30;\nconst DEFAULT_CONCURRENCY = 5; // chrome supports 10 total, firefox 17\nconst DEFAULT_RATE_LIMIT_BACKOFF_MS = 5000;\n\nexport class FetchTransport extends BaseTransport {\n readonly name = '@grafana/faro-web-sdk:transport-fetch';\n readonly version = VERSION;\n\n promiseBuffer: PromiseBuffer<Response | void>;\n\n private readonly rateLimitBackoffMs: number;\n private readonly getNow: () => number;\n private disabledUntil: Date = new Date();\n\n constructor(private options: FetchTransportOptions) {\n super();\n\n this.rateLimitBackoffMs = options.defaultRateLimitBackoffMs ?? DEFAULT_RATE_LIMIT_BACKOFF_MS;\n this.getNow = options.getNow ?? (() => Date.now());\n\n this.promiseBuffer = createPromiseBuffer({\n size: options.bufferSize ?? DEFAULT_BUFFER_SIZE,\n concurrency: options.concurrency ?? DEFAULT_CONCURRENCY,\n });\n }\n\n async send(item: TransportItem): Promise<void> {\n try {\n if (this.disabledUntil > new Date(this.getNow())) {\n this.logWarn(`Dropping transport item due to too many requests. Backoff until ${this.disabledUntil}`);\n\n return Promise.resolve();\n }\n\n await this.promiseBuffer.add(() => {\n const body = JSON.stringify(getTransportBody(item));\n\n const { url, requestOptions, apiKey } = this.options;\n\n const { headers, ...restOfRequestOptions } = requestOptions ?? {};\n\n return fetch(url, {\n method: 'POST',\n headers: {\n 'Content-Type': 'application/json',\n ...(headers ?? {}),\n ...(apiKey ? { 'x-api-key': apiKey } : {}),\n },\n body,\n keepalive: true,\n ...(restOfRequestOptions ?? {}),\n })\n .then((response) => {\n if (response.status === 429) {\n this.disabledUntil = this.getRetryAfterDate(response);\n this.logWarn(`Too many requests, backing off until ${this.disabledUntil}`);\n }\n\n return response;\n })\n .catch((err) => {\n this.logError('Failed sending payload to the receiver\\n', JSON.parse(body), err);\n });\n });\n } catch (err) {\n this.logError(err);\n }\n }\n\n override getIgnoreUrls(): Array<string | RegExp> {\n return [this.options.url];\n }\n\n private getRetryAfterDate(response: Response): Date {\n const now = this.getNow();\n const retryAfterHeader = response.headers.get('Retry-After');\n\n if (retryAfterHeader) {\n const delay = Number(retryAfterHeader);\n\n if (!isNaN(delay)) {\n return new Date(delay * 1000 + now);\n }\n\n const date = Date.parse(retryAfterHeader);\n\n if (!isNaN(date)) {\n return new Date(date);\n }\n }\n\n return new Date(now + this.rateLimitBackoffMs);\n }\n}\n"]}
1
+ {"version":3,"file":"transport.js","sourceRoot":"","sources":["../../../../src/transports/fetch/transport.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,gDAAwH;AAKxH,IAAM,mBAAmB,GAAG,EAAE,CAAC;AAC/B,IAAM,mBAAmB,GAAG,CAAC,CAAC,CAAC,uCAAuC;AACtE,IAAM,6BAA6B,GAAG,IAAI,CAAC;AAE3C;IAAoC,kCAAa;IAU/C,wBAAoB,OAA8B;QAAlD,iBAUC;;gBATC,iBAAO;QADW,aAAO,GAAP,OAAO,CAAuB;QATzC,UAAI,GAAG,uCAAuC,CAAC;QAC/C,aAAO,GAAG,mBAAO,CAAC;QAMnB,mBAAa,GAAS,IAAI,IAAI,EAAE,CAAC;QAKvC,KAAI,CAAC,kBAAkB,GAAG,MAAA,OAAO,CAAC,yBAAyB,mCAAI,6BAA6B,CAAC;QAC7F,KAAI,CAAC,MAAM,GAAG,MAAA,OAAO,CAAC,MAAM,mCAAI,CAAC,cAAM,OAAA,IAAI,CAAC,GAAG,EAAE,EAAV,CAAU,CAAC,CAAC;QAEnD,KAAI,CAAC,aAAa,GAAG,IAAA,+BAAmB,EAAC;YACvC,IAAI,EAAE,MAAA,OAAO,CAAC,UAAU,mCAAI,mBAAmB;YAC/C,WAAW,EAAE,MAAA,OAAO,CAAC,WAAW,mCAAI,mBAAmB;SACxD,CAAC,CAAC;;IACL,CAAC;IAEK,6BAAI,GAAV,UAAW,IAAmB;;;;;;;;wBAE1B,IAAI,IAAI,CAAC,aAAa,GAAG,IAAI,IAAI,CAAC,IAAI,CAAC,MAAM,EAAE,CAAC,EAAE;4BAChD,IAAI,CAAC,OAAO,CAAC,0EAAmE,IAAI,CAAC,aAAa,CAAE,CAAC,CAAC;4BAEtG,sBAAO,OAAO,CAAC,OAAO,EAAE,EAAC;yBAC1B;wBAED,qBAAM,IAAI,CAAC,aAAa,CAAC,GAAG,CAAC;gCAC3B,IAAM,IAAI,GAAG,IAAI,CAAC,SAAS,CAAC,IAAA,4BAAgB,EAAC,IAAI,CAAC,CAAC,CAAC;gCAE9C,IAAA,KAAkC,KAAI,CAAC,OAAO,EAA5C,GAAG,SAAA,EAAE,cAAc,oBAAA,EAAE,MAAM,YAAiB,CAAC;gCAErD,IAAM,KAAuC,cAAc,aAAd,cAAc,cAAd,cAAc,GAAI,EAAE,EAAzD,OAAO,aAAA,EAAK,oBAAoB,cAAlC,WAAoC,CAAuB,CAAC;gCAElE,OAAO,KAAK,CAAC,GAAG,aACd,MAAM,EAAE,MAAM,EACd,OAAO,sBACL,cAAc,EAAE,kBAAkB,IAC/B,CAAC,OAAO,aAAP,OAAO,cAAP,OAAO,GAAI,EAAE,CAAC,GACf,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,WAAW,EAAE,MAAM,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC,GAE5C,IAAI,MAAA,EACJ,SAAS,EAAE,IAAI,IACZ,CAAC,oBAAoB,aAApB,oBAAoB,cAApB,oBAAoB,GAAI,EAAE,CAAC,EAC/B;qCACC,IAAI,CAAC,UAAC,QAAQ;oCACb,IAAI,QAAQ,CAAC,MAAM,KAAK,GAAG,EAAE;wCAC3B,KAAI,CAAC,aAAa,GAAG,KAAI,CAAC,iBAAiB,CAAC,QAAQ,CAAC,CAAC;wCACtD,KAAI,CAAC,OAAO,CAAC,+CAAwC,KAAI,CAAC,aAAa,CAAE,CAAC,CAAC;qCAC5E;oCACD,gDAAgD;oCAChD,QAAQ,CAAC,IAAI,EAAE,CAAC,KAAK,CAAC,gBAAI,CAAC,CAAC;oCAE5B,OAAO,QAAQ,CAAC;gCAClB,CAAC,CAAC;qCACD,KAAK,CAAC,UAAC,GAAG;oCACT,KAAI,CAAC,QAAQ,CAAC,0CAA0C,EAAE,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,EAAE,GAAG,CAAC,CAAC;gCACnF,CAAC,CAAC,CAAC;4BACP,CAAC,CAAC,EAAA;;wBA/BF,SA+BE,CAAC;;;;wBAEH,IAAI,CAAC,QAAQ,CAAC,KAAG,CAAC,CAAC;;;;;;KAEtB;IAEQ,sCAAa,GAAtB;QACE,OAAO,CAAC,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC;IAC5B,CAAC;IAEO,0CAAiB,GAAzB,UAA0B,QAAkB;QAC1C,IAAM,GAAG,GAAG,IAAI,CAAC,MAAM,EAAE,CAAC;QAC1B,IAAM,gBAAgB,GAAG,QAAQ,CAAC,OAAO,CAAC,GAAG,CAAC,aAAa,CAAC,CAAC;QAE7D,IAAI,gBAAgB,EAAE;YACpB,IAAM,KAAK,GAAG,MAAM,CAAC,gBAAgB,CAAC,CAAC;YAEvC,IAAI,CAAC,KAAK,CAAC,KAAK,CAAC,EAAE;gBACjB,OAAO,IAAI,IAAI,CAAC,KAAK,GAAG,IAAI,GAAG,GAAG,CAAC,CAAC;aACrC;YAED,IAAM,IAAI,GAAG,IAAI,CAAC,KAAK,CAAC,gBAAgB,CAAC,CAAC;YAE1C,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,EAAE;gBAChB,OAAO,IAAI,IAAI,CAAC,IAAI,CAAC,CAAC;aACvB;SACF;QAED,OAAO,IAAI,IAAI,CAAC,GAAG,GAAG,IAAI,CAAC,kBAAkB,CAAC,CAAC;IACjD,CAAC;IACH,qBAAC;AAAD,CAAC,AA3FD,CAAoC,yBAAa,GA2FhD;AA3FY,wCAAc","sourcesContent":["import { BaseTransport, createPromiseBuffer, getTransportBody, noop, PromiseBuffer, VERSION } from '@grafana/faro-core';\nimport type { TransportItem } from '@grafana/faro-core';\n\nimport type { FetchTransportOptions } from './types';\n\nconst DEFAULT_BUFFER_SIZE = 30;\nconst DEFAULT_CONCURRENCY = 5; // chrome supports 10 total, firefox 17\nconst DEFAULT_RATE_LIMIT_BACKOFF_MS = 5000;\n\nexport class FetchTransport extends BaseTransport {\n readonly name = '@grafana/faro-web-sdk:transport-fetch';\n readonly version = VERSION;\n\n promiseBuffer: PromiseBuffer<Response | void>;\n\n private readonly rateLimitBackoffMs: number;\n private readonly getNow: () => number;\n private disabledUntil: Date = new Date();\n\n constructor(private options: FetchTransportOptions) {\n super();\n\n this.rateLimitBackoffMs = options.defaultRateLimitBackoffMs ?? DEFAULT_RATE_LIMIT_BACKOFF_MS;\n this.getNow = options.getNow ?? (() => Date.now());\n\n this.promiseBuffer = createPromiseBuffer({\n size: options.bufferSize ?? DEFAULT_BUFFER_SIZE,\n concurrency: options.concurrency ?? DEFAULT_CONCURRENCY,\n });\n }\n\n async send(item: TransportItem): Promise<void> {\n try {\n if (this.disabledUntil > new Date(this.getNow())) {\n this.logWarn(`Dropping transport item due to too many requests. Backoff until ${this.disabledUntil}`);\n\n return Promise.resolve();\n }\n\n await this.promiseBuffer.add(() => {\n const body = JSON.stringify(getTransportBody(item));\n\n const { url, requestOptions, apiKey } = this.options;\n\n const { headers, ...restOfRequestOptions } = requestOptions ?? {};\n\n return fetch(url, {\n method: 'POST',\n headers: {\n 'Content-Type': 'application/json',\n ...(headers ?? {}),\n ...(apiKey ? { 'x-api-key': apiKey } : {}),\n },\n body,\n keepalive: true,\n ...(restOfRequestOptions ?? {}),\n })\n .then((response) => {\n if (response.status === 429) {\n this.disabledUntil = this.getRetryAfterDate(response);\n this.logWarn(`Too many requests, backing off until ${this.disabledUntil}`);\n }\n // read the body so the connection can be closed\n response.text().catch(noop);\n\n return response;\n })\n .catch((err) => {\n this.logError('Failed sending payload to the receiver\\n', JSON.parse(body), err);\n });\n });\n } catch (err) {\n this.logError(err);\n }\n }\n\n override getIgnoreUrls(): Array<string | RegExp> {\n return [this.options.url];\n }\n\n private getRetryAfterDate(response: Response): Date {\n const now = this.getNow();\n const retryAfterHeader = response.headers.get('Retry-After');\n\n if (retryAfterHeader) {\n const delay = Number(retryAfterHeader);\n\n if (!isNaN(delay)) {\n return new Date(delay * 1000 + now);\n }\n\n const date = Date.parse(retryAfterHeader);\n\n if (!isNaN(date)) {\n return new Date(date);\n }\n }\n\n return new Date(now + this.rateLimitBackoffMs);\n }\n}\n"]}
@@ -0,0 +1,6 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.internalLogger = void 0;
4
+ var faro_core_1 = require("@grafana/faro-core");
5
+ exports.internalLogger = (0, faro_core_1.createInternalLogger)();
6
+ //# sourceMappingURL=otlpPayloadLogger.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"otlpPayloadLogger.js","sourceRoot":"","sources":["../../../../src/transports/otlp/otlpPayloadLogger.ts"],"names":[],"mappings":";;;AAAA,gDAA0D;AAE7C,QAAA,cAAc,GAAG,IAAA,gCAAoB,GAAE,CAAC","sourcesContent":["import { createInternalLogger } from '@grafana/faro-core';\n\nexport const internalLogger = createInternalLogger();\n"]}
@@ -0,0 +1,56 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.OtelPayload = void 0;
4
+ var faro_core_1 = require("@grafana/faro-core");
5
+ var otlpPayloadLogger_1 = require("../otlpPayloadLogger");
6
+ var transform_1 = require("./transform");
7
+ var OtelPayload = /** @class */ (function () {
8
+ function OtelPayload(transportItem) {
9
+ this.resourceLogsWithMetas = [];
10
+ if (transportItem) {
11
+ this.addResourceItem(transportItem);
12
+ }
13
+ }
14
+ OtelPayload.prototype.getPayload = function () {
15
+ return {
16
+ resourceLogs: this.resourceLogsWithMetas.map(function (_a) {
17
+ var resourceLog = _a.resourceLog;
18
+ return resourceLog;
19
+ }),
20
+ resourceSpans: [],
21
+ resourceMetrics: [],
22
+ };
23
+ };
24
+ OtelPayload.prototype.addResourceItem = function (transportItem) {
25
+ var type = transportItem.type, meta = transportItem.meta;
26
+ switch (type) {
27
+ case faro_core_1.TransportItemType.LOG:
28
+ case faro_core_1.TransportItemType.EXCEPTION:
29
+ case faro_core_1.TransportItemType.EVENT:
30
+ case faro_core_1.TransportItemType.MEASUREMENT:
31
+ var resourceLogWithMeta = this.resourceLogsWithMetas.find(function (_a) {
32
+ var meta = _a.meta;
33
+ return (0, faro_core_1.deepEqual)(transportItem.meta, meta);
34
+ });
35
+ if (resourceLogWithMeta) {
36
+ var resourceLog = resourceLogWithMeta.resourceLog;
37
+ resourceLog.scopeLogs.push((0, transform_1.toScopeLog)(transportItem));
38
+ }
39
+ else {
40
+ this.resourceLogsWithMetas.push({
41
+ resourceLog: (0, transform_1.toResourceLog)(transportItem),
42
+ meta: meta,
43
+ });
44
+ }
45
+ break;
46
+ case faro_core_1.TransportItemType.TRACE:
47
+ break;
48
+ default:
49
+ otlpPayloadLogger_1.internalLogger.error("Unknown TransportItemType: ".concat(type));
50
+ break;
51
+ }
52
+ };
53
+ return OtelPayload;
54
+ }());
55
+ exports.OtelPayload = OtelPayload;
56
+ //# sourceMappingURL=OtelPayload.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"OtelPayload.js","sourceRoot":"","sources":["../../../../../src/transports/otlp/payload/OtelPayload.ts"],"names":[],"mappings":";;;AAAA,gDAAuF;AAEvF,0DAAsD;AAEtD,yCAAwD;AASxD;IAGE,qBAAY,aAA6B;QAFjC,0BAAqB,GAAG,EAA2B,CAAC;QAG1D,IAAI,aAAa,EAAE;YACjB,IAAI,CAAC,eAAe,CAAC,aAAa,CAAC,CAAC;SACrC;IACH,CAAC;IAED,gCAAU,GAAV;QACE,OAAO;YACL,YAAY,EAAE,IAAI,CAAC,qBAAqB,CAAC,GAAG,CAAC,UAAC,EAAe;oBAAb,WAAW,iBAAA;gBAAO,OAAA,WAAW;YAAX,CAAW,CAAC;YAC9E,aAAa,EAAE,EAAE;YACjB,eAAe,EAAE,EAAE;SACX,CAAC;IACb,CAAC;IAED,qCAAe,GAAf,UAAgB,aAA4B;QAClC,IAAA,IAAI,GAAW,aAAa,KAAxB,EAAE,IAAI,GAAK,aAAa,KAAlB,CAAmB;QAErC,QAAQ,IAAI,EAAE;YACZ,KAAK,6BAAiB,CAAC,GAAG,CAAC;YAC3B,KAAK,6BAAiB,CAAC,SAAS,CAAC;YACjC,KAAK,6BAAiB,CAAC,KAAK,CAAC;YAC7B,KAAK,6BAAiB,CAAC,WAAW;gBAChC,IAAM,mBAAmB,GAAG,IAAI,CAAC,qBAAqB,CAAC,IAAI,CAAC,UAAC,EAAQ;wBAAN,IAAI,UAAA;oBAAO,OAAA,IAAA,qBAAS,EAAC,aAAa,CAAC,IAAI,EAAE,IAAI,CAAC;gBAAnC,CAAmC,CAAC,CAAC;gBAE/G,IAAI,mBAAmB,EAAE;oBACf,IAAA,WAAW,GAAK,mBAAmB,YAAxB,CAAyB;oBAC5C,WAAW,CAAC,SAAS,CAAC,IAAI,CAAC,IAAA,sBAAU,EAAC,aAAa,CAAC,CAAC,CAAC;iBACvD;qBAAM;oBACL,IAAI,CAAC,qBAAqB,CAAC,IAAI,CAAC;wBAC9B,WAAW,EAAE,IAAA,yBAAa,EAAC,aAAa,CAAC;wBACzC,IAAI,MAAA;qBACL,CAAC,CAAC;iBACJ;gBAED,MAAM;YACR,KAAK,6BAAiB,CAAC,KAAK;gBAC1B,MAAM;YACR;gBACE,kCAAc,CAAC,KAAK,CAAC,qCAA8B,IAAI,CAAE,CAAC,CAAC;gBAC3D,MAAM;SACT;IACH,CAAC;IACH,kBAAC;AAAD,CAAC,AA7CD,IA6CC;AA7CY,kCAAW","sourcesContent":["import { deepEqual, Meta, TransportItem, TransportItemType } from '@grafana/faro-core';\n\nimport { internalLogger } from '../otlpPayloadLogger';\n\nimport { toResourceLog, toScopeLog } from './transform';\nimport type { ResourceLog } from './transform';\nimport type { OtelTransportPayload } from './types';\n\ninterface ResourceLogsMetaMap {\n resourceLog: ResourceLog;\n meta: Meta;\n}\n\nexport class OtelPayload {\n private resourceLogsWithMetas = [] as ResourceLogsMetaMap[];\n\n constructor(transportItem?: TransportItem) {\n if (transportItem) {\n this.addResourceItem(transportItem);\n }\n }\n\n getPayload(): OtelTransportPayload {\n return {\n resourceLogs: this.resourceLogsWithMetas.map(({ resourceLog }) => resourceLog),\n resourceSpans: [],\n resourceMetrics: [],\n } as const;\n }\n\n addResourceItem(transportItem: TransportItem): void {\n const { type, meta } = transportItem;\n\n switch (type) {\n case TransportItemType.LOG:\n case TransportItemType.EXCEPTION:\n case TransportItemType.EVENT:\n case TransportItemType.MEASUREMENT:\n const resourceLogWithMeta = this.resourceLogsWithMetas.find(({ meta }) => deepEqual(transportItem.meta, meta));\n\n if (resourceLogWithMeta) {\n const { resourceLog } = resourceLogWithMeta;\n resourceLog.scopeLogs.push(toScopeLog(transportItem));\n } else {\n this.resourceLogsWithMetas.push({\n resourceLog: toResourceLog(transportItem),\n meta,\n });\n }\n\n break;\n case TransportItemType.TRACE:\n break;\n default:\n internalLogger.error(`Unknown TransportItemType: ${type}`);\n break;\n }\n }\n}\n"]}
@@ -0,0 +1,53 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.isAttribute = exports.toAttribute = exports.toAttributeValue = void 0;
4
+ var faro_core_1 = require("@grafana/faro-core");
5
+ function toAttributeValue(value) {
6
+ if ((0, faro_core_1.isString)(value)) {
7
+ return { stringValue: value };
8
+ }
9
+ if ((0, faro_core_1.isInt)(value)) {
10
+ return { intValue: value };
11
+ }
12
+ if ((0, faro_core_1.isNumber)(value)) {
13
+ return { doubleValue: value };
14
+ }
15
+ if ((0, faro_core_1.isBoolean)(value)) {
16
+ return { boolValue: value };
17
+ }
18
+ if ((0, faro_core_1.isArray)(value)) {
19
+ return { arrayValue: { values: value.map(toAttributeValue) } };
20
+ }
21
+ if (value instanceof Uint8Array) {
22
+ return { bytesValue: value };
23
+ }
24
+ if ((0, faro_core_1.isObject)(value)) {
25
+ return {
26
+ kvlistValue: {
27
+ values: Object.entries(value)
28
+ .map(function (_a) {
29
+ var attributeName = _a[0], attributeValue = _a[1];
30
+ return toAttribute(attributeName, attributeValue);
31
+ })
32
+ .filter(isAttribute),
33
+ },
34
+ };
35
+ }
36
+ return {};
37
+ }
38
+ exports.toAttributeValue = toAttributeValue;
39
+ function toAttribute(attributeName, attributeValue) {
40
+ if (attributeValue == null || attributeValue === '') {
41
+ return undefined;
42
+ }
43
+ return {
44
+ key: attributeName,
45
+ value: toAttributeValue(attributeValue),
46
+ };
47
+ }
48
+ exports.toAttribute = toAttribute;
49
+ function isAttribute(item) {
50
+ return Boolean(item) && typeof (item === null || item === void 0 ? void 0 : item.key) === 'string' && typeof (item === null || item === void 0 ? void 0 : item.value) !== 'undefined';
51
+ }
52
+ exports.isAttribute = isAttribute;
53
+ //# sourceMappingURL=attributeUtils.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"attributeUtils.js","sourceRoot":"","sources":["../../../../../../src/transports/otlp/payload/attribute/attributeUtils.ts"],"names":[],"mappings":";;;AAEA,gDAA6F;AAE7F,SAAgB,gBAAgB,CAAC,KAAc;IAC7C,IAAI,IAAA,oBAAQ,EAAC,KAAK,CAAC,EAAE;QACnB,OAAO,EAAE,WAAW,EAAE,KAAK,EAAE,CAAC;KAC/B;IAED,IAAI,IAAA,iBAAK,EAAC,KAAK,CAAC,EAAE;QAChB,OAAO,EAAE,QAAQ,EAAE,KAAK,EAAE,CAAC;KAC5B;IAED,IAAI,IAAA,oBAAQ,EAAC,KAAK,CAAC,EAAE;QACnB,OAAO,EAAE,WAAW,EAAE,KAAe,EAAE,CAAC;KACzC;IAED,IAAI,IAAA,qBAAS,EAAC,KAAK,CAAC,EAAE;QACpB,OAAO,EAAE,SAAS,EAAE,KAAK,EAAE,CAAC;KAC7B;IAED,IAAI,IAAA,mBAAO,EAAC,KAAK,CAAC,EAAE;QAClB,OAAO,EAAE,UAAU,EAAE,EAAE,MAAM,EAAE,KAAK,CAAC,GAAG,CAAC,gBAAgB,CAAC,EAAE,EAAE,CAAC;KAChE;IAED,IAAI,KAAK,YAAY,UAAU,EAAE;QAC/B,OAAO,EAAE,UAAU,EAAE,KAAK,EAAE,CAAC;KAC9B;IAED,IAAI,IAAA,oBAAQ,EAAC,KAAK,CAAC,EAAE;QACnB,OAAO;YACL,WAAW,EAAE;gBACX,MAAM,EAAE,MAAM,CAAC,OAAO,CAAC,KAAK,CAAC;qBAC1B,GAAG,CAAC,UAAC,EAA+B;wBAA9B,aAAa,QAAA,EAAE,cAAc,QAAA;oBAAM,OAAA,WAAW,CAAC,aAAa,EAAE,cAAc,CAAC;gBAA1C,CAA0C,CAAC;qBACpF,MAAM,CAAC,WAAW,CAAC;aACvB;SACF,CAAC;KACH;IAED,OAAO,EAAE,CAAC;AACZ,CAAC;AApCD,4CAoCC;AAED,SAAgB,WAAW,CAAC,aAAqB,EAAE,cAAmB;IACpE,IAAI,cAAc,IAAI,IAAI,IAAI,cAAc,KAAK,EAAE,EAAE;QACnD,OAAO,SAAS,CAAC;KAClB;IAED,OAAO;QACL,GAAG,EAAE,aAAa;QAClB,KAAK,EAAE,gBAAgB,CAAC,cAAc,CAAC;KACxC,CAAC;AACJ,CAAC;AATD,kCASC;AAED,SAAgB,WAAW,CAAC,IAAS;IACnC,OAAO,OAAO,CAAC,IAAI,CAAC,IAAI,OAAO,CAAA,IAAI,aAAJ,IAAI,uBAAJ,IAAI,CAAE,GAAG,CAAA,KAAK,QAAQ,IAAI,OAAO,CAAA,IAAI,aAAJ,IAAI,uBAAJ,IAAI,CAAE,KAAK,CAAA,KAAK,WAAW,CAAC;AAC9F,CAAC;AAFD,kCAEC","sourcesContent":["import type { IAnyValue, IKeyValue } from '@opentelemetry/otlp-transformer';\n\nimport { isArray, isBoolean, isInt, isNumber, isObject, isString } from '@grafana/faro-core';\n\nexport function toAttributeValue(value: unknown): IAnyValue {\n if (isString(value)) {\n return { stringValue: value };\n }\n\n if (isInt(value)) {\n return { intValue: value };\n }\n\n if (isNumber(value)) {\n return { doubleValue: value as number };\n }\n\n if (isBoolean(value)) {\n return { boolValue: value };\n }\n\n if (isArray(value)) {\n return { arrayValue: { values: value.map(toAttributeValue) } };\n }\n\n if (value instanceof Uint8Array) {\n return { bytesValue: value };\n }\n\n if (isObject(value)) {\n return {\n kvlistValue: {\n values: Object.entries(value)\n .map(([attributeName, attributeValue]) => toAttribute(attributeName, attributeValue))\n .filter(isAttribute),\n },\n };\n }\n\n return {};\n}\n\nexport function toAttribute(attributeName: string, attributeValue: any): IKeyValue | undefined {\n if (attributeValue == null || attributeValue === '') {\n return undefined;\n }\n\n return {\n key: attributeName,\n value: toAttributeValue(attributeValue),\n };\n}\n\nexport function isAttribute(item: any): item is IKeyValue {\n return Boolean(item) && typeof item?.key === 'string' && typeof item?.value !== 'undefined';\n}\n"]}
@@ -0,0 +1,8 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.isAttribute = exports.toAttributeValue = exports.toAttribute = void 0;
4
+ var attributeUtils_1 = require("./attributeUtils");
5
+ Object.defineProperty(exports, "toAttribute", { enumerable: true, get: function () { return attributeUtils_1.toAttribute; } });
6
+ Object.defineProperty(exports, "toAttributeValue", { enumerable: true, get: function () { return attributeUtils_1.toAttributeValue; } });
7
+ Object.defineProperty(exports, "isAttribute", { enumerable: true, get: function () { return attributeUtils_1.isAttribute; } });
8
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../../src/transports/otlp/payload/attribute/index.ts"],"names":[],"mappings":";;;AAAA,mDAA8E;AAArE,6GAAA,WAAW,OAAA;AAAE,kHAAA,gBAAgB,OAAA;AAAE,6GAAA,WAAW,OAAA","sourcesContent":["export { toAttribute, toAttributeValue, isAttribute } from './attributeUtils';\n"]}