@utk09/ui-observability 1.1.0 → 1.2.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 (271) hide show
  1. package/CHANGELOG.md +42 -0
  2. package/dist/{batch-D3NHhF9L.js → batch-120Kc9jr.js} +3 -3
  3. package/dist/{batch-D3NHhF9L.js.map → batch-120Kc9jr.js.map} +1 -1
  4. package/dist/{batch-DnYRJqhU.cjs → batch-C3uNp5kU.cjs} +2 -2
  5. package/dist/{batch-DnYRJqhU.cjs.map → batch-C3uNp5kU.cjs.map} +1 -1
  6. package/dist/bus/bus.d.cts +5 -0
  7. package/dist/bus/bus.d.ts +5 -0
  8. package/dist/bus-Dj8IEVcC.cjs +2 -0
  9. package/dist/bus-Dj8IEVcC.cjs.map +1 -0
  10. package/dist/{bus-dw7T92sO.js → bus-DyNafxZN.js} +104 -94
  11. package/dist/bus-DyNafxZN.js.map +1 -0
  12. package/dist/capture/errors.d.cts +10 -0
  13. package/dist/capture/errors.d.ts +10 -0
  14. package/dist/capture/replay.d.cts +1 -1
  15. package/dist/capture/replay.d.ts +1 -1
  16. package/dist/capture/types.d.cts +5 -0
  17. package/dist/capture/types.d.ts +5 -0
  18. package/dist/capture/web-vitals.d.cts +1 -0
  19. package/dist/capture/web-vitals.d.ts +1 -0
  20. package/dist/{compression-SHPAvS4U.js → compression-BWkDWY3v.js} +2 -2
  21. package/dist/{compression-SHPAvS4U.js.map → compression-BWkDWY3v.js.map} +1 -1
  22. package/dist/{compression-C0hUHKR-.cjs → compression-CEVe7NPX.cjs} +2 -2
  23. package/dist/{compression-C0hUHKR-.cjs.map → compression-CEVe7NPX.cjs.map} +1 -1
  24. package/dist/config-C0PtemvC.cjs +2 -0
  25. package/dist/config-C0PtemvC.cjs.map +1 -0
  26. package/dist/{config-CSNcS7OZ.js → config-DK1Zf7jn.js} +83 -85
  27. package/dist/config-DK1Zf7jn.js.map +1 -0
  28. package/dist/{console-BsM-fSCQ.js → console-CAyCQOpm.js} +5 -5
  29. package/dist/{console-BsM-fSCQ.js.map → console-CAyCQOpm.js.map} +1 -1
  30. package/dist/{console-Dkxs6IVQ.cjs → console-Dk6GH4yj.cjs} +2 -2
  31. package/dist/{console-Dkxs6IVQ.cjs.map → console-Dk6GH4yj.cjs.map} +1 -1
  32. package/dist/{constants-BwJDXzj6.js → constants-CEHN6KuY.js} +42 -21
  33. package/dist/constants-CEHN6KuY.js.map +1 -0
  34. package/dist/constants-NtiQDWL_.cjs +2 -0
  35. package/dist/constants-NtiQDWL_.cjs.map +1 -0
  36. package/dist/constants.d.cts +11 -0
  37. package/dist/constants.d.ts +11 -0
  38. package/dist/core/config.d.cts +9 -3
  39. package/dist/core/config.d.ts +9 -3
  40. package/dist/core/diagnostics.d.cts +1 -1
  41. package/dist/core/diagnostics.d.ts +1 -1
  42. package/dist/core/pipeline.d.cts +11 -0
  43. package/dist/core/pipeline.d.ts +11 -0
  44. package/dist/core/record.d.cts +2 -2
  45. package/dist/core/record.d.ts +2 -2
  46. package/dist/core/sender.d.cts +3 -2
  47. package/dist/core/sender.d.ts +3 -2
  48. package/dist/{debug-bundle-B2v6Cym-.cjs → debug-bundle-DMzUfiQc.cjs} +2 -2
  49. package/dist/{debug-bundle-B2v6Cym-.cjs.map → debug-bundle-DMzUfiQc.cjs.map} +1 -1
  50. package/dist/{debug-bundle-Cs_YWzTa.js → debug-bundle-w78W46zr.js} +4 -4
  51. package/dist/{debug-bundle-Cs_YWzTa.js.map → debug-bundle-w78W46zr.js.map} +1 -1
  52. package/dist/doctor.cjs +1 -1
  53. package/dist/doctor.js +22 -22
  54. package/dist/doctor.js.map +1 -1
  55. package/dist/errors-07pmZ7VY.cjs +3 -0
  56. package/dist/errors-07pmZ7VY.cjs.map +1 -0
  57. package/dist/{errors-Q3Ng1ciC.js → errors-C-LYbqyB.js} +27 -24
  58. package/dist/errors-C-LYbqyB.js.map +1 -0
  59. package/dist/{factory-DV17sm2p.js → factory-BHYrcSaU.js} +42 -31
  60. package/dist/factory-BHYrcSaU.js.map +1 -0
  61. package/dist/factory-DsaNdcXp.cjs +2 -0
  62. package/dist/factory-DsaNdcXp.cjs.map +1 -0
  63. package/dist/{identity-BgtHyY4u.js → identity-Byh3gCdT.js} +11 -11
  64. package/dist/{identity-BgtHyY4u.js.map → identity-Byh3gCdT.js.map} +1 -1
  65. package/dist/{identity-CvuyqZk7.cjs → identity-BzAzdQyv.cjs} +2 -2
  66. package/dist/{identity-CvuyqZk7.cjs.map → identity-BzAzdQyv.cjs.map} +1 -1
  67. package/dist/index.cjs +1 -1
  68. package/dist/index.cjs.map +1 -1
  69. package/dist/index.js +539 -534
  70. package/dist/index.js.map +1 -1
  71. package/dist/{indexeddb-storage-e-13ZLWm.js → indexeddb-storage-BYywz-v6.js} +4 -4
  72. package/dist/{indexeddb-storage-e-13ZLWm.js.map → indexeddb-storage-BYywz-v6.js.map} +1 -1
  73. package/dist/{indexeddb-storage-D4KVcqdD.cjs → indexeddb-storage-BfqGkLFe.cjs} +2 -2
  74. package/dist/{indexeddb-storage-D4KVcqdD.cjs.map → indexeddb-storage-BfqGkLFe.cjs.map} +1 -1
  75. package/dist/{interactions-OK85T-Dk.cjs → interactions-BXzEel4F.cjs} +2 -2
  76. package/dist/interactions-BXzEel4F.cjs.map +1 -0
  77. package/dist/{interactions-Byxf1C82.js → interactions-DdKPMWIN.js} +12 -12
  78. package/dist/interactions-DdKPMWIN.js.map +1 -0
  79. package/dist/{journey-nMbob3OB.cjs → journey-BUmsrgaw.cjs} +2 -2
  80. package/dist/{journey-nMbob3OB.cjs.map → journey-BUmsrgaw.cjs.map} +1 -1
  81. package/dist/{journey-C93FTYcs.js → journey-Nu655gEO.js} +3 -3
  82. package/dist/{journey-C93FTYcs.js.map → journey-Nu655gEO.js.map} +1 -1
  83. package/dist/{library-console-DJUQzcgM.cjs → library-console-DdIlzzph.cjs} +2 -2
  84. package/dist/{library-console-DJUQzcgM.cjs.map → library-console-DdIlzzph.cjs.map} +1 -1
  85. package/dist/{library-console-DklSmucS.js → library-console-amePMnP8.js} +2 -2
  86. package/dist/{library-console-DklSmucS.js.map → library-console-amePMnP8.js.map} +1 -1
  87. package/dist/{library-request-UGEwOHpf.js → library-request-Cv7C05jf.js} +2 -2
  88. package/dist/{library-request-UGEwOHpf.js.map → library-request-Cv7C05jf.js.map} +1 -1
  89. package/dist/{library-request-kY9iTpIF.cjs → library-request-DO3Ec7KE.cjs} +2 -2
  90. package/dist/{library-request-kY9iTpIF.cjs.map → library-request-DO3Ec7KE.cjs.map} +1 -1
  91. package/dist/{lifecycle-DaMdH_X7.cjs → lifecycle-B5yfH5is.cjs} +2 -2
  92. package/dist/{lifecycle-DaMdH_X7.cjs.map → lifecycle-B5yfH5is.cjs.map} +1 -1
  93. package/dist/{lifecycle-B2PlIuQu.js → lifecycle-CMHz2Zbs.js} +2 -2
  94. package/dist/{lifecycle-B2PlIuQu.js.map → lifecycle-CMHz2Zbs.js.map} +1 -1
  95. package/dist/{log-record-DSt2P-Sr.js → log-record-B_nSqxoe.js} +2 -2
  96. package/dist/{log-record-DSt2P-Sr.js.map → log-record-B_nSqxoe.js.map} +1 -1
  97. package/dist/{log-record-Bmx6etMh.cjs → log-record-Bdywwg0k.cjs} +2 -2
  98. package/dist/{log-record-Bmx6etMh.cjs.map → log-record-Bdywwg0k.cjs.map} +1 -1
  99. package/dist/{long-frames-Bamjs1WV.js → long-frames-6NGl1-uN.js} +3 -3
  100. package/dist/{long-frames-Bamjs1WV.js.map → long-frames-6NGl1-uN.js.map} +1 -1
  101. package/dist/{long-frames-lhtONgGt.cjs → long-frames-D9DfSWqv.cjs} +2 -2
  102. package/dist/{long-frames-lhtONgGt.cjs.map → long-frames-D9DfSWqv.cjs.map} +1 -1
  103. package/dist/models/config.d.cts +4 -3
  104. package/dist/models/config.d.ts +4 -3
  105. package/dist/{network-BCn8Gn47.cjs → network-BNHBI0Fc.cjs} +2 -2
  106. package/dist/{network-BCn8Gn47.cjs.map → network-BNHBI0Fc.cjs.map} +1 -1
  107. package/dist/{network-Cg1L2w2r.js → network-Cc3tSB7e.js} +13 -13
  108. package/dist/{network-Cg1L2w2r.js.map → network-Cc3tSB7e.js.map} +1 -1
  109. package/dist/{observed-windows-BrwaJNlj.js → observed-windows-8JtCsIr1.js} +3 -3
  110. package/dist/{observed-windows-BrwaJNlj.js.map → observed-windows-8JtCsIr1.js.map} +1 -1
  111. package/dist/{observed-windows-B3gJkdql.cjs → observed-windows-BlE25nrn.cjs} +2 -2
  112. package/dist/{observed-windows-B3gJkdql.cjs.map → observed-windows-BlE25nrn.cjs.map} +1 -1
  113. package/dist/openfin-Bxelt0yg.js.map +1 -1
  114. package/dist/openfin-DtH2f7zX.cjs.map +1 -1
  115. package/dist/{otlp-D6dRZyB8.js → otlp-Btix3EBa.js} +7 -7
  116. package/dist/{otlp-D6dRZyB8.js.map → otlp-Btix3EBa.js.map} +1 -1
  117. package/dist/{otlp-CrAWkQdO.cjs → otlp-CFSW-Dno.cjs} +2 -2
  118. package/dist/{otlp-CrAWkQdO.cjs.map → otlp-CFSW-Dno.cjs.map} +1 -1
  119. package/dist/patch-DlcKzIi-.cjs +2 -0
  120. package/dist/patch-DlcKzIi-.cjs.map +1 -0
  121. package/dist/patch-Sr1wKg7W.js +9 -0
  122. package/dist/patch-Sr1wKg7W.js.map +1 -0
  123. package/dist/platform-BZjp9wp1.cjs +2 -0
  124. package/dist/platform-BZjp9wp1.cjs.map +1 -0
  125. package/dist/{platform-8DLhjddo.js → platform-Dba6R3Hp.js} +22 -9
  126. package/dist/platform-Dba6R3Hp.js.map +1 -0
  127. package/dist/{profiler-BaXSqCfz.js → profiler-DNKcqu09.js} +19 -19
  128. package/dist/{profiler-BaXSqCfz.js.map → profiler-DNKcqu09.js.map} +1 -1
  129. package/dist/{profiler-BvWW2kNM.cjs → profiler-DpoPi1hH.cjs} +2 -2
  130. package/dist/{profiler-BvWW2kNM.cjs.map → profiler-DpoPi1hH.cjs.map} +1 -1
  131. package/dist/{profiler-frames-DeaBiB-5.cjs → profiler-frames-C9zJNd8_.cjs} +2 -2
  132. package/dist/{profiler-frames-DeaBiB-5.cjs.map → profiler-frames-C9zJNd8_.cjs.map} +1 -1
  133. package/dist/{profiler-frames-C4ySHN0X.js → profiler-frames-CGXZeZ_3.js} +4 -4
  134. package/dist/{profiler-frames-C4ySHN0X.js.map → profiler-frames-CGXZeZ_3.js.map} +1 -1
  135. package/dist/{remote-rules-Dq9xe7Qn.js → remote-rules-DNK96vLa.js} +15 -15
  136. package/dist/{remote-rules-Dq9xe7Qn.js.map → remote-rules-DNK96vLa.js.map} +1 -1
  137. package/dist/{remote-rules-D7L6D_D2.cjs → remote-rules-DuMFRlit.cjs} +2 -2
  138. package/dist/{remote-rules-D7L6D_D2.cjs.map → remote-rules-DuMFRlit.cjs.map} +1 -1
  139. package/dist/replay-Cab-lSit.cjs +2 -0
  140. package/dist/replay-Cab-lSit.cjs.map +1 -0
  141. package/dist/{replay-B0M8kWz_.js → replay-Dy6OiaOZ.js} +89 -62
  142. package/dist/replay-Dy6OiaOZ.js.map +1 -0
  143. package/dist/{reports-ojuMKGO7.cjs → reports-CGK9YQch.cjs} +2 -2
  144. package/dist/{reports-ojuMKGO7.cjs.map → reports-CGK9YQch.cjs.map} +1 -1
  145. package/dist/{reports--8APRLa-.js → reports-CX57-S9s.js} +3 -3
  146. package/dist/{reports--8APRLa-.js.map → reports-CX57-S9s.js.map} +1 -1
  147. package/dist/{resource-timing-BzR05rE-.js → resource-timing-CWVDCbrY.js} +4 -4
  148. package/dist/{resource-timing-BzR05rE-.js.map → resource-timing-CWVDCbrY.js.map} +1 -1
  149. package/dist/{resource-timing-pAG3ZhB5.cjs → resource-timing-DalulXiR.cjs} +2 -2
  150. package/dist/{resource-timing-pAG3ZhB5.cjs.map → resource-timing-DalulXiR.cjs.map} +1 -1
  151. package/dist/response-body-Cpz5__4g.cjs +3 -0
  152. package/dist/response-body-Cpz5__4g.cjs.map +1 -0
  153. package/dist/{response-body-BWvwKQ2p.js → response-body-yi92Rpvo.js} +100 -100
  154. package/dist/response-body-yi92Rpvo.js.map +1 -0
  155. package/dist/{rotation-BylN1B9e.js → rotation-ChBbNDE2.js} +24 -24
  156. package/dist/rotation-ChBbNDE2.js.map +1 -0
  157. package/dist/rotation-fTnNJcfH.cjs +2 -0
  158. package/dist/rotation-fTnNJcfH.cjs.map +1 -0
  159. package/dist/{sampling-zXA6r-Nw.js → sampling-DZTOD28D.js} +6 -6
  160. package/dist/{sampling-zXA6r-Nw.js.map → sampling-DZTOD28D.js.map} +1 -1
  161. package/dist/{sampling-B46LW0cy.cjs → sampling-wAVJIZXp.cjs} +2 -2
  162. package/dist/{sampling-B46LW0cy.cjs.map → sampling-wAVJIZXp.cjs.map} +1 -1
  163. package/dist/{sanitize-DjnR6RXR.js → sanitize-B2GKlSFp.js} +2 -2
  164. package/dist/{sanitize-DjnR6RXR.js.map → sanitize-B2GKlSFp.js.map} +1 -1
  165. package/dist/{sanitize-Qj6LuZqp.cjs → sanitize-BZdhoghq.cjs} +2 -2
  166. package/dist/{sanitize-Qj6LuZqp.cjs.map → sanitize-BZdhoghq.cjs.map} +1 -1
  167. package/dist/{sender-Bdp-TAS4.js → sender-BRSpc7R8.js} +175 -161
  168. package/dist/sender-BRSpc7R8.js.map +1 -0
  169. package/dist/sender-CFu98DAB.cjs +2 -0
  170. package/dist/sender-CFu98DAB.cjs.map +1 -0
  171. package/dist/storage/emergency-queue.d.cts +3 -1
  172. package/dist/storage/emergency-queue.d.ts +3 -1
  173. package/dist/storage/stored-context.d.cts +3 -2
  174. package/dist/storage/stored-context.d.ts +3 -2
  175. package/dist/stored-context-CPLlzgpm.cjs +2 -0
  176. package/dist/stored-context-CPLlzgpm.cjs.map +1 -0
  177. package/dist/{stored-context-CSttrAsw.js → stored-context-df1dEnht.js} +10 -8
  178. package/dist/stored-context-df1dEnht.js.map +1 -0
  179. package/dist/{storm-DKlpv0FL.js → storm-U3_ek1nA.js} +2 -2
  180. package/dist/{storm-DKlpv0FL.js.map → storm-U3_ek1nA.js.map} +1 -1
  181. package/dist/{storm-BHgI12iS.cjs → storm-qiE_AMC7.cjs} +2 -2
  182. package/dist/{storm-BHgI12iS.cjs.map → storm-qiE_AMC7.cjs.map} +1 -1
  183. package/dist/transport/exit-flush.d.cts +23 -0
  184. package/dist/transport/exit-flush.d.ts +23 -0
  185. package/dist/transport/http-transport.d.cts +3 -2
  186. package/dist/transport/http-transport.d.ts +3 -2
  187. package/dist/transport/retry-engine.d.cts +11 -3
  188. package/dist/transport/retry-engine.d.ts +11 -3
  189. package/dist/types-BAerHgCq.js.map +1 -1
  190. package/dist/types-C7WNpnG1.cjs.map +1 -1
  191. package/dist/{unclean-exit-BcOB8A2e.js → unclean-exit-Bj6gYHeL.js} +2 -2
  192. package/dist/{unclean-exit-BcOB8A2e.js.map → unclean-exit-Bj6gYHeL.js.map} +1 -1
  193. package/dist/{unclean-exit-BYPYYkQ5.cjs → unclean-exit-CuBh-ee5.cjs} +2 -2
  194. package/dist/{unclean-exit-BYPYYkQ5.cjs.map → unclean-exit-CuBh-ee5.cjs.map} +1 -1
  195. package/dist/{user-timing-BsU2wQKE.cjs → user-timing-BWqzYF2Q.cjs} +2 -2
  196. package/dist/{user-timing-BsU2wQKE.cjs.map → user-timing-BWqzYF2Q.cjs.map} +1 -1
  197. package/dist/{user-timing-4KIJ74Vi.js → user-timing-Duz0d-OA.js} +2 -2
  198. package/dist/{user-timing-4KIJ74Vi.js.map → user-timing-Duz0d-OA.js.map} +1 -1
  199. package/dist/utils/lock.d.cts +3 -2
  200. package/dist/utils/lock.d.ts +3 -2
  201. package/dist/utils/openfin.d.cts +18 -6
  202. package/dist/utils/openfin.d.ts +18 -6
  203. package/dist/utils/patch.d.cts +1 -1
  204. package/dist/utils/patch.d.ts +1 -1
  205. package/dist/utils/platform.d.cts +6 -0
  206. package/dist/utils/platform.d.ts +6 -0
  207. package/dist/{web-socket-Zg0hj1LB.js → web-socket-CE_9Q22z.js} +5 -5
  208. package/dist/{web-socket-Zg0hj1LB.js.map → web-socket-CE_9Q22z.js.map} +1 -1
  209. package/dist/{web-socket-Cs1ZbmmN.cjs → web-socket-sm3rD-A_.cjs} +2 -2
  210. package/dist/{web-socket-Cs1ZbmmN.cjs.map → web-socket-sm3rD-A_.cjs.map} +1 -1
  211. package/dist/{web-vitals-4pWACwaR.js → web-vitals-CGwXGF-M.js} +4 -4
  212. package/dist/web-vitals-CGwXGF-M.js.map +1 -0
  213. package/dist/web-vitals-Df4Wsfx9.cjs +2 -0
  214. package/dist/web-vitals-Df4Wsfx9.cjs.map +1 -0
  215. package/dist/{worker-protocol-DFYXIFus.cjs → worker-protocol-D5VnCdWY.cjs} +2 -2
  216. package/dist/{worker-protocol-DFYXIFus.cjs.map → worker-protocol-D5VnCdWY.cjs.map} +1 -1
  217. package/dist/{worker-protocol-CYpAbrVl.js → worker-protocol-h4-tRWqy.js} +6 -6
  218. package/dist/{worker-protocol-CYpAbrVl.js.map → worker-protocol-h4-tRWqy.js.map} +1 -1
  219. package/dist/{worker-server--yGTadTA.cjs → worker-server-CF1yatXq.cjs} +2 -2
  220. package/dist/{worker-server--yGTadTA.cjs.map → worker-server-CF1yatXq.cjs.map} +1 -1
  221. package/dist/worker-server-FYfKHQhJ.js +94 -0
  222. package/dist/{worker-server-BokySIII.js.map → worker-server-FYfKHQhJ.js.map} +1 -1
  223. package/dist/{worker-transport-BdEvh_-a.cjs → worker-transport-COgY4RX8.cjs} +2 -2
  224. package/dist/{worker-transport-BdEvh_-a.cjs.map → worker-transport-COgY4RX8.cjs.map} +1 -1
  225. package/dist/{worker-transport-JK-Fby9J.js → worker-transport-jzX1IusG.js} +34 -34
  226. package/dist/{worker-transport-JK-Fby9J.js.map → worker-transport-jzX1IusG.js.map} +1 -1
  227. package/llms.txt +1 -2
  228. package/package.json +1 -1
  229. package/dist/bus-B__467mL.cjs +0 -2
  230. package/dist/bus-B__467mL.cjs.map +0 -1
  231. package/dist/bus-dw7T92sO.js.map +0 -1
  232. package/dist/config-CSNcS7OZ.js.map +0 -1
  233. package/dist/config-CybPP5VM.cjs +0 -2
  234. package/dist/config-CybPP5VM.cjs.map +0 -1
  235. package/dist/constants-BwJDXzj6.js.map +0 -1
  236. package/dist/constants-CtF52hIV.cjs +0 -2
  237. package/dist/constants-CtF52hIV.cjs.map +0 -1
  238. package/dist/errors-DP2RUm4V.cjs +0 -3
  239. package/dist/errors-DP2RUm4V.cjs.map +0 -1
  240. package/dist/errors-Q3Ng1ciC.js.map +0 -1
  241. package/dist/factory-DV17sm2p.js.map +0 -1
  242. package/dist/factory-K8O6gpux.cjs +0 -2
  243. package/dist/factory-K8O6gpux.cjs.map +0 -1
  244. package/dist/interactions-Byxf1C82.js.map +0 -1
  245. package/dist/interactions-OK85T-Dk.cjs.map +0 -1
  246. package/dist/patch-BX8KrPCT.cjs +0 -2
  247. package/dist/patch-BX8KrPCT.cjs.map +0 -1
  248. package/dist/patch-UdPz1ea8.js +0 -8
  249. package/dist/patch-UdPz1ea8.js.map +0 -1
  250. package/dist/platform-8DLhjddo.js.map +0 -1
  251. package/dist/platform-BqRc-7RO.cjs +0 -2
  252. package/dist/platform-BqRc-7RO.cjs.map +0 -1
  253. package/dist/replay-B0M8kWz_.js.map +0 -1
  254. package/dist/replay-QOFBpAXh.cjs +0 -2
  255. package/dist/replay-QOFBpAXh.cjs.map +0 -1
  256. package/dist/response-body-BWvwKQ2p.js.map +0 -1
  257. package/dist/response-body-CKEJ5itk.cjs +0 -3
  258. package/dist/response-body-CKEJ5itk.cjs.map +0 -1
  259. package/dist/rotation-BylN1B9e.js.map +0 -1
  260. package/dist/rotation-E2eKClIs.cjs +0 -2
  261. package/dist/rotation-E2eKClIs.cjs.map +0 -1
  262. package/dist/sender-Bdp-TAS4.js.map +0 -1
  263. package/dist/sender-DR7ZycZY.cjs +0 -2
  264. package/dist/sender-DR7ZycZY.cjs.map +0 -1
  265. package/dist/stored-context-BOu54M8Y.cjs +0 -2
  266. package/dist/stored-context-BOu54M8Y.cjs.map +0 -1
  267. package/dist/stored-context-CSttrAsw.js.map +0 -1
  268. package/dist/web-vitals-4pWACwaR.js.map +0 -1
  269. package/dist/web-vitals-__X7t4pj.cjs +0 -2
  270. package/dist/web-vitals-__X7t4pj.cjs.map +0 -1
  271. package/dist/worker-server-BokySIII.js +0 -94
