@utk09/ui-observability 0.12.0 → 1.0.0

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 (515) hide show
  1. package/CHANGELOG.md +420 -0
  2. package/README.md +72 -839
  3. package/dist/{batch-BjQUwjA6.js → batch-CXmPmTse.js} +4 -4
  4. package/dist/{batch-BjQUwjA6.js.map → batch-CXmPmTse.js.map} +1 -1
  5. package/dist/{batch-D5LlU4Q9.cjs → batch-mmPigCpi.cjs} +2 -2
  6. package/dist/{batch-D5LlU4Q9.cjs.map → batch-mmPigCpi.cjs.map} +1 -1
  7. package/dist/bus/bus.d.cts +331 -0
  8. package/dist/bus/bus.d.ts +60 -10
  9. package/dist/bus/links.d.cts +132 -0
  10. package/dist/bus/links.d.ts +18 -3
  11. package/dist/bus/validation.d.cts +16 -0
  12. package/dist/bus/validation.d.ts +10 -1
  13. package/dist/{bus-ecxUNTja.js → bus-C39wspFV.js} +308 -193
  14. package/dist/bus-C39wspFV.js.map +1 -0
  15. package/dist/bus-_EaOVPGq.cjs +2 -0
  16. package/dist/bus-_EaOVPGq.cjs.map +1 -0
  17. package/dist/capture/console.d.cts +37 -0
  18. package/dist/capture/console.d.ts +1 -1
  19. package/dist/capture/errors.d.cts +32 -0
  20. package/dist/capture/errors.d.ts +1 -1
  21. package/dist/capture/interactions.d.cts +48 -0
  22. package/dist/capture/interactions.d.ts +1 -1
  23. package/dist/capture/lifecycle.d.cts +20 -0
  24. package/dist/capture/lifecycle.d.ts +1 -1
  25. package/dist/capture/long-frames.d.cts +31 -0
  26. package/dist/capture/long-frames.d.ts +1 -1
  27. package/dist/capture/network.d.cts +57 -0
  28. package/dist/capture/network.d.ts +1 -1
  29. package/dist/capture/profiler-frames.d.cts +44 -0
  30. package/dist/capture/profiler-frames.d.ts +1 -1
  31. package/dist/capture/replay-buffer.d.cts +45 -0
  32. package/dist/capture/replay-buffer.d.ts +9 -10
  33. package/dist/capture/replay-upload.d.cts +79 -0
  34. package/dist/capture/replay-upload.d.ts +7 -2
  35. package/dist/capture/replay.d.cts +114 -0
  36. package/dist/capture/replay.d.ts +1 -1
  37. package/dist/capture/reports.d.cts +17 -0
  38. package/dist/capture/reports.d.ts +1 -1
  39. package/dist/capture/resource-timing.d.cts +14 -0
  40. package/dist/capture/resource-timing.d.ts +1 -1
  41. package/dist/capture/server-timing.d.cts +19 -0
  42. package/dist/capture/storm.d.cts +13 -0
  43. package/dist/capture/storm.d.ts +5 -5
  44. package/dist/capture/types.d.cts +128 -0
  45. package/dist/capture/types.d.ts +10 -9
  46. package/dist/capture/unclean-exit.d.cts +31 -0
  47. package/dist/capture/unclean-exit.d.ts +1 -1
  48. package/dist/capture/user-timing.d.cts +22 -0
  49. package/dist/capture/user-timing.d.ts +2 -2
  50. package/dist/capture/web-socket.d.cts +40 -0
  51. package/dist/capture/web-socket.d.ts +3 -3
  52. package/dist/capture/web-vitals.d.cts +40 -0
  53. package/dist/capture/web-vitals.d.ts +1 -1
  54. package/dist/{compression-lD9abCcO.cjs → compression-CvED_Jel.cjs} +2 -2
  55. package/dist/{compression-lD9abCcO.cjs.map → compression-CvED_Jel.cjs.map} +1 -1
  56. package/dist/{compression-AJJCMBOa.js → compression-tVtXwVjX.js} +2 -2
  57. package/dist/{compression-AJJCMBOa.js.map → compression-tVtXwVjX.js.map} +1 -1
  58. package/dist/config-DUs7uHHt.cjs +2 -0
  59. package/dist/config-DUs7uHHt.cjs.map +1 -0
  60. package/dist/config-SgQcCP1_.js +560 -0
  61. package/dist/config-SgQcCP1_.js.map +1 -0
  62. package/dist/console-BGgGnjSi.js +81 -0
  63. package/dist/console-BGgGnjSi.js.map +1 -0
  64. package/dist/console-CSZ5_Vx5.cjs +2 -0
  65. package/dist/console-CSZ5_Vx5.cjs.map +1 -0
  66. package/dist/constants-CUyd9cTZ.js +357 -0
  67. package/dist/constants-CUyd9cTZ.js.map +1 -0
  68. package/dist/constants-CqdJhTxH.cjs +2 -0
  69. package/dist/constants-CqdJhTxH.cjs.map +1 -0
  70. package/dist/constants.d.cts +751 -0
  71. package/dist/constants.d.ts +88 -20
  72. package/dist/core/breadcrumbs.d.cts +54 -0
  73. package/dist/core/breadcrumbs.d.ts +5 -0
  74. package/dist/core/config.d.cts +45 -0
  75. package/dist/core/config.d.ts +30 -2
  76. package/dist/core/context.d.cts +24 -0
  77. package/dist/core/context.d.ts +3 -8
  78. package/dist/core/debug-buffer.d.cts +34 -0
  79. package/dist/core/debug-buffer.d.ts +3 -3
  80. package/dist/core/debug-bundle.d.cts +12 -0
  81. package/dist/core/debug-bundle.d.ts +3 -3
  82. package/dist/core/deferred.d.cts +7 -0
  83. package/dist/core/deferred.d.ts +2 -2
  84. package/dist/core/diagnostics.d.cts +86 -0
  85. package/dist/core/diagnostics.d.ts +1 -1
  86. package/dist/core/drops.d.cts +39 -0
  87. package/dist/core/drops.d.ts +16 -6
  88. package/dist/core/hold-buffer.d.cts +36 -0
  89. package/dist/core/hold-buffer.d.ts +16 -7
  90. package/dist/core/journey.d.cts +148 -0
  91. package/dist/core/journey.d.ts +7 -7
  92. package/dist/core/logger.d.cts +141 -0
  93. package/dist/core/logger.d.ts +23 -30
  94. package/dist/core/measure.d.cts +30 -0
  95. package/dist/core/measure.d.ts +14 -3
  96. package/dist/core/meter.d.cts +78 -0
  97. package/dist/core/meter.d.ts +14 -8
  98. package/dist/core/pipeline.d.cts +227 -0
  99. package/dist/core/pipeline.d.ts +73 -10
  100. package/dist/core/profile-buckets.d.cts +31 -0
  101. package/dist/core/profiler.d.cts +218 -0
  102. package/dist/core/profiler.d.ts +2 -2
  103. package/dist/core/record.d.cts +190 -0
  104. package/dist/core/record.d.ts +44 -12
  105. package/dist/core/remote-rules.d.cts +17 -0
  106. package/dist/core/remote-rules.d.ts +3 -3
  107. package/dist/core/remote-sampling.d.cts +74 -0
  108. package/dist/core/remote-sampling.d.ts +3 -3
  109. package/dist/core/rotation.d.cts +75 -0
  110. package/dist/core/rotation.d.ts +75 -0
  111. package/dist/core/runtime.d.cts +765 -0
  112. package/dist/core/runtime.d.ts +245 -70
  113. package/dist/core/sampling.d.cts +86 -0
  114. package/dist/core/sampling.d.ts +5 -5
  115. package/dist/core/sender.d.cts +161 -0
  116. package/dist/core/sender.d.ts +59 -15
  117. package/dist/core/spans.d.cts +39 -0
  118. package/dist/core/spans.d.ts +1 -1
  119. package/dist/debug-bundle-BXIlwDKM.cjs +2 -0
  120. package/dist/debug-bundle-BXIlwDKM.cjs.map +1 -0
  121. package/dist/debug-bundle-CRpYV_ui.js +35 -0
  122. package/dist/debug-bundle-CRpYV_ui.js.map +1 -0
  123. package/dist/defineProperty-X1c4tIPD.cjs +1 -0
  124. package/dist/defineProperty-s2S8BXUc.js +35 -0
  125. package/dist/doctor.cjs +1 -1
  126. package/dist/doctor.cjs.map +1 -1
  127. package/dist/doctor.d.cts +36 -0
  128. package/dist/doctor.d.ts +5 -2
  129. package/dist/doctor.js +121 -89
  130. package/dist/doctor.js.map +1 -1
  131. package/dist/errors-BE_EZV7Q.js +86 -0
  132. package/dist/errors-BE_EZV7Q.js.map +1 -0
  133. package/dist/errors-CNPbesMs.cjs +3 -0
  134. package/dist/errors-CNPbesMs.cjs.map +1 -0
  135. package/dist/factory-CTi0Is3F.js +404 -0
  136. package/dist/factory-CTi0Is3F.js.map +1 -0
  137. package/dist/factory-hRrH32v5.cjs +2 -0
  138. package/dist/factory-hRrH32v5.cjs.map +1 -0
  139. package/dist/guards-BlYGRK4l.js +10 -0
  140. package/dist/guards-BlYGRK4l.js.map +1 -0
  141. package/dist/guards-EjG3ahFp.cjs +2 -0
  142. package/dist/guards-EjG3ahFp.cjs.map +1 -0
  143. package/dist/{identity-BrQp_5J5.js → identity-DdhKgrpk.js} +20 -24
  144. package/dist/identity-DdhKgrpk.js.map +1 -0
  145. package/dist/identity-DlWRIuwy.cjs +2 -0
  146. package/dist/identity-DlWRIuwy.cjs.map +1 -0
  147. package/dist/index.cjs +1 -1
  148. package/dist/index.cjs.map +1 -1
  149. package/dist/index.d.cts +300 -0
  150. package/dist/index.d.ts +89 -98
  151. package/dist/index.js +1173 -1506
  152. package/dist/index.js.map +1 -1
  153. package/dist/indexeddb-storage-CL9uqBCy.cjs +2 -0
  154. package/dist/indexeddb-storage-CL9uqBCy.cjs.map +1 -0
  155. package/dist/{indexeddb-storage-DLXQzAGh.js → indexeddb-storage-GHdl0t8A.js} +51 -47
  156. package/dist/indexeddb-storage-GHdl0t8A.js.map +1 -0
  157. package/dist/interactions-CUkzK8sR.cjs +2 -0
  158. package/dist/interactions-CUkzK8sR.cjs.map +1 -0
  159. package/dist/{interactions-B6z2I4tU.js → interactions-DiFvCosX.js} +41 -49
  160. package/dist/interactions-DiFvCosX.js.map +1 -0
  161. package/dist/journey-B4Adltjm.cjs +2 -0
  162. package/dist/journey-B4Adltjm.cjs.map +1 -0
  163. package/dist/{journey-35yCMNFo.js → journey-D2_sia57.js} +45 -48
  164. package/dist/journey-D2_sia57.js.map +1 -0
  165. package/dist/{library-console-Dl_Ly6DQ.js → library-console-Btrzt814.js} +2 -2
  166. package/dist/{library-console-Dl_Ly6DQ.js.map → library-console-Btrzt814.js.map} +1 -1
  167. package/dist/{library-console-BFWEuQsl.cjs → library-console-CPW6bvZH.cjs} +2 -2
  168. package/dist/{library-console-BFWEuQsl.cjs.map → library-console-CPW6bvZH.cjs.map} +1 -1
  169. package/dist/{library-request-nI6pvI6I.js → library-request-BJ9PLRaD.js} +2 -2
  170. package/dist/{library-request-nI6pvI6I.js.map → library-request-BJ9PLRaD.js.map} +1 -1
  171. package/dist/{library-request-Da-CHKzT.cjs → library-request-D7OvTxZV.cjs} +2 -2
  172. package/dist/{library-request-Da-CHKzT.cjs.map → library-request-D7OvTxZV.cjs.map} +1 -1
  173. package/dist/{lifecycle-CZ6RRXc6.js → lifecycle-22CUCrc9.js} +21 -29
  174. package/dist/lifecycle-22CUCrc9.js.map +1 -0
  175. package/dist/lifecycle-IaAm1mOC.cjs +2 -0
  176. package/dist/lifecycle-IaAm1mOC.cjs.map +1 -0
  177. package/dist/{log-record-DIA6McNr.js → log-record-BNiLfqtL.js} +8 -7
  178. package/dist/log-record-BNiLfqtL.js.map +1 -0
  179. package/dist/log-record-CkivuiEl.cjs +2 -0
  180. package/dist/log-record-CkivuiEl.cjs.map +1 -0
  181. package/dist/long-frames-BUUbXd-B.cjs +2 -0
  182. package/dist/long-frames-BUUbXd-B.cjs.map +1 -0
  183. package/dist/{long-frames-430_85Da.js → long-frames-DNFaRnC3.js} +18 -22
  184. package/dist/long-frames-DNFaRnC3.js.map +1 -0
  185. package/dist/models/batch.d.cts +57 -0
  186. package/dist/models/batch.d.ts +2 -2
  187. package/dist/models/bus.d.cts +158 -0
  188. package/dist/models/bus.d.ts +22 -2
  189. package/dist/models/config.d.cts +1540 -0
  190. package/dist/models/config.d.ts +360 -259
  191. package/dist/models/drop.d.cts +54 -0
  192. package/dist/models/drop.d.ts +16 -3
  193. package/dist/models/health.d.cts +148 -0
  194. package/dist/models/health.d.ts +108 -12
  195. package/dist/models/log-record.d.cts +61 -0
  196. package/dist/models/metric.d.cts +139 -0
  197. package/dist/models/metric.d.ts +13 -2
  198. package/dist/models/plugin.d.cts +47 -0
  199. package/dist/models/plugin.d.ts +3 -3
  200. package/dist/models/replay.d.cts +60 -0
  201. package/dist/models/serializer.d.cts +23 -0
  202. package/dist/models/serializer.d.ts +1 -1
  203. package/dist/models/storage.d.cts +95 -0
  204. package/dist/models/storage.d.ts +7 -5
  205. package/dist/network-CGMLQ-mA.cjs +2 -0
  206. package/dist/network-CGMLQ-mA.cjs.map +1 -0
  207. package/dist/{network-C7SkLf4v.js → network-on2zZT6H.js} +51 -51
  208. package/dist/network-on2zZT6H.js.map +1 -0
  209. package/dist/{otlp-2MCrC3kd.cjs → otlp-BENHf3g9.cjs} +2 -2
  210. package/dist/{otlp-2MCrC3kd.cjs.map → otlp-BENHf3g9.cjs.map} +1 -1
  211. package/dist/{otlp-COq033e3.js → otlp-DimfrRor.js} +12 -12
  212. package/dist/{otlp-COq033e3.js.map → otlp-DimfrRor.js.map} +1 -1
  213. package/dist/{platform-CVewe4wQ.js → platform-BaaFIPCU.js} +10 -10
  214. package/dist/{platform-CVewe4wQ.js.map → platform-BaaFIPCU.js.map} +1 -1
  215. package/dist/{platform-12uR7kBQ.cjs → platform-CfA3-7sJ.cjs} +2 -2
  216. package/dist/{platform-12uR7kBQ.cjs.map → platform-CfA3-7sJ.cjs.map} +1 -1
  217. package/dist/{profiler-BVWIOgnq.js → profiler-BAZoh7A4.js} +89 -107
  218. package/dist/profiler-BAZoh7A4.js.map +1 -0
  219. package/dist/profiler-D4tJpDRc.cjs +2 -0
  220. package/dist/profiler-D4tJpDRc.cjs.map +1 -0
  221. package/dist/profiler-frames-C4xr7KfH.cjs +2 -0
  222. package/dist/profiler-frames-C4xr7KfH.cjs.map +1 -0
  223. package/dist/{profiler-frames-CLXlT_xL.js → profiler-frames-cJMx9wNM.js} +29 -37
  224. package/dist/profiler-frames-cJMx9wNM.js.map +1 -0
  225. package/dist/remote-rules-Dz9MRAsB.js +95 -0
  226. package/dist/remote-rules-Dz9MRAsB.js.map +1 -0
  227. package/dist/remote-rules-_tY0zj5o.cjs +2 -0
  228. package/dist/remote-rules-_tY0zj5o.cjs.map +1 -0
  229. package/dist/replay-B3gFXIZd.cjs +2 -0
  230. package/dist/replay-B3gFXIZd.cjs.map +1 -0
  231. package/dist/replay-Ds-ANH34.js +310 -0
  232. package/dist/replay-Ds-ANH34.js.map +1 -0
  233. package/dist/reports-BDSe4dFH.cjs +2 -0
  234. package/dist/reports-BDSe4dFH.cjs.map +1 -0
  235. package/dist/{reports-BuXekPOS.js → reports-C-thq-bk.js} +25 -30
  236. package/dist/reports-C-thq-bk.js.map +1 -0
  237. package/dist/resource-timing-C576gFIQ.cjs +2 -0
  238. package/dist/resource-timing-C576gFIQ.cjs.map +1 -0
  239. package/dist/{resource-timing-CXGHwFRD.js → resource-timing-eUl2dNgC.js} +20 -23
  240. package/dist/resource-timing-eUl2dNgC.js.map +1 -0
  241. package/dist/response-body-YdNl-HkR.cjs +3 -0
  242. package/dist/response-body-YdNl-HkR.cjs.map +1 -0
  243. package/dist/response-body-eoSQpLiH.js +331 -0
  244. package/dist/response-body-eoSQpLiH.js.map +1 -0
  245. package/dist/rotation-Cwct4ckk.js +94 -0
  246. package/dist/rotation-Cwct4ckk.js.map +1 -0
  247. package/dist/rotation-D4qUAHAu.cjs +2 -0
  248. package/dist/rotation-D4qUAHAu.cjs.map +1 -0
  249. package/dist/sampling-BlrI8jor.js +63 -0
  250. package/dist/sampling-BlrI8jor.js.map +1 -0
  251. package/dist/sampling-mXt4dstx.cjs +2 -0
  252. package/dist/sampling-mXt4dstx.cjs.map +1 -0
  253. package/dist/{sanitize-CNmsD9r3.js → sanitize-Ba0KqU06.js} +2 -2
  254. package/dist/sanitize-Ba0KqU06.js.map +1 -0
  255. package/dist/{sanitize-ChLn97Ch.cjs → sanitize-DQyiI_KY.cjs} +2 -2
  256. package/dist/sanitize-DQyiI_KY.cjs.map +1 -0
  257. package/dist/sender-BdRuNVhF.cjs +2 -0
  258. package/dist/sender-BdRuNVhF.cjs.map +1 -0
  259. package/dist/sender-Dv8rAmpV.js +979 -0
  260. package/dist/sender-Dv8rAmpV.js.map +1 -0
  261. package/dist/storage/context-storage.d.cts +90 -0
  262. package/dist/storage/context-storage.d.ts +5 -5
  263. package/dist/storage/emergency-queue.d.cts +27 -0
  264. package/dist/storage/emergency-queue.d.ts +4 -4
  265. package/dist/storage/eviction.d.cts +40 -0
  266. package/dist/storage/eviction.d.ts +1 -1
  267. package/dist/storage/factory.d.cts +21 -0
  268. package/dist/storage/factory.d.ts +3 -3
  269. package/dist/storage/gap.d.cts +20 -0
  270. package/dist/storage/gap.d.ts +3 -3
  271. package/dist/storage/idb-driver.d.cts +93 -0
  272. package/dist/storage/idb-driver.d.ts +1 -1
  273. package/dist/storage/indexeddb-storage.d.cts +97 -0
  274. package/dist/storage/indexeddb-storage.d.ts +12 -4
  275. package/dist/storage/keys.d.cts +17 -0
  276. package/dist/storage/keys.d.ts +2 -2
  277. package/dist/storage/local-storage.d.cts +139 -0
  278. package/dist/storage/local-storage.d.ts +11 -4
  279. package/dist/storage/memory-storage.d.cts +73 -0
  280. package/dist/storage/memory-storage.d.ts +4 -3
  281. package/dist/storage/persistence.d.cts +8 -0
  282. package/dist/storage/persistence.d.ts +2 -2
  283. package/dist/storage/stored-context.d.cts +34 -0
  284. package/dist/storage/stored-context.d.ts +34 -0
  285. package/dist/stored-context-B2EzVuYm.js +51 -0
  286. package/dist/stored-context-B2EzVuYm.js.map +1 -0
  287. package/dist/stored-context-CXt7eHZL.cjs +2 -0
  288. package/dist/stored-context-CXt7eHZL.cjs.map +1 -0
  289. package/dist/storm-C-zYSdDX.cjs +2 -0
  290. package/dist/storm-C-zYSdDX.cjs.map +1 -0
  291. package/dist/storm-DjKetLKZ.js +9 -0
  292. package/dist/storm-DjKetLKZ.js.map +1 -0
  293. package/dist/transport/compression.d.cts +7 -0
  294. package/dist/transport/custom-transport.d.cts +22 -0
  295. package/dist/transport/custom-transport.d.ts +6 -5
  296. package/dist/transport/errors.d.cts +31 -0
  297. package/dist/transport/exit-flush.d.cts +135 -0
  298. package/dist/transport/exit-flush.d.ts +30 -13
  299. package/dist/transport/headers.d.cts +8 -0
  300. package/dist/transport/headers.d.ts +2 -2
  301. package/dist/transport/http-transport.d.cts +116 -0
  302. package/dist/transport/http-transport.d.ts +20 -8
  303. package/dist/transport/memory-transport.d.cts +30 -0
  304. package/dist/transport/memory-transport.d.ts +2 -2
  305. package/dist/transport/response-body.d.cts +49 -0
  306. package/dist/transport/response-body.d.ts +49 -0
  307. package/dist/transport/retry-engine.d.cts +129 -0
  308. package/dist/transport/retry-engine.d.ts +27 -9
  309. package/dist/transport/serializers/ecs.d.cts +3 -0
  310. package/dist/transport/serializers/ecs.d.ts +1 -1
  311. package/dist/transport/serializers/otlp-metrics.d.cts +3 -0
  312. package/dist/transport/serializers/otlp-metrics.d.ts +1 -1
  313. package/dist/transport/serializers/otlp-traces.d.cts +3 -0
  314. package/dist/transport/serializers/otlp-traces.d.ts +1 -1
  315. package/dist/transport/serializers/otlp.d.cts +47 -0
  316. package/dist/transport/serializers/otlp.d.ts +2 -2
  317. package/dist/transport/serializers/select.d.cts +38 -0
  318. package/dist/transport/serializers/select.d.ts +5 -5
  319. package/dist/transport/status-transport.d.cts +129 -0
  320. package/dist/transport/status-transport.d.ts +25 -8
  321. package/dist/transport/worker-client.d.cts +23 -0
  322. package/dist/transport/worker-client.d.ts +12 -3
  323. package/dist/transport/worker-entry.d.cts +5 -0
  324. package/dist/transport/worker-entry.d.ts +1 -1
  325. package/dist/transport/worker-protocol.d.cts +38 -0
  326. package/dist/transport/worker-protocol.d.ts +4 -2
  327. package/dist/transport/worker-server.d.cts +3 -0
  328. package/dist/transport/worker-server.d.ts +1 -1
  329. package/dist/transport/worker-transport.d.cts +10 -0
  330. package/dist/transport/worker-transport.d.ts +5 -4
  331. package/dist/types-BAerHgCq.js.map +1 -1
  332. package/dist/types-C7WNpnG1.cjs.map +1 -1
  333. package/dist/{unclean-exit-Cob_jyTv.js → unclean-exit-DQD1cT7c.js} +23 -30
  334. package/dist/unclean-exit-DQD1cT7c.js.map +1 -0
  335. package/dist/unclean-exit-py99ApzT.cjs +2 -0
  336. package/dist/unclean-exit-py99ApzT.cjs.map +1 -0
  337. package/dist/{user-timing-DgHubxCI.js → user-timing-BePqb1uN.js} +15 -17
  338. package/dist/user-timing-BePqb1uN.js.map +1 -0
  339. package/dist/user-timing-D6XTmpuM.cjs +2 -0
  340. package/dist/user-timing-D6XTmpuM.cjs.map +1 -0
  341. package/dist/utils/console.d.cts +36 -0
  342. package/dist/utils/console.d.ts +4 -4
  343. package/dist/utils/deadline.d.cts +14 -0
  344. package/dist/utils/error-like.d.cts +25 -0
  345. package/dist/utils/fixed-window.d.cts +25 -0
  346. package/dist/utils/global-scope.d.cts +20 -0
  347. package/dist/utils/guards.d.cts +14 -0
  348. package/dist/utils/guards.d.ts +8 -0
  349. package/dist/utils/identity.d.cts +109 -0
  350. package/dist/utils/identity.d.ts +3 -4
  351. package/dist/utils/library-console.d.cts +11 -0
  352. package/dist/utils/library-request.d.cts +24 -0
  353. package/dist/utils/lock.d.cts +24 -0
  354. package/dist/utils/lock.d.ts +1 -1
  355. package/dist/utils/openfin.d.cts +48 -0
  356. package/dist/utils/patch.d.cts +9 -0
  357. package/dist/utils/platform.d.cts +62 -0
  358. package/dist/utils/platform.d.ts +2 -2
  359. package/dist/utils/sanitize.d.cts +52 -0
  360. package/dist/utils/sanitize.d.ts +1 -1
  361. package/dist/utils/sequence.d.cts +10 -0
  362. package/dist/utils/tracing.d.cts +158 -0
  363. package/dist/utils/tracing.d.ts +11 -4
  364. package/dist/utils/unref.d.cts +9 -0
  365. package/dist/web-socket-CoIUBM3C.cjs +2 -0
  366. package/dist/{web-socket-DthJuSAg.js.map → web-socket-CoIUBM3C.cjs.map} +1 -1
  367. package/dist/{web-socket-DthJuSAg.js → web-socket-DSHgDiZ6.js} +23 -28
  368. package/dist/web-socket-DSHgDiZ6.js.map +1 -0
  369. package/dist/{web-vitals-CsGCWnUr.js → web-vitals-4pWACwaR.js} +15 -21
  370. package/dist/web-vitals-4pWACwaR.js.map +1 -0
  371. package/dist/web-vitals-__X7t4pj.cjs +2 -0
  372. package/dist/web-vitals-__X7t4pj.cjs.map +1 -0
  373. package/dist/worker-protocol-QbvqNazn.cjs +2 -0
  374. package/dist/worker-protocol-QbvqNazn.cjs.map +1 -0
  375. package/dist/{worker-protocol-B0_8rWy5.js → worker-protocol-x074Rpet.js} +14 -11
  376. package/dist/worker-protocol-x074Rpet.js.map +1 -0
  377. package/dist/worker-server-CFe4nvos.cjs +2 -0
  378. package/dist/worker-server-CFe4nvos.cjs.map +1 -0
  379. package/dist/worker-server-iUVSjH8L.js +94 -0
  380. package/dist/worker-server-iUVSjH8L.js.map +1 -0
  381. package/dist/worker-transport-CRAX-09c.cjs +2 -0
  382. package/dist/worker-transport-CRAX-09c.cjs.map +1 -0
  383. package/dist/worker-transport-Dy1KMA7t.js +190 -0
  384. package/dist/worker-transport-Dy1KMA7t.js.map +1 -0
  385. package/llms.txt +397 -0
  386. package/package.json +54 -46
  387. package/dist/bus-D_7pd7RN.cjs +0 -2
  388. package/dist/bus-D_7pd7RN.cjs.map +0 -1
  389. package/dist/bus-ecxUNTja.js.map +0 -1
  390. package/dist/console-CLz_PvFn.cjs +0 -2
  391. package/dist/console-CLz_PvFn.cjs.map +0 -1
  392. package/dist/console-cwgHKXvM.js +0 -82
  393. package/dist/console-cwgHKXvM.js.map +0 -1
  394. package/dist/constants-Bwl_YtQi.js +0 -349
  395. package/dist/constants-Bwl_YtQi.js.map +0 -1
  396. package/dist/constants-DakMxVB2.cjs +0 -2
  397. package/dist/constants-DakMxVB2.cjs.map +0 -1
  398. package/dist/context-storage-BjzeBSxH.cjs +0 -2
  399. package/dist/context-storage-BjzeBSxH.cjs.map +0 -1
  400. package/dist/context-storage-BzkoHzkQ.js +0 -51
  401. package/dist/context-storage-BzkoHzkQ.js.map +0 -1
  402. package/dist/debug-bundle-BOdYmCeV.js +0 -32
  403. package/dist/debug-bundle-BOdYmCeV.js.map +0 -1
  404. package/dist/debug-bundle-Ex4L_LSP.cjs +0 -2
  405. package/dist/debug-bundle-Ex4L_LSP.cjs.map +0 -1
  406. package/dist/emergency-queue-B9WZxanZ.js +0 -67
  407. package/dist/emergency-queue-B9WZxanZ.js.map +0 -1
  408. package/dist/emergency-queue-HBpL5r3V.cjs +0 -2
  409. package/dist/emergency-queue-HBpL5r3V.cjs.map +0 -1
  410. package/dist/errors-D6bwgJtO.js +0 -92
  411. package/dist/errors-D6bwgJtO.js.map +0 -1
  412. package/dist/errors-DCOCRdSi.cjs +0 -3
  413. package/dist/errors-DCOCRdSi.cjs.map +0 -1
  414. package/dist/factory-DLFDjdLv.cjs +0 -2
  415. package/dist/factory-DLFDjdLv.cjs.map +0 -1
  416. package/dist/factory-e9Qo3K0z.js +0 -276
  417. package/dist/factory-e9Qo3K0z.js.map +0 -1
  418. package/dist/guards-Cidk71ME.js +0 -7
  419. package/dist/guards-Cidk71ME.js.map +0 -1
  420. package/dist/guards-nJ70syPt.cjs +0 -2
  421. package/dist/guards-nJ70syPt.cjs.map +0 -1
  422. package/dist/identity-BlvlgjrU.cjs +0 -2
  423. package/dist/identity-BlvlgjrU.cjs.map +0 -1
  424. package/dist/identity-BrQp_5J5.js.map +0 -1
  425. package/dist/indexeddb-storage-CtLvZH1r.cjs +0 -2
  426. package/dist/indexeddb-storage-CtLvZH1r.cjs.map +0 -1
  427. package/dist/indexeddb-storage-DLXQzAGh.js.map +0 -1
  428. package/dist/interactions-B6z2I4tU.js.map +0 -1
  429. package/dist/interactions-P6pz08Jn.cjs +0 -2
  430. package/dist/interactions-P6pz08Jn.cjs.map +0 -1
  431. package/dist/journey-35yCMNFo.js.map +0 -1
  432. package/dist/journey-DAGh5h9k.cjs +0 -2
  433. package/dist/journey-DAGh5h9k.cjs.map +0 -1
  434. package/dist/keys-BHhw_0Wh.cjs +0 -2
  435. package/dist/keys-BHhw_0Wh.cjs.map +0 -1
  436. package/dist/keys-BU9j5YqW.js +0 -16
  437. package/dist/keys-BU9j5YqW.js.map +0 -1
  438. package/dist/lifecycle-BGGOcN4N.cjs +0 -2
  439. package/dist/lifecycle-BGGOcN4N.cjs.map +0 -1
  440. package/dist/lifecycle-CZ6RRXc6.js.map +0 -1
  441. package/dist/log-record-D7bA1RPb.cjs +0 -2
  442. package/dist/log-record-D7bA1RPb.cjs.map +0 -1
  443. package/dist/log-record-DIA6McNr.js.map +0 -1
  444. package/dist/long-frames-430_85Da.js.map +0 -1
  445. package/dist/long-frames-Dd8tsi2U.cjs +0 -2
  446. package/dist/long-frames-Dd8tsi2U.cjs.map +0 -1
  447. package/dist/models/stats.d.ts +0 -11
  448. package/dist/network-C7SkLf4v.js.map +0 -1
  449. package/dist/network-pEX3PAJv.cjs +0 -2
  450. package/dist/network-pEX3PAJv.cjs.map +0 -1
  451. package/dist/profiler-BVWIOgnq.js.map +0 -1
  452. package/dist/profiler-eVCknCzS.cjs +0 -2
  453. package/dist/profiler-eVCknCzS.cjs.map +0 -1
  454. package/dist/profiler-frames-CLXlT_xL.js.map +0 -1
  455. package/dist/profiler-frames-Dg2OebB2.cjs +0 -2
  456. package/dist/profiler-frames-Dg2OebB2.cjs.map +0 -1
  457. package/dist/remote-rules-BJGDJGwA.js +0 -98
  458. package/dist/remote-rules-BJGDJGwA.js.map +0 -1
  459. package/dist/remote-rules-CJD3ToVk.cjs +0 -2
  460. package/dist/remote-rules-CJD3ToVk.cjs.map +0 -1
  461. package/dist/replay-0zAJv9T3.js +0 -338
  462. package/dist/replay-0zAJv9T3.js.map +0 -1
  463. package/dist/replay-DomJpXqW.cjs +0 -2
  464. package/dist/replay-DomJpXqW.cjs.map +0 -1
  465. package/dist/reports-BsbqmP8h.cjs +0 -2
  466. package/dist/reports-BsbqmP8h.cjs.map +0 -1
  467. package/dist/reports-BuXekPOS.js.map +0 -1
  468. package/dist/resource-timing-CXGHwFRD.js.map +0 -1
  469. package/dist/resource-timing-DkycFGDa.cjs +0 -2
  470. package/dist/resource-timing-DkycFGDa.cjs.map +0 -1
  471. package/dist/sampling-Dd0wllyq.cjs +0 -2
  472. package/dist/sampling-Dd0wllyq.cjs.map +0 -1
  473. package/dist/sampling-UUDbi3K0.js +0 -60
  474. package/dist/sampling-UUDbi3K0.js.map +0 -1
  475. package/dist/sanitize-CNmsD9r3.js.map +0 -1
  476. package/dist/sanitize-ChLn97Ch.cjs.map +0 -1
  477. package/dist/select-CTk-K5mG.cjs +0 -3
  478. package/dist/select-CTk-K5mG.cjs.map +0 -1
  479. package/dist/select-DPv_j6wq.js +0 -270
  480. package/dist/select-DPv_j6wq.js.map +0 -1
  481. package/dist/sender-15zEsZpr.js +0 -857
  482. package/dist/sender-15zEsZpr.js.map +0 -1
  483. package/dist/sender-Bfpv9tad.cjs +0 -2
  484. package/dist/sender-Bfpv9tad.cjs.map +0 -1
  485. package/dist/storage-BA9RqRO-.cjs +0 -2
  486. package/dist/storage-BA9RqRO-.cjs.map +0 -1
  487. package/dist/storage-DZwed89z.js +0 -16
  488. package/dist/storage-DZwed89z.js.map +0 -1
  489. package/dist/storm-BTSNTIWI.js +0 -9
  490. package/dist/storm-BTSNTIWI.js.map +0 -1
  491. package/dist/storm-D0_qZOEg.cjs +0 -2
  492. package/dist/storm-D0_qZOEg.cjs.map +0 -1
  493. package/dist/unclean-exit-ClGzrc2A.cjs +0 -2
  494. package/dist/unclean-exit-ClGzrc2A.cjs.map +0 -1
  495. package/dist/unclean-exit-Cob_jyTv.js.map +0 -1
  496. package/dist/user-timing-CdYqx3PF.cjs +0 -2
  497. package/dist/user-timing-CdYqx3PF.cjs.map +0 -1
  498. package/dist/user-timing-DgHubxCI.js.map +0 -1
  499. package/dist/utils/timer.d.ts +0 -19
  500. package/dist/web-socket-BTuvYoJI.cjs +0 -2
  501. package/dist/web-socket-BTuvYoJI.cjs.map +0 -1
  502. package/dist/web-vitals-Ch5BpDmo.cjs +0 -2
  503. package/dist/web-vitals-Ch5BpDmo.cjs.map +0 -1
  504. package/dist/web-vitals-CsGCWnUr.js.map +0 -1
  505. package/dist/worker-protocol-B0_8rWy5.js.map +0 -1
  506. package/dist/worker-protocol-BjzFORfq.cjs +0 -2
  507. package/dist/worker-protocol-BjzFORfq.cjs.map +0 -1
  508. package/dist/worker-server-4en-Lt-3.cjs +0 -2
  509. package/dist/worker-server-4en-Lt-3.cjs.map +0 -1
  510. package/dist/worker-server-Cne9MX9I.js +0 -83
  511. package/dist/worker-server-Cne9MX9I.js.map +0 -1
  512. package/dist/worker-transport-B-GF4Aqn.cjs +0 -2
  513. package/dist/worker-transport-B-GF4Aqn.cjs.map +0 -1
  514. package/dist/worker-transport-C3SjJAEC.js +0 -200
  515. package/dist/worker-transport-C3SjJAEC.js.map +0 -1
