@utk09/ui-observability 0.9.5 → 0.11.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 (259) hide show
  1. package/CHANGELOG.md +52 -0
  2. package/README.md +315 -99
  3. package/bin/uiobs.mjs +8 -0
  4. package/dist/{batch-BQFtb3i5.cjs → batch-C8OcWR2L.cjs} +2 -2
  5. package/dist/{batch-BQFtb3i5.cjs.map → batch-C8OcWR2L.cjs.map} +1 -1
  6. package/dist/{batch-BUJh-1jZ.js → batch-CL9uWYY3.js} +5 -6
  7. package/dist/{batch-BUJh-1jZ.js.map → batch-CL9uWYY3.js.map} +1 -1
  8. package/dist/bus/bus.d.ts +15 -0
  9. package/dist/{bus-DeOPHWaD.js → bus-BZ0GldpT.js} +125 -112
  10. package/dist/bus-BZ0GldpT.js.map +1 -0
  11. package/dist/bus-VWlmM5xs.cjs +2 -0
  12. package/dist/bus-VWlmM5xs.cjs.map +1 -0
  13. package/dist/capture/interactions.d.ts +18 -0
  14. package/dist/capture/lifecycle.d.ts +20 -0
  15. package/dist/capture/reports.d.ts +17 -0
  16. package/dist/capture/resource-timing.d.ts +14 -0
  17. package/dist/capture/server-timing.d.ts +19 -0
  18. package/dist/capture/types.d.ts +13 -0
  19. package/dist/capture/unclean-exit.d.ts +31 -0
  20. package/dist/capture/user-timing.d.ts +22 -0
  21. package/dist/console-BPZCuSLc.cjs +2 -0
  22. package/dist/console-BPZCuSLc.cjs.map +1 -0
  23. package/dist/{console-DbAZYJuy.js → console-BeCF7n59.js} +20 -20
  24. package/dist/{console-DbAZYJuy.js.map → console-BeCF7n59.js.map} +1 -1
  25. package/dist/constants-DqKJH_MP.cjs +2 -0
  26. package/dist/constants-DqKJH_MP.cjs.map +1 -0
  27. package/dist/constants-zyrqveN4.js +304 -0
  28. package/dist/constants-zyrqveN4.js.map +1 -0
  29. package/dist/constants.d.ts +58 -2
  30. package/dist/context-storage-BjzeBSxH.cjs.map +1 -1
  31. package/dist/{context-storage-DxZf4Gfh.js → context-storage-BzkoHzkQ.js} +2 -3
  32. package/dist/{context-storage-DxZf4Gfh.js.map → context-storage-BzkoHzkQ.js.map} +1 -1
  33. package/dist/core/debug-buffer.d.ts +34 -0
  34. package/dist/core/debug-bundle.d.ts +12 -0
  35. package/dist/core/deferred.d.ts +7 -0
  36. package/dist/core/logger.d.ts +7 -2
  37. package/dist/core/measure.d.ts +19 -0
  38. package/dist/core/pipeline.d.ts +6 -1
  39. package/dist/core/record.d.ts +20 -1
  40. package/dist/core/remote-sampling.d.ts +5 -1
  41. package/dist/core/runtime.d.ts +45 -2
  42. package/dist/core/sampling.d.ts +5 -4
  43. package/dist/core/sender.d.ts +3 -1
  44. package/dist/core/spans.d.ts +5 -0
  45. package/dist/{deadline-5_PecIl5.js → deadline-BOjOxNHj.js} +3 -5
  46. package/dist/{deadline-5_PecIl5.js.map → deadline-BOjOxNHj.js.map} +1 -1
  47. package/dist/deadline-XSnm95pg.cjs.map +1 -1
  48. package/dist/debug-bundle-BzJNpbF0.cjs +2 -0
  49. package/dist/debug-bundle-BzJNpbF0.cjs.map +1 -0
  50. package/dist/debug-bundle-C7UkHZ-q.js +25 -0
  51. package/dist/debug-bundle-C7UkHZ-q.js.map +1 -0
  52. package/dist/doctor.cjs +2 -0
  53. package/dist/doctor.cjs.map +1 -0
  54. package/dist/doctor.d.ts +23 -0
  55. package/dist/doctor.js +98 -0
  56. package/dist/doctor.js.map +1 -0
  57. package/dist/{emergency-queue-Cs1hrjsC.cjs → emergency-queue-CNTRui5t.cjs} +2 -2
  58. package/dist/{emergency-queue-Cs1hrjsC.cjs.map → emergency-queue-CNTRui5t.cjs.map} +1 -1
  59. package/dist/{emergency-queue-BYUyDHGD.js → emergency-queue-Zy6lNafo.js} +17 -19
  60. package/dist/{emergency-queue-BYUyDHGD.js.map → emergency-queue-Zy6lNafo.js.map} +1 -1
  61. package/dist/{error-like-Ywo5uRHo.js → error-like-B11pB4aL.js} +2 -3
  62. package/dist/{error-like-Ywo5uRHo.js.map → error-like-B11pB4aL.js.map} +1 -1
  63. package/dist/error-like-gGRx2s36.cjs.map +1 -1
  64. package/dist/{errors-BhC7HTSt.js → errors-Dh7kef0i.js} +5 -6
  65. package/dist/{errors-BhC7HTSt.js.map → errors-Dh7kef0i.js.map} +1 -1
  66. package/dist/{errors-CgY633cG.cjs → errors-tfEr48bS.cjs} +2 -2
  67. package/dist/{errors-CgY633cG.cjs.map → errors-tfEr48bS.cjs.map} +1 -1
  68. package/dist/{factory-C5TujXlU.js → factory-BonqI3NL.js} +16 -20
  69. package/dist/{factory-C5TujXlU.js.map → factory-BonqI3NL.js.map} +1 -1
  70. package/dist/{factory-CNj4DH3n.cjs → factory-CJXVYp0R.cjs} +2 -2
  71. package/dist/{factory-CNj4DH3n.cjs.map → factory-CJXVYp0R.cjs.map} +1 -1
  72. package/dist/fixed-window-CvESpFYV.cjs.map +1 -1
  73. package/dist/{fixed-window-CtaFHanJ.js → fixed-window-Dq3MLUUv.js} +2 -3
  74. package/dist/{fixed-window-CtaFHanJ.js.map → fixed-window-Dq3MLUUv.js.map} +1 -1
  75. package/dist/global-scope-BN-Io_yv.cjs.map +1 -1
  76. package/dist/{global-scope-dp2jADRl.js → global-scope-D9I8s-oN.js} +2 -3
  77. package/dist/{global-scope-dp2jADRl.js.map → global-scope-D9I8s-oN.js.map} +1 -1
  78. package/dist/guards-Cidk71ME.js +7 -0
  79. package/dist/guards-Cidk71ME.js.map +1 -0
  80. package/dist/guards-nJ70syPt.cjs +2 -0
  81. package/dist/guards-nJ70syPt.cjs.map +1 -0
  82. package/dist/{identity-Da9TkuKd.cjs → identity-Cxgj6pZX.cjs} +2 -2
  83. package/dist/{identity-Da9TkuKd.cjs.map → identity-Cxgj6pZX.cjs.map} +1 -1
  84. package/dist/{identity-8vKkyAWm.js → identity-DT5VmvXy.js} +15 -16
  85. package/dist/{identity-8vKkyAWm.js.map → identity-DT5VmvXy.js.map} +1 -1
  86. package/dist/index.cjs +1 -1
  87. package/dist/index.cjs.map +1 -1
  88. package/dist/index.d.ts +27 -7
  89. package/dist/index.js +980 -604
  90. package/dist/index.js.map +1 -1
  91. package/dist/{indexeddb-storage-CCA1LvtO.js → indexeddb-storage-BJVtiQKm.js} +29 -30
  92. package/dist/{indexeddb-storage-CCA1LvtO.js.map → indexeddb-storage-BJVtiQKm.js.map} +1 -1
  93. package/dist/{indexeddb-storage-BTfIFRHF.cjs → indexeddb-storage-CIoW21Xd.cjs} +2 -2
  94. package/dist/{indexeddb-storage-BTfIFRHF.cjs.map → indexeddb-storage-CIoW21Xd.cjs.map} +1 -1
  95. package/dist/interactions-DTgKy_6K.js +119 -0
  96. package/dist/interactions-DTgKy_6K.js.map +1 -0
  97. package/dist/interactions-fEN6FbVo.cjs +2 -0
  98. package/dist/interactions-fEN6FbVo.cjs.map +1 -0
  99. package/dist/{journey-BUJ4WJxP.js → journey-CuJrHzEg.js} +18 -19
  100. package/dist/{journey-BUJ4WJxP.js.map → journey-CuJrHzEg.js.map} +1 -1
  101. package/dist/{journey-B_tTnvac.cjs → journey-pffMVMfa.cjs} +2 -2
  102. package/dist/{journey-B_tTnvac.cjs.map → journey-pffMVMfa.cjs.map} +1 -1
  103. package/dist/keys-BHhw_0Wh.cjs.map +1 -1
  104. package/dist/{keys-D5r_GH9q.js → keys-BU9j5YqW.js} +2 -3
  105. package/dist/{keys-D5r_GH9q.js.map → keys-BU9j5YqW.js.map} +1 -1
  106. package/dist/library-console-C1m6g1BR.js +13 -0
  107. package/dist/library-console-C1m6g1BR.js.map +1 -0
  108. package/dist/library-console-D2GY9Or6.cjs +2 -0
  109. package/dist/library-console-D2GY9Or6.cjs.map +1 -0
  110. package/dist/{library-request-BaZOi4eg.cjs → library-request-1BX_UlaX.cjs} +2 -2
  111. package/dist/{library-request-BaZOi4eg.cjs.map → library-request-1BX_UlaX.cjs.map} +1 -1
  112. package/dist/library-request-BQBT9N9Q.js +24 -0
  113. package/dist/{library-request-BKOcaKtQ.js.map → library-request-BQBT9N9Q.js.map} +1 -1
  114. package/dist/lifecycle-2EtUaRpo.cjs +2 -0
  115. package/dist/lifecycle-2EtUaRpo.cjs.map +1 -0
  116. package/dist/lifecycle-BaKx_-32.js +55 -0
  117. package/dist/lifecycle-BaKx_-32.js.map +1 -0
  118. package/dist/log-record-CAoGBBf3.js +16 -0
  119. package/dist/log-record-CAoGBBf3.js.map +1 -0
  120. package/dist/log-record-i9zOTkpQ.cjs +2 -0
  121. package/dist/log-record-i9zOTkpQ.cjs.map +1 -0
  122. package/dist/{long-frames-CF3qiSAX.cjs → long-frames-BVg4i5SC.cjs} +2 -2
  123. package/dist/{long-frames-CF3qiSAX.cjs.map → long-frames-BVg4i5SC.cjs.map} +1 -1
  124. package/dist/{long-frames-DI5ypfAF.js → long-frames-Czk7IupC.js} +4 -5
  125. package/dist/{long-frames-DI5ypfAF.js.map → long-frames-Czk7IupC.js.map} +1 -1
  126. package/dist/models/config.d.ts +168 -4
  127. package/dist/models/health.d.ts +25 -0
  128. package/dist/models/metric.d.ts +13 -0
  129. package/dist/models/storage.d.ts +5 -0
  130. package/dist/{network-DdzXDI3J.js → network-DBNwApoF.js} +117 -70
  131. package/dist/network-DBNwApoF.js.map +1 -0
  132. package/dist/network-xbbuvG_6.cjs +2 -0
  133. package/dist/network-xbbuvG_6.cjs.map +1 -0
  134. package/dist/openfin-Bxelt0yg.js +7 -0
  135. package/dist/{openfin-BwEN0uj4.js.map → openfin-Bxelt0yg.js.map} +1 -1
  136. package/dist/openfin-DtH2f7zX.cjs.map +1 -1
  137. package/dist/otlp-BDvFrLnc.cjs +2 -0
  138. package/dist/otlp-BDvFrLnc.cjs.map +1 -0
  139. package/dist/otlp-BTJdIa6F.js +81 -0
  140. package/dist/otlp-BTJdIa6F.js.map +1 -0
  141. package/dist/patch-BX8KrPCT.cjs.map +1 -1
  142. package/dist/{patch-CCWfuEY7.js → patch-UdPz1ea8.js} +2 -3
  143. package/dist/{patch-CCWfuEY7.js.map → patch-UdPz1ea8.js.map} +1 -1
  144. package/dist/{platform-DBSKTvFn.cjs → platform-C2Ez5kDc.cjs} +2 -2
  145. package/dist/{platform-DBSKTvFn.cjs.map → platform-C2Ez5kDc.cjs.map} +1 -1
  146. package/dist/{platform-Bw1btWCT.js → platform-DkcuXwe-.js} +5 -6
  147. package/dist/{platform-Bw1btWCT.js.map → platform-DkcuXwe-.js.map} +1 -1
  148. package/dist/remote-rules-Cfb4K-Nl.js +98 -0
  149. package/dist/remote-rules-Cfb4K-Nl.js.map +1 -0
  150. package/dist/remote-rules-vzvk7aKf.cjs +2 -0
  151. package/dist/remote-rules-vzvk7aKf.cjs.map +1 -0
  152. package/dist/reports-Dk2YhKIh.cjs +2 -0
  153. package/dist/reports-Dk2YhKIh.cjs.map +1 -0
  154. package/dist/reports-TA-zInnq.js +70 -0
  155. package/dist/reports-TA-zInnq.js.map +1 -0
  156. package/dist/resource-timing-BLv3EA2A.js +76 -0
  157. package/dist/resource-timing-BLv3EA2A.js.map +1 -0
  158. package/dist/resource-timing-Cysw1S1f.cjs +2 -0
  159. package/dist/resource-timing-Cysw1S1f.cjs.map +1 -0
  160. package/dist/sampling-C4VV-1MS.js +60 -0
  161. package/dist/sampling-C4VV-1MS.js.map +1 -0
  162. package/dist/sampling-Ckh2yW9k.cjs +2 -0
  163. package/dist/sampling-Ckh2yW9k.cjs.map +1 -0
  164. package/dist/sanitize-6ymPlVvP.js +112 -0
  165. package/dist/sanitize-6ymPlVvP.js.map +1 -0
  166. package/dist/sanitize-BAWzkZt0.cjs +2 -0
  167. package/dist/sanitize-BAWzkZt0.cjs.map +1 -0
  168. package/dist/select-ZF4by-lF.cjs +3 -0
  169. package/dist/select-ZF4by-lF.cjs.map +1 -0
  170. package/dist/select-xtQaenIi.js +270 -0
  171. package/dist/select-xtQaenIi.js.map +1 -0
  172. package/dist/{sender-DUUmSglb.js → sender-CiMHC9YG.js} +202 -509
  173. package/dist/sender-CiMHC9YG.js.map +1 -0
  174. package/dist/sender-D5wBoXA8.cjs +2 -0
  175. package/dist/sender-D5wBoXA8.cjs.map +1 -0
  176. package/dist/storage/persistence.d.ts +8 -0
  177. package/dist/storage-BA9RqRO-.cjs.map +1 -1
  178. package/dist/{storage-w7Tslvlq.js → storage-DZwed89z.js} +2 -3
  179. package/dist/storage-DZwed89z.js.map +1 -0
  180. package/dist/storm-CYi9Swpx.cjs +2 -0
  181. package/dist/{storm-CNZjsw4T.cjs.map → storm-CYi9Swpx.cjs.map} +1 -1
  182. package/dist/{storm-Daq2jGHU.js → storm-VR024_QN.js} +4 -5
  183. package/dist/{storm-Daq2jGHU.js.map → storm-VR024_QN.js.map} +1 -1
  184. package/dist/transport/headers.d.ts +8 -0
  185. package/dist/transport/http-transport.d.ts +2 -6
  186. package/dist/transport/serializers/otlp.d.ts +14 -0
  187. package/dist/transport/status-transport.d.ts +5 -2
  188. package/dist/transport/worker-client.d.ts +14 -0
  189. package/dist/transport/worker-entry.d.ts +5 -0
  190. package/dist/transport/worker-protocol.d.ts +36 -0
  191. package/dist/transport/worker-server.d.ts +3 -0
  192. package/dist/transport/worker-transport.d.ts +9 -0
  193. package/dist/{types-BR9t_w28.js → types-BAerHgCq.js} +2 -3
  194. package/dist/types-BAerHgCq.js.map +1 -0
  195. package/dist/types-C7WNpnG1.cjs.map +1 -1
  196. package/dist/unclean-exit-CwcUhFOn.js +62 -0
  197. package/dist/unclean-exit-CwcUhFOn.js.map +1 -0
  198. package/dist/unclean-exit-DFUN57wY.cjs +2 -0
  199. package/dist/unclean-exit-DFUN57wY.cjs.map +1 -0
  200. package/dist/user-timing-C9kfRq3J.cjs +2 -0
  201. package/dist/user-timing-C9kfRq3J.cjs.map +1 -0
  202. package/dist/user-timing-_jZIhDKI.js +63 -0
  203. package/dist/user-timing-_jZIhDKI.js.map +1 -0
  204. package/dist/{web-socket-BacvKOvD.cjs → web-socket-BWUoqBh8.cjs} +2 -2
  205. package/dist/{web-socket-BacvKOvD.cjs.map → web-socket-BWUoqBh8.cjs.map} +1 -1
  206. package/dist/{web-socket-CpsD8WAa.js → web-socket-CV7yIMnm.js} +7 -8
  207. package/dist/{web-socket-CpsD8WAa.js.map → web-socket-CV7yIMnm.js.map} +1 -1
  208. package/dist/{web-vitals-Bflr5jSA.js → web-vitals-Bq4WFHQo.js} +2 -3
  209. package/dist/{web-vitals-Bflr5jSA.js.map → web-vitals-Bq4WFHQo.js.map} +1 -1
  210. package/dist/web-vitals-DFuoTQbZ.cjs.map +1 -1
  211. package/dist/worker-protocol-Bai7GAIA.cjs +2 -0
  212. package/dist/worker-protocol-Bai7GAIA.cjs.map +1 -0
  213. package/dist/worker-protocol-CrsdSDLn.js +49 -0
  214. package/dist/worker-protocol-CrsdSDLn.js.map +1 -0
  215. package/dist/worker-server-BrIYkfoa.cjs +2 -0
  216. package/dist/worker-server-BrIYkfoa.cjs.map +1 -0
  217. package/dist/worker-server-Dp5HYm4b.js +83 -0
  218. package/dist/worker-server-Dp5HYm4b.js.map +1 -0
  219. package/dist/worker-transport-Bwej4N2e.cjs +2 -0
  220. package/dist/worker-transport-Bwej4N2e.cjs.map +1 -0
  221. package/dist/worker-transport-D6jtgpqN.js +199 -0
  222. package/dist/worker-transport-D6jtgpqN.js.map +1 -0
  223. package/package.json +31 -41
  224. package/dist/bus-BW6N-pY8.cjs +0 -2
  225. package/dist/bus-BW6N-pY8.cjs.map +0 -1
  226. package/dist/bus-DeOPHWaD.js.map +0 -1
  227. package/dist/console-Ce6heqZZ.cjs +0 -2
  228. package/dist/console-Ce6heqZZ.cjs.map +0 -1
  229. package/dist/constants-CN7GE1Lt.js +0 -246
  230. package/dist/constants-CN7GE1Lt.js.map +0 -1
  231. package/dist/constants-CW-MlHdY.cjs +0 -2
  232. package/dist/constants-CW-MlHdY.cjs.map +0 -1
  233. package/dist/interactions-BUDLxbv1.js +0 -74
  234. package/dist/interactions-BUDLxbv1.js.map +0 -1
  235. package/dist/interactions-NHbLKrqe.cjs +0 -2
  236. package/dist/interactions-NHbLKrqe.cjs.map +0 -1
  237. package/dist/library-request-BKOcaKtQ.js +0 -25
  238. package/dist/network-CF8UO5PK.cjs +0 -2
  239. package/dist/network-CF8UO5PK.cjs.map +0 -1
  240. package/dist/network-DdzXDI3J.js.map +0 -1
  241. package/dist/openfin-BwEN0uj4.js +0 -8
  242. package/dist/remote-rules-DIcC5vVC.js +0 -91
  243. package/dist/remote-rules-DIcC5vVC.js.map +0 -1
  244. package/dist/remote-rules-DpFmOef2.cjs +0 -2
  245. package/dist/remote-rules-DpFmOef2.cjs.map +0 -1
  246. package/dist/sampling-BVjspJWu.cjs +0 -2
  247. package/dist/sampling-BVjspJWu.cjs.map +0 -1
  248. package/dist/sampling-Cm3WhI0a.js +0 -76
  249. package/dist/sampling-Cm3WhI0a.js.map +0 -1
  250. package/dist/sanitize-C-ahCFsG.js +0 -123
  251. package/dist/sanitize-C-ahCFsG.js.map +0 -1
  252. package/dist/sanitize-DHucKGdi.cjs +0 -2
  253. package/dist/sanitize-DHucKGdi.cjs.map +0 -1
  254. package/dist/sender-D3fRCR8d.cjs +0 -3
  255. package/dist/sender-D3fRCR8d.cjs.map +0 -1
  256. package/dist/sender-DUUmSglb.js.map +0 -1
  257. package/dist/storage-w7Tslvlq.js.map +0 -1
  258. package/dist/storm-CNZjsw4T.cjs +0 -2
  259. package/dist/types-BR9t_w28.js.map +0 -1