@@ -0,0 +1 @@
1
+ {"version":3,"file":"config-DK1Zf7jn.js","names":["PROFILER_PROBE_LIMIT","LEVEL_ORDER","BEACON_LIMIT_BYTES","DEFAULT_CONFIG","CONFIG_SECTIONS","CONSOLE_DEFAULT_LEVEL","CONSOLE_DEFAULT_STYLES","REMOTE_CAPTURE_FLAGS","UNKNOWN_SERVICE_NAME","UNDEFAULTED_SECTION_KEYS","UNDEFAULTED_CONFIG_KEYS","SERIALIZER_NAME_OTLP","isObject","hasOwn","pageBase","LEVEL_NAMES","COMPRESSION_VALUES","CREDENTIALS_VALUES","STORAGE_VALUES","IDENTITY_VALUES","BUS_MODE_VALUES","OPENFIN_ROLE_VALUES","JOURNEY_SCOPE_VALUES","CONSOLE_METHOD_VALUES","LOG_TYPE_VALUES","BATCHING_RANGES","MAX_BATCHES_RANGE","RETENTION_AGE_RANGE","RETENTION_ATTEMPTS_RANGE","LIMIT_RANGES","JOURNEY_AGE_RANGE","DURATION_RANGE","POSITIVE_DURATION_RANGE","COUNT_RANGE","POSITIVE_RANGE","CLICK_WAIT_RANGE","isStrings","value","entry","isFunctions","isFunctionOrNull","isNull","SCHEME_PATTERN","isRate","HOOK_EXPECTED","URL_EXPECTED","isHeaders","isRecord","keepKind","describeValue","fallback","test","reportInvalid","diagnostics","key","expected","describe","absoluteUrl","url","error","current","resolveDestination","describeKind","resolveEndpoint","POLICY_RULES","resolveDiagnosticRecords","CAPTURE_FLAG_KEYS","SANDBOX_ORIGIN","LEVEL_EXPECTED","listOf","CONSOLE_LEVELS_EXPECTED","PATTERN_LIST_EXPECTED","TARGET_LIST_EXPECTED","ORIGIN_LIST_EXPECTED","LOG_TYPE_LIST_EXPECTED","DIAGNOSTIC_RECORDS_EXPECTED","quoted","values","kept","resolveChoice","match","accepted","resolveBoolean","resolveNonNegative","resolveInteger","min","max","range","resolveLimit","resolveHook","REFUSE_RECORDS","resolveRedact","resolveProcessors","resolveString","resolveRate","resolveRates","rates","ns","rate","resolveRanges","given","input","keys","ranges","section","base","toLevel","upper","level","resolveLevel","resolveMinLevels","levels","prefix","raw","resolveList","entries","accept","toPlugin","toStringEntry","toLogType","type","toPattern","toConsoleMethod","method","toOrigin","origin","toTarget","isStringRecord","resolveHeaders","isSerializer","resolveSerializer","requested","previous","CONSOLE_STYLE_KEYS","validStyles","valid","styles","resolveConsoleLevel","resolveConsole","resolveSampling","resolveBus","resolveJourney","resolveRetention","resolveCaptureOptions","resolved","fields","name","resolveCapture","capture","resolveInteractions","parsesSelector","selector","ignore","ignoreSelector","actionAttribute","deadClickIgnoreSelector","live","resolvePolicy","next","rules","limit","choice","custom","checkSections","checked","reportIneffective","config","noEffect","condition","sampling","requests","resolveConfig","policies","merged","reportUnknownKeys","known","sectionKeys","applyResolvedConfig","target"],"sources":["../src/core/config.ts"],"sourcesContent":["// src/core/config.ts\n//\n// Resolves partial consumer options into a validated config, and updates the live config.\n// Three rules to follow here, because breaking any one fails silently:\n// 1. Merge a reconfigure onto the current config, not onto the defaults.\n// 2. Change the resolved object in place, never replace it. Subsystems keep the\n// reference they got at construction.\n// 3. An omitted key or undefined keeps the current value at every depth. Only null clears a\n// hook or lifts a limit, so an unset variable can't remove redact.\n// A getter in the app's input can throw here. ObservabilityRuntime.configure() catches it, so\n// configure() never throws into the app.\n\nimport {\n ACTION_ATTRIBUTE_DEFAULT,\n BEACON_LIMIT_BYTES,\n CONFIG_SECTIONS,\n CONSOLE_DEFAULT_LEVEL,\n CONSOLE_DEFAULT_STYLES,\n DEAD_CLICK_IGNORE_SELECTOR,\n DEAD_CLICK_MS,\n DEFAULT_CONFIG,\n HOLD_BUFFER_HEAD_RECORDS,\n LEVEL_ORDER,\n LONG_FRAME_THRESHOLD_MS,\n PROFILER_PROBE_LIMIT,\n REMOTE_CAPTURE_FLAGS,\n RESOURCE_SLOW_MS,\n RAGE_CLICK_COUNT,\n RAGE_CLICK_WINDOW_MS,\n SAMPLING_RATE_MAX,\n SAMPLING_RATE_MIN,\n SERIALIZER_NAME_ECS,\n SERIALIZER_NAME_OTLP,\n UNDEFAULTED_CONFIG_KEYS,\n UNDEFAULTED_SECTION_KEYS,\n UNKNOWN_SERVICE_NAME,\n} from \"../constants\";\nimport type {\n BatchingOptions,\n BusOptions,\n CaptureOptions,\n CapturedConsoleMethod,\n ConsoleStyles,\n InteractionOptions,\n JourneyOptions,\n LimitsOptions,\n ObservabilityConfig,\n ResolvedConfig,\n ResolvedConsole,\n RetentionOptions,\n SamplingOptions,\n SerializerChoice,\n} from \"../models/config\";\nimport type { LogLevel, LogType } from \"../models/log-record\";\nimport type { CapturePlugin } from \"../models/plugin\";\nimport type { LogSerializer } from \"../models/serializer\";\nimport { hasOwn, isObject } from \"../utils/guards\";\nimport { pageBase } from \"../utils/platform\";\nimport type { Diagnostics } from \"./diagnostics\";\n\n/** Level names in severity order. */\nconst LEVEL_NAMES = Object.keys(LEVEL_ORDER) as readonly LogLevel[];\n\n/** Accepted values for each choice option. */\nconst COMPRESSION_VALUES = [\"gzip\", \"none\"] as const;\nconst CREDENTIALS_VALUES = [\"omit\", \"same-origin\", \"include\"] as const;\nconst STORAGE_VALUES = [\"auto\", \"indexeddb\", \"localstorage\", \"memory\", \"none\"] as const;\nconst IDENTITY_VALUES = [\"storage\", \"memory\"] as const;\nconst BUS_MODE_VALUES = [\"auto\", \"sender\", \"forwarder\", \"off\"] as const;\nconst OPENFIN_ROLE_VALUES = [\"auto\", \"provider\", \"client\"] as const;\nconst JOURNEY_SCOPE_VALUES = [\"auto\", \"context\", \"tab\", \"origin\"] as const;\nconst CONSOLE_METHOD_VALUES = [\"error\", \"warn\", \"info\", \"log\"] as const;\nconst LOG_TYPE_VALUES: readonly LogType[] = [\"action\", \"event\", \"metric\", \"log\", \"system\", \"span\"];\n\n/** Lowest and highest value an integer option accepts. */\ntype Range = readonly [min: number, max: number];\n\n/** Accepted range for each batching key. */\nconst BATCHING_RANGES: Record<keyof BatchingOptions, Range> = {\n logFlushIntervalMs: [100, 60_000],\n logBatchSize: [1, 1000],\n metricBatchSize: [1, 1000],\n};\n\n/** Accepted range for retention.maxBatches. */\nconst MAX_BATCHES_RANGE: Range = [1, 5000];\n\n/** Accepted range for retention.maxAgeMs. null lifts the age limit. */\nconst RETENTION_AGE_RANGE: Range = [60_000, 7 * 24 * 60 * 60 * 1000];\n\n/** Accepted range for retention.maxAttempts. null lifts the attempt limit. */\nconst RETENTION_ATTEMPTS_RANGE: Range = [1, 20];\n\n/**\n * Accepted range for each record limit. maxRecordBytes tops out at one beacon, and the body\n * and error fields don't count toward it. An exit batch larger than one beacon goes to the\n * emergency queue.\n */\nconst LIMIT_RANGES: Record<keyof LimitsOptions, Range> = {\n maxBodyChars: [256, 65_536],\n maxAttributeChars: [256, 65_536],\n maxAttributeCount: [1, 1024],\n maxStackChars: [256, 65_536],\n maxDepth: [1, 16],\n maxArrayLength: [1, 10_000],\n maxNodes: [100, 100_000],\n maxRecordBytes: [1024, BEACON_LIMIT_BYTES],\n};\n\n/** Accepted range for journey.maxAgeMs. */\nconst JOURNEY_AGE_RANGE: Range = [60_000, 24 * 60 * 60 * 1000];\n\n/** Range for a duration. The maximum is the largest delay a browser timer accepts. */\nconst DURATION_RANGE: Range = [0, 2_147_483_647];\n\n/** Range for a duration that must be at least 1 ms, because 0 would expire at once. */\nconst POSITIVE_DURATION_RANGE: Range = [1, DURATION_RANGE[1]];\n\n/** Range for a count. Zero allows nothing. */\nconst COUNT_RANGE: Range = [0, Number.MAX_SAFE_INTEGER];\n\n/** Range for a count that must be at least 1. */\nconst POSITIVE_RANGE: Range = [1, Number.MAX_SAFE_INTEGER];\n\n/** Range for the rage click and dead click detection waits. */\nconst CLICK_WAIT_RANGE: Range = [100, 10_000];\n\n/** The keys of a policy section whose values are numbers. */\ntype NumberKeys<T> = { [K in keyof T]: T[K] extends number ? K : never }[keyof T];\n\n/** The keys of a policy section that take a number, or null for no limit. */\ntype LimitKeys<T> = {\n [K in keyof T]: T[K] extends number | null ? (null extends T[K] ? K : never) : never;\n}[keyof T];\n\n/** The policy sections resolvePolicy() checks. */\ntype PolicySection =\n | \"captureLimits\"\n | \"metadata\"\n | \"storage\"\n | \"diagnostics\"\n | \"correlation\"\n | \"metrics\"\n | \"buffering\"\n | \"delivery\"\n | \"debugBuffer\"\n | \"profiler\"\n | \"replay\";\n\n/**\n * Reads one policy key the generic checks can't handle, for example a list.\n * @param key Full config key for the diagnostic message.\n * @param value The value the consumer passed.\n * @param fallback The current value.\n * @param diagnostics Diagnostics reporter.\n * @returns The value to use.\n */\ntype CustomResolver = (\n key: string,\n value: unknown,\n fallback: unknown,\n diagnostics: Diagnostics,\n) => unknown;\n\n/** True for an array of strings. */\nconst isStrings = (value: unknown): boolean =>\n Array.isArray(value) && value.every((entry) => typeof entry === \"string\");\n\n/** True for an array of functions. */\nconst isFunctions = (value: unknown): boolean =>\n Array.isArray(value) && value.every((entry) => typeof entry === \"function\");\n\n/** True for a function or null. */\nconst isFunctionOrNull = (value: unknown): boolean => value === null || typeof value === \"function\";\n\n/** True for null. */\nconst isNull = (value: unknown): boolean => value === null;\n\n/** Matches a URL that names its scheme, for example \"https:\". A relative URL has none. */\nconst SCHEME_PATTERN = /^[a-z][a-z\\d+.-]*:/i;\n\n/** True for a sampling rate from 0 to 1. NaN fails both comparisons, so it's rejected too. */\nconst isRate = (value: unknown): value is number =>\n typeof value === \"number\" && value >= SAMPLING_RATE_MIN && value <= SAMPLING_RATE_MAX;\n\n/** How a hook value and a URL value read in a config.invalid message. */\nconst HOOK_EXPECTED = \"a function or null\";\nconst URL_EXPECTED = \"a URL string or null\";\n\n/** True for request headers: an object of strings, a function, or null. */\nconst isHeaders = (value: unknown): boolean =>\n isFunctionOrNull(value) ||\n (isRecord(value) && Object.values(value as object).every((entry) => typeof entry === \"string\"));\n\n/** True for an object that isn't an array. */\nconst isRecord = (value: unknown): boolean =>\n typeof value === \"object\" && value !== null && !Array.isArray(value);\n\n/**\n * Builds the resolver for a key whose value isn't a number, a boolean or a string.\n * @param test Checks the value.\n * @param expected What the report says was expected.\n * @param describe Describes a rejected value. A key whose text can hold a secret passes\n * describeKind.\n * @returns The resolver. A value that fails the test is ignored, and the current one stays.\n */\nfunction keepKind(\n test: (value: unknown) => boolean,\n expected: string,\n describe: (value: unknown) => string = describeValue,\n): CustomResolver {\n return (key, value, fallback, diagnostics) => {\n if (value === undefined) {\n return fallback;\n }\n\n // null is a valid value for some keys, and it replaces the current value.\n if (test(value)) {\n return value;\n }\n\n reportInvalid(diagnostics, key, expected, value, \"the current value\", describe);\n return fallback;\n };\n}\n\n/**\n * Checks a destination URL and returns the form the library sends to. A relative URL resolves\n * against the page, so the records go where the app's own requests go, and the report names\n * that origin. A URL with a user name or a password is refused, because each request would\n * carry it.\n * @param key Config key.\n * @param value The URL the consumer passed.\n * @param fallback The current destination.\n * @param diagnostics Diagnostics reporter.\n * @param current The URL the runtime sends to now, if any.\n * @returns The URL, its absolute form for a relative URL, or the fallback for a refused URL.\n */\nfunction absoluteUrl(\n key: string,\n value: string,\n fallback: unknown,\n diagnostics: Diagnostics,\n current: unknown,\n): unknown {\n let url: URL;\n try {\n url = new URL(value, pageBase());\n } catch (error) {\n // The URL can hold a token, and this message can become a record.\n diagnostics.report(\n \"config.invalid\",\n `${key} is not a valid URL. The library keeps the current value.`,\n undefined,\n error,\n );\n return fallback;\n }\n\n if (url.username !== \"\" || url.password !== \"\") {\n diagnostics.report(\n \"config.invalid\",\n `${key} has a user name or a password. The library keeps the current value.`,\n );\n return fallback;\n }\n\n if (SCHEME_PATTERN.test(value)) {\n return value;\n }\n\n // A later call or a rotation often repeats the same relative URL, so only a new destination\n // reports. Otherwise every call warns again about a URL the app already saw reported.\n if (url.href !== current) {\n diagnostics.report(\"config.invalid\", `${key} is relative. The library sends to ${url.origin}.`);\n }\n\n return url.href;\n}\n\n/**\n * Reads a destination that null turns off. An empty or blank string turns it off too, with a\n * report, because an empty environment variable must not leave the records going to the old\n * destination. A rotation runs it too, to find a refused URL.\n * @param key Config key.\n * @param value The value the consumer passed.\n * @param fallback The current destination.\n * @param diagnostics Diagnostics reporter.\n * @param current The URL the runtime sends to now. A relative URL that resolves to it isn't\n * reported again.\n * @returns The URL, null when it's off, or the fallback for a refused value.\n */\nexport function resolveDestination(\n key: string,\n value: unknown,\n fallback: unknown,\n diagnostics: Diagnostics,\n current?: unknown,\n): unknown {\n if (typeof value !== \"string\") {\n return keepKind(isNull, URL_EXPECTED, describeKind)(key, value, fallback, diagnostics);\n }\n\n if (value.trim() === \"\") {\n diagnostics.report(\n \"config.invalid\",\n `${key} is empty. The library turns it off. Use null to turn it off.`,\n );\n return null;\n }\n\n // The current value passed the check already, so it gets no second report.\n return value === fallback ? value : absoluteUrl(key, value, fallback, diagnostics, current);\n}\n\n/**\n * Reads the endpoint. \"\" stays \"\", the value for \"not set\", so resolveConfig reports a missing\n * endpoint. A blank string is refused, because it would send to the page itself. A rotation\n * runs it too, to find a refused URL.\n * @param value The value the consumer passed.\n * @param fallback The current endpoint.\n * @param diagnostics Diagnostics reporter.\n * @param current The URL the runtime sends to now. A relative URL that resolves to it isn't\n * reported again.\n * @returns The endpoint, null for console-only mode, or the fallback for a refused value.\n */\nexport function resolveEndpoint(\n value: unknown,\n fallback: unknown,\n diagnostics: Diagnostics,\n current?: unknown,\n): unknown {\n if (typeof value !== \"string\") {\n return keepKind(isNull, URL_EXPECTED, describeKind)(\"endpoint\", value, fallback, diagnostics);\n }\n\n if (value === \"\" || value === fallback) {\n return value;\n }\n\n if (value.trim() === \"\") {\n diagnostics.report(\"config.invalid\", \"endpoint is blank. The library keeps the current value.\");\n return fallback;\n }\n\n return absoluteUrl(\"endpoint\", value, fallback, diagnostics, current);\n}\n\n/** Rules for one policy section. Every number key must have a range. */\ninterface PolicyRules<T> {\n /** Accepted range for each number key. */\n ranges: Record<NumberKeys<T>, Range>;\n /** Accepted range for each key that also takes null, which means no limit. */\n limits: Record<LimitKeys<T>, Range>;\n /** Accepted values for each choice key. */\n choices?: Partial<Record<keyof T, readonly string[]>>;\n /** Resolver for each key with any other value type. */\n custom?: Partial<Record<keyof T, CustomResolver>>;\n}\n\n/** Rules for every policy section. A new number key without a range won't compile. */\nconst POLICY_RULES: { [K in PolicySection]: PolicyRules<ResolvedConfig[K]> } = {\n captureLimits: {\n ranges: {\n // A larger capacity fails as an invalid array allocation.\n breadcrumbs: [0, 1_000_000],\n errorDedupeMs: DURATION_RANGE,\n // A window of 0 ms starts a new window for every event, so no rate limit would apply.\n windowMs: POSITIVE_DURATION_RANGE,\n },\n limits: {\n errorsPerWindow: COUNT_RANGE,\n consolePerWindow: COUNT_RANGE,\n longFramesPerWindow: COUNT_RANGE,\n webSocketPerWindow: COUNT_RANGE,\n reportsPerWindow: COUNT_RANGE,\n resourcesPerWindow: COUNT_RANGE,\n lifecyclePerWindow: COUNT_RANGE,\n },\n },\n metadata: { ranges: {}, limits: {} },\n storage: { ranges: {}, limits: {}, choices: { backend: STORAGE_VALUES } },\n diagnostics: {\n ranges: { throttleMs: DURATION_RANGE },\n limits: {},\n custom: { records: resolveDiagnosticRecords },\n },\n correlation: {\n ranges: {},\n // 0 would end a session or a trace at once, so these start at 1, and null lifts them.\n limits: { sessionIdleMs: POSITIVE_DURATION_RANGE, traceMaxAgeMs: POSITIVE_DURATION_RANGE },\n },\n metrics: {\n ranges: { intervalMs: [1000, 600_000] },\n limits: {\n maxSeries: COUNT_RANGE,\n maxInstruments: COUNT_RANGE,\n maxHistogramBoundaries: COUNT_RANGE,\n },\n },\n buffering: {\n ranges: {\n // Two heads at least, or a full buffer keeps its first records but too few of the newest.\n // The maximum bounds the memory of a startup storm.\n maxHeldRecords: [2 * HOLD_BUFFER_HEAD_RECORDS, 10_000],\n },\n // A buffer that holds nothing would drop every record, so these start at 1.\n limits: { maxPendingRecords: POSITIVE_RANGE, maxPendingBytes: POSITIVE_RANGE },\n choices: { overflow: [\"drop-oldest\", \"drop-newest\", \"persist\"] },\n },\n delivery: {\n ranges: {\n requestTimeoutMs: [1, DURATION_RANGE[1]],\n maxConcurrentRequests: POSITIVE_RANGE,\n retryBaseDelayMs: DURATION_RANGE,\n retryMaxDelayMs: DURATION_RANGE,\n },\n limits: {},\n choices: { priority: [\"low\", \"auto\", \"high\"] },\n },\n debugBuffer: {\n ranges: { maxRecords: [1, 10_000] },\n limits: { maxAgeMs: POSITIVE_DURATION_RANGE },\n },\n profiler: {\n ranges: { maxProbes: [1, PROFILER_PROBE_LIMIT] },\n limits: {},\n },\n replay: {\n ranges: {\n bufferMs: [5000, 600_000],\n maxBufferBytes: [100_000, 200_000_000],\n afterErrorMs: [0, 600_000],\n // A window of 0 ms starts a new window for every upload, so the limit would never apply.\n uploadWindowMs: POSITIVE_DURATION_RANGE,\n maxSegmentEvents: [1, 10_000],\n maxSegmentBytes: [10_000, 10_000_000],\n flushIntervalMs: [100, 60_000],\n maxQueueBytes: [100_000, 200_000_000],\n maxAttempts: [1, 10],\n },\n limits: { uploadsPerWindow: COUNT_RANGE },\n choices: { mode: [\"onError\"] },\n custom: {\n endpoint: resolveDestination,\n maskSelectors: keepKind(isStrings, \"a list of strings\"),\n blockSelectors: keepKind(isStrings, \"a list of strings\"),\n loader: keepKind(isFunctionOrNull, HOOK_EXPECTED, describeKind),\n onSegment: keepKind(isFunctionOrNull, HOOK_EXPECTED, describeKind),\n // A string can be a token, so the report gives only the type.\n headers: keepKind(isHeaders, \"an object of strings, a function or null\", describeKind),\n plugins: keepKind(isFunctions, \"a list of functions\"),\n recordOptions: keepKind(isRecord, \"an object\"),\n },\n },\n};\n\n/** The boolean keys of the capture section. */\nconst CAPTURE_FLAG_KEYS = [\n \"errors\",\n \"rejections\",\n \"resourceErrors\",\n \"fetch\",\n \"xhr\",\n \"httpMetrics\",\n \"navigation\",\n \"fullUrls\",\n \"webSocket\",\n \"uncleanExit\",\n \"serverTiming\",\n \"reports\",\n \"lifecycle\",\n] as const;\n\n/** The origin of a sandboxed frame that lacks allow-same-origin. */\nconst SANDBOX_ORIGIN = \"null\";\n\n/** How each expected value reads in a config.invalid message. */\nconst LEVEL_EXPECTED = `a level name: ${listOf(LEVEL_NAMES)}`;\nconst CONSOLE_LEVELS_EXPECTED = `a list of ${listOf(CONSOLE_METHOD_VALUES)}`;\nconst PATTERN_LIST_EXPECTED = \"a list of strings and RegExp patterns\";\nconst TARGET_LIST_EXPECTED =\n 'a list of origin URLs such as \"https://api.example\" and RegExp patterns';\nconst ORIGIN_LIST_EXPECTED =\n 'a list of origin URLs such as \"https://app.example\". For a sandboxed frame, set bus.mode: \"sender\" in the frame';\nconst LOG_TYPE_LIST_EXPECTED = `a list of log types: ${listOf(LOG_TYPE_VALUES)}`;\nconst DIAGNOSTIC_RECORDS_EXPECTED = \"true, false or a list of diagnostic codes\";\n\n/** Function form of the headers option. */\ntype HeadersFunction = () => Record<string, string> | Promise<Record<string, string>>;\n\n/** The headers option, after null has removed it. */\ntype HeadersOption = NonNullable<ObservabilityConfig[\"headers\"]> | undefined;\n\n/**\n * Formats a list of values as text, for example `\"a\", \"b\" or \"c\"`.\n * @param values Values to list.\n * @returns The text.\n */\nfunction listOf(values: readonly string[]): string {\n const quoted = values.map((value) => `\"${value}\"`);\n return `${quoted.slice(0, -1).join(\", \")} or ${quoted[quoted.length - 1]}`;\n}\n\n/**\n * Describes a config value for a message. Never prints an object or a function.\n * @param value The value the consumer passed.\n * @returns Short text for the value.\n */\nfunction describeValue(value: unknown): string {\n if (typeof value === \"string\") {\n return `\"${value}\"`;\n }\n\n if (typeof value === \"function\") {\n return \"a function\";\n }\n\n if (typeof value === \"object\" && value !== null) {\n return \"an object\";\n }\n\n return String(value);\n}\n\n/**\n * Describes only the type of a value. A hook or a URL key can hold a token as a string, and\n * a diagnostic can become a record, so its text must not appear.\n * @param value The value the consumer passed.\n * @returns The type, for example \"a string\".\n */\nfunction describeKind(value: unknown): string {\n if (value === null) {\n return \"null\";\n }\n\n if (Array.isArray(value)) {\n return \"a list\";\n }\n\n return typeof value === \"object\" ? \"an object\" : `a ${typeof value}`;\n}\n\n/**\n * Reports a value the option doesn't accept.\n * @param diagnostics Diagnostics reporter.\n * @param key Config key, for example `bus.mode`.\n * @param expected Describes the accepted values.\n * @param value The value the consumer passed.\n * @param kept Describes the value that stays in effect.\n * @param describe Describes the value. A key whose text can hold a secret passes describeKind.\n */\nfunction reportInvalid(\n diagnostics: Diagnostics,\n key: string,\n expected: string,\n value: unknown,\n kept: string,\n describe: (value: unknown) => string = describeValue,\n): void {\n diagnostics.report(\n \"config.invalid\",\n `${key} must be ${expected}. The value is ${describe(value)}. The library keeps ${kept}.`,\n );\n}\n\n/**\n * Reads an option that takes one value from a fixed list.\n * @param key Config key.\n * @param value The value the consumer passed.\n * @param accepted Accepted values.\n * @param fallback The current value.\n * @param diagnostics Diagnostics reporter.\n * @returns The value, or the fallback when the value isn't accepted.\n */\nfunction resolveChoice<T extends string>(\n key: string,\n value: unknown,\n accepted: readonly T[],\n fallback: T,\n diagnostics: Diagnostics,\n): T {\n if (value === undefined) {\n return fallback;\n }\n\n const match = accepted.find((entry) => entry === value);\n if (match !== undefined) {\n return match;\n }\n\n // The value isn't printed, because a string can be a token put into the wrong key.\n diagnostics.report(\n \"config.invalid\",\n `${key} must be ${listOf(accepted)}. The library keeps \"${fallback}\".`,\n );\n return fallback;\n}\n\n/**\n * Reads a boolean option.\n * @param key Config key.\n * @param value The value the consumer passed.\n * @param fallback The current value.\n * @param diagnostics Diagnostics reporter.\n * @returns The value, or the fallback when the value isn't a boolean.\n */\nfunction resolveBoolean(\n key: string,\n value: unknown,\n fallback: boolean,\n diagnostics: Diagnostics,\n): boolean {\n if (value === undefined) {\n return fallback;\n }\n\n if (typeof value === \"boolean\") {\n return value;\n }\n\n reportInvalid(diagnostics, key, \"true or false\", value, String(fallback));\n return fallback;\n}\n\n/**\n * Reads an option that takes a finite number, 0 or more.\n * @param key Config key.\n * @param value The value the consumer passed.\n * @param fallback The current value.\n * @param diagnostics Diagnostics reporter.\n * @returns The value, or the fallback when the value isn't accepted.\n */\nfunction resolveNonNegative(\n key: string,\n value: unknown,\n fallback: number,\n diagnostics: Diagnostics,\n): number {\n if (value === undefined) {\n return fallback;\n }\n\n if (typeof value === \"number\" && Number.isFinite(value) && value >= 0) {\n return value;\n }\n\n reportInvalid(diagnostics, key, \"a finite number of 0 or more\", value, String(fallback));\n return fallback;\n}\n\n/**\n * Reads an option that takes an integer in a range.\n * @param key Config key.\n * @param value The value the consumer passed.\n * @param range Lowest and highest accepted value.\n * @param fallback The current value.\n * @param diagnostics Diagnostics reporter.\n * @returns The value, or the fallback when the value isn't accepted.\n */\nfunction resolveInteger(\n key: string,\n value: unknown,\n range: Range,\n fallback: number,\n diagnostics: Diagnostics,\n): number {\n if (value === undefined) {\n return fallback;\n }\n\n const [min, max] = range;\n if (typeof value === \"number\" && Number.isInteger(value) && value >= min && value <= max) {\n return value;\n }\n\n const expected = `an integer from ${String(min)} to ${String(max)}`;\n reportInvalid(diagnostics, key, expected, value, String(fallback));\n return fallback;\n}\n\n/**\n * Reads a limit that takes an integer in a range, or null for no limit.\n * @param key Config key.\n * @param value The value the consumer passed.\n * @param range Lowest and highest accepted value.\n * @param fallback The current limit. Null means no limit.\n * @param diagnostics Diagnostics reporter.\n * @returns The limit, or the fallback when the value isn't accepted.\n */\nfunction resolveLimit(\n key: string,\n value: unknown,\n range: Range,\n fallback: number | null,\n diagnostics: Diagnostics,\n): number | null {\n if (value === undefined) {\n return fallback;\n }\n\n if (value === null) {\n return null;\n }\n\n const [min, max] = range;\n if (typeof value === \"number\" && Number.isInteger(value) && value >= min && value <= max) {\n return value;\n }\n\n const expected = `an integer from ${String(min)} to ${String(max)}, or null for no limit`;\n reportInvalid(diagnostics, key, expected, value, String(fallback));\n return fallback;\n}\n\n/**\n * Reads a hook. Undefined keeps the current hook and null removes it.\n * @param key Config key.\n * @param value The value the consumer passed.\n * @param fallback The current hook.\n * @param diagnostics Diagnostics reporter.\n * @returns The hook, or undefined when there is none.\n */\nfunction resolveHook<T>(\n key: string,\n value: unknown,\n fallback: T | undefined,\n diagnostics: Diagnostics,\n): T | undefined {\n if (value === undefined) {\n return fallback;\n }\n\n if (value === null) {\n return undefined;\n }\n\n if (typeof value === \"function\") {\n return value as T;\n }\n\n reportInvalid(diagnostics, key, HOOK_EXPECTED, value, \"the current value\", describeKind);\n return fallback;\n}\n\n/**\n * Stands in for a redact value that isn't a function when no redact hook was set before. The\n * record builder drops each record while it's the hook, so a record the app meant to redact\n * never leaves the page.\n * @returns null, which drops the record.\n */\nexport const REFUSE_RECORDS = (): null => null;\n\n/**\n * Reads the redact hook. A value that isn't a function keeps the current hook, or fails closed\n * when there is none. Otherwise a typo such as `{ default: fn }` would send raw records.\n * @param value The value the consumer passed.\n * @param fallback The current hook.\n * @param diagnostics Diagnostics reporter.\n * @returns The hook, REFUSE_RECORDS, or undefined when there is none.\n */\nfunction resolveRedact(\n value: unknown,\n fallback: ResolvedConfig[\"redact\"],\n diagnostics: Diagnostics,\n): ResolvedConfig[\"redact\"] {\n if (value === undefined || value === null || typeof value === \"function\" || fallback) {\n return resolveHook(\"redact\", value, fallback, diagnostics);\n }\n\n diagnostics.report(\n \"config.invalid\",\n `redact must be ${HOOK_EXPECTED}. The value is ${describeKind(value)}. The library drops each record until redact is a function or null.`,\n );\n return REFUSE_RECORDS;\n}\n\n/**\n * Reads the processors. A list with one entry that isn't a function is refused as a whole,\n * because running the other processors without it could let a record through unmasked. With\n * no current list, the library drops each record instead.\n * @param value The value the consumer passed.\n * @param fallback The current processors.\n * @param diagnostics Diagnostics reporter.\n * @returns A copy of the new list, the current list, or a list that drops each record.\n */\nfunction resolveProcessors(\n value: unknown,\n fallback: ResolvedConfig[\"processors\"],\n diagnostics: Diagnostics,\n): ResolvedConfig[\"processors\"] {\n if (value === undefined) {\n return fallback;\n }\n\n if (isFunctions(value)) {\n return [...(value as ResolvedConfig[\"processors\"])];\n }\n\n if (fallback.length > 0) {\n reportInvalid(\n diagnostics,\n \"processors\",\n \"a list of functions\",\n value,\n \"the current list\",\n describeKind,\n );\n return fallback;\n }\n\n // No list to keep, and the app meant to process each record, so fail closed.\n diagnostics.report(\n \"config.invalid\",\n `processors must be a list of functions. The value is ${describeKind(value)}. The library drops each record until processors is a list of functions or [].`,\n );\n return [REFUSE_RECORDS];\n}\n\n/**\n * Reads a string option.\n * @param key Config key.\n * @param value The value the consumer passed.\n * @param fallback The current value.\n * @param diagnostics Diagnostics reporter.\n * @returns The value, or the fallback when the value isn't a string.\n */\nfunction resolveString(\n key: string,\n value: unknown,\n fallback: string,\n diagnostics: Diagnostics,\n): string {\n if (value === undefined) {\n return fallback;\n }\n\n if (typeof value === \"string\") {\n return value;\n }\n\n reportInvalid(diagnostics, key, \"a string\", value, \"the current value\");\n return fallback;\n}\n\n/**\n * Reads a sampling rate from 0 to 1.\n * @param key Config key.\n * @param value The value the consumer passed.\n * @param fallback The current rate.\n * @param diagnostics Diagnostics reporter.\n * @returns The rate, or the fallback when the value isn't accepted.\n */\nfunction resolveRate(\n key: string,\n value: unknown,\n fallback: number,\n diagnostics: Diagnostics,\n): number {\n if (value === undefined) {\n return fallback;\n }\n\n if (isRate(value)) {\n return value;\n }\n\n diagnostics.report(\n \"config.invalid\",\n `${key} must be 0..1. The value is ${describeValue(value)}. The library keeps ${String(fallback)}.`,\n );\n return fallback;\n}\n\n/**\n * Reads sampling.rates. A new map replaces the current one, as minLevels does, so a later call\n * can remove a namespace.\n * @param value The value the consumer passed.\n * @param fallback The current rates.\n * @param diagnostics Diagnostics reporter.\n * @returns The rate for each namespace prefix.\n */\nfunction resolveRates(\n value: unknown,\n fallback: Record<string, number>,\n diagnostics: Diagnostics,\n): Record<string, number> {\n if (value === undefined) {\n return fallback;\n }\n\n if (!isObject(value)) {\n reportInvalid(diagnostics, \"sampling.rates\", \"an object of rates\", value, \"the current value\");\n return fallback;\n }\n\n // A bad entry is left out, so the namespace falls back to a shorter prefix or defaultRate.\n // An undefined entry is the same as no entry.\n const rates: [string, number][] = [];\n for (const [ns, rate] of Object.entries(value)) {\n if (isRate(rate)) {\n rates.push([ns, rate]);\n } else if (rate !== undefined) {\n diagnostics.report(\n \"config.invalid\",\n `sampling.rates[\"${ns}\"] must be 0..1. The value is ${describeValue(rate)}. The library ignores this entry.`,\n );\n }\n }\n\n // fromEntries creates own properties, and it copies, so the app's object never changes.\n return Object.fromEntries(rates);\n}\n\n/**\n * Merges and checks a section of integer options. The keys come only from `ranges`.\n * @param section Section name, for example `batching`.\n * @param input The values the consumer passed.\n * @param base The current values.\n * @param ranges Accepted range for each key.\n * @param diagnostics Diagnostics reporter.\n * @returns The value for every key in `ranges`.\n */\nfunction resolveRanges<K extends string>(\n section: string,\n input: Partial<Record<NoInfer<K>, unknown>> | undefined,\n base: Record<NoInfer<K>, number>,\n ranges: Record<K, Range>,\n diagnostics: Diagnostics,\n): Record<K, number> {\n const given: Partial<Record<K, unknown>> = input ?? {};\n const keys = Object.keys(ranges) as K[];\n\n return Object.fromEntries(\n keys.map((key): [K, number] => [\n key,\n resolveInteger(`${section}.${key}`, given[key], ranges[key], base[key], diagnostics),\n ]),\n ) as Record<K, number>;\n}\n\n/**\n * Reads a level name, ignoring case.\n * @param value The value the consumer passed.\n * @returns The level, or undefined when the value isn't a level name.\n */\nfunction toLevel(value: unknown): LogLevel | undefined {\n if (typeof value !== \"string\") {\n return undefined;\n }\n\n const upper = value.toUpperCase();\n return LEVEL_NAMES.find((level) => level === upper);\n}\n\n/**\n * Reads a level option. Without this check, an unknown level silently drops every record.\n * @param key Config key.\n * @param value The value the consumer passed.\n * @param fallback The current level.\n * @param diagnostics Diagnostics reporter.\n * @returns The level, or the fallback when the value isn't a level name.\n */\nfunction resolveLevel(\n key: string,\n value: unknown,\n fallback: LogLevel,\n diagnostics: Diagnostics,\n): LogLevel {\n if (value === undefined) {\n return fallback;\n }\n\n const level = toLevel(value);\n if (level !== undefined) {\n return level;\n }\n\n reportInvalid(diagnostics, key, LEVEL_EXPECTED, value, `\"${fallback}\"`);\n return fallback;\n}\n\n/**\n * Reads the minLevels option. Keeps every valid prefix and reports the rest. A new map\n * replaces the current one.\n * @param value The value the consumer passed.\n * @param fallback The current levels.\n * @param diagnostics Diagnostics reporter.\n * @returns The level for each namespace prefix.\n */\nfunction resolveMinLevels(\n value: unknown,\n fallback: Record<string, LogLevel>,\n diagnostics: Diagnostics,\n): Record<string, LogLevel> {\n if (value === undefined) {\n return fallback;\n }\n\n if (!isObject(value)) {\n reportInvalid(diagnostics, \"minLevels\", \"an object of level names\", value, \"the current value\");\n return fallback;\n }\n\n const levels: [string, LogLevel][] = [];\n for (const [prefix, raw] of Object.entries(value)) {\n const level = toLevel(raw);\n if (prefix !== \"\" && level !== undefined) {\n levels.push([prefix, level]);\n } else {\n reportInvalid(diagnostics, `minLevels[\"${prefix}\"]`, LEVEL_EXPECTED, raw, \"minLevel for it\");\n }\n }\n\n // fromEntries creates own properties, so a \"__proto__\" key can't change the prototype.\n return Object.fromEntries(levels);\n}\n\n/**\n * Reads a list option. Keeps every accepted entry and reports the rest.\n * @param key Config key.\n * @param value The value the consumer passed.\n * @param fallback The current list.\n * @param expected Describes the accepted list.\n * @param accept Converts an entry, or returns undefined to reject it.\n * @param diagnostics Diagnostics reporter.\n * @returns The accepted entries, or the fallback when the value isn't a list.\n */\nfunction resolveList<T>(\n key: string,\n value: unknown,\n fallback: T[],\n expected: string,\n accept: (entry: unknown) => T | undefined,\n diagnostics: Diagnostics,\n): T[] {\n if (value === undefined) {\n return fallback;\n }\n\n if (!Array.isArray(value)) {\n reportInvalid(diagnostics, key, expected, value, \"the current list\");\n return fallback;\n }\n\n const kept: T[] = [];\n const entries: unknown[] = value;\n\n for (const entry of entries) {\n const accepted = accept(entry);\n if (accepted === undefined) {\n diagnostics.report(\n \"config.invalid\",\n `The library ignores the ${key} entry ${describeValue(entry)}. ${key} must be ${expected}.`,\n );\n continue;\n }\n kept.push(accepted);\n }\n\n return kept;\n}\n\n/**\n * Accepts a capture plugin entry.\n * @param entry List entry.\n * @returns The entry, or undefined.\n */\nfunction toPlugin(entry: unknown): CapturePlugin | undefined {\n const valid =\n isObject(entry) &&\n typeof entry.name === \"string\" &&\n entry.name !== \"\" &&\n typeof entry.install === \"function\" &&\n typeof entry.uninstall === \"function\";\n\n return valid ? (entry as unknown as CapturePlugin) : undefined;\n}\n\n/**\n * Reads diagnostics.records. A list keeps its string entries and reports the rest.\n * @param key Full config key.\n * @param value The value the consumer passed.\n * @param fallback The current value.\n * @param diagnostics Diagnostics reporter.\n * @returns True, false or the list of codes.\n */\nfunction resolveDiagnosticRecords(\n key: string,\n value: unknown,\n fallback: unknown,\n diagnostics: Diagnostics,\n): unknown {\n if (value === undefined || typeof value === \"boolean\") {\n return value ?? fallback;\n }\n\n if (Array.isArray(value)) {\n return resolveList(key, value, [], DIAGNOSTIC_RECORDS_EXPECTED, toStringEntry, diagnostics);\n }\n\n reportInvalid(diagnostics, key, DIAGNOSTIC_RECORDS_EXPECTED, value, \"the current value\");\n return fallback;\n}\n\n/**\n * Accepts a string entry.\n * @param entry List entry.\n * @returns The entry, or undefined.\n */\nfunction toStringEntry(entry: unknown): string | undefined {\n return typeof entry === \"string\" ? entry : undefined;\n}\n\n/**\n * Accepts a log type entry. An unknown type would never match a record, so it's rejected.\n * @param entry List entry.\n * @returns The log type, or undefined.\n */\nfunction toLogType(entry: unknown): LogType | undefined {\n return LOG_TYPE_VALUES.find((type) => type === entry);\n}\n\n/**\n * Accepts a string or a RegExp entry.\n * @param entry List entry.\n * @returns The entry, or undefined.\n */\nfunction toPattern(entry: unknown): string | RegExp | undefined {\n return typeof entry === \"string\" || entry instanceof RegExp ? entry : undefined;\n}\n\n/**\n * Accepts a console method name.\n * @param entry List entry.\n * @returns The method, or undefined.\n */\nfunction toConsoleMethod(entry: unknown): CapturedConsoleMethod | undefined {\n return CONSOLE_METHOD_VALUES.find((method) => method === entry);\n}\n\n/**\n * Reads an origin entry. A URL with a path is reduced to its origin.\n * @param entry List entry.\n * @returns The origin, or undefined. resolveList reports the rejected entry.\n */\nfunction toOrigin(entry: unknown): string | undefined {\n if (typeof entry !== \"string\") {\n return undefined;\n }\n\n // Every sandboxed and data: document has the opaque origin \"null\", so a single entry\n // would trust all of them.\n try {\n const { origin } = new URL(entry);\n return origin === SANDBOX_ORIGIN ? undefined : origin;\n } catch {\n return undefined;\n }\n}\n\n/**\n * Reads a trace header target. A string is reduced to its origin, and a RegExp is kept as is.\n * @param entry List entry.\n * @returns The target, or undefined. resolveList reports the rejected entry.\n */\nfunction toTarget(entry: unknown): string | RegExp | undefined {\n return entry instanceof RegExp ? entry : toOrigin(entry);\n}\n\n/**\n * Checks whether a value is an object of string values.\n * @param value Value to test.\n * @returns True for an object whose values are all strings.\n */\nfunction isStringRecord(value: unknown): value is Record<string, string> {\n if (!isObject(value)) {\n return false;\n }\n\n const values: unknown[] = Object.values(value);\n return values.every((entry) => typeof entry === \"string\");\n}\n\n/**\n * Reads the headers option.\n * @param value The value the consumer passed.\n * @param fallback The current headers.\n * @param diagnostics Diagnostics reporter.\n * @returns The headers, undefined after null, or the fallback for undefined or a bad value.\n */\nfunction resolveHeaders(\n value: unknown,\n fallback: HeadersOption,\n diagnostics: Diagnostics,\n): HeadersOption {\n if (value === undefined) {\n return fallback;\n }\n\n // null clears the headers. undefined keeps them, so an unset variable can't drop a token the\n // app still needs. With isolation on, configure() refuses the change and a logout rotates.\n if (value === null) {\n return undefined;\n }\n\n if (typeof value === \"function\") {\n return value as HeadersFunction;\n }\n\n if (isStringRecord(value)) {\n return value;\n }\n\n // The value can hold a token, and this message can become a record.\n diagnostics.report(\n \"config.invalid\",\n \"headers must be an object of strings or a function. The library keeps the current headers.\",\n );\n return fallback;\n}\n\n/**\n * Checks if a value implements the LogSerializer interface.\n * @param value Value to check.\n * @returns True if value implements serialize.\n */\nfunction isSerializer(value: unknown): value is LogSerializer {\n if (typeof value !== \"object\" || value === null) {\n return false;\n }\n const serialize: unknown = Reflect.get(value, \"serialize\");\n return typeof serialize === \"function\";\n}\n\n/**\n * Validates the serializer option. A name stays a name here, because the transport picks\n * the implementation.\n * @param requested Serializer name or custom serializer implementation.\n * @param previous The current serializer option.\n * @param diagnostics Diagnostics reporter.\n * @returns Valid serializer option.\n */\nfunction resolveSerializer(\n requested: unknown,\n previous: SerializerChoice | undefined,\n diagnostics: Diagnostics,\n): SerializerChoice {\n if (requested === undefined) {\n return previous ?? SERIALIZER_NAME_OTLP;\n }\n if (requested === SERIALIZER_NAME_OTLP || requested === SERIALIZER_NAME_ECS) {\n return requested;\n }\n if (isSerializer(requested)) {\n return requested;\n }\n\n diagnostics.report(\n \"config.invalid\",\n `serializer must be \"${SERIALIZER_NAME_OTLP}\", \"${SERIALIZER_NAME_ECS}\" or an implementation. The library keeps the current serializer.`,\n );\n return previous ?? SERIALIZER_NAME_OTLP;\n}\n\n/** The style keys the console option accepts. */\nconst CONSOLE_STYLE_KEYS = new Set(Object.keys(CONSOLE_DEFAULT_STYLES));\n\n/**\n * Keeps the valid entries of a console styles object and reports every entry it drops.\n * @param styles The styles the consumer passed.\n * @param diagnostics Diagnostics reporter.\n * @returns The valid styles.\n */\nfunction validStyles(styles: unknown, diagnostics: Diagnostics): ConsoleStyles {\n const valid: Record<string, string> = {};\n if (styles !== undefined && !isObject(styles)) {\n reportInvalid(\n diagnostics,\n \"consoleOutput.styles\",\n \"an object of CSS strings\",\n styles,\n \"the styles\",\n );\n return valid;\n }\n\n const entries: [string, unknown][] = Object.entries(styles ?? {});\n\n for (const [key, value] of entries) {\n if (!CONSOLE_STYLE_KEYS.has(key)) {\n diagnostics.report(\n \"config.invalid\",\n `The library ignores the unknown consoleOutput.styles key \"${key}\". Check the spelling.`,\n );\n continue;\n }\n\n // undefined keeps the current style, as it does for every other key.\n if (value === undefined) {\n continue;\n }\n\n if (typeof value !== \"string\") {\n diagnostics.report(\n \"config.invalid\",\n `consoleOutput.styles.${key} must be a string. The library keeps the current style.`,\n );\n continue;\n }\n\n valid[key] = value;\n }\n\n return valid;\n}\n\n/**\n * Reads the level from the consoleOutput option's object form.\n * @param requested The level the consumer passed.\n * @param previous The current console level. Null means the console is off.\n * @param diagnostics Diagnostics reporter.\n * @returns The level. An omitted or unknown level keeps the current one, also when it's off.\n */\nfunction resolveConsoleLevel(\n requested: unknown,\n previous: LogLevel | null,\n diagnostics: Diagnostics,\n): LogLevel | null {\n // An omitted level keeps the current one, so setting only the styles can't turn a console on.\n if (requested === undefined) {\n return previous;\n }\n\n const level = toLevel(requested);\n if (level !== undefined) {\n return level;\n }\n\n reportInvalid(\n diagnostics,\n \"consoleOutput.level\",\n LEVEL_EXPECTED,\n requested,\n \"the current console level\",\n );\n return previous;\n}\n\n/**\n * Normalizes the consoleOutput option into a level and a set of styles.\n * @param requested Consumer consoleOutput option.\n * @param previous The current console settings.\n * @param diagnostics Diagnostics reporter.\n * @returns Console settings. The level is null when the console is off.\n */\nfunction resolveConsole(\n requested: ObservabilityConfig[\"consoleOutput\"],\n previous: ResolvedConsole,\n diagnostics: Diagnostics,\n): ResolvedConsole {\n if (requested === undefined) {\n return previous;\n }\n if (requested === false) {\n return { level: null, styles: previous.styles };\n }\n if (requested === true) {\n return { level: CONSOLE_DEFAULT_LEVEL, styles: previous.styles };\n }\n if (typeof requested === \"string\") {\n const level = toLevel(requested);\n if (level === undefined) {\n reportInvalid(\n diagnostics,\n \"consoleOutput\",\n LEVEL_EXPECTED,\n requested,\n \"the current console level\",\n );\n return previous;\n }\n\n return { level, styles: previous.styles };\n }\n\n // Guard against null and other values the type doesn't allow.\n if (typeof requested !== \"object\" || (requested as unknown) === null) {\n diagnostics.report(\n \"config.invalid\",\n \"consoleOutput must be a boolean, a level or an object. The current console settings stay.\",\n );\n return previous;\n }\n\n return {\n level: resolveConsoleLevel(requested.level, previous.level, diagnostics),\n styles: { ...previous.styles, ...validStyles(requested.styles, diagnostics) },\n };\n}\n\n/**\n * Merges and checks the sampling section.\n * @param input The sampling options the consumer passed.\n * @param base The current sampling options.\n * @param diagnostics Diagnostics reporter.\n * @returns The sampling options.\n */\nfunction resolveSampling(\n input: Partial<SamplingOptions> | undefined,\n base: SamplingOptions,\n diagnostics: Diagnostics,\n): SamplingOptions {\n const given = input ?? {};\n\n return {\n defaultRate: resolveRate(\n \"sampling.defaultRate\",\n given.defaultRate,\n base.defaultRate,\n diagnostics,\n ),\n remoteMaxRate: resolveRate(\n \"sampling.remoteMaxRate\",\n given.remoteMaxRate,\n base.remoteMaxRate,\n diagnostics,\n ),\n rates: resolveRates(given.rates, base.rates, diagnostics),\n alwaysSampleTypes: resolveList(\n \"sampling.alwaysSampleTypes\",\n given.alwaysSampleTypes,\n base.alwaysSampleTypes,\n LOG_TYPE_LIST_EXPECTED,\n toLogType,\n diagnostics,\n ),\n alwaysSampleFrom: resolveLevel(\n \"sampling.alwaysSampleFrom\",\n given.alwaysSampleFrom,\n base.alwaysSampleFrom,\n diagnostics,\n ),\n errorCeiling: resolveLimit(\n \"sampling.errorCeiling\",\n given.errorCeiling,\n COUNT_RANGE,\n base.errorCeiling,\n diagnostics,\n ),\n // A window of 0 ms starts a new window for every record, so the ceiling would never apply.\n errorCeilingWindowMs: resolveInteger(\n \"sampling.errorCeilingWindowMs\",\n given.errorCeilingWindowMs,\n POSITIVE_DURATION_RANGE,\n base.errorCeilingWindowMs,\n diagnostics,\n ),\n remote: resolveBoolean(\"sampling.remote\", given.remote, base.remote, diagnostics),\n };\n}\n\n/**\n * Merges and checks the bus section.\n * @param input The bus options the consumer passed.\n * @param base The current bus options.\n * @param diagnostics Diagnostics reporter.\n * @returns The bus options. Every trusted origin is a bare origin.\n */\nfunction resolveBus(\n input: Partial<BusOptions> | undefined,\n base: BusOptions,\n diagnostics: Diagnostics,\n): BusOptions {\n const given = input ?? {};\n\n // A limit of 0 would stop every message, so each limit starts at 1 and null lifts it.\n return {\n sourcePolicy: resolveChoice(\n \"bus.sourcePolicy\",\n given.sourcePolicy,\n [\"registered\", \"trusted-origin\"],\n base.sourcePolicy,\n diagnostics,\n ),\n maxMessageBytes: resolveLimit(\n \"bus.maxMessageBytes\",\n given.maxMessageBytes,\n POSITIVE_RANGE,\n base.maxMessageBytes,\n diagnostics,\n ),\n maxRecordsPerMessage: resolveLimit(\n \"bus.maxRecordsPerMessage\",\n given.maxRecordsPerMessage,\n POSITIVE_RANGE,\n base.maxRecordsPerMessage,\n diagnostics,\n ),\n maxMessagesPerSecond: resolveLimit(\n \"bus.maxMessagesPerSecond\",\n given.maxMessagesPerSecond,\n POSITIVE_RANGE,\n base.maxMessagesPerSecond,\n diagnostics,\n ),\n mode: resolveChoice(\"bus.mode\", given.mode, BUS_MODE_VALUES, base.mode, diagnostics),\n // Compare origins, not URLs. Otherwise an entry with a path never matches event.origin.\n trustedOrigins: resolveList(\n \"bus.trustedOrigins\",\n given.trustedOrigins,\n base.trustedOrigins,\n ORIGIN_LIST_EXPECTED,\n toOrigin,\n diagnostics,\n ),\n openFinRole: resolveChoice(\n \"bus.openFinRole\",\n given.openFinRole,\n OPENFIN_ROLE_VALUES,\n base.openFinRole,\n diagnostics,\n ),\n };\n}\n\n/**\n * Merges and checks the journey section.\n * @param input The journey options the consumer passed.\n * @param base The current journey options.\n * @param diagnostics Diagnostics reporter.\n * @returns The journey options.\n */\nfunction resolveJourney(\n input: Partial<JourneyOptions> | undefined,\n base: JourneyOptions,\n diagnostics: Diagnostics,\n): JourneyOptions {\n const given = input ?? {};\n\n return {\n scope: resolveChoice(\n \"journey.scope\",\n given.scope,\n JOURNEY_SCOPE_VALUES,\n base.scope,\n diagnostics,\n ),\n maxAgeMs: resolveInteger(\n \"journey.maxAgeMs\",\n given.maxAgeMs,\n JOURNEY_AGE_RANGE,\n base.maxAgeMs,\n diagnostics,\n ),\n };\n}\n\n/**\n * Merges and checks the retention section.\n * @param input The retention options the consumer passed.\n * @param base The current retention options.\n * @param diagnostics Diagnostics reporter.\n * @returns The retention options.\n */\nfunction resolveRetention(\n input: Partial<RetentionOptions> | undefined,\n base: RetentionOptions,\n diagnostics: Diagnostics,\n): RetentionOptions {\n const given = input ?? {};\n\n return {\n maxBatches: resolveInteger(\n \"retention.maxBatches\",\n given.maxBatches,\n MAX_BATCHES_RANGE,\n base.maxBatches,\n diagnostics,\n ),\n maxAgeMs: resolveLimit(\n \"retention.maxAgeMs\",\n given.maxAgeMs,\n RETENTION_AGE_RANGE,\n base.maxAgeMs,\n diagnostics,\n ),\n maxAttempts: resolveLimit(\n \"retention.maxAttempts\",\n given.maxAttempts,\n RETENTION_ATTEMPTS_RANGE,\n base.maxAttempts,\n diagnostics,\n ),\n };\n}\n\n/**\n * Reads a capture key that takes a boolean or an options object, where true means the defaults.\n * @param key Capture key, for example `longFrames`.\n * @param value The value the consumer passed.\n * @param base The current value.\n * @param diagnostics Diagnostics reporter.\n * @param fields Checks each field of an object. It gets the current object, or {} after a\n * boolean, so an omitted field keeps its current value.\n * @returns The boolean, the checked object, or the current value for a bad value.\n */\nfunction resolveCaptureOptions<T extends object>(\n key: string,\n value: unknown,\n base: boolean | T,\n diagnostics: Diagnostics,\n fields: (given: Record<string, unknown>, previous: Partial<T>) => T,\n): boolean | T {\n if (value === undefined) {\n return base;\n }\n\n if (typeof value === \"boolean\") {\n return value;\n }\n\n if (!isObject(value)) {\n diagnostics.report(\"config.invalid\", `capture.${key} must be a boolean or an options object.`);\n return base;\n }\n\n const resolved = fields(value, typeof base === \"object\" ? base : {});\n\n // The resolved object has each known option, so a typo such as `threshold` isn't silent.\n for (const name of Object.keys(value)) {\n if (!hasOwn(resolved, name)) {\n diagnostics.report(\n \"config.invalid\",\n `The library ignores the unknown config key \"capture.${key}.${name}\". Check the spelling.`,\n );\n }\n }\n\n return resolved;\n}\n\n/**\n * Merges and checks the capture section.\n * @param input The capture options the consumer passed.\n * @param base The current capture options.\n * @param diagnostics Diagnostics reporter.\n * @returns The capture options.\n */\nfunction resolveCapture(\n input: Partial<CaptureOptions> | undefined,\n base: CaptureOptions,\n diagnostics: Diagnostics,\n): CaptureOptions {\n const given = input ?? {};\n const capture: CaptureOptions = {\n ...base,\n urlTransform: resolveHook(\n \"capture.urlTransform\",\n given.urlTransform,\n base.urlTransform,\n diagnostics,\n ),\n remoteToggles: resolveList(\n \"capture.remoteToggles\",\n given.remoteToggles,\n base.remoteToggles,\n \"a list of capture switch names without privacy controls\",\n (value) => REMOTE_CAPTURE_FLAGS.find((key) => key === value),\n diagnostics,\n ),\n resourceTiming: resolveCaptureOptions(\n \"resourceTiming\",\n given.resourceTiming,\n base.resourceTiming,\n diagnostics,\n (value, previous) => ({\n slowMs: resolveNonNegative(\n \"capture.resourceTiming.slowMs\",\n value.slowMs,\n previous.slowMs ?? RESOURCE_SLOW_MS,\n diagnostics,\n ),\n }),\n ),\n interactions: resolveCaptureOptions(\n \"interactions\",\n given.interactions,\n base.interactions,\n diagnostics,\n (value, previous) => resolveInteractions(value, previous, diagnostics),\n ),\n console: resolveCaptureOptions(\n \"console\",\n given.console,\n base.console,\n diagnostics,\n (value, previous) => ({\n levels: resolveList(\n \"capture.console.levels\",\n value.levels,\n previous.levels ?? [\"error\", \"warn\"],\n CONSOLE_LEVELS_EXPECTED,\n toConsoleMethod,\n diagnostics,\n ),\n }),\n ),\n longFrames: resolveCaptureOptions(\n \"longFrames\",\n given.longFrames,\n base.longFrames,\n diagnostics,\n (value, previous) => ({\n thresholdMs: resolveNonNegative(\n \"capture.longFrames.thresholdMs\",\n value.thresholdMs,\n previous.thresholdMs ?? LONG_FRAME_THRESHOLD_MS,\n diagnostics,\n ),\n }),\n ),\n userTiming: resolveCaptureOptions(\n \"userTiming\",\n given.userTiming,\n base.userTiming,\n diagnostics,\n (value, previous) => ({\n include: resolveList(\n \"capture.userTiming.include\",\n value.include,\n previous.include ?? [],\n PATTERN_LIST_EXPECTED,\n toPattern,\n diagnostics,\n ),\n }),\n ),\n webVitals: resolveCaptureOptions(\n \"webVitals\",\n given.webVitals,\n base.webVitals,\n diagnostics,\n (value, previous) => ({\n loader: resolveHook(\"capture.webVitals.loader\", value.loader, previous.loader, diagnostics),\n }),\n ),\n ignoreUrls: resolveList(\n \"capture.ignoreUrls\",\n given.ignoreUrls,\n base.ignoreUrls,\n PATTERN_LIST_EXPECTED,\n toPattern,\n diagnostics,\n ),\n // A string target is an origin, because a substring test would also match a query value\n // or a longer host.\n propagateTraceHeaderTo: resolveList(\n \"capture.propagateTraceHeaderTo\",\n given.propagateTraceHeaderTo,\n base.propagateTraceHeaderTo,\n TARGET_LIST_EXPECTED,\n toTarget,\n diagnostics,\n ),\n plugins: resolveList(\n \"capture.plugins\",\n given.plugins,\n base.plugins,\n \"a list of objects with a name, install() and uninstall()\",\n toPlugin,\n diagnostics,\n ),\n };\n\n for (const key of CAPTURE_FLAG_KEYS) {\n capture[key] = resolveBoolean(`capture.${key}`, given[key], base[key], diagnostics);\n }\n\n return capture;\n}\n\n/**\n * Checks whether the browser parses a CSS selector. Without a document there's nothing to parse\n * with, so any selector passes.\n * @param selector The selector. matches(\"\") throws, so \"\" fails.\n * @returns True for a selector the browser parses, or for any selector without a document.\n */\nfunction parsesSelector(selector: string): boolean {\n if (typeof document === \"undefined\") {\n return true;\n }\n\n try {\n document.createElement(\"div\").matches(selector);\n return true;\n } catch {\n // A selector the browser can't parse throws, and that's the answer. The fallback is false.\n return false;\n }\n}\n\n/**\n * Checks the click settings. An invalid value never turns on text or selector capture.\n * @param value The settings the app supplied.\n * @param previous The current settings, or {} when the capture was a boolean.\n * @param diagnostics Diagnostics reporter.\n * @returns The valid settings, with invalid values replaced by the current ones.\n */\nfunction resolveInteractions(\n value: Record<string, unknown>,\n previous: InteractionOptions,\n diagnostics: Diagnostics,\n): InteractionOptions {\n const ignore = value.ignoreSelector;\n let ignoreSelector = ignore === undefined ? previous.ignoreSelector : ignore;\n // \"\" restores the built-in region, and matches(\"\") throws, so \"\" skips the parse check.\n if (ignoreSelector !== undefined && ignoreSelector !== null && ignoreSelector !== \"\") {\n if (typeof ignoreSelector !== \"string\" || !parsesSelector(ignoreSelector)) {\n diagnostics.report(\n \"config.invalid\",\n 'capture.interactions.ignoreSelector must be a valid CSS selector, \"\" or null.',\n );\n ignoreSelector = previous.ignoreSelector;\n }\n }\n // The name goes into a CSS attribute selector. Letters, digits, hyphens and underscores need\n // no escaping, and any other name keeps the current attribute.\n let actionAttribute = previous.actionAttribute ?? ACTION_ATTRIBUTE_DEFAULT;\n if (value.actionAttribute !== undefined) {\n if (typeof value.actionAttribute === \"string\" && /^[a-z][\\w-]*$/i.test(value.actionAttribute)) {\n actionAttribute = value.actionAttribute;\n } else {\n reportInvalid(\n diagnostics,\n \"capture.interactions.actionAttribute\",\n \"an attribute name of letters, digits, hyphens and underscores\",\n value.actionAttribute,\n `\"${actionAttribute}\"`,\n );\n }\n }\n // Use ?? here, because \"\" is a real setting that turns the filter off.\n let deadClickIgnoreSelector = previous.deadClickIgnoreSelector ?? DEAD_CLICK_IGNORE_SELECTOR;\n const live = value.deadClickIgnoreSelector;\n if (live !== undefined) {\n // \"\" is the off switch, and matches(\"\") throws, so \"\" skips the parse check.\n if (typeof live === \"string\" && (live === \"\" || parsesSelector(live))) {\n deadClickIgnoreSelector = live;\n } else {\n reportInvalid(\n diagnostics,\n \"capture.interactions.deadClickIgnoreSelector\",\n 'a valid CSS selector, or \"\" to turn the live-region filter off',\n live,\n `\"${deadClickIgnoreSelector}\"`,\n );\n }\n }\n return {\n actionAttribute,\n text: resolveBoolean(\n \"capture.interactions.text\",\n value.text,\n previous.text ?? false,\n diagnostics,\n ),\n selector: resolveBoolean(\n \"capture.interactions.selector\",\n value.selector,\n previous.selector ?? false,\n diagnostics,\n ),\n ignoreSelector:\n typeof ignoreSelector === \"string\" || ignoreSelector === null ? ignoreSelector : undefined,\n maxTextChars: resolveInteger(\n \"capture.interactions.maxTextChars\",\n value.maxTextChars,\n [0, Number.MAX_SAFE_INTEGER],\n previous.maxTextChars ?? 50,\n diagnostics,\n ),\n rageClicks: resolveBoolean(\n \"capture.interactions.rageClicks\",\n value.rageClicks,\n previous.rageClicks ?? false,\n diagnostics,\n ),\n rageClickCount: resolveInteger(\n \"capture.interactions.rageClickCount\",\n value.rageClickCount,\n [2, 20],\n previous.rageClickCount ?? RAGE_CLICK_COUNT,\n diagnostics,\n ),\n rageClickWindowMs: resolveInteger(\n \"capture.interactions.rageClickWindowMs\",\n value.rageClickWindowMs,\n CLICK_WAIT_RANGE,\n previous.rageClickWindowMs ?? RAGE_CLICK_WINDOW_MS,\n diagnostics,\n ),\n deadClicks: resolveBoolean(\n \"capture.interactions.deadClicks\",\n value.deadClicks,\n previous.deadClicks ?? false,\n diagnostics,\n ),\n deadClickMs: resolveInteger(\n \"capture.interactions.deadClickMs\",\n value.deadClickMs,\n CLICK_WAIT_RANGE,\n previous.deadClickMs ?? DEAD_CLICK_MS,\n diagnostics,\n ),\n deadClickIgnoreSelector,\n };\n}\n\n/** The rules in the form resolvePolicy() reads. POLICY_RULES holds the typed form. */\ninterface PolicyLookup {\n /** Accepted range for each number key. */\n ranges: Partial<Record<string, Range>>;\n /** Accepted range for each key that also takes null. */\n limits: Partial<Record<string, Range>>;\n /** Accepted values for each choice key. */\n choices?: Partial<Record<string, readonly string[]>>;\n /** Resolver for each key with any other value type. */\n custom?: Partial<Record<string, CustomResolver>>;\n}\n\n/**\n * Checks one policy section. An invalid value keeps the current value.\n * @param name Section name for diagnostic messages.\n * @param input The settings the app supplied.\n * @param base The current settings.\n * @param rules The section's ranges and choices.\n * @param diagnostics Diagnostics reporter.\n * @returns The valid section.\n */\nfunction resolvePolicy<T extends object>(\n name: string,\n input: Partial<T> | undefined,\n base: T,\n rules: PolicyLookup,\n diagnostics: Diagnostics,\n): T {\n const next = { ...base };\n for (const key of Object.keys(base) as (keyof T & string)[]) {\n const value: unknown = input?.[key];\n const fallback: unknown = base[key];\n const range = rules.ranges[key];\n const limit = rules.limits[key];\n const choice = rules.choices?.[key];\n const custom = rules.custom?.[key];\n let resolved: unknown = fallback;\n if (custom) {\n resolved = custom(`${name}.${key}`, value, fallback, diagnostics);\n } else if (limit) {\n resolved = resolveLimit(\n `${name}.${key}`,\n value,\n limit,\n fallback as number | null,\n diagnostics,\n );\n } else if (typeof fallback === \"number\" && range) {\n resolved = resolveInteger(`${name}.${key}`, value, range, fallback, diagnostics);\n } else if (typeof fallback === \"boolean\") {\n resolved = resolveBoolean(`${name}.${key}`, value, fallback, diagnostics);\n } else if (choice) {\n resolved = resolveChoice(`${name}.${key}`, value, choice, String(fallback), diagnostics);\n } else if (value === undefined || typeof value === \"string\") {\n resolved = value ?? fallback;\n } else {\n reportInvalid(diagnostics, `${name}.${key}`, \"a string\", value, String(fallback));\n }\n Object.assign(next, { [key]: resolved });\n }\n return next;\n}\n\n/**\n * Returns the input without a section that isn't an object, and reports each one. Otherwise\n * the library would ignore a section such as `capture: null` with no report.\n * @param input Partial consumer configuration options.\n * @param diagnostics Diagnostics reporter.\n * @returns The input, with every bad section left out so its current values stay.\n */\nfunction checkSections(\n input: Partial<ObservabilityConfig>,\n diagnostics: Diagnostics,\n): Partial<ObservabilityConfig> {\n let checked = input;\n\n for (const section of CONFIG_SECTIONS) {\n const value: unknown = input[section];\n if (value !== undefined && !isObject(value)) {\n reportInvalid(diagnostics, section, \"an object\", value, \"the current values\");\n checked = { ...checked, [section]: undefined };\n }\n }\n\n return checked;\n}\n\n/**\n * Reports each pair of settings where one of them does nothing, so the app learns why. The\n * values stay. Only a call that sets one of the pair reports it, so an unrelated later call\n * stays quiet.\n * @param input The options of this configure() call, after checkSections().\n * @param config The resolved config.\n * @param diagnostics Diagnostics reporter.\n */\nfunction reportIneffective(\n input: Partial<ObservabilityConfig>,\n config: ResolvedConfig,\n diagnostics: Diagnostics,\n): void {\n const { capture, sampling } = config;\n const noEffect = (key: string, condition: string): void => {\n diagnostics.report(\"config.invalid\", `${key} has no effect ${condition}. The value stays.`);\n };\n\n const setsTransport = input.transport !== undefined || input.transportWorker !== undefined;\n if (setsTransport && config.transport && config.transportWorker) {\n noEffect(\"transportWorker\", \"with transport\");\n }\n\n const setsExit = input.transport !== undefined || input.transportOnExit !== undefined;\n if (setsExit && config.transportOnExit && !config.transport) {\n noEffect(\"transportOnExit\", \"without transport\");\n }\n\n const setsToggles =\n input.capture?.remoteToggles !== undefined || input.sampling?.remote !== undefined;\n if (setsToggles && capture.remoteToggles.length > 0 && !sampling.remote) {\n noEffect(\"capture.remoteToggles\", \"without sampling.remote\");\n }\n\n // A remote rule can still turn on fetch or xhr, and then the targets apply.\n const requests =\n capture.fetch ||\n capture.xhr ||\n capture.remoteToggles.includes(\"fetch\") ||\n capture.remoteToggles.includes(\"xhr\");\n const setsTargets =\n input.capture?.propagateTraceHeaderTo !== undefined ||\n input.capture?.fetch !== undefined ||\n input.capture?.xhr !== undefined;\n if (setsTargets && capture.propagateTraceHeaderTo.length > 0 && !requests) {\n noEffect(\"capture.propagateTraceHeaderTo\", \"without capture.fetch or capture.xhr\");\n }\n}\n\n/**\n * Resolves partial configuration input into a validated ResolvedConfig.\n * @param input Partial consumer configuration options.\n * @param diagnostics Diagnostics reporter.\n * @param previous The active configuration, for an incremental reconfigure.\n * @param live The config the runtime sends with now. A rotation passes it, because its previous\n * has no routing values, and each relative endpoint would be reported again.\n * @returns Complete, validated configuration object.\n */\nexport function resolveConfig(\n input: Partial<ObservabilityConfig>,\n diagnostics: Diagnostics,\n previous?: ResolvedConfig,\n live: ResolvedConfig | undefined = previous,\n): ResolvedConfig {\n const base = previous ?? DEFAULT_CONFIG;\n const given = checkSections(input, diagnostics);\n\n // Check every policy section against its own rules. POLICY_RULES key order is the report order.\n const policies = Object.fromEntries(\n (Object.keys(POLICY_RULES) as PolicySection[]).map((key) => [\n key,\n resolvePolicy(key, given[key], base[key], POLICY_RULES[key], diagnostics),\n ]),\n ) as Pick<ResolvedConfig, PolicySection>;\n // Every key is read on its own. Spreading the input would let undefined remove a hook.\n const merged: ResolvedConfig = {\n ...base,\n ...policies,\n\n lockConfiguration: resolveBoolean(\n \"lockConfiguration\",\n given.lockConfiguration,\n base.lockConfiguration,\n diagnostics,\n ),\n loggerCache: {\n // 0 turns the cache off, and null lifts the limit.\n maxEntries: resolveLimit(\n \"loggerCache.maxEntries\",\n given.loggerCache?.maxEntries,\n COUNT_RANGE,\n base.loggerCache.maxEntries,\n diagnostics,\n ),\n },\n securityContext: {\n // An empty id keeps the current one, and the runtime creates one at startup.\n id:\n resolveString(\n \"securityContext.id\",\n given.securityContext?.id,\n base.securityContext.id,\n diagnostics,\n ) || base.securityContext.id,\n isolation: resolveBoolean(\n \"securityContext.isolation\",\n given.securityContext?.isolation,\n base.securityContext.isolation,\n diagnostics,\n ),\n },\n // An unset environment variable arrives as undefined, so keep the current endpoint.\n endpoint: resolveEndpoint(given.endpoint, base.endpoint, diagnostics, live?.endpoint) as\n string | null,\n serviceName: resolveString(\"serviceName\", given.serviceName, base.serviceName, diagnostics),\n serviceVersion: resolveString(\n \"serviceVersion\",\n given.serviceVersion,\n base.serviceVersion,\n diagnostics,\n ),\n environment: resolveString(\"environment\", given.environment, base.environment, diagnostics),\n // A bad value reports config.invalid and the current value stays. Without this check, a bad\n // minLevel silently drops every record.\n enabled: resolveBoolean(\"enabled\", given.enabled, base.enabled, diagnostics),\n payloadMode: resolveChoice(\n \"payloadMode\",\n given.payloadMode,\n [\"copy\", \"defer\"] as const,\n base.payloadMode,\n diagnostics,\n ),\n minLevel: resolveLevel(\"minLevel\", given.minLevel, base.minLevel, diagnostics),\n minLevels: resolveMinLevels(given.minLevels, base.minLevels, diagnostics),\n processors: resolveProcessors(given.processors, base.processors, diagnostics),\n compression: resolveChoice(\n \"compression\",\n given.compression,\n COMPRESSION_VALUES,\n base.compression,\n diagnostics,\n ),\n credentials: resolveChoice(\n \"credentials\",\n given.credentials,\n CREDENTIALS_VALUES,\n base.credentials,\n diagnostics,\n ),\n headers: resolveHeaders(given.headers, base.headers, diagnostics),\n identity: resolveChoice(\n \"identity\",\n given.identity,\n IDENTITY_VALUES,\n base.identity,\n diagnostics,\n ),\n // A name stays a name, because the transport picks the implementation.\n serializer: resolveSerializer(given.serializer, previous?.serializer, diagnostics),\n consoleOutput: resolveConsole(given.consoleOutput, base.consoleOutput, diagnostics),\n sampling: resolveSampling(given.sampling, base.sampling, diagnostics),\n bus: resolveBus(given.bus, base.bus, diagnostics),\n batching: resolveRanges(\n \"batching\",\n given.batching,\n base.batching,\n BATCHING_RANGES,\n diagnostics,\n ),\n retention: resolveRetention(given.retention, base.retention, diagnostics),\n limits: resolveRanges(\"limits\", given.limits, base.limits, LIMIT_RANGES, diagnostics),\n journey: resolveJourney(given.journey, base.journey, diagnostics),\n capture: resolveCapture(given.capture, base.capture, diagnostics),\n // Without a transport function, the pipeline drops every batch, so a bad value keeps the\n // current one.\n transport: resolveHook(\"transport\", given.transport, base.transport, diagnostics),\n transportOnExit: resolveHook(\n \"transportOnExit\",\n given.transportOnExit,\n base.transportOnExit,\n diagnostics,\n ),\n transportWorker: resolveHook(\n \"transportWorker\",\n given.transportWorker,\n base.transportWorker,\n diagnostics,\n ),\n otelLoader: resolveHook(\"otelLoader\", given.otelLoader, base.otelLoader, diagnostics),\n contextProvider: resolveHook(\n \"contextProvider\",\n given.contextProvider,\n base.contextProvider,\n diagnostics,\n ),\n redact: resolveRedact(given.redact, base.redact, diagnostics),\n onDiagnostic: resolveHook(\"onDiagnostic\", given.onDiagnostic, base.onDiagnostic, diagnostics),\n onDrop: resolveHook(\"onDrop\", given.onDrop, base.onDrop, diagnostics),\n };\n\n // Metric and span batches always go out as OTLP, whatever the log serializer is, so a\n // custom or ECS log format doesn't turn these endpoints off.\n for (const key of [\"metricsEndpoint\", \"tracesEndpoint\"] as const) {\n merged[key] = resolveDestination(key, given[key], base[key], diagnostics, live?.[key]) as\n string | null;\n }\n\n // null selects console-only mode. \"\" is the default when no call has set an endpoint.\n // A custom transport needs no endpoint.\n if (merged.endpoint === \"\") {\n if (merged.transport === undefined) {\n diagnostics.report(\n \"config.invalid\",\n \"endpoint is missing. The library drops each record. Set endpoint: null for console-only mode.\",\n );\n }\n }\n\n // Only the delivery stack sends, and it loads only with an endpoint or a custom transport.\n for (const key of [\"metricsEndpoint\", \"tracesEndpoint\"] as const) {\n if (merged[key] !== null && merged.endpoint === null && !merged.transport) {\n diagnostics.report(\n \"config.invalid\",\n `${key} needs endpoint or transport. The library sends nothing to ${key}.`,\n );\n }\n }\n\n if (!merged.serviceName) {\n diagnostics.report(\n \"config.invalid\",\n `serviceName is missing. Every record reports service.name as '${UNKNOWN_SERVICE_NAME}'.`,\n );\n merged.serviceName = UNKNOWN_SERVICE_NAME;\n }\n\n // Swap the previous endpoints in the ignore list for the new ones to prevent a self-logging\n // loop. Otherwise one failed POST logs another failed POST without end.\n merged.capture.ignoreUrls = merged.capture.ignoreUrls.filter(\n (url) =>\n url !== previous?.endpoint &&\n url !== previous?.metricsEndpoint &&\n url !== previous?.tracesEndpoint &&\n url !== previous?.replay.endpoint,\n );\n for (const url of [\n merged.endpoint,\n merged.metricsEndpoint,\n merged.tracesEndpoint,\n merged.replay.endpoint,\n ]) {\n if (url && !merged.capture.ignoreUrls.includes(url)) {\n merged.capture.ignoreUrls = [...merged.capture.ignoreUrls, url];\n }\n }\n\n if (merged.delivery.retryMaxDelayMs < merged.delivery.retryBaseDelayMs) {\n diagnostics.report(\n \"config.invalid\",\n \"delivery.retryMaxDelayMs must be at least retryBaseDelayMs.\",\n );\n merged.delivery.retryBaseDelayMs = base.delivery.retryBaseDelayMs;\n merged.delivery.retryMaxDelayMs = base.delivery.retryMaxDelayMs;\n }\n reportIneffective(given, merged, diagnostics);\n reportUnknownKeys(input, diagnostics);\n\n return merged;\n}\n\n/**\n * Reports every config key the schema doesn't know, at the top level and one level inside\n * each section. A typo passes the `Partial` type check and has no effect, for example\n * `remoteUrl` for `endpoint` or `capture.webVital` for `capture.webVitals`. Namespace keys\n * under `sampling.rates` are free-form and one level deeper, so the check skips them.\n * @param input Partial consumer configuration options.\n * @param diagnostics Diagnostics reporter.\n */\nfunction reportUnknownKeys(input: Partial<ObservabilityConfig>, diagnostics: Diagnostics): void {\n const known = new Set<string>([...Object.keys(DEFAULT_CONFIG), ...UNDEFAULTED_CONFIG_KEYS]);\n\n for (const key of Object.keys(input)) {\n if (!known.has(key)) {\n diagnostics.report(\n \"config.invalid\",\n `The library ignores the unknown config key \"${key}\". Check the spelling.`,\n );\n }\n }\n\n for (const section of CONFIG_SECTIONS) {\n const values: unknown = input[section];\n\n if (typeof values !== \"object\" || values === null) {\n continue;\n }\n\n const sectionKeys = new Set<string>([\n ...Object.keys(DEFAULT_CONFIG[section]),\n ...UNDEFAULTED_SECTION_KEYS[section],\n ]);\n\n for (const key of Object.keys(values)) {\n if (!sectionKeys.has(key)) {\n diagnostics.report(\n \"config.invalid\",\n `The library ignores the unknown config key \"${section}.${key}\". Check the spelling.`,\n );\n }\n }\n }\n}\n\n/**\n * Changes the active configuration object in place, so subsystems holding a section\n * reference see the update.\n * @param target Active configuration object to change.\n * @param next Configuration object with the new values.\n */\nexport function applyResolvedConfig(target: ResolvedConfig, next: ResolvedConfig): void {\n for (const key of Object.keys(next) as (keyof ResolvedConfig)[]) {\n // The cast widens the tuple so includes accepts any string key. With satisfies, the tuple\n // stays narrow and every non-section key fails to compile.\n if ((CONFIG_SECTIONS as readonly string[]).includes(key)) {\n continue;\n }\n Object.assign(target, { [key]: next[key] });\n }\n\n // Merge every section object in place to keep its reference. A new object would leave\n // subsystems on the old section they got at construction.\n for (const section of CONFIG_SECTIONS) {\n Object.assign(target[section] as object, next[section] as object);\n }\n}\n"],"mappings":";;;;AA6DA,IAAMe,IAAc,OAAO,KAAKd,CAAW,GAGrCe,KAAqB,CAAC,QAAQ,MAAM,GACpCC,KAAqB;CAAC;CAAQ;CAAe;AAAS,GACtDC,KAAiB;CAAC;CAAQ;CAAa;CAAgB;CAAU;AAAM,GACvEC,KAAkB,CAAC,WAAW,QAAQ,GACtCC,KAAkB;CAAC;CAAQ;CAAU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EACZ,yBACAY,EAAM,cACNnE,GACAwE,EAAK,cACLpD,CACF;EAEA,sBAAsB+B,EACpB,iCACAgB,EAAM,sBACNpE,GACAyE,EAAK,sBACLpD,CACF;EACA,QAAQ6B,EAAe,mBAAmBkB,EAAM,QAAQK,EAAK,QAAQpD,CAAW;CAClF;AACF;AASA,SAASuF,GACP,GACA,GACA,GACY;CACZ,IAAMxC,IAAQC,KAAS,CAAC;CAGxB,OAAO;EACL,cAActB,EACZ,oBACAqB,EAAM,cACN,CAAC,cAAc,gBAAgB,GAC/BK,EAAK,cACLpD,CACF;EACA,iBAAiBmC,EACf,uBACAY,EAAM,iBACNlE,GACAuE,EAAK,iBACLpD,CACF;EACA,sBAAsBmC,EACpB,4BACAY,EAAM,sBACNlE,GACAuE,EAAK,sBACLpD,CACF;EACA,sBAAsBmC,EACpB,4BACAY,EAAM,sBACNlE,GACAuE,EAAK,sBACLpD,CACF;EACA,MAAM0B,EAAc,YAAYqB,EAAM,MAAMhF,IAAiBqF,EAAK,MAAMpD,CAAW;EAEnF,gBAAgB6D,EACd,sBACAd,EAAM,gBACNK,EAAK,gBACLhC,IACAmD,IACAvE,CACF;EACA,aAAa0B,EACX,mBACAqB,EAAM,aACN/E,IACAoF,EAAK,aACLpD,CACF;CACF;AACF;AASA,SAASwF,GACP,GACA,GACA,GACgB;CAChB,IAAMzC,IAAQC,KAAS,CAAC;CAExB,OAAO;EACL,OAAOtB,EACL,iBACAqB,EAAM,OACN9E,IACAmF,EAAK,OACLpD,CACF;EACA,UAAU+B,EACR,oBACAgB,EAAM,UACNtE,IACA2E,EAAK,UACLpD,CACF;CACF;AACF;AASA,SAASyF,GACP,GACA,GACA,GACkB;CAClB,IAAM1C,IAAQC,KAAS,CAAC;CAExB,OAAO;EACL,YAAYjB,EACV,wBACAgB,EAAM,YACN1E,IACA+E,EAAK,YACLpD,CACF;EACA,UAAUmC,EACR,sBACAY,EAAM,UACNzE,IACA8E,EAAK,UACLpD,CACF;EACA,aAAamC,EAC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C;EAED,KAAK,IAAMlD,KAAO,OAAO,KAAKuB,CAAM,GAClC,AAAKmG,EAAY,IAAI1H,CAAG,KACtBD,EAAY,OACV,kBACA,+CAA+CmD,EAAQ,GAAGlD,EAAI,uBAChE;CAGN;AACF;AAQA,SAAgB2H,GAAoB,GAAwB,GAA4B;CACtF,KAAK,IAAM3H,KAAO,OAAO,KAAKwG,CAAI,GAGhC,AAAK1J,EAAsC,SAASkD,CAAG,KAGvD,OAAO,OAAO4H,GAAQ,GAAG5H,IAAMwG,EAAKxG,GAAK,CAAC;CAK5C,KAAK,IAAMkD,KAAWpG,GACpB,OAAO,OAAO8K,EAAO1E,IAAoBsD,EAAKtD,EAAkB;AAEpE"}
@@ -1,9 +1,9 @@
1
1
  import { r as e } from "./error-like-B11pB4aL.js";