package/dist/index.cjs CHANGED
@@ -1,2 +1,2 @@
1
- Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require("./constants-DakMxVB2.cjs"),t=require("./log-record-D7bA1RPb.cjs"),n=require("./error-like-gGRx2s36.cjs"),r=require("./guards-nJ70syPt.cjs"),i=require("./unref-CU9Nyz_9.cjs"),a=require("./platform-12uR7kBQ.cjs"),o=require("./profiler-eVCknCzS.cjs"),s=require("./library-console-BFWEuQsl.cjs"),c=require("./sanitize-ChLn97Ch.cjs"),l=require("./identity-BlvlgjrU.cjs"),u=require("./library-request-Da-CHKzT.cjs"),d=require("./batch-D5LlU4Q9.cjs"),f=require("./journey-DAGh5h9k.cjs"),p=require("./sampling-Dd0wllyq.cjs");function m(t){return Math.round((performance.now()-t)*e.X)/e.X}function h(e,t,n,r,i){e.logMetric(`${t}.duration`,n,`ms`,`histogram`,{status:r,...i})}function g(e,t,n,r,i){let a=m(n);e.error(`${t} failed`,r,{"action.duration_ms":a,status:`FAILURE`,...i}),h(e,t,a,`FAILURE`,i)}function _(e,t,n,r){let i=performance.now();try{let a=n();return h(e,t,m(i),`SUCCESS`,r),a}catch(n){throw g(e,t,i,n,r),n}}async function ee(e,t,n,r){let i=performance.now();try{let a=await n();return h(e,t,m(i),`SUCCESS`,r),a}catch(n){throw g(e,t,i,n,r),n}}var v=new WeakMap;function y(e){let t=e.idle;t!==void 0&&(e.diagnostics.guard(`pipeline.crashed`,`The idle callback could not be cancelled.`,()=>{cancelIdleCallback(t)}),e.idle=void 0),clearTimeout(e.timer),e.timer=void 0}function b(t,n){typeof requestIdleCallback==`function`&&typeof cancelIdleCallback==`function`&&(n.idle=n.diagnostics.guard(`pipeline.crashed`,`The idle callback could not be scheduled.`,()=>requestIdleCallback(e=>{x(t,n,e)},{timeout:e.G})),n.idle!==void 0)||(n.timer=setTimeout(()=>{x(t,n)},0),i.t(n.timer))}function x(e,t,n){if(v.get(e)!==t||t.draining)return;y(t),t.draining=!0;let r=t.work;t.work=[];let i=0;for(;i<r.length&&(!n||n.didTimeout&&i===0||n.timeRemaining()>0);)if(t.diagnostics.guard(`pipeline.crashed`,`The library could not build a deferred record.`,r[i]),i++,v.get(e)!==t)return;t.work=[...r.slice(i),...t.work],t.draining=!1,t.work.length>0?b(e,t):v.delete(e)}function S(t,n,r,i){let a=v.get(t),o=i>0?Math.min(i,e.K):e.K;if(a&&a.work.length>=o&&!a.draining&&(x(t,a),a=v.get(t)),a){if(a.work.length>=o){r.count(`record.dropped_by_ceiling`);return}a.work.push(n)}else a={work:[n],diagnostics:r,draining:!1},v.set(t,a),b(t,a)}function C(e){let t=v.get(e);t&&x(e,t)}function te(e){let t=v.get(e);if(t){y(t),v.delete(e);for(let e of t.work)t.diagnostics.count(`record.dropped_by_ceiling`);t.work=[]}}var ne=[e.N,e.In,e.q];function re(e,t){let r=t.guard(`record.sanitize_failed`,`The library could not read the error reason.`,()=>{if(!(e instanceof Error)&&!n.r(e))return;let t=Error(e.message);return t.name=e.name,t.stack=e.stack,t});if(r)return r;let i=t.guard(`record.sanitize_failed`,`The library could not convert the error reason to text.`,()=>String(e));return Error(i??typeof e)}function ie(e,t,n){return n.guard(`record.sanitize_failed`,`The library could not read the error reason.`,()=>e instanceof Error?e:t)??t}function ae(e,t){if(typeof e==`number`||typeof e==`boolean`||typeof e==`bigint`||typeof e==`symbol`)return e;if(typeof e==`object`&&e)return t.guard(`record.sanitize_failed`,`The library could not read the properties of the error reason.`,()=>{let t=e,r=n.r(e),i={},a=0;for(let e of Object.keys(t)){let o=t[e];r&&n.t.has(e)||!n.n(o)||(i[e]=o,a++)}return a===0?void 0:i})}function oe(e){if(!r.t(e)||e instanceof Error)return!1;let t=Object.getPrototypeOf(e);return t===null||Object.getPrototypeOf(t)===null}function se(e){return ne.some(t=>e===t||e.startsWith(`${t}.`))?`system`:`log`}function w(e,t){return e===void 0?{}:t.guard(`record.sanitize_failed`,`The library could not read the payload.`,()=>({...e}))??{"uiobs.sanitize_failed":!0}}var T=class n{bind;namespace;options;levelType;constructor(e,t,n={}){this.bind=e,this.namespace=t,this.options=n,this.levelType=se(t)}child(e,t={}){return new n(this.bind,`${this.namespace}.${e}`,{scopedContext:{...this.options.scopedContext,...t.scopedContext}})}trace=(e,t)=>{this.write(`TRACE`,this.levelType,e,t)};debug=(e,t)=>{this.write(`DEBUG`,this.levelType,e,t)};info=(e,t)=>{this.write(`INFO`,this.levelType,e,t)};warn=(e,t)=>{this.write(`WARN`,this.levelType,e,t)};error=(e,t,n)=>{this.writeError(`ERROR`,e,t,n)};fatal=(e,t,n)=>{this.writeError(`FATAL`,e,t,n)};logAction=(e,t)=>{this.write(`INFO`,`action`,e,t)};logEvent=(e,t)=>{this.write(`INFO`,`event`,e,t)};logMetric=(t,n,r=e.W,i=`gauge`,a)=>{if(!Number.isFinite(n)){this.bind().diagnostics.report(`record.dropped_malformed`,`The metric value is not a finite number. The library dropped the metric.`,{"metric.name":t});return}let o=this.bind();this.submit(o,`INFO`,`metric`,s=>{let c=w(a,o.diagnostics),l={...c,"metric.name":t,"metric.value":n,"metric.unit":r,"metric.type":i,[e.Pt.attributeKeys]:Object.keys(c)};this.writeNow(o,`INFO`,`metric`,t,l,!0,s)})};timeSync=(e,t,n)=>_(this,e,t,n);timeAsync=(e,t,n)=>ee(this,e,t,n);write(e,t,n,r){let i=this.bind();this.submit(i,e,t,a=>{this.writeNow(i,e,t,n,r,!1,a)})}submit(e,n,r,i){if(!e.isDestroyed()){if(e.isRotating())e.diagnostics.count(`record.dropped_during_rotation`);else if(e.config.payloadMode===`defer`&&e.config.enabled&&!e.config.debugBuffer.enabled&&this.namespace!==`uiobs.diagnostics`){if(!e.builder.isEnabled(n,this.namespace,r)&&!this.mirrors(e,n))return;let o=e.journey.current(),s={timeUnixNano:t.r(),trace:e.tracing.resolve(),journey:o?{...o}:null,context:e.context.getAll(),url:a.t(e.diagnostics)};S(e,()=>{i(s)},e.diagnostics,e.config.buffering.maxPendingRecords)}else i()}}writeNow(e,t,n,r,i,a,o){if(!(e.config.enabled&&e.config.debugBuffer.enabled)&&!e.builder.isEnabled(t,this.namespace,n)){this.mirrors(e,t)&&this.print(e,t,r,i,void 0,null,void 0,o);return}let s={snapshot:o,level:t,type:n,body:r,namespace:this.namespace,scoped:this.options.scopedContext,payload:a?i:w(i,e.diagnostics)},{record:c,dropped:l}=e.builder.build(s),u=!!e.config.redact||e.config.processors.length>0,d=n!==`metric`&&e.config.capturePolicy.breadcrumbs>0,f=l===`sampling`&&u&&d?e.builder.build(s,!0):void 0,p=c??f?.record??null,m=p?p.body:l===`sampling`&&!u?r:void 0;d&&m!==void 0&&e.breadcrumbs.push({t:o?Number(o.timeUnixNano.slice(0,-6)):Date.now(),category:n===`action`?`action`:n===`event`?`event`:`log`,message:m}),this.print(e,t,r,i,void 0,p,f?.dropped??l,o),e.emit(c)}writeError(e,t,n,r){let i=this.bind();this.submit(i,e,this.levelType,a=>{this.writeErrorNow(i,e,t,n,r,a)})}writeErrorNow(t,n,r,i,a,o){let s=t.builder.isEnabled(n,this.namespace);if(!s&&!this.mirrors(t,n))return;let c=a===void 0&&(t.diagnostics.guard(`record.sanitize_failed`,`The library could not read the error slot.`,()=>oe(i))??!1),l=c?i:a,u=c?void 0:i,d=u===void 0?void 0:re(u,t.diagnostics),f=d===void 0?void 0:ie(u,d,t.diagnostics);if(!s){this.print(t,n,r,l,f,null,void 0,o);return}let p=d?ae(u,t.diagnostics):void 0,{record:m,dropped:h}=t.builder.build({snapshot:o,level:n,type:this.levelType,body:r,namespace:this.namespace,scoped:this.options.scopedContext,payload:{...w(l,t.diagnostics),...d?{"error.type":d.name,"error.message":d.message,"error.stack_trace":d.stack}:{},...p===void 0?{}:{[e.d]:p},[e.c]:t.breadcrumbs.snapshot()}});this.print(t,n,r,l,f,m,h,o),t.emit(m)}print(e,t,n,r,i,a,o,s){if(!e.config.redact&&e.config.processors.length===0){e.console.write(this.namespace,t,n,r,i);return}if(a){e.console.write(this.namespace,t,a.body,a.attributes);return}if(o===`processor`||o===`redact`||o===`malformed`||!e.config.enabled||!e.console.accepts(t))return;let c=e.builder.build({snapshot:s,level:t,type:this.levelType,body:n,namespace:this.namespace,scoped:this.options.scopedContext,payload:{...w(r,e.diagnostics),...i?{"error.type":i.name,"error.message":i.message,"error.stack_trace":i.stack}:{}}},!0).record;c&&e.console.write(this.namespace,t,c.body,c.attributes)}mirrors(e,t){return e.config.enabled&&e.console.accepts(t)}},ce=`overflow`,le=new Set([e.g,e.h,e.a,e.v,e.f,e.p,e.m]);function ue(e={}){let t={};for(let n of Object.keys(e).sort()){if(n.startsWith(`metric.`)||le.has(n))continue;let r=e[n];(typeof r==`string`||typeof r==`boolean`||typeof r==`number`&&Number.isFinite(r))&&(t[n]=r)}return t}function de(e,t){if(!Array.isArray(e))return null;let n=t===0?e.length:Math.min(e.length,t+1);return Array.from({length:n},(t,n)=>e[n])}function fe(e,t){return Array.isArray(e)&&(t===0||e.length<=t)&&e.every((t,n)=>typeof t==`number`&&Number.isFinite(t)&&(n===0||t>e[n-1]))}function pe(t,n,r){let i={"metric.name":t.name,"metric.unit":t.unit,"metric.type":t.kind,[e.Pt.start]:r,[e.Pt.attributeKeys]:Object.keys(n.attributes)};return t.kind===`counter`?(i[`metric.value`]=n.sum,i):{...i,[e.Pt.count]:n.count,[e.Pt.sum]:n.sum,[e.Pt.min]:n.min,[e.Pt.max]:n.max,[e.Pt.bounds]:t.boundaries,[e.Pt.buckets]:n.buckets}}function me(e,t){try{return{unit:e.unit,boundaries:e.boundaries}}catch(e){return t(e),{unit:void 0,boundaries:void 0}}}function he(e,t,n,r){let i={name:e,kind:`counter`,unit:me(t,r).unit??`count`,boundaries:[]};return{add:(e,t)=>{n(i,e,t)}}}function ge(t,n,r,i){let{unit:a,boundaries:o}=me(n,i),s={name:t,kind:`histogram`,unit:a??`count`,boundaries:o??e.Nt};return{record:(e,t)=>{r(s,e,t)}}}var _e=class{intervalMs;emit;diagnostics;policy;instruments=new Map;timer=null;startedAt=0;constructor(e,t,n,r={maxSeries:100,maxInstruments:1e3,maxHistogramBoundaries:50}){this.intervalMs=e,this.emit=t,this.diagnostics=n,this.policy=r}record(e,t,n){!Number.isFinite(t)||e.kind===`counter`&&t<0?this.diagnostics.report(`record.dropped_malformed`,`The value of the metric ${e.name} is not valid. The library dropped it.`,{"metric.name":e.name}):this.diagnostics.guard(`record.sanitize_failed`,`The library could not read the attributes of the metric ${e.name}.`,()=>{let r=this.instrumentOf(e);r&&(this.add(r,t,ue(n)),this.arm())})}collect(){this.timer!==null&&(clearTimeout(this.timer),this.timer=null);let e=`${String(this.startedAt)}000000`,t=[...this.instruments.values()];this.instruments.clear();for(let{def:n,series:r}of t)for(let t of r.values())this.emit(n.name,t.attributes,pe(n,t,e))}instrumentOf(t){let n=this.instruments.get(t.name);if(n)return n.def.kind===t.kind?n:(this.diagnostics.report(`record.dropped_malformed`,`The metric ${t.name} is a counter and a histogram. The library dropped the value.`,{"metric.name":t.name}),null);if(this.policy.maxInstruments&&this.instruments.size>=this.policy.maxInstruments)return this.diagnostics.count(`record.dropped_by_ceiling`),null;let r=de(t.boundaries,this.policy.maxHistogramBoundaries),i=fe(r,this.policy.maxHistogramBoundaries);t.kind===`histogram`&&!i&&this.diagnostics.report(`config.invalid`,`The boundaries of the metric ${t.name} must meet metrics.maxHistogramBoundaries and contain finite numbers in ascending order. The library uses the default boundaries.`);let a={def:{...t,boundaries:i?r:[...e.Nt]},series:new Map};return this.instruments.set(t.name,a),a}add(t,n,r){let i=JSON.stringify(r),a=t.series.get(i),o=r;if(!a&&this.policy.maxSeries>0&&t.series.size>=this.policy.maxSeries&&(i=ce,a=t.series.get(i),o={[e._]:!0}),!a){let e=t.def.kind===`histogram`?t.def.boundaries.length+1:0,r=Array(e).fill(0);a={attributes:o,count:0,sum:0,min:n,max:n,buckets:r},t.series.set(i,a)}if(a.count+=1,a.sum+=n,a.min=Math.min(a.min,n),a.max=Math.max(a.max,n),a.buckets.length>0){let e=t.def.boundaries.findIndex(e=>n<=e);a.buckets[e===-1?a.buckets.length-1:e]+=1}}arm(){this.timer===null&&(this.startedAt=Date.now(),this.timer=setTimeout(()=>{this.collect()},this.intervalMs()),i.t(this.timer))}},ve={TRACE:`debug`,DEBUG:`debug`,INFO:`info`,WARN:`warn`,ERROR:`error`,FATAL:`error`},ye=class{settings;diagnostics;limits;constructor(t,n,r=e.tn){this.settings=t,this.diagnostics=n,this.limits=r}update(e){this.settings=e}accepts(t){return this.settings.level===null||!Object.hasOwn(e.Tt,this.settings.level)?!1:e.Tt[t]>=e.Tt[this.settings.level]}write(e,t,n,r,i){if(!this.accepts(t)||typeof console>`u`||s.t())return;let a=`%c[%s]%c[${t}]%c`,{styles:o}=this.settings,l=ve[t];this.diagnostics.guard(`handler.threw`,`The library could not print to console.${l}.`,()=>{let u=[];i!==void 0&&u.push(i),r!==void 0&&u.push(c.n(r,this.limits,this.diagnostics)),s.n(()=>{console[l](a,o.namespace,e,o[t],``,n,...u)})})}},be=class{value=0;next(){return++this.value}},xe=/^[0-9a-f]{32}$/,Se=/^[0-9a-f]{16}$/,Ce=/[1-9a-f]/;function we(e){return xe.test(e.traceId)&&Ce.test(e.traceId)&&Se.test(e.spanId)&&Ce.test(e.spanId)}function Te(){return l.o(16)}function E(){return l.o(8)}function Ee(e){return{traceId:Te(),spanId:E(),traceFlags:1,startedAt:Date.now(),reason:e,ended:!1}}function De(e,t,n){return`00-${e}-${t}-${(n&255).toString(16).padStart(2,`0`)}`}function Oe(e){return{traceId:e.traceId,spanId:e.spanId,traceFlags:e.traceFlags}}var ke=class{diagnostics;maxAgeMs;load;spans;ambient=Ee(`start`);otel;constructor(t,n=e.qn,r,i){this.diagnostics=t,this.maxAgeMs=n,this.load=r,this.spans=i}async loadOtel(){if(this.load)try{this.otel=await this.load()}catch(e){this.diagnostics.report(`trace.otel_failed`,`The library could not load @opentelemetry/api. Records use the trace ids of the library.`,void 0,e)}}resolve(){return this.activeSpanContext()??this.ambientContext()}ambientContext(){return Date.now()-this.ambient.startedAt>this.maxAgeMs&&this.rotate(`maxAge`),Oe(this.ambient)}activeSpanContext(){let e=this.otel;if(e)return this.diagnostics.guard(`trace.otel_failed`,`The library could not read the active OpenTelemetry span.`,()=>{let t=e.trace.getActiveSpan();if(t===void 0)return;let n=t.spanContext();if(we(n))return{traceId:n.traceId,spanId:n.spanId,traceFlags:n.traceFlags}})}rotate(e){let t=this.ambient;this.ambient=Ee(e);let n=Oe(this.ambient);return this.finish(t),n}end(){this.finish(this.ambient)}finish(e){e.ended||(e.ended=!0,this.spans?.onEnd({traceId:e.traceId,spanId:e.spanId,reason:e.reason,startedAt:e.startedAt,endedAt:Date.now()}))}headers(){return this.trace(!1).headers}request(){return this.trace(!0)}trace(t){let n={},r=this.otel;if(r&&this.diagnostics.guard(`trace.otel_failed`,`The library could not add the OpenTelemetry headers.`,()=>{r.propagation.inject(r.context.active(),n)}),n.traceparent)return{headers:n};let i=this.activeSpanContext(),a=i??this.ambientContext(),o=i?void 0:this.spans;if(!o?.enabled())return n[e.Kn]=De(a.traceId,a.spanId,a.traceFlags),{headers:n};let s=o.keeps(a.traceId),c=s?a.traceFlags:a.traceFlags&-2,l=t?E():a.spanId;return n[e.Kn]=De(a.traceId,l,c),!t||!s?{headers:n}:{headers:n,span:{traceId:a.traceId,spanId:l,parentSpanId:a.spanId}}}},Ae=class{buffer;pointer=0;filled=!1;capacity;constructor(e){this.capacity=e===0?0:Math.max(e,1),this.buffer=Array(this.capacity)}resize(e){let t=this.snapshot().slice(-e);if(this.capacity=e,this.buffer=Array(e),this.pointer=0,this.filled=!1,e)for(let e of t)this.push(e)}push(e){this.capacity!==0&&(this.buffer[this.pointer]=e,this.pointer=(this.pointer+1)%this.capacity,this.pointer===0&&(this.filled=!0))}clear(){this.buffer.fill(void 0),this.pointer=0,this.filled=!1}snapshot(){return(this.filled?[...this.buffer.slice(this.pointer),...this.buffer.slice(0,this.pointer)]:this.buffer.slice(0,this.pointer)).filter(e=>e!==void 0)}},je=Object.keys(e.Tt),Me=[`gzip`,`none`],Ne=[`omit`,`same-origin`,`include`],Pe=[`auto`,`indexeddb`,`localstorage`,`memory`,`none`],Fe=[`storage`,`memory`],Ie=[`auto`,`sender`,`forwarder`,`off`],Le=[`auto`,`provider`,`client`],Re=[`auto`,`context`,`tab`,`origin`],ze=[`error`,`warn`,`info`,`log`],Be=[`limited`,`until-delivered`],Ve={logFlushIntervalMs:[100,6e4],logBatchSize:[1,1e3],metricFlushIntervalMs:[100,6e4],metricBatchSize:[1,1e3]},He={maxBatches:[1,5e3],maxAgeMs:[6e4,6048e5],maxAttempts:[1,20]},Ue={maxBodyChars:[256,65536],maxAttributeChars:[256,65536],maxAttributeCount:[1,1024],maxStackChars:[256,65536],maxDepth:[1,16],maxArrayLength:[1,1e4],maxNodes:[100,1e5],maxRecordBytes:[1024,e.D]},We=[6e4,864e5],D=[0,2147483647],O=[0,2**53-1],Ge=[1,2**53-1],Ke=[100,1e4],qe=e=>Array.isArray(e)&&e.every(e=>typeof e==`string`),Je=e=>Array.isArray(e)&&e.every(e=>typeof e==`function`),k=e=>e===null||typeof e==`function`,Ye=e=>k(e)||Xe(e)&&Object.values(e).every(e=>typeof e==`string`),Xe=e=>typeof e==`object`&&!!e&&!Array.isArray(e);function A(e,t){return(n,r,i,a)=>r===void 0?i:e(r)?r:(N(a,n,t,r,`the current value`),i)}var Ze={capturePolicy:{ranges:{breadcrumbs:[0,1e6],errorDedupeMs:D,maxErrorSignatures:O,errorsPerWindow:O,consolePerWindow:O,longFramesPerWindow:O,webSocketPerWindow:O,reportsPerWindow:O,resourcesPerWindow:O,lifecyclePerWindow:O,windowMs:D,errorCeiling:O}},metadata:{ranges:{}},persistence:{ranges:{}},diagnostics:{ranges:{throttleMs:D},custom:{records:pt}},correlation:{ranges:{sessionIdleMs:D,sessionTouchMs:D,traceMaxAgeMs:D}},metrics:{ranges:{maxSeries:O,maxInstruments:O,maxHistogramBoundaries:O}},buffering:{ranges:{maxPendingRecords:O,maxPendingBytes:O},choices:{overflow:[`drop-oldest`,`drop-newest`,`persist`]}},delivery:{ranges:{requestTimeoutMs:[1,D[1]],maxConcurrentRequests:Ge,retryBaseDelayMs:D,retryMaxDelayMs:D,retryIdleDelayMs:D,batchesPerDrain:Ge},choices:{priority:[`low`,`auto`,`high`]}},debugBuffer:{ranges:{maxRecords:[1,1e4],maxAgeMs:D}},profiler:{ranges:{flushIntervalMs:[1e3,6e5],maxProbes:[1,e.Gt]}},replay:{ranges:{bufferMs:[5e3,6e5],maxBufferBytes:[1e5,2e8],afterErrorMs:[0,6e5],uploadsPerWindow:O,batchSize:[1,1e4],batchBytes:[1e4,1e7],flushIntervalMs:[100,6e4],maxQueueBytes:[1e5,2e8],maxAttempts:[1,10]},choices:{mode:[`onError`]},custom:{maskSelectors:A(qe,`a list of strings`),blockSelectors:A(qe,`a list of strings`),loader:A(k,`a function or null`),onSegment:A(k,`a function or null`),headers:A(Ye,`an object of strings, a function or null`),plugins:A(Je,`a list of functions`),recordOptions:A(Xe,`an object`)}}},Qe=[`errors`,`rejections`,`resourceErrors`,`fetch`,`xhr`,`httpMetrics`,`navigation`,`webVitals`,`longFrames`,`fullUrls`,`webSocket`,`uncleanExit`,`userTiming`,`serverTiming`,`reports`,`lifecycle`],$e=`null`,j=`a level name: ${M(je)}`,et=`true, false or a list of ${M(ze)}`,tt=`a list of strings and RegExp patterns`,nt=`a list of origin URLs such as "https://api.example" and RegExp patterns`,rt=`a list of origin URLs such as "https://app.example". For a sandboxed frame, set bus.mode: "sender" in the frame`,it=`a list of strings`,at=`true, false or a list of diagnostic codes`;function M(e){let t=e.map(e=>`"${e}"`);return`${t.slice(0,-1).join(`, `)} or ${t[t.length-1]}`}function ot(e){return typeof e==`string`?`"${e}"`:typeof e==`function`?`a function`:typeof e==`object`&&e?`an object`:String(e)}function N(e,t,n,r,i){e.report(`config.invalid`,`${t} must be ${n}. The value is ${ot(r)}. The library keeps ${i}.`)}function P(e,t,n,r,i){if(t===void 0)return r;let a=n.find(e=>e===t);return a===void 0?(N(i,e,M(n),t,`"${r}"`),r):a}function F(e,t,n,r){return t===void 0?n:typeof t==`boolean`?t:(N(r,e,`true or false`,t,String(n)),n)}function st(e,t,n,r){return t===void 0?n:typeof t==`number`&&Number.isFinite(t)&&t>=0?t:(N(r,e,`a finite number of 0 or more`,t,String(n)),n)}function I(e,t,n,r,i){if(t===void 0)return r;let[a,o]=n;return typeof t==`number`&&Number.isInteger(t)&&t>=a&&t<=o?t:(N(i,e,`an integer from ${String(a)} to ${String(o)}`,t,String(r)),r)}function ct(e,t,n){return e===void 0?t:e===null?null:typeof e==`number`&&Number.isSafeInteger(e)&&e>=0?e:(N(n,`loggerCache.maxEntries`,`a nonnegative safe integer or null`,e,String(t)),t)}function L(e,t,n,r,i){let a=t??{},o=Object.keys(r);return Object.fromEntries(o.map(t=>[t,I(`${e}.${t}`,a[t],r[t],n[t],i)]))}function R(e){if(typeof e!=`string`)return;let t=e.toUpperCase();return je.find(e=>e===t)}function lt(e,t,n,r){if(t===void 0)return n;let i=R(t);return i===void 0?(N(r,e,j,t,`"${n}"`),n):i}function ut(e,t,n){if(e===void 0)return t;if(!r.t(e))return N(n,`minLevels`,`an object of level names`,e,`the current value`),t;let i=[];for(let[t,r]of Object.entries(e)){let e=R(r);t!==``&&e!==void 0?i.push([t,e]):N(n,`minLevels["${t}"]`,j,r,`minLevel for it`)}return Object.fromEntries(i)}function z(e,t,n,r,i,a){if(t===void 0)return n;if(!Array.isArray(t))return N(a,e,r,t,`the current list`),n;let o=[],s=t;for(let t of s){let n=i(t);n===void 0?a.report(`config.invalid`,`The library ignores the ${e} entry ${ot(t)}. ${e} must be ${r}.`):o.push(n)}return o}function dt(e){return typeof e==`function`?e:void 0}function ft(e){return r.t(e)&&typeof e.name==`string`&&e.name!==``&&typeof e.install==`function`&&typeof e.uninstall==`function`?e:void 0}function pt(e,t,n,r){return t===void 0||typeof t==`boolean`?t??n:Array.isArray(t)?z(e,t,[],at,mt,r):(N(r,e,at,t,`the current value`),n)}function mt(e){return typeof e==`string`?e:void 0}function ht(e){return typeof e==`string`||e instanceof RegExp?e:void 0}function gt(e){return ze.find(t=>t===e)}function _t(e){if(typeof e==`string`)try{let{origin:t}=new URL(e);return t===$e?void 0:t}catch{return}}function vt(e){return e instanceof RegExp?e:_t(e)}function yt(e){return r.t(e)?Object.values(e).every(e=>typeof e==`string`):!1}function bt(e,t,n){if(e!==void 0)return typeof e==`function`||yt(e)?e:(n.report(`config.invalid`,`headers must be an object of strings or a function. The library keeps the current headers.`),t)}function xt(e){return typeof e!=`object`||!e?!1:typeof Reflect.get(e,`serialize`)==`function`}function St(t,n,r){return t===void 0?n??`otlp`:t===`otlp`||t===`ecs`||xt(t)?t:(r.report(`config.invalid`,`serializer must be "${e.En}", "ecs" or an implementation. The library uses "${e.En}".`),e.En)}var Ct=new Set(Object.keys(e.L));function wt(e,t){let n={},r=Object.entries(e??{});for(let[e,i]of r)Ct.has(e)?typeof i==`string`?n[e]=i:t.report(`config.invalid`,`console.styles.${e} must be a string. The library keeps the current style.`):t.report(`config.invalid`,`The library ignores the unknown console.styles key "${e}". Check the spelling.`);return n}function Tt(e,t,n){if(e===void 0)return t??`DEBUG`;let r=R(e);return r===void 0?(N(n,`console.level`,j,e,`the current console level`),t):r}function Et(t,n,r){if(t===void 0)return n;if(t===!1)return{level:null,styles:n.styles};if(t===!0)return{level:e.I,styles:n.styles};if(typeof t==`string`){let e=R(t);return e===void 0?(N(r,`console`,j,t,`the current console level`),n):{level:e,styles:n.styles}}return typeof t!=`object`||!t?(r.report(`config.invalid`,`console must be a boolean, a level or an object. The current console settings stay.`),n):{level:Tt(t.level,n.level,r),styles:{...n.styles,...wt(t.styles,r)}}}function Dt(e,t,n){let r=e??{};return{...t,...r,rates:{...t.rates,...r.rates},alwaysSampleTypes:z(`sampling.alwaysSampleTypes`,r.alwaysSampleTypes,t.alwaysSampleTypes,it,mt,n),alwaysSampleFrom:lt(`sampling.alwaysSampleFrom`,r.alwaysSampleFrom,t.alwaysSampleFrom,n),remote:F(`sampling.remote`,r.remote,t.remote,n)}}function Ot(e,t,n){let r=e??{};return{maxTrackedSources:I(`bus.maxTrackedSources`,r.maxTrackedSources,[0,2**53-1],t.maxTrackedSources,n),sourcePolicy:P(`bus.sourcePolicy`,r.sourcePolicy,[`registered`,`trusted-origin`],t.sourcePolicy,n),validation:P(`bus.validation`,r.validation,[`strict`,`envelope`],t.validation,n),maxMessageBytes:I(`bus.maxMessageBytes`,r.maxMessageBytes,[0,2**53-1],t.maxMessageBytes,n),maxRecordsPerMessage:I(`bus.maxRecordsPerMessage`,r.maxRecordsPerMessage,[0,2**53-1],t.maxRecordsPerMessage,n),maxMessagesPerSecond:I(`bus.maxMessagesPerSecond`,r.maxMessagesPerSecond,[0,2**53-1],t.maxMessagesPerSecond,n),mode:P(`bus.mode`,r.mode,Ie,t.mode,n),trustedOrigins:z(`bus.trustedOrigins`,r.trustedOrigins,t.trustedOrigins,rt,_t,n),openFinRole:P(`bus.openFinRole`,r.openFinRole,Le,t.openFinRole,n)}}function kt(e,t,n){let r=e??{};return{scope:P(`journey.scope`,r.scope,Re,t.scope,n),maxAgeMs:I(`journey.maxAgeMs`,r.maxAgeMs,We,t.maxAgeMs,n)}}function At(e,t,n){let r=e??{};return{mode:P(`retention.mode`,r.mode,Be,t.mode,n),...L(`retention`,r,t,He,n)}}function jt(e,t,n){return e===void 0?t:typeof e==`boolean`?e:Array.isArray(e)?z(`capture.console`,e,[],et,gt,n):(N(n,`capture.console`,et,e,`the current value`),t)}function Mt(t,n,r){let i=t??{},a={...n,...i,remoteToggles:z(`capture.remoteToggles`,i.remoteToggles,n.remoteToggles,`a list of capture switch names without privacy controls`,t=>e.nn.find(e=>e===t),r),resourceTiming:Nt(i.resourceTiming,n.resourceTiming,r),interactions:Pt(i.interactions,n.interactions,r),console:jt(i.console,n.console,r),longFrameMs:st(`capture.longFrameMs`,i.longFrameMs,n.longFrameMs,r),ignoreUrls:z(`capture.ignoreUrls`,i.ignoreUrls,n.ignoreUrls,tt,ht,r),userTimingInclude:z(`capture.userTimingInclude`,i.userTimingInclude,n.userTimingInclude,tt,ht,r),propagateTraceHeaderTo:z(`capture.propagateTraceHeaderTo`,i.propagateTraceHeaderTo,n.propagateTraceHeaderTo,nt,vt,r),plugins:z(`capture.plugins`,i.plugins,n.plugins,`a list of objects with a name, install() and uninstall()`,ft,r)};for(let e of Qe)a[e]=F(`capture.${e}`,i[e],n[e],r);return a}function Nt(t,n,i){return t===void 0?n:typeof t==`boolean`?t:r.t(t)?{slowMs:st(`capture.resourceTiming.slowMs`,t.slowMs,typeof n==`object`?n.slowMs??1e3:e.vn,i)}:(i.report(`config.invalid`,`capture.resourceTiming must be a boolean or an options object.`),n)}function Pt(e,t,n){if(e===void 0)return t;if(typeof e==`boolean`)return e;if(!r.t(e))return n.report(`config.invalid`,`capture.interactions must be a boolean or an options object.`),t;let i=typeof t==`object`?t:{},a=e.ignoreSelector,o=a===void 0?i.ignoreSelector:a;if(o!=null)try{if(typeof o!=`string`)throw Error(`Invalid selector`);typeof document<`u`&&document.createElement(`div`).matches(o)}catch{n.report(`config.invalid`,`capture.interactions.ignoreSelector must be a valid CSS selector or null.`),o=i.ignoreSelector}let s=i.actionAttribute??`data-observability-action`;return e.actionAttribute!==void 0&&(typeof e.actionAttribute==`string`&&/^[a-z][\w-]*$/i.test(e.actionAttribute)?s=e.actionAttribute:N(n,`capture.interactions.actionAttribute`,`an attribute name of letters, digits, hyphens and underscores`,e.actionAttribute,`"${s}"`)),{actionAttribute:s,text:F(`capture.interactions.text`,e.text,i.text??!1,n),selector:F(`capture.interactions.selector`,e.selector,i.selector??!1,n),ignoreSelector:typeof o==`string`||o===null?o:void 0,maxTextChars:I(`capture.interactions.maxTextChars`,e.maxTextChars,[0,2**53-1],i.maxTextChars??50,n),rageClicks:F(`capture.interactions.rageClicks`,e.rageClicks,i.rageClicks??!1,n),rageClickCount:I(`capture.interactions.rageClickCount`,e.rageClickCount,[2,20],i.rageClickCount??3,n),rageClickWindowMs:I(`capture.interactions.rageClickWindowMs`,e.rageClickWindowMs,Ke,i.rageClickWindowMs??1e3,n),deadClicks:F(`capture.interactions.deadClicks`,e.deadClicks,i.deadClicks??!1,n),deadClickMs:I(`capture.interactions.deadClickMs`,e.deadClickMs,Ke,i.deadClickMs??1e3,n)}}var Ft={metricsEndpoint:`The library sends metric records as log records.`,tracesEndpoint:`The library sends no span.`};function It(t,n,r,i,o){let s=r;if(typeof n==`string`&&n!==``)try{new URL(n),s=n}catch(e){o.report(`config.invalid`,`${t} is not a valid absolute URL: ${a.i(n,!1)}. The library keeps the current value.`,void 0,e)}else n===``?s=``:n!==void 0&&N(o,t,`a URL string`,n,`the current value`);return s!==``&&i!==`otlp`?(o.report(`config.invalid`,`${t} needs serializer "${e.En}". ${Ft[t]}`),``):s}function Lt(e,t,n,r,i){let a={...n};for(let o of Object.keys(n)){let s=t?.[o],c=n[o],l=r.ranges[o],u=r.choices?.[o],d=r.custom?.[o],f=c;d?f=d(`${e}.${o}`,s,c,i):typeof c==`number`&&l?f=I(`${e}.${o}`,s,l,c,i):typeof c==`boolean`?f=F(`${e}.${o}`,s,c,i):u?f=P(`${e}.${o}`,s,u,String(c),i):s===void 0||typeof s==`string`?f=s??c:N(i,`${e}.${o}`,`a string`,s,String(c)),Object.assign(a,{[o]:f})}return a}function B(t,n,r){let i=r??e.U,o=Object.fromEntries(Object.keys(Ze).map(e=>[e,Lt(e,t[e],i[e],Ze[e],n)])),s={...i,...t,...o,lockConfiguration:F(`lockConfiguration`,t.lockConfiguration,i.lockConfiguration,n),loggerCache:{maxEntries:ct(t.loggerCache?.maxEntries,i.loggerCache.maxEntries,n)},securityContext:{id:typeof t.securityContext?.id==`string`&&t.securityContext.id||i.securityContext.id,isolation:F(`securityContext.isolation`,t.securityContext?.isolation,i.securityContext.isolation,n)},endpoint:t.endpoint===void 0?i.endpoint:t.endpoint,enabled:F(`enabled`,t.enabled,i.enabled,n),payloadMode:P(`payloadMode`,t.payloadMode,[`copy`,`defer`],i.payloadMode,n),minLevel:lt(`minLevel`,t.minLevel,i.minLevel,n),minLevels:ut(t.minLevels,i.minLevels,n),processors:z(`processors`,t.processors,i.processors,`a list of functions`,dt,n),compression:P(`compression`,t.compression,Me,i.compression,n),credentials:P(`credentials`,t.credentials,Ne,i.credentials,n),headers:`headers`in t?bt(t.headers,i.headers,n):i.headers,storage:P(`storage`,t.storage,Pe,i.storage,n),identity:P(`identity`,t.identity,Fe,i.identity,n),serializer:St(t.serializer,r?.serializer,n),console:Et(t.console,i.console,n),sampling:Dt(t.sampling,i.sampling,n),bus:Ot(t.bus,i.bus,n),batching:L(`batching`,t.batching,i.batching,Ve,n),retention:At(t.retention,i.retention,n),limits:L(`limits`,t.limits,i.limits,Ue,n),journey:kt(t.journey,i.journey,n),capture:Mt(t.capture,i.capture,n)};for(let e of[`metricsEndpoint`,`tracesEndpoint`])s[e]=It(e,t[e],i[e],s.serializer,n);if(s.transport!==void 0&&typeof s.transport!=`function`&&(n.report(`config.invalid`,`transport must be a function. The library ignores the value.`),s.transport=i.transport),s.onDrop!==void 0&&typeof s.onDrop!=`function`&&(n.report(`config.invalid`,`onDrop must be a function. The library ignores the value.`),s.onDrop=i.onDrop),s.contextProvider!==void 0&&typeof s.contextProvider!=`function`&&(n.report(`config.invalid`,`contextProvider must be a function. The library ignores the value.`),s.contextProvider=i.contextProvider),s.transportWorker!==void 0&&typeof s.transportWorker!=`function`&&(n.report(`config.invalid`,`transportWorker must be a function. The library keeps the current value.`),s.transportWorker=i.transportWorker),s.transportOnExit!==void 0&&typeof s.transportOnExit!=`function`&&(n.report(`config.invalid`,`transportOnExit must be a function. The library ignores the value.`),s.transportOnExit=i.transportOnExit),s.endpoint===``)s.transport===void 0&&n.report(`config.invalid`,`endpoint is missing. The library drops each record. Set endpoint: null for console-only mode.`);else if(s.endpoint!==null)try{new URL(s.endpoint)}catch(e){n.report(`config.invalid`,`endpoint is not a valid absolute URL: ${a.i(s.endpoint,!1)}.`,void 0,e)}for(let e of[`metricsEndpoint`,`tracesEndpoint`])s[e]!==``&&s.endpoint===null&&!s.transport&&n.report(`config.invalid`,`${e} needs endpoint or transport. The library sends nothing to ${e}.`);s.serviceName||=(n.report(`config.invalid`,`serviceName is missing. Every record reports service.name as '${e.nr}'.`),e.nr);let c=s.sampling.defaultRate;(typeof c!=`number`||c<0||c>1)&&(n.report(`config.invalid`,`sampling.defaultRate must be 0..1. The value is ${String(c)}. The library uses 1.`),s.sampling.defaultRate=1);let l=s.sampling.remoteMaxRate;typeof l==`number`&&l>=0&&l<=1||(n.report(`config.invalid`,`sampling.remoteMaxRate must be 0..1. The value is ${String(l)}. The library uses 1.`),s.sampling.remoteMaxRate=1);let u=Object.entries(s.sampling.rates);for(let[e,t]of u)(typeof t!=`number`||t<0||t>1)&&(n.report(`config.invalid`,`sampling.rates["${e}"] must be 0..1. The value is ${String(t)}. The library uses 1.`),s.sampling.rates[e]=1);s.capture.ignoreUrls=s.capture.ignoreUrls.filter(e=>e!==r?.endpoint&&e!==r?.metricsEndpoint&&e!==r?.tracesEndpoint&&e!==r?.replay.endpoint);for(let e of[s.endpoint,s.metricsEndpoint,s.tracesEndpoint,s.replay.endpoint])e&&!s.capture.ignoreUrls.includes(e)&&(s.capture.ignoreUrls=[...s.capture.ignoreUrls,e]);return s.delivery.retryMaxDelayMs<s.delivery.retryBaseDelayMs&&(n.report(`config.invalid`,`delivery.retryMaxDelayMs must be at least retryBaseDelayMs.`),s.delivery.retryBaseDelayMs=i.delivery.retryBaseDelayMs,s.delivery.retryMaxDelayMs=i.delivery.retryMaxDelayMs),s.capture.urlTransform!==void 0&&typeof s.capture.urlTransform!=`function`&&(n.report(`config.invalid`,`capture.urlTransform must be a function.`),s.capture.urlTransform=i.capture.urlTransform),Rt(t,n),s}function Rt(t,n){let r=new Set([...Object.keys(e.U),...e.er]);for(let e of Object.keys(t))r.has(e)||n.report(`config.invalid`,`The library ignores the unknown config key "${e}". Check the spelling.`);for(let r of e.F){let i=t[r];if(typeof i!=`object`||!i)continue;let a=new Set([...Object.keys(e.U[r]),...e.tr[r]]);for(let e of Object.keys(i))a.has(e)||n.report(`config.invalid`,`The library ignores the unknown config key "${r}.${e}". Check the spelling.`)}}function zt(t,n){for(let r of Object.keys(n))e.F.includes(r)||Object.assign(t,{[r]:n[r]});for(let r of e.F)Object.assign(t[r],n[r])}var Bt=class{map=new Map;set(e,t){this.map.set(e,t)}setMany(e){for(let[t,n]of Object.entries(e))this.map.set(t,n)}remove(e){this.map.delete(e)}clear(){this.map.clear()}getAll(){return Object.fromEntries(this.map)}},Vt=class{policy;kept=[];constructor(e){this.policy=e}push(e){let{enabled:t,maxRecords:n}=this.policy();t&&(this.kept.push({at:Date.now(),record:e}),this.kept.length>=n*2&&(this.kept=this.kept.slice(-n)))}drain(){let t=this.live();return this.kept=[],t.map(({record:t})=>({...t,attributes:{...t.attributes,[e.u]:!0}}))}snapshot(){return this.live().map(({record:e})=>e)}live(){let{enabled:e,maxRecords:t,maxAgeMs:n}=this.policy();if(!e)return this.kept=[],[];let r=n===0?-1/0:Date.now()-n;return this.kept.slice(-t).filter(e=>e.at>=r)}clear(){this.kept=[]}},V=class{handler;throttleMs;consoleFallback;counters=new Map;lastEmitted=new Map;constructor(t,n=e.J,r=!1){this.handler=t,this.throttleMs=n,this.consoleFallback=r}setPolicy(e,t){this.throttleMs=e,this.consoleFallback=t}setHandler(e){this.handler=e}count(e,t=1){let n=(this.counters.get(e)??0)+t;return this.counters.set(e,n),n}report(t,n,r,i){let a=this.count(t),o=Date.now();if(o-(this.lastEmitted.get(t)??0)<this.throttleMs)return!1;this.lastEmitted.set(t,o);let c={code:t,message:n,detail:r,cause:i,at:o,count:a},{handler:l}=this;if(!l)return!0;try{s.n(()=>{l(c)})}catch{this.count(`handler.threw`),this.consoleFallback&&typeof console<`u`&&s.n(()=>{console.warn(`${e.Dt} The onDiagnostic handler threw an error.`)})}return!0}guard(e,t,n){try{return n()}catch(n){this.report(e,t,void 0,n);return}}async guardAsync(e,t,n){try{return await n()}catch(n){this.report(e,t,void 0,n);return}}snapshot(){return Object.fromEntries(this.counters)}};function H(e,t){e.length<20&&!e.includes(t)&&e.push(t)}var Ht=class{config;diagnostics;pending=new Map;scheduled=!1;reporting=!1;constructor(e,t){this.config=e,this.diagnostics=t}add(t,n,r=[]){if(!this.config.onDrop||this.reporting||n.length===0&&r.length===0)return;let i=this.pending.get(t);i||(i={reason:t,records:0,batchIds:[],journeyIds:[],actions:[]},this.pending.set(t,i)),i.records+=n.length;for(let e of r)H(i.batchIds,e);for(let t of n){let n=d.t(t,e.f);typeof n==`string`&&H(i.journeyIds,n);let r=d.r(t)?t.body:void 0;typeof r==`string`&&H(i.actions,r)}this.scheduled||(this.scheduled=!0,queueMicrotask(()=>{this.flush()}))}flush(){this.scheduled=!1;let e=[...this.pending.values()];this.pending.clear();let t=this.config.onDrop;if(t){this.reporting=!0;for(let n of e)this.diagnostics.guard(`handler.threw`,`The onDrop hook threw an error.`,()=>{u.r(()=>{s.n(()=>{t(n)})})});this.reporting=!1}}},Ut=class{onDrop;held=[];actions=0;constructor(e){this.onDrop=e}get records(){return this.held}get length(){return this.held.length}push(e){let t=d.r(e);if((t?this.actions:this.held.length-this.actions)<(t?2e3:500))this.actions+=+!!t;else{let e=this.held.findIndex(e=>d.r(e)===t),[n]=this.held.splice(e,1);this.onDrop(n)}this.held.push(e)}take(){let e=this.held;return this.held=[],this.actions=0,e}},Wt={name:`ui.measure.duration`,kind:`histogram`,unit:`ms`,boundaries:e.Nt},Gt={name:`ui.measure.phase.duration`,kind:`histogram`,unit:`ms`,boundaries:e.Nt};function Kt(e,t,n,r){let i=String(e),a=Date.now(),o=performance.now(),s,c=!1,l=e=>a+e-o,u=(e,a)=>{s&&=(r.metric(Gt,e-s.at,{...t,"measure.name":i,"measure.phase":s.name}),n&&r.span({name:s.name,kind:`internal`,traceId:n.traceId,spanId:E(),parentSpanId:n.spanId,startMs:l(s.at),endMs:l(e),error:a,attributes:{"measure.name":i}}),void 0)};return{phase:e=>{if(c)return;let t=performance.now();u(t,!1),s={name:String(e),at:t}},end:(e=`ok`)=>{if(c)return;c=!0;let s=performance.now(),d=e===`error`;u(s,d);let f={...t,"measure.outcome":e};r.metric(Wt,s-o,{...f,"measure.name":i}),n&&r.span({...n,name:i,kind:`internal`,startMs:a,endMs:l(s),error:d,attributes:f})}}}var qt=`error.`,Jt=[e.v,e.f,e.p],Yt={processor:{label:`A processor`,code:`record.dropped_by_processor`},redact:{label:`The redact hook`,code:`record.dropped_by_redact`}},Xt=[`metric.name`,`metric.unit`,`metric.type`,`metric.value`,...Object.values(e.Pt),...Object.values(e.Nn)];function Zt(e){return Object.fromEntries(Xt.filter(t=>t in e).map(t=>[t,e[t]]))}function U(e){return e}var Qt=class{deps;resourceCache=null;constructor(e){this.deps=e}invalidateResource(){this.resourceCache=null}isEnabled(t,n,r){let{config:i}=this.deps;if(!i.enabled)return!1;if(r!==void 0&&e.wt.includes(r))return!0;let a=this.deps.remote.sampling?.minLevelFor(n)??p.n(n,i);return e.Tt[t]>=e.Tt[a]}keepForDebug(e){let{config:t,debug:n}=this.deps;if(!n||!t.enabled||!t.debugBuffer.enabled)return;let{record:r}=this.build(e,!0);r&&n.push(r)}build(n,r=!1){let{config:i,diagnostics:o,tracing:s,journey:l,sequence:u,limits:d,remote:f}=this.deps;if(!r&&!this.isEnabled(n.level,n.namespace,n.type))return o.count(`record.dropped_by_level`),this.keepForDebug(n),{record:null,dropped:`level`};let m=n.trace??n.snapshot?.trace??s.resolve(),h=n.snapshot?n.snapshot.journey:l.current(),g=p.o({level:n.level,type:n.type,namespace:n.namespace,journeyId:h?.id??``,traceId:m.traceId,aggregated:n.aggregated},i,f.sampling?.current()??null);if(!r&&!g)return o.count(`record.dropped_by_sampling`),this.keepForDebug(n),{record:null,dropped:`sampling`};let _=u.next(),ee=n.snapshot?.url??a.t(o),v=i.metadata.pageUrl?a.i(ee,i.capture.fullUrls,i.capture.urlTransform,o):``,y,b=0;try{let e=c.r(n.snapshot?.context??this.deps.context.getAll(),d,o),t=c.r(this.provided(),d,o),r=c.r(n.scoped??{},d,o),i=c.r(n.payload??{},d,o);b=e.bytes+t.bytes+r.bytes+i.bytes,y={...U(e.value),...U(t.value),...U(r.value),...U(i.value)}}catch(t){o.report(`record.sanitize_failed`,`The library could not sanitize the attributes.`,void 0,t),y={[e.y]:!0}}Object.assign(y,n.fixed),y[e.g]=n.type,y[e.h]=_,y[e.a]=n.namespace,y[e.v]=v,h&&(y[e.f]=h.id,y[e.p]=h.name,h.parentId!==void 0&&(y[e.m]=h.parentId));let x=c.i(n.body,d.maxBodyChars);x!==n.body&&o.count(`record.truncated`);let S={timeUnixNano:n.snapshot?.timeUnixNano??t.r(),traceId:m.traceId,spanId:m.spanId,traceFlags:m.traceFlags,severityNumber:e.Mn[n.level],severityText:n.level,body:x,attributes:y,resource:this.resource()},C=i.processors.map(e=>[e,`processor`]);if(i.redact&&C.push([i.redact,`redact`]),C.length>0){let e=this.applyHooks(S,C,n.fixed);if(typeof e==`string`)return{record:null,dropped:e};({record:S,bytes:b}=e)}if(b>d.maxRecordBytes){o.report(`record.truncated`,`The attributes are larger than the size limit. The library dropped the caller attributes.`,{bytes:b,body:S.body});let t={[e.g]:n.type,[e.h]:_,[e.a]:n.namespace,[e.s]:!0,[e.o]:b};for(let e of Jt)e in S.attributes&&(t[e]=S.attributes[e]);for(let[e,n]of Object.entries(S.attributes))e.startsWith(qt)&&(t[e]=n);let r=c.r(t,d,o).bytes;r>d.maxRecordBytes&&`error.data`in t&&(Reflect.deleteProperty(t,e.d),r=c.r(t,d,o).bytes);let i=S.attributes[e.c];if(i!==void 0){let n=c.r(i,d,o).bytes;r+n<=d.maxRecordBytes&&(t[e.c]=i)}Object.assign(t,n.fixed),S.attributes=t}return{record:S}}redactForwarded(e){let{redact:t}=this.deps.config;if(!t)return e;let n=[[t,`redact`]],r=this.applyHooks(e,n,Zt(e.attributes));return typeof r==`string`?null:r.record}applyHooks(e,t,n){let r=e;for(let[e,n]of t){let t=this.runHook(e,n,r);if(typeof t==`string`)return t;r=t}let{diagnostics:i,limits:a}=this.deps,o=c.r(r.attributes,a,i),s=U(o.value);return Object.assign(s,n),{record:{...r,attributes:s},bytes:o.bytes}}runHook(n,r,i){let{diagnostics:a}=this.deps,{label:o,code:s}=Yt[r],c;try{c=n(i)}catch(e){return a.report(s,`${o} threw an error. The library dropped the record.`,void 0,e),r}if(c===null)return a.count(s),r;let l=c??i;return t.n(l)?t.t(l.severityText)?{...l,severityNumber:e.Mn[l.severityText]}:(a.report(`record.dropped_malformed`,`${o} set a severityText that is not a log level. The library dropped the record.`),`malformed`):l===i?(a.report(`record.dropped_malformed`,`${o} changed the record to a shape that is not a record. The library dropped it.`),`malformed`):(a.report(s,`${o} returned a value that is not a record. The library dropped the record.`),r)}provided(){let e=this.deps.config.contextProvider;if(!e)return{};let{diagnostics:t}=this.deps,n=t.guard(`handler.threw`,`The contextProvider threw an error. The record has no attributes from it.`,()=>{let t=e();return t===void 0?{}:r.t(t)&&typeof t.then!=`function`?t:null});return n===null&&t.report(`config.invalid`,`contextProvider must return an object of attributes. The library ignores the value.`),n??{}}resource(){if(this.resourceCache)return this.resourceCache;let{config:t,identity:n,platform:r}=this.deps;return this.resourceCache={[e.hn]:t.serviceName,[e.gn]:t.serviceVersion,[e.dn]:t.environment,[e.xn]:e.Wn,[e.Sn]:e.Gn,[e.bn]:e.Un,[e.fn]:r.platform,[e._n]:n.sessionId,[e.yn]:n.tabId,[e.un]:n.contextId,...t.metadata.userAgent?{[e.ln]:r.userAgent}:{},...!t.metadata.openfin||r.openfinUuid===void 0?{}:{[e.mn]:r.openfinUuid},...!t.metadata.openfin||r.openfinName===void 0?{}:{[e.pn]:r.openfinName}},this.resourceCache}},$t=1e3,en={start:`ui.start`,interaction:`ui.interaction`,navigation:`ui.navigation`,explicit:`ui.trace`,maxAge:`ui.trace`};function tn(e){return`${String(Math.round(e*$t))}000`}function nn(e){return{name:en[e.reason],kind:`internal`,traceId:e.traceId,spanId:e.spanId,parentSpanId:``,startMs:e.startedAt,endMs:e.endedAt,error:!1,attributes:{}}}function rn(t){return{[e.Nn.kind]:t.kind,[e.Nn.parentId]:t.parentSpanId,[e.Nn.start]:tn(t.startMs),[e.Nn.end]:tn(t.endMs),[e.Nn.status]:t.error?`error`:`unset`,...t.link?{[e.Nn.linkTraceId]:t.link.traceId,[e.Nn.linkSpanId]:t.link.spanId}:{}}}var an={errors:async()=>(await Promise.resolve().then(()=>require("./errors-DCOCRdSi.cjs"))).ErrorCapture,network:async()=>(await Promise.resolve().then(()=>require("./network-pEX3PAJv.cjs"))).NetworkCapture,interactions:async()=>(await Promise.resolve().then(()=>require("./interactions-P6pz08Jn.cjs"))).InteractionCapture,webVitals:async()=>(await Promise.resolve().then(()=>require("./web-vitals-Ch5BpDmo.cjs"))).WebVitalsCapture,longFrames:async()=>(await Promise.resolve().then(()=>require("./long-frames-Dd8tsi2U.cjs"))).LongFrameCapture,console:async()=>(await Promise.resolve().then(()=>require("./console-CLz_PvFn.cjs"))).ConsoleCapture,uncleanExit:async()=>(await Promise.resolve().then(()=>require("./unclean-exit-ClGzrc2A.cjs"))).UncleanExitCapture,userTiming:async()=>(await Promise.resolve().then(()=>require("./user-timing-CdYqx3PF.cjs"))).UserTimingCapture,reports:async()=>(await Promise.resolve().then(()=>require("./reports-BsbqmP8h.cjs"))).ReportCapture,resourceTiming:async()=>(await Promise.resolve().then(()=>require("./resource-timing-DkycFGDa.cjs"))).ResourceTimingCapture,lifecycle:async()=>(await Promise.resolve().then(()=>require("./lifecycle-BGGOcN4N.cjs"))).LifecycleCapture,framePhases:async()=>(await Promise.resolve().then(()=>require("./profiler-frames-Dg2OebB2.cjs"))).FramePhasesCapture,framePacing:async()=>(await Promise.resolve().then(()=>require("./profiler-frames-Dg2OebB2.cjs"))).FramePacingCapture,replay:async()=>(await Promise.resolve().then(()=>require("./replay-DomJpXqW.cjs"))).ReplayCapture},on=new WeakMap,sn=0;function W(e){let t=on.get(e);return t===void 0&&(t=++sn,on.set(e,t)),t}var G=Symbol.for(e.Cn),K=Symbol.for(e.wn),cn=[`batching`,`retention`],ln={endpoint:null,metricsEndpoint:``,tracesEndpoint:``,headers:void 0,credentials:`omit`,transport:void 0,transportOnExit:void 0,transportWorker:void 0},un=Object.keys(ln),dn=new Set([`bus.role_resolved`,`config.reconfigured`,`security.rotated`,`journey.adopted`,`journey.expired`]);function fn(e){return JSON.stringify({...e,urlTransform:e.urlTransform?W(e.urlTransform):void 0,webVitalsLoader:e.webVitalsLoader!==void 0,ignoreUrls:e.ignoreUrls.map(String),propagateTraceHeaderTo:e.propagateTraceHeaderTo.map(String),userTimingInclude:e.userTimingInclude.map(String),plugins:e.plugins.map(W)})}function pn(e){if(!r.t(e))return e;let t={...e};for(let e of[`url`,`endpoint`]){let n=t[e];typeof n==`string`&&(t[e]=a.i(n,!1))}return t}function mn(e){return{...e,endpoint:null,metricsEndpoint:``,tracesEndpoint:``,transport:void 0,transportOnExit:void 0,transportWorker:void 0,bus:{...e.bus,mode:`off`}}}function hn(e){return!!e.endpoint||!!e.metricsEndpoint||!!e.tracesEndpoint||e.transport!==void 0||e.transportWorker!==void 0}function gn(t){return t.sdkVersion===e.Gn}var q=class n{rotating=!1;profilerOn=!1;closingContext=!1;mismatchVersion=null;contextMismatch=!1;rotation;memoryStorage;storagePersistence=`off`;recordingDiagnostic=!1;diagnosticLogger=new T(()=>this,e.q);debugBuffer=new Vt(()=>this.config.debugBuffer);explicitSecurityContext;ownerAdopted=!1;isRotating(){return this.rotating}setConfigurationLocked(e){typeof e==`boolean`&&(this.config.lockConfiguration=e)}static local=null;sdkVersion=e.Gn;diagnostics;config;platform;identity;stores;identityBuiltAs;sessionTouch;context=new Bt;breadcrumbs;tracing;sequence=new be;journey;builder;remote={sampling:null,changed:()=>{this.refreshCaptures()}};identityEpoch=0;errorHook;replayConsent;replay;remoteCaptureTimer;installedCaptureKey=``;replayBuiltKey=``;console;drops;meter;bus=null;busBuilt;busLoad;storageBuiltAs;sender;senderLoad;pendingRecords=new Ut(e=>{this.dropHeld(e)});captures=[];captureGeneration=0;captureOnce={webVitals:!1,navigationTiming:!1,longFrames:!1,uncleanExit:!1,userTiming:!1};bootBuffer=new Ut(e=>{this.dropHeld(e)});forwardBuffer=[];forwardScheduled=!1;roleResolved=!1;started=Promise.resolve();ready=!1;destroyed=!1;lastGapAt=0;limits;journeyOptions;tunablesLocked=!0;degraded;serverReported=!1;onPageHide=()=>{C(this),this.role()===`forwarder`&&(this.tracing.end(),this.sendForwarded())};constructor(e,t=!1){this.diagnostics=new V(e.onDiagnostic),this.platform=a.n(this.diagnostics),this.degraded=t||this.onServer(),this.config=B(this.allowed(e),this.diagnostics),this.explicitSecurityContext=!!e.securityContext?.id,this.config.securityContext.id||=l.i(this.diagnostics),this.diagnostics.setPolicy(this.config.diagnostics.throttleMs,this.config.diagnostics.consoleFallback),this.identityBuiltAs=this.config.identity,this.stores=this.identityBuiltAs===`memory`||this.onServer()?l.r():l.t,this.identity=l.s(this.diagnostics,this.stores,this.config.correlation.sessionIdleMs),this.sessionTouch=new l.n(this.diagnostics,this.stores,this.config.correlation.sessionTouchMs,this.config.correlation.sessionIdleMs),this.breadcrumbs=new Ae(this.config.capturePolicy.breadcrumbs);let n=e=>p.i(e,this.config.sampling.defaultRate);this.tracing=new ke(this.diagnostics,this.config.correlation.traceMaxAgeMs||1/0,this.config.otelLoader,{enabled:()=>this.config.tracesEndpoint!==``,keeps:n,onEnd:e=>{n(e.traceId)&&this.recordSpan(nn(e))}}),this.tracing.loadOtel(),this.limits={...this.config.limits},this.console=new ye(this.config.console,this.diagnostics,this.limits),this.drops=new Ht(this.config,this.diagnostics),this.journeyOptions={...f.t,maxAgeMs:this.config.journey.maxAgeMs},this.journey=new f.n(this.journeyOptions,this.diagnostics,this.identity.contextId,e=>{this.bus?.broadcastJourney(e)},this.stores),this.builder=new Qt({remote:this.remote,config:this.config,limits:this.limits,diagnostics:this.diagnostics,context:this.context,journey:this.journey,tracing:this.tracing,sequence:this.sequence,identity:this.identity,platform:this.platform,debug:this.debugBuffer}),this.meter=new _e(()=>this.config.batching.metricFlushIntervalMs,(e,t,n)=>{this.emitPoint(e,t,n)},this.diagnostics,this.config.metrics),this.diagnostics.setHandler(this.diagnosticHandler()),this.syncProfiler()}diagnosticHandler(){return this.config.diagnostics.records===!1?this.config.onDiagnostic:e=>{this.recordDiagnostic(e),this.config.onDiagnostic?.(e)}}recordDiagnostic(e){let{records:t}=this.config.diagnostics;if((t===!0||t!==!1&&t.includes(e.code))&&!this.recordingDiagnostic){this.recordingDiagnostic=!0;try{(dn.has(e.code)?this.diagnosticLogger.info:this.diagnosticLogger.warn)(e.message,{"diagnostic.code":e.code,"diagnostic.count":e.count,"diagnostic.detail":pn(e.detail)})}finally{this.recordingDiagnostic=!1}}}addBreadcrumb(e,t){this.rotating||this.destroyed||this.diagnostics.guard(`record.sanitize_failed`,`The library could not add the breadcrumb.`,()=>{let n={t:Date.now(),category:`custom`,message:c.i(String(e),this.limits.maxBodyChars)};if(t!==void 0){let e=c.n(t,this.limits,this.diagnostics);n.data=r.t(e)?e:{value:e}}this.breadcrumbs.push(n)})}recordMetric(e,t,n){!this.destroyed&&!this.rotating&&this.meter.record(e,t,n)}startMeasure(e,t){let n=this.identityEpoch,r=()=>!this.destroyed&&!this.rotating&&(!this.config.securityContext.isolation||this.identityEpoch===n),i=this.diagnostics.guard(`record.sanitize_failed`,`The library could not read the attributes of the measure.`,()=>({...t}));return Kt(this.diagnostics.guard(`record.sanitize_failed`,`The library could not read the name of the measure.`,()=>`${e}`)??``,i??{},this.tracing.request().span,{metric:(e,t,n)=>{r()&&this.recordMetric(e,t,n)},span:e=>{r()&&this.recordSpan(e)}})}recordSpan(t){if(this.config.tracesEndpoint===``)return;let{record:n}=this.builder.build({level:`INFO`,type:`span`,body:t.name,namespace:e.Jn,payload:t.attributes,fixed:rn(t),trace:{traceId:t.traceId,spanId:t.spanId,traceFlags:1}});this.emit(n)}emitPoint(t,n,r){let{record:i}=this.builder.build({level:`INFO`,type:`metric`,body:t,namespace:e.Ft,payload:n,fixed:r,aggregated:!0});this.emit(i)}syncProfiler(){let{enabled:e}=this.config.profiler;if(e===this.profilerOn)return;this.profilerOn=e;let t=o.t();if(!e){t.collect(!1),t.detach();return}let n={capacity:this.config.profiler.maxProbes,intervalMs:()=>this.config.profiler.flushIntervalMs,emit:(e,t,n)=>{this.emitPoint(e,t,n)},diagnostics:this.diagnostics,ready:()=>!this.rotating||this.closingContext,outlier:(e,t)=>{this.breadcrumbs.push({t:Date.now(),category:`profile`,message:`${e} ${String(Math.round(t))} ms`})}};t.attach(n)}setReplay(e){this.replayConsent=e,e?this.replay?.start():this.replay?.stop()}collectPoints(){this.meter.collect(),this.profilerOn&&o.t().collect(!1)}advanceIdentity(){this.identityEpoch++,this.profilerOn&&this.config.securityContext.isolation&&o.t().reset()}busCanAccept=(e,t)=>this.bus?.isRegistered(e,t)??!1;busAccept=(e,t,n)=>{this.destroyed||this.ensureBus().then(r=>{r&&!this.destroyed&&this.diagnostics.guard(`bus.send_failed`,`The bus could not accept a direct message from a child frame.`,()=>{r.acceptDirect(e,t,n)})})};static pinned(){return globalThis[G]??null}static current(){let e=n.local;if(e)return e.destroyed?null:e;let t=n.pinned();return t&&gn(t)?t:null}static stopped(){let e=n.local;if(e?.destroyed)return e;let t=globalThis[K];return t&&gn(t)?t:null}isDestroyed(){return this.destroyed}static configure(e,t=!1){let r=n.local;if(r&&!r.destroyed)return r.reconfigure(e),r;n.local=null;let i=n.pinned();if(i){if(!gn(i))return n.startDegraded(e,i.sdkVersion);if(!i.destroyed)return i.reconfigure(e),i}let a=new n(e);return a.tunablesLocked=!t,globalThis[G]=a,Reflect.deleteProperty(globalThis,K),a.init(),a}static startDegraded(t,r){let i=new n(t,!0);n.local=i;let a=typeof r==`string`?r:`before 0.9.0`;return i.mismatchVersion=a,i.diagnostics.report(`runtime.version_mismatch`,`Another copy of the library, version ${a}, owns the page runtime. This copy, version ${e.Gn}, runs in console-only mode and installs no capture. Load one version of the library on the page.`,{found:a,own:e.Gn}),i.init(),i}reconfigure(e){if(this.rotating){this.diagnostics.report(`config.locked`,`Configuration cannot change during security-context rotation.`);return}if(this.config.lockConfiguration){let t=B(e,this.diagnostics,this.config);J(this.config,t)||this.diagnostics.report(`config.locked`,`Runtime configuration is locked. Use setConfigurationLocked(false) to unlock it explicitly.`);return}C(this);let t=this.keepDestination(this.keepRouting(this.allowed(e)));!this.tunablesLocked&&t.securityContext?.id&&(this.explicitSecurityContext=!0);for(let e of[`correlation`,`persistence`])(e!==`persistence`||this.tunablesLocked||this.senderLoad!==void 0)&&t[e]&&!J({...this.config[e],...t[e]},this.config[e])&&(this.diagnostics.report(`config.invalid`,`${e} cannot change after startup.`),Object.assign(t,{[e]:this.config[e]}));let n=B(t,this.diagnostics,this.config);this.keepStartupTunables(n);let{redact:r,processors:i}=this.config;zt(this.config,n),(this.config.redact!==r||this.config.processors!==i)&&this.debugBuffer.clear(),this.breadcrumbs.resize(this.config.capturePolicy.breadcrumbs),this.diagnostics.setHandler(this.diagnosticHandler()),this.diagnostics.setPolicy(this.config.diagnostics.throttleMs,this.config.diagnostics.consoleFallback),this.builder.invalidateResource(),this.console.update(this.config.console),this.keepBuiltStorage(),this.keepBuiltIdentity(),this.syncProfiler(),this.refreshCaptures(),this.roleResolved&&this.syncSender(),this.diagnostics.report(`config.reconfigured`,`A later configure() call updated the runtime.`)}onServer(){return this.platform.platform===`node`}allowed(e){return this.degraded?(this.onServer()&&!this.serverReported&&hn(e)&&(this.serverReported=!0,this.diagnostics.report(`config.invalid`,`The library runs console-only on Node. It sends no record and installs no capture. It ignores endpoint, metricsEndpoint, tracesEndpoint, transport and transportWorker.`)),mn(e)):e}keepRouting(e){if(!this.tunablesLocked||this.degraded||!this.config.securityContext.isolation)return e;let t=B(e,new V,this.config),n=un.filter(e=>!J(t[e],this.config[e]));if(t.securityContext.id!==this.config.securityContext.id&&n.push(`securityContext.id`),n.length===0)return e;let r={...e};for(let e of un)n.includes(e)&&Reflect.deleteProperty(r,e);if(n.includes(`securityContext.id`)){let t={...e.securityContext};Reflect.deleteProperty(t,`id`),r.securityContext=t}return this.diagnostics.report(`config.invalid`,`Isolation refuses changes to ${n.join(`, `)}. Use rotateSecurityContext() for these changes. To permit them, set securityContext.isolation: false in a separate configure() call. The other settings apply.`),r}keepStartupTunables(e){if(this.senderLoad!==void 0&&this.keepSections(e,cn),!this.tunablesLocked){this.tunablesLocked=!0,Object.assign(this.limits,e.limits),this.journeyOptions.maxAgeMs=e.journey.maxAgeMs;return}this.keepSections(e,[`limits`]);let{maxAgeMs:t}=this.config.journey;e.journey.maxAgeMs!==t&&(this.diagnostics.report(`config.invalid`,`journey.maxAgeMs cannot change after startup. It stays ${String(t)}.`,{requested:e.journey.maxAgeMs}),e.journey.maxAgeMs=t);let{maxProbes:n}=this.config.profiler;e.profiler.maxProbes!==n&&(this.diagnostics.report(`config.invalid`,`profiler.maxProbes cannot change after startup. It stays ${String(n)}.`,{requested:e.profiler.maxProbes}),e.profiler.maxProbes=n)}keepSections(e,t){for(let n of t)J(e[n],this.config[n])||(this.diagnostics.report(`config.invalid`,`${n} cannot change after startup. The current values stay.`,{requested:e[n]}),Object.assign(e,{[n]:this.config[n]}))}keepBuiltStorage(){let e=this.storageBuiltAs;e!==void 0&&this.config.storage!==e&&(this.diagnostics.report(`config.invalid`,`storage cannot change after startup. It stays ${e}.`,{requested:this.config.storage}),this.config.storage=e)}keepDestination(e){if(this.senderLoad===void 0)return e;let t=e;for(let n of[`transport`,`transportWorker`])n in e&&e[n]===void 0!=(this.config[n]===void 0)&&(this.diagnostics.report(`config.invalid`,`You cannot add or remove ${n} after the delivery stack loads. The current transport stays.`),t={...t},Reflect.deleteProperty(t,n));return(t.endpoint===null||t.endpoint===``)&&this.config.transport===void 0&&(this.diagnostics.report(`config.invalid`,`You cannot remove the endpoint after the delivery stack loads. The current endpoint stays.`),t={...t,endpoint:void 0}),t}keepBuiltIdentity(){let e=this.identityBuiltAs;this.config.identity!==e&&(this.diagnostics.report(`config.invalid`,`identity cannot change after startup. It stays ${e}.`,{requested:this.config.identity}),this.config.identity=e)}async init(){this.degraded||addEventListener(`pagehide`,this.onPageHide);let e=this.installCaptures();this.started=this.boot(),await this.started,await e}async boot(){try{let e=this.journey.bootstrap();this.config.bus.mode!==`off`&&await this.ensureBus(),this.roleResolved=!0,await this.syncSender(),await e}catch(e){this.diagnostics.report(`pipeline.crashed`,`Startup failed. The runtime continues with reduced function.`,void 0,e)}finally{this.ready=!0,this.releaseBootBuffer()}}ensureBus(){return this.busLoad??=this.startBus(),this.busLoad}constructBus(){return this.busBuilt??=this.buildBus(),this.busBuilt}async startBus(){let e=await this.constructBus();if(!e)return null;try{return await e.start(),e}catch(e){return this.diagnostics.report(`pipeline.crashed`,`The bus did not start. This context sends its own records.`,void 0,e),null}}async buildBus(){try{let{Bus:e}=await Promise.resolve().then(()=>require("./bus-D_7pd7RN.cjs"));if(this.destroyed)return null;let t=new e(this.config,this.diagnostics,this.platform,this.identity.contextId,this.identity.tabId,{onSecurityContext:e=>{if(this.explicitSecurityContext&&this.config.securityContext.id!==e)return this.contextMismatch=!0,this.diagnostics.report(`security.context_mismatch`,`The configured security context differs from the upstream owner.`),!1;if(this.contextMismatch=!1,this.config.securityContext.id!==e){if(this.ownerAdopted){C(this),this.drops.add(`security_context`,[...this.bootBuffer.take(),...this.pendingRecords.take(),...this.forwardBuffer]),this.forwardBuffer=[],this.context.clear(),this.breadcrumbs.clear();let e=this.rotating;this.rotating=!0,this.collectPoints(),this.profilerOn&&o.t().reset();let t=this.sessionTouch.stored();this.resetSession(t!==void 0&&t!==this.identity.sessionId?t:l.i(this.diagnostics)),this.rotating=e,this.advanceIdentity(),this.remote.sampling=null,this.refreshCaptures()}this.config.securityContext.id=e}return this.ownerAdopted=!0,!0},onRecords:e=>{this.ingestForwarded(e)},onJourney:e=>{this.journey.applyRemote(e)},onJourneyRequest:()=>this.journey.current(),onTabConflict:()=>{this.regenerateTabId()},remote:this.remote});return this.bus=t,t}catch(e){return this.diagnostics.report(`pipeline.crashed`,`The bus did not load. This context sends its own records.`,void 0,e),null}}role(){return this.bus?.getRole()??`sender`}syncSender(){return!this.hasDestination()||this.role()!==`sender`?Promise.resolve():this.loadSender()}hasDestination(){return!!this.config.endpoint||this.config.transport!==void 0}loadSender(){return this.senderLoad??=this.buildSender(),this.senderLoad}async buildSender(){this.storageBuiltAs=this.config.storage;try{let{Sender:e}=await Promise.resolve().then(()=>require("./sender-Bfpv9tad.cjs")),t=this.destroyed?null:await e.create({storage:this.memoryStorage,onStorage:e=>{e.name===`memory`&&(this.memoryStorage=e)},onPersistence:e=>{this.storagePersistence=e},config:this.config,diagnostics:this.diagnostics,onGap:this.reportGap,onLoss:this.reportLoss,remote:this.remote,beforeExit:()=>{C(this),this.collectPoints(),this.tracing.end()}});if(!t||this.destroyed){await t?.destroy();return}this.sender=t}catch(e){this.senderLoad=void 0,this.diagnostics.report(`pipeline.crashed`,`The delivery stack did not load. The library does not send records.`,{held:this.pendingRecords.length},e),this.drops.add(`load_failed`,this.pendingRecords.records)}for(let e of this.pendingRecords.take())this.sender?.push(e)}refreshCaptures(){if(clearTimeout(this.remoteCaptureTimer),this.remoteCaptureTimer=void 0,this.destroyed)return;let e=this.remote.sampling?.wire();e&&(this.remoteCaptureTimer=setTimeout(()=>{this.refreshCaptures()},e.ttlMs),i.t(this.remoteCaptureTimer)),this.captureState(this.effectiveCapture())!==this.installedCaptureKey&&this.installCaptures()}captureState(e){let{enabled:t,framePhases:n,framePacing:r}=this.config.profiler;return`${fn(e)}${String(t&&n)}${String(t&&r)}${this.replayState(e)}`}replayState(e){let{replay:t}=this.config;return t.enabled?JSON.stringify([t.loader&&W(t.loader),t.onSegment&&W(t.onSegment),W(t.recordOptions),t.endpoint,t.requireConsent,t.mode,t.maskText,t.maskInputs,t.maskSelectors,t.blockSelectors,t.recordCanvas,t.bufferMs,t.plugins.map(W),e.fullUrls,e.ignoreUrls.map(String)]):``}effectiveCapture(){let t={...this.config.capture},n=this.remote.sampling?.current()?.capture;for(let r of e.nn){let e=n?.[r];if(t.remoteToggles.includes(r)&&e!==void 0){if(e&&typeof t[r]==`object`)continue;t[r]=e}}return t}async installCaptures(){if(this.degraded)return;let t=++this.captureGeneration,n=this.effectiveCapture();this.installedCaptureKey=this.captureState(n);let r=this.replayState(n);r!==this.replayBuiltKey&&(this.replayBuiltKey=``);let i=r!==``&&r===this.replayBuiltKey?this.replay:void 0,a=[],{profiler:o}=this.config;(n.errors||n.rejections||n.resourceErrors)&&a.push(`errors`),(n.fetch||n.xhr)&&a.push(`network`),(n.interactions||n.navigation)&&a.push(`interactions`),n.webVitals&&a.push(`webVitals`),n.longFrames&&a.push(`longFrames`),(Array.isArray(n.console)?n.console.length>0:n.console)&&a.push(`console`),n.uncleanExit&&a.push(`uncleanExit`),n.userTiming&&a.push(`userTiming`),n.reports&&a.push(`reports`),n.resourceTiming&&a.push(`resourceTiming`),n.lifecycle&&a.push(`lifecycle`),o.enabled&&o.framePhases&&a.push(`framePhases`),o.enabled&&o.framePacing&&a.push(`framePacing`),this.config.replay.enabled&&!i&&a.push(`replay`);let[s,c]=await Promise.all([Promise.all(a.map(e=>this.loadCapture(e))),n.webSocket?this.loadWebSocket():void 0]);if(t!==this.captureGeneration||this.destroyed)return;this.uninstallCaptures(i);let l={isActive:()=>!this.destroyed&&!this.rotating,config:Object.assign(Object.create(this.config),{capture:n}),diagnostics:this.diagnostics,breadcrumbs:this.breadcrumbs,tracing:this.tracing,logger:new T(()=>this,e.N),once:this.captureOnce,recordMetric:(e,t,n)=>{this.recordMetric(e,t,n)},recordSpan:e=>{this.recordSpan(e)},sessionId:()=>this.identity.sessionId,onError:e=>{this.errorHook=e},setContext:(e,t)=>{t===void 0?this.context.remove(e):this.context.set(e,t)},replayConsent:()=>this.replayConsent};s.forEach((e,t)=>{if(e){let n=new e(l);this.captures.push(n),a[t]===`replay`&&(this.replay=n,this.replayBuiltKey=r)}});let u=c?[...n.plugins,new c(this.diagnostics,l.config)]:n.plugins;for(let e of u)this.captures.push(this.pluginCapture(e));for(let e of this.captures)this.diagnostics.guard(`capture.install_failed`,`The library could not install the ${e.name} capture.`,()=>{e.install()})}uninstallCaptures(e){for(let t of this.captures)t!==e&&this.diagnostics.guard(`capture.install_failed`,`The library could not uninstall the ${t.name} capture.`,()=>{t.uninstall()});this.captures.length=0,this.replay=e,e&&this.captures.push(e)}loadWebSocket(){return this.diagnostics.guardAsync(`capture.install_failed`,`The library could not load the webSocket capture.`,async()=>(await Promise.resolve().then(()=>require("./web-socket-BTuvYoJI.cjs"))).WebSocketCapture)}pluginCapture(t){let{name:n}=t,r=(e,t,n)=>{this.recordMetric(e,t,n)},i=t=>{this.diagnostics.report(`config.invalid`,e._t,void 0,t)},a={logger:new T(()=>this,`${e.N}.${n}`),counter:(e,t={})=>he(e,t,r,i),histogram:(e,t={})=>ge(e,t,r,i),addBreadcrumb:(e,t)=>{this.addBreadcrumb(e,t)},ownRequest:u.r};return{name:n,install:()=>{t.install(a)},uninstall:()=>{t.uninstall()}}}loadCapture(e){return this.diagnostics.guardAsync(`capture.install_failed`,`The library could not load the ${e} capture.`,an[e])}registerWorker(e,t={}){let n=!1,r;return this.destroyed?()=>void 0:(this.constructBus().then(i=>{!i||this.destroyed||n||(this.diagnostics.guard(`bus.send_failed`,`The library could not register the worker.`,()=>{r=i.attachWorker(e,t)}),this.ensureBus())}),()=>{n=!0,r?.()})}registerFrame(e,t){let n=!1,r;return this.constructBus().then(i=>{!i||this.destroyed||n||(r=this.diagnostics.guard(`bus.send_failed`,`The frame could not be registered.`,()=>i.registerFrame(e,t)),this.ensureBus())}),()=>{n=!0,r?.()}}async destroy(){if(this.destroyed)return;C(this),this.collectPoints(),this.profilerOn&&(this.profilerOn=!1,o.t().detach()),this.tracing.end(),this.destroyed=!0,te(this),clearTimeout(this.remoteCaptureTimer),this.remoteCaptureTimer=void 0,this.degraded||removeEventListener(`pagehide`,this.onPageHide),this.uninstallCaptures();let e=this.sender?.destroy();this.journey.destroy(),this.sendForwarded(),this.bus?.destroy(),this.drops.add(`load_failed`,this.pendingRecords.take()),await e,await this.senderLoad,await this.rotation?.catch(()=>void 0),await this.memoryStorage?.close(),n.pinned()===this&&(Reflect.deleteProperty(globalThis,G),globalThis[K]=this)}emit(e){if(!e||this.destroyed||this.rotating&&!this.closingContext)return;this.sessionTouch.touch(this.identity.sessionId);let t=e.severityText===`ERROR`||e.severityText===`FATAL`,n=t?[...this.debugBuffer.drain(),e]:[e];t&&this.errorHook?.(e);for(let e of n)this.ready?this.route(e):this.bootBuffer.push(e)}route(e){this.role()===`forwarder`?this.forward(e):this.deliver(e)}deliver(e){this.sender?this.sender.push(e):this.senderLoad?this.pendingRecords.push(e):(this.diagnostics.count(`record.dropped_no_destination`),this.hasDestination()&&this.drops.add(`load_failed`,[e]))}dropHeld(e){this.diagnostics.count(`record.dropped_boot_buffer_full`),this.drops.add(`buffer_full`,[e])}forward(e){this.forwardBuffer.push(e),this.forwardScheduled||(this.forwardScheduled=!0,queueMicrotask(()=>{this.forwardScheduled=!1,this.sendForwarded()}))}sendForwarded(){let e=this.forwardBuffer;this.forwardBuffer=[],e.length>0&&this.bus?.sendRecords(e)}ingestForwarded(e){if(this.destroyed)return;if(!Array.isArray(e)){this.diagnostics.count(`record.dropped_malformed`);return}let n=[];for(let r of e){if(!t.n(r)){this.diagnostics.count(`record.dropped_malformed`);continue}if(r.attributes[`uiobs.debug_buffer`]!==!0&&!p.a(r,this.config,this.remote.sampling?.current()??null)){this.diagnostics.count(`record.dropped_by_sampling`);continue}let e=this.builder.redactForwarded(r);e&&n.push(e)}if(this.rotating)this.drops.add(`security_context`,n);else for(let e of n)this.deliver(e)}releaseBootBuffer(){let e=this.bootBuffer.take(),{processors:t,redact:n}=this.config,r=t.length===0&&n===void 0?this.journey.current():null;for(let t of e)r&&!t.attributes[`journey.id`]&&(t.attributes[`journey.id`]=r.id,t.attributes[`journey.name`]=r.name),this.route(t)}reportLoss=(e,t,n)=>{this.drops.add(e,t,n)};reportGap=(t,n)=>{this.drops.add(t.reason,n.flatMap(e=>e.records),n.map(e=>e.id));let r=Date.now();r-this.lastGapAt<6e4||(this.lastGapAt=r,new T(()=>this,e.In).warn(`stored records were dropped before delivery`,{"gap.batches":t.batches,"gap.records":t.records,"gap.reason":t.reason}))};regenerateTabId(){let e=l.i(this.diagnostics);this.diagnostics.report(`bus.role_resolved`,`Another context uses this tab id. A duplicated tab is the usual cause. The library makes a new tab id.`,{was:this.identity.tabId,now:e}),this.identity.tabId=e,l.a(e,this.diagnostics,this.stores),this.builder.invalidateResource()}newSession(){this.destroyed||(C(this),this.resetSession(l.i(this.diagnostics)))}resetSession(e){this.collectPoints(),this.tracing.rotate(`explicit`),this.journey.end(),this.breadcrumbs.clear(),this.debugBuffer.clear(),this.replay?.reset(),this.identity.sessionId=e,this.sessionTouch.restart(e),this.builder.invalidateResource()}rotateSecurityContext(e,t={}){if(this.rotation)return Promise.reject(Error(`A security-context rotation is already running.`));let n=t.pending??`discard`,i=t.timeoutMs??5e3;return!r.t(e)||!r.t(e.delivery)||![`discard`,`flush`,`retain`,`carry`].includes(n)||!Number.isFinite(i)||i<0||e.id!==void 0&&(typeof e.id!=`string`||e.id.length===0)?Promise.reject(Error(`Invalid security-context rotation options.`)):this.destroyed?Promise.reject(Error(`The runtime has stopped.`)):(C(this),this.rotating=!0,this.rotation=this.rotateContext(e,n,i).finally(()=>{this.rotating=!1,this.rotation=void 0}),this.rotation)}async rotateContext(e,t,n){if(await this.started,this.role()===`forwarder`)throw Error(`Rotate the security context on the upstream owner, or use bus.mode: sender for an independent identity.`);await this.senderLoad;let r=this.config.securityContext.id,i=e.id??l.i(this.diagnostics);if(i===r)throw Error(`A rotation requires a different security-context id.`);let a={...ln,...e.delivery},o=this.diagnostics.snapshot()[`config.invalid`]??0,s=B(this.allowed({...a,securityContext:{id:i}}),this.diagnostics,{...this.config,...ln});if((this.diagnostics.snapshot()[`config.invalid`]??0)!==o)throw Error(`Invalid delivery settings for the next security context.`);let c=e.context?Object.fromEntries(Object.entries(e.context)):void 0,u=new Set([this.config.endpoint,this.config.metricsEndpoint,this.config.tracesEndpoint]),d=new Set([s.endpoint,s.metricsEndpoint,s.tracesEndpoint]);s.capture.ignoreUrls=s.capture.ignoreUrls.filter(e=>!u.has(e)||d.has(e)),this.closingContext=!0;try{this.collectPoints(),this.tracing.end(),this.journey.end()}finally{this.closingContext=!1}let f=[...this.bootBuffer.take(),...this.pendingRecords.take(),...this.forwardBuffer];this.forwardBuffer=[];let p=this.sender;this.sender=void 0,this.senderLoad=void 0;let m=await p?.retire(t,n,r)??{buffered:[],stored:[]};if(this.destroyed)return;let h=[...f,...m.buffered],g=m.stored.flatMap(e=>e.records);t!==`retain`&&t!==`carry`&&this.drops.add(`security_context`,[...h,...g]),s.lockConfiguration=this.config.lockConfiguration,zt(this.config,s),this.advanceIdentity(),this.remote.sampling=null,this.refreshCaptures(),this.context.clear(),c&&this.context.setMany(c),this.breadcrumbs.clear(),this.newSession(),this.builder.invalidateResource(),await this.syncSender(),this.bus?.rotateContext(),this.rotating=!1,t===`carry`&&await this.carry(h,m.stored),this.diagnostics.report(`security.rotated`,`The runtime rotated its security context.`,{pending:t})}async carry(e,t){for(let t of e)this.route(t);this.sender&&await this.sender.adopt(t,this.config.securityContext.id)}async debugBundle(t){let{configSummary:n}=await Promise.resolve().then(()=>require("./debug-bundle-Ex4L_LSP.cjs")),{record:r}=this.builder.build({level:`INFO`,type:`system`,body:`debug bundle`,namespace:e.q,payload:{[e.c]:this.breadcrumbs.snapshot()}},!0),i=r?.attributes??{},a=i[e.c],o=i[e.v];return{createdAt:new Date().toISOString(),sdkVersion:this.sdkVersion,health:t,diagnostics:this.diagnostics.snapshot(),resource:r?.resource??{},pageUrl:typeof o==`string`?o:``,breadcrumbs:Array.isArray(a)?a:[],debugBuffer:this.debugBuffer.snapshot(),config:n(this.config,this.limits,this.diagnostics)}}async health(){let e=this.sender?.stats()??{pending:0,inFlight:0,lastSendAt:null},t=[];this.mismatchVersion&&t.push(`runtime.version_mismatch`),this.contextMismatch&&t.push(`security.context_mismatch`),this.ready&&this.hasDestination()&&this.role()===`sender`&&!this.sender&&t.push(`sender.unavailable`);let{sourcePolicy:n,validation:r,maxMessageBytes:i,maxRecordsPerMessage:a,maxMessagesPerSecond:o,maxTrackedSources:s}=this.config.bus;return{...e,pending:e.pending+this.bootBuffer.length+this.pendingRecords.length+this.forwardBuffer.length,stored:await this.sender?.queueDepth()??0,sdkVersion:this.sdkVersion,owningSdkVersion:this.mismatchVersion,status:this.destroyed?`stopped`:this.rotating?`rotating`:t.length?`degraded`:this.ready?`ready`:`starting`,mode:this.role()===`forwarder`?`forwarder`:this.hasDestination()?`sender`:`console-only`,senderReady:this.sender!==void 0&&!this.destroyed&&!this.rotating,configurationLocked:this.config.lockConfiguration,issues:t,securityContext:{...this.config.securityContext},storagePersistence:this.storagePersistence,bus:{sourcePolicy:n,validation:r,maxMessageBytes:i,maxRecordsPerMessage:a,maxMessagesPerSecond:o,maxTrackedSources:s}}}async stats(){let e=await this.queueDepth(),t=this.sender?.stats()??{pending:0,inFlight:0,lastSendAt:null},n=this.bootBuffer.length+this.pendingRecords.length+this.forwardBuffer.length;return{...t,pending:t.pending+n,stored:e}}async clearPersisted(e){if(await this.senderLoad,this.sender){await this.sender.clearPersisted(e,this.config.securityContext.id);return}let[{createStorage:t,storageName:n},{ContextStorage:r},{storageLimits:i},{clearEmergencyContext:a}]=await Promise.all([Promise.resolve().then(()=>require("./factory-DLFDjdLv.cjs")),Promise.resolve().then(()=>require("./context-storage-BjzeBSxH.cjs")),Promise.resolve().then(()=>require("./storage-BA9RqRO-.cjs")),Promise.resolve().then(()=>require("./emergency-queue-HBpL5r3V.cjs"))]),o=this.config.persistence.namespace,s=this.memoryStorage??await t(this.config.storage,n(o),i(this.config.retention),this.diagnostics,void 0,o),c=new r(s,this.config.securityContext,o);try{e===`namespace`?await c.clearNamespace():await c.clear(),a(this.config.securityContext.id,this.diagnostics,o,e===`namespace`)}finally{s!==this.memoryStorage&&await c.close()}}async queueDepth(){return await this.senderLoad,await this.sender?.queueDepth()??0}async flush(){C(this),this.collectPoints(),this.ready||await this.started,this.role()===`forwarder`?this.sendForwarded():(await this.senderLoad,await this.sender?.flush())}};function J(e,t,n=new WeakMap){if(Object.is(e,t))return!0;if(e instanceof RegExp&&t instanceof RegExp)return String(e)===String(t);if(typeof e!=`object`||!e||typeof t!=`object`||!t)return!1;if(n.has(e))return n.get(e)===t;n.set(e,t);let r=Object.keys(e),i=Object.keys(t);return r.length===i.length&&r.every(r=>Object.hasOwn(t,r)&&J(Reflect.get(e,r),Reflect.get(t,r),n))}var Y;function _n(t={}){if(Y)return Y;let n=new V(t.onDiagnostic);if(typeof document<`u`||typeof addEventListener!=`function`)return n.report(`config.invalid`,`Call serveTransportWorker() in a dedicated worker.`),()=>void 0;let i=!1,a,o,s=t=>{n.guard(`transport.http_error`,`The transport worker could not read its connection.`,()=>{let s=t.data;if(!r.t(s)||s.p!==`ui-observability.transport/1`||s.t!==e.Qn.connect||t.ports.length===0)return;let c=t.ports[0];a||s.v!==`0.12.0`?(c.postMessage(e.Zn),c.close()):(a=c,Promise.resolve().then(()=>require("./worker-server-4en-Lt-3.cjs")).then(e=>{i||(o=e.serveWorkerPort(c,n))}).catch(t=>{n.report(`transport.http_error`,`The transport worker delivery module could not load.`,void 0,t),n.guard(`transport.http_error`,`The failed transport port could not be closed.`,()=>{c.postMessage(e.Zn),c.close()})}))})},c=()=>{i||(i=!0,Y=void 0,removeEventListener(`message`,s),o?.(),n.guard(`transport.http_error`,`The transport service could not close its port.`,()=>{a?.postMessage(e.Zn)}),n.guard(`transport.http_error`,`The transport port could not close.`,()=>{a?.close()}))};return addEventListener(`message`,s),Y=c,c}function vn(){let e=[],t=[],n={status:200};return{transport:r=>(e.push(r),n.status>=200&&n.status<300&&t.push(r),Promise.resolve({...n})),records:()=>t.flatMap(e=>[...e.records]),batches:()=>[...e],clear:()=>{e.length=0,t.length=0},respondWith:(e,t)=>{n=t===void 0?{status:e}:{status:e,retryAfterMs:t}}}}var X=new Map;function Z(){return(q.current()??q.stopped())||q.configure({},!0)}function yn(e=`context`){return[`context`,`namespace`].includes(e)?Z().clearPersisted(e):Promise.reject(Error(`Invalid persistence scope.`))}function bn(e){q.configure(e),Q()}function xn(e){Z().setConfigurationLocked(e)}function Sn(e,t){return Z().rotateSecurityContext(e,t)}async function Cn(){let e=Z();return Q(),{...await e.health(),loggerCache:{...e.config.loggerCache,size:X.size}}}async function wn(){let e=await Cn();return Z().debugBundle(e)}function Q(){let e=(q.current()??q.stopped())?.config.loggerCache.maxEntries,t=e===void 0?256:e;if(t!==null)for(let e of X.keys()){if(X.size<=t)break;X.delete(e)}return t}function Tn(e,t){let n=Q();if(t||n===0)return new T(Z,e,t);let r=X.get(e);return r??=new T(Z,e),X.delete(e),X.set(e,r),Q(),r}function $(){return Tn(`app`)}function En(e,t){$().trace(e,t)}function Dn(e,t){$().debug(e,t)}function On(e,t){$().info(e,t)}function kn(e,t){$().warn(e,t)}function An(e,t,n){$().error(e,t,n)}function jn(e,t,n){$().fatal(e,t,n)}function Mn(e,t){$().logAction(e,t)}function Nn(e,t){$().logEvent(e,t)}function Pn(e,t,n,r,i){$().logMetric(e,t,n,r,i)}function Fn(t){q.current()?.diagnostics.report(`config.invalid`,e._t,void 0,t)}function In(e,t={}){return he(e,t,(e,t,n)=>{Z().recordMetric(e,t,n)},Fn)}function Ln(e,t={}){return ge(e,t,(e,t,n)=>{Z().recordMetric(e,t,n)},Fn)}function Rn(e,t){return Z().startMeasure(e,t)}function zn(){Z().setReplay(!0)}function Bn(){Z().setReplay(!1)}var Vn={probe:(e,t)=>o.t().probe(e,t,q.current()?.diagnostics),time:(e,t)=>o.t().time(e,t,q.current()?.diagnostics)};function Hn(e,t,n){return $().timeSync(e,t,n)}function Un(e,t,n){return $().timeAsync(e,t,n)}function Wn(e,t){Z().addBreadcrumb(e,t)}function Gn(e,t){Z().context.set(e,t)}function Kn(e){Z().context.setMany(e)}function qn(e){Z().context.remove(e)}function Jn(e,t){return Z().journey.start(e,t)}function Yn(){Z().journey.end()}function Xn(){return Z().journey.current()}function Zn(){return Z().journey.getToken()}function Qn(e){return Z().journey.adopt(e,`manual`,!0)}function $n(e,t){return Z().registerWorker(e,t)}function er(e,t){return Z().registerFrame(e,t)}function tr(){Z().tracing.rotate(`explicit`)}function nr(){return Z().tracing.headers()}function rr(){return Z().flush()}function ir(){return Z().queueDepth()}function ar(){return Z().stats()}function or(){Z().newSession()}function sr(){return Z().diagnostics.snapshot()}async function cr(){await q.current()?.destroy()}exports.OneLogger=T,exports.addBreadcrumb=Wn,exports.adoptJourney=Qn,exports.clearPersistedLogs=yn,exports.collectDebugBundle=wn,exports.configure=bn,exports.counter=In,exports.createMemoryTransport=vn,exports.currentJourney=Xn,exports.debug=Dn,exports.endJourney=Yn,exports.error=An,exports.fatal=jn,exports.flush=rr,exports.getDiagnosticCounters=sr,exports.getHealth=Cn,exports.getJourneyToken=Zn,exports.getLogger=Tn,exports.getQueueDepth=ir,exports.getStats=ar,exports.getTraceHeaders=nr,exports.histogram=Ln,exports.info=On,exports.logAction=Mn,exports.logEvent=Nn,exports.logMetric=Pn,exports.newSession=or,exports.profiler=Vn,exports.registerFrame=er,exports.registerWorker=$n,exports.removeContext=qn,exports.rotateSecurityContext=Sn,exports.serveTransportWorker=_n,exports.setConfigurationLocked=xn,exports.setContext=Gn,exports.setContextMap=Kn,exports.shutdown=cr,exports.startJourney=Jn,exports.startMeasure=Rn,exports.startReplay=zn,exports.startTrace=tr,exports.stopReplay=Bn,exports.timeAsync=Un,exports.timeSync=Hn,exports.trace=En,exports.warn=kn;
1
+ Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require("./constants-CqdJhTxH.cjs"),t=require("./log-record-CkivuiEl.cjs"),n=require("./error-like-gGRx2s36.cjs"),r=require("./guards-EjG3ahFp.cjs"),i=require("./unref-CU9Nyz_9.cjs"),a=require("./platform-CfA3-7sJ.cjs"),o=require("./defineProperty-X1c4tIPD.cjs"),s=require("./identity-DlWRIuwy.cjs"),c=require("./profiler-D4tJpDRc.cjs"),l=require("./library-console-CPW6bvZH.cjs"),u=require("./sanitize-DQyiI_KY.cjs"),d=require("./library-request-D7OvTxZV.cjs"),f=require("./config-DUs7uHHt.cjs"),p=require("./batch-mmPigCpi.cjs"),m=require("./journey-B4Adltjm.cjs"),h=require("./sampling-mXt4dstx.cjs");var g=new WeakMap;function _(e){let t=e.idle;t!==void 0&&(e.diagnostics.guard(`pipeline.crashed`,`The idle callback could not be cancelled.`,()=>{cancelIdleCallback(t)}),e.idle=void 0),clearTimeout(e.timer),e.timer=void 0}function v(t,n){typeof requestIdleCallback==`function`&&typeof cancelIdleCallback==`function`&&(n.idle=n.diagnostics.guard(`pipeline.crashed`,`The idle callback could not be scheduled.`,()=>requestIdleCallback(e=>{y(t,n,e)},{timeout:e.K})),n.idle!==void 0)||(n.timer=setTimeout(()=>{y(t,n)},0),i.t(n.timer))}function y(e,t,n){if(g.get(e)!==t||t.draining)return;_(t),t.draining=!0;let r=t.work;t.work=[];let i=0;for(;i<r.length&&(!n||n.didTimeout&&i===0||n.timeRemaining()>0);)if(t.diagnostics.guard(`pipeline.crashed`,`The library could not build a deferred record.`,r[i]),i++,g.get(e)!==t)return;t.work=[...r.slice(i),...t.work],t.draining=!1,t.work.length>0?v(e,t):g.delete(e)}function b(t,n,r,i){let a=g.get(t),o=i===null?e.q:Math.min(i,e.q);if(a&&a.work.length>=o&&!a.draining&&(y(t,a),a=g.get(t)),a){if(a.work.length>=o){r.count(`record.dropped_by_ceiling`);return}a.work.push(n)}else a={work:[n],diagnostics:r,draining:!1},g.set(t,a),v(t,a)}function x(e){let t=g.get(e);t&&y(e,t)}function S(e){let t=g.get(e);if(t){_(t),g.delete(e);for(let e of t.work)t.diagnostics.count(`record.dropped_by_ceiling`);t.work=[]}}var C=[e.P,e.Gn,e.J];function w(e,t){let r=t.guard(`record.sanitize_failed`,`The library could not read the error reason.`,()=>{if(!(e instanceof Error)&&!n.r(e))return;let t=Error(e.message);return t.name=e.name,t.stack=e.stack,t});if(r)return r;let i=t.guard(`record.sanitize_failed`,`The library could not convert the error reason to text.`,()=>String(e));return Error(i??typeof e)}function ee(e,t,n){return n.guard(`record.sanitize_failed`,`The library could not read the error reason.`,()=>e instanceof Error?e:t)??t}function te(e,t){if(typeof e==`number`||typeof e==`boolean`||typeof e==`bigint`||typeof e==`symbol`)return e;if(typeof e==`object`&&e)return t.guard(`record.sanitize_failed`,`The library could not read the properties of the error reason.`,()=>{let t=e,r=n.r(e),i={},a=0;for(let e of Object.keys(t)){let o=t[e];r&&n.t.has(e)||!n.n(o)||(i[e]=o,a++)}return a===0?void 0:i})}function ne(e){if(!r.n(e)||e instanceof Error)return!1;let t=Object.getPrototypeOf(e);return t===null||Object.getPrototypeOf(t)===null}function re(e){return C.some(t=>e===t||e.startsWith(`${t}.`))?`system`:`log`}function T(e,t){return e===void 0?{}:t.guard(`record.sanitize_failed`,`The library could not read the payload.`,()=>({...e}))??{"uiobs.sanitize_failed":!0}}var E=class n{constructor(e,t,n={}){o.t(this,`bind`,void 0),o.t(this,`namespace`,void 0),o.t(this,`options`,void 0),o.t(this,`levelType`,void 0),o.t(this,`trace`,(e,t)=>{this.write(`TRACE`,this.levelType,e,t)}),o.t(this,`debug`,(e,t)=>{this.write(`DEBUG`,this.levelType,e,t)}),o.t(this,`info`,(e,t)=>{this.write(`INFO`,this.levelType,e,t)}),o.t(this,`warn`,(e,t)=>{this.write(`WARN`,this.levelType,e,t)}),o.t(this,`error`,(e,t,n)=>{this.writeError(`ERROR`,e,t,n)}),o.t(this,`fatal`,(e,t,n)=>{this.writeError(`FATAL`,e,t,n)}),o.t(this,`logAction`,(e,t)=>{this.write(`INFO`,`action`,e,t)}),o.t(this,`logEvent`,(e,t)=>{this.write(`INFO`,`event`,e,t)}),this.bind=e,this.namespace=t,this.options=n,this.levelType=re(t)}child(e,t={}){return new n(this.bind,`${this.namespace}.${e}`,{scopedContext:{...this.options.scopedContext,...t.scopedContext}})}write(e,t,n,r){let i=this.bind();this.submit(i,e,t,a=>{this.writeNow(i,e,t,n,r,!1,a)})}submit(e,n,r,i){if(!e.isDestroyed()){if(e.isRotating())e.diagnostics.count(`record.dropped_during_rotation`);else if(e.config.payloadMode===`defer`&&e.config.enabled&&!e.config.debugBuffer.enabled&&this.namespace!==`uiobs.diagnostics`){if(!e.builder.isEnabled(n,this.namespace,r)&&!this.mirrors(e,n))return;let o=e.journey.current(),s={timeUnixNano:t.r(),trace:e.tracing.resolve(),journey:o?{...o}:null,context:e.context.getAll(),url:a.t(e.diagnostics)};b(e,()=>{i(s)},e.diagnostics,e.config.buffering.maxPendingRecords)}else i()}}writeNow(e,t,n,r,i,a,o){if(!(e.config.enabled&&e.config.debugBuffer.enabled)&&!e.builder.isEnabled(t,this.namespace,n)){this.mirrors(e,t)&&this.print(e,t,r,i,void 0,null,void 0,o);return}let s={snapshot:o,level:t,type:n,body:r,namespace:this.namespace,scoped:this.options.scopedContext,payload:a?i:T(i,e.diagnostics)},{record:c,dropped:l}=e.builder.build(s),u=!!e.config.redact||e.config.processors.length>0,d=n!==`metric`&&e.config.captureLimits.breadcrumbs>0,f=l===`sampling`&&u&&d?e.builder.build(s,!0):void 0,p=c??f?.record??null,m=p?p.body:l===`sampling`&&!u?r:void 0;d&&m!==void 0&&e.breadcrumbs.push({t:o?Number(o.timeUnixNano.slice(0,-6)):Date.now(),category:n===`action`?`action`:n===`event`?`event`:`log`,message:m}),this.print(e,t,r,i,void 0,p,f?.dropped??l,o),e.emit(c)}writeError(e,t,n,r){let i=this.bind();this.submit(i,e,this.levelType,a=>{this.writeErrorNow(i,e,t,n,r,a)})}writeErrorNow(t,n,r,i,a,o){let s=t.builder.isEnabled(n,this.namespace);if(!s&&!this.mirrors(t,n))return;let c=a===void 0&&(t.diagnostics.guard(`record.sanitize_failed`,`The library could not read the error slot.`,()=>ne(i))??!1),l=c?i:a,u=c?void 0:i,d=u===void 0?void 0:w(u,t.diagnostics),f=d===void 0?void 0:ee(u,d,t.diagnostics);if(!s){this.print(t,n,r,l,f,null,void 0,o);return}let p=d?te(u,t.diagnostics):void 0,{record:m,dropped:h}=t.builder.build({snapshot:o,level:n,type:this.levelType,body:r,namespace:this.namespace,scoped:this.options.scopedContext,payload:{...T(l,t.diagnostics),...d?{"error.type":d.name,"error.message":d.message,"error.stack_trace":d.stack}:{},...p===void 0?{}:{[e.d]:p},[e.c]:t.breadcrumbs.snapshot()}});this.print(t,n,r,l,f,m,h,o),t.emit(m)}print(e,t,n,r,i,a,o,s){if(!e.config.redact&&e.config.processors.length===0){e.console.write(this.namespace,t,n,r,i);return}if(a){e.console.write(this.namespace,t,a.body,a.attributes);return}if(o===`processor`||o===`redact`||o===`malformed`||!e.config.enabled||!e.console.accepts(t))return;let c=e.builder.build({snapshot:s,level:t,type:this.levelType,body:n,namespace:this.namespace,scoped:this.options.scopedContext,payload:{...T(r,e.diagnostics),...i?{"error.type":i.name,"error.message":i.message,"error.stack_trace":i.stack}:{}}},!0).record;c&&e.console.write(this.namespace,t,c.body,c.attributes)}mirrors(e,t){return e.config.enabled&&e.console.accepts(t)}},ie=class extends E{constructor(...t){super(...t),o.t(this,`logMetric`,(t,n,r=e.G,i=`gauge`,a,o)=>{if(!Number.isFinite(n)){this.bind().diagnostics.report(`record.dropped_malformed`,`The metric value is not a finite number. The library dropped the metric.`,{"metric.name":t});return}let s=this.bind();this.submit(s,`INFO`,`metric`,c=>{let l=T(a,s.diagnostics),u={...T(o,s.diagnostics),...l,"metric.name":t,"metric.value":n,"metric.unit":r,"metric.type":i,[e.zt.attributeKeys]:Object.keys(l)};this.writeNow(s,`INFO`,`metric`,t,u,!0,c)})})}},ae=/^[0-9a-f]{32}$/,oe=/^[0-9a-f]{16}$/,se=/[1-9a-f]/;function ce(e){return ae.test(e.traceId)&&se.test(e.traceId)&&oe.test(e.spanId)&&se.test(e.spanId)}function le(){return s.o(16)}function D(){return s.o(8)}function O(e){return{traceId:le(),spanId:D(),traceFlags:1,startedAt:Date.now(),reason:e,ended:!1}}function k(e,t,n){return`00-${e}-${t}-${(n&255).toString(16).padStart(2,`0`)}`}function ue(e){return{traceId:e.traceId,spanId:e.spanId,traceFlags:e.traceFlags}}var de=class{constructor(t,n=e.nr,r,i){o.t(this,`diagnostics`,void 0),o.t(this,`maxAgeMs`,void 0),o.t(this,`load`,void 0),o.t(this,`spans`,void 0),o.t(this,`ambient`,O(`start`)),o.t(this,`otel`,void 0),this.diagnostics=t,this.maxAgeMs=n,this.load=r,this.spans=i}setup(e,t){this.maxAgeMs=e,this.load=t}async loadOtel(){if(this.load)try{this.otel=await this.load()}catch(e){this.diagnostics.report(`trace.otel_failed`,`The library could not load @opentelemetry/api. Records use the trace ids of the library.`,void 0,e)}}resolve(){return this.activeSpanContext()??this.ambientContext()}ambientContext(){return Date.now()-this.ambient.startedAt>this.maxAgeMs&&this.rotate(`maxAge`),ue(this.ambient)}activeSpanContext(){let e=this.otel;if(e)return this.diagnostics.guard(`trace.otel_failed`,`The library could not read the active OpenTelemetry span.`,()=>{let t=e.trace.getActiveSpan();if(t===void 0)return;let n=t.spanContext();if(ce(n))return{traceId:n.traceId,spanId:n.spanId,traceFlags:n.traceFlags}})}rotate(e){let t=this.ambient;this.ambient=O(e);let n=ue(this.ambient);return this.finish(t),n}end(){this.finish(this.ambient)}finish(e){e.ended||(e.ended=!0,this.spans?.onEnd({traceId:e.traceId,spanId:e.spanId,reason:e.reason,startedAt:e.startedAt,endedAt:Date.now()}))}headers(){return this.trace(!1).headers}request(){return this.trace(!0)}trace(t){let n={},r=this.otel;if(r&&this.diagnostics.guard(`trace.otel_failed`,`The library could not add the OpenTelemetry headers.`,()=>{r.propagation.inject(r.context.active(),n)}),n.traceparent)return{headers:n};let i=this.activeSpanContext(),a=i??this.ambientContext(),o=i?void 0:this.spans;if(!o?.enabled())return n[e.tr]=k(a.traceId,a.spanId,a.traceFlags),{headers:n};let s=o.keeps(a.traceId),c=s?a.traceFlags:a.traceFlags&-2,l=t?D():a.spanId;return n[e.tr]=k(a.traceId,l,c),!t||!s?{headers:n}:{headers:n,span:{traceId:a.traceId,spanId:l,parentSpanId:a.spanId}}}},fe={name:`ui.measure.duration`,kind:`histogram`,unit:`ms`,boundaries:e.Lt},pe={name:`ui.measure.phase.duration`,kind:`histogram`,unit:`ms`,boundaries:e.Lt};function me(e,t,n,r){let i=String(e),a=Date.now(),o=performance.now(),s,c=!1,l=e=>a+e-o,u=(e,a)=>{s&&=(r.metric(pe,e-s.at,{...t,"measure.name":i,"measure.phase":s.name}),n&&r.span({name:s.name,kind:`internal`,traceId:n.traceId,spanId:D(),parentSpanId:n.spanId,startMs:l(s.at),endMs:l(e),error:a,attributes:{"measure.name":i}}),void 0)};return{phase:e=>{if(c)return;let t=performance.now();u(t,!1),s={name:String(e),at:t}},end:(e=`ok`)=>{if(c)return;c=!0;let s=performance.now(),d=e===`error`;u(s,d);let f={...t,"measure.outcome":e};r.metric(fe,s-o,{...f,"measure.name":i}),n&&r.span({...n,name:i,kind:`internal`,startMs:a,endMs:l(s),error:d,attributes:f})}}}function he(e,t,n){let r=`error`;try{let i=t(),a=n.guard(`record.sanitize_failed`,`The library could not read what the function of the measure returned. The measure ends now.`,()=>i?.then);if(typeof a!=`function`)return r=`ok`,i;let o=a.call(i,t=>(e.end(),t),t=>{throw e.end(`error`),t});return r=void 0,o}finally{r!==void 0&&e.end(r)}}var ge=`overflow`,_e=new Set([e.g,e.h,e.a,e.v,e.f,e.p,e.m]);function ve(e={}){let t={};for(let n of Object.keys(e).sort()){if(n.startsWith(`metric.`)||_e.has(n))continue;let r=e[n];(typeof r==`string`||typeof r==`boolean`||typeof r==`number`&&Number.isFinite(r))&&(t[n]=r)}return t}function ye(e,t){if(!Array.isArray(e))return null;let n=t===null?e.length:Math.min(e.length,t+1);return Array.from({length:n},(t,n)=>e[n])}function be(e,t){return Array.isArray(e)&&(t===null||e.length<=t)&&e.every((t,n)=>typeof t==`number`&&Number.isFinite(t)&&(n===0||t>e[n-1]))}function xe(t,n,r){let i={"metric.name":t.name,"metric.unit":t.unit,"metric.type":t.kind,[e.zt.start]:r,[e.zt.attributeKeys]:Object.keys(n.attributes)};return t.kind===`histogram`?{...i,[e.zt.count]:n.count,[e.zt.sum]:n.sum,[e.zt.min]:n.min,[e.zt.max]:n.max,[e.zt.bounds]:t.boundaries,[e.zt.buckets]:n.buckets}:(i[`metric.value`]=t.kind===`gauge`?n.last:n.sum,i)}function Se(e,t){try{return{unit:e.unit,boundaries:e.boundaries}}catch(e){return t(e),{unit:void 0,boundaries:void 0}}}function Ce(e,t,n,r){return{name:e,kind:t,unit:Se(n,r).unit??`count`,boundaries:[]}}function we(e,t,n,r){let i=Ce(e,`counter`,t,r);return{add:(e,t)=>{n(i,e,t)}}}function Te(e,t,n,r){let i=Ce(e,`gauge`,t,r);return{set:(e,t)=>{n(i,e,t)}}}function Ee(t,n,r,i){let{unit:a,boundaries:o}=Se(n,i),s={name:t,kind:`histogram`,unit:a??`count`,boundaries:o??e.Lt,fromApp:o!==void 0};return{record:(e,t)=>{r(s,e,t)}}}var De=class{constructor(e,t,n,r={maxSeries:100,maxInstruments:1e3,maxHistogramBoundaries:50}){o.t(this,`intervalMs`,void 0),o.t(this,`emit`,void 0),o.t(this,`diagnostics`,void 0),o.t(this,`policy`,void 0),o.t(this,`instruments`,new Map),o.t(this,`timer`,null),o.t(this,`startedAt`,0),this.intervalMs=e,this.emit=t,this.diagnostics=n,this.policy=r}record(e,t,n){!Number.isFinite(t)||e.kind===`counter`&&t<0?this.diagnostics.report(`record.dropped_malformed`,`The value of the metric ${e.name} is not valid. The library dropped it.`,{"metric.name":e.name}):this.diagnostics.guard(`record.sanitize_failed`,`The library could not read the attributes of the metric ${e.name}.`,()=>{let r=this.instrumentOf(e);r&&(this.add(r,t,ve(n)),this.arm())})}collect(){this.timer!==null&&(clearTimeout(this.timer),this.timer=null);let e=`${String(this.startedAt)}000000`,t=[...this.instruments.values()];this.instruments.clear();for(let{def:n,series:r}of t)for(let t of r.values())this.emit(n.name,t.attributes,xe(n,t,e))}instrumentOf(t){let n=this.instruments.get(t.name);if(n)return n.def.kind===t.kind?n:(this.diagnostics.report(`record.dropped_malformed`,`The metric ${t.name} is a ${n.def.kind} and a ${t.kind}. The library dropped the value.`,{"metric.name":t.name}),null);let{maxInstruments:r}=this.policy;if(r!==null&&this.instruments.size>=r)return this.diagnostics.count(`record.dropped_by_ceiling`),null;let i=t.fromApp===!0?this.policy.maxHistogramBoundaries:null,a=ye(t.boundaries,i),o=be(a,i);t.kind===`histogram`&&!o&&this.diagnostics.report(`config.invalid`,`The boundaries of the metric ${t.name} must meet metrics.maxHistogramBoundaries and contain finite numbers in ascending order. The library uses the default boundaries.`);let s={def:{...t,boundaries:o?a:[...e.Lt]},series:new Map};return this.instruments.set(t.name,s),s}add(t,n,r){let i=JSON.stringify(r),a=t.series.get(i),o=r,{maxSeries:s}=this.policy;if(!a&&s!==null&&t.series.size>=s&&(i=ge,a=t.series.get(i),o={[e._]:!0}),!a){let e=t.def.kind===`histogram`?t.def.boundaries.length+1:0,r=Array(e).fill(0);a={attributes:o,count:0,sum:0,min:n,max:n,last:n,buckets:r},t.series.set(i,a)}if(a.count+=1,a.sum+=n,a.min=Math.min(a.min,n),a.max=Math.max(a.max,n),a.last=n,a.buckets.length>0){let e=t.def.boundaries.findIndex(e=>n<=e);a.buckets[e===-1?a.buckets.length-1:e]+=1}}arm(){this.timer===null&&(this.startedAt=Date.now(),this.timer=setTimeout(()=>{this.collect()},this.intervalMs()),i.t(this.timer))}},Oe={TRACE:`debug`,DEBUG:`debug`,INFO:`info`,WARN:`warn`,ERROR:`error`,FATAL:`error`},ke=class{constructor(t,n,r=e.on){o.t(this,`settings`,void 0),o.t(this,`diagnostics`,void 0),o.t(this,`limits`,void 0),this.settings=t,this.diagnostics=n,this.limits=r}update(e){this.settings=e}accepts(t){return this.settings.level===null||!r.t(e.kt,this.settings.level)?!1:e.kt[t]>=e.kt[this.settings.level]}write(e,t,n,r,i){if(!this.accepts(t)||typeof console>`u`||l.t())return;let a=`%c[%s]%c[${t}]%c`,{styles:o}=this.settings,s=Oe[t];this.diagnostics.guard(`handler.threw`,`The library could not print to console.${s}.`,()=>{let c=[];i!==void 0&&c.push(i),r!==void 0&&c.push(u.n(r,this.limits,this.diagnostics)),l.n(()=>{console[s](a,o.namespace,e,o[t],``,n,...c)})})}},Ae=class{constructor(){o.t(this,`value`,0)}next(){return++this.value}},je=class{constructor(e){o.t(this,`buffer`,void 0),o.t(this,`pointer`,0),o.t(this,`filled`,!1),o.t(this,`capacity`,void 0),this.capacity=e===0?0:Math.max(e,1),this.buffer=Array(this.capacity)}resize(e){let t=this.snapshot().slice(-e);if(this.capacity=e,this.buffer=Array(e),this.pointer=0,this.filled=!1,e)for(let e of t)this.push(e)}push(e){this.capacity!==0&&(this.buffer[this.pointer]=e,this.pointer=(this.pointer+1)%this.capacity,this.pointer===0&&(this.filled=!0))}retain(e){let t=this.snapshot().filter(e);this.clear();for(let e of t)this.push(e)}clear(){this.buffer.fill(void 0),this.pointer=0,this.filled=!1}snapshot(){return(this.filled?[...this.buffer.slice(this.pointer),...this.buffer.slice(0,this.pointer)]:this.buffer.slice(0,this.pointer)).filter(e=>e!==void 0)}},Me=class{constructor(){o.t(this,`map`,new Map)}merge(e){for(let[t,n]of Object.entries(e))n===null?this.map.delete(t):n!==void 0&&this.map.set(t,n)}remove(e){this.map.delete(e)}clear(){this.map.clear()}getAll(){return Object.fromEntries(this.map)}},Ne=class{constructor(e){o.t(this,`policy`,void 0),o.t(this,`kept`,[]),this.policy=e}push(e){let{enabled:t,maxRecords:n}=this.policy();t&&(this.kept.push({at:Date.now(),record:e}),this.kept.length>=n*2&&(this.kept=this.kept.slice(-n)))}drain(){let t=this.live();return this.kept=[],t.map(({record:t})=>({...t,attributes:{...t.attributes,[e.u]:!0}}))}snapshot(){return this.live().map(({record:e})=>e)}live(){let{enabled:e,maxRecords:t,maxAgeMs:n}=this.policy();if(!e)return this.kept=[],[];let r=n===null?-1/0:Date.now()-n;return this.kept.slice(-t).filter(e=>e.at>=r)}clear(){this.kept=[]}},A=class{constructor(t,n=e.Y,r=!1){o.t(this,`handler`,void 0),o.t(this,`throttleMs`,void 0),o.t(this,`consoleFallback`,void 0),o.t(this,`counters`,new Map),o.t(this,`lastEmitted`,new Map),this.handler=t,this.throttleMs=n,this.consoleFallback=r}setPolicy(e,t){this.throttleMs=e,this.consoleFallback=t}setHandler(e){this.handler=e}count(e,t=1){let n=(this.counters.get(e)??0)+t;return this.counters.set(e,n),n}report(t,n,r,i){let a=this.count(t),o=Date.now();if(o-(this.lastEmitted.get(t)??0)<this.throttleMs)return!1;this.lastEmitted.set(t,o);let s={code:t,message:n,detail:r,cause:i,at:o,count:a},{handler:c}=this;if(!c)return!0;try{l.n(()=>{c(s)})}catch{this.count(`handler.threw`),this.consoleFallback&&typeof console<`u`&&l.n(()=>{console.warn(`${e.jt} The onDiagnostic handler threw an error.`)})}return!0}guard(e,t,n){try{return n()}catch(n){this.report(e,t,void 0,n);return}}async guardAsync(e,t,n){try{return await n()}catch(n){this.report(e,t,void 0,n);return}}snapshot(){return Object.fromEntries(this.counters)}};function j(e,t){e.length<20&&!e.includes(t)&&e.push(t)}var Pe=class{constructor(e,t){o.t(this,`config`,void 0),o.t(this,`diagnostics`,void 0),o.t(this,`pending`,new Map),o.t(this,`scheduled`,!1),o.t(this,`reporting`,!1),o.t(this,`lost`,{}),this.config=e,this.diagnostics=t}add(t,n,r=[],i=n.length){if(i>0&&(this.lost[t]=(this.lost[t]??0)+i),!this.config.onDrop||this.reporting||n.length===0&&r.length===0)return;let a=this.pending.get(t);a||(a={reason:t,records:0,batchIds:[],journeyIds:[],actions:[]},this.pending.set(t,a)),a.records+=i;for(let e of r)j(a.batchIds,e);for(let t of n){let n=p.t(t,e.f);typeof n==`string`&&j(a.journeyIds,n);let r=p.r(t)?t.body:void 0;typeof r==`string`&&j(a.actions,r)}this.scheduled||(this.scheduled=!0,queueMicrotask(()=>{this.flush()}))}counts(){return{...this.lost}}flush(){this.scheduled=!1;let e=[...this.pending.values()];this.pending.clear();let t=this.config.onDrop;if(t){this.reporting=!0;for(let n of e)this.diagnostics.guard(`handler.threw`,`The onDrop hook threw an error.`,()=>{d.r(()=>{l.n(()=>{t(n)})})});this.reporting=!1}}},Fe=class{constructor(e){o.t(this,`onDrop`,void 0),o.t(this,`actions`,{head:[],tail:[]}),o.t(this,`others`,{head:[],tail:[]}),o.t(this,`arrivals`,0),this.onDrop=e}get records(){return this.inOrder()}get length(){let{actions:e,others:t}=this;return e.head.length+e.tail.length+t.head.length+t.tail.length}push(t,n){let r=p.r(t),i=r?this.actions:this.others,a=r?e.j:n,o={record:t,arrival:this.arrivals};if(this.arrivals+=1,i.head.length<100)i.head.push(o);else if(i.tail.push(o),i.head.length+i.tail.length>a){let e=i.tail[0];i.tail.shift(),this.onDrop(e.record)}}take(){let e=this.inOrder();return this.actions={head:[],tail:[]},this.others={head:[],tail:[]},this.arrivals=0,e}inOrder(){let{actions:e,others:t}=this;return[...e.head,...e.tail,...t.head,...t.tail].sort((e,t)=>e.arrival-t.arrival).map(e=>e.record)}},Ie=`error.`,Le=[e.v,e.f,e.p],Re={processor:{label:`A processor`,code:`record.dropped_by_processor`,refused:`processors is not a list of functions. The library drops each record until processors is a list of functions or [].`},redact:{label:`The redact hook`,code:`record.dropped_by_redact`,refused:`redact is not a function. The library drops each record until redact is a function or null.`}},M=e=>typeof e==`number`&&Number.isFinite(e),N=e=>Array.isArray(e)&&e.every(M),P=e=>typeof e==`string`&&/^\d{1,20}$/.test(e),ze=e=>typeof e==`string`&&/^[0-9a-f]{32}$/.test(e),F=e=>typeof e==`string`&&/^[0-9a-f]{16}$/.test(e),Be=e=>e===``||F(e),Ve=e=>e===`counter`,He=e=>e===`histogram`,Ue=e=>e===`client`||e===`internal`,We=e=>e===`error`||e===`unset`,Ge={"metric.type":Ve,"metric.value":M,[e.zt.start]:P},Ke={"metric.type":He,[e.zt.start]:P,[e.zt.count]:M,[e.zt.sum]:M,[e.zt.min]:M,[e.zt.max]:M,[e.zt.bounds]:N,[e.zt.buckets]:N},qe={[e.Hn.kind]:Ue,[e.Hn.parentId]:Be,[e.Hn.start]:P,[e.Hn.end]:P,[e.Hn.status]:We},Je={[e.Hn.linkTraceId]:ze,[e.Hn.linkSpanId]:F};function Ye(t){let n=t[e.g],r=t[e.a];return n===`span`&&r===`uiobs.traces`?[qe,Je]:n!==`metric`||r!==`uiobs.metrics`?[]:t[`metric.type`]===`histogram`?[Ke]:[Ge]}function I(e){let t={};for(let n of Ye(e)){let r=Object.keys(n);if(r.every(t=>n[t](e[t])))for(let n of r)t[n]=e[n]}return t}function L(e){return e}var Xe=class{constructor(e){o.t(this,`deps`,void 0),o.t(this,`resourceCache`,null),this.deps=e}invalidateResource(){this.resourceCache=null}isEnabled(e,t,n){return this.deps.config.enabled&&this.passesLevel(e,t,n)}passesLevel(t,n,r){let{config:i}=this.deps;if(r!==void 0&&e.Ot.includes(r))return!0;let a=this.deps.remote.sampling?.minLevelFor(n)??h.n(n,i);return e.kt[t]>=e.kt[a]}keepForDebug(e){let{config:t,debug:n}=this.deps;if(!n||!t.enabled||!t.debugBuffer.enabled)return;let{record:r}=this.build(e,!0);r&&n.push(r)}build(n,r=!1){let{config:i,diagnostics:o,tracing:s,journey:c,sequence:l,limits:d,remote:f}=this.deps;if(!r&&!this.isEnabled(n.level,n.namespace,n.type))return o.count(`record.dropped_by_level`),this.keepForDebug(n),{record:null,dropped:`level`};let p=n.trace??n.snapshot?.trace??s.resolve(),m=n.snapshot?n.snapshot.journey:c.current(),g=h.o({level:n.level,type:n.type,namespace:n.namespace,journeyId:m?.id??``,traceId:p.traceId,aggregated:n.aggregated},i,f.sampling?.current()??null);if(!r&&!g)return o.count(`record.dropped_by_sampling`),this.keepForDebug(n),{record:null,dropped:`sampling`};let _=l.next(),v=n.snapshot?.url??a.t(o),y=i.metadata.pageUrl?a.i(v,i.capture.fullUrls,i.capture.urlTransform,o):``,b,x=0;try{let e=u.r(n.snapshot?.context??this.deps.context.getAll(),d,o),t=u.r(this.provided(),d,o),r=u.r(n.scoped??{},d,o),i=u.r(n.payload??{},d,o);x=e.bytes+t.bytes+r.bytes+i.bytes,b={...L(e.value),...L(t.value),...L(r.value),...L(i.value)}}catch(t){o.report(`record.sanitize_failed`,`The library could not sanitize the attributes.`,void 0,t),b={[e.y]:!0}}Object.assign(b,n.fixed),b[e.g]=n.type,b[e.h]=_,b[e.a]=n.namespace,b[e.v]=y,m&&(b[e.f]=m.id,b[e.p]=m.name,m.parentId!==void 0&&(b[e.m]=m.parentId));let S=u.i(n.body,d.maxBodyChars);S!==n.body&&o.count(`record.truncated`);let C={timeUnixNano:n.snapshot?.timeUnixNano??t.r(),traceId:p.traceId,spanId:p.spanId,traceFlags:p.traceFlags,severityNumber:e.Vn[n.level],severityText:n.level,body:S,attributes:b,resource:this.resource()},w=this.hookStages();if(w.length>0){let e=this.applyHooks(C,w,n.fixed);if(typeof e==`string`)return{record:null,dropped:e};({record:C,bytes:x}=e)}let ee={[e.g]:n.type,[e.h]:_,[e.a]:n.namespace};return{record:this.fit(C,x,ee,n.fixed)}}redactForwarded(e){let{redact:t}=this.deps.config;if(!t)return e;let n=[[t,`redact`]],r=this.applyHooks(e,n,I(e.attributes));return typeof r==`string`?null:r.record}rehook(t){let{config:n,diagnostics:r,limits:i,remote:o,debug:s}=this.deps,{attributes:c}=t,l=String(c[e.a]),d=this.passesLevel(t.severityText,l,c[e.g]),f=d&&h.a(t,n,o.sampling?.current()??null),p=n.metadata.pageUrl?a.i(String(c[e.v]),n.capture.fullUrls,n.capture.urlTransform,r):``,m=u.i(t.body,i.maxBodyChars);m!==t.body&&r.count(`record.truncated`);let g=I(c),_={...t,body:m,attributes:{...c,[e.v]:p},resource:this.resource()},v=this.applyHooks(_,this.hookStages(),g),y=typeof v==`string`?null:this.fit(v.record,v.bytes,c,g);return f?y:(r.count(d?`record.dropped_by_sampling`:`record.dropped_by_level`),y&&s&&n.enabled&&n.debugBuffer.enabled&&s.push(y),null)}fit(t,n,r,i){let{diagnostics:a,limits:o}=this.deps;if(n<=o.maxRecordBytes)return t;a.report(`record.truncated`,`The attributes are larger than the size limit. The library dropped the caller attributes.`,{bytes:n,body:t.body});let s={[e.g]:r[e.g],[e.h]:r[e.h],[e.a]:r[e.a],[e.s]:!0,[e.o]:n};for(let e of Le)e in t.attributes&&(s[e]=t.attributes[e]);for(let[e,n]of Object.entries(t.attributes))e.startsWith(Ie)&&(s[e]=n);let c=u.r(s,o,a).bytes;c>o.maxRecordBytes&&`error.data`in s&&(Reflect.deleteProperty(s,e.d),c=u.r(s,o,a).bytes);let l=t.attributes[e.c];if(l!==void 0){let t=u.r(l,o,a).bytes;c+t<=o.maxRecordBytes&&(s[e.c]=l)}return Object.assign(s,i),t.attributes=s,t}hookStages(){let{processors:e,redact:t}=this.deps.config,n=e.map(e=>[e,`processor`]);return t&&n.push([t,`redact`]),n}applyHooks(e,t,n){let r=e;for(let[e,n]of t){let t=this.runHook(e,n,r);if(typeof t==`string`)return t;r=t}let{diagnostics:i,limits:a}=this.deps,o=u.r(r.attributes,a,i),s=L(o.value);return Object.assign(s,n),{record:{...r,attributes:s},bytes:o.bytes}}runHook(n,r,i){let{diagnostics:a}=this.deps,{label:o,code:s,refused:c}=Re[r],l;try{l=n(i)}catch(e){return a.report(s,`${o} threw an error. The library dropped the record.`,void 0,e),r}if(l===null)return n===f.t?a.report(s,c):a.count(s),r;let u=l??i;return t.n(u)?t.t(u.severityText)?{...u,severityNumber:e.Vn[u.severityText]}:(a.report(`record.dropped_malformed`,`${o} set a severityText that is not a log level. The library dropped the record.`),`malformed`):u===i?(a.report(`record.dropped_malformed`,`${o} changed the record to a shape that is not a record. The library dropped it.`),`malformed`):(a.report(s,`${o} returned a value that is not a record. The library dropped the record.`),r)}provided(){let e=this.deps.config.contextProvider;if(!e)return{};let{diagnostics:t}=this.deps,n=t.guard(`handler.threw`,`The contextProvider threw an error. The record has no attributes from it.`,()=>{let t=e();return t===void 0?{}:r.n(t)&&typeof t.then!=`function`?t:null});return n===null&&t.report(`config.invalid`,`contextProvider must return an object of attributes. The library ignores the value.`),n??{}}resource(){if(this.resourceCache)return this.resourceCache;let{config:t,identity:n,platform:r}=this.deps;return this.resourceCache={[e.bn]:t.serviceName,[e.xn]:t.serviceVersion,[e.gn]:t.environment,[e.En]:e.$n,[e.Dn]:e.er,[e.Tn]:e.Qn,[e._n]:r.platform,[e.Sn]:n.sessionId,[e.wn]:n.tabId,[e.hn]:n.contextId,...t.metadata.userAgent?{[e.mn]:r.userAgent}:{},...!t.metadata.openfin||r.openfinUuid===void 0?{}:{[e.yn]:r.openfinUuid},...!t.metadata.openfin||r.openfinName===void 0?{}:{[e.vn]:r.openfinName}},this.resourceCache}},Ze=1e3,Qe={start:`ui.start`,interaction:`ui.interaction`,navigation:`ui.navigation`,explicit:`ui.trace`,maxAge:`ui.trace`};function R(e){return`${String(Math.round(e*Ze))}000`}function $e(e){return{name:Qe[e.reason],kind:`internal`,traceId:e.traceId,spanId:e.spanId,parentSpanId:``,startMs:e.startedAt,endMs:e.endedAt,error:!1,attributes:{}}}function et(t){return{[e.Hn.kind]:t.kind,[e.Hn.parentId]:t.parentSpanId,[e.Hn.start]:R(t.startMs),[e.Hn.end]:R(t.endMs),[e.Hn.status]:t.error?`error`:`unset`,...t.link?{[e.Hn.linkTraceId]:t.link.traceId,[e.Hn.linkSpanId]:t.link.spanId}:{}}}var tt={errors:async()=>(await Promise.resolve().then(()=>require("./errors-CNPbesMs.cjs"))).ErrorCapture,network:async()=>(await Promise.resolve().then(()=>require("./network-CGMLQ-mA.cjs"))).NetworkCapture,interactions:async()=>(await Promise.resolve().then(()=>require("./interactions-CUkzK8sR.cjs"))).InteractionCapture,webVitals:async()=>(await Promise.resolve().then(()=>require("./web-vitals-__X7t4pj.cjs"))).WebVitalsCapture,longFrames:async()=>(await Promise.resolve().then(()=>require("./long-frames-BUUbXd-B.cjs"))).LongFrameCapture,console:async()=>(await Promise.resolve().then(()=>require("./console-CSZ5_Vx5.cjs"))).ConsoleCapture,uncleanExit:async()=>(await Promise.resolve().then(()=>require("./unclean-exit-py99ApzT.cjs"))).UncleanExitCapture,userTiming:async()=>(await Promise.resolve().then(()=>require("./user-timing-D6XTmpuM.cjs"))).UserTimingCapture,reports:async()=>(await Promise.resolve().then(()=>require("./reports-BDSe4dFH.cjs"))).ReportCapture,resourceTiming:async()=>(await Promise.resolve().then(()=>require("./resource-timing-C576gFIQ.cjs"))).ResourceTimingCapture,lifecycle:async()=>(await Promise.resolve().then(()=>require("./lifecycle-IaAm1mOC.cjs"))).LifecycleCapture,framePhases:async()=>(await Promise.resolve().then(()=>require("./profiler-frames-C4xr7KfH.cjs"))).FramePhasesCapture,framePacing:async()=>(await Promise.resolve().then(()=>require("./profiler-frames-C4xr7KfH.cjs"))).FramePacingCapture,replay:async()=>(await Promise.resolve().then(()=>require("./replay-B3gFXIZd.cjs"))).ReplayCapture},z=new WeakMap,nt=0;function B(e){let t=z.get(e);return t===void 0&&(t=++nt,z.set(e,t)),t}var V=Symbol.for(e.Mn),H=Symbol.for(e.Nn),rt=[`batching`,`retention`],it=[`log`,`event`,`action`],at=`configure() could not read its options. The library drops each record and installs no capture until a configure() call sets redact to a function or null.`,ot=`shutdown() got invalid options. The library discards the records in memory. An invalid clearStorage removes the "context" scope.`,st=`flush() got invalid options. The library waits the default 5000 ms.`,ct=new Set([`bus.role_resolved`,`config.reconfigured`,`security.rotated`,`journey.adopted`,`journey.expired`]);function lt(e){return JSON.stringify({...e,urlTransform:e.urlTransform?B(e.urlTransform):void 0,webVitals:typeof e.webVitals==`object`?{loader:e.webVitals.loader!==void 0}:e.webVitals,ignoreUrls:e.ignoreUrls.map(String),propagateTraceHeaderTo:e.propagateTraceHeaderTo.map(String),userTiming:typeof e.userTiming==`object`?{include:e.userTiming.include?.map(String)}:e.userTiming,plugins:e.plugins.map(B)})}function ut(e){if(!r.n(e))return e;let t={...e};for(let e of[`url`,`endpoint`]){let n=t[e];typeof n==`string`&&(t[e]=a.i(n,!1))}return t}function dt(e){return{...e,endpoint:null,metricsEndpoint:null,tracesEndpoint:null,transport:null,transportOnExit:null,transportWorker:null,bus:{...e.bus,mode:`off`}}}function ft(e){return!!e.endpoint||!!e.metricsEndpoint||!!e.tracesEndpoint||!!e.transport||!!e.transportWorker}function U(e,t){return{status:e,accepted:0,stored:0,dropped:0,forwarded:0,pending:0,...t}}function W(e){return U(e.pending>0?`timeout`:`complete`,e)}function G(t){return t.sdkVersion===e.er}var K=class n{isRotating(){return this.rotating}setConfigurationLocked(e){typeof e==`boolean`&&(this.config.lockConfiguration=e)}constructor(t,n){o.t(this,`rotating`,!1),o.t(this,`rotationSeq`,0),o.t(this,`profilerOn`,!1),o.t(this,`closingContext`,!1),o.t(this,`mismatchVersion`,null),o.t(this,`contextMismatch`,!1),o.t(this,`rotation`,void 0),o.t(this,`memoryStorage`,void 0),o.t(this,`storagePersistence`,`off`),o.t(this,`recordingDiagnostic`,!1),o.t(this,`diagnosticLogger`,new E(()=>this,e.J)),o.t(this,`debugBuffer`,new Ne(()=>this.config.debugBuffer)),o.t(this,`explicitSecurityContext`,void 0),o.t(this,`ownerAdopted`,!1),o.t(this,`sdkVersion`,e.er),o.t(this,`protocol`,e.M),o.t(this,`diagnostics`,void 0),o.t(this,`config`,void 0),o.t(this,`platform`,void 0),o.t(this,`identity`,void 0),o.t(this,`backing`,s.r()),o.t(this,`stores`,{local:()=>this.backing.local(),session:()=>this.backing.session()}),o.t(this,`identityBuiltAs`,void 0),o.t(this,`sessionTouch`,void 0),o.t(this,`context`,new Me),o.t(this,`breadcrumbs`,void 0),o.t(this,`tracing`,void 0),o.t(this,`sequence`,new Ae),o.t(this,`journey`,void 0),o.t(this,`builder`,void 0),o.t(this,`remote`,{sampling:null,changed:()=>{this.refreshCaptures()}}),o.t(this,`identityEpoch`,0),o.t(this,`errorHook`,void 0),o.t(this,`replayConsent`,void 0),o.t(this,`replay`,void 0),o.t(this,`remoteCaptureTimer`,void 0),o.t(this,`installedCaptureKey`,``),o.t(this,`replayBuiltKey`,``),o.t(this,`console`,void 0),o.t(this,`drops`,void 0),o.t(this,`meter`,void 0),o.t(this,`bus`,null),o.t(this,`busBuilt`,void 0),o.t(this,`busLoad`,void 0),o.t(this,`sender`,void 0),o.t(this,`senderLoad`,void 0),o.t(this,`pendingRecords`,new Fe(e=>{this.dropHeld(e)})),o.t(this,`pausedLoss`,new WeakSet),o.t(this,`carried`,[]),o.t(this,`sessionPicked`,!1),o.t(this,`deliveryClosed`,!1),o.t(this,`parkedSender`,void 0),o.t(this,`retiring`,void 0),o.t(this,`startFailed`,!1),o.t(this,`running`,!1),o.t(this,`openGate`,void 0),o.t(this,`startGate`,new Promise(e=>{this.openGate=e})),o.t(this,`captures`,[]),o.t(this,`captureGeneration`,0),o.t(this,`captureOnce`,{webVitals:!1,navigationTiming:!1,longFrames:!1,uncleanExit:!1,userTiming:!1}),o.t(this,`bootBuffer`,new Fe(e=>{this.dropHeld(e)})),o.t(this,`forwardBuffer`,[]),o.t(this,`forwardScheduled`,!1),o.t(this,`roleResolved`,!1),o.t(this,`started`,Promise.resolve()),o.t(this,`ready`,!1),o.t(this,`destroyed`,!1),o.t(this,`stopping`,void 0),o.t(this,`lastSendAt`,null),o.t(this,`lastGapAt`,0),o.t(this,`limits`,void 0),o.t(this,`journeyOptions`,void 0),o.t(this,`tunablesLocked`,!1),o.t(this,`degraded`,void 0),o.t(this,`serverReported`,!1),o.t(this,`onPageHide`,()=>{x(this),this.dropPaused(),this.role()===`forwarder`&&(this.tracing.end(),this.sendForwarded())}),o.t(this,`busCanAccept`,(e,t)=>this.bus?.isRegistered(e,t)??!1),o.t(this,`busAccept`,(e,t,n)=>{this.destroyed||this.ensureBus().then(r=>{r&&!this.destroyed&&this.diagnostics.guard(`bus.send_failed`,`The bus could not accept a direct message from a child frame.`,()=>{r.acceptDirect(e,t,n)})})}),o.t(this,`reportLoss`,(e,t,n,r)=>{this.drops.add(e,t,n,r)}),o.t(this,`reportGap`,(t,n)=>{this.drops.add(t.reason,n.flatMap(e=>e.records),n.map(e=>e.id));let r=Date.now();r-this.lastGapAt<6e4||(this.lastGapAt=r,new E(()=>this,e.Gn).warn(`stored records were dropped before delivery`,{"gap.batches":t.batches,"gap.records":t.records,"gap.reason":t.reason}))}),this.diagnostics=new A(typeof t.onDiagnostic==`function`?t.onDiagnostic:void 0),this.platform=a.n(this.diagnostics),this.degraded=n||this.onServer(),this.config=f.r(this.allowed(t),this.diagnostics),this.explicitSecurityContext=!!t.securityContext?.id,this.config.securityContext.id||=s.i(this.diagnostics),this.diagnostics.setPolicy(this.config.diagnostics.throttleMs,this.config.diagnostics.consoleFallback),this.identityBuiltAs=this.config.identity,this.identity=s.s(this.diagnostics,this.stores,this.config.correlation.sessionIdleMs),this.sessionTouch=new s.n(this.diagnostics,this.stores,this.config.correlation.sessionIdleMs),this.breadcrumbs=new je(this.config.captureLimits.breadcrumbs);let r=e=>h.i(e,this.config.sampling.defaultRate);this.tracing=new de(this.diagnostics,this.config.correlation.traceMaxAgeMs??1/0,this.config.otelLoader,{enabled:()=>this.config.tracesEndpoint!==null,keeps:r,onEnd:e=>{r(e.traceId)&&this.recordSpan($e(e))}}),this.limits={...this.config.limits},this.console=new ke(this.config.consoleOutput,this.diagnostics,this.limits),this.drops=new Pe(this.config,this.diagnostics),this.journeyOptions={...m.t,maxAgeMs:this.config.journey.maxAgeMs},this.journey=new m.n(this.journeyOptions,this.diagnostics,this.identity.contextId,e=>{this.bus?.broadcastJourney(e)},this.stores),this.builder=new Xe({remote:this.remote,config:this.config,limits:this.limits,diagnostics:this.diagnostics,context:this.context,journey:this.journey,tracing:this.tracing,sequence:this.sequence,identity:this.identity,platform:this.platform,debug:this.debugBuffer}),this.meter=new De(()=>this.config.metrics.intervalMs,(e,t,n)=>{this.emitPoint(e,t,n)},this.diagnostics,this.config.metrics),this.diagnostics.setHandler(this.diagnosticHandler()),this.syncProfiler()}diagnosticHandler(){return this.config.diagnostics.records===!1?this.config.onDiagnostic:e=>{this.recordDiagnostic(e),this.config.onDiagnostic?.(e)}}recordDiagnostic(e){let{records:t}=this.config.diagnostics;if((t===!0||t!==!1&&t.includes(e.code))&&!this.recordingDiagnostic){this.recordingDiagnostic=!0;try{(ct.has(e.code)?this.diagnosticLogger.info:this.diagnosticLogger.warn)(e.message,{"diagnostic.code":e.code,"diagnostic.count":e.count,"diagnostic.detail":ut(e.detail)})}finally{this.recordingDiagnostic=!1}}}addBreadcrumb(e,t){this.rotating||this.destroyed||this.diagnostics.guard(`record.sanitize_failed`,`The library could not add the breadcrumb.`,()=>{let n={t:Date.now(),category:`custom`,message:u.i(String(e),this.limits.maxBodyChars)};if(t!==void 0){let e=u.n(t,this.limits,this.diagnostics);n.data=r.n(e)?e:{value:e}}this.breadcrumbs.push(n)})}recordMetric(e,t,n){!this.destroyed&&!this.rotating&&this.config.enabled&&this.meter.record(e,t,n)}startMeasure(e,t){let n=this.identityEpoch,r=()=>!this.destroyed&&!this.rotating&&(!this.config.securityContext.isolation||this.identityEpoch===n),i=this.diagnostics.guard(`record.sanitize_failed`,`The library could not read the attributes of the measure.`,()=>({...t}));return me(this.diagnostics.guard(`record.sanitize_failed`,`The library could not read the name of the measure.`,()=>`${e}`)??``,i??{},this.tracing.request().span,{metric:(e,t,n)=>{r()&&this.recordMetric(e,t,n)},span:e=>{r()&&this.recordSpan(e)}})}recordSpan(t){if(this.config.tracesEndpoint===null)return;let{record:n}=this.builder.build({level:`INFO`,type:`span`,body:t.name,namespace:e.rr,payload:t.attributes,fixed:et(t),trace:{traceId:t.traceId,spanId:t.spanId,traceFlags:1}});this.emit(n)}emitPoint(t,n,r){if(this.destroyed)return;let{record:i}=this.builder.build({level:`INFO`,type:`metric`,body:t,namespace:e.Bt,payload:n,fixed:r,aggregated:!0});this.emit(i)}syncProfiler(){let e=this.config.profiler.enabled&&this.config.enabled;if(e===this.profilerOn)return;this.profilerOn=e;let t=c.t();if(!e){t.collect(!1),t.detach();return}let n={capacity:this.config.profiler.maxProbes,intervalMs:()=>this.config.metrics.intervalMs,emit:(e,t,n)=>{this.emitPoint(e,t,n)},diagnostics:this.diagnostics,ready:()=>!this.rotating||this.closingContext,outlier:(e,t)=>{this.breadcrumbs.push({t:Date.now(),category:`profile`,message:`${e} ${String(Math.round(t))} ms`})}};t.attach(n)}setReplay(e){this.replayConsent=e,e?this.replay?.start():this.replay?.stop()}collectPoints(){this.meter.collect(),this.profilerOn&&c.t().collect(!1)}advanceIdentity(){this.identityEpoch++,this.profilerOn&&this.config.securityContext.isolation&&c.t().reset(),this.remote.sampling=null,this.refreshCaptures()}static pinned(){return globalThis[V]??null}static current(){let e=n.local;if(e)return e.destroyed?null:e;let t=n.pinned();return t&&G(t)?t:null}static stopped(){let e=n.local;if(e?.destroyed)return e;let t=globalThis[H];return t&&G(t)?t:null}isDestroyed(){return this.destroyed}static configure(e,t=!1){try{return n.startOrUpdate(e,t)}catch(e){let t=n.current();if(t?.tunablesLocked)return t.diagnostics.report(`config.invalid`,`configure() could not read its options. The library keeps the current settings.`,void 0,e),t;let r=t??n.startOrUpdate({},!0);return r.refuse(e),r}}refuse(t){this.startFailed=!0;let n=f.r({redact:f.t},new A,this.config);f.n(this.config,n),l.n(()=>{console.warn(`${e.jt} ${at}`)}),this.diagnostics.report(`config.invalid`,at,void 0,t),this.rehookHeld()}static startOrUpdate(e,t){let r=n.local;if(r&&!r.destroyed)return r.reconfigure(e),r;n.local=null;let i=n.pinned();if(i){if(!G(i))return n.startDegraded(e,i.sdkVersion,t);if(!i.destroyed)return i.reconfigure(e),i}let a=new n(e,!1);return globalThis[V]=a,Reflect.deleteProperty(globalThis,H),t||a.launch(),a}static startDegraded(t,r,i){let a=new n(t,!0);n.local=a;let o=typeof r==`string`?r:`before 0.9.0`;return a.mismatchVersion=o,a.diagnostics.report(`runtime.version_mismatch`,`Another copy of the library, version ${o}, owns the page runtime. This copy, version ${e.er}, runs in console-only mode and installs no capture. Load one version of the library on the page.`,{found:o,own:e.er}),i||a.launch(),a}reconfigure(e){if(this.rotating){this.diagnostics.report(`config.locked`,`Configuration cannot change during security-context rotation.`);return}if(this.config.lockConfiguration){let t=f.r(e,this.diagnostics,this.config);q(this.config,t)||this.diagnostics.report(`config.locked`,`Runtime configuration is locked. Use setConfigurationLocked(false) to unlock it explicitly.`);return}x(this);let t=this.keepDestination(this.keepRouting(this.allowed(e)));!this.tunablesLocked&&t.securityContext?.id&&(this.explicitSecurityContext=!0);let n=f.r(t,this.diagnostics,this.config),r=this.tunablesLocked?[`correlation`,`storage`]:[];for(let e of r)q(n[e],this.config[e])||(this.diagnostics.report(`config.invalid`,`${e} cannot change after startup. The library keeps the current settings.`),Object.assign(n,{[e]:this.config[e]}));this.keepStartupTunables(n);let{redact:i,processors:a,enabled:o}=this.config;o&&!n.enabled&&this.collectPoints(),f.n(this.config,n),this.config.redact!==f.t&&(this.startFailed=!1),(this.config.redact!==i||this.config.processors!==a)&&this.debugBuffer.clear(),this.breadcrumbs.resize(this.config.captureLimits.breadcrumbs),this.diagnostics.setHandler(this.diagnosticHandler()),this.diagnostics.setPolicy(this.config.diagnostics.throttleMs,this.config.diagnostics.consoleFallback),this.builder.invalidateResource(),this.console.update(this.config.consoleOutput),this.keepBuiltIdentity(),this.syncProfiler(),this.launch(),this.running&&o!==this.config.enabled&&this.sender?.hold(!this.config.enabled),this.refreshCaptures(),this.roleResolved&&this.syncSender(),this.diagnostics.report(`config.reconfigured`,`A later configure() call updated the runtime.`)}onServer(){return this.platform.platform===`node`}allowed(e){return this.degraded?(this.onServer()&&!this.serverReported&&ft(e)&&(this.serverReported=!0,this.diagnostics.report(`config.invalid`,`The library runs console-only on Node. It sends no record and installs no capture. It ignores endpoint, metricsEndpoint, tracesEndpoint, transport and transportWorker.`)),dt(e)):e}keepRouting(t){if(!this.tunablesLocked||this.degraded||!this.config.securityContext.isolation)return t;let n=f.r(t,new A,this.config),r=e.An.filter(e=>!q(n[e],this.config[e]));if(n.securityContext.id!==this.config.securityContext.id&&r.push(`securityContext.id`),r.length===0)return t;let i={...t};for(let t of e.An)r.includes(t)&&Reflect.deleteProperty(i,t);if(r.includes(`securityContext.id`)){let e={...t.securityContext};Reflect.deleteProperty(e,`id`),i.securityContext=e}return this.diagnostics.report(`config.invalid`,`Isolation refuses changes to ${r.join(`, `)}. Use rotateSecurityContext() for these changes. To permit them, set securityContext.isolation: false in a separate configure() call. The other settings apply.`),i}keepStartupTunables(e){if(this.senderLoad!==void 0&&this.keepSections(e,rt),!this.tunablesLocked){Object.assign(this.limits,e.limits),this.journeyOptions.maxAgeMs=e.journey.maxAgeMs;return}this.keepSections(e,[`limits`]);for(let t of[`mode`,`openFinRole`])e.bus[t]!==this.config.bus[t]&&(this.diagnostics.report(`config.invalid`,`bus.${t} cannot change after startup. The library keeps "${this.config.bus[t]}".`,{requested:e.bus[t]}),Object.assign(e.bus,{[t]:this.config.bus[t]}));let{maxAgeMs:t}=this.config.journey;e.journey.maxAgeMs!==t&&(this.diagnostics.report(`config.invalid`,`journey.maxAgeMs cannot change after startup. It stays ${String(t)}.`,{requested:e.journey.maxAgeMs}),e.journey.maxAgeMs=t);let{maxProbes:n}=this.config.profiler;e.profiler.maxProbes!==n&&(this.diagnostics.report(`config.invalid`,`profiler.maxProbes cannot change after startup. It stays ${String(n)}.`,{requested:e.profiler.maxProbes}),e.profiler.maxProbes=n)}keepSections(e,t){for(let n of t)q(e[n],this.config[n])||(this.diagnostics.report(`config.invalid`,`${n} cannot change after startup. The current values stay.`,{requested:e[n]}),Object.assign(e,{[n]:this.config[n]}))}keepDestination(e){if(this.senderLoad===void 0)return e;let t=e;for(let n of[`transport`,`transportWorker`]){let r=e[n],i=typeof r==`function`&&this.config[n]===void 0,a=r===null&&this.config[n]!==void 0;(i||a)&&(this.diagnostics.report(`config.invalid`,`You cannot add or remove ${n} after the delivery stack loads. The current transport stays.`),t={...t},Reflect.deleteProperty(t,n))}return(t.endpoint===null||t.endpoint===``)&&this.config.transport===void 0&&(this.diagnostics.report(`config.invalid`,`You cannot remove the endpoint after the delivery stack loads. The current endpoint stays.`),t={...t,endpoint:void 0}),t}keepBuiltIdentity(){if(!this.tunablesLocked){this.identityBuiltAs=this.config.identity;return}let e=this.identityBuiltAs;this.config.identity!==e&&(this.diagnostics.report(`config.invalid`,`identity cannot change after startup. It stays ${e}.`,{requested:this.config.identity}),this.config.identity=e)}launch(){this.startFailed||(this.tunablesLocked||(this.tunablesLocked=!0,this.config.enabled||this.drops.add(`disabled`,this.rehookHeld())),!this.running&&this.config.enabled&&this.start())}start(){this.running=!0,this.identityBuiltAs===`storage`&&!this.onServer()&&(this.backing=s.t);let{sessionIdleMs:e,traceMaxAgeMs:t}=this.config.correlation,{sessionId:n,tabId:r}=s.s(this.diagnostics,this.stores,e);this.sessionTouch=new s.n(this.diagnostics,this.stores,e),this.sessionPicked?this.sessionTouch.restart(this.identity.sessionId):this.identity.sessionId=n,this.identity.tabId=r,this.builder.invalidateResource(),this.breadcrumbs.retain(e=>!it.includes(e.category)),this.tracing.setup(t??1/0,this.config.otelLoader),this.tracing.loadOtel();for(let e of this.rehookHeld())this.bootBuffer.push(e,this.config.buffering.maxHeldRecords);this.openGate(),this.init()}rehookHeld(){return this.bootBuffer.take().map(e=>this.builder.rehook(e)).filter(e=>e!==null)}async init(){this.degraded||addEventListener(`pagehide`,this.onPageHide);let e=this.installCaptures();this.started=this.boot(),await this.started,await e}async boot(){try{let e=this.journey.bootstrap();this.config.bus.mode!==`off`&&await this.ensureBus(),this.roleResolved=!0,await this.syncSender(),await e}catch(e){this.diagnostics.report(`pipeline.crashed`,`Startup failed. The runtime continues with reduced function.`,void 0,e)}finally{this.ready=!0,this.releaseBootBuffer()}}ensureBus(){return this.busLoad??=this.startBus(),this.busLoad}constructBus(){return this.busBuilt??=this.buildBus(),this.busBuilt}async startBus(){let e=await this.constructBus();if(!e)return null;try{return await e.start(),e}catch(e){return this.diagnostics.report(`pipeline.crashed`,`The bus did not start. This context sends its own records.`,void 0,e),null}}async buildBus(){try{await this.startGate;let{Bus:e}=await Promise.resolve().then(()=>require("./bus-_EaOVPGq.cjs"));if(this.destroyed)return null;let t=new e(this.config,this.diagnostics,this.platform,this.identity.contextId,this.identity.tabId,{onSecurityContext:e=>{if(this.explicitSecurityContext&&this.config.securityContext.id!==e)return this.contextMismatch=!0,this.diagnostics.report(`security.context_mismatch`,`The configured security context differs from the upstream owner.`),!1;if(this.contextMismatch=!1,this.config.securityContext.id!==e){if(this.ownerAdopted){x(this),this.drops.add(`security_context`,[...this.bootBuffer.take(),...this.pendingRecords.take(),...this.forwardBuffer]),this.forwardBuffer=[],this.context.clear(),this.breadcrumbs.clear();let e=this.rotating;this.rotating=!0,this.collectPoints(),this.profilerOn&&c.t().reset();let t=this.sessionTouch.stored();this.resetSession(t!==void 0&&t!==this.identity.sessionId?t:s.i(this.diagnostics)),this.rotating=e,this.advanceIdentity()}this.config.securityContext.id=e}return this.ownerAdopted=!0,!0},onRecords:e=>{this.ingestForwarded(e)},paused:()=>!this.config.enabled,onJourney:e=>{this.journey.applyRemote(e)},onJourneyRequest:()=>this.journey.current(),onTabConflict:()=>{this.regenerateTabId()},onFlush:e=>this.flushFor(e,!1),remote:this.remote});return this.bus=t,t}catch(e){return this.diagnostics.report(`pipeline.crashed`,`The bus did not load. This context sends its own records.`,void 0,e),null}}role(){return this.bus?.getRole()??`sender`}syncSender(){return!this.running||!this.config.enabled||this.deliveryClosed||this.destroyed||!this.hasDestination()||this.role()!==`sender`?Promise.resolve():this.loadSender()}hasDestination(){return!!this.config.endpoint||this.config.transport!==void 0}loadSender(){return this.senderLoad??=this.buildSender(),this.senderLoad}async buildSender(){try{let{Sender:e}=await Promise.resolve().then(()=>require("./sender-BdRuNVhF.cjs")),t=this.destroyed?null:await e.create({storage:this.memoryStorage,onStorage:e=>{e.name===`memory`&&(this.memoryStorage=e)},onPersistence:e=>{this.storagePersistence=e},config:this.config,diagnostics:this.diagnostics,onGap:this.reportGap,onLoss:this.reportLoss,remote:this.remote,beforeExit:()=>{x(this),this.collectPoints(),this.tracing.end()},onSent:e=>{this.lastSendAt=e}});if(!t||this.destroyed){await t?.discard();return}if(this.deliveryClosed){await this.parkSender(t);return}this.sender=t,this.config.enabled||t.hold(!0)}catch(e){this.senderLoad=void 0,this.diagnostics.report(`pipeline.crashed`,`The delivery stack did not load. The library does not send records.`,{held:this.pendingRecords.length},e),this.drops.add(`load_failed`,this.pendingRecords.records)}for(let e of this.pendingRecords.take())this.sender?.push(e);let e=this.carried;this.carried=[],this.sender&&e.length>0&&await this.adoptStored(this.sender,e)}async adoptStored(e,t){await this.diagnostics.guardAsync(`storage.degraded`,`The library could not store the carried batches under the new context.`,()=>e.adopt(t,this.config.securityContext.id))}refreshCaptures(){if(clearTimeout(this.remoteCaptureTimer),this.remoteCaptureTimer=void 0,this.destroyed)return;let e=this.remote.sampling?.wire();e&&(this.remoteCaptureTimer=setTimeout(()=>{this.refreshCaptures()},e.ttlMs),i.t(this.remoteCaptureTimer)),this.captureState(this.effectiveCapture())!==this.installedCaptureKey&&this.installCaptures()}captureState(e){let{enabled:t,framePhases:n,framePacing:r}=this.config.profiler;return`${String(this.config.enabled)}${lt(e)}${String(t&&n)}${String(t&&r)}${this.replayState(e)}`}replayState(e){let{replay:t}=this.config;return t.enabled?JSON.stringify([t.loader&&B(t.loader),t.onSegment&&B(t.onSegment),B(t.recordOptions),t.endpoint,t.requireConsent,t.mode,t.maskText,t.maskInputs,t.maskSelectors,t.blockSelectors,t.recordCanvas,t.bufferMs,t.plugins.map(B),e.fullUrls,e.ignoreUrls.map(String)]):``}effectiveCapture(){let t={...this.config.capture},n=this.remote.sampling?.current()?.capture;for(let r of e.sn){let e=n?.[r];if(t.remoteToggles.includes(r)&&e!==void 0){if(e&&typeof t[r]==`object`)continue;t[r]=e}}return t}async installCaptures(){if(this.degraded||!this.running)return;let t=++this.captureGeneration,n=this.effectiveCapture();if(this.installedCaptureKey=this.captureState(n),!this.config.enabled){this.uninstallCaptures();return}let r=this.replayState(n);r!==this.replayBuiltKey&&(this.replayBuiltKey=``);let i=r!==``&&r===this.replayBuiltKey?this.replay:void 0,a=[],{profiler:o}=this.config;(n.errors||n.rejections||n.resourceErrors)&&a.push(`errors`),(n.fetch||n.xhr)&&a.push(`network`),(n.interactions||n.navigation)&&a.push(`interactions`),n.webVitals&&a.push(`webVitals`),n.longFrames&&a.push(`longFrames`),(typeof n.console==`object`?n.console.levels?.length!==0:n.console)&&a.push(`console`),n.uncleanExit&&a.push(`uncleanExit`),n.userTiming&&a.push(`userTiming`),n.reports&&a.push(`reports`),n.resourceTiming&&a.push(`resourceTiming`),n.lifecycle&&a.push(`lifecycle`),o.enabled&&o.framePhases&&a.push(`framePhases`),o.enabled&&o.framePacing&&a.push(`framePacing`),this.config.replay.enabled&&!i&&a.push(`replay`);let[s,c]=await Promise.all([Promise.all(a.map(e=>this.loadCapture(e))),n.webSocket?this.loadWebSocket():void 0]);if(t!==this.captureGeneration||this.destroyed)return;this.uninstallCaptures(i);let l={isActive:()=>!this.destroyed&&!this.rotating,config:Object.assign(Object.create(this.config),{capture:n}),diagnostics:this.diagnostics,breadcrumbs:this.breadcrumbs,tracing:this.tracing,logger:new ie(()=>this,e.P),once:this.captureOnce,recordMetric:(e,t,n)=>{this.recordMetric(e,t,n)},recordSpan:e=>{this.recordSpan(e)},sessionId:()=>this.identity.sessionId,onError:e=>{this.errorHook=e},setContext:(e,t)=>{this.context.merge({[e]:t??null})},replayConsent:()=>this.replayConsent};s.forEach((e,t)=>{if(e){let n=new e(l);this.captures.push(n),a[t]===`replay`&&(this.replay=n,this.replayBuiltKey=r)}});let u=c?[...n.plugins,new c(this.diagnostics,l.config)]:n.plugins;for(let e of u)this.captures.push(this.pluginCapture(e));for(let e of this.captures)this.diagnostics.guard(`capture.install_failed`,`The library could not install the ${e.name} capture.`,()=>{e.install()})}uninstallCaptures(e){for(let t of this.captures)t!==e&&this.diagnostics.guard(`capture.install_failed`,`The library could not uninstall the ${t.name} capture.`,()=>{t.uninstall()});this.captures.length=0,this.replay=e,e&&this.captures.push(e)}loadWebSocket(){return this.diagnostics.guardAsync(`capture.install_failed`,`The library could not load the webSocket capture.`,async()=>(await Promise.resolve().then(()=>require("./web-socket-CoIUBM3C.cjs"))).WebSocketCapture)}pluginCapture(t){let{name:n}=t,r=(e,t,n)=>{this.recordMetric(e,t,n)},i=t=>{this.diagnostics.report(`config.invalid`,e.xt,void 0,t)},a={logger:new E(()=>this,`${e.P}.${n}`),counter:(e,t={})=>we(e,t,r,i),histogram:(e,t={})=>Ee(e,t,r,i),addBreadcrumb:(e,t)=>{this.addBreadcrumb(e,t)},ownRequest:d.r};return{name:n,install:()=>{t.install(a)},uninstall:()=>{t.uninstall()}}}loadCapture(e){return this.diagnostics.guardAsync(`capture.install_failed`,`The library could not load the ${e} capture.`,tt[e])}registerWorker(e,t={}){let n=!1,r;return this.destroyed?()=>void 0:(this.constructBus().then(i=>{!i||this.destroyed||n||(this.diagnostics.guard(`bus.send_failed`,`The library could not register the worker.`,()=>{r=i.attachWorker(e,t)}),this.ensureBus())}),()=>{n=!0,r?.()})}registerFrame(e,t){let n=!1,r;return this.constructBus().then(i=>{!i||this.destroyed||n||(r=this.diagnostics.guard(`bus.send_failed`,`The frame could not be registered.`,()=>i.registerFrame(e,t)),this.ensureBus())}),()=>{n=!0,r?.()}}async destroy(e){let{discard:t,scope:n}=this.shutdownRule(e);this.stopping??=this.stop(t),await this.stopping,n!==void 0&&await this.clearStorage(n)}async stop(e){e||(x(this),this.collectPoints(),this.tracing.end()),this.profilerOn&&(this.profilerOn=!1,c.t().detach()),this.destroyed=!0,this.backing=s.r(),S(this),this.collectPoints(),clearTimeout(this.remoteCaptureTimer),this.remoteCaptureTimer=void 0,this.degraded||removeEventListener(`pagehide`,this.onPageHide),this.uninstallCaptures();let t=e?this.discardHeld():this.flushHeld();this.journey.destroy(),this.bus?.destroy(),await t,await this.senderLoad,await this.rotation?.catch(()=>void 0);let r=this.parkedSender;this.parkedSender=void 0,await this.diagnostics.guardAsync(`pipeline.crashed`,`The delivery stack of the old context did not stop at shutdown. The library leaves its stored batches in storage.`,async()=>{await(e?r?.discard():r?.retire(`retain`,0,this.config.securityContext.id))}),await this.memoryStorage?.close(),n.pinned()===this&&(Reflect.deleteProperty(globalThis,V),globalThis[H]=this)}shutdownRule(e){let t=this.readOptions(e,ot);if(t===void 0)return{discard:!0};let{pending:n,clearStorage:r}=t,i=r==null,a=i||r===`context`||r===`namespace`,o;i||(o=r===`namespace`?`namespace`:`context`);let s=n===void 0||n===`flush`;return(!a||!(s||n===`discard`)||n===`flush`&&o)&&this.diagnostics.report(`config.invalid`,ot),{discard:!s||o!==void 0,scope:o}}async flushHeld(){this.dropPaused();let e=this.sender?.destroy();this.sendForwarded(),this.drops.add(`load_failed`,this.unreported(this.pendingRecords.take())),await e}async discardHeld(){let e=[...this.bootBuffer.take(),...this.pendingRecords.take(),...this.forwardBuffer];this.forwardBuffer=[],this.breadcrumbs.clear(),this.debugBuffer.clear(),this.context.clear(),this.journey.applyRemote(null);let t=await this.sender?.discard()??[];this.drops.add(`discarded`,this.unreported([...e,...t]))}async clearStorage(e){this.tunablesLocked&&await this.diagnostics.guardAsync(`storage.degraded`,`The library could not remove the stored batches at shutdown.`,async()=>{let{clearStored:t}=await Promise.resolve().then(()=>require("./stored-context-CXt7eHZL.cjs")),n=this.carried.map(e=>e.id);this.carried=[],await t(this.storeAccess(),e,n,this.identityBuiltAs===`storage`&&!this.onServer())})}emit(e){if(!e||this.destroyed)return;if(this.rotating&&!this.closingContext){this.drops.add(`security_context`,[e]);return}this.sessionTouch.touch(this.identity.sessionId);let t=e.severityText===`ERROR`||e.severityText===`FATAL`,n=t?[...this.debugBuffer.drain(),e]:[e];t&&this.errorHook?.(e);for(let e of n)this.ready?this.route(e):this.bootBuffer.push(e,this.config.buffering.maxHeldRecords)}route(e){this.role()===`forwarder`?this.forward(e):this.deliver(e)}deliver(e){if(this.deliveryClosed){this.drops.add(`security_context`,[e]);return}if(this.sender){this.sender.push(e);return}let t=!this.config.enabled&&this.hasDestination();!this.senderLoad&&!t?(this.diagnostics.count(`record.dropped_no_destination`),this.hasDestination()&&this.drops.add(`load_failed`,[e])):this.pendingRecords.push(e,this.config.buffering.maxHeldRecords)}dropPaused(){if(this.config.enabled)return;let e=this.unreported([...this.pendingRecords.records,...this.sender?.records()??[]]);for(let t of e)this.pausedLoss.add(t);this.drops.add(`disabled`,e)}unreported(e){return e.filter(e=>!this.pausedLoss.has(e))}dropHeld(e){this.diagnostics.count(`record.dropped_boot_buffer_full`),this.drops.add(`buffer_full`,[e])}forward(e){this.forwardBuffer.push(e),this.forwardScheduled||(this.forwardScheduled=!0,queueMicrotask(()=>{this.forwardScheduled=!1,this.sendForwarded()}))}sendForwarded(){let e=this.forwardBuffer;this.forwardBuffer=[];let{bus:t}=this;return e.length===0||!t?0:t.sendRecords(e)}ingestForwarded(e){if(this.destroyed)return;if(!Array.isArray(e)){this.diagnostics.count(`record.dropped_malformed`);return}let n=[];for(let r of e){if(!t.n(r)){this.diagnostics.count(`record.dropped_malformed`);continue}if(r.attributes[`uiobs.debug_buffer`]!==!0&&!h.a(r,this.config,this.remote.sampling?.current()??null)){this.diagnostics.count(`record.dropped_by_sampling`);continue}let e=this.builder.redactForwarded(r);e&&n.push(e)}if(this.rotating)this.drops.add(`security_context`,n);else if(!this.config.enabled)this.drops.add(`disabled`,n);else for(let e of n)this.deliver(e)}releaseBootBuffer(){let e=this.bootBuffer.take(),{processors:t,redact:n}=this.config,r=t.length===0&&n===void 0?this.journey.current():null;for(let t of e)r&&!t.attributes[`journey.id`]&&(t.attributes[`journey.id`]=r.id,t.attributes[`journey.name`]=r.name),this.route(t)}regenerateTabId(){let e=s.i(this.diagnostics);this.diagnostics.report(`bus.role_resolved`,`Another context uses this tab id. A duplicated tab is the usual cause. The library makes a new tab id.`,{was:this.identity.tabId,now:e}),this.identity.tabId=e,s.a(e,this.diagnostics,this.stores),this.builder.invalidateResource()}newSession(){this.destroyed||(x(this),this.resetSession(s.i(this.diagnostics)))}resetSession(e){this.sessionPicked=!0,this.collectPoints(),this.tracing.rotate(`explicit`),this.journey.end(),this.breadcrumbs.clear(),this.debugBuffer.clear(),this.replay?.reset(),this.identity.sessionId=e,this.sessionTouch.restart(e),this.builder.invalidateResource()}rotateSecurityContext(e,t={}){if(this.destroyed)return Promise.reject(Error(`The runtime has stopped.`));if(!this.tunablesLocked)return Promise.reject(Error(`The runtime is not configured. Call configure() before rotateSecurityContext().`));x(this),this.rotating=!0;let n=++this.rotationSeq,r=(this.rotation??Promise.resolve()).catch(()=>void 0).then(()=>this.runRotation(e,t,n));this.rotation=r;let i=()=>{this.rotation===r&&(this.rotation=void 0,this.rotating=!1,this.retiring=void 0)};return r.then(i,i),r}async runRotation(e,t,n){if(this.destroyed)throw Error(`The runtime has stopped.`);if(await this.started,this.role()===`forwarder`)throw Error(`Rotate the security context on the upstream owner, or use bus.mode: sender for an independent identity.`);let r;try{r=(await Promise.resolve().then(()=>require("./rotation-D4qUAHAu.cjs"))).rotateContext}catch(e){throw this.diagnostics.report(`pipeline.crashed`,`The library could not load the security-context rotation.`,void 0,e),await this.closeDelivery(),e}if(this.isDestroyed())throw Error(`The runtime has stopped.`);await r(this.rotationHost(),e,t,n)}rotationHost(){return{runtime:this,quiet:new A,senderLoaded:async()=>{await this.senderLoad},allowed:e=>this.allowed(e),closeDelivery:()=>this.closeDelivery(),closeContext:()=>{this.closingContext=!0;try{this.collectPoints(),this.tracing.end(),this.journey.end()}finally{this.closingContext=!1}},takeOld:()=>{let e=[...this.bootBuffer.take(),...this.pendingRecords.take(),...this.forwardBuffer],t=this.sender??this.parkedSender;this.retiring=t;let n=this.carried;return this.forwardBuffer=[],this.carried=[],this.sender=void 0,this.senderLoad=void 0,this.parkedSender=void 0,{held:e,sender:t,closed:this.deliveryClosed,carried:n}},drop:e=>{this.drops.add(`security_context`,this.unreported(e))},storeAccess:()=>this.storeAccess(),advanceIdentity:()=>{this.advanceIdentity()},openDelivery:async()=>{this.deliveryClosed=!1,await this.syncSender(),this.bus?.rotateContext()},endRotation:e=>{this.rotating=e!==this.rotationSeq},route:e=>{this.route(e)},adopt:async e=>{this.config.enabled?await this.sender?.adopt(e,this.config.securityContext.id):this.carried=[...e]}}}async closeDelivery(){this.deliveryClosed=!0,this.diagnostics.report(`security.rotation_failed`,`The security-context rotation failed. The library sends no record until a rotation succeeds.`),await this.senderLoad;let e=this.sender;this.sender=void 0,this.senderLoad=void 0,e&&await this.parkSender(e),this.drops.add(`security_context`,this.unreported(this.pendingRecords.take()))}async parkSender(e){this.parkedSender=e,await this.diagnostics.guardAsync(`pipeline.crashed`,`The delivery stack of the old context did not stop. The next rotation that succeeds retires it.`,()=>e.pause(this.config.securityContext.id))}async debugBundle(t){let{configSummary:n}=await Promise.resolve().then(()=>require("./debug-bundle-BXIlwDKM.cjs")),{record:r}=this.builder.build({level:`INFO`,type:`system`,body:`debug bundle`,namespace:e.J,payload:{[e.c]:this.breadcrumbs.snapshot()}},!0),i=r?.attributes??{},a=i[e.c],o=i[e.v];return{createdAt:new Date().toISOString(),sdkVersion:this.sdkVersion,health:t,diagnostics:this.diagnostics.snapshot(),resource:r?.resource??{},pageUrl:typeof o==`string`?o:``,breadcrumbs:Array.isArray(a)?a:[],debugBuffer:this.debugBuffer.snapshot(),config:n(this.config,this.limits,this.diagnostics)}}async health(){let e=this.sender?.stats(),t=[];this.mismatchVersion&&t.push(`runtime.version_mismatch`),this.contextMismatch&&t.push(`security.context_mismatch`);let{redact:n,processors:r}=this.config;(n===f.t||r.includes(f.t))&&t.push(`records.refused`),this.deliveryClosed?t.push(`security.rotation_failed`):this.ready&&this.config.enabled&&this.hasDestination()&&this.role()===`sender`&&!this.sender&&t.push(`sender.unavailable`);let{sourcePolicy:i,maxMessageBytes:a,maxRecordsPerMessage:o,maxMessagesPerSecond:s}=this.config.bus;return{delivery:{pending:(e?.pending??0)+this.heldRecords(),inFlight:e?.inFlight??0,stored:await this.storedBatches(),lastSendAt:this.lastSendAt,lastFailureAt:e?.lastFailureAt??null,consecutiveFailures:e?.consecutiveFailures??0,throttledUntil:e?.throttledUntil??null,dropped:this.drops.counts()},sdkVersion:this.sdkVersion,owningSdkVersion:this.mismatchVersion,status:this.destroyed?`stopped`:this.tunablesLocked?this.config.enabled?this.rotating?`rotating`:t.length?`degraded`:this.ready?`ready`:`starting`:`disabled`:`unconfigured`,mode:this.role()===`forwarder`?`forwarder`:this.hasDestination()?`sender`:`console-only`,senderReady:this.sender!==void 0&&this.config.enabled&&!this.destroyed&&!this.rotating&&!this.deliveryClosed,configurationLocked:this.config.lockConfiguration,issues:t,securityContext:{...this.config.securityContext},storagePersistence:this.storagePersistence,bus:{sourcePolicy:i,maxMessageBytes:a,maxRecordsPerMessage:o,maxMessagesPerSecond:s}}}storeAccess(){return{config:this.config,diagnostics:this.diagnostics,memory:this.memoryStorage}}async storedBatches(){return await(this.sender??this.parkedSender)?.queueDepth()??0}flush(e){return this.flushFor(this.flushTimeout(e),!0)}async flushFor(e,t){x(this),t&&this.collectPoints();let n=this.idle();if(n)return n;let r=Date.now()+e,a,o=new Promise(t=>{let n=setTimeout(t,e);i.t(n),a=()=>{clearTimeout(n)}});try{return await this.flushBefore(r,o)}finally{a()}}async flushBefore(t,n){let r=this.heldRecords(),i=this.ready?this.senderLoad:this.started;if(i&&(!this.ready||!this.sender)&&!await Promise.race([i.then(()=>!0),n.then(()=>!1)]))return W({pending:this.waiting()});let{bus:a}=this,o=a?.getRole()===`forwarder`,s=this.idle();if(s)return s;if(o){let r=this.forwardBuffer.length,i=this.sendForwarded(),o=r-i,s=Math.floor(Math.max(0,t-Date.now())*e.rt),c=await a.requestFlush(s,n);return c?{...c,forwarded:i,dropped:c.dropped+o}:W({forwarded:i,pending:i,dropped:o})}let{sender:c}=this;return c?W(await c.flushUntil(n)):this.rotating?W({pending:r+this.waiting()}):U(`complete`,{dropped:r})}idle(){return this.tunablesLocked&&this.config.enabled&&!this.destroyed?null:U(`inactive`,{pending:this.destroyed?0:this.waiting()})}heldRecords(){return this.bootBuffer.length+this.pendingRecords.length+this.forwardBuffer.length}waiting(){let e=this.heldRecords();for(let t of[this.sender,this.retiring]){let n=t?.stats();e+=n?n.pending+n.inFlight:0}return e}readOptions(e,t){if(typeof e!=`object`&&e!==void 0)this.diagnostics.report(`config.invalid`,t);else return this.diagnostics.guard(`config.invalid`,t,()=>({...e}))}flushTimeout(t){let n=this.readOptions(t,st);if(!n)return e.at;let r=n.timeoutMs??5e3;return typeof r==`number`&&r>=0&&r<=6e5?r:(this.diagnostics.report(`config.invalid`,st),e.at)}};o.t(K,`local`,null);function q(e,t,n=new WeakMap){if(Object.is(e,t))return!0;if(e instanceof RegExp&&t instanceof RegExp)return String(e)===String(t);if(typeof e!=`object`||!e||typeof t!=`object`||!t)return!1;if(n.has(e))return n.get(e)===t;n.set(e,t);let i=Object.keys(e),a=Object.keys(t);return i.length===a.length&&i.every(i=>r.t(t,i)&&q(Reflect.get(e,i),Reflect.get(t,i),n))}var J;function pt(t={}){if(J)return J;let n=new A(t.onDiagnostic);if(typeof document<`u`||typeof addEventListener!=`function`)return n.report(`config.invalid`,`Call serveTransportWorker() in a dedicated worker.`),()=>void 0;let i=!1,a,o,s=t=>{n.guard(`transport.http_error`,`The transport worker could not read its connection.`,()=>{let s=t.data;if(!r.n(s)||s.p!==`ui-observability.transport/1`||s.t!==e.sr.connect||t.ports.length===0)return;let c=t.ports[0];a||s.v!==`1.0.0`?(c.postMessage(e.or),c.close()):(a=c,Promise.resolve().then(()=>require("./worker-server-CFe4nvos.cjs")).then(e=>{i||(o=e.serveWorkerPort(c,n))}).catch(t=>{n.report(`transport.http_error`,`The transport worker delivery module could not load.`,void 0,t),n.guard(`transport.http_error`,`The failed transport port could not be closed.`,()=>{c.postMessage(e.or),c.close()})}))})},c=()=>{i||(i=!0,J=void 0,removeEventListener(`message`,s),o?.(),n.guard(`transport.http_error`,`The transport service could not close its port.`,()=>{a?.postMessage(e.or)}),n.guard(`transport.http_error`,`The transport port could not close.`,()=>{a?.close()}))};return addEventListener(`message`,s),J=c,c}function mt(){let e=[],t=[],n={status:200};return{transport:r=>(e.push(r),n.status>=200&&n.status<300&&t.push(r),Promise.resolve({...n})),records:()=>t.flatMap(e=>[...e.records]),batches:()=>[...e],clear:()=>{e.length=0,t.length=0},respondWith:(e,t)=>{n=t===void 0?{status:e}:{status:e,retryAfterMs:t}}}}var Y=new Map;function X(){return(K.current()??K.stopped())||K.configure({},!0)}function ht(e){K.configure(e),Z()}function gt(e){X().setConfigurationLocked(e)}function _t(e,t){return X().rotateSecurityContext(e,t)}async function vt(){let e=X();return Z(),{...await e.health(),loggerCache:{...e.config.loggerCache,size:Y.size}}}async function yt(){let e=await vt();return X().debugBundle(e)}function Z(){let e=(K.current()??K.stopped())?.config.loggerCache.maxEntries,t=e===void 0?256:e;if(t!==null)for(let e of Y.keys()){if(Y.size<=t)break;Y.delete(e)}return t}function bt(e,t){let n=Z();if(t||n===0)return new E(X,e,t);let r=Y.get(e);return r??=new E(X,e),Y.delete(e),Y.set(e,r),Z(),r}function Q(){return bt(`app`)}function xt(e,t){Q().trace(e,t)}function St(e,t){Q().debug(e,t)}function Ct(e,t){Q().info(e,t)}function wt(e,t){Q().warn(e,t)}function Tt(e,t,n){Q().error(e,t,n)}function Et(e,t,n){Q().fatal(e,t,n)}function Dt(e,t){Q().logAction(e,t)}function Ot(e,t){Q().logEvent(e,t)}function $(t){K.current()?.diagnostics.report(`config.invalid`,e.xt,void 0,t)}function kt(e,t={}){return we(e,t,(e,t,n)=>{X().recordMetric(e,t,n)},$)}function At(e,t={}){return Te(e,t,(e,t,n)=>{X().recordMetric(e,t,n)},$)}function jt(e,t={}){return Ee(e,t,(e,t,n)=>{X().recordMetric(e,t,n)},$)}function Mt(e,t){return X().startMeasure(e,t)}function Nt(e,t,n){let r=X();return he(r.startMeasure(e,n),t,r.diagnostics)}function Pt(){X().setReplay(!0)}function Ft(){X().setReplay(!1)}var It={probe:(e,t)=>c.t().probe(e,t,K.current()?.diagnostics),time:(e,t)=>c.t().time(e,t,K.current()?.diagnostics)};function Lt(e,t){X().addBreadcrumb(e,t)}function Rt(e){let t=X();r.n(e)?t.diagnostics.guard(`record.sanitize_failed`,`The library could not read the values of setContext().`,()=>{t.context.merge(e)}):t.diagnostics.report(`config.invalid`,`setContext() takes an object. The library keeps the current context.`)}function zt(e){X().context.remove(e)}function Bt(e,t){return X().journey.start(e,t)}function Vt(){X().journey.end()}function Ht(){return X().journey.current()}function Ut(){return X().journey.getToken()}function Wt(e){return X().journey.adopt(e,`manual`,!0)}function Gt(e,t){return X().registerWorker(e,t)}function Kt(e,t){return X().registerFrame(e,t)}function qt(){X().tracing.rotate(`explicit`)}function Jt(){return X().tracing.headers()}function Yt(e){return X().flush(e)}function Xt(){X().newSession()}function Zt(){return X().diagnostics.snapshot()}async function Qt(e){await(K.current()??K.stopped())?.destroy(e)}exports.addBreadcrumb=Lt,exports.adoptJourney=Wt,exports.collectDebugBundle=yt,exports.configure=ht,exports.counter=kt,exports.createMemoryTransport=mt,exports.currentJourney=Ht,exports.debug=St,exports.endJourney=Vt,exports.error=Tt,exports.fatal=Et,exports.flush=Yt,exports.gauge=At,exports.getDiagnosticCounters=Zt,exports.getHealth=vt,exports.getJourneyToken=Ut,exports.getLogger=bt,exports.getTraceHeaders=Jt,exports.histogram=jt,exports.info=Ct,exports.logAction=Dt,exports.logEvent=Ot,exports.measure=Nt,exports.newSession=Xt,exports.newTrace=qt,exports.profiler=It,exports.registerFrame=Kt,exports.registerWorker=Gt,exports.removeContext=zt,exports.rotateSecurityContext=_t,exports.serveTransportWorker=pt,exports.setConfigurationLocked=gt,exports.setContext=Rt,exports.shutdown=Qt,exports.startJourney=Bt,exports.startMeasure=Mt,exports.startReplay=Pt,exports.stopReplay=Ft,exports.trace=xt,exports.warn=wt;
2
2
  //# sourceMappingURL=index.cjs.map