package/dist/index.js CHANGED
@@ -1,55 +1,111 @@
1
- import { $t as e, Bt as t, C as n, Ct as r, En as i, Ft as a, Gt as o, Ht as s, Jt as c, Kt as l, L as u, M as d, N as f, Qt as p, R as m, St as h, Tn as g, Ut as _, V as v, Vt as y, Wt as ee, Xt as te, Yt as ne, Zt as re, _n as ie, a as ae, an as oe, bn as se, c as b, d as x, f as ce, gn as le, gt as ue, h as de, i as fe, j as pe, k as me, l as he, ln as ge, m as _e, mt as S, o as C, on as w, p as ve, pt as ye, qt as be, r as T, s as xe, tn as E, u as Se, vn as D, wn as Ce, wt as we, xn as Te, yn as Ee, z as De, zt as Oe } from "./constants-CN7GE1Lt.js";
2
- import { n as ke, r as Ae, t as je } from "./error-like-Ywo5uRHo.js";
3
- import { a as Me, c as Ne, i as Pe, l as Fe, n as Ie, o as Le, s as Re, u as O } from "./sampling-Cm3WhI0a.js";
4
- import { r as ze } from "./deadline-5_PecIl5.js";
5
- import { a as Be, i as Ve, n as He, o as k, r as A } from "./sanitize-C-ahCFsG.js";
6
- import { a as Ue, i as j, n as We, o as Ge, r as Ke, s as qe, t as Je } from "./identity-8vKkyAWm.js";
7
- import { r as Ye } from "./library-request-BKOcaKtQ.js";
8
- import { i as Xe, n as Ze, t as Qe } from "./platform-Bw1btWCT.js";
9
- import { r as $e, t as et } from "./batch-BUJh-1jZ.js";
10
- import { n as tt, t as nt } from "./journey-BUJ4WJxP.js";
11
- //#region src/utils/timer.ts
12
- function M(e) {
13
- return Math.round((performance.now() - e) * v) / v;
14
- }
15
- function N(e, t, n, r, i) {
1
+ import { $t as e, Bn as t, Ct as n, D as r, Et as i, F as a, Fn as o, G as s, Hn as c, I as l, In as u, J as d, K as f, Kt as p, L as m, Mn as h, Mt as g, N as _, Nn as v, Nt as y, Pn as ee, Pt as te, Qt as ne, U as re, Un as ie, W as ae, Wn as oe, X as se, Zt as ce, _ as le, a as ue, an as de, bn as fe, c as b, cn as pe, d as me, dn as he, en as ge, f as x, fn as _e, g as ve, h as ye, in as be, jn as xe, ln as Se, m as Ce, mn as S, nn as we, o as Te, on as Ee, p as De, q as Oe, qt as ke, rn as Ae, s as je, sn as Me, tn as Ne, u as Pe, un as Fe, v as C, wn as Ie, wt as w, xn as T, y as Le, zn as Re } from "./constants-zyrqveN4.js";
2
+ import { n as ze, r as Be, t as Ve } from "./log-record-CAoGBBf3.js";
3
+ import { n as He, r as Ue, t as We } from "./error-like-B11pB4aL.js";
4
+ import { t as E } from "./guards-Cidk71ME.js";
5
+ import { r as Ge } from "./deadline-BOjOxNHj.js";
6
+ import { i as D, n as Ke, t as qe } from "./platform-DkcuXwe-.js";
7
+ import { n as O, t as Je } from "./library-console-C1m6g1BR.js";
8
+ import { i as Ye, n as Xe, r as k } from "./sanitize-6ymPlVvP.js";
9
+ import { a as Ze, i as A, n as Qe, o as $e, r as et, s as tt, t as nt } from "./identity-DT5VmvXy.js";
10
+ import { r as rt } from "./library-request-BQBT9N9Q.js";
11
+ import { r as it, t as at } from "./batch-CL9uWYY3.js";
12
+ import { n as ot, t as st } from "./journey-CuJrHzEg.js";
13
+ import { a as ct, i as lt, n as ut, o as dt } from "./sampling-C4VV-1MS.js";
14
+ // src/utils/timer.ts
15
+ function ft(e) {
16
+ return Math.round((performance.now() - e) * se) / se;
17
+ }
18
+ function pt(e, t, n, r, i) {
16
19
  e.logMetric(`${t}.duration`, n, "ms", "histogram", {
17
20
  status: r,
18
21
  ...i
19
22
  });
20
23
  }
21
- function rt(e, t, n, r, i) {
22
- let a = M(n);
24
+ function mt(e, t, n, r, i) {
25
+ let a = ft(n);
23
26
  e.error(`${t} failed`, r, {
24
27
  "action.duration_ms": a,
25
28
  status: "FAILURE",
26
29
  ...i
27
- }), N(e, t, a, "FAILURE", i);
30
+ }), pt(e, t, a, "FAILURE", i);
28
31
  }