2
2
  import { n as t } from "./guards-BlYGRK4l.js";
3
- import { n, t as r } from "./library-console-DklSmucS.js";
4
- import { t as i } from "./patch-UdPz1ea8.js";
5
- import { i as a } from "./sanitize-DjnR6RXR.js";
6
- import { t as o } from "./storm-DKlpv0FL.js";
3
+ import { n, t as r } from "./library-console-amePMnP8.js";
4
+ import { t as i } from "./patch-Sr1wKg7W.js";
5
+ import { i as a } from "./sanitize-B2GKlSFp.js";
6
+ import { t as o } from "./storm-U3_ek1nA.js";
7
7
  import { t as s } from "./defineProperty-s2S8BXUc.js";
8
8
  // src/capture/console.ts
9
9
  var c = [
@@ -78,4 +78,4 @@ var d = class {
78
78
  };
79
79
  export { d as ConsoleCapture };
80
80
 
81
- //# sourceMappingURL=console-BsM-fSCQ.js.map
81
+ //# sourceMappingURL=console-CAyCQOpm.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"console-BsM-fSCQ.js","names":["isErrorLike","isObject","isLibraryConsole","patch","truncate","allowInWindow","_defineProperty","METHODS","DEFAULT_METHODS","makeWrapper","args","original","target","ConsoleCapture","ctx","method","restore","setting","levels","errorAt","arg","textAt","error","message","diagnostics","used","rest","index","attrs","logger"],"sources":["../src/capture/console.ts"],"sourcesContent":["// src/capture/console.ts\n//\n// Records the app's own console calls, because third-party code often reports a fault only there.\n\nimport { CONSOLE_BREADCRUMB_MAX_CHARS } from \"../constants\";\nimport type { CapturedConsoleMethod } from \"../models/config\";\nimport { type ErrorLike, isErrorLike } from \"../utils/error-like\";\nimport { isObject } from \"../utils/guards\";\nimport { isLibraryConsole, runAsLibraryConsole } from \"../utils/library-console\";\nimport { patch } from \"../utils/patch\";\nimport { truncate } from \"../utils/sanitize\";\nimport { allowInWindow, type StormWindow } from \"./storm\";\nimport type { Capture, CaptureContext } from \"./types\";\n\n/** The console methods this capture can wrap. */\nconst METHODS: readonly CapturedConsoleMethod[] = [\"error\", \"warn\", \"info\", \"log\"];\n\n/** Methods that `capture.console: true` wraps. */\nconst DEFAULT_METHODS: readonly CapturedConsoleMethod[] = [\"error\", \"warn\"];\n\n/** Signature of a console method. */\ntype ConsoleFn = (...args: unknown[]) => void;\n\n/** A wrapper's record function. Uninstall sets it to null. */\ninterface Target {\n /** Records one call, or null after uninstall. */\n record: ((args: unknown[]) => void) | null;\n}\n\n/** A wrapper's target, plus the function that undoes its patch. */\ninterface Wrapped {\n /** The wrapper's target. */\n target: Target;\n /** Puts the original back if the method still holds the wrapper. Returns true if it did. */\n restore: () => boolean;\n}\n\n/**\n * Builds a wrapper that calls the original first, then the target.\n * The wrapper doesn't close over the capture, so one that stays in place keeps no runtime alive.\n * @param original The method that was in place before the wrap.\n * @param target The wrapper's target.\n * @returns The wrapper.\n */\nfunction makeWrapper(original: ConsoleFn, target: Target): ConsoleFn {\n return (...args) => {\n // Call the original first, so devtools shows the same text even when the record fails.\n Reflect.apply(original, console, args);\n\n // Skip the lines the library itself prints.\n if (isLibraryConsole()) {\n return;\n }\n\n target.record?.(args);\n };\n}\n\n/** Wraps the selected console methods and records every call as a record or a breadcrumb. */\nexport class ConsoleCapture implements Capture {\n /** Capture module identifier. */\n readonly name = \"console\";\n\n /** Active wrappers. A wrapper that isn't in this map only calls the original. */\n private readonly wrapped = new Map<CapturedConsoleMethod, Wrapped>();\n\n /** Guards against wrapping a method twice. */\n private installed = false;\n\n /** This capture's own rate limit, so console noise can't eat the error capture's allowance. */\n private readonly window: StormWindow = { start: 0, count: 0 };\n\n /**\n * @param ctx Capture context: configuration, diagnostics, logger and breadcrumbs.\n */\n constructor(private readonly ctx: CaptureContext) {}\n\n /** Wraps every selected method. */\n install(): void {\n // Some worker realms don't define console, so guard against a missing one.\n if (this.installed || typeof console === \"undefined\") {\n return;\n }\n this.installed = true;\n\n for (const method of this.readMethods()) {\n this.wrap(method);\n }\n }\n\n /** Restores every method that still holds this capture's wrapper. */\n uninstall(): void {\n if (!this.installed) {\n return;\n }\n this.installed = false;\n\n for (const [method, { target, restore }] of this.wrapped) {\n target.record = null;\n\n if (restore()) {\n continue;\n }\n\n // Restoring here would remove the other script's wrapper, so leave it. Our wrapper now\n // only calls the original.\n this.ctx.diagnostics.report(\n \"capture.install_failed\",\n `Another script wrapped console.${method} after the library. The library leaves that wrapper in place.`,\n );\n }\n\n this.wrapped.clear();\n }\n\n /**\n * Reads the methods from the configuration and reports any value it can't use.\n * @returns Methods to wrap, with no duplicates.\n */\n private readMethods(): readonly CapturedConsoleMethod[] {\n const { console: setting } = this.ctx.config.capture;\n\n if (setting === true) {\n return DEFAULT_METHODS;\n }\n\n const levels: unknown = isObject(setting) ? setting.levels : undefined;\n\n if (\n Array.isArray(levels) &&\n levels.every((method: unknown) => METHODS.includes(method as CapturedConsoleMethod))\n ) {\n return [...new Set(levels as CapturedConsoleMethod[])];\n }\n\n this.ctx.diagnostics.report(\n \"config.invalid\",\n 'capture.console must be true or an object with a list of \"error\", \"warn\", \"info\" and \"log\" in levels. The console capture is off.',\n );\n return [];\n }\n\n /**\n * Replaces one console method with a wrapper that calls the original first.\n * @param method Console method to wrap.\n */\n private wrap(method: CapturedConsoleMethod): void {\n const target: Target = {\n record: (args) => {\n // The scope keeps a console call inside the record path from being captured again.\n runAsLibraryConsole(() => {\n this.ctx.diagnostics.guard(\n \"capture.record_failed\",\n `The library could not record a console.${method} call.`,\n () => {\n this.record(method, args);\n },\n );\n });\n },\n };\n\n // patch keeps the unbound method, so uninstall restores the same function, not a bound copy.\n const restore = patch(console, method, (original) => makeWrapper(original, target));\n this.wrapped.set(method, { target, restore });\n }\n\n /**\n * Records one console call.\n * @param method The console method that was called.\n * @param args The call's arguments.\n */\n private record(method: CapturedConsoleMethod, args: unknown[]): void {\n // Duck typing also finds an error from another realm, which fails `instanceof Error`.\n const errorAt = args.findIndex((arg) => isErrorLike(arg));\n const textAt = args.findIndex((arg) => typeof arg === \"string\");\n const error = args[errorAt] as ErrorLike | undefined;\n const message = (args[textAt] as string | undefined) ?? error?.message ?? `console.${method}`;\n\n if (method === \"info\" || method === \"log\") {\n this.ctx.breadcrumbs.push({\n t: Date.now(),\n category: \"console\",\n message: truncate(message, CONSOLE_BREADCRUMB_MAX_CHARS),\n data: { \"console.method\": method },\n });\n return;\n }\n\n const { diagnostics, logger } = this.ctx;\n\n if (\n !allowInWindow(\n this.window,\n this.ctx.config.captureLimits.consolePerWindow,\n diagnostics,\n \"console records\",\n this.ctx.config.captureLimits.windowMs,\n )\n ) {\n return;\n }\n\n // The record builder sanitizes the arguments. A warn record keeps its Error among them.\n const used = method === \"error\" ? [textAt, errorAt] : [textAt];\n const rest = args.filter((_, index) => !used.includes(index));\n const attrs: Record<string, unknown> = { \"console.method\": method };\n\n if (rest.length > 0) {\n attrs[\"console.args\"] = rest;\n }\n\n if (method === \"warn\") {\n logger.warn(message, attrs);\n return;\n }\n\n logger.error(message, error, { ...attrs, \"error.captured_by\": \"console.error\" });\n }\n}\n"],"mappings":";;;;;;;;AAeA,IAAMO,IAA4C;CAAC;CAAS;CAAQ;CAAQ;AAAK,GAG3EC,IAAoD,CAAC,SAAS,MAAM;AA0B1E,SAASC,EAAY,GAAqB,GAA2B;CACnE,QAAQ,GAAGC,MAAS;EAKlB,AAHA,QAAQ,MAAMC,GAAU,SAASD,CAAI,GAGj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AAK,OAAOA,GAAQL,CAAI;IAC1B,CACF;GACF,CAAC;EACH,EACF,GAGMM,IAAUb,EAAM,SAASY,IAAS,MAAaN,EAAYE,GAAUC,CAAM,CAAC;EAClF,KAAK,QAAQ,IAAIG,GAAQ;GAAE;GAAQ;EAAQ,CAAC;CAC9C;CAOA,OAAe,GAA+B,GAAuB;EAEnE,IAAMI,IAAUT,EAAK,WAAW,MAAQV,EAAYoB,CAAG,CAAC,GAClDC,IAASX,EAAK,WAAW,MAAQ,OAAOU,KAAQ,QAAQ,GACxDE,IAAQZ,EAAKS,IACbI,IAAWb,EAAKW,MAAkCC,GAAO,WAAW,WAAWP;EAErF,IAAIA,MAAW,UAAUA,MAAW,OAAO;GACzC,KAAK,IAAI,YAAY,KAAK;IACxB,GAAG,KAAK,IAAI;IACZ,UAAU;IACV,SAASX,EAASmB,GAAA,GAAqC;IACvD,MAAM,EAAE,kBAAkBR,EAAO;GACnC,CAAC;GACD;EACF;EAEA,IAAM,EAAE,gBAAa,cAAW,KAAK;EAErC,IACE,CAACV,EACC,KAAK,QACL,KAAK,IAAI,OAAO,cAAc,kBAC9BmB,GACA,mBACA,KAAK,IAAI,OAAO,cAAc,QAChC,GAEA;EAIF,IAAMC,IAAOV,MAAW,UAAU,CAACM,GAAQF,CAAO,IAAI,CAACE,CAAM,GACvDK,IAAOhB,EAAK,QAAQ,GAAG,MAAU,CAACe,EAAK,SAASE,CAAK,CAAC,GACtDC,IAAiC,EAAE,kBAAkBb,EAAO;EAMlE,AAJIW,EAAK,SAAS,MAChB,EAAM,kBAAkBA,IAGtBX,MAAW,SACbc,EAAO,KAAKN,GAASK,CAAK,IAI5BC,EAAO,MAAMN,GAASD,GAAO;GAAE,GAAGM;GAAO,qBAAqB;EAAgB,CAAC;CACjF;AACF"}
1
+ {"version":3,"file":"console-CAyCQOpm.js","names":["isErrorLike","isObject","isLibraryConsole","patch","truncate","allowInWindow","_defineProperty","METHODS","DEFAULT_METHODS","makeWrapper","args","original","target","ConsoleCapture","ctx","method","restore","setting","levels","errorAt","arg","textAt","error","message","diagnostics","used","rest","index","attrs","logger"],"sources":["../src/capture/console.ts"],"sourcesContent":["// src/capture/console.ts\n//\n// Records the app's own console calls, because third-party code often reports a fault only there.\n\nimport { CONSOLE_BREADCRUMB_MAX_CHARS } from \"../constants\";\nimport type { CapturedConsoleMethod } from \"../models/config\";\nimport { type ErrorLike, isErrorLike } from \"../utils/error-like\";\nimport { isObject } from \"../utils/guards\";\nimport { isLibraryConsole, runAsLibraryConsole } from \"../utils/library-console\";\nimport { patch } from \"../utils/patch\";\nimport { truncate } from \"../utils/sanitize\";\nimport { allowInWindow, type StormWindow } from \"./storm\";\nimport type { Capture, CaptureContext } from \"./types\";\n\n/** The console methods this capture can wrap. */\nconst METHODS: readonly CapturedConsoleMethod[] = [\"error\", \"warn\", \"info\", \"log\"];\n\n/** Methods that `capture.console: true` wraps. */\nconst DEFAULT_METHODS: readonly CapturedConsoleMethod[] = [\"error\", \"warn\"];\n\n/** Signature of a console method. */\ntype ConsoleFn = (...args: unknown[]) => void;\n\n/** A wrapper's record function. Uninstall sets it to null. */\ninterface Target {\n /** Records one call, or null after uninstall. */\n record: ((args: unknown[]) => void) | null;\n}\n\n/** A wrapper's target, plus the function that undoes its patch. */\ninterface Wrapped {\n /** The wrapper's target. */\n target: Target;\n /** Puts the original back if the method still holds the wrapper. Returns true if it did. */\n restore: () => boolean;\n}\n\n/**\n * Builds a wrapper that calls the original first, then the target.\n * The wrapper doesn't close over the capture, so one that stays in place keeps no runtime alive.\n * @param original The method that was in place before the wrap.\n * @param target The wrapper's target.\n * @returns The wrapper.\n */\nfunction makeWrapper(original: ConsoleFn, target: Target): ConsoleFn {\n return (...args) => {\n // Call the original first, so devtools shows the same text even when the record fails.\n Reflect.apply(original, console, args);\n\n // Skip the lines the library itself prints.\n if (isLibraryConsole()) {\n return;\n }\n\n target.record?.(args);\n };\n}\n\n/** Wraps the selected console methods and records every call as a record or a breadcrumb. */\nexport class ConsoleCapture implements Capture {\n /** Capture module identifier. */\n readonly name = \"console\";\n\n /** Active wrappers. A wrapper that isn't in this map only calls the original. */\n private readonly wrapped = new Map<CapturedConsoleMethod, Wrapped>();\n\n /** Guards against wrapping a method twice. */\n private installed = false;\n\n /** This capture's own rate limit, so console noise can't eat the error capture's allowance. */\n private readonly window: StormWindow = { start: 0, count: 0 };\n\n /**\n * @param ctx Capture context: configuration, diagnostics, logger and breadcrumbs.\n */\n constructor(private readonly ctx: CaptureContext) {}\n\n /** Wraps every selected method. */\n install(): void {\n // Some worker realms don't define console, so guard against a missing one.\n if (this.installed || typeof console === \"undefined\") {\n return;\n }\n this.installed = true;\n\n for (const method of this.readMethods()) {\n this.wrap(method);\n }\n }\n\n /** Restores every method that still holds this capture's wrapper. */\n uninstall(): void {\n if (!this.installed) {\n return;\n }\n this.installed = false;\n\n for (const [method, { target, restore }] of this.wrapped) {\n target.record = null;\n\n if (restore()) {\n continue;\n }\n\n // Restoring here would remove the other script's wrapper, so leave it. Our wrapper now\n // only calls the original.\n this.ctx.diagnostics.report(\n \"capture.install_failed\",\n `Another script wrapped console.${method} after the library. The library leaves that wrapper in place.`,\n );\n }\n\n this.wrapped.clear();\n }\n\n /**\n * Reads the methods from the configuration and reports any value it can't use.\n * @returns Methods to wrap, with no duplicates.\n */\n private readMethods(): readonly CapturedConsoleMethod[] {\n const { console: setting } = this.ctx.config.capture;\n\n if (setting === true) {\n return DEFAULT_METHODS;\n }\n\n const levels: unknown = isObject(setting) ? setting.levels : undefined;\n\n if (\n Array.isArray(levels) &&\n levels.every((method: unknown) => METHODS.includes(method as CapturedConsoleMethod))\n ) {\n return [...new Set(levels as CapturedConsoleMethod[])];\n }\n\n this.ctx.diagnostics.report(\n \"config.invalid\",\n 'capture.console must be true or an object with a list of \"error\", \"warn\", \"info\" and \"log\" in levels. The console capture is off.',\n );\n return [];\n }\n\n /**\n * Replaces one console method with a wrapper that calls the original first.\n * @param method Console method to wrap.\n */\n private wrap(method: CapturedConsoleMethod): void {\n const target: Target = {\n record: (args) => {\n // The scope keeps a console call inside the record path from being captured again.\n runAsLibraryConsole(() => {\n this.ctx.diagnostics.guard(\n \"capture.record_failed\",\n `The library could not record a console.${method} call.`,\n () => {\n this.record(method, args);\n },\n );\n });\n },\n };\n\n // patch keeps the unbound method, so uninstall restores the same function, not a bound copy.\n const restore = patch(console, method, (original) => makeWrapper(original, target));\n this.wrapped.set(method, { target, restore });\n }\n\n /**\n * Records one console call.\n * @param method The console method that was called.\n * @param args The call's arguments.\n */\n private record(method: CapturedConsoleMethod, args: unknown[]): void {\n // Duck typing also finds an error from another realm, which fails `instanceof Error`.\n const errorAt = args.findIndex((arg) => isErrorLike(arg));\n const textAt = args.findIndex((arg) => typeof arg === \"string\");\n const error = args[errorAt] as ErrorLike | undefined;\n const message = (args[textAt] as string | undefined) ?? error?.message ?? `console.${method}`;\n\n if (method === \"info\" || method === \"log\") {\n this.ctx.breadcrumbs.push({\n t: Date.now(),\n category: \"console\",\n message: truncate(message, CONSOLE_BREADCRUMB_MAX_CHARS),\n data: { \"console.method\": method },\n });\n return;\n }\n\n const { diagnostics, logger } = this.ctx;\n\n if (\n !allowInWindow(\n this.window,\n this.ctx.config.captureLimits.consolePerWindow,\n diagnostics,\n \"console records\",\n this.ctx.config.captureLimits.windowMs,\n )\n ) {\n return;\n }\n\n // The record builder sanitizes the arguments. A warn record keeps its Error among them.\n const used = method === \"error\" ? [textAt, errorAt] : [textAt];\n const rest = args.filter((_, index) => !used.includes(index));\n const attrs: Record<string, unknown> = { \"console.method\": method };\n\n if (rest.length > 0) {\n attrs[\"console.args\"] = rest;\n }\n\n if (method === \"warn\") {\n logger.warn(message, attrs);\n return;\n }\n\n logger.error(message, error, { ...attrs, \"error.captured_by\": \"console.error\" });\n }\n}\n"],"mappings":";;;;;;;;AAeA,IAAMO,IAA4C;CAAC;CAAS;CAAQ;CAAQ;AAAK,GAG3EC,IAAoD,CAAC,SAAS,MAAM;AA0B1E,SAASC,EAAY,GAAqB,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36.cjs"),t=require("./guards-EjG3ahFp.cjs"),n=require("./library-console-DJUQzcgM.cjs"),r=require("./patch-BX8KrPCT.cjs"),i=require("./sanitize-Qj6LuZqp.cjs"),a=require("./storm-BHgI12iS.cjs"),o=require("./defineProperty-X1c4tIPD.cjs");var s=[`error`,`warn`,`info`,`log`],c=[`error`,`warn`];function l(e,t){return(...r)=>{Reflect.apply(e,console,r),n.t()||t.record?.(r)}}var u=class{constructor(e){o.t(this,`ctx`,void 0),o.t(this,`name`,`console`),o.t(this,`wrapped`,new Map),o.t(this,`installed`,!1),o.t(this,`window`,{start:0,count:0}),this.ctx=e}install(){if(!(this.installed||typeof console>`u`)){this.installed=!0;for(let e of this.readMethods())this.wrap(e)}}uninstall(){if(this.installed){this.installed=!1;for(let[e,{target:t,restore:n}]of this.wrapped)t.record=null,n()||this.ctx.diagnostics.report(`capture.install_failed`,`Another script wrapped console.${e} after the library. The library leaves that wrapper in place.`);this.wrapped.clear()}}readMethods(){let{console:e}=this.ctx.config.capture;if(e===!0)return c;let n=t.n(e)?e.levels:void 0;return Array.isArray(n)&&n.every(e=>s.includes(e))?[...new Set(n)]:(this.ctx.diagnostics.report(`config.invalid`,`capture.console must be true or an object with a list of "error", "warn", "info" and "log" in levels. The console capture is off.`),[])}wrap(e){let t={record:t=>{n.n(()=>{this.ctx.diagnostics.guard(`capture.record_failed`,`The library could not record a console.${e} call.`,()=>{this.record(e,t)})})}},i=r.t(console,e,e=>l(e,t));this.wrapped.set(e,{target:t,restore:i})}record(t,n){let r=n.findIndex(t=>e.r(t)),o=n.findIndex(e=>typeof e==`string`),s=n[r],c=n[o]??s?.message??`console.${t}`;if(t===`info`||t===`log`){this.ctx.breadcrumbs.push({t:Date.now(),category:`console`,message:i.i(c,200),data:{"console.method":t}});return}let{diagnostics:l,logger:u}=this.ctx;if(!a.t(this.window,this.ctx.config.captureLimits.consolePerWindow,l,`console records`,this.ctx.config.captureLimits.windowMs))return;let d=t===`error`?[o,r]:[o],f=n.filter((e,t)=>!d.includes(t)),p={"console.method":t};f.length>0&&(p[`console.args`]=f),t===`warn`?u.warn(c,p):u.error(c,s,{...p,"error.captured_by":`console.error`})}};exports.ConsoleCapture=u;
2
- //# sourceMappingURL=console-Dkxs6IVQ.cjs.map
1
+ const e=require("./error-like-gGRx2s36.cjs"),t=require("./guards-EjG3ahFp.cjs"),n=require("./library-console-DdIlzzph.cjs"),r=require("./patch-DlcKzIi-.cjs"),i=require("./sanitize-BZdhoghq.cjs"),a=require("./storm-qiE_AMC7.cjs"),o=require("./defineProperty-X1c4tIPD.cjs");var s=[`error`,`warn`,`info`,`log`],c=[`error`,`warn`];function l(e,t){return(...r)=>{Reflect.apply(e,console,r),n.t()||t.record?.(r)}}var u=class{constructor(e){o.t(this,`ctx`,void 0),o.t(this,`name`,`console`),o.t(this,`wrapped`,new Map),o.t(this,`installed`,!1),o.t(this,`window`,{start:0,count:0}),this.ctx=e}install(){if(!(this.installed||typeof console>`u`)){this.installed=!0;for(let e of this.readMethods())this.wrap(e)}}uninstall(){if(this.installed){this.installed=!1;for(let[e,{target:t,restore:n}]of this.wrapped)t.record=null,n()||this.ctx.diagnostics.report(`capture.install_failed`,`Another script wrapped console.${e} after the library. The library leaves that wrapper in place.`);this.wrapped.clear()}}readMethods(){let{console:e}=this.ctx.config.capture;if(e===!0)return c;let n=t.n(e)?e.levels:void 0;return Array.isArray(n)&&n.every(e=>s.includes(e))?[...new Set(n)]:(this.ctx.diagnostics.report(`config.invalid`,`capture.console must be true or an object with a list of "error", "warn", "info" and "log" in levels. The console capture is off.`),[])}wrap(e){let t={record:t=>{n.n(()=>{this.ctx.diagnostics.guard(`capture.record_failed`,`The library could not record a console.${e} call.`,()=>{this.record(e,t)})})}},i=r.t(console,e,e=>l(e,t));this.wrapped.set(e,{target:t,restore:i})}record(t,n){let r=n.findIndex(t=>e.r(t)),o=n.findIndex(e=>typeof e==`string`),s=n[r],c=n[o]??s?.message??`console.${t}`;if(t===`info`||t===`log`){this.ctx.breadcrumbs.push({t:Date.now(),category:`console`,message:i.i(c,200),data:{"console.method":t}});return}let{diagnostics:l,logger:u}=this.ctx;if(!a.t(this.window,this.ctx.config.captureLimits.consolePerWindow,l,`console records`,this.ctx.config.captureLimits.windowMs))return;let d=t===`error`?[o,r]:[o],f=n.filter((e,t)=>!d.includes(t)),p={"console.method":t};f.length>0&&(p[`console.args`]=f),t===`warn`?u.warn(c,p):u.error(c,s,{...p,"error.captured_by":`console.error`})}};exports.ConsoleCapture=u;
2
+ //# sourceMappingURL=console-Dk6GH4yj.cjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"console-Dkxs6IVQ.cjs","names":["isLibraryConsole","isObject","patch","isErrorLike","truncate","allowInWindow","require_error_like","require_guards","require_library_console","require_patch","require_sanitize","require_storm","require_defineProperty","METHODS","DEFAULT_METHODS","makeWrapper","args","original","target","ConsoleCapture","ctx","method","restore","setting","levels","errorAt","arg","textAt","error","message","diagnostics","used","rest","index","attrs","logger"],"sources":["../src/capture/console.ts"],"sourcesContent":["// src/capture/console.ts\n//\n// Records the app's own console calls, because third-party code often reports a fault only there.\n\nimport { CONSOLE_BREADCRUMB_MAX_CHARS } from \"../constants\";\nimport type { CapturedConsoleMethod } from \"../models/config\";\nimport { type ErrorLike, isErrorLike } from \"../utils/error-like\";\nimport { isObject } from \"../utils/guards\";\nimport { isLibraryConsole, runAsLibraryConsole } from \"../utils/library-console\";\nimport { patch } from \"../utils/patch\";\nimport { truncate } from \"../utils/sanitize\";\nimport { allowInWindow, type StormWindow } from \"./storm\";\nimport type { Capture, CaptureContext } from \"./types\";\n\n/** The console methods this capture can wrap. */\nconst METHODS: readonly CapturedConsoleMethod[] = [\"error\", \"warn\", \"info\", \"log\"];\n\n/** Methods that `capture.console: true` wraps. */\nconst DEFAULT_METHODS: readonly CapturedConsoleMethod[] = [\"error\", \"warn\"];\n\n/** Signature of a console method. */\ntype ConsoleFn = (...args: unknown[]) => void;\n\n/** A wrapper's record function. Uninstall sets it to null. */\ninterface Target {\n /** Records one call, or null after uninstall. */\n record: ((args: unknown[]) => void) | null;\n}\n\n/** A wrapper's target, plus the function that undoes its patch. */\ninterface Wrapped {\n /** The wrapper's target. */\n target: Target;\n /** Puts the original back if the method still holds the wrapper. Returns true if it did. */\n restore: () => boolean;\n}\n\n/**\n * Builds a wrapper that calls the original first, then the target.\n * The wrapper doesn't close over the capture, so one that stays in place keeps no runtime alive.\n * @param original The method that was in place before the wrap.\n * @param target The wrapper's target.\n * @returns The wrapper.\n */\nfunction makeWrapper(original: ConsoleFn, target: Target): ConsoleFn {\n return (...args) => {\n // Call the original first, so devtools shows the same text even when the record fails.\n Reflect.apply(original, console, args);\n\n // Skip the lines the library itself prints.\n if (isLibraryConsole()) {\n return;\n }\n\n target.record?.(args);\n };\n}\n\n/** Wraps the selected console methods and records every call as a record or a breadcrumb. */\nexport class ConsoleCapture implements Capture {\n /** Capture module identifier. */\n readonly name = \"console\";\n\n /** Active wrappers. A wrapper that isn't in this map only calls the original. */\n private readonly wrapped = new Map<CapturedConsoleMethod, Wrapped>();\n\n /** Guards against wrapping a method twice. */\n private installed = false;\n\n /** This capture's own rate limit, so console noise can't eat the error capture's allowance. */\n private readonly window: StormWindow = { start: 0, count: 0 };\n\n /**\n * @param ctx Capture context: configuration, diagnostics, logger and breadcrumbs.\n */\n constructor(private readonly ctx: CaptureContext) {}\n\n /** Wraps every selected method. */\n install(): void {\n // Some worker realms don't define console, so guard against a missing one.\n if (this.installed || typeof console === \"undefined\") {\n return;\n }\n this.installed = true;\n\n for (const method of this.readMethods()) {\n this.wrap(method);\n }\n }\n\n /** Restores every method that still holds this capture's wrapper. */\n uninstall(): void {\n if (!this.installed) {\n return;\n }\n this.installed = false;\n\n for (const [method, { target, restore }] of this.wrapped) {\n target.record = null;\n\n if (restore()) {\n continue;\n }\n\n // Restoring here would remove the other script's wrapper, so leave it. Our wrapper now\n // only calls the original.\n this.ctx.diagnostics.report(\n \"capture.install_failed\",\n `Another script wrapped console.${method} after the library. The library leaves that wrapper in place.`,\n );\n }\n\n this.wrapped.clear();\n }\n\n /**\n * Reads the methods from the configuration and reports any value it can't use.\n * @returns Methods to wrap, with no duplicates.\n */\n private readMethods(): readonly CapturedConsoleMethod[] {\n const { console: setting } = this.ctx.config.capture;\n\n if (setting === true) {\n return DEFAULT_METHODS;\n }\n\n const levels: unknown = isObject(setting) ? setting.levels : undefined;\n\n if (\n Array.isArray(levels) &&\n levels.every((method: unknown) => METHODS.includes(method as CapturedConsoleMethod))\n ) {\n return [...new Set(levels as CapturedConsoleMethod[])];\n }\n\n this.ctx.diagnostics.report(\n \"config.invalid\",\n 'capture.console must be true or an object with a list of \"error\", \"warn\", \"info\" and \"log\" in levels. The console capture is off.',\n );\n return [];\n }\n\n /**\n * Replaces one console method with a wrapper that calls the original first.\n * @param method Console method to wrap.\n */\n private wrap(method: CapturedConsoleMethod): void {\n const target: Target = {\n record: (args) => {\n // The scope keeps a console call inside the record path from being captured again.\n runAsLibraryConsole(() => {\n this.ctx.diagnostics.guard(\n \"capture.record_failed\",\n `The library could not record a console.${method} call.`,\n () => {\n this.record(method, args);\n },\n );\n });\n },\n };\n\n // patch keeps the unbound method, so uninstall restores the same function, not a bound copy.\n const restore = patch(console, method, (original) => makeWrapper(original, target));\n this.wrapped.set(method, { target, restore });\n }\n\n /**\n * Records one console call.\n * @param method The console method that was called.\n * @param args The call's arguments.\n */\n private record(method: CapturedConsoleMethod, args: unknown[]): void {\n // Duck typing also finds an error from another realm, which fails `instanceof Error`.\n const errorAt = args.findIndex((arg) => isErrorLike(arg));\n const textAt = args.findIndex((arg) => typeof arg === \"string\");\n const error = args[errorAt] as ErrorLike | undefined;\n const message = (args[textAt] as string | undefined) ?? error?.message ?? `console.${method}`;\n\n if (method === \"info\" || method === \"log\") {\n this.ctx.breadcrumbs.push({\n t: Date.now(),\n category: \"console\",\n message: truncate(message, CONSOLE_BREADCRUMB_MAX_CHARS),\n data: { \"console.method\": method },\n });\n return;\n }\n\n const { diagnostics, logger } = this.ctx;\n\n if (\n !allowInWindow(\n this.window,\n this.ctx.config.captureLimits.consolePerWindow,\n diagnostics,\n \"console records\",\n this.ctx.config.captureLimits.windowMs,\n )\n ) {\n return;\n }\n\n // The record builder sanitizes the arguments. A warn record keeps its Error among them.\n const used = method === \"error\" ? [textAt, errorAt] : [textAt];\n const rest = args.filter((_, index) => !used.includes(index));\n const attrs: Record<string, unknown> = { \"console.method\": method };\n\n if (rest.length > 0) {\n attrs[\"console.args\"] = rest;\n }\n\n if (method === \"warn\") {\n logger.warn(message, attrs);\n return;\n }\n\n logger.error(message, error, { ...attrs, \"error.captured_by\": \"console.error\" });\n }\n}\n"],"mappings":"A,gRAeA,IAAMa,EAA4C,CAAC,QAAS,OAAQ,OAAQ,KAAK,EAG3EC,EAAoD,CAAC,QAAS,MAAM,EA0B1E,SAASC,EAAY,EAAqB,EAA2B,CACnE,OAAQ,GAAGC,IAAS,CAElB,QAAQ,MAAMC,EAAU,QAASD,CAAI,EAGjChB,EAAAA,EAAiB,GAIrBkB,EAAO,SAASF,CAAI,CACtB,CACF,CAGA,IAAaG,EAAb,KAA+C,CAgB7C,YAAY,EAAsC,CAArBP,EAAA,EAAA,KAAA,MAAA,IAAA,EAAA,EAd7BA,EAAA,EAAA,KAAA,OAAgB,SAAA,EAGhBA,EAAA,EAAA,KAAA,UAA2B,IAAI,GAAoC,EAGnEA,EAAA,EAAA,KAAA,YAAoB,EAAA,EAGpBA,EAAA,EAAA,KAAA,SAAuC,CAAE,MAAO,EAAG,MAAO,CAAE,CAAA,EAK/B,KAAA,IAAAQ,CAAsB,CAGnD,SAAgB,CAEd,GAAI,OAAK,WAAa,OAAO,QAAY,KAGzC,MAAK,UAAY,GAEjB,IAAK,IAAMC,KAAU,KAAK,YAAY,EACpC,KAAK,KAAKA,CAAM,CAHD,CAKnB,CAGA,WAAkB,CAChB,GAAK,KAAK,UAGV,MAAK,UAAY,GAEjB,IAAK,GAAM,CAACA,EAAQ,CAAE,SAAQ,cAAc,KAAK,QA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AO,CACnC,CAAC,EACD,MACF,CAEA,GAAM,CAAE,cAAa,UAAW,KAAK,IAErC,GACE,CAAChB,EAAAA,EACC,KAAK,OACL,KAAK,IAAI,OAAO,cAAc,iBAC9ByB,EACA,kBACA,KAAK,IAAI,OAAO,cAAc,QAChC,EAEA,OAIF,IAAMC,EAAOV,IAAW,QAAU,CAACM,EAAQF,CAAO,EAAI,CAACE,CAAM,EACvDK,EAAOhB,EAAK,QAAQ,EAAG,IAAU,CAACe,EAAK,SAASE,CAAK,CAAC,EACtDC,EAAiC,CAAE,iBAAkBb,CAAO,EAE9DW,EAAK,OAAS,IAChB,EAAM,gBAAkBA,GAGtBX,IAAW,OACbc,EAAO,KAAKN,EAASK,CAAK,EAI5BC,EAAO,MAAMN,EAASD,EAAO,CAAE,GAAGM,EAAO,oBAAqB,eAAgB,CAAC,CACjF,CACF,E"}
1
+ {"version":3,"file":"console-Dk6GH4yj.cjs","names":["isLibraryConsole","isObject","patch","isErrorLike","truncate","allowInWindow","require_error_like","require_guards","require_library_console","require_patch","require_sanitize","require_storm","require_defineProperty","METHODS","DEFAULT_METHODS","makeWrapper","args","original","target","ConsoleCapture","ctx","method","restore","setting","levels","errorAt","arg","textAt","error","message","diagnostics","used","rest","index","attrs","logger"],"sources":["../src/capture/console.ts"],"sourcesContent":["// src/capture/console.ts\n//\n// Records the app's own console calls, because third-party code often reports a fault only there.\n\nimport { CONSOLE_BREADCRUMB_MAX_CHARS } from \"../constants\";\nimport type { CapturedConsoleMethod } from \"../models/config\";\nimport { type ErrorLike, isErrorLike } from \"../utils/error-like\";\nimport { isObject } from \"../utils/guards\";\nimport { isLibraryConsole, runAsLibraryConsole } from \"../utils/library-console\";\nimport { patch } from \"../utils/patch\";\nimport { truncate } from \"../utils/sanitize\";\nimport { allowInWindow, type StormWindow } from \"./storm\";\nimport type { Capture, CaptureContext } from \"./types\";\n\n/** The console methods this capture can wrap. */\nconst METHODS: readonly CapturedConsoleMethod[] = [\"error\", \"warn\", \"info\", \"log\"];\n\n/** Methods that `capture.console: true` wraps. */\nconst DEFAULT_METHODS: readonly CapturedConsoleMethod[] = [\"error\", \"warn\"];\n\n/** Signature of a console method. */\ntype ConsoleFn = (...args: unknown[]) => void;\n\n/** A wrapper's record function. Uninstall sets it to null. */\ninterface Target {\n /** Records one call, or null after uninstall. */\n record: ((args: unknown[]) => void) | null;\n}\n\n/** A wrapper's target, plus the function that undoes its patch. */\ninterface Wrapped {\n /** The wrapper's target. */\n target: Target;\n /** Puts the original back if the method still holds the wrapper. Returns true if it did. */\n restore: () => boolean;\n}\n\n/**\n * Builds a wrapper that calls the original first, then the target.\n * The wrapper doesn't close over the capture, so one that stays in place keeps no runtime alive.\n * @param original The method that was in place before the wrap.\n * @param target The wrapper's target.\n * @returns The wrapper.\n */\nfunction makeWrapper(original: ConsoleFn, target: Target): ConsoleFn {\n return (...args) => {\n // Call the original first, so devtools shows the same text even when the record fails.\n Reflect.apply(original, console, args);\n\n // Skip the lines the library itself prints.\n if (isLibraryConsole()) {\n return;\n }\n\n target.record?.(args);\n };\n}\n\n/** Wraps the selected console methods and records every call as a record or a breadcrumb. */\nexport class ConsoleCapture implements Capture {\n /** Capture module identifier. */\n readonly name = \"console\";\n\n /** Active wrappers. A wrapper that isn't in this map only calls the original. */\n private readonly wrapped = new Map<CapturedConsoleMethod, Wrapped>();\n\n /** Guards against wrapping a method twice. */\n private installed = false;\n\n /** This capture's own rate limit, so console noise can't eat the error capture's allowance. */\n private readonly window: StormWindow = { start: 0, count: 0 };\n\n /**\n * @param ctx Capture context: configuration, diagnostics, logger and breadcrumbs.\n */\n constructor(private readonly ctx: CaptureContext) {}\n\n /** Wraps every selected method. */\n install(): void {\n // Some worker realms don't define console, so guard against a missing one.\n if (this.installed || typeof console === \"undefined\") {\n return;\n }\n this.installed = true;\n\n for (const method of this.readMethods()) {\n this.wrap(method);\n }\n }\n\n /** Restores every method that still holds this capture's wrapper. */\n uninstall(): void {\n if (!this.installed) {\n return;\n }\n this.installed = false;\n\n for (const [method, { target, restore }] of this.wrapped) {\n target.record = null;\n\n if (restore()) {\n continue;\n }\n\n // Restoring here would remove the other script's wrapper, so leave it. Our wrapper now\n // only calls the original.\n this.ctx.diagnostics.report(\n \"capture.install_failed\",\n `Another script wrapped console.${method} after the library. The library leaves that wrapper in place.`,\n );\n }\n\n this.wrapped.clear();\n }\n\n /**\n * Reads the methods from the configuration and reports any value it can't use.\n * @returns Methods to wrap, with no duplicates.\n */\n private readMethods(): readonly CapturedConsoleMethod[] {\n const { console: setting } = this.ctx.config.capture;\n\n if (setting === true) {\n return DEFAULT_METHODS;\n }\n\n const levels: unknown = isObject(setting) ? setting.levels : undefined;\n\n if (\n Array.isArray(levels) &&\n levels.every((method: unknown) => METHODS.includes(method as CapturedConsoleMethod))\n ) {\n return [...new Set(levels as CapturedConsoleMethod[])];\n }\n\n this.ctx.diagnostics.report(\n \"config.invalid\",\n 'capture.console must be true or an object with a list of \"error\", \"warn\", \"info\" and \"log\" in levels. The console capture is off.',\n );\n return [];\n }\n\n /**\n * Replaces one console method with a wrapper that calls the original first.\n * @param method Console method to wrap.\n */\n private wrap(method: CapturedConsoleMethod): void {\n const target: Target = {\n record: (args) => {\n // The scope keeps a console call inside the record path from being captured again.\n runAsLibraryConsole(() => {\n this.ctx.diagnostics.guard(\n \"capture.record_failed\",\n `The library could not record a console.${method} call.`,\n () => {\n this.record(method, args);\n },\n );\n });\n },\n };\n\n // patch keeps the unbound method, so uninstall restores the same function, not a bound copy.\n const restore = patch(console, method, (original) => makeWrapper(original, target));\n this.wrapped.set(method, { target, restore });\n }\n\n /**\n * Records one console call.\n * @param method The console method that was called.\n * @param args The call's arguments.\n */\n private record(method: CapturedConsoleMethod, args: unknown[]): void {\n // Duck typing also finds an error from another realm, which fails `instanceof Error`.\n const errorAt = args.findIndex((arg) => isErrorLike(arg));\n const textAt = args.findIndex((arg) => typeof arg === \"string\");\n const error = args[errorAt] as ErrorLike | undefined;\n const message = (args[textAt] as string | undefined) ?? error?.message ?? `console.${method}`;\n\n if (method === \"info\" || method === \"log\") {\n this.ctx.breadcrumbs.push({\n t: Date.now(),\n category: \"console\",\n message: truncate(message, CONSOLE_BREADCRUMB_MAX_CHARS),\n data: { \"console.method\": method },\n });\n return;\n }\n\n const { diagnostics, logger } = this.ctx;\n\n if (\n !allowInWindow(\n this.window,\n this.ctx.config.captureLimits.consolePerWindow,\n diagnostics,\n \"console records\",\n this.ctx.config.captureLimits.windowMs,\n )\n ) {\n return;\n }\n\n // The record builder sanitizes the arguments. A warn record keeps its Error among them.\n const used = method === \"error\" ? [textAt, errorAt] : [textAt];\n const rest = args.filter((_, index) => !used.includes(index));\n const attrs: Record<string, unknown> = { \"console.method\": method };\n\n if (rest.length > 0) {\n attrs[\"console.args\"] = rest;\n }\n\n if (method === \"warn\") {\n logger.warn(message, attrs);\n return;\n }\n\n logger.error(message, error, { ...attrs, \"error.captured_by\": \"console.error\" });\n }\n}\n"],"mappings":"A,gRAeA,IAAMa,EAA4C,CAAC,QAAS,OAAQ,OAAQ,KAAK,EAG3EC,EAAoD,CAAC,QAAS,MAAM,EA0B1E,SAASC,EAAY,EAAqB,EAA2B,CACnE,OAAQ,GAAGC,IAAS,CAElB,QAAQ,MAAMC,EAAU,QAASD,CAAI,EAGjChB,EAAAA,EAAiB,GAIrBkB,EAAO,SAASF,CAAI,CACtB,CACF,CAGA,IAAaG,EAAb,KAA+C,CAgB7C,YAAY,EAAsC,CAArBP,EAAA,EAAA,KAAA,MAAA,IAAA,EAAA,EAd7BA,EAAA,EAAA,KAAA,OAAgB,SAAA,EAGhBA,EAAA,EAAA,KAAA,UAA2B,IAAI,GAAoC,EAGnEA,EAAA,EAAA,KAAA,YAAoB,EAAA,EAGpBA,EAAA,EAAA,KAAA,SAAuC,CAAE,MAAO,EAAG,MAAO,CAAE,CAAA,EAK/B,KAAA,IAAAQ,CAAsB,CAGnD,SAAgB,CAEd,GAAI,OAAK,WAAa,OAAO,QAAY,KAGzC,MAAK,UAAY,GAEjB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AAWP,IAErF,GAAIA,IAAW,QAAUA,IAAW,MAAO,CACzC,KAAK,IAAI,YAAY,KAAK,CACxB,EAAG,KAAK,IAAI,EACZ,SAAU,UACV,QAASjB,EAAAA,EAASyB,EAAA,GAAqC,EACvD,KAAM,CAAE,iBAAkBR,CAAO,CACnC,CAAC,EACD,MACF,CAEA,GAAM,CAAE,cAAa,UAAW,KAAK,IAErC,GACE,CAAChB,EAAAA,EACC,KAAK,OACL,KAAK,IAAI,OAAO,cAAc,iBAC9ByB,EACA,kBACA,KAAK,IAAI,OAAO,cAAc,QAChC,EAEA,OAIF,IAAMC,EAAOV,IAAW,QAAU,CAACM,EAAQF,CAAO,EAAI,CAACE,CAAM,EACvDK,EAAOhB,EAAK,QAAQ,EAAG,IAAU,CAACe,EAAK,SAASE,CAAK,CAAC,EACtDC,EAAiC,CAAE,iBAAkBb,CAAO,EAE9DW,EAAK,OAAS,IAChB,EAAM,gBAAkBA,GAGtBX,IAAW,OACbc,EAAO,KAAKN,EAASK,CAAK,EAI5BC,EAAO,MAAMN,EAASD,EAAO,CAAE,GAAGM,EAAO,oBAAqB,eAAgB,CAAC,CACjF,CACF,E"}
@@ -1,12 +1,12 @@
1
1
  // src/constants.ts
2
- var ee = "[ui-observability]", te = 1e3, ne = "ui-observability.session", e = "ui-observability.tab", t = "ui-observability.alive", re = 3e4, n = 18e5, ie = 6e4, ae = /OpenFin/i, oe = /\bwv\b/, se = /\b(iPhone|iPad|iPod)\b/, ce = /\bMacintosh\b/, le = /\bMobile\b/, ue = "AppleWebKit", de = "Safari/", r = 55296, i = 56319, a = 2048, o = {
2
+ var ee = "[ui-observability]", te = 1e3, e = "ui-observability.session", t = "ui-observability.tab", n = "ui-observability.alive", r = 3e4, i = 18e5, a = 6e4, ne = /OpenFin/i, re = /\bwv\b/, ie = /\b(iPhone|iPad|iPod)\b/, o = /\bMacintosh\b/, s = /\bMobile\b/, c = "AppleWebKit", l = "Safari/", u = 55296, d = 56319, f = 2048, p = {
3
3
  TRACE: 1,
4
4
  DEBUG: 5,
5
5
  INFO: 9,
6
6
  WARN: 13,
7
7
  ERROR: 17,
8
8
  FATAL: 21
9
- }, s = o, c = "log.type", l = "log.seq", u = "app.namespace", d = "page.url", f = "url.full", p = "journey.id", m = "journey.name", h = "journey.parent_id", g = "uiobs.sanitize_failed", _ = "error.data", v = "breadcrumbs", y = "uiobs.attributes_dropped", b = "uiobs.attributes_bytes", x = "uiobs.clock_offset_ms", S = "uiobs.debug_buffer", C = "service.name", w = "service.version", T = "deployment.environment", E = "telemetry.sdk.name", D = "telemetry.sdk.version", O = "telemetry.sdk.language", k = "host.platform", A = "session.id", j = "tab.id", M = "context.id", N = "browser.user_agent", P = "openfin.uuid", F = "openfin.name", I = "@utk09/ui-observability", L = "1.1.0", R = "webjs", z = "otlp", B = { WARN: "warning" }, V = "8.10.0", H = "application/json", fe = "application/x-ndjson", pe = 1000000n, me = /^\d+$/, he = "Content-Type", ge = "Content-Encoding", _e = "Retry-After", ve = "X-UiObs-Batch-Id", ye = "X-UiObs-Attempt", be = "X-UiObs-Sampling", xe = "Date", Se = "gzip", Ce = 1e3, we = 6e4, Te = 16384, Ee = "text/plain;charset=UTF-8", De = "uiobs_batch_id", Oe = "uiobs_exit", ke = "ui-observability.batch.", Ae = "ui-observability.emergency.", je = "ui-observability.probe", Me = "QuotaExceededError", Ne = "batches", Pe = "createdAt", Fe = "indexeddb", Ie = "localstorage", Le = "memory", Re = "none", ze = "ui-observability.drain", Be = "ui-observability.emergency", Ve = "ui-observability.journey", He = /* @__PURE__ */ RegExp("^[\\w.:-]{1,64}$"), Ue = 3e5, We = 2e3, Ge = "uiObsJourney", Ke = /\+/g, qe = /\//g, Je = /=+$/, Ye = /-/g, Xe = /_/g, U = 3e5, Ze = "traceparent", Qe = 2166136261, $e = 16777619, et = 4294967295, tt = [
9
+ }, m = p, h = "log.type", g = "log.seq", _ = "app.namespace", v = "page.url", y = "url.full", b = "journey.id", x = "journey.name", S = "journey.parent_id", ae = "uiobs.sanitize_failed", oe = "error.data", se = "breadcrumbs", ce = "uiobs.attributes_dropped", le = "uiobs.attributes_bytes", ue = "uiobs.clock_offset_ms", de = "uiobs.debug_buffer", C = "service.name", w = "service.version", T = "deployment.environment", E = "telemetry.sdk.name", D = "telemetry.sdk.version", O = "telemetry.sdk.language", k = "host.platform", A = "session.id", j = "tab.id", M = "context.id", N = "browser.user_agent", P = "openfin.uuid", F = "openfin.name", I = "@utk09/ui-observability", L = "1.2.0", R = "webjs", z = "otlp", B = { WARN: "warning" }, V = "8.10.0", H = "application/json", fe = "application/x-ndjson", pe = 1000000n, me = /^\d+$/, he = "Content-Type", ge = "Content-Encoding", _e = "Retry-After", ve = "X-UiObs-Batch-Id", ye = "X-UiObs-Attempt", be = "X-UiObs-Sampling", xe = "Date", Se = "gzip", Ce = 1e3, we = 6e4, Te = 16384, Ee = "text/plain;charset=UTF-8", De = "uiobs_batch_id", Oe = "uiobs_exit", ke = "ui-observability.batch.", Ae = "ui-observability.emergency.", je = "ui-observability.probe", Me = "QuotaExceededError", Ne = "batches", Pe = "createdAt", Fe = "indexeddb", Ie = "localstorage", Le = "memory", Re = "none", ze = "ui-observability.drain", Be = "ui-observability.emergency", Ve = "ui-observability.journey", He = /* @__PURE__ */ RegExp("^[\\w.:-]{1,64}$"), Ue = 3e5, We = 2e3, Ge = "uiObsJourney", Ke = /\+/g, qe = /\//g, Je = /=+$/, Ye = /-/g, Xe = /_/g, U = 3e5, Ze = "traceparent", Qe = 2166136261, $e = 16777619, et = 4294967295, tt = [
10
10
  "action",
11
11
  "metric",
12
12
  "span"
@@ -61,7 +61,28 @@ var ee = "[ui-observability]", te = 1e3, ne = "ui-observability.session", e = "u
61
61
  "metric.unit",
62
62
  "metric.type",
63
63
  ...Object.values(q)
64
- ], Ot = 67108863, kt = "ui.profile.duration", At = {
64
+ ], Ot = [
65
+ h,
66
+ g,
67
+ _,
68
+ v,
69
+ b,
70
+ x,
71
+ S,
72
+ C,
73
+ w,
74
+ T,
75
+ E,
76
+ D,
77
+ O,
78
+ k,
79
+ A,
80
+ j,
81
+ M,
82
+ N,
83
+ P,
84
+ F
85
+ ], kt = 67108863, At = "ui.profile.duration", jt = {
65
86
  probe: "profile.probe",
66
87
  sampleEvery: "profile.sample_every",
67
88
  p50: "profile.p50",
@@ -70,7 +91,7 @@ var ee = "[ui-observability]", te = 1e3, ne = "ui-observability.session", e = "u
70
91
  overhead: "profile.overhead_ns",
71
92
  selfP99: "profile.self_p99",
72
93
  framePhase: "profile.frame_phase"
73
- }, jt = "ui.profile.frame.duration", Mt = "frame.interval", Nt = "The library could not read the options of an instrument. The library uses the defaults.", Pt = "replay.id", Ft = "data-observability-unmask", It = 1024, Lt = "ui-observability.profiler", Rt = 1e5, zt = "uiobs.traces", Bt = {
94
+ }, Mt = "ui.profile.frame.duration", Nt = "frame.interval", Pt = "The library could not read the options of an instrument. The library uses the defaults.", Ft = "replay.id", It = "data-observability-unmask", Lt = 1024, Rt = "ui-observability.profiler", zt = 1e5, Bt = "uiobs.traces", Vt = {
74
95
  kind: "span.kind",
75
96
  parentId: "span.parent_id",
76
97
  start: "span.start_time_unix_nano",
@@ -84,12 +105,12 @@ var ee = "[ui-observability]", te = 1e3, ne = "ui-observability.session", e = "u
84
105
  send: "send",
85
106
  result: "result",
86
107
  cancel: "cancel"
87
- }, Vt = {
108
+ }, Ht = {
88
109
  p: J,
89
110
  v: L,
90
111
  t: Y.ready,
91
112
  ok: !1
92
- }, Ht = 1e3, Ut = 1e3, Wt = 1e3, Gt = 1e3, Kt = "Server-Timing", qt = 4096, Jt = [
113
+ }, Ut = 1e3, Wt = 1e3, Gt = 1e3, Kt = 1e3, qt = "Server-Timing", Jt = 4096, Yt = [
93
114
  "errors",
94
115
  "rejections",
95
116
  "resourceErrors",
@@ -108,7 +129,7 @@ var ee = "[ui-observability]", te = 1e3, ne = "ui-observability.session", e = "u
108
129
  "reports",
109
130
  "resourceTiming",
110
131
  "lifecycle"
111
- ], Yt = "unknown-service", Xt = 4096, Zt = 36e5, Qt = 3e4, $t = [
132
+ ], Xt = "unknown-service", Zt = 4096, Qt = 36e5, $t = 3e4, en = [
112
133
  "contextProvider",
113
134
  "redact",
114
135
  "onDiagnostic",
@@ -119,7 +140,7 @@ var ee = "[ui-observability]", te = 1e3, ne = "ui-observability.session", e = "u
119
140
  "transport",
120
141
  "transportOnExit",
121
142
  "transportWorker"
122
- ], en = [
143
+ ], tn = [
123
144
  "captureLimits",
124
145
  "metadata",
125
146
  "storage",
@@ -140,7 +161,7 @@ var ee = "[ui-observability]", te = 1e3, ne = "ui-observability.session", e = "u
140
161
  "debugBuffer",
141
162
  "profiler",
142
163
  "replay"
143
- ], tn = {
164
+ ], nn = {
144
165
  captureLimits: [],
145
166
  metadata: [],
146
167
  storage: [],
@@ -161,11 +182,11 @@ var ee = "[ui-observability]", te = 1e3, ne = "ui-observability.session", e = "u
161
182
  debugBuffer: [],
162
183
  profiler: [],
163
184
  replay: []
164
- }, nn = "DEBUG", rn = 2e3, an = 1e4, X = 15e3, on = 1024, sn = "UiObservability", cn = {
185
+ }, rn = "DEBUG", an = 2e3, on = 1e4, X = 15e3, sn = 1024, cn = "UiObservability", ln = {
165
186
  maxBatches: 500,
166
187
  maxAgeMs: 864e5,
167
188
  maxAttempts: 5
168
- }, ln = 1e4, un = 5e3, dn = 6e5, fn = 2e3, pn = 6e4, mn = 3e4, Z = 18e5, hn = "__uiobs_journey", gn = "ui_observability_control", _n = 1500, vn = 1e3, yn = .9, bn = 2e3, xn = 5e3, Q = {
189
+ }, un = 1e4, dn = 5e3, fn = 6e5, pn = 2e3, mn = 6e4, hn = 3e4, Z = 18e5, gn = "__uiobs_journey", _n = "ui_observability_control", vn = 1500, yn = 1e3, bn = .9, xn = 2e3, Sn = 5e3, Q = {
169
190
  maxBodyChars: 4096,
170
191
  maxAttributeChars: 8192,
171
192
  maxAttributeCount: 128,
@@ -183,10 +204,10 @@ var ee = "[ui-observability]", te = 1e3, ne = "ui-observability.session", e = "u
183
204
  transport: void 0,
184
205
  transportOnExit: void 0,
185
206
  transportWorker: void 0
186
- }, Sn = Object.keys($), Cn = {
207
+ }, Cn = Object.keys($), wn = {
187
208
  captureLimits: {
188
209
  breadcrumbs: 50,
189
- errorDedupeMs: xn,
210
+ errorDedupeMs: Sn,
190
211
  errorsPerWindow: 20,
191
212
  consolePerWindow: 20,
192
213
  longFramesPerWindow: 20,
@@ -250,11 +271,11 @@ var ee = "[ui-observability]", te = 1e3, ne = "ui-observability.session", e = "u
250
271
  records: !1
251
272
  },
252
273
  correlation: {
253
- sessionIdleMs: n,
274
+ sessionIdleMs: i,
254
275
  traceMaxAgeMs: U
255
276
  },
256
277
  metrics: {
257
- intervalMs: an,
278
+ intervalMs: on,
258
279
  maxSeries: 100,
259
280
  maxInstruments: 1e3,
260
281
  maxHistogramBoundaries: 50
@@ -268,8 +289,8 @@ var ee = "[ui-observability]", te = 1e3, ne = "ui-observability.session", e = "u
268
289
  delivery: {
269
290
  requestTimeoutMs: X,
270
291
  maxConcurrentRequests: 2,
271
- retryBaseDelayMs: fn,
272
- retryMaxDelayMs: pn,
292
+ retryBaseDelayMs: pn,
293
+ retryMaxDelayMs: mn,
273
294
  priority: "low"
274
295
  },
275
296
  lockConfiguration: !1,
@@ -316,11 +337,11 @@ var ee = "[ui-observability]", te = 1e3, ne = "ui-observability.session", e = "u
316
337
  maxAgeMs: Z
317
338
  },
318
339
  batching: {
319
- logFlushIntervalMs: rn,
340
+ logFlushIntervalMs: an,
320
341
  logBatchSize: 100,
321
342
  metricBatchSize: 500
322
343
  },
323
- retention: { ...cn },
344
+ retention: { ...ln },
324
345
  limits: { ...Q },
325
346
  capture: {
326
347
  errors: !0,
@@ -352,6 +373,6 @@ var ee = "[ui-observability]", te = 1e3, ne = "ui-observability.session", e = "u
352
373
  styles: K
353
374
  }
354
375
  };
