@sentry/browser-utils 11.0.0-alpha.0 → 11.0.0-alpha.2

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 (316) hide show
  1. package/build/cjs/component-name.js +28 -0
  2. package/build/cjs/component-name.js.map +1 -0
  3. package/build/cjs/getLocationHref.js +14 -0
  4. package/build/cjs/getLocationHref.js.map +1 -0
  5. package/build/cjs/index.js +36 -28
  6. package/build/cjs/index.js.map +1 -1
  7. package/build/cjs/instrumentation/dom.js.map +1 -0
  8. package/build/cjs/{instrument → instrumentation}/history.js +5 -1
  9. package/build/cjs/instrumentation/history.js.map +1 -0
  10. package/build/cjs/instrumentation/location.js.map +1 -0
  11. package/build/cjs/{metrics/instrument.js → instrumentation/performanceObserver.js} +44 -32
  12. package/build/cjs/instrumentation/performanceObserver.js.map +1 -0
  13. package/build/cjs/instrumentation/xhr.js.map +1 -0
  14. package/build/cjs/isBotUserAgent.js +15 -0
  15. package/build/cjs/isBotUserAgent.js.map +1 -0
  16. package/build/cjs/{metrics → performance}/elementTiming.js +2 -2
  17. package/build/cjs/performance/elementTiming.js.map +1 -0
  18. package/build/cjs/{metrics/browserMetrics.js → performance/entries.js} +45 -220
  19. package/build/cjs/performance/entries.js.map +1 -0
  20. package/build/cjs/performance/interactions.js +123 -0
  21. package/build/cjs/performance/interactions.js.map +1 -0
  22. package/build/cjs/performance/resourceTiming.js.map +1 -0
  23. package/build/cjs/{metrics → performance}/userTiming.js +4 -3
  24. package/build/cjs/performance/userTiming.js.map +1 -0
  25. package/build/cjs/{metrics → performance}/utils.js +4 -30
  26. package/build/cjs/performance/utils.js.map +1 -0
  27. package/build/cjs/types.js.map +1 -1
  28. package/build/cjs/{metrics → web-vitals}/inp.js +4 -4
  29. package/build/cjs/web-vitals/inp.js.map +1 -0
  30. package/build/cjs/web-vitals/lcp.js.map +1 -0
  31. package/build/cjs/web-vitals/reportEvents.js +31 -0
  32. package/build/cjs/web-vitals/reportEvents.js.map +1 -0
  33. package/build/cjs/{metrics/webVitalSpans.js → web-vitals/spans.js} +30 -21
  34. package/build/cjs/web-vitals/spans.js.map +1 -0
  35. package/build/cjs/web-vitals/tracking.js +164 -0
  36. package/build/cjs/web-vitals/tracking.js.map +1 -0
  37. package/build/cjs/web-vitals/utils.js +99 -0
  38. package/build/cjs/web-vitals/utils.js.map +1 -0
  39. package/build/esm/component-name.js +26 -0
  40. package/build/esm/component-name.js.map +1 -0
  41. package/build/esm/getLocationHref.js +12 -0
  42. package/build/esm/getLocationHref.js.map +1 -0
  43. package/build/esm/index.js +18 -13
  44. package/build/esm/index.js.map +1 -1
  45. package/build/esm/instrumentation/dom.js.map +1 -0
  46. package/build/esm/{instrument → instrumentation}/history.js +5 -2
  47. package/build/esm/instrumentation/history.js.map +1 -0
  48. package/build/esm/instrumentation/location.js.map +1 -0
  49. package/build/esm/{metrics/instrument.js → instrumentation/performanceObserver.js} +42 -30
  50. package/build/esm/instrumentation/performanceObserver.js.map +1 -0
  51. package/build/esm/instrumentation/xhr.js.map +1 -0
  52. package/build/esm/isBotUserAgent.js +13 -0
  53. package/build/esm/isBotUserAgent.js.map +1 -0
  54. package/build/esm/package.json +1 -1
  55. package/build/esm/{metrics → performance}/elementTiming.js +1 -1
  56. package/build/esm/performance/elementTiming.js.map +1 -0
  57. package/build/esm/{metrics/browserMetrics.js → performance/entries.js} +41 -213
  58. package/build/esm/performance/entries.js.map +1 -0
  59. package/build/esm/performance/interactions.js +121 -0
  60. package/build/esm/performance/interactions.js.map +1 -0
  61. package/build/esm/performance/resourceTiming.js.map +1 -0
  62. package/build/esm/{metrics → performance}/userTiming.js +4 -3
  63. package/build/esm/performance/userTiming.js.map +1 -0
  64. package/build/esm/{metrics → performance}/utils.js +3 -28
  65. package/build/esm/performance/utils.js.map +1 -0
  66. package/build/esm/types.js.map +1 -1
  67. package/build/esm/{metrics → web-vitals}/inp.js +1 -1
  68. package/build/esm/web-vitals/inp.js.map +1 -0
  69. package/build/esm/web-vitals/lcp.js.map +1 -0
  70. package/build/esm/web-vitals/reportEvents.js +29 -0
  71. package/build/esm/web-vitals/reportEvents.js.map +1 -0
  72. package/build/esm/{metrics/webVitalSpans.js → web-vitals/spans.js} +25 -16
  73. package/build/esm/web-vitals/spans.js.map +1 -0
  74. package/build/esm/web-vitals/tracking.js +161 -0
  75. package/build/esm/web-vitals/tracking.js.map +1 -0
  76. package/build/esm/web-vitals/utils.js +91 -0
  77. package/build/esm/web-vitals/utils.js.map +1 -0
  78. package/build/types/component-name.d.ts +9 -0
  79. package/build/types/component-name.d.ts.map +1 -0
  80. package/build/types/getLocationHref.d.ts +5 -0
  81. package/build/types/getLocationHref.d.ts.map +1 -0
  82. package/build/types/index.d.ts +18 -13
  83. package/build/types/index.d.ts.map +1 -1
  84. package/build/types/{instrument → instrumentation}/dom.d.ts +1 -1
  85. package/build/types/instrumentation/dom.d.ts.map +1 -0
  86. package/build/types/{instrument → instrumentation}/history.d.ts +8 -1
  87. package/build/types/instrumentation/history.d.ts.map +1 -0
  88. package/build/types/instrumentation/location.d.ts.map +1 -0
  89. package/build/types/{metrics/instrument.d.ts → instrumentation/performanceObserver.d.ts} +3 -3
  90. package/build/types/instrumentation/performanceObserver.d.ts.map +1 -0
  91. package/build/types/{instrument → instrumentation}/xhr.d.ts +1 -1
  92. package/build/types/instrumentation/xhr.d.ts.map +1 -0
  93. package/build/types/isBotUserAgent.d.ts +5 -0
  94. package/build/types/isBotUserAgent.d.ts.map +1 -0
  95. package/build/types/performance/elementTiming.d.ts.map +1 -0
  96. package/build/types/{metrics/browserMetrics.d.ts → performance/entries.d.ts} +4 -51
  97. package/build/types/performance/entries.d.ts.map +1 -0
  98. package/build/types/performance/interactions.d.ts +48 -0
  99. package/build/types/performance/interactions.d.ts.map +1 -0
  100. package/build/types/performance/resourceTiming.d.ts.map +1 -0
  101. package/build/types/performance/userTiming.d.ts.map +1 -0
  102. package/build/types/{metrics → performance}/utils.d.ts +1 -17
  103. package/build/types/performance/utils.d.ts.map +1 -0
  104. package/build/types/types.d.ts +38 -1
  105. package/build/types/types.d.ts.map +1 -1
  106. package/build/types/{metrics → web-vitals}/inp.d.ts +2 -1
  107. package/build/types/web-vitals/inp.d.ts.map +1 -0
  108. package/build/types/web-vitals/lcp.d.ts.map +1 -0
  109. package/build/types/web-vitals/reportEvents.d.ts +18 -0
  110. package/build/types/web-vitals/reportEvents.d.ts.map +1 -0
  111. package/build/types/{metrics/webVitalSpans.d.ts → web-vitals/spans.d.ts} +3 -3
  112. package/build/types/web-vitals/spans.d.ts.map +1 -0
  113. package/build/types/web-vitals/tracking.d.ts +46 -0
  114. package/build/types/web-vitals/tracking.d.ts.map +1 -0
  115. package/build/types/{metrics/web-vitals/lib/globalListeners.d.ts → web-vitals/utils.d.ts} +16 -1
  116. package/build/types/web-vitals/utils.d.ts.map +1 -0
  117. package/package.json +5 -3
  118. package/build/cjs/instrument/dom.js.map +0 -1
  119. package/build/cjs/instrument/history.js.map +0 -1
  120. package/build/cjs/instrument/location.js.map +0 -1
  121. package/build/cjs/instrument/xhr.js.map +0 -1
  122. package/build/cjs/metrics/browserMetrics.js.map +0 -1
  123. package/build/cjs/metrics/elementTiming.js.map +0 -1
  124. package/build/cjs/metrics/inp.js.map +0 -1
  125. package/build/cjs/metrics/instrument.js.map +0 -1
  126. package/build/cjs/metrics/lcp.js.map +0 -1
  127. package/build/cjs/metrics/resourceTiming.js.map +0 -1
  128. package/build/cjs/metrics/userTiming.js.map +0 -1
  129. package/build/cjs/metrics/utils.js.map +0 -1
  130. package/build/cjs/metrics/web-vitals/getCLS.js +0 -46
  131. package/build/cjs/metrics/web-vitals/getCLS.js.map +0 -1
  132. package/build/cjs/metrics/web-vitals/getINP.js +0 -60
  133. package/build/cjs/metrics/web-vitals/getINP.js.map +0 -1
  134. package/build/cjs/metrics/web-vitals/getLCP.js +0 -62
  135. package/build/cjs/metrics/web-vitals/getLCP.js.map +0 -1
  136. package/build/cjs/metrics/web-vitals/lib/InteractionManager.js +0 -87
  137. package/build/cjs/metrics/web-vitals/lib/InteractionManager.js.map +0 -1
  138. package/build/cjs/metrics/web-vitals/lib/LCPEntryManager.js +0 -11
  139. package/build/cjs/metrics/web-vitals/lib/LCPEntryManager.js.map +0 -1
  140. package/build/cjs/metrics/web-vitals/lib/LayoutShiftManager.js +0 -27
  141. package/build/cjs/metrics/web-vitals/lib/LayoutShiftManager.js.map +0 -1
  142. package/build/cjs/metrics/web-vitals/lib/bindReporter.js +0 -31
  143. package/build/cjs/metrics/web-vitals/lib/bindReporter.js.map +0 -1
  144. package/build/cjs/metrics/web-vitals/lib/generateUniqueID.js +0 -8
  145. package/build/cjs/metrics/web-vitals/lib/generateUniqueID.js.map +0 -1
  146. package/build/cjs/metrics/web-vitals/lib/getActivationStart.js +0 -11
  147. package/build/cjs/metrics/web-vitals/lib/getActivationStart.js.map +0 -1
  148. package/build/cjs/metrics/web-vitals/lib/getNavigationEntry.js +0 -17
  149. package/build/cjs/metrics/web-vitals/lib/getNavigationEntry.js.map +0 -1
  150. package/build/cjs/metrics/web-vitals/lib/getVisibilityWatcher.js +0 -44
  151. package/build/cjs/metrics/web-vitals/lib/getVisibilityWatcher.js.map +0 -1
  152. package/build/cjs/metrics/web-vitals/lib/globalListeners.js +0 -18
  153. package/build/cjs/metrics/web-vitals/lib/globalListeners.js.map +0 -1
  154. package/build/cjs/metrics/web-vitals/lib/initMetric.js +0 -34
  155. package/build/cjs/metrics/web-vitals/lib/initMetric.js.map +0 -1
  156. package/build/cjs/metrics/web-vitals/lib/initUnique.js +0 -16
  157. package/build/cjs/metrics/web-vitals/lib/initUnique.js.map +0 -1
  158. package/build/cjs/metrics/web-vitals/lib/observe.js +0 -20
  159. package/build/cjs/metrics/web-vitals/lib/observe.js.map +0 -1
  160. package/build/cjs/metrics/web-vitals/lib/onHidden.js +0 -16
  161. package/build/cjs/metrics/web-vitals/lib/onHidden.js.map +0 -1
  162. package/build/cjs/metrics/web-vitals/lib/polyfills/interactionCountPolyfill.js +0 -32
  163. package/build/cjs/metrics/web-vitals/lib/polyfills/interactionCountPolyfill.js.map +0 -1
  164. package/build/cjs/metrics/web-vitals/lib/runOnce.js +0 -14
  165. package/build/cjs/metrics/web-vitals/lib/runOnce.js.map +0 -1
  166. package/build/cjs/metrics/web-vitals/lib/whenActivated.js +0 -14
  167. package/build/cjs/metrics/web-vitals/lib/whenActivated.js.map +0 -1
  168. package/build/cjs/metrics/web-vitals/lib/whenIdleOrHidden.js +0 -22
  169. package/build/cjs/metrics/web-vitals/lib/whenIdleOrHidden.js.map +0 -1
  170. package/build/cjs/metrics/web-vitals/onFCP.js +0 -37
  171. package/build/cjs/metrics/web-vitals/onFCP.js.map +0 -1
  172. package/build/cjs/metrics/web-vitals/onTTFB.js +0 -35
  173. package/build/cjs/metrics/web-vitals/onTTFB.js.map +0 -1
  174. package/build/cjs/metrics/webVitalSpans.js.map +0 -1
  175. package/build/esm/instrument/dom.js.map +0 -1
  176. package/build/esm/instrument/history.js.map +0 -1
  177. package/build/esm/instrument/location.js.map +0 -1
  178. package/build/esm/instrument/xhr.js.map +0 -1
  179. package/build/esm/metrics/browserMetrics.js.map +0 -1
  180. package/build/esm/metrics/elementTiming.js.map +0 -1
  181. package/build/esm/metrics/inp.js.map +0 -1
  182. package/build/esm/metrics/instrument.js.map +0 -1
  183. package/build/esm/metrics/lcp.js.map +0 -1
  184. package/build/esm/metrics/resourceTiming.js.map +0 -1
  185. package/build/esm/metrics/userTiming.js.map +0 -1
  186. package/build/esm/metrics/utils.js.map +0 -1
  187. package/build/esm/metrics/web-vitals/getCLS.js +0 -43
  188. package/build/esm/metrics/web-vitals/getCLS.js.map +0 -1
  189. package/build/esm/metrics/web-vitals/getINP.js +0 -57
  190. package/build/esm/metrics/web-vitals/getINP.js.map +0 -1
  191. package/build/esm/metrics/web-vitals/getLCP.js +0 -59
  192. package/build/esm/metrics/web-vitals/getLCP.js.map +0 -1
  193. package/build/esm/metrics/web-vitals/lib/InteractionManager.js +0 -85
  194. package/build/esm/metrics/web-vitals/lib/InteractionManager.js.map +0 -1
  195. package/build/esm/metrics/web-vitals/lib/LCPEntryManager.js +0 -9
  196. package/build/esm/metrics/web-vitals/lib/LCPEntryManager.js.map +0 -1
  197. package/build/esm/metrics/web-vitals/lib/LayoutShiftManager.js +0 -25
  198. package/build/esm/metrics/web-vitals/lib/LayoutShiftManager.js.map +0 -1
  199. package/build/esm/metrics/web-vitals/lib/bindReporter.js +0 -29
  200. package/build/esm/metrics/web-vitals/lib/bindReporter.js.map +0 -1
  201. package/build/esm/metrics/web-vitals/lib/generateUniqueID.js +0 -6
  202. package/build/esm/metrics/web-vitals/lib/generateUniqueID.js.map +0 -1
  203. package/build/esm/metrics/web-vitals/lib/getActivationStart.js +0 -9
  204. package/build/esm/metrics/web-vitals/lib/getActivationStart.js.map +0 -1
  205. package/build/esm/metrics/web-vitals/lib/getNavigationEntry.js +0 -15
  206. package/build/esm/metrics/web-vitals/lib/getNavigationEntry.js.map +0 -1
  207. package/build/esm/metrics/web-vitals/lib/getVisibilityWatcher.js +0 -42
  208. package/build/esm/metrics/web-vitals/lib/getVisibilityWatcher.js.map +0 -1
  209. package/build/esm/metrics/web-vitals/lib/globalListeners.js +0 -15
  210. package/build/esm/metrics/web-vitals/lib/globalListeners.js.map +0 -1
  211. package/build/esm/metrics/web-vitals/lib/initMetric.js +0 -32
  212. package/build/esm/metrics/web-vitals/lib/initMetric.js.map +0 -1
  213. package/build/esm/metrics/web-vitals/lib/initUnique.js +0 -14
  214. package/build/esm/metrics/web-vitals/lib/initUnique.js.map +0 -1
  215. package/build/esm/metrics/web-vitals/lib/observe.js +0 -18
  216. package/build/esm/metrics/web-vitals/lib/observe.js.map +0 -1
  217. package/build/esm/metrics/web-vitals/lib/onHidden.js +0 -14
  218. package/build/esm/metrics/web-vitals/lib/onHidden.js.map +0 -1
  219. package/build/esm/metrics/web-vitals/lib/polyfills/interactionCountPolyfill.js +0 -29
  220. package/build/esm/metrics/web-vitals/lib/polyfills/interactionCountPolyfill.js.map +0 -1
  221. package/build/esm/metrics/web-vitals/lib/runOnce.js +0 -12
  222. package/build/esm/metrics/web-vitals/lib/runOnce.js.map +0 -1
  223. package/build/esm/metrics/web-vitals/lib/whenActivated.js +0 -12
  224. package/build/esm/metrics/web-vitals/lib/whenActivated.js.map +0 -1
  225. package/build/esm/metrics/web-vitals/lib/whenIdleOrHidden.js +0 -20
  226. package/build/esm/metrics/web-vitals/lib/whenIdleOrHidden.js.map +0 -1
  227. package/build/esm/metrics/web-vitals/onFCP.js +0 -34
  228. package/build/esm/metrics/web-vitals/onFCP.js.map +0 -1
  229. package/build/esm/metrics/web-vitals/onTTFB.js +0 -32
  230. package/build/esm/metrics/web-vitals/onTTFB.js.map +0 -1
  231. package/build/esm/metrics/webVitalSpans.js.map +0 -1
  232. package/build/types/instrument/dom.d.ts.map +0 -1
  233. package/build/types/instrument/history.d.ts.map +0 -1
  234. package/build/types/instrument/location.d.ts.map +0 -1
  235. package/build/types/instrument/xhr.d.ts.map +0 -1
  236. package/build/types/metrics/browserMetrics.d.ts.map +0 -1
  237. package/build/types/metrics/elementTiming.d.ts.map +0 -1
  238. package/build/types/metrics/inp.d.ts.map +0 -1
  239. package/build/types/metrics/instrument.d.ts.map +0 -1
  240. package/build/types/metrics/lcp.d.ts.map +0 -1
  241. package/build/types/metrics/resourceTiming.d.ts.map +0 -1
  242. package/build/types/metrics/userTiming.d.ts.map +0 -1
  243. package/build/types/metrics/utils.d.ts.map +0 -1
  244. package/build/types/metrics/web-vitals/getCLS.d.ts +0 -26
  245. package/build/types/metrics/web-vitals/getCLS.d.ts.map +0 -1
  246. package/build/types/metrics/web-vitals/getINP.d.ts +0 -34
  247. package/build/types/metrics/web-vitals/getINP.d.ts.map +0 -1
  248. package/build/types/metrics/web-vitals/getLCP.d.ts +0 -16
  249. package/build/types/metrics/web-vitals/getLCP.d.ts.map +0 -1
  250. package/build/types/metrics/web-vitals/lib/InteractionManager.d.ts +0 -37
  251. package/build/types/metrics/web-vitals/lib/InteractionManager.d.ts.map +0 -1
  252. package/build/types/metrics/web-vitals/lib/LCPEntryManager.d.ts +0 -5
  253. package/build/types/metrics/web-vitals/lib/LCPEntryManager.d.ts.map +0 -1
  254. package/build/types/metrics/web-vitals/lib/LayoutShiftManager.d.ts +0 -7
  255. package/build/types/metrics/web-vitals/lib/LayoutShiftManager.d.ts.map +0 -1
  256. package/build/types/metrics/web-vitals/lib/bindReporter.d.ts +0 -7
  257. package/build/types/metrics/web-vitals/lib/bindReporter.d.ts.map +0 -1
  258. package/build/types/metrics/web-vitals/lib/generateUniqueID.d.ts +0 -7
  259. package/build/types/metrics/web-vitals/lib/generateUniqueID.d.ts.map +0 -1
  260. package/build/types/metrics/web-vitals/lib/getActivationStart.d.ts +0 -2
  261. package/build/types/metrics/web-vitals/lib/getActivationStart.d.ts.map +0 -1
  262. package/build/types/metrics/web-vitals/lib/getNavigationEntry.d.ts +0 -2
  263. package/build/types/metrics/web-vitals/lib/getNavigationEntry.d.ts.map +0 -1
  264. package/build/types/metrics/web-vitals/lib/getVisibilityWatcher.d.ts +0 -5
  265. package/build/types/metrics/web-vitals/lib/getVisibilityWatcher.d.ts.map +0 -1
  266. package/build/types/metrics/web-vitals/lib/globalListeners.d.ts.map +0 -1
  267. package/build/types/metrics/web-vitals/lib/initMetric.d.ts +0 -21
  268. package/build/types/metrics/web-vitals/lib/initMetric.d.ts.map +0 -1
  269. package/build/types/metrics/web-vitals/lib/initUnique.d.ts +0 -7
  270. package/build/types/metrics/web-vitals/lib/initUnique.d.ts.map +0 -1
  271. package/build/types/metrics/web-vitals/lib/observe.d.ts +0 -23
  272. package/build/types/metrics/web-vitals/lib/observe.d.ts.map +0 -1
  273. package/build/types/metrics/web-vitals/lib/onHidden.d.ts +0 -15
  274. package/build/types/metrics/web-vitals/lib/onHidden.d.ts.map +0 -1
  275. package/build/types/metrics/web-vitals/lib/polyfills/interactionCountPolyfill.d.ts +0 -15
  276. package/build/types/metrics/web-vitals/lib/polyfills/interactionCountPolyfill.d.ts.map +0 -1
  277. package/build/types/metrics/web-vitals/lib/runOnce.d.ts +0 -2
  278. package/build/types/metrics/web-vitals/lib/runOnce.d.ts.map +0 -1
  279. package/build/types/metrics/web-vitals/lib/whenActivated.d.ts +0 -2
  280. package/build/types/metrics/web-vitals/lib/whenActivated.d.ts.map +0 -1
  281. package/build/types/metrics/web-vitals/lib/whenIdleOrHidden.d.ts +0 -6
  282. package/build/types/metrics/web-vitals/lib/whenIdleOrHidden.d.ts.map +0 -1
  283. package/build/types/metrics/web-vitals/onFCP.d.ts +0 -11
  284. package/build/types/metrics/web-vitals/onFCP.d.ts.map +0 -1
  285. package/build/types/metrics/web-vitals/onTTFB.d.ts +0 -20
  286. package/build/types/metrics/web-vitals/onTTFB.d.ts.map +0 -1
  287. package/build/types/metrics/web-vitals/types/base.d.ts +0 -103
  288. package/build/types/metrics/web-vitals/types/base.d.ts.map +0 -1
  289. package/build/types/metrics/web-vitals/types/cls.d.ts +0 -58
  290. package/build/types/metrics/web-vitals/types/cls.d.ts.map +0 -1
  291. package/build/types/metrics/web-vitals/types/fcp.d.ts +0 -47
  292. package/build/types/metrics/web-vitals/types/fcp.d.ts.map +0 -1
  293. package/build/types/metrics/web-vitals/types/inp.d.ts +0 -150
  294. package/build/types/metrics/web-vitals/types/inp.d.ts.map +0 -1
  295. package/build/types/metrics/web-vitals/types/lcp.d.ts +0 -74
  296. package/build/types/metrics/web-vitals/types/lcp.d.ts.map +0 -1
  297. package/build/types/metrics/web-vitals/types/ttfb.d.ts +0 -60
  298. package/build/types/metrics/web-vitals/types/ttfb.d.ts.map +0 -1
  299. package/build/types/metrics/web-vitals/types.d.ts +0 -78
  300. package/build/types/metrics/web-vitals/types.d.ts.map +0 -1
  301. package/build/types/metrics/webVitalSpans.d.ts.map +0 -1
  302. /package/build/cjs/{instrument → instrumentation}/dom.js +0 -0
  303. /package/build/cjs/{instrument → instrumentation}/location.js +0 -0
  304. /package/build/cjs/{instrument → instrumentation}/xhr.js +0 -0
  305. /package/build/cjs/{metrics → performance}/resourceTiming.js +0 -0
  306. /package/build/cjs/{metrics → web-vitals}/lcp.js +0 -0
  307. /package/build/esm/{instrument → instrumentation}/dom.js +0 -0
  308. /package/build/esm/{instrument → instrumentation}/location.js +0 -0
  309. /package/build/esm/{instrument → instrumentation}/xhr.js +0 -0
  310. /package/build/esm/{metrics → performance}/resourceTiming.js +0 -0
  311. /package/build/esm/{metrics → web-vitals}/lcp.js +0 -0
  312. /package/build/types/{instrument → instrumentation}/location.d.ts +0 -0
  313. /package/build/types/{metrics → performance}/elementTiming.d.ts +0 -0
  314. /package/build/types/{metrics → performance}/resourceTiming.d.ts +0 -0
  315. /package/build/types/{metrics → performance}/userTiming.d.ts +0 -0
  316. /package/build/types/{metrics → web-vitals}/lcp.d.ts +0 -0