29
- function it(e, t, n, r) {
32
+ function ht(e, t, n, r) {
30
33
  let i = performance.now();
31
34
  try {
32
35
  let a = n();
33
- return N(e, t, M(i), "SUCCESS", r), a;
36
+ return pt(e, t, ft(i), "SUCCESS", r), a;
34
37
  } catch (n) {
35
- throw rt(e, t, i, n, r), n;
38
+ throw mt(e, t, i, n, r), n;
36
39
  }
37
40
  }
38
- async function at(e, t, n, r) {
41
+ async function gt(e, t, n, r) {
39
42
  let i = performance.now();
40
43
  try {
41
44
  let a = await n();
42
- return N(e, t, M(i), "SUCCESS", r), a;
45
+ return pt(e, t, ft(i), "SUCCESS", r), a;
43
46
  } catch (n) {
44
- throw rt(e, t, i, n, r), n;
45
- }
46
- }
47
- //#endregion
48
- //#region src/core/logger.ts
49
- var ot = [me, ge];
50
- function st(e, t) {
47
+ throw mt(e, t, i, n, r), n;
48
+ }
49
+ }
50
+ // src/core/deferred.ts
51
+ var j = /* @__PURE__ */ new WeakMap();
52
+ function _t(e) {
53
+ let t = e.idle;
54
+ t !== void 0 && (e.diagnostics.guard("pipeline.crashed", "The idle callback could not be cancelled.", () => {
55
+ cancelIdleCallback(t);
56
+ }), e.idle = void 0), clearTimeout(e.timer), e.timer = void 0;
57
+ }
58
+ function vt(e, t) {
59
+ typeof requestIdleCallback == "function" && typeof cancelIdleCallback == "function" && (t.idle = t.diagnostics.guard("pipeline.crashed", "The idle callback could not be scheduled.", () => requestIdleCallback((n) => {
60
+ M(e, t, n);
61
+ }, { timeout: s })), t.idle !== void 0) || (t.timer = setTimeout(() => {
62
+ M(e, t);
63
+ }, 0), Ge(t.timer));
64
+ }
65
+ function M(e, t, n) {
66
+ if (j.get(e) !== t || t.draining) return;
67
+ _t(t), t.draining = !0;
68
+ let r = t.work;
69
+ t.work = [];
70
+ let i = 0;
71
+ 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++, j.get(e) !== t) return;
72
+ t.work = [...r.slice(i), ...t.work], t.draining = !1, t.work.length > 0 ? vt(e, t) : j.delete(e);
73
+ }
74
+ function yt(e, t, n, r) {
75
+ let i = j.get(e), a = r > 0 ? Math.min(r, f) : f;
76
+ if (i && i.work.length >= a && !i.draining && (M(e, i), i = j.get(e)), i) {
77
+ if (i.work.length >= a) {
78
+ n.count("record.dropped_by_ceiling");
79
+ return;
80
+ }
81
+ i.work.push(t);
82
+ } else i = {
83
+ work: [t],
84
+ diagnostics: n,
85
+ draining: !1
86
+ }, j.set(e, i), vt(e, i);
87
+ }
88
+ function N(e) {
89
+ let t = j.get(e);
90
+ t && M(e, t);
91
+ }
92
+ function bt(e) {
93
+ let t = j.get(e);
94
+ if (t) {
95
+ _t(t), j.delete(e);
96
+ for (let e of t.work) t.diagnostics.count("record.dropped_by_ceiling");
97
+ t.work = [];
98
+ }
99
+ }
100
+ // src/core/logger.ts
101
+ var xt = [
102
+ _,
103
+ Ie,
104
+ Oe
105
+ ];
106
+ function St(e, t) {
51
107
  let n = t.guard("record.sanitize_failed", "The library could not read the error reason.", () => {
52
- if (!(e instanceof Error) && !Ae(e)) return;
108
+ if (!(e instanceof Error) && !Ue(e)) return;
53
109
  let t = Error(e.message);
54
110
  return t.name = e.name, t.stack = e.stack, t;
55
111
  });
@@ -57,27 +113,27 @@ function st(e, t) {
57
113
  let r = t.guard("record.sanitize_failed", "The library could not convert the error reason to text.", () => String(e));
58
114
  return Error(r ?? typeof e);
59
115
  }
60
- function ct(e, t, n) {
116
+ function Ct(e, t, n) {
61
117
  return n.guard("record.sanitize_failed", "The library could not read the error reason.", () => e instanceof Error ? e : t) ?? t;
62
118
  }
63
- function lt(e, t) {
119
+ function wt(e, t) {
64
120
  if (typeof e == "number" || typeof e == "boolean" || typeof e == "bigint" || typeof e == "symbol") return e;
65
121
  if (typeof e == "object" && e) return t.guard("record.sanitize_failed", "The library could not read the properties of the error reason.", () => {
66
- let t = e, n = Ae(e), r = {}, i = 0;
122
+ let t = e, n = Ue(e), r = {}, i = 0;
67
123
  for (let e of Object.keys(t)) {
68
124
  let a = t[e];
69
- (!n || !je.has(e)) && ke(a) && (r[e] = a, i++);
125
+ n && We.has(e) || !He(a) || (r[e] = a, i++);
70
126
  }
71
127
  return i === 0 ? void 0 : r;
72
128
  });
73
129
  }
74
- function ut(e) {
75
- if (!O(e) || e instanceof Error) return !1;
130
+ function Tt(e) {
131
+ if (!E(e) || e instanceof Error) return !1;
76
132
  let t = Object.getPrototypeOf(e);
77
133
  return t === null || Object.getPrototypeOf(t) === null;
78
134
  }
79
- function dt(e) {
80
- return ot.some((t) => e === t || e.startsWith(`${t}.`)) ? "system" : "log";
135
+ function Et(e) {
136
+ return xt.some((t) => e === t || e.startsWith(`${t}.`)) ? "system" : "log";
81
137
  }
82
138
  function P(e, t) {
83
139
  return e === void 0 ? {} : t.guard("record.sanitize_failed", "The library could not read the payload.", () => ({ ...e })) ?? { "uiobs.sanitize_failed": !0 };
@@ -88,7 +144,7 @@ var F = class e {
88
144
  options;
89
145
  levelType;
90
146
  constructor(e, t, n = {}) {
91
- this.bind = e, this.namespace = t, this.options = n, this.levelType = dt(t);
147
+ this.bind = e, this.namespace = t, this.options = n, this.levelType = Et(t);
92
148
  }
93
149
  child(t, n = {}) {
94
150
  return new e(this.bind, `${this.namespace}.${t}`, { scopedContext: {
@@ -120,82 +176,105 @@ var F = class e {
120
176
  logEvent = (e, t) => {
121
177
  this.write("INFO", "event", e, t);
122
178
  };
123
- logMetric = (e, t, n = m, i = "gauge", a) => {
179
+ logMetric = (e, t, n = ae, r = "gauge", i) => {
124
180
  if (!Number.isFinite(t)) {
125
181
  this.bind().diagnostics.report("record.dropped_malformed", "The metric value is not a finite number. The library dropped the metric.", { "metric.name": e });
126
182
  return;
127
183
  }
128
- let o = P(a, this.bind().diagnostics), s = {
129
- ...o,
130
- "metric.name": e,
131
- "metric.value": t,
132
- "metric.unit": n,
133
- "metric.type": i,
134
- [r.attributeKeys]: Object.keys(o)
135
- };
136
- this.write("INFO", "metric", e, s, !0);
137
- };
138
- timeSync = (e, t, n) => it(this, e, t, n);
139
- timeAsync = (e, t, n) => at(this, e, t, n);
140
- write(e, t, n, r, i = !1) {
141
184
  let a = this.bind();
142
- if (a.isDestroyed()) return;
143
- if (a.isRotating()) {
144
- a.diagnostics.count("record.dropped_during_rotation");
145
- return;
185
+ this.submit(a, "INFO", "metric", (o) => {
186
+ let s = P(i, a.diagnostics), c = {
187
+ ...s,
188
+ "metric.name": e,
189
+ "metric.value": t,
190
+ "metric.unit": n,
191
+ "metric.type": r,
192
+ [y.attributeKeys]: Object.keys(s)
193
+ };
194
+ this.writeNow(a, "INFO", "metric", e, c, !0, o);
195
+ });
196
+ };
197
+ timeSync = (e, t, n) => ht(this, e, t, n);
198
+ timeAsync = (e, t, n) => gt(this, e, t, n);
199
+ write(e, t, n, r) {
200
+ let i = this.bind();
201
+ this.submit(i, e, t, (a) => {
202
+ this.writeNow(i, e, t, n, r, !1, a);
203
+ });
204
+ }
205
+ submit(e, t, n, r) {
206
+ if (!e.isDestroyed()) {
207
+ if (e.isRotating()) e.diagnostics.count("record.dropped_during_rotation");
208
+ else if (e.config.payloadMode === "defer" && e.config.enabled && !e.config.debugBuffer.enabled && this.namespace !== "uiobs.diagnostics") {
209
+ if (!e.builder.isEnabled(t, this.namespace, n) && !this.mirrors(e, t)) return;
210
+ let i = e.journey.current(), a = {
211
+ timeUnixNano: Be(),
212
+ trace: e.tracing.resolve(),
213
+ journey: i ? { ...i } : null,
214
+ context: e.context.getAll(),
215
+ url: qe(e.diagnostics)
216
+ };
217
+ yt(e, () => {
218
+ r(a);
219
+ }, e.diagnostics, e.config.buffering.maxPendingRecords);
220
+ } else r();
146
221
  }
147
- if (!a.builder.isEnabled(e, this.namespace, t)) {
148
- this.mirrors(a, e) && this.print(a, e, n, r, void 0, null);
222
+ }
223
+ writeNow(e, t, n, r, i, a, o) {
224
+ if (!(e.config.enabled && e.config.debugBuffer.enabled) && !e.builder.isEnabled(t, this.namespace, n)) {
225
+ this.mirrors(e, t) && this.print(e, t, r, i, void 0, null, void 0, o);
149
226
  return;
150
227
  }
151
- let o = {
152
- level: e,
153
- type: t,
154
- body: n,
228
+ let s = {
229
+ snapshot: o,
230
+ level: t,
231
+ type: n,
232
+ body: r,
155
233
  namespace: this.namespace,
156
234
  scoped: this.options.scopedContext,
157
- payload: i ? r : P(r, a.diagnostics)
158
- }, { record: s, dropped: c } = a.builder.build(o), l = !!a.config.redact || a.config.processors.length > 0, u = t !== "metric" && a.config.capturePolicy.breadcrumbs > 0, d = c === "sampling" && l && u ? a.builder.build(o, !0) : void 0, f = s ?? d?.record ?? null, p = f ? f.body : c === "sampling" && !l ? n : void 0;
159
- u && p !== void 0 && a.breadcrumbs.push({
160
- t: Date.now(),
161
- category: t === "action" ? "action" : t === "event" ? "event" : "log",
162
- message: p
163
- }), this.print(a, e, n, r, void 0, f, d?.dropped ?? c), a.emit(s);
235
+ payload: a ? i : P(i, e.diagnostics)
236
+ }, { 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;
237
+ d && m !== void 0 && e.breadcrumbs.push({
238
+ t: o ? Number(o.timeUnixNano.slice(0, -6)) : Date.now(),
239
+ category: n === "action" ? "action" : n === "event" ? "event" : "log",
240
+ message: m
241
+ }), this.print(e, t, r, i, void 0, p, f?.dropped ?? l, o), e.emit(c);
164
242
  }
165
243
  writeError(e, t, n, r) {
166
244
  let i = this.bind();
167
- if (i.isDestroyed()) return;
168
- if (i.isRotating()) {
169
- i.diagnostics.count("record.dropped_during_rotation");
170
- return;
171
- }
172
- let a = i.builder.isEnabled(e, this.namespace);
173
- if (!a && !this.mirrors(i, e)) return;
174
- let o = r === void 0 && (i.diagnostics.guard("record.sanitize_failed", "The library could not read the error slot.", () => ut(n)) ?? !1), s = o ? n : r, c = o ? void 0 : n, l = c === void 0 ? void 0 : st(c, i.diagnostics), u = l === void 0 ? void 0 : ct(c, l, i.diagnostics);
175
- if (!a) {
176
- this.print(i, e, t, s, u, null);
245
+ this.submit(i, e, this.levelType, (a) => {
246
+ this.writeErrorNow(i, e, t, n, r, a);
247
+ });
248
+ }
249
+ writeErrorNow(e, t, n, r, i, a) {
250
+ let o = e.builder.isEnabled(t, this.namespace);
251
+ if (!o && !this.mirrors(e, t)) return;
252
+ let s = i === void 0 && (e.diagnostics.guard("record.sanitize_failed", "The library could not read the error slot.", () => Tt(r)) ?? !1), c = s ? r : i, l = s ? void 0 : r, u = l === void 0 ? void 0 : St(l, e.diagnostics), d = u === void 0 ? void 0 : Ct(l, u, e.diagnostics);
253
+ if (!o) {
254
+ this.print(e, t, n, c, d, null, void 0, a);
177
255
  return;
178
256
  }
179
- let d = l ? lt(c, i.diagnostics) : void 0, { record: f, dropped: p } = i.builder.build({
180
- level: e,
257
+ let f = u ? wt(l, e.diagnostics) : void 0, { record: p, dropped: m } = e.builder.build({
258
+ snapshot: a,
259
+ level: t,
181
260
  type: this.levelType,
182
- body: t,
261
+ body: n,
183
262
  namespace: this.namespace,
184
263
  scoped: this.options.scopedContext,
185
264
  payload: {
186
- ...P(s, i.diagnostics),
187
- ...l ? {
188
- "error.type": l.name,
189
- "error.message": l.message,
190
- "error.stack_trace": l.stack
265
+ ...P(c, e.diagnostics),
266
+ ...u ? {
267
+ "error.type": u.name,
268
+ "error.message": u.message,
269
+ "error.stack_trace": u.stack
191
270
  } : {},
192
- ...d === void 0 ? {} : { [xe]: d },
193
- [C]: i.breadcrumbs.snapshot()
271
+ ...f === void 0 ? {} : { [me]: f },
272
+ [b]: e.breadcrumbs.snapshot()
194
273
  }
195
274
  });
196
- this.print(i, e, t, s, u, f, p), i.emit(f);
275
+ this.print(e, t, n, c, d, p, m, a), e.emit(p);
197
276
  }
198
- print(e, t, n, r, i, a, o) {
277
+ print(e, t, n, r, i, a, o, s) {
199
278
  if (!e.config.redact && e.config.processors.length === 0) {
200
279
  e.console.write(this.namespace, t, n, r, i);
201
280
  return;
@@ -205,7 +284,8 @@ var F = class e {
205
284
  return;
206
285
  }
207
286
  if (o === "processor" || o === "redact" || o === "malformed" || !e.config.enabled || !e.console.accepts(t)) return;
208
- let s = e.builder.build({
287
+ let c = e.builder.build({
288
+ snapshot: s,
209
289
  level: t,
210
290
  type: this.levelType,
211
291
  body: n,
@@ -220,56 +300,56 @@ var F = class e {
220
300
  } : {}
221
301
  }
222
302
  }, !0).record;
223
- s && e.console.write(this.namespace, t, s.body, s.attributes);
303
+ c && e.console.write(this.namespace, t, c.body, c.attributes);
224
304
  }
225
305
  mirrors(e, t) {
226
306
  return e.config.enabled && e.console.accepts(t);
227
307
  }
228
- }, ft = "overflow", pt = /* @__PURE__ */ new Set([
229
- ce,
308
+ }, Dt = "overflow", Ot = /* @__PURE__ */ new Set([
309
+ ve,
310
+ ye,
311
+ ue,
312
+ C,
230
313
  x,
231
- T,
232
- _e,
233
- b,
234
- he,
235
- Se
314
+ De,
315
+ Ce
236
316
  ]);
237
- function mt(e = {}) {
317
+ function kt(e = {}) {
238
318
  let t = {};
239
319
  for (let n of Object.keys(e).sort()) {
240
- if (n.startsWith("metric.") || pt.has(n)) continue;
320
+ if (n.startsWith("metric.") || Ot.has(n)) continue;
241
321
  let r = e[n];
242
322
  (typeof r == "string" || typeof r == "boolean" || typeof r == "number" && Number.isFinite(r)) && (t[n] = r);
243
323
  }
244
324
  return t;
245
325
  }
246
- function ht(e, t) {
326
+ function At(e, t) {
247
327
  if (!Array.isArray(e)) return null;
248
328
  let n = t === 0 ? e.length : Math.min(e.length, t + 1);
249
329
  return Array.from({ length: n }, (t, n) => e[n]);
250
330
  }
251
- function gt(e, t) {
331
+ function jt(e, t) {
252
332
  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]));
253
333
  }
254
- function _t(e, t, n) {
255
- let i = {
334
+ function Mt(e, t, n) {
335
+ let r = {
256
336
  "metric.name": e.name,
257
337
  "metric.unit": e.unit,
258
338
  "metric.type": e.kind,
259
- [r.start]: n,
260
- [r.attributeKeys]: Object.keys(t.attributes)
339
+ [y.start]: n,
340
+ [y.attributeKeys]: Object.keys(t.attributes)
261
341
  };
262
- return e.kind === "counter" ? (i["metric.value"] = t.sum, i) : {
263
- ...i,
264
- [r.count]: t.count,
265
- [r.sum]: t.sum,
266
- [r.min]: t.min,
267
- [r.max]: t.max,
268
- [r.bounds]: e.boundaries,
269
- [r.buckets]: t.buckets
342
+ return e.kind === "counter" ? (r["metric.value"] = t.sum, r) : {
343
+ ...r,
344
+ [y.count]: t.count,
345
+ [y.sum]: t.sum,
346
+ [y.min]: t.min,
347
+ [y.max]: t.max,
348
+ [y.bounds]: e.boundaries,
349
+ [y.buckets]: t.buckets
270
350
  };
271
351
  }
272
- function vt(e, t, n) {
352
+ function Nt(e, t, n) {
273
353
  let r = {
274
354
  name: e,
275
355
  kind: "counter",
@@ -280,18 +360,18 @@ function vt(e, t, n) {
280
360
  n(r, e, t);
281
361
  } };
282
362
  }
283
- function yt(e, t, n) {
363
+ function Pt(e, t, n) {
284
364
  let r = {
285
365
  name: e,
286
366
  kind: "histogram",
287
367
  unit: t.unit ?? "count",
288
- boundaries: t.boundaries ?? h
368
+ boundaries: t.boundaries ?? g
289
369
  };
290
370
  return { record: (e, t) => {
291
371
  n(r, e, t);
292
372
  } };
293
373
  }
294
- var bt = class {
374
+ var Ft = class {
295
375
  intervalMs;
296
376
  emit;
297
377
  diagnostics;
@@ -309,25 +389,25 @@ var bt = class {
309
389
  record(e, t, n) {
310
390
  !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}.`, () => {
311
391
  let r = this.instrumentOf(e);
312
- r && (this.add(r, t, mt(n)), this.arm());
392
+ r && (this.add(r, t, kt(n)), this.arm());
313
393
  });
314
394
  }
315
395
  collect() {
316
396
  this.timer !== null && (clearTimeout(this.timer), this.timer = null);
317
397
  let e = `${String(this.startedAt)}000000`, t = [...this.instruments.values()];
318
398
  this.instruments.clear();
319
- for (let { def: n, series: r } of t) for (let t of r.values()) this.emit(n.name, t.attributes, _t(n, t, e));
399
+ for (let { def: n, series: r } of t) for (let t of r.values()) this.emit(n.name, t.attributes, Mt(n, t, e));
320
400
  }
321
401
  instrumentOf(e) {
322
402
  let t = this.instruments.get(e.name);
323
403
  if (t) return t.def.kind === e.kind ? t : (this.diagnostics.report("record.dropped_malformed", `The metric ${e.name} is a counter and a histogram. The library dropped the value.`, { "metric.name": e.name }), null);
324
404
  if (this.policy.maxInstruments && this.instruments.size >= this.policy.maxInstruments) return this.diagnostics.count("record.dropped_by_ceiling"), null;
325
- let n = ht(e.boundaries, this.policy.maxHistogramBoundaries), r = gt(n, this.policy.maxHistogramBoundaries);
405
+ let n = At(e.boundaries, this.policy.maxHistogramBoundaries), r = jt(n, this.policy.maxHistogramBoundaries);
326
406
  e.kind === "histogram" && !r && this.diagnostics.report("config.invalid", `The boundaries of the metric ${e.name} must meet metrics.maxHistogramBoundaries and contain finite numbers in ascending order. The library uses the default boundaries.`);
327
407
  let i = {
328
408
  def: {
329
409
  ...e,
330
- boundaries: r ? n : [...h]
410
+ boundaries: r ? n : [...g]
331
411
  },
332
412
  series: /* @__PURE__ */ new Map()
333
413
  };
@@ -335,7 +415,7 @@ var bt = class {
335
415
  }
336
416
  add(e, t, n) {
337
417
  let r = JSON.stringify(n), i = e.series.get(r), a = n;
338
- if (!i && this.policy.maxSeries > 0 && e.series.size >= this.policy.maxSeries && (r = ft, i = e.series.get(r), a = { [ve]: !0 }), !i) {
418
+ if (!i && this.policy.maxSeries > 0 && e.series.size >= this.policy.maxSeries && (r = Dt, i = e.series.get(r), a = { [le]: !0 }), !i) {
339
419
  let n = e.def.kind === "histogram" ? e.def.boundaries.length + 1 : 0, o = Array(n).fill(0);
340
420
  i = {
341
421
  attributes: a,
@@ -354,81 +434,81 @@ var bt = class {
354
434
  arm() {
355
435
  this.timer === null && (this.startedAt = Date.now(), this.timer = setTimeout(() => {
356
436
  this.collect();
357
- }, this.intervalMs()), ze(this.timer));
437
+ }, this.intervalMs()), Ge(this.timer));
358
438
  }
359
- }, xt = {
439
+ }, It = {
360
440
  TRACE: "debug",
361
441
  DEBUG: "debug",
362
442
  INFO: "info",
363
443
  WARN: "warn",
364
444
  ERROR: "error",
365
445
  FATAL: "error"
366
- }, St = class {
446
+ }, Lt = class {
367
447
  settings;
368
448
  diagnostics;
369
449
  limits;
370
- constructor(e, t, n = a) {
450
+ constructor(e, t, n = p) {
371
451
  this.settings = e, this.diagnostics = t, this.limits = n;
372
452
  }
373
453
  update(e) {
374
454
  this.settings = e;
375
455
  }
376
456
  accepts(e) {
377
- return this.settings.level === null || !Object.hasOwn(S, this.settings.level) ? !1 : S[e] >= S[this.settings.level];
457
+ return this.settings.level === null || !Object.hasOwn(w, this.settings.level) ? !1 : w[e] >= w[this.settings.level];
378
458
  }
379
459
  write(e, t, n, r, i) {
380
- if (!this.accepts(t) || typeof console > "u" || Be()) return;
381
- let a = `%c[%s]%c[${t}]%c`, { styles: o } = this.settings, s = xt[t];
460
+ if (!this.accepts(t) || typeof console > "u" || Je()) return;
461
+ let a = `%c[%s]%c[${t}]%c`, { styles: o } = this.settings, s = It[t];
382
462
  this.diagnostics.guard("handler.threw", `The library could not print to console.${s}.`, () => {
383
463
  let c = [];
384
- i !== void 0 && c.push(i), r !== void 0 && c.push(He(r, this.limits, this.diagnostics)), k(() => {
464
+ i !== void 0 && c.push(i), r !== void 0 && c.push(Xe(r, this.limits, this.diagnostics)), O(() => {
385
465
  console[s](a, o.namespace, e, o[t], "", n, ...c);
386
466
  });
387
467
  });
388
468
  }
389
- }, Ct = class {
469
+ }, Rt = class {
390
470
  value = 0;
391
471
  next() {
392
472
  return ++this.value;
393
473
  }
394
- }, wt = /^[0-9a-f]{32}$/, Tt = /^[0-9a-f]{16}$/, Et = /[1-9a-f]/;
395
- function Dt(e) {
396
- return wt.test(e.traceId) && Et.test(e.traceId) && Tt.test(e.spanId) && Et.test(e.spanId);
474
+ }, zt = /^[0-9a-f]{32}$/, Bt = /^[0-9a-f]{16}$/, Vt = /[1-9a-f]/;
475
+ function Ht(e) {
476
+ return zt.test(e.traceId) && Vt.test(e.traceId) && Bt.test(e.spanId) && Vt.test(e.spanId);
397
477
  }
398
- function Ot() {
399
- return Ge(16);
478
+ function Ut() {
479
+ return $e(16);
400
480
  }
401
- function kt() {
402
- return Ge(8);
481
+ function Wt() {
482
+ return $e(8);
403
483
  }
404
- function At(e) {
484
+ function Gt(e) {
405
485
  return {
406
- traceId: Ot(),
407
- spanId: kt(),
486
+ traceId: Ut(),
487
+ spanId: Wt(),
408
488
  traceFlags: 1,
409
489
  startedAt: Date.now(),
410
490
  reason: e,
411
491
  ended: !1
412
492
  };
413
493
  }
414
- function jt(e, t, n) {
494
+ function Kt(e, t, n) {
415
495
  return `00-${e}-${t}-${(n & 255).toString(16).padStart(2, "0")}`;
416
496
  }
417
- function Mt(e) {
497
+ function qt(e) {
418
498
  return {
419
499
  traceId: e.traceId,
420
500
  spanId: e.spanId,
421
501
  traceFlags: e.traceFlags
422
502
  };
423
503
  }
424
- var Nt = class {
504
+ var Jt = class {
425
505
  diagnostics;
426
506
  maxAgeMs;
427
507
  load;
428
508
  spans;
429
- ambient = At("start");
509
+ ambient = Gt("start");
430
510
  otel;
431
- constructor(e, t = se, n, r) {
511
+ constructor(e, t = o, n, r) {
432
512
  this.diagnostics = e, this.maxAgeMs = t, this.load = n, this.spans = r;
433
513
  }
434
514
  async loadOtel() {
@@ -442,7 +522,7 @@ var Nt = class {
442
522
  return this.activeSpanContext() ?? this.ambientContext();
443
523
  }
444
524
  ambientContext() {
445
- return Date.now() - this.ambient.startedAt > this.maxAgeMs && this.rotate("maxAge"), Mt(this.ambient);
525
+ return Date.now() - this.ambient.startedAt > this.maxAgeMs && this.rotate("maxAge"), qt(this.ambient);
446
526
  }
447
527
  activeSpanContext() {
448
528
  let e = this.otel;
@@ -450,7 +530,7 @@ var Nt = class {
450
530
  let t = e.trace.getActiveSpan();
451
531
  if (t === void 0) return;
452
532
  let n = t.spanContext();
453
- if (Dt(n)) return {
533
+ if (Ht(n)) return {
454
534
  traceId: n.traceId,
455
535
  spanId: n.spanId,
456
536
  traceFlags: n.traceFlags
@@ -459,8 +539,8 @@ var Nt = class {
459
539
  }
460
540
  rotate(e) {
461
541
  let t = this.ambient;
462
- this.ambient = At(e);
463
- let n = Mt(this.ambient);
542
+ this.ambient = Gt(e);
543
+ let n = qt(this.ambient);
464
544
  return this.finish(t), n;
465
545
  }
466
546
  end() {
@@ -487,9 +567,9 @@ var Nt = class {
487
567
  n.propagation.inject(n.context.active(), t);
488
568
  }), t.traceparent) return { headers: t };
489
569
  let r = this.activeSpanContext(), i = r ?? this.ambientContext(), a = r ? void 0 : this.spans;
490
- if (!a?.enabled()) return t[Ee] = jt(i.traceId, i.spanId, i.traceFlags), { headers: t };
491
- let o = a.keeps(i.traceId), s = o ? i.traceFlags : i.traceFlags & -2, c = e ? kt() : i.spanId;
492
- return t[Ee] = jt(i.traceId, c, s), !e || !o ? { headers: t } : {
570
+ if (!a?.enabled()) return t[ee] = Kt(i.traceId, i.spanId, i.traceFlags), { headers: t };
571
+ let o = a.keeps(i.traceId), s = o ? i.traceFlags : i.traceFlags & -2, c = e ? Wt() : i.spanId;
572
+ return t[ee] = Kt(i.traceId, c, s), !e || !o ? { headers: t } : {
493
573
  headers: t,
494
574
  span: {
495
575
  traceId: i.traceId,
@@ -498,7 +578,7 @@ var Nt = class {
498
578
  }
499
579
  };
500
580
  }
501
- }, Pt = class {
581
+ }, Yt = class {
502
582
  buffer;
503
583
  pointer = 0;
504
584
  filled = !1;
@@ -519,45 +599,45 @@ var Nt = class {
519
599
  snapshot() {
520
600
  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);
521
601
  }
522
- }, Ft = Object.keys(S), It = ["gzip", "none"], Lt = [
602
+ }, Xt = Object.keys(w), Zt = ["gzip", "none"], Qt = [
523
603
  "omit",
524
604
  "same-origin",
525
605
  "include"
526
- ], Rt = [
606
+ ], $t = [
527
607
  "auto",
528
608
  "indexeddb",
529
609
  "localstorage",
530
610
  "memory",
531
611
  "none"
532
- ], zt = ["storage", "memory"], Bt = [
612
+ ], en = ["storage", "memory"], tn = [
533
613
  "auto",
534
614
  "sender",
535
615
  "forwarder",
536
616
  "off"
537
- ], Vt = [
617
+ ], nn = [
538
618
  "auto",
539
619
  "provider",
540
620
  "client"
541
- ], Ht = [
621
+ ], rn = [
542
622
  "auto",
543
623
  "context",
544
624
  "tab",
545
625
  "origin"
546
- ], Ut = [
626
+ ], an = [
547
627
  "error",
548
628
  "warn",
549
629
  "info",
550
630
  "log"
551
- ], Wt = ["limited", "until-delivered"], Gt = {
631
+ ], on = ["limited", "until-delivered"], sn = {
552
632
  logFlushIntervalMs: [100, 6e4],
553
633
  logBatchSize: [1, 1e3],
554
634
  metricFlushIntervalMs: [100, 6e4],
555
635
  metricBatchSize: [1, 1e3]
556
- }, Kt = {
636
+ }, cn = {
557
637
  maxBatches: [1, 5e3],
558
638
  maxAgeMs: [6e4, 6048e5],
559
639
  maxAttempts: [1, 20]
560
- }, qt = {
640
+ }, ln = {
561
641
  maxBodyChars: [256, 65536],
562
642
  maxAttributeChars: [256, 65536],
563
643
  maxAttributeCount: [1, 1024],
@@ -565,8 +645,8 @@ var Nt = class {
565
645
  maxDepth: [1, 16],
566
646
  maxArrayLength: [1, 1e4],
567
647
  maxNodes: [100, 1e5],
568
- maxRecordBytes: [1024, n]
569
- }, Jt = [6e4, 864e5], I = [0, 2147483647], L = [0, 2 ** 53 - 1], Yt = [1, 2 ** 53 - 1], Xt = {
648
+ maxRecordBytes: [1024, r]
649
+ }, un = [6e4, 864e5], I = [0, 2147483647], L = [0, 2 ** 53 - 1], dn = [1, 2 ** 53 - 1], fn = [100, 1e4], pn = {
570
650
  capturePolicy: { ranges: {
571
651
  breadcrumbs: [0, 1e6],
572
652
  errorDedupeMs: I,
@@ -575,12 +655,18 @@ var Nt = class {
575
655
  consolePerWindow: L,
576
656
  longFramesPerWindow: L,
577
657
  webSocketPerWindow: L,
658
+ reportsPerWindow: L,
659
+ resourcesPerWindow: L,
660
+ lifecyclePerWindow: L,
578
661
  windowMs: I,
579
662
  errorCeiling: L
580
663
  } },
581
664
  metadata: { ranges: {} },
582
665
  persistence: { ranges: {} },
583
- diagnostics: { ranges: { throttleMs: I } },
666
+ diagnostics: {
667
+ ranges: { throttleMs: I },
668
+ custom: { records: jn }
669
+ },
584
670
  correlation: { ranges: {
585
671
  sessionIdleMs: I,
586
672
  sessionTouchMs: I,
@@ -602,15 +688,26 @@ var Nt = class {
602
688
  "persist"
603
689
  ] }
604
690
  },
605
- delivery: { ranges: {
606
- requestTimeoutMs: [1, I[1]],
607
- maxConcurrentRequests: Yt,
608
- retryBaseDelayMs: I,
609
- retryMaxDelayMs: I,
610
- retryIdleDelayMs: I,
611
- batchesPerDrain: Yt
691
+ delivery: {
692
+ ranges: {
693
+ requestTimeoutMs: [1, I[1]],
694
+ maxConcurrentRequests: dn,
695
+ retryBaseDelayMs: I,
696
+ retryMaxDelayMs: I,
697
+ retryIdleDelayMs: I,
698
+ batchesPerDrain: dn
699
+ },
700
+ choices: { priority: [
701
+ "low",
702
+ "auto",
703
+ "high"
704
+ ] }
705
+ },
706
+ debugBuffer: { ranges: {
707
+ maxRecords: [1, 1e4],
708
+ maxAgeMs: I
612
709
  } }
613
- }, Zt = [
710
+ }, mn = [
614
711
  "errors",
615
712
  "rejections",
616
713
  "resourceErrors",
@@ -621,146 +718,154 @@ var Nt = class {
621
718
  "webVitals",
622
719
  "longFrames",
623
720
  "fullUrls",
624
- "webSocket"
625
- ], Qt = "null", R = `a level name: ${z(Ft)}`, $t = `true, false or a list of ${z(Ut)}`, en = "a list of strings and RegExp patterns", tn = "a list of origin URLs such as \"https://api.example\" and RegExp patterns", nn = "a list of origin URLs such as \"https://app.example\". For a sandboxed frame, set bus.mode: \"sender\" in the frame", rn = "a list of strings";
626
- function z(e) {
721
+ "webSocket",
722
+ "uncleanExit",
723
+ "userTiming",
724
+ "serverTiming",
725
+ "reports",
726
+ "lifecycle"
727
+ ], hn = "null", R = `a level name: ${Sn(Xt)}`, gn = `true, false or a list of ${Sn(an)}`, _n = "a list of strings and RegExp patterns", vn = "a list of origin URLs such as \"https://api.example\" and RegExp patterns", yn = "a list of origin URLs such as \"https://app.example\". For a sandboxed frame, set bus.mode: \"sender\" in the frame", bn = "a list of strings", xn = "true, false or a list of diagnostic codes";
728
+ function Sn(e) {
627
729
  let t = e.map((e) => `"${e}"`);
628
730
  return `${t.slice(0, -1).join(", ")} or ${t[t.length - 1]}`;
629
731
  }
630
- function an(e) {
732
+ function Cn(e) {
631
733
  return typeof e == "string" ? `"${e}"` : typeof e == "function" ? "a function" : typeof e == "object" && e ? "an object" : String(e);
632
734
  }
633
- function B(e, t, n, r, i) {
634
- e.report("config.invalid", `${t} must be ${n}. The value is ${an(r)}. The library keeps ${i}.`);
735
+ function z(e, t, n, r, i) {
736
+ e.report("config.invalid", `${t} must be ${n}. The value is ${Cn(r)}. The library keeps ${i}.`);
635
737
  }
636
- function V(e, t, n, r, i) {
738
+ function B(e, t, n, r, i) {
637
739
  if (t === void 0) return r;
638
740
  let a = n.find((e) => e === t);
639
- return a === void 0 ? (B(i, e, z(n), t, `"${r}"`), r) : a;
741
+ return a === void 0 ? (z(i, e, Sn(n), t, `"${r}"`), r) : a;
640
742
  }
641
- function H(e, t, n, r) {
642
- return t === void 0 ? n : typeof t == "boolean" ? t : (B(r, e, "true or false", t, String(n)), n);
743
+ function V(e, t, n, r) {
744
+ return t === void 0 ? n : typeof t == "boolean" ? t : (z(r, e, "true or false", t, String(n)), n);
643
745
  }
644
- function on(e, t, n, r) {
645
- return t === void 0 ? n : typeof t == "number" && Number.isFinite(t) && t >= 0 ? t : (B(r, e, "a finite number of 0 or more", t, String(n)), n);
746
+ function wn(e, t, n, r) {
747
+ return t === void 0 ? n : typeof t == "number" && Number.isFinite(t) && t >= 0 ? t : (z(r, e, "a finite number of 0 or more", t, String(n)), n);
646
748
  }
647
- function U(e, t, n, r, i) {
749
+ function H(e, t, n, r, i) {
648
750
  if (t === void 0) return r;
649
751
  let [a, o] = n;
650
- return typeof t == "number" && Number.isInteger(t) && t >= a && t <= o ? t : (B(i, e, `an integer from ${String(a)} to ${String(o)}`, t, String(r)), r);
752
+ return typeof t == "number" && Number.isInteger(t) && t >= a && t <= o ? t : (z(i, e, `an integer from ${String(a)} to ${String(o)}`, t, String(r)), r);
651
753
  }
652
- function sn(e, t, n) {
653
- return e === void 0 ? t : e === null ? null : typeof e == "number" && Number.isSafeInteger(e) && e >= 0 ? e : (B(n, "loggerCache.maxEntries", "a nonnegative safe integer or null", e, String(t)), t);
754
+ function Tn(e, t, n) {
755
+ return e === void 0 ? t : e === null ? null : typeof e == "number" && Number.isSafeInteger(e) && e >= 0 ? e : (z(n, "loggerCache.maxEntries", "a nonnegative safe integer or null", e, String(t)), t);
654
756
  }
655
- function cn(e, t, n, r, i) {
757
+ function En(e, t, n, r, i) {
656
758
  let a = t ?? {}, o = Object.keys(r);
657
- return Object.fromEntries(o.map((t) => [t, U(`${e}.${t}`, a[t], r[t], n[t], i)]));
759
+ return Object.fromEntries(o.map((t) => [t, H(`${e}.${t}`, a[t], r[t], n[t], i)]));
658
760
  }
659
- function W(e) {
761
+ function U(e) {
660
762
  if (typeof e != "string") return;
661
763
  let t = e.toUpperCase();
662
- return Ft.find((e) => e === t);
764
+ return Xt.find((e) => e === t);
663
765
  }
664
- function ln(e, t, n, r) {
766
+ function Dn(e, t, n, r) {
665
767
  if (t === void 0) return n;
666
- let i = W(t);
667
- return i === void 0 ? (B(r, e, R, t, `"${n}"`), n) : i;
768
+ let i = U(t);
769
+ return i === void 0 ? (z(r, e, R, t, `"${n}"`), n) : i;
668
770
  }
669
- function un(e, t, n) {
771
+ function On(e, t, n) {
670
772
  if (e === void 0) return t;
671
- if (!O(e)) return B(n, "minLevels", "an object of level names", e, "the value in force"), t;
773
+ if (!E(e)) return z(n, "minLevels", "an object of level names", e, "the value in force"), t;
672
774
  let r = [];
673
775
  for (let [t, i] of Object.entries(e)) {
674
- let e = W(i);
675
- t !== "" && e !== void 0 ? r.push([t, e]) : B(n, `minLevels["${t}"]`, R, i, "minLevel for it");
776
+ let e = U(i);
777
+ t !== "" && e !== void 0 ? r.push([t, e]) : z(n, `minLevels["${t}"]`, R, i, "minLevel for it");
676
778
  }
677
779
  return Object.fromEntries(r);
678
780
  }
679
- function G(e, t, n, r, i, a) {
781
+ function W(e, t, n, r, i, a) {
680
782
  if (t === void 0) return n;
681
- if (!Array.isArray(t)) return B(a, e, r, t, "the list in force"), n;
783
+ if (!Array.isArray(t)) return z(a, e, r, t, "the list in force"), n;
682
784
  let o = [], s = t;
683
785
  for (let t of s) {
684
786
  let n = i(t);
685
- n === void 0 ? a.report("config.invalid", `The library ignores the ${e} entry ${an(t)}. ${e} must be ${r}.`) : o.push(n);
787
+ n === void 0 ? a.report("config.invalid", `The library ignores the ${e} entry ${Cn(t)}. ${e} must be ${r}.`) : o.push(n);
686
788
  }
687
789
  return o;
688
790
  }
689
- function dn(e) {
791
+ function kn(e) {
690
792
  return typeof e == "function" ? e : void 0;
691
793
  }
692
- function fn(e) {
693
- return O(e) && typeof e.name == "string" && e.name !== "" && typeof e.install == "function" && typeof e.uninstall == "function" ? e : void 0;
794
+ function An(e) {
795
+ return E(e) && typeof e.name == "string" && e.name !== "" && typeof e.install == "function" && typeof e.uninstall == "function" ? e : void 0;
796
+ }
797
+ function jn(e, t, n, r) {
798
+ return t === void 0 || typeof t == "boolean" ? t ?? n : Array.isArray(t) ? W(e, t, [], xn, Mn, r) : (z(r, e, xn, t, "the value in force"), n);
694
799
  }
695
- function pn(e) {
800
+ function Mn(e) {
696
801
  return typeof e == "string" ? e : void 0;
697
802
  }
698
- function mn(e) {
803
+ function Nn(e) {
699
804
  return typeof e == "string" || e instanceof RegExp ? e : void 0;
700
805
  }
701
- function hn(e) {
702
- return Ut.find((t) => t === e);
806
+ function Pn(e) {
807
+ return an.find((t) => t === e);
703
808
  }
704
- function gn(e) {
809
+ function Fn(e) {
705
810
  if (typeof e == "string") try {
706
811
  let { origin: t } = new URL(e);
707
- return t === Qt ? void 0 : t;
812
+ return t === hn ? void 0 : t;
708
813
  } catch {
709
814
  return;
710
815
  }
711
816
  }
712
- function _n(e) {
713
- return e instanceof RegExp ? e : gn(e);
817
+ function In(e) {
818
+ return e instanceof RegExp ? e : Fn(e);
714
819
  }
715
- function vn(e) {
716
- return O(e) ? Object.values(e).every((e) => typeof e == "string") : !1;
820
+ function Ln(e) {
821
+ return E(e) ? Object.values(e).every((e) => typeof e == "string") : !1;
717
822
  }
718
- function yn(e, t, n) {
719
- if (e !== void 0) return typeof e == "function" || vn(e) ? e : (B(n, "headers", "an object of strings or a function", e, "the headers in force"), t);
823
+ function Rn(e, t, n) {
824
+ if (e !== void 0) return typeof e == "function" || Ln(e) ? e : (n.report("config.invalid", "headers must be an object of strings or a function. The library keeps the headers in force."), t);
720
825
  }
721
- function bn(e) {
826
+ function zn(e) {
722
827
  return typeof e != "object" || !e ? !1 : typeof Reflect.get(e, "serialize") == "function";
723
828
  }
724
- function xn(e, t, n) {
725
- return e === void 0 ? t ?? "otlp" : e === "otlp" || e === "ecs" || bn(e) ? e : (n.report("config.invalid", `serializer must be "${E}", "ecs" or an implementation. The library uses "${E}".`), E);
829
+ function Bn(e, t, n) {
830
+ return e === void 0 ? t ?? "otlp" : e === "otlp" || e === "ecs" || zn(e) ? e : (n.report("config.invalid", `serializer must be "${S}", "ecs" or an implementation. The library uses "${S}".`), S);
726
831
  }
727
- var Sn = new Set(Object.keys(f));
728
- function Cn(e, t) {
832
+ var Vn = new Set(Object.keys(m));
833
+ function Hn(e, t) {
729
834
  let n = {}, r = Object.entries(e ?? {});
730
- for (let [e, i] of r) Sn.has(e) ? typeof i == "string" ? n[e] = i : t.report("config.invalid", `console.styles.${e} must be a string. The library keeps the style in force.`) : t.report("config.invalid", `The library ignores the unknown console.styles key "${e}". Check the spelling.`);
835
+ for (let [e, i] of r) Vn.has(e) ? typeof i == "string" ? n[e] = i : t.report("config.invalid", `console.styles.${e} must be a string. The library keeps the style in force.`) : t.report("config.invalid", `The library ignores the unknown console.styles key "${e}". Check the spelling.`);
731
836
  return n;
732
837
  }
733
- function wn(e, t, n) {
838
+ function Un(e, t, n) {
734
839
  if (e === void 0) return t ?? "DEBUG";
735
- let r = W(e);
736
- return r === void 0 ? (B(n, "console.level", R, e, "the console level in force"), t) : r;
840
+ let r = U(e);
841
+ return r === void 0 ? (z(n, "console.level", R, e, "the console level in force"), t) : r;
737
842
  }
738
- function Tn(e, t, n) {
843
+ function Wn(e, t, n) {
739
844
  if (e === void 0) return t;
740
845
  if (e === !1) return {
741
846
  level: null,
742
847
  styles: t.styles
743
848
  };
744
849
  if (e === !0) return {
745
- level: d,
850
+ level: l,
746
851
  styles: t.styles
747
852
  };
748
853
  if (typeof e == "string") {
749
- let r = W(e);
750
- return r === void 0 ? (B(n, "console", R, e, "the console level in force"), t) : {
854
+ let r = U(e);
855
+ return r === void 0 ? (z(n, "console", R, e, "the console level in force"), t) : {
751
856
  level: r,
752
857
  styles: t.styles
753
858
  };
754
859
  }
755
860
  return typeof e != "object" || !e ? (n.report("config.invalid", "console must be a boolean, a level or an object. The console settings in force stay."), t) : {
756
- level: wn(e.level, t.level, n),
861
+ level: Un(e.level, t.level, n),
757
862
  styles: {
758
863
  ...t.styles,
759
- ...Cn(e.styles, n)
864
+ ...Hn(e.styles, n)
760
865
  }
761
866
  };
762
867
  }
763
- function En(e, t, n) {
868
+ function Gn(e, t, n) {
764
869
  let r = e ?? {};
765
870
  return {
766
871
  ...t,
@@ -769,59 +874,66 @@ function En(e, t, n) {
769
874
  ...t.rates,
770
875
  ...r.rates
771
876
  },
772
- alwaysSampleTypes: G("sampling.alwaysSampleTypes", r.alwaysSampleTypes, t.alwaysSampleTypes, rn, pn, n),
773
- remote: H("sampling.remote", r.remote, t.remote, n)
877
+ alwaysSampleTypes: W("sampling.alwaysSampleTypes", r.alwaysSampleTypes, t.alwaysSampleTypes, bn, Mn, n),
878
+ alwaysSampleFrom: Dn("sampling.alwaysSampleFrom", r.alwaysSampleFrom, t.alwaysSampleFrom, n),
879
+ remote: V("sampling.remote", r.remote, t.remote, n)
774
880
  };
775
881
  }
776
- function Dn(e, t, n) {
882
+ function Kn(e, t, n) {
777
883
  let r = e ?? {};
778
884
  return {
779
- maxTrackedSources: U("bus.maxTrackedSources", r.maxTrackedSources, [0, 2 ** 53 - 1], t.maxTrackedSources, n),
780
- sourcePolicy: V("bus.sourcePolicy", r.sourcePolicy, ["registered", "trusted-origin"], t.sourcePolicy, n),
781
- validation: V("bus.validation", r.validation, ["strict", "envelope"], t.validation, n),
782
- maxMessageBytes: U("bus.maxMessageBytes", r.maxMessageBytes, [0, 2 ** 53 - 1], t.maxMessageBytes, n),
783
- maxRecordsPerMessage: U("bus.maxRecordsPerMessage", r.maxRecordsPerMessage, [0, 2 ** 53 - 1], t.maxRecordsPerMessage, n),
784
- maxMessagesPerSecond: U("bus.maxMessagesPerSecond", r.maxMessagesPerSecond, [0, 2 ** 53 - 1], t.maxMessagesPerSecond, n),
785
- mode: V("bus.mode", r.mode, Bt, t.mode, n),
786
- trustedOrigins: G("bus.trustedOrigins", r.trustedOrigins, t.trustedOrigins, nn, gn, n),
787
- openFinRole: V("bus.openFinRole", r.openFinRole, Vt, t.openFinRole, n)
885
+ maxTrackedSources: H("bus.maxTrackedSources", r.maxTrackedSources, [0, 2 ** 53 - 1], t.maxTrackedSources, n),
886
+ sourcePolicy: B("bus.sourcePolicy", r.sourcePolicy, ["registered", "trusted-origin"], t.sourcePolicy, n),
887
+ validation: B("bus.validation", r.validation, ["strict", "envelope"], t.validation, n),
888
+ maxMessageBytes: H("bus.maxMessageBytes", r.maxMessageBytes, [0, 2 ** 53 - 1], t.maxMessageBytes, n),
889
+ maxRecordsPerMessage: H("bus.maxRecordsPerMessage", r.maxRecordsPerMessage, [0, 2 ** 53 - 1], t.maxRecordsPerMessage, n),
890
+ maxMessagesPerSecond: H("bus.maxMessagesPerSecond", r.maxMessagesPerSecond, [0, 2 ** 53 - 1], t.maxMessagesPerSecond, n),
891
+ mode: B("bus.mode", r.mode, tn, t.mode, n),
892
+ trustedOrigins: W("bus.trustedOrigins", r.trustedOrigins, t.trustedOrigins, yn, Fn, n),
893
+ openFinRole: B("bus.openFinRole", r.openFinRole, nn, t.openFinRole, n)
788
894
  };
789
895
  }
790
- function On(e, t, n) {
896
+ function qn(e, t, n) {
791
897
  let r = e ?? {};
792
898
  return {
793
- scope: V("journey.scope", r.scope, Ht, t.scope, n),
794
- maxAgeMs: U("journey.maxAgeMs", r.maxAgeMs, Jt, t.maxAgeMs, n)
899
+ scope: B("journey.scope", r.scope, rn, t.scope, n),
900
+ maxAgeMs: H("journey.maxAgeMs", r.maxAgeMs, un, t.maxAgeMs, n)
795
901
  };
796
902
  }
797
- function kn(e, t, n) {
903
+ function Jn(e, t, n) {
798
904
  let r = e ?? {};
799
905
  return {
800
- mode: V("retention.mode", r.mode, Wt, t.mode, n),
801
- ...cn("retention", r, t, Kt, n)
906
+ mode: B("retention.mode", r.mode, on, t.mode, n),
907
+ ...En("retention", r, t, cn, n)
802
908
  };
803
909
  }
804
- function An(e, t, n) {
805
- return e === void 0 ? t : typeof e == "boolean" ? e : Array.isArray(e) ? G("capture.console", e, [], $t, hn, n) : (B(n, "capture.console", $t, e, "the value in force"), t);
910
+ function Yn(e, t, n) {
911
+ return e === void 0 ? t : typeof e == "boolean" ? e : Array.isArray(e) ? W("capture.console", e, [], gn, Pn, n) : (z(n, "capture.console", gn, e, "the value in force"), t);
806
912
  }
807
- function jn(e, t, n) {
913
+ function Xn(e, t, n) {
808
914
  let r = e ?? {}, i = {
809
915
  ...t,
810
916
  ...r,
811
- interactions: Mn(r.interactions, t.interactions, n),
812
- console: An(r.console, t.console, n),
813
- longFrameThresholdMs: on("capture.longFrameThresholdMs", r.longFrameThresholdMs, t.longFrameThresholdMs, n),
814
- ignoreUrls: G("capture.ignoreUrls", r.ignoreUrls, t.ignoreUrls, en, mn, n),
815
- propagateTraceHeaderTo: G("capture.propagateTraceHeaderTo", r.propagateTraceHeaderTo, t.propagateTraceHeaderTo, tn, _n, n),
816
- plugins: G("capture.plugins", r.plugins, t.plugins, "a list of objects with a name, install() and uninstall()", fn, n)
917
+ remoteToggles: W("capture.remoteToggles", r.remoteToggles, t.remoteToggles, "a list of capture switch names without privacy controls", (e) => ke.find((t) => t === e), n),
918
+ resourceTiming: Zn(r.resourceTiming, t.resourceTiming, n),
919
+ interactions: Qn(r.interactions, t.interactions, n),
920
+ console: Yn(r.console, t.console, n),
921
+ longFrameThresholdMs: wn("capture.longFrameThresholdMs", r.longFrameThresholdMs, t.longFrameThresholdMs, n),
922
+ ignoreUrls: W("capture.ignoreUrls", r.ignoreUrls, t.ignoreUrls, _n, Nn, n),
923
+ userTimingInclude: W("capture.userTimingInclude", r.userTimingInclude, t.userTimingInclude, _n, Nn, n),
924
+ propagateTraceHeaderTo: W("capture.propagateTraceHeaderTo", r.propagateTraceHeaderTo, t.propagateTraceHeaderTo, vn, In, n),
925
+ plugins: W("capture.plugins", r.plugins, t.plugins, "a list of objects with a name, install() and uninstall()", An, n)
817
926
  };
818
- for (let e of Zt) i[e] = H(`capture.${e}`, r[e], t[e], n);
927
+ for (let e of mn) i[e] = V(`capture.${e}`, r[e], t[e], n);
819
928
  return i;
820
929
  }
821
- function Mn(e, t, n) {
930
+ function Zn(e, t, n) {
931
+ return e === void 0 ? t : typeof e == "boolean" ? e : E(e) ? { slowMs: wn("capture.resourceTiming.slowMs", e.slowMs, typeof t == "object" ? t.slowMs ?? 1e3 : Ee, n) } : (n.report("config.invalid", "capture.resourceTiming must be a boolean or an options object."), t);
932
+ }
933
+ function Qn(e, t, n) {
822
934
  if (e === void 0) return t;
823
935
  if (typeof e == "boolean") return e;
824
- if (!O(e)) return n.report("config.invalid", "capture.interactions must be a boolean or an options object."), t;
936
+ if (!E(e)) return n.report("config.invalid", "capture.interactions must be a boolean or an options object."), t;
825
937
  let r = typeof t == "object" ? t : {}, i = e.ignoreSelector, a = i === void 0 ? r.ignoreSelector : i;
826
938
  if (a != null) try {
827
939
  if (typeof a != "string") throw Error("Invalid selector");
@@ -830,107 +942,112 @@ function Mn(e, t, n) {
830
942
  n.report("config.invalid", "capture.interactions.ignoreSelector must be a valid CSS selector or null."), a = r.ignoreSelector;
831
943
  }
832
944
  let o = r.actionAttribute ?? "data-observability-action";
833
- return e.actionAttribute !== void 0 && (typeof e.actionAttribute == "string" && /^[a-z][\w-]*$/i.test(e.actionAttribute) ? o = e.actionAttribute : B(n, "capture.interactions.actionAttribute", "an attribute name of letters, digits, hyphens and underscores", e.actionAttribute, `"${o}"`)), {
945
+ return e.actionAttribute !== void 0 && (typeof e.actionAttribute == "string" && /^[a-z][\w-]*$/i.test(e.actionAttribute) ? o = e.actionAttribute : z(n, "capture.interactions.actionAttribute", "an attribute name of letters, digits, hyphens and underscores", e.actionAttribute, `"${o}"`)), {
834
946
  actionAttribute: o,
835
- text: H("capture.interactions.text", e.text, r.text ?? !1, n),
836
- selector: H("capture.interactions.selector", e.selector, r.selector ?? !1, n),
947
+ text: V("capture.interactions.text", e.text, r.text ?? !1, n),
948
+ selector: V("capture.interactions.selector", e.selector, r.selector ?? !1, n),
837
949
  ignoreSelector: typeof a == "string" || a === null ? a : void 0,
838
- maxTextChars: U("capture.interactions.maxTextChars", e.maxTextChars, [0, 2 ** 53 - 1], r.maxTextChars ?? 50, n)
950
+ maxTextChars: H("capture.interactions.maxTextChars", e.maxTextChars, [0, 2 ** 53 - 1], r.maxTextChars ?? 50, n),
951
+ rageClicks: V("capture.interactions.rageClicks", e.rageClicks, r.rageClicks ?? !1, n),
952
+ rageClickCount: H("capture.interactions.rageClickCount", e.rageClickCount, [2, 20], r.rageClickCount ?? 3, n),
953
+ rageClickWindowMs: H("capture.interactions.rageClickWindowMs", e.rageClickWindowMs, fn, r.rageClickWindowMs ?? 1e3, n),
954
+ deadClicks: V("capture.interactions.deadClicks", e.deadClicks, r.deadClicks ?? !1, n),
955
+ deadClickMs: H("capture.interactions.deadClickMs", e.deadClickMs, fn, r.deadClickMs ?? 1e3, n)
839
956
  };
840
957
  }
841
- var Nn = {
958
+ var $n = {
842
959
  metricsEndpoint: "The library sends metric records as log records.",
843
960
  tracesEndpoint: "The library sends no span."
844
961
  };
845
- function Pn(e, t, n, r, i) {
962
+ function er(e, t, n, r, i) {
846
963
  let a = n;
847
964
  if (typeof t == "string" && t !== "") try {
848
965
  new URL(t), a = t;
849
966
  } catch (n) {
850
- i.report("config.invalid", `${e} is not a valid absolute URL: ${t}. The library keeps the value in force.`, void 0, n);
967
+ i.report("config.invalid", `${e} is not a valid absolute URL: ${D(t, !1)}. The library keeps the value in force.`, void 0, n);
851
968
  }
852
- else t === "" ? a = "" : t !== void 0 && B(i, e, "a URL string", t, "the value in force");
853
- return a !== "" && r !== "otlp" ? (i.report("config.invalid", `${e} needs serializer "${E}". ${Nn[e]}`), "") : a;
969
+ else t === "" ? a = "" : t !== void 0 && z(i, e, "a URL string", t, "the value in force");
970
+ return a !== "" && r !== "otlp" ? (i.report("config.invalid", `${e} needs serializer "${S}". ${$n[e]}`), "") : a;
854
971
  }
855
- function Fn(e, t, n, r, i) {
972
+ function tr(e, t, n, r, i) {
856
973
  let a = { ...n };
857
974
  for (let o of Object.keys(n)) {
858
- let s = t?.[o], c = n[o], l = r.ranges[o], u = r.choices?.[o], d = c;
859
- typeof c == "number" && l ? d = U(`${e}.${o}`, s, l, c, i) : typeof c == "boolean" ? d = H(`${e}.${o}`, s, c, i) : u ? d = V(`${e}.${o}`, s, u, String(c), i) : s === void 0 || typeof s == "string" ? d = s ?? c : B(i, `${e}.${o}`, "a string", s, String(c)), Object.assign(a, { [o]: d });
975
+ let s = t?.[o], c = n[o], l = r.ranges[o], u = r.choices?.[o], d = r.custom?.[o], f = c;
976
+ d ? f = d(`${e}.${o}`, s, c, i) : typeof c == "number" && l ? f = H(`${e}.${o}`, s, l, c, i) : typeof c == "boolean" ? f = V(`${e}.${o}`, s, c, i) : u ? f = B(`${e}.${o}`, s, u, String(c), i) : s === void 0 || typeof s == "string" ? f = s ?? c : z(i, `${e}.${o}`, "a string", s, String(c)), Object.assign(a, { [o]: f });
860
977
  }
861
978
  return a;
862
979
  }
863
- function K(e, t, n) {
864
- let r = n ?? u, a = Object.fromEntries(Object.keys(Xt).map((n) => [n, Fn(n, e[n], r[n], Xt[n], t)])), o = {
980
+ function G(e, t, n) {
981
+ let r = n ?? re, i = Object.fromEntries(Object.keys(pn).map((n) => [n, tr(n, e[n], r[n], pn[n], t)])), a = {
865
982
  ...r,
866
983
  ...e,
867
- ...a,
868
- lockConfiguration: H("lockConfiguration", e.lockConfiguration, r.lockConfiguration, t),
869
- loggerCache: { maxEntries: sn(e.loggerCache?.maxEntries, r.loggerCache.maxEntries, t) },
984
+ ...i,
985
+ lockConfiguration: V("lockConfiguration", e.lockConfiguration, r.lockConfiguration, t),
986
+ loggerCache: { maxEntries: Tn(e.loggerCache?.maxEntries, r.loggerCache.maxEntries, t) },
870
987
  securityContext: {
871
988
  id: typeof e.securityContext?.id == "string" && e.securityContext.id || r.securityContext.id,
872
- isolation: H("securityContext.isolation", e.securityContext?.isolation, r.securityContext.isolation, t)
989
+ isolation: V("securityContext.isolation", e.securityContext?.isolation, r.securityContext.isolation, t)
873
990
  },
874
991
  endpoint: e.endpoint === void 0 ? r.endpoint : e.endpoint,
875
- enabled: H("enabled", e.enabled, r.enabled, t),
876
- minLevel: ln("minLevel", e.minLevel, r.minLevel, t),
877
- minLevels: un(e.minLevels, r.minLevels, t),
878
- processors: G("processors", e.processors, r.processors, "a list of functions", dn, t),
879
- compression: V("compression", e.compression, It, r.compression, t),
880
- credentials: V("credentials", e.credentials, Lt, r.credentials, t),
881
- headers: "headers" in e ? yn(e.headers, r.headers, t) : r.headers,
882
- storage: V("storage", e.storage, Rt, r.storage, t),
883
- identity: V("identity", e.identity, zt, r.identity, t),
884
- serializer: xn(e.serializer, n?.serializer, t),
885
- console: Tn(e.console, r.console, t),
886
- sampling: En(e.sampling, r.sampling, t),
887
- bus: Dn(e.bus, r.bus, t),
888
- batching: cn("batching", e.batching, r.batching, Gt, t),
889
- retention: kn(e.retention, r.retention, t),
890
- limits: cn("limits", e.limits, r.limits, qt, t),
891
- journey: On(e.journey, r.journey, t),
892
- capture: jn(e.capture, r.capture, t)
992
+ enabled: V("enabled", e.enabled, r.enabled, t),
993
+ payloadMode: B("payloadMode", e.payloadMode, ["copy", "defer"], r.payloadMode, t),
994
+ minLevel: Dn("minLevel", e.minLevel, r.minLevel, t),
995
+ minLevels: On(e.minLevels, r.minLevels, t),
996
+ processors: W("processors", e.processors, r.processors, "a list of functions", kn, t),
997
+ compression: B("compression", e.compression, Zt, r.compression, t),
998
+ credentials: B("credentials", e.credentials, Qt, r.credentials, t),
999
+ headers: "headers" in e ? Rn(e.headers, r.headers, t) : r.headers,
1000
+ storage: B("storage", e.storage, $t, r.storage, t),
1001
+ identity: B("identity", e.identity, en, r.identity, t),
1002
+ serializer: Bn(e.serializer, n?.serializer, t),
1003
+ console: Wn(e.console, r.console, t),
1004
+ sampling: Gn(e.sampling, r.sampling, t),
1005
+ bus: Kn(e.bus, r.bus, t),
1006
+ batching: En("batching", e.batching, r.batching, sn, t),
1007
+ retention: Jn(e.retention, r.retention, t),
1008
+ limits: En("limits", e.limits, r.limits, ln, t),
1009
+ journey: qn(e.journey, r.journey, t),
1010
+ capture: Xn(e.capture, r.capture, t)
893
1011
  };
894
- for (let n of ["metricsEndpoint", "tracesEndpoint"]) o[n] = Pn(n, e[n], r[n], o.serializer, t);
895
- if (o.transport !== void 0 && typeof o.transport != "function" && (t.report("config.invalid", "transport must be a function. The library ignores the value."), o.transport = r.transport), o.onDrop !== void 0 && typeof o.onDrop != "function" && (t.report("config.invalid", "onDrop must be a function. The library ignores the value."), o.onDrop = r.onDrop), o.contextProvider !== void 0 && typeof o.contextProvider != "function" && (t.report("config.invalid", "contextProvider must be a function. The library ignores the value."), o.contextProvider = r.contextProvider), o.transportOnExit !== void 0 && typeof o.transportOnExit != "function" && (t.report("config.invalid", "transportOnExit must be a function. The library ignores the value."), o.transportOnExit = r.transportOnExit), o.endpoint === "") o.transport === void 0 && t.report("config.invalid", "endpoint is missing. The library drops each record. Set endpoint: null for console-only mode.");
896
- else if (o.endpoint !== null) try {
897
- new URL(o.endpoint);
1012
+ for (let n of ["metricsEndpoint", "tracesEndpoint"]) a[n] = er(n, e[n], r[n], a.serializer, t);
1013
+ if (a.transport !== void 0 && typeof a.transport != "function" && (t.report("config.invalid", "transport must be a function. The library ignores the value."), a.transport = r.transport), a.onDrop !== void 0 && typeof a.onDrop != "function" && (t.report("config.invalid", "onDrop must be a function. The library ignores the value."), a.onDrop = r.onDrop), a.contextProvider !== void 0 && typeof a.contextProvider != "function" && (t.report("config.invalid", "contextProvider must be a function. The library ignores the value."), a.contextProvider = r.contextProvider), a.transportWorker !== void 0 && typeof a.transportWorker != "function" && (t.report("config.invalid", "transportWorker must be a function. The library keeps the value in force."), a.transportWorker = r.transportWorker), a.transportOnExit !== void 0 && typeof a.transportOnExit != "function" && (t.report("config.invalid", "transportOnExit must be a function. The library ignores the value."), a.transportOnExit = r.transportOnExit), a.endpoint === "") a.transport === void 0 && t.report("config.invalid", "endpoint is missing. The library drops each record. Set endpoint: null for console-only mode.");
1014
+ else if (a.endpoint !== null) try {
1015
+ new URL(a.endpoint);
898
1016
  } catch (e) {
899
- t.report("config.invalid", `endpoint is not a valid absolute URL: ${o.endpoint}.`, void 0, e);
900
- }
901
- for (let e of ["metricsEndpoint", "tracesEndpoint"]) o[e] !== "" && o.endpoint === null && !o.transport && t.report("config.invalid", `${e} needs endpoint or transport. The library sends nothing to ${e}.`);
902
- o.serviceName ||= (t.report("config.invalid", `serviceName is missing. Every record reports service.name as '${i}'.`), i);
903
- let s = o.sampling.defaultRate;
904
- (typeof s != "number" || s < 0 || s > 1) && (t.report("config.invalid", `sampling.defaultRate must be 0..1. The value is ${String(s)}. The library uses 1.`), o.sampling.defaultRate = 1);
905
- let c = o.sampling.remoteMaxRate;
906
- (typeof c != "number" || !(c >= 0 && c <= 1)) && (t.report("config.invalid", `sampling.remoteMaxRate must be 0..1. The value is ${String(c)}. The library uses 1.`), o.sampling.remoteMaxRate = 1);
907
- let l = Object.entries(o.sampling.rates);
908
- for (let [e, n] of l) (typeof n != "number" || n < 0 || n > 1) && (t.report("config.invalid", `sampling.rates["${e}"] must be 0..1. The value is ${String(n)}. The library uses 1.`), o.sampling.rates[e] = 1);
909
- o.capture.ignoreUrls = o.capture.ignoreUrls.filter((e) => e !== n?.endpoint && e !== n?.metricsEndpoint && e !== n?.tracesEndpoint);
1017
+ t.report("config.invalid", `endpoint is not a valid absolute URL: ${D(a.endpoint, !1)}.`, void 0, e);
1018
+ }
1019
+ for (let e of ["metricsEndpoint", "tracesEndpoint"]) a[e] !== "" && a.endpoint === null && !a.transport && t.report("config.invalid", `${e} needs endpoint or transport. The library sends nothing to ${e}.`);
1020
+ a.serviceName ||= (t.report("config.invalid", `serviceName is missing. Every record reports service.name as '${oe}'.`), oe);
1021
+ let o = a.sampling.defaultRate;
1022
+ (typeof o != "number" || o < 0 || o > 1) && (t.report("config.invalid", `sampling.defaultRate must be 0..1. The value is ${String(o)}. The library uses 1.`), a.sampling.defaultRate = 1);
1023
+ let s = a.sampling.remoteMaxRate;
1024
+ typeof s == "number" && s >= 0 && s <= 1 || (t.report("config.invalid", `sampling.remoteMaxRate must be 0..1. The value is ${String(s)}. The library uses 1.`), a.sampling.remoteMaxRate = 1);
1025
+ let c = Object.entries(a.sampling.rates);
1026
+ for (let [e, n] of c) (typeof n != "number" || n < 0 || n > 1) && (t.report("config.invalid", `sampling.rates["${e}"] must be 0..1. The value is ${String(n)}. The library uses 1.`), a.sampling.rates[e] = 1);
1027
+ a.capture.ignoreUrls = a.capture.ignoreUrls.filter((e) => e !== n?.endpoint && e !== n?.metricsEndpoint && e !== n?.tracesEndpoint);
910
1028
  for (let e of [
911
- o.endpoint,
912
- o.metricsEndpoint,
913
- o.tracesEndpoint
914
- ]) e && !o.capture.ignoreUrls.includes(e) && (o.capture.ignoreUrls = [...o.capture.ignoreUrls, e]);
915
- return o.delivery.retryMaxDelayMs < o.delivery.retryBaseDelayMs && (t.report("config.invalid", "delivery.retryMaxDelayMs must be at least retryBaseDelayMs."), o.delivery.retryBaseDelayMs = r.delivery.retryBaseDelayMs, o.delivery.retryMaxDelayMs = r.delivery.retryMaxDelayMs), o.capture.urlTransform !== void 0 && typeof o.capture.urlTransform != "function" && (t.report("config.invalid", "capture.urlTransform must be a function."), o.capture.urlTransform = r.capture.urlTransform), In(e, t), o;
916
- }
917
- function In(e, t) {
918
- let n = /* @__PURE__ */ new Set([...Object.keys(u), ...Ce]);
1029
+ a.endpoint,
1030
+ a.metricsEndpoint,
1031
+ a.tracesEndpoint
1032
+ ]) e && !a.capture.ignoreUrls.includes(e) && (a.capture.ignoreUrls = [...a.capture.ignoreUrls, e]);
1033
+ return a.delivery.retryMaxDelayMs < a.delivery.retryBaseDelayMs && (t.report("config.invalid", "delivery.retryMaxDelayMs must be at least retryBaseDelayMs."), a.delivery.retryBaseDelayMs = r.delivery.retryBaseDelayMs, a.delivery.retryMaxDelayMs = r.delivery.retryMaxDelayMs), a.capture.urlTransform !== void 0 && typeof a.capture.urlTransform != "function" && (t.report("config.invalid", "capture.urlTransform must be a function."), a.capture.urlTransform = r.capture.urlTransform), nr(e, t), a;
1034
+ }
1035
+ function nr(e, t) {
1036
+ let n = /* @__PURE__ */ new Set([...Object.keys(re), ...c]);
919
1037
  for (let r of Object.keys(e)) n.has(r) || t.report("config.invalid", `The library ignores the unknown config key "${r}". Check the spelling.`);
920
- for (let n of pe) {
1038
+ for (let n of a) {
921
1039
  let r = e[n];
922
1040
  if (typeof r != "object" || !r) continue;
923
- let i = /* @__PURE__ */ new Set([...Object.keys(u[n]), ...g[n]]);
1041
+ let i = /* @__PURE__ */ new Set([...Object.keys(re[n]), ...ie[n]]);
924
1042
  for (let e of Object.keys(r)) i.has(e) || t.report("config.invalid", `The library ignores the unknown config key "${n}.${e}". Check the spelling.`);
925
1043
  }
926
1044
  }
927
- function Ln(e, t) {
928
- for (let n of Object.keys(t)) pe.includes(n) || Object.assign(e, { [n]: t[n] });
929
- for (let n of pe) Object.assign(e[n], t[n]);
1045
+ function rr(e, t) {
1046
+ for (let n of Object.keys(t)) a.includes(n) || Object.assign(e, { [n]: t[n] });
1047
+ for (let n of a) Object.assign(e[n], t[n]);
930
1048
  }
931
- //#endregion
932
- //#region src/core/context.ts
933
- var Rn = class {
1049
+ // src/core/context.ts
1050
+ var ir = class {
934
1051
  map = /* @__PURE__ */ new Map();
935
1052
  set(e, t) {
936
1053
  this.map.set(e, t);
@@ -947,13 +1064,48 @@ var Rn = class {
947
1064
  getAll() {
948
1065
  return Object.fromEntries(this.map);
949
1066
  }
950
- }, zn = class {
1067
+ }, ar = class {
1068
+ policy;
1069
+ kept = [];
1070
+ constructor(e) {
1071
+ this.policy = e;
1072
+ }
1073
+ push(e) {
1074
+ let { enabled: t, maxRecords: n } = this.policy();
1075
+ t && (this.kept.push({
1076
+ at: Date.now(),
1077
+ record: e
1078
+ }), this.kept.length >= n * 2 && (this.kept = this.kept.slice(-n)));
1079
+ }
1080
+ drain() {
1081
+ let e = this.live();
1082
+ return this.kept = [], e.map(({ record: e }) => ({
1083
+ ...e,
1084
+ attributes: {
1085
+ ...e.attributes,
1086
+ [Pe]: !0
1087
+ }
1088
+ }));
1089
+ }
1090
+ snapshot() {
1091
+ return this.live().map(({ record: e }) => e);
1092
+ }
1093
+ live() {
1094
+ let { enabled: e, maxRecords: t, maxAgeMs: n } = this.policy();
1095
+ if (!e) return this.kept = [], [];
1096
+ let r = n === 0 ? -Infinity : Date.now() - n;
1097
+ return this.kept.slice(-t).filter((e) => e.at >= r);
1098
+ }
1099
+ clear() {
1100
+ this.kept = [];
1101
+ }
1102
+ }, or = class {
951
1103
  handler;
952
1104
  throttleMs;
953
1105
  consoleFallback;
954
1106
  counters = /* @__PURE__ */ new Map();
955
1107
  lastEmitted = /* @__PURE__ */ new Map();
956
- constructor(e, t = De, n = !1) {
1108
+ constructor(e, t = d, n = !1) {
957
1109
  this.handler = e, this.throttleMs = t, this.consoleFallback = n;
958
1110
  }
959
1111
  setPolicy(e, t) {
@@ -967,24 +1119,24 @@ var Rn = class {
967
1119
  return this.counters.set(e, n), n;
968
1120
  }
969
1121
  report(e, t, n, r) {
970
- let i = this.count(e), a = Date.now();
971
- if (a - (this.lastEmitted.get(e) ?? 0) < this.throttleMs) return;
972
- this.lastEmitted.set(e, a);
973
- let o = {
1122
+ let a = this.count(e), o = Date.now();
1123
+ if (o - (this.lastEmitted.get(e) ?? 0) < this.throttleMs) return;
1124
+ this.lastEmitted.set(e, o);
1125
+ let s = {
974
1126
  code: e,
975
1127
  message: t,
976
1128
  detail: n,
977
1129
  cause: r,
978
- at: a,
979
- count: i
980
- }, { handler: s } = this;
981
- if (s) try {
982
- k(() => {
983
- s(o);
1130
+ at: o,
1131
+ count: a
1132
+ }, { handler: c } = this;
1133
+ if (c) try {
1134
+ O(() => {
1135
+ c(s);
984
1136
  });
985
1137
  } catch {
986
- this.count("handler.threw"), this.consoleFallback && typeof console < "u" && k(() => {
987
- console.warn(`${ue} The onDiagnostic handler threw an error.`);
1138
+ this.count("handler.threw"), this.consoleFallback && typeof console < "u" && O(() => {
1139
+ console.warn(`${i} The onDiagnostic handler threw an error.`);
988
1140
  });
989
1141
  }
990
1142
  }
@@ -1008,12 +1160,11 @@ var Rn = class {
1008
1160
  return Object.fromEntries(this.counters);
1009
1161
  }
1010
1162
  };
1011
- //#endregion
1012
- //#region src/core/drops.ts
1013
- function Bn(e, t) {
1163
+ // src/core/drops.ts
1164
+ function sr(e, t) {
1014
1165
  e.length < 20 && !e.includes(t) && e.push(t);
1015
1166
  }
1016
- var Vn = class {
1167
+ var cr = class {
1017
1168
  config;
1018
1169
  diagnostics;
1019
1170
  pending = /* @__PURE__ */ new Map();
@@ -1032,12 +1183,12 @@ var Vn = class {
1032
1183
  journeyIds: [],
1033
1184
  actions: []
1034
1185
  }, this.pending.set(e, r)), r.records += t.length;
1035
- for (let e of n) Bn(r.batchIds, e);
1186
+ for (let e of n) sr(r.batchIds, e);
1036
1187
  for (let e of t) {
1037
- let t = et(e, b);
1038
- typeof t == "string" && Bn(r.journeyIds, t);
1039
- let n = $e(e) ? e.body : void 0;
1040
- typeof n == "string" && Bn(r.actions, n);
1188
+ let t = at(e, x);
1189
+ typeof t == "string" && sr(r.journeyIds, t);
1190
+ let n = it(e) ? e.body : void 0;
1191
+ typeof n == "string" && sr(r.actions, n);
1041
1192
  }
1042
1193
  this.scheduled || (this.scheduled = !0, queueMicrotask(() => {
1043
1194
  this.flush();
@@ -1051,8 +1202,8 @@ var Vn = class {
1051
1202
  if (t) {
1052
1203
  this.reporting = !0;
1053
1204
  for (let n of e) this.diagnostics.guard("handler.threw", "The onDrop hook threw an error.", () => {
1054
- Ye(() => {
1055
- k(() => {
1205
+ rt(() => {
1206
+ O(() => {
1056
1207
  t(n);
1057
1208
  });
1058
1209
  });
@@ -1060,7 +1211,7 @@ var Vn = class {
1060
1211
  this.reporting = !1;
1061
1212
  }
1062
1213
  }
1063
- }, Hn = class {
1214
+ }, lr = class {
1064
1215
  onDrop;
1065
1216
  held = [];
1066
1217
  actions = 0;
@@ -1074,10 +1225,10 @@ var Vn = class {
1074
1225
  return this.held.length;
1075
1226
  }
1076
1227
  push(e) {
1077
- let t = $e(e);
1228
+ let t = it(e);
1078
1229
  if ((t ? this.actions : this.held.length - this.actions) < (t ? 2e3 : 500)) this.actions += +!!t;
1079
1230
  else {
1080
- let e = this.held.findIndex((e) => $e(e) === t), [n] = this.held.splice(e, 1);
1231
+ let e = this.held.findIndex((e) => it(e) === t), [n] = this.held.splice(e, 1);
1081
1232
  this.onDrop(n);
1082
1233
  }
1083
1234
  this.held.push(e);
@@ -1086,11 +1237,74 @@ var Vn = class {
1086
1237
  let e = this.held;
1087
1238
  return this.held = [], this.actions = 0, e;
1088
1239
  }
1089
- }, Un = "error.", Wn = [
1090
- _e,
1091
- b,
1092
- he
1093
- ], Gn = {
1240
+ }, ur = {
1241
+ name: "ui.measure.duration",
1242
+ kind: "histogram",
1243
+ unit: "ms",
1244
+ boundaries: g
1245
+ }, dr = {
1246
+ name: "ui.measure.phase.duration",
1247
+ kind: "histogram",
1248
+ unit: "ms",
1249
+ boundaries: g
1250
+ };
1251
+ function fr(e, t, n, r) {
1252
+ let i = String(e), a = Date.now(), o = performance.now(), s, c = !1, l = (e) => a + e - o, u = (e, a) => {
1253
+ s &&= (r.metric(dr, e - s.at, {
1254
+ ...t,
1255
+ "measure.name": i,
1256
+ "measure.phase": s.name
1257
+ }), n && r.span({
1258
+ name: s.name,
1259
+ kind: "internal",
1260
+ traceId: n.traceId,
1261
+ spanId: Wt(),
1262
+ parentSpanId: n.spanId,
1263
+ startMs: l(s.at),
1264
+ endMs: l(e),
1265
+ error: a,
1266
+ attributes: { "measure.name": i }
1267
+ }), void 0);
1268
+ };
1269
+ return {
1270
+ phase: (e) => {
1271
+ if (c) return;
1272
+ let t = performance.now();
1273
+ u(t, !1), s = {
1274
+ name: String(e),
1275
+ at: t
1276
+ };
1277
+ },
1278
+ end: (e = "ok") => {
1279
+ if (c) return;
1280
+ c = !0;
1281
+ let s = performance.now(), d = e === "error";
1282
+ u(s, d);
1283
+ let f = {
1284
+ ...t,
1285
+ "measure.outcome": e
1286
+ };
1287
+ r.metric(ur, s - o, {
1288
+ ...f,
1289
+ "measure.name": i
1290
+ }), n && r.span({
1291
+ ...n,
1292
+ name: i,
1293
+ kind: "internal",
1294
+ startMs: a,
1295
+ endMs: l(s),
1296
+ error: d,
1297
+ attributes: f
1298
+ });
1299
+ }
1300
+ };
1301
+ }
1302
+ // src/core/record.ts
1303
+ var pr = "error.", mr = [
1304
+ C,
1305
+ x,
1306
+ De
1307
+ ], hr = {
1094
1308
  processor: {
1095
1309
  label: "A processor",
1096
1310
  code: "record.dropped_by_processor"
@@ -1099,21 +1313,21 @@ var Vn = class {
1099
1313
  label: "The redact hook",
1100
1314
  code: "record.dropped_by_redact"
1101
1315
  }
1102
- }, Kn = [
1316
+ }, gr = [
1103
1317
  "metric.name",
1104
1318
  "metric.unit",
1105
1319
  "metric.type",
1106
1320
  "metric.value",
1107
- ...Object.values(r),
1108
- ...Object.values(w)
1321
+ ...Object.values(y),
1322
+ ...Object.values(T)
1109
1323
  ];
1110
- function qn(e) {
1111
- return Object.fromEntries(Kn.filter((t) => t in e).map((t) => [t, e[t]]));
1324
+ function _r(e) {
1325
+ return Object.fromEntries(gr.filter((t) => t in e).map((t) => [t, e[t]]));
1112
1326
  }
1113
- function q(e) {
1327
+ function K(e) {
1114
1328
  return e;
1115
1329
  }
1116
- var Jn = class {
1330
+ var vr = class {
1117
1331
  deps;
1118
1332
  resourceCache = null;
1119
1333
  constructor(e) {
@@ -1122,20 +1336,26 @@ var Jn = class {
1122
1336
  invalidateResource() {
1123
1337
  this.resourceCache = null;
1124
1338
  }
1125
- isEnabled(e, t, n) {
1126
- let { config: r } = this.deps;
1127
- if (!r.enabled) return !1;
1128
- if (n !== void 0 && ye.includes(n)) return !0;
1129
- let i = this.deps.remote.sampling?.minLevelFor(t) ?? Ie(t, r);
1130
- return S[e] >= S[i];
1339
+ isEnabled(e, t, r) {
1340
+ let { config: i } = this.deps;
1341
+ if (!i.enabled) return !1;
1342
+ if (r !== void 0 && n.includes(r)) return !0;
1343
+ let a = this.deps.remote.sampling?.minLevelFor(t) ?? ut(t, i);
1344
+ return w[e] >= w[a];
1345
+ }
1346
+ keepForDebug(e) {
1347
+ let { config: t, debug: n } = this.deps;
1348
+ if (!n || !t.enabled || !t.debugBuffer.enabled) return;
1349
+ let { record: r } = this.build(e, !0);
1350
+ r && n.push(r);
1131
1351
  }
1132
1352
  build(e, t = !1) {
1133
1353
  let { config: n, diagnostics: r, tracing: i, journey: a, sequence: o, limits: s, remote: c } = this.deps;
1134
- if (!t && !this.isEnabled(e.level, e.namespace, e.type)) return r.count("record.dropped_by_level"), {
1354
+ if (!t && !this.isEnabled(e.level, e.namespace, e.type)) return r.count("record.dropped_by_level"), this.keepForDebug(e), {
1135
1355
  record: null,
1136
1356
  dropped: "level"
1137
1357
  };
1138
- let l = e.trace ?? i.resolve(), u = a.current(), d = Le({
1358
+ let l = e.trace ?? e.snapshot?.trace ?? i.resolve(), u = e.snapshot ? e.snapshot.journey : a.current(), d = dt({
1139
1359
  level: e.level,
1140
1360
  type: e.type,
1141
1361
  namespace: e.namespace,
@@ -1143,31 +1363,31 @@ var Jn = class {
1143
1363
  traceId: l.traceId,
1144
1364
  aggregated: e.aggregated
1145
1365
  }, n, c.sampling?.current() ?? null);
1146
- if (!t && !d) return r.count("record.dropped_by_sampling"), {
1366
+ if (!t && !d) return r.count("record.dropped_by_sampling"), this.keepForDebug(e), {
1147
1367
  record: null,
1148
1368
  dropped: "sampling"
1149
1369
  };
1150
- let f = o.next(), p = Qe(r), m = n.metadata.pageUrl ? Xe(p, n.capture.fullUrls, n.capture.urlTransform, r) : "", h, g = 0;
1370
+ let f = o.next(), p = e.snapshot?.url ?? qe(r), m = n.metadata.pageUrl ? D(p, n.capture.fullUrls, n.capture.urlTransform, r) : "", h, g = 0;
1151
1371
  try {
1152
- let t = A(this.deps.context.getAll(), s, r), n = A(this.provided(), s, r), i = A(e.scoped ?? {}, s, r), a = A(e.payload ?? {}, s, r);
1372
+ let t = k(e.snapshot?.context ?? this.deps.context.getAll(), s, r), n = k(this.provided(), s, r), i = k(e.scoped ?? {}, s, r), a = k(e.payload ?? {}, s, r);
1153
1373
  g = t.bytes + n.bytes + i.bytes + a.bytes, h = {
1154
- ...q(t.value),
1155
- ...q(n.value),
1156
- ...q(i.value),
1157
- ...q(a.value)
1374
+ ...K(t.value),
1375
+ ...K(n.value),
1376
+ ...K(i.value),
1377
+ ...K(a.value)
1158
1378
  };
1159
1379
  } catch (e) {
1160
- r.report("record.sanitize_failed", "The library could not sanitize the attributes.", void 0, e), h = { [de]: !0 };
1380
+ r.report("record.sanitize_failed", "The library could not sanitize the attributes.", void 0, e), h = { [Le]: !0 };
1161
1381
  }
1162
- Object.assign(h, e.fixed), h[ce] = e.type, h[x] = f, h[T] = e.namespace, h[_e] = m, u && (h[b] = u.id, h[he] = u.name, u.parentId !== void 0 && (h[Se] = u.parentId));
1163
- let _ = Ve(e.body, s.maxBodyChars);
1382
+ Object.assign(h, e.fixed), h[ve] = e.type, h[ye] = f, h[ue] = e.namespace, h[C] = m, u && (h[x] = u.id, h[De] = u.name, u.parentId !== void 0 && (h[Ce] = u.parentId));
1383
+ let _ = Ye(e.body, s.maxBodyChars);
1164
1384
  _ !== e.body && r.count("record.truncated");
1165
1385
  let v = {
1166
- timeUnixNano: Fe(),
1386
+ timeUnixNano: e.snapshot?.timeUnixNano ?? Be(),
1167
1387
  traceId: l.traceId,
1168
1388
  spanId: l.spanId,
1169
1389
  traceFlags: l.traceFlags,
1170
- severityNumber: oe[e.level],
1390
+ severityNumber: fe[e.level],
1171
1391
  severityText: e.level,
1172
1392
  body: _,
1173
1393
  attributes: h,
@@ -1187,20 +1407,20 @@ var Jn = class {
1187
1407
  body: v.body
1188
1408
  });
1189
1409
  let t = {
1190
- [ce]: e.type,
1191
- [x]: f,
1192
- [T]: e.namespace,
1193
- [ae]: !0,
1194
- [fe]: g
1410
+ [ve]: e.type,
1411
+ [ye]: f,
1412
+ [ue]: e.namespace,
1413
+ [je]: !0,
1414
+ [Te]: g
1195
1415
  };
1196
- for (let e of Wn) e in v.attributes && (t[e] = v.attributes[e]);
1197
- for (let [e, n] of Object.entries(v.attributes)) e.startsWith(Un) && (t[e] = n);
1198
- let n = A(t, s, r).bytes;
1199
- n > s.maxRecordBytes && "error.data" in t && (Reflect.deleteProperty(t, xe), n = A(t, s, r).bytes);
1200
- let i = v.attributes[C];
1416
+ for (let e of mr) e in v.attributes && (t[e] = v.attributes[e]);
1417
+ for (let [e, n] of Object.entries(v.attributes)) e.startsWith(pr) && (t[e] = n);
1418
+ let n = k(t, s, r).bytes;
1419
+ n > s.maxRecordBytes && "error.data" in t && (Reflect.deleteProperty(t, me), n = k(t, s, r).bytes);
1420
+ let i = v.attributes[b];
1201
1421
  if (i !== void 0) {
1202
- let e = A(i, s, r).bytes;
1203
- n + e <= s.maxRecordBytes && (t[C] = i);
1422
+ let e = k(i, s, r).bytes;
1423
+ n + e <= s.maxRecordBytes && (t[b] = i);
1204
1424
  }
1205
1425
  Object.assign(t, e.fixed), v.attributes = t;
1206
1426
  }
@@ -1209,7 +1429,7 @@ var Jn = class {
1209
1429
  redactForwarded(e) {
1210
1430
  let { redact: t } = this.deps.config;
1211
1431
  if (!t) return e;
1212
- let n = [[t, "redact"]], r = this.applyHooks(e, n, qn(e.attributes));
1432
+ let n = [[t, "redact"]], r = this.applyHooks(e, n, _r(e.attributes));
1213
1433
  return typeof r == "string" ? null : r.record;
1214
1434
  }
1215
1435
  applyHooks(e, t, n) {
@@ -1219,7 +1439,7 @@ var Jn = class {
1219
1439
  if (typeof t == "string") return t;
1220
1440
  r = t;
1221
1441
  }
1222
- let { diagnostics: i, limits: a } = this.deps, o = A(r.attributes, a, i), s = q(o.value);
1442
+ let { diagnostics: i, limits: a } = this.deps, o = k(r.attributes, a, i), s = K(o.value);
1223
1443
  return Object.assign(s, n), {
1224
1444
  record: {
1225
1445
  ...r,
@@ -1229,7 +1449,7 @@ var Jn = class {
1229
1449
  };
1230
1450
  }
1231
1451
  runHook(e, t, n) {
1232
- let { diagnostics: r } = this.deps, { label: i, code: a } = Gn[t], o;
1452
+ let { diagnostics: r } = this.deps, { label: i, code: a } = hr[t], o;
1233
1453
  try {
1234
1454
  o = e(n);
1235
1455
  } catch (e) {
@@ -1237,9 +1457,9 @@ var Jn = class {
1237
1457
  }
1238
1458
  if (o === null) return r.count(a), t;
1239
1459
  let s = o ?? n;
1240
- return Ne(s) ? Re(s.severityText) ? {
1460
+ return ze(s) ? Ve(s.severityText) ? {
1241
1461
  ...s,
1242
- severityNumber: oe[s.severityText]
1462
+ severityNumber: fe[s.severityText]
1243
1463
  } : (r.report("record.dropped_malformed", `${i} set a severityText that is not a log level. The library dropped the record.`), "malformed") : s === n ? (r.report("record.dropped_malformed", `${i} changed the record to a shape that is not a record. The library dropped it.`), "malformed") : (r.report(a, `${i} returned a value that is not a record. The library dropped the record.`), t);
1244
1464
  }
1245
1465
  provided() {
@@ -1247,42 +1467,42 @@ var Jn = class {
1247
1467
  if (!e) return {};
1248
1468
  let { diagnostics: t } = this.deps, n = t.guard("handler.threw", "The contextProvider threw an error. The record has no attributes from it.", () => {
1249
1469
  let t = e();
1250
- return t === void 0 ? {} : O(t) && typeof t.then != "function" ? t : null;
1470
+ return t === void 0 ? {} : E(t) && typeof t.then != "function" ? t : null;
1251
1471
  });
1252
1472
  return n === null && t.report("config.invalid", "contextProvider must return an object of attributes. The library ignores the value."), n ?? {};
1253
1473
  }
1254
1474
  resource() {
1255
1475
  if (this.resourceCache) return this.resourceCache;
1256
- let { config: e, identity: n, platform: r } = this.deps;
1476
+ let { config: t, identity: n, platform: r } = this.deps;
1257
1477
  return this.resourceCache = {
1258
- [o]: e.serviceName,
1259
- [l]: e.serviceVersion,
1260
- [y]: e.environment,
1261
- [te]: ie,
1262
- [re]: D,
1263
- [ne]: le,
1264
- [s]: r.platform,
1265
- [be]: n.sessionId,
1266
- [c]: n.tabId,
1267
- [t]: n.contextId,
1268
- ...e.metadata.userAgent ? { [Oe]: r.userAgent } : {},
1269
- ...!e.metadata.openfin || r.openfinUuid === void 0 ? {} : { [ee]: r.openfinUuid },
1270
- ...!e.metadata.openfin || r.openfinName === void 0 ? {} : { [_]: r.openfinName }
1478
+ [Ae]: t.serviceName,
1479
+ [be]: t.serviceVersion,
1480
+ [e]: t.environment,
1481
+ [Se]: h,
1482
+ [Fe]: v,
1483
+ [pe]: xe,
1484
+ [ge]: r.platform,
1485
+ [de]: n.sessionId,
1486
+ [Me]: n.tabId,
1487
+ [ne]: n.contextId,
1488
+ ...t.metadata.userAgent ? { [ce]: r.userAgent } : {},
1489
+ ...!t.metadata.openfin || r.openfinUuid === void 0 ? {} : { [we]: r.openfinUuid },
1490
+ ...!t.metadata.openfin || r.openfinName === void 0 ? {} : { [Ne]: r.openfinName }
1271
1491
  }, this.resourceCache;
1272
1492
  }
1273
- }, Yn = 1e3, Xn = {
1493
+ }, yr = 1e3, br = {
1274
1494
  start: "ui.start",
1275
1495
  interaction: "ui.interaction",
1276
1496
  navigation: "ui.navigation",
1277
1497
  explicit: "ui.trace",
1278
1498
  maxAge: "ui.trace"
1279
1499
  };
1280
- function Zn(e) {
1281
- return `${String(Math.round(e * Yn))}000`;
1500
+ function xr(e) {
1501
+ return `${String(Math.round(e * yr))}000`;
1282
1502
  }
1283
- function Qn(e) {
1503
+ function Sr(e) {
1284
1504
  return {
1285
- name: Xn[e.reason],
1505
+ name: br[e.reason],
1286
1506
  kind: "internal",
1287
1507
  traceId: e.traceId,
1288
1508
  spanId: e.spanId,
@@ -1293,49 +1513,74 @@ function Qn(e) {
1293
1513
  attributes: {}
1294
1514
  };
1295
1515
  }
1296
- function $n(e) {
1516
+ function Cr(e) {
1297
1517
  return {
1298
- [w.kind]: e.kind,
1299
- [w.parentId]: e.parentSpanId,
1300
- [w.start]: Zn(e.startMs),
1301
- [w.end]: Zn(e.endMs),
1302
- [w.status]: e.error ? "error" : "unset"
1518
+ [T.kind]: e.kind,
1519
+ [T.parentId]: e.parentSpanId,
1520
+ [T.start]: xr(e.startMs),
1521
+ [T.end]: xr(e.endMs),
1522
+ [T.status]: e.error ? "error" : "unset",
1523
+ ...e.link ? {
1524
+ [T.linkTraceId]: e.link.traceId,
1525
+ [T.linkSpanId]: e.link.spanId
1526
+ } : {}
1303
1527
  };
1304
1528
  }
1305
- //#endregion
1306
- //#region src/core/runtime.ts
1307
- var er = {
1308
- errors: async () => (await import("./errors-BhC7HTSt.js")).ErrorCapture,
1309
- network: async () => (await import("./network-DdzXDI3J.js")).NetworkCapture,
1310
- interactions: async () => (await import("./interactions-BUDLxbv1.js")).InteractionCapture,
1311
- webVitals: async () => (await import("./web-vitals-Bflr5jSA.js")).WebVitalsCapture,
1312
- longFrames: async () => (await import("./long-frames-DI5ypfAF.js")).LongFrameCapture,
1313
- console: async () => (await import("./console-DbAZYJuy.js")).ConsoleCapture
1314
- }, tr = /* @__PURE__ */ new WeakMap(), nr = 0;
1315
- function rr(e) {
1316
- let t = tr.get(e);
1317
- return t === void 0 && (t = ++nr, tr.set(e, t)), t;
1318
- }
1319
- var ir = Symbol.for(p), ar = Symbol.for(e), or = ["batching", "retention"], sr = {
1529
+ // src/core/runtime.ts
1530
+ var wr = {
1531
+ errors: async () => (await import("./errors-Dh7kef0i.js")).ErrorCapture,
1532
+ network: async () => (await import("./network-DBNwApoF.js")).NetworkCapture,
1533
+ interactions: async () => (await import("./interactions-DTgKy_6K.js")).InteractionCapture,
1534
+ webVitals: async () => (await import("./web-vitals-Bq4WFHQo.js")).WebVitalsCapture,
1535
+ longFrames: async () => (await import("./long-frames-Czk7IupC.js")).LongFrameCapture,
1536
+ console: async () => (await import("./console-BeCF7n59.js")).ConsoleCapture,
1537
+ uncleanExit: async () => (await import("./unclean-exit-CwcUhFOn.js")).UncleanExitCapture,
1538
+ userTiming: async () => (await import("./user-timing-_jZIhDKI.js")).UserTimingCapture,
1539
+ reports: async () => (await import("./reports-TA-zInnq.js")).ReportCapture,
1540
+ resourceTiming: async () => (await import("./resource-timing-BLv3EA2A.js")).ResourceTimingCapture,
1541
+ lifecycle: async () => (await import("./lifecycle-BaKx_-32.js")).LifecycleCapture
1542
+ }, Tr = /* @__PURE__ */ new WeakMap(), Er = 0;
1543
+ function Dr(e) {
1544
+ let t = Tr.get(e);
1545
+ return t === void 0 && (t = ++Er, Tr.set(e, t)), t;
1546
+ }
1547
+ var Or = Symbol.for(he), kr = Symbol.for(_e), Ar = ["batching", "retention"], jr = {
1320
1548
  endpoint: null,
1321
1549
  metricsEndpoint: "",
1322
1550
  tracesEndpoint: "",
1323
1551
  headers: void 0,
1324
1552
  credentials: "omit",
1325
1553
  transport: void 0,
1326
- transportOnExit: void 0
1327
- }, cr = Object.keys(sr);
1328
- function lr(e) {
1554
+ transportOnExit: void 0,
1555
+ transportWorker: void 0
1556
+ }, Mr = Object.keys(jr), Nr = /* @__PURE__ */ new Set([
1557
+ "bus.role_resolved",
1558
+ "config.reconfigured",
1559
+ "security.rotated",
1560
+ "journey.adopted",
1561
+ "journey.expired"
1562
+ ]);
1563
+ function Pr(e) {
1329
1564
  return JSON.stringify({
1330
1565
  ...e,
1331
- urlTransform: e.urlTransform ? rr(e.urlTransform) : void 0,
1566
+ urlTransform: e.urlTransform ? Dr(e.urlTransform) : void 0,
1332
1567
  webVitalsLoader: e.webVitalsLoader !== void 0,
1333
1568
  ignoreUrls: e.ignoreUrls.map(String),
1334
1569
  propagateTraceHeaderTo: e.propagateTraceHeaderTo.map(String),
1335
- plugins: e.plugins.map(rr)
1570
+ userTimingInclude: e.userTimingInclude.map(String),
1571
+ plugins: e.plugins.map(Dr)
1336
1572
  });
1337
1573
  }
1338
- function ur(e) {
1574
+ function Fr(e) {
1575
+ if (!E(e)) return e;
1576
+ let t = { ...e };
1577
+ for (let e of ["url", "endpoint"]) {
1578
+ let n = t[e];
1579
+ typeof n == "string" && (t[e] = D(n, !1));
1580
+ }
1581
+ return t;
1582
+ }
1583
+ function Ir(e) {
1339
1584
  return {
1340
1585
  ...e,
1341
1586
  endpoint: null,
@@ -1343,25 +1588,30 @@ function ur(e) {
1343
1588
  tracesEndpoint: "",
1344
1589
  transport: void 0,
1345
1590
  transportOnExit: void 0,
1591
+ transportWorker: void 0,
1346
1592
  bus: {
1347
1593
  ...e.bus,
1348
1594
  mode: "off"
1349
1595
  }
1350
1596
  };
1351
1597
  }
1352
- function dr(e) {
1353
- return !!e.endpoint || !!e.metricsEndpoint || !!e.tracesEndpoint || e.transport !== void 0;
1598
+ function Lr(e) {
1599
+ return !!e.endpoint || !!e.metricsEndpoint || !!e.tracesEndpoint || e.transport !== void 0 || e.transportWorker !== void 0;
1354
1600
  }
1355
- function fr(e) {
1356
- return e.sdkVersion === D;
1601
+ function Rr(e) {
1602
+ return e.sdkVersion === v;
1357
1603
  }
1358
- var J = class e {
1604
+ var q = class e {
1359
1605
  rotating = !1;
1360
1606
  closingContext = !1;
1361
1607
  mismatchVersion = null;
1362
1608
  contextMismatch = !1;
1363
1609
  rotation;
1364
1610
  memoryStorage;
1611
+ storagePersistence = "off";
1612
+ recordingDiagnostic = !1;
1613
+ diagnosticLogger = new F(() => this, Oe);
1614
+ debugBuffer = new ar(() => this.config.debugBuffer);
1365
1615
  explicitSecurityContext;
1366
1616
  ownerAdopted = !1;
1367
1617
  isRotating() {
@@ -1371,7 +1621,7 @@ var J = class e {
1371
1621
  typeof e == "boolean" && (this.config.lockConfiguration = e);
1372
1622
  }
1373
1623
  static local = null;
1374
- sdkVersion = D;
1624
+ sdkVersion = v;
1375
1625
  diagnostics;
1376
1626
  config;
1377
1627
  platform;
@@ -1379,13 +1629,21 @@ var J = class e {
1379
1629
  stores;
1380
1630
  identityBuiltAs;
1381
1631
  sessionTouch;
1382
- context = new Rn();
1632
+ context = new ir();
1383
1633
  breadcrumbs;
1384
1634
  tracing;
1385
- sequence = new Ct();
1635
+ sequence = new Rt();
1386
1636
  journey;
1387
1637
  builder;
1388
- remote = { sampling: null };
1638
+ remote = {
1639
+ sampling: null,
1640
+ changed: () => {
1641
+ this.refreshCaptures();
1642
+ }
1643
+ };
1644
+ identityEpoch = 0;
1645
+ remoteCaptureTimer;
1646
+ installedCaptureKey = "";
1389
1647
  console;
1390
1648
  drops;
1391
1649
  meter;
@@ -1395,7 +1653,7 @@ var J = class e {
1395
1653
  storageBuiltAs;
1396
1654
  sender;
1397
1655
  senderLoad;
1398
- pendingRecords = new Hn((e) => {
1656
+ pendingRecords = new lr((e) => {
1399
1657
  this.dropHeld(e);
1400
1658
  });
1401
1659
  captures = [];
@@ -1403,9 +1661,11 @@ var J = class e {
1403
1661
  captureOnce = {
1404
1662
  webVitals: !1,
1405
1663
  navigationTiming: !1,
1406
- longFrames: !1
1664
+ longFrames: !1,
1665
+ uncleanExit: !1,
1666
+ userTiming: !1
1407
1667
  };
1408
- bootBuffer = new Hn((e) => {
1668
+ bootBuffer = new lr((e) => {
1409
1669
  this.dropHeld(e);
1410
1670
  });
1411
1671
  forwardBuffer = [];
@@ -1421,23 +1681,23 @@ var J = class e {
1421
1681
  degraded;
1422
1682
  serverReported = !1;
1423
1683
  onPageHide = () => {
1424
- this.role() === "forwarder" && (this.tracing.end(), this.sendForwarded());
1684
+ N(this), this.role() === "forwarder" && (this.tracing.end(), this.sendForwarded());
1425
1685
  };
1426
1686
  constructor(e, t = !1) {
1427
- this.diagnostics = new zn(e.onDiagnostic), this.platform = Ze(this.diagnostics), this.degraded = t || this.onServer(), this.config = K(this.allowed(e), this.diagnostics), this.explicitSecurityContext = !!e.securityContext?.id, this.config.securityContext.id ||= j(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() ? Ke() : Je, this.identity = qe(this.diagnostics, this.stores, this.config.correlation.sessionIdleMs), this.sessionTouch = new We(this.diagnostics, this.stores, this.config.correlation.sessionTouchMs, this.config.correlation.sessionIdleMs), this.breadcrumbs = new Pt(this.config.capturePolicy.breadcrumbs);
1428
- let n = (e) => Pe(e, this.config.sampling.defaultRate);
1429
- this.tracing = new Nt(this.diagnostics, this.config.correlation.traceMaxAgeMs || Infinity, this.config.otelLoader, {
1687
+ this.diagnostics = new or(e.onDiagnostic), this.platform = Ke(this.diagnostics), this.degraded = t || this.onServer(), this.config = G(this.allowed(e), this.diagnostics), this.explicitSecurityContext = !!e.securityContext?.id, this.config.securityContext.id ||= A(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() ? et() : nt, this.identity = tt(this.diagnostics, this.stores, this.config.correlation.sessionIdleMs), this.sessionTouch = new Qe(this.diagnostics, this.stores, this.config.correlation.sessionTouchMs, this.config.correlation.sessionIdleMs), this.breadcrumbs = new Yt(this.config.capturePolicy.breadcrumbs);
1688
+ let n = (e) => lt(e, this.config.sampling.defaultRate);
1689
+ this.tracing = new Jt(this.diagnostics, this.config.correlation.traceMaxAgeMs || Infinity, this.config.otelLoader, {
1430
1690
  enabled: () => this.config.tracesEndpoint !== "",
1431
1691
  keeps: n,
1432
1692
  onEnd: (e) => {
1433
- n(e.traceId) && this.recordSpan(Qn(e));
1693
+ n(e.traceId) && this.recordSpan(Sr(e));
1434
1694
  }
1435
- }), this.tracing.loadOtel(), this.limits = { ...this.config.limits }, this.console = new St(this.config.console, this.diagnostics, this.limits), this.drops = new Vn(this.config, this.diagnostics), this.journeyOptions = {
1436
- ...nt,
1695
+ }), this.tracing.loadOtel(), this.limits = { ...this.config.limits }, this.console = new Lt(this.config.console, this.diagnostics, this.limits), this.drops = new cr(this.config, this.diagnostics), this.journeyOptions = {
1696
+ ...st,
1437
1697
  maxAgeMs: this.config.journey.maxAgeMs
1438
- }, this.journey = new tt(this.journeyOptions, this.diagnostics, this.identity.contextId, (e) => {
1698
+ }, this.journey = new ot(this.journeyOptions, this.diagnostics, this.identity.contextId, (e) => {
1439
1699
  this.bus?.broadcastJourney(e);
1440
- }, this.stores), this.builder = new Jn({
1700
+ }, this.stores), this.builder = new vr({
1441
1701
  remote: this.remote,
1442
1702
  config: this.config,
1443
1703
  limits: this.limits,
@@ -1447,21 +1707,42 @@ var J = class e {
1447
1707
  tracing: this.tracing,
1448
1708
  sequence: this.sequence,
1449
1709
  identity: this.identity,
1450
- platform: this.platform
1451
- }), this.meter = new bt(() => this.config.batching.metricFlushIntervalMs, (e, t, n) => {
1710
+ platform: this.platform,
1711
+ debug: this.debugBuffer
1712
+ }), this.meter = new Ft(() => this.config.batching.metricFlushIntervalMs, (e, t, n) => {
1452
1713
  this.emitPoint(e, t, n);
1453
- }, this.diagnostics, this.config.metrics);
1714
+ }, this.diagnostics, this.config.metrics), this.diagnostics.setHandler(this.diagnosticHandler());
1715
+ }
1716
+ diagnosticHandler() {
1717
+ return this.config.diagnostics.records === !1 ? this.config.onDiagnostic : (e) => {
1718
+ this.recordDiagnostic(e), this.config.onDiagnostic?.(e);
1719
+ };
1720
+ }
1721
+ recordDiagnostic(e) {
1722
+ let { records: t } = this.config.diagnostics;
1723
+ if ((t === !0 || t !== !1 && t.includes(e.code)) && !this.recordingDiagnostic) {
1724
+ this.recordingDiagnostic = !0;
1725
+ try {
1726
+ (Nr.has(e.code) ? this.diagnosticLogger.info : this.diagnosticLogger.warn)(e.message, {
1727
+ "diagnostic.code": e.code,
1728
+ "diagnostic.count": e.count,
1729
+ "diagnostic.detail": Fr(e.detail)
1730
+ });
1731
+ } finally {
1732
+ this.recordingDiagnostic = !1;
1733
+ }
1734
+ }
1454
1735
  }
1455
1736
  addBreadcrumb(e, t) {
1456
1737
  this.rotating || this.destroyed || this.diagnostics.guard("record.sanitize_failed", "The library could not add the breadcrumb.", () => {
1457
1738
  let n = {
1458
1739
  t: Date.now(),
1459
1740
  category: "custom",
1460
- message: Ve(String(e), this.limits.maxBodyChars)
1741
+ message: Ye(String(e), this.limits.maxBodyChars)
1461
1742
  };
1462
1743
  if (t !== void 0) {
1463
- let e = He(t, this.limits, this.diagnostics);
1464
- n.data = O(e) ? e : { value: e };
1744
+ let e = Xe(t, this.limits, this.diagnostics);
1745
+ n.data = E(e) ? e : { value: e };
1465
1746
  }
1466
1747
  this.breadcrumbs.push(n);
1467
1748
  });
@@ -1469,15 +1750,26 @@ var J = class e {
1469
1750
  recordMetric(e, t, n) {
1470
1751
  !this.destroyed && !this.rotating && this.meter.record(e, t, n);
1471
1752
  }
1753
+ startMeasure(e, t) {
1754
+ let n = this.identityEpoch, r = () => !this.destroyed && !this.rotating && (!this.config.securityContext.isolation || this.identityEpoch === n);
1755
+ return fr(e, this.diagnostics.guard("record.sanitize_failed", "The library could not read the attributes of the measure.", () => ({ ...t })) ?? {}, this.tracing.request().span, {
1756
+ metric: (e, t, n) => {
1757
+ r() && this.recordMetric(e, t, n);
1758
+ },
1759
+ span: (e) => {
1760
+ r() && this.recordSpan(e);
1761
+ }
1762
+ });
1763
+ }
1472
1764
  recordSpan(e) {
1473
1765
  if (this.config.tracesEndpoint === "") return;
1474
1766
  let { record: t } = this.builder.build({
1475
1767
  level: "INFO",
1476
1768
  type: "span",
1477
1769
  body: e.name,
1478
- namespace: Te,
1770
+ namespace: u,
1479
1771
  payload: e.attributes,
1480
- fixed: $n(e),
1772
+ fixed: Cr(e),
1481
1773
  trace: {
1482
1774
  traceId: e.traceId,
1483
1775
  spanId: e.spanId,
@@ -1491,7 +1783,7 @@ var J = class e {
1491
1783
  level: "INFO",
1492
1784
  type: "metric",
1493
1785
  body: e,
1494
- namespace: we,
1786
+ namespace: te,
1495
1787
  payload: t,
1496
1788
  fixed: n,
1497
1789
  aggregated: !0
@@ -1507,19 +1799,19 @@ var J = class e {
1507
1799
  });
1508
1800
  };
1509
1801
  static pinned() {
1510
- return globalThis[ir] ?? null;
1802
+ return globalThis[Or] ?? null;
1511
1803
  }
1512
1804
  static current() {
1513
1805
  let t = e.local;
1514
1806
  if (t) return t.destroyed ? null : t;
1515
1807
  let n = e.pinned();
1516
- return n && fr(n) ? n : null;
1808
+ return n && Rr(n) ? n : null;
1517
1809
  }
1518
1810
  static stopped() {
1519
1811
  let t = e.local;
1520
1812
  if (t?.destroyed) return t;
1521
- let n = globalThis[ar];
1522
- return n && fr(n) ? n : null;
1813
+ let n = globalThis[kr];
1814
+ return n && Rr(n) ? n : null;
1523
1815
  }
1524
1816
  isDestroyed() {
1525
1817
  return this.destroyed;
@@ -1530,19 +1822,19 @@ var J = class e {
1530
1822
  e.local = null;
1531
1823
  let i = e.pinned();
1532
1824
  if (i) {
1533
- if (!fr(i)) return e.startDegraded(t, i.sdkVersion);
1825
+ if (!Rr(i)) return e.startDegraded(t, i.sdkVersion);
1534
1826
  if (!i.destroyed) return i.reconfigure(t), i;
1535
1827
  }
1536
1828
  let a = new e(t);
1537
- return a.tunablesLocked = !n, globalThis[ir] = a, Reflect.deleteProperty(globalThis, ar), a.init(), a;
1829
+ return a.tunablesLocked = !n, globalThis[Or] = a, Reflect.deleteProperty(globalThis, kr), a.init(), a;
1538
1830
  }
1539
1831
  static startDegraded(t, n) {
1540
1832
  let r = new e(t, !0);
1541
1833
  e.local = r;
1542
1834
  let i = typeof n == "string" ? n : "before 0.9.0";
1543
- return r.mismatchVersion = i, r.diagnostics.report("runtime.version_mismatch", `Another copy of the library, version ${i}, owns the page runtime. This copy, version ${D}, runs in console-only mode and installs no capture. Load one version of the library on the page.`, {
1835
+ return r.mismatchVersion = i, r.diagnostics.report("runtime.version_mismatch", `Another copy of the library, version ${i}, owns the page runtime. This copy, version ${v}, runs in console-only mode and installs no capture. Load one version of the library on the page.`, {
1544
1836
  found: i,
1545
- own: D
1837
+ own: v
1546
1838
  }), r.init(), r;
1547
1839
  }
1548
1840
  reconfigure(e) {
@@ -1551,31 +1843,34 @@ var J = class e {
1551
1843
  return;
1552
1844
  }
1553
1845
  if (this.config.lockConfiguration) {
1554
- let t = K(e, this.diagnostics, this.config);
1555
- Y(this.config, t) || this.diagnostics.report("config.locked", "Runtime configuration is locked. Use setConfigurationLocked(false) to unlock it explicitly.");
1846
+ let t = G(e, this.diagnostics, this.config);
1847
+ J(this.config, t) || this.diagnostics.report("config.locked", "Runtime configuration is locked. Use setConfigurationLocked(false) to unlock it explicitly.");
1556
1848
  return;
1557
1849
  }
1850
+ N(this);
1558
1851
  let t = this.keepDestination(this.keepRouting(this.allowed(e)));
1559
1852
  !this.tunablesLocked && t.securityContext?.id && (this.explicitSecurityContext = !0);
1560
- for (let e of ["correlation", "persistence"]) (e !== "persistence" || this.tunablesLocked || this.senderLoad !== void 0) && t[e] && !Y({
1853
+ for (let e of ["correlation", "persistence"]) (e !== "persistence" || this.tunablesLocked || this.senderLoad !== void 0) && t[e] && !J({
1561
1854
  ...this.config[e],
1562
1855
  ...t[e]
1563
1856
  }, this.config[e]) && (this.diagnostics.report("config.invalid", `${e} cannot change after startup.`), Object.assign(t, { [e]: this.config[e] }));
1564
- let n = lr(this.config.capture), r = K(t, this.diagnostics, this.config);
1565
- this.keepStartupTunables(r), Ln(this.config, r), this.breadcrumbs.resize(this.config.capturePolicy.breadcrumbs), this.diagnostics.setHandler(this.config.onDiagnostic), this.diagnostics.setPolicy(this.config.diagnostics.throttleMs, this.config.diagnostics.consoleFallback), this.builder.invalidateResource(), this.console.update(this.config.console), this.keepBuiltStorage(), this.keepBuiltIdentity(), lr(this.config.capture) !== n && this.installCaptures(), this.roleResolved && this.syncSender(), this.diagnostics.report("config.reconfigured", "A later configure() call updated the runtime.");
1857
+ let n = G(t, this.diagnostics, this.config);
1858
+ this.keepStartupTunables(n);
1859
+ let { redact: r, processors: i } = this.config;
1860
+ rr(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.refreshCaptures(), this.roleResolved && this.syncSender(), this.diagnostics.report("config.reconfigured", "A later configure() call updated the runtime.");
1566
1861
  }
1567
1862
  onServer() {
1568
1863
  return this.platform.platform === "node";
1569
1864
  }
1570
1865
  allowed(e) {
1571
- return this.degraded ? (this.onServer() && !this.serverReported && dr(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 and transport.")), ur(e)) : e;
1866
+ return this.degraded ? (this.onServer() && !this.serverReported && Lr(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.")), Ir(e)) : e;
1572
1867
  }
1573
1868
  keepRouting(e) {
1574
1869
  if (!this.tunablesLocked || this.degraded || !this.config.securityContext.isolation) return e;
1575
- let t = K(e, new zn(), this.config), n = cr.filter((e) => !Y(t[e], this.config[e]));
1870
+ let t = G(e, new or(), this.config), n = Mr.filter((e) => !J(t[e], this.config[e]));
1576
1871
  if (t.securityContext.id !== this.config.securityContext.id && n.push("securityContext.id"), n.length === 0) return e;
1577
1872
  let r = { ...e };
1578
- for (let e of cr) n.includes(e) && Reflect.deleteProperty(r, e);
1873
+ for (let e of Mr) n.includes(e) && Reflect.deleteProperty(r, e);
1579
1874
  if (n.includes("securityContext.id")) {
1580
1875
  let t = { ...e.securityContext };
1581
1876
  Reflect.deleteProperty(t, "id"), r.securityContext = t;
@@ -1583,7 +1878,7 @@ var J = class e {
1583
1878
  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;
1584
1879
  }
1585
1880
  keepStartupTunables(e) {
1586
- if (this.senderLoad !== void 0 && this.keepSections(e, or), !this.tunablesLocked) {
1881
+ if (this.senderLoad !== void 0 && this.keepSections(e, Ar), !this.tunablesLocked) {
1587
1882
  this.tunablesLocked = !0, Object.assign(this.limits, e.limits), this.journeyOptions.maxAgeMs = e.journey.maxAgeMs;
1588
1883
  return;
1589
1884
  }
@@ -1592,7 +1887,7 @@ var J = class e {
1592
1887
  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);
1593
1888
  }
1594
1889
  keepSections(e, t) {
1595
- for (let n of t) Y(e[n], this.config[n]) || (this.diagnostics.report("config.invalid", `${n} cannot change after startup. The values in force stay.`, { requested: e[n] }), Object.assign(e, { [n]: this.config[n] }));
1890
+ for (let n of t) J(e[n], this.config[n]) || (this.diagnostics.report("config.invalid", `${n} cannot change after startup. The values in force stay.`, { requested: e[n] }), Object.assign(e, { [n]: this.config[n] }));
1596
1891
  }
1597
1892
  keepBuiltStorage() {
1598
1893
  let e = this.storageBuiltAs;
@@ -1601,7 +1896,8 @@ var J = class e {
1601
1896
  keepDestination(e) {
1602
1897
  if (this.senderLoad === void 0) return e;
1603
1898
  let t = e;
1604
- return "transport" in e && e.transport === void 0 != (this.config.transport === void 0) && (this.diagnostics.report("config.invalid", "You cannot add or remove transport after the delivery stack loads. The transport in force stays."), t = { ...t }, delete t.transport), (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 endpoint in force stays."), t = {
1899
+ 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 transport in force stays.`), t = { ...t }, Reflect.deleteProperty(t, n));
1900
+ 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 endpoint in force stays."), t = {
1605
1901
  ...t,
1606
1902
  endpoint: void 0
1607
1903
  }), t;
@@ -1642,14 +1938,14 @@ var J = class e {
1642
1938
  }
1643
1939
  async buildBus() {
1644
1940
  try {
1645
- let { Bus: e } = await import("./bus-DeOPHWaD.js");
1941
+ let { Bus: e } = await import("./bus-BZ0GldpT.js");
1646
1942
  if (this.destroyed) return null;
1647
1943
  let t = new e(this.config, this.diagnostics, this.platform, this.identity.contextId, this.identity.tabId, {
1648
1944
  onSecurityContext: (e) => {
1649
1945
  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;
1650
1946
  if (this.contextMismatch = !1, this.config.securityContext.id !== e) {
1651
1947
  if (this.ownerAdopted) {
1652
- this.drops.add("security_context", [
1948
+ N(this), this.drops.add("security_context", [
1653
1949
  ...this.bootBuffer.take(),
1654
1950
  ...this.pendingRecords.take(),
1655
1951
  ...this.forwardBuffer
@@ -1657,7 +1953,7 @@ var J = class e {
1657
1953
  let e = this.rotating;
1658
1954
  this.rotating = !0, this.meter.collect();
1659
1955
  let t = this.sessionTouch.stored();
1660
- this.resetSession(t !== void 0 && t !== this.identity.sessionId ? t : j(this.diagnostics)), this.rotating = e;
1956
+ this.resetSession(t !== void 0 && t !== this.identity.sessionId ? t : A(this.diagnostics)), this.rotating = e, this.identityEpoch++, this.remote.sampling = null, this.refreshCaptures();
1661
1957
  }
1662
1958
  this.config.securityContext.id = e;
1663
1959
  }
@@ -1695,18 +1991,21 @@ var J = class e {
1695
1991
  async buildSender() {
1696
1992
  this.storageBuiltAs = this.config.storage;
1697
1993
  try {
1698
- let { Sender: e } = await import("./sender-DUUmSglb.js"), t = this.destroyed ? null : await e.create({
1994
+ let { Sender: e } = await import("./sender-CiMHC9YG.js"), t = this.destroyed ? null : await e.create({
1699
1995
  storage: this.memoryStorage,
1700
1996
  onStorage: (e) => {
1701
1997
  e.name === "memory" && (this.memoryStorage = e);
1702
1998
  },
1999
+ onPersistence: (e) => {
2000
+ this.storagePersistence = e;
2001
+ },
1703
2002
  config: this.config,
1704
2003
  diagnostics: this.diagnostics,
1705
2004
  onGap: this.reportGap,
1706
2005
  onLoss: this.reportLoss,
1707
2006
  remote: this.remote,
1708
2007
  beforeExit: () => {
1709
- this.meter.collect(), this.tracing.end();
2008
+ N(this), this.meter.collect(), this.tracing.end();
1710
2009
  }
1711
2010
  });
1712
2011
  if (!t || this.destroyed) {
@@ -1719,30 +2018,51 @@ var J = class e {
1719
2018
  }
1720
2019
  for (let e of this.pendingRecords.take()) this.sender?.push(e);
1721
2020
  }
2021
+ refreshCaptures() {
2022
+ if (clearTimeout(this.remoteCaptureTimer), this.remoteCaptureTimer = void 0, this.destroyed) return;
2023
+ let e = this.remote.sampling?.wire();
2024
+ e && (this.remoteCaptureTimer = setTimeout(() => {
2025
+ this.refreshCaptures();
2026
+ }, e.ttlMs), Ge(this.remoteCaptureTimer)), Pr(this.effectiveCapture()) !== this.installedCaptureKey && this.installCaptures();
2027
+ }
2028
+ effectiveCapture() {
2029
+ let e = { ...this.config.capture }, t = this.remote.sampling?.current()?.capture;
2030
+ for (let n of ke) {
2031
+ let r = t?.[n];
2032
+ if (e.remoteToggles.includes(n) && r !== void 0) {
2033
+ if (r && typeof e[n] == "object") continue;
2034
+ e[n] = r;
2035
+ }
2036
+ }
2037
+ return e;
2038
+ }
1722
2039
  async installCaptures() {
1723
2040
  if (this.degraded) return;
1724
- let e = ++this.captureGeneration, t = this.config.capture, n = [];
1725
- (t.errors || t.rejections || t.resourceErrors) && n.push("errors"), (t.fetch || t.xhr) && n.push("network"), (t.interactions || t.navigation) && n.push("interactions"), t.webVitals && n.push("webVitals"), t.longFrames && n.push("longFrames"), (Array.isArray(t.console) ? t.console.length > 0 : t.console) && n.push("console");
2041
+ let e = ++this.captureGeneration, t = this.effectiveCapture();
2042
+ this.installedCaptureKey = Pr(t);
2043
+ let n = [];
2044
+ (t.errors || t.rejections || t.resourceErrors) && n.push("errors"), (t.fetch || t.xhr) && n.push("network"), (t.interactions || t.navigation) && n.push("interactions"), t.webVitals && n.push("webVitals"), t.longFrames && n.push("longFrames"), (Array.isArray(t.console) ? t.console.length > 0 : t.console) && n.push("console"), t.uncleanExit && n.push("uncleanExit"), t.userTiming && n.push("userTiming"), t.reports && n.push("reports"), t.resourceTiming && n.push("resourceTiming"), t.lifecycle && n.push("lifecycle");
1726
2045
  let [r, i] = await Promise.all([Promise.all(n.map((e) => this.loadCapture(e))), t.webSocket ? this.loadWebSocket() : void 0]);
1727
2046
  if (e !== this.captureGeneration || this.destroyed) return;
1728
2047
  this.uninstallCaptures();
1729
2048
  let a = {
1730
2049
  isActive: () => !this.destroyed && !this.rotating,
1731
- config: this.config,
2050
+ config: Object.assign(Object.create(this.config), { capture: t }),
1732
2051
  diagnostics: this.diagnostics,
1733
2052
  breadcrumbs: this.breadcrumbs,
1734
2053
  tracing: this.tracing,
1735
- logger: new F(() => this, me),
2054
+ logger: new F(() => this, _),
1736
2055
  once: this.captureOnce,
1737
2056
  recordMetric: (e, t, n) => {
1738
2057
  this.recordMetric(e, t, n);
1739
2058
  },
1740
2059
  recordSpan: (e) => {
1741
2060
  this.recordSpan(e);
1742
- }
2061
+ },
2062
+ sessionId: () => this.identity.sessionId
1743
2063
  };
1744
2064
  for (let e of r) e && this.captures.push(new e(a));
1745
- let o = i ? [...t.plugins, new i(this.diagnostics, this.config)] : t.plugins;
2065
+ let o = i ? [...t.plugins, new i(this.diagnostics, a.config)] : t.plugins;
1746
2066
  for (let e of o) this.captures.push(this.pluginCapture(e));
1747
2067
  for (let e of this.captures) this.diagnostics.guard("capture.install_failed", `The library could not install the ${e.name} capture.`, () => {
1748
2068
  e.install();
@@ -1755,19 +2075,19 @@ var J = class e {
1755
2075
  this.captures.length = 0;
1756
2076
  }
1757
2077
  loadWebSocket() {
1758
- return this.diagnostics.guardAsync("capture.install_failed", "The library could not load the webSocket capture.", async () => (await import("./web-socket-CpsD8WAa.js")).WebSocketCapture);
2078
+ return this.diagnostics.guardAsync("capture.install_failed", "The library could not load the webSocket capture.", async () => (await import("./web-socket-CV7yIMnm.js")).WebSocketCapture);
1759
2079
  }
1760
2080
  pluginCapture(e) {
1761
2081
  let { name: t } = e, n = (e, t, n) => {
1762
2082
  this.recordMetric(e, t, n);
1763
2083
  }, r = {
1764
- logger: new F(() => this, `${me}.${t}`),
1765
- counter: (e, t = {}) => vt(e, t, n),
1766
- histogram: (e, t = {}) => yt(e, t, n),
2084
+ logger: new F(() => this, `${_}.${t}`),
2085
+ counter: (e, t = {}) => Nt(e, t, n),
2086
+ histogram: (e, t = {}) => Pt(e, t, n),
1767
2087
  addBreadcrumb: (e, t) => {
1768
2088
  this.addBreadcrumb(e, t);
1769
2089
  },
1770
- ownRequest: Ye
2090
+ ownRequest: rt
1771
2091
  };
1772
2092
  return {
1773
2093
  name: t,
@@ -1780,7 +2100,7 @@ var J = class e {
1780
2100
  };
1781
2101
  }
1782
2102
  loadCapture(e) {
1783
- return this.diagnostics.guardAsync("capture.install_failed", `The library could not load the ${e} capture.`, er[e]);
2103
+ return this.diagnostics.guardAsync("capture.install_failed", `The library could not load the ${e} capture.`, wr[e]);
1784
2104
  }
1785
2105
  registerWorker(e, t = {}) {
1786
2106
  let n = !1, r;
@@ -1802,12 +2122,15 @@ var J = class e {
1802
2122
  }
1803
2123
  async destroy() {
1804
2124
  if (this.destroyed) return;
1805
- this.meter.collect(), this.tracing.end(), this.destroyed = !0, this.degraded || removeEventListener("pagehide", this.onPageHide), this.uninstallCaptures();
2125
+ N(this), this.meter.collect(), this.tracing.end(), this.destroyed = !0, bt(this), clearTimeout(this.remoteCaptureTimer), this.remoteCaptureTimer = void 0, this.degraded || removeEventListener("pagehide", this.onPageHide), this.uninstallCaptures();
1806
2126
  let t = this.sender?.destroy();
1807
- this.journey.destroy(), this.sendForwarded(), this.bus?.destroy(), this.drops.add("load_failed", this.pendingRecords.take()), await t, await this.senderLoad, await this.rotation?.catch(() => void 0), await this.memoryStorage?.close(), e.pinned() === this && (Reflect.deleteProperty(globalThis, ir), globalThis[ar] = this);
2127
+ this.journey.destroy(), this.sendForwarded(), this.bus?.destroy(), this.drops.add("load_failed", this.pendingRecords.take()), await t, await this.senderLoad, await this.rotation?.catch(() => void 0), await this.memoryStorage?.close(), e.pinned() === this && (Reflect.deleteProperty(globalThis, Or), globalThis[kr] = this);
1808
2128
  }
1809
2129
  emit(e) {
1810
- !e || this.destroyed || this.rotating && !this.closingContext || (this.sessionTouch.touch(this.identity.sessionId), this.ready ? this.route(e) : this.bootBuffer.push(e));
2130
+ if (!e || this.destroyed || this.rotating && !this.closingContext) return;
2131
+ this.sessionTouch.touch(this.identity.sessionId);
2132
+ let t = e.severityText === "ERROR" || e.severityText === "FATAL" ? [...this.debugBuffer.drain(), e] : [e];
2133
+ for (let e of t) this.ready ? this.route(e) : this.bootBuffer.push(e);
1811
2134
  }
1812
2135
  route(e) {
1813
2136
  this.role() === "forwarder" ? this.forward(e) : this.deliver(e);
@@ -1819,7 +2142,7 @@ var J = class e {
1819
2142
  this.diagnostics.count("record.dropped_boot_buffer_full"), this.drops.add("buffer_full", [e]);
1820
2143
  }
1821
2144
  forward(e) {
1822
- this.forwardBuffer.push(e), !this.forwardScheduled && (this.forwardScheduled = !0, queueMicrotask(() => {
2145
+ this.forwardBuffer.push(e), this.forwardScheduled || (this.forwardScheduled = !0, queueMicrotask(() => {
1823
2146
  this.forwardScheduled = !1, this.sendForwarded();
1824
2147
  }));
1825
2148
  }
@@ -1835,11 +2158,11 @@ var J = class e {
1835
2158
  }
1836
2159
  let t = [];
1837
2160
  for (let n of e) {
1838
- if (!Ne(n)) {
2161
+ if (!ze(n)) {
1839
2162
  this.diagnostics.count("record.dropped_malformed");
1840
2163
  continue;
1841
2164
  }
1842
- if (!Me(n, this.config, this.remote.sampling?.current() ?? null)) {
2165
+ if (n.attributes["uiobs.debug_buffer"] !== !0 && !ct(n, this.config, this.remote.sampling?.current() ?? null)) {
1843
2166
  this.diagnostics.count("record.dropped_by_sampling");
1844
2167
  continue;
1845
2168
  }
@@ -1859,51 +2182,51 @@ var J = class e {
1859
2182
  reportGap = (e, t) => {
1860
2183
  this.drops.add(e.reason, t.flatMap((e) => e.records), t.map((e) => e.id));
1861
2184
  let n = Date.now();
1862
- n - this.lastGapAt < 6e4 || (this.lastGapAt = n, new F(() => this, ge).warn("stored records were dropped before delivery", {
2185
+ n - this.lastGapAt < 6e4 || (this.lastGapAt = n, new F(() => this, Ie).warn("stored records were dropped before delivery", {
1863
2186
  "gap.batches": e.batches,
1864
2187
  "gap.records": e.records,
1865
2188
  "gap.reason": e.reason
1866
2189
  }));
1867
2190
  };
1868
2191
  regenerateTabId() {
1869
- let e = j(this.diagnostics);
2192
+ let e = A(this.diagnostics);
1870
2193
  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.", {
1871
2194
  was: this.identity.tabId,
1872
2195
  now: e
1873
- }), this.identity.tabId = e, Ue(e, this.diagnostics, this.stores), this.builder.invalidateResource();
2196
+ }), this.identity.tabId = e, Ze(e, this.diagnostics, this.stores), this.builder.invalidateResource();
1874
2197
  }
1875
2198
  newSession() {
1876
- this.destroyed || this.resetSession(j(this.diagnostics));
2199
+ this.destroyed || (N(this), this.resetSession(A(this.diagnostics)));
1877
2200
  }
1878
2201
  resetSession(e) {
1879
- this.meter.collect(), this.tracing.rotate("explicit"), this.journey.end(), this.breadcrumbs.clear(), this.identity.sessionId = e, this.sessionTouch.restart(e), this.builder.invalidateResource();
2202
+ this.meter.collect(), this.tracing.rotate("explicit"), this.journey.end(), this.breadcrumbs.clear(), this.debugBuffer.clear(), this.identity.sessionId = e, this.sessionTouch.restart(e), this.builder.invalidateResource();
1880
2203
  }
1881
2204
  rotateSecurityContext(e, t = {}) {
1882
2205
  if (this.rotation) return Promise.reject(/* @__PURE__ */ Error("A security-context rotation is already running."));
1883
2206
  let n = t.pending ?? "discard", r = t.timeoutMs ?? 5e3;
1884
- return !O(e) || !O(e.delivery) || ![
2207
+ return !E(e) || !E(e.delivery) || ![
1885
2208
  "discard",
1886
2209
  "flush",
1887
2210
  "retain",
1888
2211
  "carry"
1889
- ].includes(n) || !Number.isFinite(r) || r < 0 || e.id !== void 0 && (typeof e.id != "string" || e.id.length === 0) ? Promise.reject(/* @__PURE__ */ Error("Invalid security-context rotation options.")) : this.destroyed ? Promise.reject(/* @__PURE__ */ Error("The runtime has stopped.")) : (this.rotating = !0, this.rotation = this.rotateContext(e, n, r).finally(() => {
2212
+ ].includes(n) || !Number.isFinite(r) || r < 0 || e.id !== void 0 && (typeof e.id != "string" || e.id.length === 0) ? Promise.reject(/* @__PURE__ */ Error("Invalid security-context rotation options.")) : this.destroyed ? Promise.reject(/* @__PURE__ */ Error("The runtime has stopped.")) : (N(this), this.rotating = !0, this.rotation = this.rotateContext(e, n, r).finally(() => {
1890
2213
  this.rotating = !1, this.rotation = void 0;
1891
2214
  }), this.rotation);
1892
2215
  }
1893
2216
  async rotateContext(e, t, n) {
1894
2217
  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.");
1895
2218
  await this.senderLoad;
1896
- let r = this.config.securityContext.id, i = e.id ?? j(this.diagnostics);
2219
+ let r = this.config.securityContext.id, i = e.id ?? A(this.diagnostics);
1897
2220
  if (i === r) throw Error("A rotation requires a different security-context id.");
1898
2221
  let a = {
1899
- ...sr,
2222
+ ...jr,
1900
2223
  ...e.delivery
1901
- }, o = this.diagnostics.snapshot()["config.invalid"] ?? 0, s = K(this.allowed({
2224
+ }, o = this.diagnostics.snapshot()["config.invalid"] ?? 0, s = G(this.allowed({
1902
2225
  ...a,
1903
2226
  securityContext: { id: i }
1904
2227
  }), this.diagnostics, {
1905
2228
  ...this.config,
1906
- ...sr
2229
+ ...jr
1907
2230
  });
1908
2231
  if ((this.diagnostics.snapshot()["config.invalid"] ?? 0) !== o) throw Error("Invalid delivery settings for the next security context.");
1909
2232
  let c = e.context ? Object.fromEntries(Object.entries(e.context)) : void 0, l = /* @__PURE__ */ new Set([
@@ -1935,12 +2258,32 @@ var J = class e {
1935
2258
  };
1936
2259
  if (this.destroyed) return;
1937
2260
  let m = [...d, ...p.buffered], h = p.stored.flatMap((e) => e.records);
1938
- t !== "retain" && t !== "carry" && this.drops.add("security_context", [...m, ...h]), s.lockConfiguration = this.config.lockConfiguration, Ln(this.config, s), this.remote.sampling = null, this.context.clear(), c && this.context.setMany(c), this.breadcrumbs.clear(), this.newSession(), this.builder.invalidateResource(), await this.syncSender(), this.bus?.rotateContext(), t === "carry" && (this.rotating = !1, await this.carry(m, p.stored)), this.diagnostics.report("security.rotated", "The runtime rotated its security context.", { pending: t });
2261
+ t !== "retain" && t !== "carry" && this.drops.add("security_context", [...m, ...h]), s.lockConfiguration = this.config.lockConfiguration, rr(this.config, s), this.identityEpoch++, 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(m, p.stored), this.diagnostics.report("security.rotated", "The runtime rotated its security context.", { pending: t });
1939
2262
  }
1940
2263
  async carry(e, t) {
1941
2264
  for (let t of e) this.route(t);
1942
2265
  this.sender && await this.sender.adopt(t, this.config.securityContext.id);
1943
2266
  }
2267
+ async debugBundle(e) {
2268
+ let { configSummary: t } = await import("./debug-bundle-C7UkHZ-q.js"), { record: n } = this.builder.build({
2269
+ level: "INFO",
2270
+ type: "system",
2271
+ body: "debug bundle",
2272
+ namespace: Oe,
2273
+ payload: { [b]: this.breadcrumbs.snapshot() }
2274
+ }, !0), r = n?.attributes ?? {}, i = r[b], a = r[C];
2275
+ return {
2276
+ createdAt: (/* @__PURE__ */ new Date()).toISOString(),
2277
+ sdkVersion: this.sdkVersion,
2278
+ health: e,
2279
+ diagnostics: this.diagnostics.snapshot(),
2280
+ resource: n?.resource ?? {},
2281
+ pageUrl: typeof a == "string" ? a : "",
2282
+ breadcrumbs: Array.isArray(i) ? i : [],
2283
+ debugBuffer: this.debugBuffer.snapshot(),
2284
+ config: t(this.config, this.limits, this.diagnostics)
2285
+ };
2286
+ }
1944
2287
  async health() {
1945
2288
  let e = this.sender?.stats() ?? {
1946
2289
  pending: 0,
@@ -1961,6 +2304,7 @@ var J = class e {
1961
2304
  configurationLocked: this.config.lockConfiguration,
1962
2305
  issues: t,
1963
2306
  securityContext: { ...this.config.securityContext },
2307
+ storagePersistence: this.storagePersistence,
1964
2308
  bus: {
1965
2309
  sourcePolicy: n,
1966
2310
  validation: r,
@@ -1989,10 +2333,10 @@ var J = class e {
1989
2333
  return;
1990
2334
  }
1991
2335
  let [{ createStorage: t, storageName: n }, { ContextStorage: r }, { storageLimits: i }, { clearEmergencyContext: a }] = await Promise.all([
1992
- import("./factory-C5TujXlU.js"),
1993
- import("./context-storage-DxZf4Gfh.js"),
1994
- import("./storage-w7Tslvlq.js"),
1995
- import("./emergency-queue-BYUyDHGD.js")
2336
+ import("./factory-BonqI3NL.js"),
2337
+ import("./context-storage-BzkoHzkQ.js"),
2338
+ import("./storage-DZwed89z.js"),
2339
+ import("./emergency-queue-Zy6lNafo.js")
1996
2340
  ]), 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);
1997
2341
  try {
1998
2342
  e === "namespace" ? await c.clearNamespace() : await c.clear(), a(this.config.securityContext.id, this.diagnostics, o, e === "namespace");
@@ -2004,21 +2348,48 @@ var J = class e {
2004
2348
  return await this.senderLoad, await this.sender?.queueDepth() ?? 0;
2005
2349
  }
2006
2350
  async flush() {
2007
- this.meter.collect(), this.ready || await this.started, this.role() === "forwarder" ? this.sendForwarded() : (await this.senderLoad, await this.sender?.flush());
2351
+ N(this), this.meter.collect(), this.ready || await this.started, this.role() === "forwarder" ? this.sendForwarded() : (await this.senderLoad, await this.sender?.flush());
2008
2352
  }
2009
2353
  };
2010
- function Y(e, t, n = /* @__PURE__ */ new WeakMap()) {
2354
+ function J(e, t, n = /* @__PURE__ */ new WeakMap()) {
2011
2355
  if (Object.is(e, t)) return !0;
2012
2356
  if (e instanceof RegExp && t instanceof RegExp) return String(e) === String(t);
2013
2357
  if (typeof e != "object" || !e || typeof t != "object" || !t) return !1;
2014
2358
  if (n.has(e)) return n.get(e) === t;
2015
2359
  n.set(e, t);
2016
2360
  let r = Object.keys(e), i = Object.keys(t);
2017
- return r.length === i.length && r.every((r) => Object.hasOwn(t, r) && Y(Reflect.get(e, r), Reflect.get(t, r), n));
2361
+ return r.length === i.length && r.every((r) => Object.hasOwn(t, r) && J(Reflect.get(e, r), Reflect.get(t, r), n));
2362
+ }
2363
+ // src/transport/worker-entry.ts
2364
+ var Y;
2365
+ function zr(e = {}) {
2366
+ if (Y) return Y;
2367
+ let n = new or(e.onDiagnostic);
2368
+ if (typeof document < "u" || typeof addEventListener != "function") return n.report("config.invalid", "Call serveTransportWorker() in a dedicated worker."), () => void 0;
2369
+ let r = !1, i, a, o = (e) => {
2370
+ n.guard("transport.http_error", "The transport worker could not read its connection.", () => {
2371
+ let o = e.data;
2372
+ if (!E(o) || o.p !== "ui-observability.transport/1" || o.t !== t.connect || e.ports.length === 0) return;
2373
+ let s = e.ports[0];
2374
+ i || o.v !== "0.11.0" ? (s.postMessage(Re), s.close()) : (i = s, import("./worker-server-Dp5HYm4b.js").then((e) => {
2375
+ r || (a = e.serveWorkerPort(s, n));
2376
+ }).catch((e) => {
2377
+ n.report("transport.http_error", "The transport worker delivery module could not load.", void 0, e), n.guard("transport.http_error", "The failed transport port could not be closed.", () => {
2378
+ s.postMessage(Re), s.close();
2379
+ });
2380
+ }));
2381
+ });
2382
+ }, s = () => {
2383
+ r || (r = !0, Y = void 0, removeEventListener("message", o), a?.(), n.guard("transport.http_error", "The transport service could not close its port.", () => {
2384
+ i?.postMessage(Re);
2385
+ }), n.guard("transport.http_error", "The transport port could not close.", () => {
2386
+ i?.close();
2387
+ }));
2388
+ };
2389
+ return addEventListener("message", o), Y = s, s;
2018
2390
  }
2019
- //#endregion
2020
- //#region src/transport/memory-transport.ts
2021
- function pr() {
2391
+ // src/transport/memory-transport.ts
2392
+ function Br() {
2022
2393
  let e = [], t = [], n = { status: 200 };
2023
2394
  return {
2024
2395
  transport: (r) => (e.push(r), n.status >= 200 && n.status < 300 && t.push(r), Promise.resolve({ ...n })),
@@ -2035,25 +2406,24 @@ function pr() {
2035
2406
  }
2036
2407
  };
2037
2408
  }
2038
- //#endregion
2039
- //#region src/index.ts
2409
+ // src/index.ts
2040
2410
  var X = /* @__PURE__ */ new Map();
2041
2411
  function Z() {
2042
- return (J.current() ?? J.stopped()) || J.configure({}, !0);
2412
+ return (q.current() ?? q.stopped()) || q.configure({}, !0);
2043
2413
  }
2044
- function mr(e = "context") {
2414
+ function Vr(e = "context") {
2045
2415
  return ["context", "namespace"].includes(e) ? Z().clearPersisted(e) : Promise.reject(/* @__PURE__ */ Error("Invalid persistence scope."));
2046
2416
  }
2047
- function hr(e) {
2048
- J.configure(e), Q();
2417
+ function Hr(e) {
2418
+ q.configure(e), Q();
2049
2419
  }
2050
- function gr(e) {
2420
+ function Ur(e) {
2051
2421
  Z().setConfigurationLocked(e);
2052
2422
  }
2053
- function _r(e, t) {
2423
+ function Wr(e, t) {
2054
2424
  return Z().rotateSecurityContext(e, t);
2055
2425
  }
2056
- async function vr() {
2426
+ async function Gr() {
2057
2427
  let e = Z();
2058
2428
  return Q(), {
2059
2429
  ...await e.health(),
@@ -2063,124 +2433,130 @@ async function vr() {
2063
2433
  }
2064
2434
  };
2065
2435
  }
2436
+ async function Kr() {
2437
+ let e = await Gr();
2438
+ return Z().debugBundle(e);
2439
+ }
2066
2440
  function Q() {
2067
- let e = (J.current() ?? J.stopped())?.config.loggerCache.maxEntries, t = e === void 0 ? 256 : e;
2441
+ let e = (q.current() ?? q.stopped())?.config.loggerCache.maxEntries, t = e === void 0 ? 256 : e;
2068
2442
  if (t !== null) for (let e of X.keys()) {
2069
2443
  if (X.size <= t) break;
2070
2444
  X.delete(e);
2071
2445
  }
2072
2446
  return t;
2073
2447
  }
2074
- function yr(e, t) {
2448
+ function qr(e, t) {
2075
2449
  let n = Q();
2076
2450
  if (t || n === 0) return new F(Z, e, t);
2077
2451
  let r = X.get(e);
2078
2452
  return r ??= new F(Z, e), X.delete(e), X.set(e, r), Q(), r;
2079
2453
  }
2080
2454
  function $() {
2081
- return yr("app");
2455
+ return qr("app");
2082
2456
  }
2083
- function br(e, t) {
2457
+ function Jr(e, t) {
2084
2458
  $().trace(e, t);
2085
2459
  }
2086
- function xr(e, t) {
2460
+ function Yr(e, t) {
2087
2461
  $().debug(e, t);
2088
2462
  }
2089
- function Sr(e, t) {
2463
+ function Xr(e, t) {
2090
2464
  $().info(e, t);
2091
2465
  }
2092
- function Cr(e, t) {
2466
+ function Zr(e, t) {
2093
2467
  $().warn(e, t);
2094
2468
  }
2095
- function wr(e, t, n) {
2469
+ function Qr(e, t, n) {
2096
2470
  $().error(e, t, n);
2097
2471
  }
2098
- function Tr(e, t, n) {
2472
+ function $r(e, t, n) {
2099
2473
  $().fatal(e, t, n);
2100
2474
  }
2101
- function Er(e, t) {
2475
+ function ei(e, t) {
2102
2476
  $().logAction(e, t);
2103
2477
  }
2104
- function Dr(e, t) {
2478
+ function ti(e, t) {
2105
2479
  $().logEvent(e, t);
2106
2480
  }
2107
- function Or(e, t, n, r, i) {
2481
+ function ni(e, t, n, r, i) {
2108
2482
  $().logMetric(e, t, n, r, i);
2109
2483
  }
2110
- function kr(e, t = {}) {
2111
- return vt(e, t, (e, t, n) => {
2484
+ function ri(e, t = {}) {
2485
+ return Nt(e, t, (e, t, n) => {
2112
2486
  Z().recordMetric(e, t, n);
2113
2487
  });
2114
2488
  }
2115
- function Ar(e, t = {}) {
2116
- return yt(e, t, (e, t, n) => {
2489
+ function ii(e, t = {}) {
2490
+ return Pt(e, t, (e, t, n) => {
2117
2491
  Z().recordMetric(e, t, n);
2118
2492
  });
2119
2493
  }
2120
- function jr(e, t, n) {
2494
+ function ai(e, t) {
2495
+ return Z().startMeasure(e, t);
2496
+ }
2497
+ function oi(e, t, n) {
2121
2498
  return $().timeSync(e, t, n);
2122
2499
  }
2123
- function Mr(e, t, n) {
2500
+ function si(e, t, n) {
2124
2501
  return $().timeAsync(e, t, n);
2125
2502
  }
2126
- function Nr(e, t) {
2503
+ function ci(e, t) {
2127
2504
  Z().addBreadcrumb(e, t);
2128
2505
  }
2129
- function Pr(e, t) {
2506
+ function li(e, t) {
2130
2507
  Z().context.set(e, t);
2131
2508
  }
2132
- function Fr(e) {
2509
+ function ui(e) {
2133
2510
  Z().context.setMany(e);
2134
2511
  }
2135
- function Ir(e) {
2512
+ function di(e) {
2136
2513
  Z().context.remove(e);
2137
2514
  }
2138
- function Lr(e, t) {
2515
+ function fi(e, t) {
2139
2516
  return Z().journey.start(e, t);
2140
2517
  }
2141
- function Rr() {
2518
+ function pi() {
2142
2519
  Z().journey.end();
2143
2520
  }
2144
- function zr() {
2521
+ function mi() {
2145
2522
  return Z().journey.current();
2146
2523
  }
2147
- function Br() {
2524
+ function hi() {
2148
2525
  return Z().journey.getToken();
2149
2526
  }
2150
- function Vr(e) {
2527
+ function gi(e) {
2151
2528
  return Z().journey.adopt(e, "manual", !0);
2152
2529
  }
2153
- function Hr(e, t) {
2530
+ function _i(e, t) {
2154
2531
  return Z().registerWorker(e, t);
2155
2532
  }
2156
- function Ur(e, t) {
2533
+ function vi(e, t) {
2157
2534
  return Z().registerFrame(e, t);
2158
2535
  }
2159
- function Wr() {
2536
+ function yi() {
2160
2537
  Z().tracing.rotate("explicit");
2161
2538
  }
2162
- function Gr() {
2539
+ function bi() {
2163
2540
  return Z().tracing.headers();
2164
2541
  }
2165
- function Kr() {
2542
+ function xi() {
2166
2543
  return Z().flush();
2167
2544
  }
2168
- function qr() {
2545
+ function Si() {
2169
2546
  return Z().queueDepth();
2170
2547
  }
2171
- function Jr() {
2548
+ function Ci() {
2172
2549
  return Z().stats();
2173
2550
  }
2174
- function Yr() {
2551
+ function wi() {
2175
2552
  Z().newSession();
2176
2553
  }
2177
- function Xr() {
2554
+ function Ti() {
2178
2555
  return Z().diagnostics.snapshot();
2179
2556
  }
2180
- async function Zr() {
2181
- await J.current()?.destroy();
2557
+ async function Ei() {
2558
+ await q.current()?.destroy();
2182
2559
  }
2183
- //#endregion
2184
- export { F as OneLogger, Nr as addBreadcrumb, Vr as adoptJourney, mr as clearPersistedLogs, hr as configure, kr as counter, pr as createMemoryTransport, zr as currentJourney, xr as debug, Rr as endJourney, wr as error, Tr as fatal, Kr as flush, Xr as getDiagnosticCounters, vr as getHealth, Br as getJourneyToken, yr as getLogger, qr as getQueueDepth, Jr as getStats, Gr as getTraceHeaders, Ar as histogram, Sr as info, Er as logAction, Dr as logEvent, Or as logMetric, Yr as newSession, Ur as registerFrame, Hr as registerWorker, Ir as removeContext, _r as rotateSecurityContext, gr as setConfigurationLocked, Pr as setContext, Fr as setContextMap, Zr as shutdown, Lr as startJourney, Wr as startTrace, Mr as timeAsync, jr as timeSync, br as trace, Cr as warn };
2560
+ export { F as OneLogger, ci as addBreadcrumb, gi as adoptJourney, Vr as clearPersistedLogs, Kr as collectDebugBundle, Hr as configure, ri as counter, Br as createMemoryTransport, mi as currentJourney, Yr as debug, pi as endJourney, Qr as error, $r as fatal, xi as flush, Ti as getDiagnosticCounters, Gr as getHealth, hi as getJourneyToken, qr as getLogger, Si as getQueueDepth, Ci as getStats, bi as getTraceHeaders, ii as histogram, Xr as info, ei as logAction, ti as logEvent, ni as logMetric, wi as newSession, vi as registerFrame, _i as registerWorker, di as removeContext, Wr as rotateSecurityContext, zr as serveTransportWorker, Ur as setConfigurationLocked, li as setContext, ui as setContextMap, Ei as shutdown, fi as startJourney, ai as startMeasure, yi as startTrace, si as timeAsync, oi as timeSync, Jr as trace, Zr as warn };
2185
2561
 
2186
2562
  //# sourceMappingURL=index.js.map