355
- export { V as $, je as $n, It as $t, _n as A, D as An, s as At, fe as B, qt as Bn, q as Bt, Je as C, C as Cn, se as Ct, we as D, j as Dn, Ve as Dt, ke as E, Gt as En, Z as Et, on as F, ot as Fn, W as Ft, Cn as G, Bt as Gn, pe as Gt, vt as H, ne as Hn, Ce as Ht, en as I, st as In, rt as It, Wt as J, xt as Jn, Ge as Jt, Ct as K, sn as Kn, ht as Kt, nn as L, de as Ln, ce as Lt, it as M, mn as Mn, ee as Mt, at as N, Sn as Nn, lt as Nt, gn as O, O as On, hn as Ot, bt as P, $ as Pn, nt as Pt, B as Q, Re as Qn, Lt as Qt, K as R, z as Rn, Et as Rt, Xe as S, P as Sn, Nt as St, qe as T, A as Tn, He as Tt, mt as U, ie as Un, le as Ut, Ee as V, n as Vn, wt as Vt, _t as W, o as Wn, me as Wt, te as X, Ie as Xn, ae as Xt, St as Y, Fe as Yn, We as Yt, ze as Z, Le as Zn, Rt as Zt, Tt as _, N as _n, Ht as _r, i as _t, u as a, De as an, U as ar, dn as at, f as b, k as bn, Pe as bt, v as c, gt as cn, J as cr, $e as ct, _ as d, Xt as dn, et as dr, ve as dt, jt as en, e as er, Be as et, p as f, Zt as fn, $t as fr, ge as ft, c as g, X as gn, ue as gr, be as gt, l as h, Ft as hn, a as hr, _e as ht, oe as i, kt as in, Ze as ir, yn as it, bn as j, Te as jn, ut as jt, vn as k, E as kn, tt as kt, x as l, Q as ln, Vt as lr, yt as lt, h as m, Pt as mn, Yt as mr, xe as mt, t as n, At as nn, I as nr, Se as nt, b as o, Oe as on, zt as or, un as ot, m as p, Qt as pn, tn as pr, he as pt, Ut as q, ln as qn, ct as qt, re as r, Ot as rn, L as rr, G as rt, y as s, Me as sn, dt as sr, Qe as st, ft as t, Mt as tn, R as tr, Ae as tt, S as u, Jt as un, Y as ur, ye as ut, d as v, M as vn, r as vt, Ke as w, w as wn, Ue as wt, Ye as x, F as xn, Ne as xt, g as y, T as yn, pt as yt, H as z, Kt as zn, Dt as zt };
376
+ export { V as $, Re as $n, Lt as $t, vn as A, E as An, m as At, fe as B, qt as Bn, q as Bt, Je as C, P as Cn, ie as Ct, we as D, Kt as Dn, Ve as Dt, ke as E, A as En, Z as Et, sn as F, $ as Fn, W as Ft, wn as G, p as Gn, pe as Gt, vt as H, i as Hn, Ce as Ht, tn as I, ot as In, rt as It, Gt as J, un as Jn, Ge as Jt, Ct as K, Vt as Kn, ht as Kt, rn as L, st as Ln, o as Lt, it as M, Te as Mn, ee as Mt, at as N, hn as Nn, lt as Nt, _n as O, j as On, gn as Ot, bt as P, Cn as Pn, nt as Pt, B as Q, Le as Qn, Rt as Qt, K as R, l as Rn, Et as Rt, Xe as S, F as Sn, Pt as St, qe as T, w as Tn, He as Tt, mt as U, e as Un, s as Ut, Ee as V, Jt as Vn, wt as Vt, _t as W, a as Wn, me as Wt, te as X, Fe as Xn, ne as Xt, St as Y, xt as Yn, We as Yt, ze as Z, Ie as Zn, zt as Zt, Tt as _, X as _n, c as _r, d as _t, _ as a, De as an, Ze as ar, fn as at, y as b, T as bn, Pe as bt, se as c, gt as cn, dt as cr, $e as ct, oe as d, Yt as dn, Y as dr, ve as dt, Mt as en, je as er, Be as et, b as f, Zt as fn, et as fr, ge as ft, h as g, It as gn, f as gr, be as gt, g as h, Ft as hn, Xt as hr, _e as ht, re as i, At as in, L as ir, bn as it, xn as j, D as jn, ut as jt, yn as k, O as kn, tt as kt, ue as l, Ot as ln, J as lr, yt as lt, S as m, $t as mn, nn as mr, xe as mt, n, jt as nn, R as nr, Se as nt, le as o, Oe as on, U as or, dn as ot, x as p, Qt as pn, en as pr, he as pt, Wt as q, cn as qn, ct as qt, r, kt as rn, I as rr, G as rt, ce as s, Me as sn, Bt as sr, Qe as st, ft as t, Nt as tn, t as tr, Ae as tt, de as u, Q as un, Ht as ur, ye as ut, v, N as vn, Ut as vr, u as vt, Ke as w, C as wn, Ue as wt, Ye as x, k as xn, Ne as xt, ae as y, M as yn, pt as yt, H as z, z as zn, Dt as zt };
356
377
 
357
- //# sourceMappingURL=constants-BwJDXzj6.js.map
378
+ //# sourceMappingURL=constants-CEHN6KuY.js.map