@@ -1,87 +0,0 @@
1
- Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
2
-
3
- const interactionCountPolyfill = require('./polyfills/interactionCountPolyfill.js');
4
-
5
- const MAX_INTERACTIONS_TO_CONSIDER = 10;
6
- let prevInteractionCount = 0;
7
- const getInteractionCountForNavigation = () => {
8
- return interactionCountPolyfill.getInteractionCount() - prevInteractionCount;
9
- };
10
- class InteractionManager {
11
- constructor() {
12
- /**
13
- * A list of longest interactions on the page (by latency) sorted so the
14
- * longest one is first. The list is at most MAX_INTERACTIONS_TO_CONSIDER
15
- * long.
16
- */
17
- // oxlint-disable-next-line sdk/no-class-field-initializers
18
- this._longestInteractionList = [];
19
- /**
20
- * A mapping of longest interactions by their interaction ID.
21
- * This is used for faster lookup.
22
- */
23
- // oxlint-disable-next-line sdk/no-class-field-initializers
24
- this._longestInteractionMap = /* @__PURE__ */ new Map();
25
- }
26
- // eslint-disable-next-line @typescript-eslint/explicit-member-accessibility, jsdoc/require-jsdoc
27
- _resetInteractions() {
28
- prevInteractionCount = interactionCountPolyfill.getInteractionCount();
29
- this._longestInteractionList.length = 0;
30
- this._longestInteractionMap.clear();
31
- }
32
- /**
33
- * Returns the estimated p98 longest interaction based on the stored
34
- * interaction candidates and the interaction count for the current page.
35
- */
36
- // eslint-disable-next-line @typescript-eslint/explicit-member-accessibility
37
- _estimateP98LongestInteraction() {
38
- const candidateInteractionIndex = Math.min(
39
- this._longestInteractionList.length - 1,
40
- Math.floor(getInteractionCountForNavigation() / 50)
41
- );
42
- return this._longestInteractionList[candidateInteractionIndex];
43
- }
44
- /**
45
- * Takes a performance entry and adds it to the list of worst interactions
46
- * if its duration is long enough to make it among the worst. If the
47
- * entry is part of an existing interaction, it is merged and the latency
48
- * and entries list is updated as needed.
49
- */
50
- // eslint-disable-next-line @typescript-eslint/explicit-member-accessibility
51
- _processEntry(entry) {
52
- this._onBeforeProcessingEntry?.(entry);
53
- if (!(entry.interactionId || entry.entryType === "first-input")) return;
54
- const minLongestInteraction = this._longestInteractionList.at(-1);
55
- let interaction = this._longestInteractionMap.get(entry.interactionId);
56
- if (interaction || this._longestInteractionList.length < MAX_INTERACTIONS_TO_CONSIDER || // If the above conditions are false, `minLongestInteraction` will be set.
57
- entry.duration > minLongestInteraction._latency) {
58
- if (interaction) {
59
- if (entry.duration > interaction._latency) {
60
- interaction.entries = [entry];
61
- interaction._latency = entry.duration;
62
- } else if (entry.duration === interaction._latency && entry.startTime === interaction.entries[0].startTime) {
63
- interaction.entries.push(entry);
64
- }
65
- } else {
66
- interaction = {
67
- id: entry.interactionId,
68
- entries: [entry],
69
- _latency: entry.duration
70
- };
71
- this._longestInteractionMap.set(interaction.id, interaction);
72
- this._longestInteractionList.push(interaction);
73
- }
74
- this._longestInteractionList.sort((a, b) => b._latency - a._latency);
75
- if (this._longestInteractionList.length > MAX_INTERACTIONS_TO_CONSIDER) {
76
- const removedInteractions = this._longestInteractionList.splice(MAX_INTERACTIONS_TO_CONSIDER);
77
- for (const interaction2 of removedInteractions) {
78
- this._longestInteractionMap.delete(interaction2.id);
79
- }
80
- }
81
- this._onAfterProcessingINPCandidate?.(interaction);
82
- }
83
- }
84
- }
85
-
86
- exports.InteractionManager = InteractionManager;
87
- //# sourceMappingURL=InteractionManager.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"InteractionManager.js","sources":["../../../../../src/metrics/web-vitals/lib/InteractionManager.ts"],"sourcesContent":["/*\n * Copyright 2024 Google LLC\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * https://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { getInteractionCount } from './polyfills/interactionCountPolyfill.js';\n\nexport interface Interaction {\n _latency: number;\n // While the `id` and `entries` properties are also internal and could be\n // mangled by prefixing with an underscore, since they correspond to public\n // symbols there is no need to mangle them as the library will compress\n // better if we reuse the existing names.\n id: number;\n entries: PerformanceEventTiming[];\n}\n\n// To prevent unnecessary memory usage on pages with lots of interactions,\n// store at most 10 of the longest interactions to consider as INP candidates.\nconst MAX_INTERACTIONS_TO_CONSIDER = 10;\n\n// Used to store the interaction count after a bfcache restore, since p98\n// interaction latencies should only consider the current navigation.\nlet prevInteractionCount = 0;\n\n/**\n * Returns the interaction count since the last bfcache restore (or for the\n * full page lifecycle if there were no bfcache restores).\n */\nconst getInteractionCountForNavigation = () => {\n return getInteractionCount() - prevInteractionCount;\n};\n\n/**\n *\n */\nexport class InteractionManager {\n /**\n * A list of longest interactions on the page (by latency) sorted so the\n * longest one is first. The list is at most MAX_INTERACTIONS_TO_CONSIDER\n * long.\n */\n // oxlint-disable-next-line sdk/no-class-field-initializers\n _longestInteractionList: Interaction[] = [];\n\n /**\n * A mapping of longest interactions by their interaction ID.\n * This is used for faster lookup.\n */\n // oxlint-disable-next-line sdk/no-class-field-initializers\n _longestInteractionMap: Map<number, Interaction> = new Map();\n\n // eslint-disable-next-line @typescript-eslint/explicit-member-accessibility\n _onBeforeProcessingEntry?: (entry: PerformanceEventTiming) => void;\n\n // eslint-disable-next-line @typescript-eslint/explicit-member-accessibility\n _onAfterProcessingINPCandidate?: (interaction: Interaction) => void;\n\n // eslint-disable-next-line @typescript-eslint/explicit-member-accessibility, jsdoc/require-jsdoc\n _resetInteractions() {\n prevInteractionCount = getInteractionCount();\n this._longestInteractionList.length = 0;\n this._longestInteractionMap.clear();\n }\n\n /**\n * Returns the estimated p98 longest interaction based on the stored\n * interaction candidates and the interaction count for the current page.\n */\n // eslint-disable-next-line @typescript-eslint/explicit-member-accessibility\n _estimateP98LongestInteraction() {\n const candidateInteractionIndex = Math.min(\n this._longestInteractionList.length - 1,\n Math.floor(getInteractionCountForNavigation() / 50),\n );\n\n return this._longestInteractionList[candidateInteractionIndex];\n }\n\n /**\n * Takes a performance entry and adds it to the list of worst interactions\n * if its duration is long enough to make it among the worst. If the\n * entry is part of an existing interaction, it is merged and the latency\n * and entries list is updated as needed.\n */\n // eslint-disable-next-line @typescript-eslint/explicit-member-accessibility\n _processEntry(entry: PerformanceEventTiming) {\n this._onBeforeProcessingEntry?.(entry);\n\n // Skip further processing for entries that cannot be INP candidates.\n if (!(entry.interactionId || entry.entryType === 'first-input')) return;\n\n // The least-long of the 10 longest interactions.\n const minLongestInteraction = this._longestInteractionList.at(-1);\n\n let interaction = this._longestInteractionMap.get(entry.interactionId);\n\n // Only process the entry if it's possibly one of the ten longest,\n // or if it's part of an existing interaction.\n if (\n interaction ||\n this._longestInteractionList.length < MAX_INTERACTIONS_TO_CONSIDER ||\n // If the above conditions are false, `minLongestInteraction` will be set.\n entry.duration > minLongestInteraction!._latency\n ) {\n // If the interaction already exists, update it. Otherwise create one.\n if (interaction) {\n // If the new entry has a longer duration, replace the old entries,\n // otherwise add to the array.\n if (entry.duration > interaction._latency) {\n interaction.entries = [entry];\n interaction._latency = entry.duration;\n } else if (entry.duration === interaction._latency && entry.startTime === interaction.entries[0]!.startTime) {\n interaction.entries.push(entry);\n }\n } else {\n interaction = {\n id: entry.interactionId,\n entries: [entry],\n _latency: entry.duration,\n };\n this._longestInteractionMap.set(interaction.id, interaction);\n this._longestInteractionList.push(interaction);\n }\n\n // Sort the entries by latency (descending) and keep only the top ten.\n this._longestInteractionList.sort((a, b) => b._latency - a._latency);\n if (this._longestInteractionList.length > MAX_INTERACTIONS_TO_CONSIDER) {\n const removedInteractions = this._longestInteractionList.splice(MAX_INTERACTIONS_TO_CONSIDER);\n\n for (const interaction of removedInteractions) {\n this._longestInteractionMap.delete(interaction.id);\n }\n }\n\n // Call any post-processing on the interaction\n this._onAfterProcessingINPCandidate?.(interaction);\n }\n }\n}\n"],"names":["getInteractionCount","interaction"],"mappings":";;;;AA8BA,MAAM,4BAAA,GAA+B,EAAA;AAIrC,IAAI,oBAAA,GAAuB,CAAA;AAM3B,MAAM,mCAAmC,MAAM;AAC7C,EAAA,OAAOA,8CAAoB,GAAI,oBAAA;AACjC,CAAA;AAKO,MAAM,kBAAA,CAAmB;AAAA,EAAzB,WAAA,GAAA;AAOL;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,IAAA,IAAA,CAAA,uBAAA,GAAyC,EAAC;AAO1C;AAAA;AAAA;AAAA;AAAA;AAAA,IAAA,IAAA,CAAA,sBAAA,uBAAuD,GAAA,EAAI;AAAA,EAAA;AAAA;AAAA,EAS3D,kBAAA,GAAqB;AACnB,IAAA,oBAAA,GAAuBA,4CAAA,EAAoB;AAC3C,IAAA,IAAA,CAAK,wBAAwB,MAAA,GAAS,CAAA;AACtC,IAAA,IAAA,CAAK,uBAAuB,KAAA,EAAM;AAAA,EACpC;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAOA,8BAAA,GAAiC;AAC/B,IAAA,MAAM,4BAA4B,IAAA,CAAK,GAAA;AAAA,MACrC,IAAA,CAAK,wBAAwB,MAAA,GAAS,CAAA;AAAA,MACtC,IAAA,CAAK,KAAA,CAAM,gCAAA,EAAiC,GAAI,EAAE;AAAA,KACpD;AAEA,IAAA,OAAO,IAAA,CAAK,wBAAwB,yBAAyB,CAAA;AAAA,EAC/D;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EASA,cAAc,KAAA,EAA+B;AAC3C,IAAA,IAAA,CAAK,2BAA2B,KAAK,CAAA;AAGrC,IAAA,IAAI,EAAE,KAAA,CAAM,aAAA,IAAiB,KAAA,CAAM,cAAc,aAAA,CAAA,EAAgB;AAGjE,IAAA,MAAM,qBAAA,GAAwB,IAAA,CAAK,uBAAA,CAAwB,EAAA,CAAG,EAAE,CAAA;AAEhE,IAAA,IAAI,WAAA,GAAc,IAAA,CAAK,sBAAA,CAAuB,GAAA,CAAI,MAAM,aAAa,CAAA;AAIrE,IAAA,IACE,WAAA,IACA,IAAA,CAAK,uBAAA,CAAwB,MAAA,GAAS,4BAAA;AAAA,IAEtC,KAAA,CAAM,QAAA,GAAW,qBAAA,CAAuB,QAAA,EACxC;AAEA,MAAA,IAAI,WAAA,EAAa;AAGf,QAAA,IAAI,KAAA,CAAM,QAAA,GAAW,WAAA,CAAY,QAAA,EAAU;AACzC,UAAA,WAAA,CAAY,OAAA,GAAU,CAAC,KAAK,CAAA;AAC5B,UAAA,WAAA,CAAY,WAAW,KAAA,CAAM,QAAA;AAAA,QAC/B,CAAA,MAAA,IAAW,KAAA,CAAM,QAAA,KAAa,WAAA,CAAY,QAAA,IAAY,KAAA,CAAM,SAAA,KAAc,WAAA,CAAY,OAAA,CAAQ,CAAC,CAAA,CAAG,SAAA,EAAW;AAC3G,UAAA,WAAA,CAAY,OAAA,CAAQ,KAAK,KAAK,CAAA;AAAA,QAChC;AAAA,MACF,CAAA,MAAO;AACL,QAAA,WAAA,GAAc;AAAA,UACZ,IAAI,KAAA,CAAM,aAAA;AAAA,UACV,OAAA,EAAS,CAAC,KAAK,CAAA;AAAA,UACf,UAAU,KAAA,CAAM;AAAA,SAClB;AACA,QAAA,IAAA,CAAK,sBAAA,CAAuB,GAAA,CAAI,WAAA,CAAY,EAAA,EAAI,WAAW,CAAA;AAC3D,QAAA,IAAA,CAAK,uBAAA,CAAwB,KAAK,WAAW,CAAA;AAAA,MAC/C;AAGA,MAAA,IAAA,CAAK,uBAAA,CAAwB,KAAK,CAAC,CAAA,EAAG,MAAM,CAAA,CAAE,QAAA,GAAW,EAAE,QAAQ,CAAA;AACnE,MAAA,IAAI,IAAA,CAAK,uBAAA,CAAwB,MAAA,GAAS,4BAAA,EAA8B;AACtE,QAAA,MAAM,mBAAA,GAAsB,IAAA,CAAK,uBAAA,CAAwB,MAAA,CAAO,4BAA4B,CAAA;AAE5F,QAAA,KAAA,MAAWC,gBAAe,mBAAA,EAAqB;AAC7C,UAAA,IAAA,CAAK,sBAAA,CAAuB,MAAA,CAAOA,YAAAA,CAAY,EAAE,CAAA;AAAA,QACnD;AAAA,MACF;AAGA,MAAA,IAAA,CAAK,iCAAiC,WAAW,CAAA;AAAA,IACnD;AAAA,EACF;AACF;;;;"}
@@ -1,11 +0,0 @@
1
- Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
2
-
3
- class LCPEntryManager {
4
- // eslint-disable-next-line @typescript-eslint/explicit-member-accessibility, jsdoc/require-jsdoc
5
- _processEntry(entry) {
6
- this._onBeforeProcessingEntry?.(entry);
7
- }
8
- }
9
-
10
- exports.LCPEntryManager = LCPEntryManager;
11
- //# sourceMappingURL=LCPEntryManager.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"LCPEntryManager.js","sources":["../../../../../src/metrics/web-vitals/lib/LCPEntryManager.ts"],"sourcesContent":["/*\n * Copyright 2024 Google LLC\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * https://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n// eslint-disable-next-line jsdoc/require-jsdoc\nexport class LCPEntryManager {\n // eslint-disable-next-line @typescript-eslint/explicit-member-accessibility\n _onBeforeProcessingEntry?: (entry: LargestContentfulPaint) => void;\n\n // eslint-disable-next-line @typescript-eslint/explicit-member-accessibility, jsdoc/require-jsdoc\n _processEntry(entry: LargestContentfulPaint) {\n this._onBeforeProcessingEntry?.(entry);\n }\n}\n"],"names":[],"mappings":";;AAiBO,MAAM,eAAA,CAAgB;AAAA;AAAA,EAK3B,cAAc,KAAA,EAA+B;AAC3C,IAAA,IAAA,CAAK,2BAA2B,KAAK,CAAA;AAAA,EACvC;AACF;;;;"}
@@ -1,27 +0,0 @@
1
- Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
2
-
3
- class LayoutShiftManager {
4
- constructor() {
5
- // oxlint-disable-next-line sdk/no-class-field-initializers
6
- this._sessionValue = 0;
7
- // oxlint-disable-next-line sdk/no-class-field-initializers
8
- this._sessionEntries = [];
9
- }
10
- // eslint-disable-next-line @typescript-eslint/explicit-member-accessibility
11
- _processEntry(entry) {
12
- if (entry.hadRecentInput) return;
13
- const firstSessionEntry = this._sessionEntries[0];
14
- const lastSessionEntry = this._sessionEntries[this._sessionEntries.length - 1];
15
- if (this._sessionValue && firstSessionEntry && lastSessionEntry && entry.startTime - lastSessionEntry.startTime < 1e3 && entry.startTime - firstSessionEntry.startTime < 5e3) {
16
- this._sessionValue += entry.value;
17
- this._sessionEntries.push(entry);
18
- } else {
19
- this._sessionValue = entry.value;
20
- this._sessionEntries = [entry];
21
- }
22
- this._onAfterProcessingUnexpectedShift?.(entry);
23
- }
24
- }
25
-
26
- exports.LayoutShiftManager = LayoutShiftManager;
27
- //# sourceMappingURL=LayoutShiftManager.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"LayoutShiftManager.js","sources":["../../../../../src/metrics/web-vitals/lib/LayoutShiftManager.ts"],"sourcesContent":["/* eslint-disable jsdoc/require-jsdoc */\n/*\n * Copyright 2024 Google LLC\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * https://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nexport class LayoutShiftManager {\n // eslint-disable-next-line @typescript-eslint/explicit-member-accessibility\n _onAfterProcessingUnexpectedShift?: (entry: LayoutShift) => void;\n\n // oxlint-disable-next-line sdk/no-class-field-initializers\n _sessionValue = 0;\n // oxlint-disable-next-line sdk/no-class-field-initializers\n _sessionEntries: LayoutShift[] = [];\n\n // eslint-disable-next-line @typescript-eslint/explicit-member-accessibility\n _processEntry(entry: LayoutShift) {\n // Only count layout shifts without recent user input.\n if (entry.hadRecentInput) return;\n\n const firstSessionEntry = this._sessionEntries[0];\n // This previously used `this._sessionEntries.at(-1)` but that is ES2022. We support ES2021 and earlier.\n const lastSessionEntry = this._sessionEntries[this._sessionEntries.length - 1];\n\n // If the entry occurred less than 1 second after the previous entry\n // and less than 5 seconds after the first entry in the session,\n // include the entry in the current session. Otherwise, start a new\n // session.\n if (\n this._sessionValue &&\n firstSessionEntry &&\n lastSessionEntry &&\n entry.startTime - lastSessionEntry.startTime < 1000 &&\n entry.startTime - firstSessionEntry.startTime < 5000\n ) {\n this._sessionValue += entry.value;\n this._sessionEntries.push(entry);\n } else {\n this._sessionValue = entry.value;\n this._sessionEntries = [entry];\n }\n\n this._onAfterProcessingUnexpectedShift?.(entry);\n }\n}\n"],"names":[],"mappings":";;AAiBO,MAAM,kBAAA,CAAmB;AAAA,EAAzB,WAAA,GAAA;AAKL;AAAA,IAAA,IAAA,CAAA,aAAA,GAAgB,CAAA;AAEhB;AAAA,IAAA,IAAA,CAAA,eAAA,GAAiC,EAAC;AAAA,EAAA;AAAA;AAAA,EAGlC,cAAc,KAAA,EAAoB;AAEhC,IAAA,IAAI,MAAM,cAAA,EAAgB;AAE1B,IAAA,MAAM,iBAAA,GAAoB,IAAA,CAAK,eAAA,CAAgB,CAAC,CAAA;AAEhD,IAAA,MAAM,mBAAmB,IAAA,CAAK,eAAA,CAAgB,IAAA,CAAK,eAAA,CAAgB,SAAS,CAAC,CAAA;AAM7E,IAAA,IACE,IAAA,CAAK,aAAA,IACL,iBAAA,IACA,gBAAA,IACA,KAAA,CAAM,SAAA,GAAY,gBAAA,CAAiB,SAAA,GAAY,GAAA,IAC/C,KAAA,CAAM,SAAA,GAAY,iBAAA,CAAkB,YAAY,GAAA,EAChD;AACA,MAAA,IAAA,CAAK,iBAAiB,KAAA,CAAM,KAAA;AAC5B,MAAA,IAAA,CAAK,eAAA,CAAgB,KAAK,KAAK,CAAA;AAAA,IACjC,CAAA,MAAO;AACL,MAAA,IAAA,CAAK,gBAAgB,KAAA,CAAM,KAAA;AAC3B,MAAA,IAAA,CAAK,eAAA,GAAkB,CAAC,KAAK,CAAA;AAAA,IAC/B;AAEA,IAAA,IAAA,CAAK,oCAAoC,KAAK,CAAA;AAAA,EAChD;AACF;;;;"}
@@ -1,31 +0,0 @@
1
- Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
2
-
3
- const getRating = (value, thresholds) => {
4
- if (value > thresholds[1]) {
5
- return "poor";
6
- }
7
- if (value > thresholds[0]) {
8
- return "needs-improvement";
9
- }
10
- return "good";
11
- };
12
- const bindReporter = (callback, metric, thresholds, reportAllChanges) => {
13
- let prevValue;
14
- let delta;
15
- return (forceReport) => {
16
- if (metric.value >= 0) {
17
- if (forceReport || reportAllChanges) {
18
- delta = metric.value - (prevValue ?? 0);
19
- if (delta || prevValue === void 0) {
20
- prevValue = metric.value;
21
- metric.delta = delta;
22
- metric.rating = getRating(metric.value, thresholds);
23
- callback(metric);
24
- }
25
- }
26
- }
27
- };
28
- };
29
-
30
- exports.bindReporter = bindReporter;
31
- //# sourceMappingURL=bindReporter.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"bindReporter.js","sources":["../../../../../src/metrics/web-vitals/lib/bindReporter.ts"],"sourcesContent":["/*\n * Copyright 2020 Google LLC\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * https://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport type { MetricRatingThresholds, MetricType } from '../types';\n\nconst getRating = (value: number, thresholds: MetricRatingThresholds): MetricType['rating'] => {\n if (value > thresholds[1]) {\n return 'poor';\n }\n if (value > thresholds[0]) {\n return 'needs-improvement';\n }\n return 'good';\n};\n\nexport const bindReporter = <MetricName extends MetricType['name']>(\n callback: (metric: Extract<MetricType, { name: MetricName }>) => void,\n metric: Extract<MetricType, { name: MetricName }>,\n thresholds: MetricRatingThresholds,\n reportAllChanges?: boolean,\n) => {\n let prevValue: number;\n let delta: number;\n return (forceReport?: boolean) => {\n if (metric.value >= 0) {\n if (forceReport || reportAllChanges) {\n delta = metric.value - (prevValue ?? 0);\n\n // Report the metric if there's a non-zero delta or if no previous\n // value exists (which can happen in the case of the document becoming\n // hidden when the metric value is 0).\n // See: https://github.com/GoogleChrome/web-vitals/issues/14\n if (delta || prevValue === undefined) {\n prevValue = metric.value;\n metric.delta = delta;\n metric.rating = getRating(metric.value, thresholds);\n callback(metric);\n }\n }\n }\n };\n};\n"],"names":[],"mappings":";;AAkBA,MAAM,SAAA,GAAY,CAAC,KAAA,EAAe,UAAA,KAA6D;AAC7F,EAAA,IAAI,KAAA,GAAQ,UAAA,CAAW,CAAC,CAAA,EAAG;AACzB,IAAA,OAAO,MAAA;AAAA,EACT;AACA,EAAA,IAAI,KAAA,GAAQ,UAAA,CAAW,CAAC,CAAA,EAAG;AACzB,IAAA,OAAO,mBAAA;AAAA,EACT;AACA,EAAA,OAAO,MAAA;AACT,CAAA;AAEO,MAAM,YAAA,GAAe,CAC1B,QAAA,EACA,MAAA,EACA,YACA,gBAAA,KACG;AACH,EAAA,IAAI,SAAA;AACJ,EAAA,IAAI,KAAA;AACJ,EAAA,OAAO,CAAC,WAAA,KAA0B;AAChC,IAAA,IAAI,MAAA,CAAO,SAAS,CAAA,EAAG;AACrB,MAAA,IAAI,eAAe,gBAAA,EAAkB;AACnC,QAAA,KAAA,GAAQ,MAAA,CAAO,SAAS,SAAA,IAAa,CAAA,CAAA;AAMrC,QAAA,IAAI,KAAA,IAAS,cAAc,MAAA,EAAW;AACpC,UAAA,SAAA,GAAY,MAAA,CAAO,KAAA;AACnB,UAAA,MAAA,CAAO,KAAA,GAAQ,KAAA;AACf,UAAA,MAAA,CAAO,MAAA,GAAS,SAAA,CAAU,MAAA,CAAO,KAAA,EAAO,UAAU,CAAA;AAClD,UAAA,QAAA,CAAS,MAAM,CAAA;AAAA,QACjB;AAAA,MACF;AAAA,IACF;AAAA,EACF,CAAA;AACF;;;;"}
@@ -1,8 +0,0 @@
1
- Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
2
-
3
- const generateUniqueID = () => {
4
- return `v5-${Date.now()}-${Math.floor(Math.random() * (9e12 - 1)) + 1e12}`;
5
- };
6
-
7
- exports.generateUniqueID = generateUniqueID;
8
- //# sourceMappingURL=generateUniqueID.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"generateUniqueID.js","sources":["../../../../../src/metrics/web-vitals/lib/generateUniqueID.ts"],"sourcesContent":["/*\n * Copyright 2020 Google LLC\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * https://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n/**\n * Performantly generate a unique, 30-char string by combining a version\n * number, the current timestamp with a 13-digit number integer.\n * @return {string}\n */\nexport const generateUniqueID = () => {\n return `v5-${Date.now()}-${Math.floor(Math.random() * (9e12 - 1)) + 1e12}`;\n};\n"],"names":[],"mappings":";;AAqBO,MAAM,mBAAmB,MAAM;AACpC,EAAA,OAAO,CAAA,GAAA,EAAM,IAAA,CAAK,GAAA,EAAK,CAAA,CAAA,EAAI,IAAA,CAAK,KAAA,CAAM,IAAA,CAAK,MAAA,EAAO,IAAK,IAAA,GAAO,CAAA,CAAE,IAAI,IAAI,CAAA,CAAA;AAC1E;;;;"}
@@ -1,11 +0,0 @@
1
- Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
2
-
3
- const getNavigationEntry = require('./getNavigationEntry.js');
4
-
5
- const getActivationStart = () => {
6
- const navEntry = getNavigationEntry.getNavigationEntry();
7
- return navEntry?.activationStart ?? 0;
8
- };
9
-
10
- exports.getActivationStart = getActivationStart;
11
- //# sourceMappingURL=getActivationStart.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"getActivationStart.js","sources":["../../../../../src/metrics/web-vitals/lib/getActivationStart.ts"],"sourcesContent":["/*\n * Copyright 2022 Google LLC\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * https://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { getNavigationEntry } from './getNavigationEntry';\n\nexport const getActivationStart = (): number => {\n const navEntry = getNavigationEntry();\n return navEntry?.activationStart ?? 0;\n};\n"],"names":["getNavigationEntry"],"mappings":";;;;AAkBO,MAAM,qBAAqB,MAAc;AAC9C,EAAA,MAAM,WAAWA,qCAAA,EAAmB;AACpC,EAAA,OAAO,UAAU,eAAA,IAAmB,CAAA;AACtC;;;;"}
@@ -1,17 +0,0 @@
1
- Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
2
-
3
- const types = require('../../../types.js');
4
-
5
- const getNavigationEntry = (checkResponseStart = true) => {
6
- const navigationEntry = types.WINDOW.performance?.getEntriesByType?.("navigation")[0];
7
- if (
8
- // sentry-specific change:
9
- // We don't want to check for responseStart for our own use of `getNavigationEntry`
10
- !checkResponseStart || navigationEntry && navigationEntry.responseStart > 0 && navigationEntry.responseStart < performance.now()
11
- ) {
12
- return navigationEntry;
13
- }
14
- };
15
-
16
- exports.getNavigationEntry = getNavigationEntry;
17
- //# sourceMappingURL=getNavigationEntry.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"getNavigationEntry.js","sources":["../../../../../src/metrics/web-vitals/lib/getNavigationEntry.ts"],"sourcesContent":["/*\n * Copyright 2022 Google LLC\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * https://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { WINDOW } from '../../../types';\n\n// sentry-specific change:\n// add optional param to not check for responseStart (see comment below)\nexport const getNavigationEntry = (checkResponseStart = true): PerformanceNavigationTiming | void => {\n const navigationEntry = WINDOW.performance?.getEntriesByType?.('navigation')[0];\n // Check to ensure the `responseStart` property is present and valid.\n // In some cases a zero value is reported by the browser (for\n // privacy/security reasons), and in other cases (bugs) the value is\n // negative or is larger than the current page time. Ignore these cases:\n // - https://github.com/GoogleChrome/web-vitals/issues/137\n // - https://github.com/GoogleChrome/web-vitals/issues/162\n // - https://github.com/GoogleChrome/web-vitals/issues/275\n if (\n // sentry-specific change:\n // We don't want to check for responseStart for our own use of `getNavigationEntry`\n !checkResponseStart ||\n (navigationEntry && navigationEntry.responseStart > 0 && navigationEntry.responseStart < performance.now())\n ) {\n return navigationEntry;\n }\n};\n"],"names":["WINDOW"],"mappings":";;;;AAoBO,MAAM,kBAAA,GAAqB,CAAC,kBAAA,GAAqB,IAAA,KAA6C;AACnG,EAAA,MAAM,kBAAkBA,YAAA,CAAO,WAAA,EAAa,gBAAA,GAAmB,YAAY,EAAE,CAAC,CAAA;AAQ9E,EAAA;AAAA;AAAA;AAAA,IAGE,CAAC,sBACA,eAAA,IAAmB,eAAA,CAAgB,gBAAgB,CAAA,IAAK,eAAA,CAAgB,aAAA,GAAgB,WAAA,CAAY,GAAA;AAAI,IACzG;AACA,IAAA,OAAO,eAAA;AAAA,EACT;AACF;;;;"}
@@ -1,44 +0,0 @@
1
- Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
2
-
3
- const types = require('../../../types.js');
4
- const getActivationStart = require('./getActivationStart.js');
5
- const globalListeners = require('./globalListeners.js');
6
-
7
- let firstHiddenTime = -1;
8
- const onHiddenFunctions = /* @__PURE__ */ new Set();
9
- const initHiddenTime = () => {
10
- return types.WINDOW.document?.visibilityState === "hidden" && !types.WINDOW.document?.prerendering ? 0 : Infinity;
11
- };
12
- const onVisibilityUpdate = (event) => {
13
- if (types.WINDOW.document?.visibilityState === "hidden" && firstHiddenTime > -1) {
14
- if (event.type === "visibilitychange") {
15
- for (const onHiddenFunction of onHiddenFunctions) {
16
- onHiddenFunction();
17
- }
18
- }
19
- if (!isFinite(firstHiddenTime)) {
20
- firstHiddenTime = event.type === "visibilitychange" ? event.timeStamp : 0;
21
- globalListeners.removePageListener("prerenderingchange", onVisibilityUpdate, true);
22
- }
23
- }
24
- };
25
- const getVisibilityWatcher = () => {
26
- if (types.WINDOW.document && firstHiddenTime < 0) {
27
- const activationStart = getActivationStart.getActivationStart();
28
- const firstVisibilityStateHiddenTime = !types.WINDOW.document.prerendering ? globalThis.performance.getEntriesByType("visibility-state").filter((e) => e.name === "hidden" && e.startTime > activationStart)[0]?.startTime : void 0;
29
- firstHiddenTime = firstVisibilityStateHiddenTime ?? initHiddenTime();
30
- globalListeners.addPageListener("visibilitychange", onVisibilityUpdate, true);
31
- globalListeners.addPageListener("prerenderingchange", onVisibilityUpdate, true);
32
- }
33
- return {
34
- get firstHiddenTime() {
35
- return firstHiddenTime;
36
- },
37
- onHidden(cb) {
38
- onHiddenFunctions.add(cb);
39
- }
40
- };
41
- };
42
-
43
- exports.getVisibilityWatcher = getVisibilityWatcher;
44
- //# sourceMappingURL=getVisibilityWatcher.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"getVisibilityWatcher.js","sources":["../../../../../src/metrics/web-vitals/lib/getVisibilityWatcher.ts"],"sourcesContent":["/*\n * Copyright 2020 Google LLC\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * https://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { WINDOW } from '../../../types';\nimport { getActivationStart } from './getActivationStart';\nimport { addPageListener, removePageListener } from './globalListeners';\n\nlet firstHiddenTime = -1;\nconst onHiddenFunctions: Set<() => void> = new Set();\n\nconst initHiddenTime = () => {\n // If the document is hidden when this code runs, assume it was always\n // hidden and the page was loaded in the background, with the one exception\n // that visibility state is always 'hidden' during prerendering, so we have\n // to ignore that case until prerendering finishes (see: `prerenderingchange`\n // event logic below).\n return WINDOW.document?.visibilityState === 'hidden' && !WINDOW.document?.prerendering ? 0 : Infinity;\n};\n\nconst onVisibilityUpdate = (event: Event) => {\n // Handle changes to hidden state\n if (WINDOW.document?.visibilityState === 'hidden' && firstHiddenTime > -1) {\n // Call onHidden callbacks when the page becomes hidden\n if (event.type === 'visibilitychange') {\n for (const onHiddenFunction of onHiddenFunctions) {\n onHiddenFunction();\n }\n }\n\n // If the document is 'hidden' and no previous hidden timestamp has been\n // set (so is infinity), update it based on the current event data.\n if (!isFinite(firstHiddenTime)) {\n // If the event is a 'visibilitychange' event, it means the page was\n // visible prior to this change, so the event timestamp is the first\n // hidden time.\n // However, if the event is not a 'visibilitychange' event, then it must\n // be a 'prerenderingchange' event, and the fact that the document is\n // still 'hidden' from the above check means the tab was activated\n // in a background state and so has always been hidden.\n firstHiddenTime = event.type === 'visibilitychange' ? event.timeStamp : 0;\n\n // We no longer need the `prerenderingchange` event listener now we've\n // set an initial init time so remove that\n // (we'll keep the visibilitychange one for onHiddenFunction above)\n removePageListener('prerenderingchange', onVisibilityUpdate, true);\n }\n }\n};\n\nexport const getVisibilityWatcher = () => {\n if (WINDOW.document && firstHiddenTime < 0) {\n // Check if we have a previous hidden `visibility-state` performance entry.\n const activationStart = getActivationStart();\n const firstVisibilityStateHiddenTime = !WINDOW.document.prerendering\n ? globalThis.performance\n .getEntriesByType('visibility-state')\n .filter(e => e.name === 'hidden' && e.startTime > activationStart)[0]?.startTime\n : undefined;\n\n // Prefer that, but if it's not available and the document is hidden when\n // this code runs, assume it was hidden since navigation start. This isn't\n // a perfect heuristic, but it's the best we can do until the\n // `visibility-state` performance entry becomes available in all browsers.\n firstHiddenTime = firstVisibilityStateHiddenTime ?? initHiddenTime();\n // Listen for visibility changes so we can handle things like bfcache\n // restores and/or prerender without having to examine individual\n // timestamps in detail and also for onHidden function calls.\n addPageListener('visibilitychange', onVisibilityUpdate, true);\n\n // IMPORTANT: when a page is prerendering, its `visibilityState` is\n // 'hidden', so in order to account for cases where this module checks for\n // visibility during prerendering, an additional check after prerendering\n // completes is also required.\n addPageListener('prerenderingchange', onVisibilityUpdate, true);\n }\n\n return {\n get firstHiddenTime() {\n return firstHiddenTime;\n },\n onHidden(cb: () => void) {\n onHiddenFunctions.add(cb);\n },\n };\n};\n"],"names":["WINDOW","removePageListener","getActivationStart","addPageListener"],"mappings":";;;;;;AAoBA,IAAI,eAAA,GAAkB,EAAA;AACtB,MAAM,iBAAA,uBAAyC,GAAA,EAAI;AAEnD,MAAM,iBAAiB,MAAM;AAM3B,EAAA,OAAOA,YAAA,CAAO,UAAU,eAAA,KAAoB,QAAA,IAAY,CAACA,YAAA,CAAO,QAAA,EAAU,eAAe,CAAA,GAAI,QAAA;AAC/F,CAAA;AAEA,MAAM,kBAAA,GAAqB,CAAC,KAAA,KAAiB;AAE3C,EAAA,IAAIA,YAAA,CAAO,QAAA,EAAU,eAAA,KAAoB,QAAA,IAAY,kBAAkB,EAAA,EAAI;AAEzE,IAAA,IAAI,KAAA,CAAM,SAAS,kBAAA,EAAoB;AACrC,MAAA,KAAA,MAAW,oBAAoB,iBAAA,EAAmB;AAChD,QAAA,gBAAA,EAAiB;AAAA,MACnB;AAAA,IACF;AAIA,IAAA,IAAI,CAAC,QAAA,CAAS,eAAe,CAAA,EAAG;AAQ9B,MAAA,eAAA,GAAkB,KAAA,CAAM,IAAA,KAAS,kBAAA,GAAqB,KAAA,CAAM,SAAA,GAAY,CAAA;AAKxE,MAAAC,kCAAA,CAAmB,oBAAA,EAAsB,oBAAoB,IAAI,CAAA;AAAA,IACnE;AAAA,EACF;AACF,CAAA;AAEO,MAAM,uBAAuB,MAAM;AACxC,EAAA,IAAID,YAAA,CAAO,QAAA,IAAY,eAAA,GAAkB,CAAA,EAAG;AAE1C,IAAA,MAAM,kBAAkBE,qCAAA,EAAmB;AAC3C,IAAA,MAAM,8BAAA,GAAiC,CAACF,YAAA,CAAO,QAAA,CAAS,eACpD,UAAA,CAAW,WAAA,CACR,iBAAiB,kBAAkB,CAAA,CACnC,OAAO,CAAA,CAAA,KAAK,CAAA,CAAE,SAAS,QAAA,IAAY,CAAA,CAAE,YAAY,eAAe,CAAA,CAAE,CAAC,CAAA,EAAG,SAAA,GACzE,MAAA;AAMJ,IAAA,eAAA,GAAkB,kCAAkC,cAAA,EAAe;AAInE,IAAAG,+BAAA,CAAgB,kBAAA,EAAoB,oBAAoB,IAAI,CAAA;AAM5D,IAAAA,+BAAA,CAAgB,oBAAA,EAAsB,oBAAoB,IAAI,CAAA;AAAA,EAChE;AAEA,EAAA,OAAO;AAAA,IACL,IAAI,eAAA,GAAkB;AACpB,MAAA,OAAO,eAAA;AAAA,IACT,CAAA;AAAA,IACA,SAAS,EAAA,EAAgB;AACvB,MAAA,iBAAA,CAAkB,IAAI,EAAE,CAAA;AAAA,IAC1B;AAAA,GACF;AACF;;;;"}
@@ -1,18 +0,0 @@
1
- Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
2
-
3
- const types = require('../../../types.js');
4
-
5
- function addPageListener(type, listener, options) {
6
- if (types.WINDOW.document) {
7
- types.WINDOW.addEventListener(type, listener, options);
8
- }
9
- }
10
- function removePageListener(type, listener, options) {
11
- if (types.WINDOW.document) {
12
- types.WINDOW.removeEventListener(type, listener, options);
13
- }
14
- }
15
-
16
- exports.addPageListener = addPageListener;
17
- exports.removePageListener = removePageListener;
18
- //# sourceMappingURL=globalListeners.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"globalListeners.js","sources":["../../../../../src/metrics/web-vitals/lib/globalListeners.ts"],"sourcesContent":["import { WINDOW } from '../../../types';\n\n/**\n * web-vitals 5.1.0 switched listeners to be added on the window rather than the document.\n * Instead of having to check for window/document every time we add a listener, we can use this function.\n */\nexport function addPageListener(type: string, listener: EventListener, options?: boolean | AddEventListenerOptions) {\n if (WINDOW.document) {\n WINDOW.addEventListener(type, listener, options);\n }\n}\n/**\n * web-vitals 5.1.0 switched listeners to be removed from the window rather than the document.\n * Instead of having to check for window/document every time we remove a listener, we can use this function.\n */\nexport function removePageListener(type: string, listener: EventListener, options?: boolean | AddEventListenerOptions) {\n if (WINDOW.document) {\n WINDOW.removeEventListener(type, listener, options);\n }\n}\n"],"names":["WINDOW"],"mappings":";;;;AAMO,SAAS,eAAA,CAAgB,IAAA,EAAc,QAAA,EAAyB,OAAA,EAA6C;AAClH,EAAA,IAAIA,aAAO,QAAA,EAAU;AACnB,IAAAA,YAAA,CAAO,gBAAA,CAAiB,IAAA,EAAM,QAAA,EAAU,OAAO,CAAA;AAAA,EACjD;AACF;AAKO,SAAS,kBAAA,CAAmB,IAAA,EAAc,QAAA,EAAyB,OAAA,EAA6C;AACrH,EAAA,IAAIA,aAAO,QAAA,EAAU;AACnB,IAAAA,YAAA,CAAO,mBAAA,CAAoB,IAAA,EAAM,QAAA,EAAU,OAAO,CAAA;AAAA,EACpD;AACF;;;;;"}
@@ -1,34 +0,0 @@
1
- Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
2
-
3
- const types = require('../../../types.js');
4
- const generateUniqueID = require('./generateUniqueID.js');
5
- const getActivationStart = require('./getActivationStart.js');
6
- const getNavigationEntry = require('./getNavigationEntry.js');
7
-
8
- const initMetric = (name, value = -1) => {
9
- const navEntry = getNavigationEntry.getNavigationEntry();
10
- let navigationType = "navigate";
11
- if (navEntry) {
12
- if (types.WINDOW.document?.prerendering || getActivationStart.getActivationStart() > 0) {
13
- navigationType = "prerender";
14
- } else if (types.WINDOW.document?.wasDiscarded) {
15
- navigationType = "restore";
16
- } else if (navEntry.type) {
17
- navigationType = navEntry.type.replace(/_/g, "-");
18
- }
19
- }
20
- const entries = [];
21
- return {
22
- name,
23
- value,
24
- rating: "good",
25
- // If needed, will be updated when reported. `const` to keep the type from widening to `string`.
26
- delta: 0,
27
- entries,
28
- id: generateUniqueID.generateUniqueID(),
29
- navigationType
30
- };
31
- };
32
-
33
- exports.initMetric = initMetric;
34
- //# sourceMappingURL=initMetric.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"initMetric.js","sources":["../../../../../src/metrics/web-vitals/lib/initMetric.ts"],"sourcesContent":["/*\n * Copyright 2020 Google LLC\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * https://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { WINDOW } from '../../../types';\nimport type { MetricType } from '../types';\nimport { generateUniqueID } from './generateUniqueID';\nimport { getActivationStart } from './getActivationStart';\nimport { getNavigationEntry } from './getNavigationEntry';\n\nexport const initMetric = <MetricName extends MetricType['name']>(name: MetricName, value: number = -1) => {\n const navEntry = getNavigationEntry();\n let navigationType: MetricType['navigationType'] = 'navigate';\n\n if (navEntry) {\n if (WINDOW.document?.prerendering || getActivationStart() > 0) {\n navigationType = 'prerender';\n } else if (WINDOW.document?.wasDiscarded) {\n navigationType = 'restore';\n } else if (navEntry.type) {\n navigationType = navEntry.type.replace(/_/g, '-') as MetricType['navigationType'];\n }\n }\n\n // Use `entries` type specific for the metric.\n const entries: Extract<MetricType, { name: MetricName }>['entries'] = [];\n\n return {\n name,\n value,\n rating: 'good' as const, // If needed, will be updated when reported. `const` to keep the type from widening to `string`.\n delta: 0,\n entries,\n id: generateUniqueID(),\n navigationType,\n };\n};\n"],"names":["getNavigationEntry","WINDOW","getActivationStart","generateUniqueID"],"mappings":";;;;;;;AAsBO,MAAM,UAAA,GAAa,CAAwC,IAAA,EAAkB,KAAA,GAAgB,EAAA,KAAO;AACzG,EAAA,MAAM,WAAWA,qCAAA,EAAmB;AACpC,EAAA,IAAI,cAAA,GAA+C,UAAA;AAEnD,EAAA,IAAI,QAAA,EAAU;AACZ,IAAA,IAAIC,YAAA,CAAO,QAAA,EAAU,YAAA,IAAgBC,qCAAA,KAAuB,CAAA,EAAG;AAC7D,MAAA,cAAA,GAAiB,WAAA;AAAA,IACnB,CAAA,MAAA,IAAWD,YAAA,CAAO,QAAA,EAAU,YAAA,EAAc;AACxC,MAAA,cAAA,GAAiB,SAAA;AAAA,IACnB,CAAA,MAAA,IAAW,SAAS,IAAA,EAAM;AACxB,MAAA,cAAA,GAAiB,QAAA,CAAS,IAAA,CAAK,OAAA,CAAQ,IAAA,EAAM,GAAG,CAAA;AAAA,IAClD;AAAA,EACF;AAGA,EAAA,MAAM,UAAgE,EAAC;AAEvE,EAAA,OAAO;AAAA,IACL,IAAA;AAAA,IACA,KAAA;AAAA,IACA,MAAA,EAAQ,MAAA;AAAA;AAAA,IACR,KAAA,EAAO,CAAA;AAAA,IACP,OAAA;AAAA,IACA,IAAIE,iCAAA,EAAiB;AAAA,IACrB;AAAA,GACF;AACF;;;;"}
@@ -1,16 +0,0 @@
1
- Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
2
-
3
- const instanceMap = /* @__PURE__ */ new WeakMap();
4
- function initUnique(identityObj, ClassObj) {
5
- try {
6
- if (!instanceMap.get(identityObj)) {
7
- instanceMap.set(identityObj, new ClassObj());
8
- }
9
- return instanceMap.get(identityObj);
10
- } catch {
11
- return new ClassObj();
12
- }
13
- }
14
-
15
- exports.initUnique = initUnique;
16
- //# sourceMappingURL=initUnique.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"initUnique.js","sources":["../../../../../src/metrics/web-vitals/lib/initUnique.ts"],"sourcesContent":["/*\n * Copyright 2024 Google LLC\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * https://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nconst instanceMap: WeakMap<object, unknown> = new WeakMap();\n\n/**\n * A function that accepts and identity object and a class object and returns\n * either a new instance of that class or an existing instance, if the\n * identity object was previously used.\n */\nexport function initUnique<T>(identityObj: object, ClassObj: new () => T): T {\n try {\n if (!instanceMap.get(identityObj)) {\n instanceMap.set(identityObj, new ClassObj());\n }\n return instanceMap.get(identityObj)! as T;\n } catch {\n // --- START Sentry-custom code (try/catch wrapping) ---\n // Fix for cases where identityObj is not a valid key for WeakMap (sometimes a problem in Safari)\n // Just return a new instance without caching it in instanceMap\n return new ClassObj();\n }\n // --- END Sentry-custom code ---\n}\n"],"names":[],"mappings":";;AAgBA,MAAM,WAAA,uBAA4C,OAAA,EAAQ;AAOnD,SAAS,UAAA,CAAc,aAAqB,QAAA,EAA0B;AAC3E,EAAA,IAAI;AACF,IAAA,IAAI,CAAC,WAAA,CAAY,GAAA,CAAI,WAAW,CAAA,EAAG;AACjC,MAAA,WAAA,CAAY,GAAA,CAAI,WAAA,EAAa,IAAI,QAAA,EAAU,CAAA;AAAA,IAC7C;AACA,IAAA,OAAO,WAAA,CAAY,IAAI,WAAW,CAAA;AAAA,EACpC,CAAA,CAAA,MAAQ;AAIN,IAAA,OAAO,IAAI,QAAA,EAAS;AAAA,EACtB;AAEF;;;;"}
@@ -1,20 +0,0 @@
1
- Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
2
-
3
- const observe = (type, callback, opts = {}) => {
4
- try {
5
- if (PerformanceObserver.supportedEntryTypes.includes(type)) {
6
- const po = new PerformanceObserver((list) => {
7
- Promise.resolve().then(() => {
8
- callback(list.getEntries());
9
- });
10
- });
11
- po.observe({ type, buffered: true, ...opts });
12
- return po;
13
- }
14
- } catch {
15
- }
16
- return;
17
- };
18
-
19
- exports.observe = observe;
20
- //# sourceMappingURL=observe.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"observe.js","sources":["../../../../../src/metrics/web-vitals/lib/observe.ts"],"sourcesContent":["/*\n * Copyright 2020 Google LLC\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * https://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\ninterface PerformanceEntryMap {\n event: PerformanceEventTiming[];\n 'first-input': PerformanceEventTiming[];\n 'layout-shift': LayoutShift[];\n 'largest-contentful-paint': LargestContentfulPaint[];\n 'long-animation-frame': PerformanceLongAnimationFrameTiming[];\n paint: PerformancePaintTiming[];\n navigation: PerformanceNavigationTiming[];\n resource: PerformanceResourceTiming[];\n // Sentry-specific change:\n // We add longtask as a supported entry type as we use this in\n // our `instrumentPerformanceObserver` function also observes 'longtask'\n // entries.\n longtask: PerformanceEntry[];\n // Sentry-specific change:\n // We add element as a supported entry type for ElementTiming API\n element: PerformanceEntry[];\n}\n\n/**\n * Takes a performance entry type and a callback function, and creates a\n * `PerformanceObserver` instance that will observe the specified entry type\n * with buffering enabled and call the callback _for each entry_.\n *\n * This function also feature-detects entry support and wraps the logic in a\n * try/catch to avoid errors in unsupporting browsers.\n */\nexport const observe = <K extends keyof PerformanceEntryMap>(\n type: K,\n callback: (entries: PerformanceEntryMap[K]) => void,\n opts: PerformanceObserverInit = {},\n): PerformanceObserver | undefined => {\n try {\n if (PerformanceObserver.supportedEntryTypes.includes(type)) {\n const po = new PerformanceObserver(list => {\n // Delay by a microtask to workaround a bug in Safari where the\n // callback is invoked immediately, rather than in a separate task.\n // See: https://github.com/GoogleChrome/web-vitals/issues/277\n // eslint-disable-next-line @typescript-eslint/no-floating-promises\n Promise.resolve().then(() => {\n callback(list.getEntries() as PerformanceEntryMap[K]);\n });\n });\n po.observe({ type, buffered: true, ...opts });\n return po;\n }\n } catch {\n // Do nothing.\n }\n return;\n};\n"],"names":[],"mappings":";;AA2CO,MAAM,UAAU,CACrB,IAAA,EACA,QAAA,EACA,IAAA,GAAgC,EAAC,KACG;AACpC,EAAA,IAAI;AACF,IAAA,IAAI,mBAAA,CAAoB,mBAAA,CAAoB,QAAA,CAAS,IAAI,CAAA,EAAG;AAC1D,MAAA,MAAM,EAAA,GAAK,IAAI,mBAAA,CAAoB,CAAA,IAAA,KAAQ;AAKzC,QAAA,OAAA,CAAQ,OAAA,EAAQ,CAAE,IAAA,CAAK,MAAM;AAC3B,UAAA,QAAA,CAAS,IAAA,CAAK,YAAsC,CAAA;AAAA,QACtD,CAAC,CAAA;AAAA,MACH,CAAC,CAAA;AACD,MAAA,EAAA,CAAG,QAAQ,EAAE,IAAA,EAAM,UAAU,IAAA,EAAM,GAAG,MAAM,CAAA;AAC5C,MAAA,OAAO,EAAA;AAAA,IACT;AAAA,EACF,CAAA,CAAA,MAAQ;AAAA,EAER;AACA,EAAA;AACF;;;;"}
@@ -1,16 +0,0 @@
1
- Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
2
-
3
- const types = require('../../../types.js');
4
- const globalListeners = require('./globalListeners.js');
5
-
6
- const onHidden = (cb) => {
7
- const onHiddenCallback = (event) => {
8
- if (types.WINDOW.document?.visibilityState === "hidden") {
9
- cb(event);
10
- }
11
- };
12
- globalListeners.addPageListener("visibilitychange", onHiddenCallback, { capture: true });
13
- };
14
-
15
- exports.onHidden = onHidden;
16
- //# sourceMappingURL=onHidden.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"onHidden.js","sources":["../../../../../src/metrics/web-vitals/lib/onHidden.ts"],"sourcesContent":["/*\n * Copyright 2020 Google LLC\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * https://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { WINDOW } from '../../../types';\nimport { addPageListener } from './globalListeners';\n\nexport interface OnHiddenCallback {\n (event: Event): void;\n}\n\n/**\n * Calls the passed callback when the page transitions to hidden.\n *\n * Uses the `visibilitychange` event exclusively, which is well-supported\n * across all modern browsers.\n *\n * @param {OnHiddenCallback} cb - Callback to be executed when the page is hidden.\n *\n * @deprecated use `whenIdleOrHidden` or `addPageListener('visibilitychange')` instead\n */\nexport const onHidden = (cb: OnHiddenCallback) => {\n const onHiddenCallback = (event: Event) => {\n if (WINDOW.document?.visibilityState === 'hidden') {\n cb(event);\n }\n };\n\n addPageListener('visibilitychange', onHiddenCallback, { capture: true });\n};\n"],"names":["WINDOW","addPageListener"],"mappings":";;;;;AAiCO,MAAM,QAAA,GAAW,CAAC,EAAA,KAAyB;AAChD,EAAA,MAAM,gBAAA,GAAmB,CAAC,KAAA,KAAiB;AACzC,IAAA,IAAIA,YAAA,CAAO,QAAA,EAAU,eAAA,KAAoB,QAAA,EAAU;AACjD,MAAA,EAAA,CAAG,KAAK,CAAA;AAAA,IACV;AAAA,EACF,CAAA;AAEA,EAAAC,+BAAA,CAAgB,kBAAA,EAAoB,gBAAA,EAAkB,EAAE,OAAA,EAAS,MAAM,CAAA;AACzE;;;;"}
@@ -1,32 +0,0 @@
1
- Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
2
-
3
- const observe = require('../observe.js');
4
-
5
- let interactionCountEstimate = 0;
6
- let minKnownInteractionId = Infinity;
7
- let maxKnownInteractionId = 0;
8
- const updateEstimate = (entries) => {
9
- entries.forEach((e) => {
10
- if (e.interactionId) {
11
- minKnownInteractionId = Math.min(minKnownInteractionId, e.interactionId);
12
- maxKnownInteractionId = Math.max(maxKnownInteractionId, e.interactionId);
13
- interactionCountEstimate = maxKnownInteractionId ? (maxKnownInteractionId - minKnownInteractionId) / 7 + 1 : 0;
14
- }
15
- });
16
- };
17
- let po;
18
- const getInteractionCount = () => {
19
- return po ? interactionCountEstimate : performance.interactionCount || 0;
20
- };
21
- const initInteractionCountPolyfill = () => {
22
- if ("interactionCount" in performance || po) return;
23
- po = observe.observe("event", updateEstimate, {
24
- type: "event",
25
- buffered: true,
26
- durationThreshold: 0
27
- });
28
- };
29
-
30
- exports.getInteractionCount = getInteractionCount;
31
- exports.initInteractionCountPolyfill = initInteractionCountPolyfill;
32
- //# sourceMappingURL=interactionCountPolyfill.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"interactionCountPolyfill.js","sources":["../../../../../../src/metrics/web-vitals/lib/polyfills/interactionCountPolyfill.ts"],"sourcesContent":["/*\n * Copyright 2022 Google LLC\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * https://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { observe } from '../observe';\n\ndeclare global {\n interface Performance {\n readonly interactionCount: number;\n }\n}\n\nlet interactionCountEstimate = 0;\nlet minKnownInteractionId = Infinity;\nlet maxKnownInteractionId = 0;\n\nconst updateEstimate = (entries: PerformanceEventTiming[]) => {\n entries.forEach(e => {\n if (e.interactionId) {\n minKnownInteractionId = Math.min(minKnownInteractionId, e.interactionId);\n maxKnownInteractionId = Math.max(maxKnownInteractionId, e.interactionId);\n\n interactionCountEstimate = maxKnownInteractionId ? (maxKnownInteractionId - minKnownInteractionId) / 7 + 1 : 0;\n }\n });\n};\n\nlet po: PerformanceObserver | undefined;\n\n/**\n * Returns the `interactionCount` value using the native API (if available)\n * or the polyfill estimate in this module.\n */\nexport const getInteractionCount = (): number => {\n return po ? interactionCountEstimate : performance.interactionCount || 0;\n};\n\n/**\n * Feature detects native support or initializes the polyfill if needed.\n */\nexport const initInteractionCountPolyfill = (): void => {\n if ('interactionCount' in performance || po) return;\n\n po = observe('event', updateEstimate, {\n type: 'event',\n buffered: true,\n durationThreshold: 0,\n });\n};\n"],"names":["observe"],"mappings":";;;;AAwBA,IAAI,wBAAA,GAA2B,CAAA;AAC/B,IAAI,qBAAA,GAAwB,QAAA;AAC5B,IAAI,qBAAA,GAAwB,CAAA;AAE5B,MAAM,cAAA,GAAiB,CAAC,OAAA,KAAsC;AAC5D,EAAA,OAAA,CAAQ,QAAQ,CAAA,CAAA,KAAK;AACnB,IAAA,IAAI,EAAE,aAAA,EAAe;AACnB,MAAA,qBAAA,GAAwB,IAAA,CAAK,GAAA,CAAI,qBAAA,EAAuB,CAAA,CAAE,aAAa,CAAA;AACvE,MAAA,qBAAA,GAAwB,IAAA,CAAK,GAAA,CAAI,qBAAA,EAAuB,CAAA,CAAE,aAAa,CAAA;AAEvE,MAAA,wBAAA,GAA2B,qBAAA,GAAA,CAAyB,qBAAA,GAAwB,qBAAA,IAAyB,CAAA,GAAI,CAAA,GAAI,CAAA;AAAA,IAC/G;AAAA,EACF,CAAC,CAAA;AACH,CAAA;AAEA,IAAI,EAAA;AAMG,MAAM,sBAAsB,MAAc;AAC/C,EAAA,OAAO,EAAA,GAAK,wBAAA,GAA2B,WAAA,CAAY,gBAAA,IAAoB,CAAA;AACzE;AAKO,MAAM,+BAA+B,MAAY;AACtD,EAAA,IAAI,kBAAA,IAAsB,eAAe,EAAA,EAAI;AAE7C,EAAA,EAAA,GAAKA,eAAA,CAAQ,SAAS,cAAA,EAAgB;AAAA,IACpC,IAAA,EAAM,OAAA;AAAA,IACN,QAAA,EAAU,IAAA;AAAA,IACV,iBAAA,EAAmB;AAAA,GACpB,CAAA;AACH;;;;;"}
@@ -1,14 +0,0 @@
1
- Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
2
-
3
- const runOnce = (cb) => {
4
- let called = false;
5
- return () => {
6
- if (!called) {
7
- cb();
8
- called = true;
9
- }
10
- };
11
- };
12
-
13
- exports.runOnce = runOnce;
14
- //# sourceMappingURL=runOnce.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"runOnce.js","sources":["../../../../../src/metrics/web-vitals/lib/runOnce.ts"],"sourcesContent":["/*\n * Copyright 2022 Google LLC\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * https://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nexport const runOnce = (cb: () => void) => {\n let called = false;\n return () => {\n if (!called) {\n cb();\n called = true;\n }\n };\n};\n"],"names":[],"mappings":";;AAgBO,MAAM,OAAA,GAAU,CAAC,EAAA,KAAmB;AACzC,EAAA,IAAI,MAAA,GAAS,KAAA;AACb,EAAA,OAAO,MAAM;AACX,IAAA,IAAI,CAAC,MAAA,EAAQ;AACX,MAAA,EAAA,EAAG;AACH,MAAA,MAAA,GAAS,IAAA;AAAA,IACX;AAAA,EACF,CAAA;AACF;;;;"}
@@ -1,14 +0,0 @@
1
- Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
2
-
3
- const types = require('../../../types.js');
4
-
5
- const whenActivated = (callback) => {
6
- if (types.WINDOW.document?.prerendering) {
7
- addEventListener("prerenderingchange", () => callback(), true);
8
- } else {
9
- callback();
10
- }
11
- };
12
-
13
- exports.whenActivated = whenActivated;
14
- //# sourceMappingURL=whenActivated.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"whenActivated.js","sources":["../../../../../src/metrics/web-vitals/lib/whenActivated.ts"],"sourcesContent":["/*\n * Copyright 2022 Google LLC\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * https://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { WINDOW } from '../../../types';\n\nexport const whenActivated = (callback: () => void) => {\n if (WINDOW.document?.prerendering) {\n addEventListener('prerenderingchange', () => callback(), true);\n } else {\n callback();\n }\n};\n"],"names":["WINDOW"],"mappings":";;;;AAkBO,MAAM,aAAA,GAAgB,CAAC,QAAA,KAAyB;AACrD,EAAA,IAAIA,YAAA,CAAO,UAAU,YAAA,EAAc;AACjC,IAAA,gBAAA,CAAiB,oBAAA,EAAsB,MAAM,QAAA,EAAS,EAAG,IAAI,CAAA;AAAA,EAC/D,CAAA,MAAO;AACL,IAAA,QAAA,EAAS;AAAA,EACX;AACF;;;;"}
@@ -1,22 +0,0 @@
1
- Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
2
-
3
- const types = require('../../../types.js');
4
- const globalListeners = require('./globalListeners.js');
5
- const runOnce = require('./runOnce.js');
6
-
7
- const whenIdleOrHidden = (cb) => {
8
- const rIC = types.WINDOW.requestIdleCallback || types.WINDOW.setTimeout;
9
- if (types.WINDOW.document?.visibilityState === "hidden") {
10
- cb();
11
- } else {
12
- cb = runOnce.runOnce(cb);
13
- globalListeners.addPageListener("visibilitychange", cb, { once: true, capture: true });
14
- rIC(() => {
15
- cb();
16
- globalListeners.removePageListener("visibilitychange", cb, { capture: true });
17
- });
18
- }
19
- };
20
-
21
- exports.whenIdleOrHidden = whenIdleOrHidden;
22
- //# sourceMappingURL=whenIdleOrHidden.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"whenIdleOrHidden.js","sources":["../../../../../src/metrics/web-vitals/lib/whenIdleOrHidden.ts"],"sourcesContent":["/*\n * Copyright 2024 Google LLC\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * https://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { WINDOW } from '../../../types.js';\nimport { addPageListener, removePageListener } from './globalListeners.js';\nimport { runOnce } from './runOnce.js';\n\n/**\n * Runs the passed callback during the next idle period, or immediately\n * if the browser's visibility state is (or becomes) hidden.\n */\nexport const whenIdleOrHidden = (cb: () => void) => {\n const rIC = WINDOW.requestIdleCallback || WINDOW.setTimeout;\n\n // If the document is hidden, run the callback immediately, otherwise\n // race an idle callback with the next `visibilitychange` event.\n if (WINDOW.document?.visibilityState === 'hidden') {\n cb();\n } else {\n // eslint-disable-next-line no-param-reassign\n cb = runOnce(cb);\n addPageListener('visibilitychange', cb, { once: true, capture: true });\n rIC(() => {\n cb();\n // Remove the above event listener since no longer required.\n // See: https://github.com/GoogleChrome/web-vitals/issues/622\n removePageListener('visibilitychange', cb, { capture: true });\n });\n }\n};\n"],"names":["WINDOW","runOnce","addPageListener","removePageListener"],"mappings":";;;;;;AAwBO,MAAM,gBAAA,GAAmB,CAAC,EAAA,KAAmB;AAClD,EAAA,MAAM,GAAA,GAAMA,YAAA,CAAO,mBAAA,IAAuBA,YAAA,CAAO,UAAA;AAIjD,EAAA,IAAIA,YAAA,CAAO,QAAA,EAAU,eAAA,KAAoB,QAAA,EAAU;AACjD,IAAA,EAAA,EAAG;AAAA,EACL,CAAA,MAAO;AAEL,IAAA,EAAA,GAAKC,gBAAQ,EAAE,CAAA;AACf,IAAAC,+BAAA,CAAgB,oBAAoB,EAAA,EAAI,EAAE,MAAM,IAAA,EAAM,OAAA,EAAS,MAAM,CAAA;AACrE,IAAA,GAAA,CAAI,MAAM;AACR,MAAA,EAAA,EAAG;AAGH,MAAAC,kCAAA,CAAmB,kBAAA,EAAoB,EAAA,EAAI,EAAE,OAAA,EAAS,MAAM,CAAA;AAAA,IAC9D,CAAC,CAAA;AAAA,EACH;AACF;;;;"}