@utk09/ui-observability 1.0.0 → 1.1.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 (221) hide show
  1. package/CHANGELOG.md +69 -219
  2. package/README.md +24 -26
  3. package/dist/{batch-CXmPmTse.js → batch-D3NHhF9L.js} +3 -3
  4. package/dist/{batch-CXmPmTse.js.map → batch-D3NHhF9L.js.map} +1 -1
  5. package/dist/{batch-mmPigCpi.cjs → batch-DnYRJqhU.cjs} +2 -2
  6. package/dist/{batch-mmPigCpi.cjs.map → batch-DnYRJqhU.cjs.map} +1 -1
  7. package/dist/bus/bus.d.cts +26 -2
  8. package/dist/bus/bus.d.ts +26 -2
  9. package/dist/bus-B__467mL.cjs +2 -0
  10. package/dist/bus-B__467mL.cjs.map +1 -0
  11. package/dist/{bus-C39wspFV.js → bus-dw7T92sO.js} +37 -24
  12. package/dist/bus-dw7T92sO.js.map +1 -0
  13. package/dist/capture/interactions.d.cts +35 -3
  14. package/dist/capture/interactions.d.ts +35 -3
  15. package/dist/capture/observed-windows.d.cts +51 -0
  16. package/dist/capture/observed-windows.d.ts +51 -0
  17. package/dist/{compression-CvED_Jel.cjs → compression-C0hUHKR-.cjs} +2 -2
  18. package/dist/{compression-CvED_Jel.cjs.map → compression-C0hUHKR-.cjs.map} +1 -1
  19. package/dist/{compression-tVtXwVjX.js → compression-SHPAvS4U.js} +2 -2
  20. package/dist/{compression-tVtXwVjX.js.map → compression-SHPAvS4U.js.map} +1 -1
  21. package/dist/{config-SgQcCP1_.js → config-CSNcS7OZ.js} +194 -196
  22. package/dist/config-CSNcS7OZ.js.map +1 -0
  23. package/dist/config-CybPP5VM.cjs +2 -0
  24. package/dist/config-CybPP5VM.cjs.map +1 -0
  25. package/dist/{console-BGgGnjSi.js → console-BsM-fSCQ.js} +4 -4
  26. package/dist/{console-BGgGnjSi.js.map → console-BsM-fSCQ.js.map} +1 -1
  27. package/dist/{console-CSZ5_Vx5.cjs → console-Dkxs6IVQ.cjs} +2 -2
  28. package/dist/{console-CSZ5_Vx5.cjs.map → console-Dkxs6IVQ.cjs.map} +1 -1
  29. package/dist/{constants-CUyd9cTZ.js → constants-BwJDXzj6.js} +23 -23
  30. package/dist/constants-BwJDXzj6.js.map +1 -0
  31. package/dist/constants-CtF52hIV.cjs +2 -0
  32. package/dist/constants-CtF52hIV.cjs.map +1 -0
  33. package/dist/constants.d.cts +12 -0
  34. package/dist/constants.d.ts +12 -0
  35. package/dist/core/diagnostics.d.cts +1 -1
  36. package/dist/core/diagnostics.d.ts +1 -1
  37. package/dist/core/rotation.d.cts +26 -2
  38. package/dist/core/rotation.d.ts +26 -2
  39. package/dist/core/runtime.d.cts +9 -0
  40. package/dist/core/runtime.d.ts +9 -0
  41. package/dist/{debug-bundle-BXIlwDKM.cjs → debug-bundle-B2v6Cym-.cjs} +2 -2
  42. package/dist/{debug-bundle-BXIlwDKM.cjs.map → debug-bundle-B2v6Cym-.cjs.map} +1 -1
  43. package/dist/{debug-bundle-CRpYV_ui.js → debug-bundle-Cs_YWzTa.js} +4 -4
  44. package/dist/{debug-bundle-CRpYV_ui.js.map → debug-bundle-Cs_YWzTa.js.map} +1 -1
  45. package/dist/doctor.cjs +1 -1
  46. package/dist/doctor.js +31 -31
  47. package/dist/doctor.js.map +1 -1
  48. package/dist/{errors-CNPbesMs.cjs → errors-DP2RUm4V.cjs} +2 -2
  49. package/dist/{errors-CNPbesMs.cjs.map → errors-DP2RUm4V.cjs.map} +1 -1
  50. package/dist/{errors-BE_EZV7Q.js → errors-Q3Ng1ciC.js} +3 -3
  51. package/dist/{errors-BE_EZV7Q.js.map → errors-Q3Ng1ciC.js.map} +1 -1
  52. package/dist/{factory-CTi0Is3F.js → factory-DV17sm2p.js} +22 -22
  53. package/dist/{factory-CTi0Is3F.js.map → factory-DV17sm2p.js.map} +1 -1
  54. package/dist/{factory-hRrH32v5.cjs → factory-K8O6gpux.cjs} +2 -2
  55. package/dist/{factory-hRrH32v5.cjs.map → factory-K8O6gpux.cjs.map} +1 -1
  56. package/dist/{identity-DdhKgrpk.js → identity-BgtHyY4u.js} +38 -27
  57. package/dist/identity-BgtHyY4u.js.map +1 -0
  58. package/dist/identity-CvuyqZk7.cjs +2 -0
  59. package/dist/identity-CvuyqZk7.cjs.map +1 -0
  60. package/dist/index.cjs +1 -1
  61. package/dist/index.cjs.map +1 -1
  62. package/dist/index.d.cts +1 -0
  63. package/dist/index.d.ts +1 -0
  64. package/dist/index.js +600 -569
  65. package/dist/index.js.map +1 -1
  66. package/dist/{indexeddb-storage-CL9uqBCy.cjs → indexeddb-storage-D4KVcqdD.cjs} +2 -2
  67. package/dist/{indexeddb-storage-CL9uqBCy.cjs.map → indexeddb-storage-D4KVcqdD.cjs.map} +1 -1
  68. package/dist/{indexeddb-storage-GHdl0t8A.js → indexeddb-storage-e-13ZLWm.js} +17 -17
  69. package/dist/{indexeddb-storage-GHdl0t8A.js.map → indexeddb-storage-e-13ZLWm.js.map} +1 -1
  70. package/dist/interactions-Byxf1C82.js +207 -0
  71. package/dist/interactions-Byxf1C82.js.map +1 -0
  72. package/dist/interactions-OK85T-Dk.cjs +2 -0
  73. package/dist/interactions-OK85T-Dk.cjs.map +1 -0
  74. package/dist/{journey-D2_sia57.js → journey-C93FTYcs.js} +14 -14
  75. package/dist/{journey-D2_sia57.js.map → journey-C93FTYcs.js.map} +1 -1
  76. package/dist/{journey-B4Adltjm.cjs → journey-nMbob3OB.cjs} +2 -2
  77. package/dist/{journey-B4Adltjm.cjs.map → journey-nMbob3OB.cjs.map} +1 -1
  78. package/dist/{library-console-CPW6bvZH.cjs → library-console-DJUQzcgM.cjs} +2 -2
  79. package/dist/{library-console-CPW6bvZH.cjs.map → library-console-DJUQzcgM.cjs.map} +1 -1
  80. package/dist/{library-console-Btrzt814.js → library-console-DklSmucS.js} +2 -2
  81. package/dist/{library-console-Btrzt814.js.map → library-console-DklSmucS.js.map} +1 -1
  82. package/dist/{library-request-BJ9PLRaD.js → library-request-UGEwOHpf.js} +2 -2
  83. package/dist/{library-request-BJ9PLRaD.js.map → library-request-UGEwOHpf.js.map} +1 -1
  84. package/dist/{library-request-D7OvTxZV.cjs → library-request-kY9iTpIF.cjs} +2 -2
  85. package/dist/{library-request-D7OvTxZV.cjs.map → library-request-kY9iTpIF.cjs.map} +1 -1
  86. package/dist/{lifecycle-22CUCrc9.js → lifecycle-B2PlIuQu.js} +2 -2
  87. package/dist/{lifecycle-22CUCrc9.js.map → lifecycle-B2PlIuQu.js.map} +1 -1
  88. package/dist/{lifecycle-IaAm1mOC.cjs → lifecycle-DaMdH_X7.cjs} +2 -2
  89. package/dist/{lifecycle-IaAm1mOC.cjs.map → lifecycle-DaMdH_X7.cjs.map} +1 -1
  90. package/dist/{log-record-CkivuiEl.cjs → log-record-Bmx6etMh.cjs} +2 -2
  91. package/dist/{log-record-CkivuiEl.cjs.map → log-record-Bmx6etMh.cjs.map} +1 -1
  92. package/dist/{log-record-BNiLfqtL.js → log-record-DSt2P-Sr.js} +2 -2
  93. package/dist/{log-record-BNiLfqtL.js.map → log-record-DSt2P-Sr.js.map} +1 -1
  94. package/dist/{long-frames-DNFaRnC3.js → long-frames-Bamjs1WV.js} +3 -3
  95. package/dist/{long-frames-DNFaRnC3.js.map → long-frames-Bamjs1WV.js.map} +1 -1
  96. package/dist/{long-frames-BUUbXd-B.cjs → long-frames-lhtONgGt.cjs} +2 -2
  97. package/dist/{long-frames-BUUbXd-B.cjs.map → long-frames-lhtONgGt.cjs.map} +1 -1
  98. package/dist/models/bus.d.cts +6 -1
  99. package/dist/models/bus.d.ts +6 -1
  100. package/dist/models/config.d.cts +23 -8
  101. package/dist/models/config.d.ts +23 -8
  102. package/dist/models/serializer.d.cts +3 -1
  103. package/dist/models/serializer.d.ts +3 -1
  104. package/dist/{network-CGMLQ-mA.cjs → network-BCn8Gn47.cjs} +2 -2
  105. package/dist/{network-CGMLQ-mA.cjs.map → network-BCn8Gn47.cjs.map} +1 -1
  106. package/dist/{network-on2zZT6H.js → network-Cg1L2w2r.js} +12 -12
  107. package/dist/{network-on2zZT6H.js.map → network-Cg1L2w2r.js.map} +1 -1
  108. package/dist/observed-windows-B3gJkdql.cjs +2 -0
  109. package/dist/observed-windows-B3gJkdql.cjs.map +1 -0
  110. package/dist/observed-windows-BrwaJNlj.js +64 -0
  111. package/dist/observed-windows-BrwaJNlj.js.map +1 -0
  112. package/dist/{otlp-BENHf3g9.cjs → otlp-CrAWkQdO.cjs} +2 -2
  113. package/dist/{otlp-BENHf3g9.cjs.map → otlp-CrAWkQdO.cjs.map} +1 -1
  114. package/dist/{otlp-DimfrRor.js → otlp-D6dRZyB8.js} +6 -6
  115. package/dist/{otlp-DimfrRor.js.map → otlp-D6dRZyB8.js.map} +1 -1
  116. package/dist/{platform-BaaFIPCU.js → platform-8DLhjddo.js} +7 -7
  117. package/dist/{platform-BaaFIPCU.js.map → platform-8DLhjddo.js.map} +1 -1
  118. package/dist/{platform-CfA3-7sJ.cjs → platform-BqRc-7RO.cjs} +2 -2
  119. package/dist/{platform-CfA3-7sJ.cjs.map → platform-BqRc-7RO.cjs.map} +1 -1
  120. package/dist/{profiler-BAZoh7A4.js → profiler-BaXSqCfz.js} +59 -59
  121. package/dist/{profiler-BAZoh7A4.js.map → profiler-BaXSqCfz.js.map} +1 -1
  122. package/dist/{profiler-D4tJpDRc.cjs → profiler-BvWW2kNM.cjs} +2 -2
  123. package/dist/{profiler-D4tJpDRc.cjs.map → profiler-BvWW2kNM.cjs.map} +1 -1
  124. package/dist/{profiler-frames-cJMx9wNM.js → profiler-frames-C4ySHN0X.js} +16 -16
  125. package/dist/{profiler-frames-cJMx9wNM.js.map → profiler-frames-C4ySHN0X.js.map} +1 -1
  126. package/dist/{profiler-frames-C4xr7KfH.cjs → profiler-frames-DeaBiB-5.cjs} +2 -2
  127. package/dist/{profiler-frames-C4xr7KfH.cjs.map → profiler-frames-DeaBiB-5.cjs.map} +1 -1
  128. package/dist/{remote-rules-_tY0zj5o.cjs → remote-rules-D7L6D_D2.cjs} +2 -2
  129. package/dist/{remote-rules-_tY0zj5o.cjs.map → remote-rules-D7L6D_D2.cjs.map} +1 -1
  130. package/dist/{remote-rules-Dz9MRAsB.js → remote-rules-Dq9xe7Qn.js} +22 -22
  131. package/dist/{remote-rules-Dz9MRAsB.js.map → remote-rules-Dq9xe7Qn.js.map} +1 -1
  132. package/dist/{replay-Ds-ANH34.js → replay-B0M8kWz_.js} +24 -24
  133. package/dist/{replay-Ds-ANH34.js.map → replay-B0M8kWz_.js.map} +1 -1
  134. package/dist/{replay-B3gFXIZd.cjs → replay-QOFBpAXh.cjs} +2 -2
  135. package/dist/{replay-B3gFXIZd.cjs.map → replay-QOFBpAXh.cjs.map} +1 -1
  136. package/dist/{reports-C-thq-bk.js → reports--8APRLa-.js} +3 -3
  137. package/dist/{reports-C-thq-bk.js.map → reports--8APRLa-.js.map} +1 -1
  138. package/dist/{reports-BDSe4dFH.cjs → reports-ojuMKGO7.cjs} +2 -2
  139. package/dist/{reports-BDSe4dFH.cjs.map → reports-ojuMKGO7.cjs.map} +1 -1
  140. package/dist/{resource-timing-eUl2dNgC.js → resource-timing-BzR05rE-.js} +4 -4
  141. package/dist/{resource-timing-eUl2dNgC.js.map → resource-timing-BzR05rE-.js.map} +1 -1
  142. package/dist/{resource-timing-C576gFIQ.cjs → resource-timing-pAG3ZhB5.cjs} +2 -2
  143. package/dist/{resource-timing-C576gFIQ.cjs.map → resource-timing-pAG3ZhB5.cjs.map} +1 -1
  144. package/dist/{response-body-eoSQpLiH.js → response-body-BWvwKQ2p.js} +106 -106
  145. package/dist/{response-body-eoSQpLiH.js.map → response-body-BWvwKQ2p.js.map} +1 -1
  146. package/dist/{response-body-YdNl-HkR.cjs → response-body-CKEJ5itk.cjs} +3 -3
  147. package/dist/{response-body-YdNl-HkR.cjs.map → response-body-CKEJ5itk.cjs.map} +1 -1
  148. package/dist/{rotation-Cwct4ckk.js → rotation-BylN1B9e.js} +10 -11
  149. package/dist/rotation-BylN1B9e.js.map +1 -0
  150. package/dist/rotation-E2eKClIs.cjs +2 -0
  151. package/dist/rotation-E2eKClIs.cjs.map +1 -0
  152. package/dist/{sampling-mXt4dstx.cjs → sampling-B46LW0cy.cjs} +2 -2
  153. package/dist/{sampling-mXt4dstx.cjs.map → sampling-B46LW0cy.cjs.map} +1 -1
  154. package/dist/{sampling-BlrI8jor.js → sampling-zXA6r-Nw.js} +16 -16
  155. package/dist/{sampling-BlrI8jor.js.map → sampling-zXA6r-Nw.js.map} +1 -1
  156. package/dist/{sanitize-Ba0KqU06.js → sanitize-DjnR6RXR.js} +2 -2
  157. package/dist/{sanitize-Ba0KqU06.js.map → sanitize-DjnR6RXR.js.map} +1 -1
  158. package/dist/{sanitize-DQyiI_KY.cjs → sanitize-Qj6LuZqp.cjs} +2 -2
  159. package/dist/{sanitize-DQyiI_KY.cjs.map → sanitize-Qj6LuZqp.cjs.map} +1 -1
  160. package/dist/{sender-Dv8rAmpV.js → sender-Bdp-TAS4.js} +71 -71
  161. package/dist/{sender-Dv8rAmpV.js.map → sender-Bdp-TAS4.js.map} +1 -1
  162. package/dist/{sender-BdRuNVhF.cjs → sender-DR7ZycZY.cjs} +2 -2
  163. package/dist/{sender-BdRuNVhF.cjs.map → sender-DR7ZycZY.cjs.map} +1 -1
  164. package/dist/{stored-context-CXt7eHZL.cjs → stored-context-BOu54M8Y.cjs} +2 -2
  165. package/dist/{stored-context-CXt7eHZL.cjs.map → stored-context-BOu54M8Y.cjs.map} +1 -1
  166. package/dist/{stored-context-B2EzVuYm.js → stored-context-CSttrAsw.js} +6 -6
  167. package/dist/{stored-context-B2EzVuYm.js.map → stored-context-CSttrAsw.js.map} +1 -1
  168. package/dist/{storm-C-zYSdDX.cjs → storm-BHgI12iS.cjs} +2 -2
  169. package/dist/{storm-C-zYSdDX.cjs.map → storm-BHgI12iS.cjs.map} +1 -1
  170. package/dist/{storm-DjKetLKZ.js → storm-DKlpv0FL.js} +2 -2
  171. package/dist/{storm-DjKetLKZ.js.map → storm-DKlpv0FL.js.map} +1 -1
  172. package/dist/{unclean-exit-py99ApzT.cjs → unclean-exit-BYPYYkQ5.cjs} +2 -2
  173. package/dist/{unclean-exit-py99ApzT.cjs.map → unclean-exit-BYPYYkQ5.cjs.map} +1 -1
  174. package/dist/{unclean-exit-DQD1cT7c.js → unclean-exit-BcOB8A2e.js} +2 -2
  175. package/dist/{unclean-exit-DQD1cT7c.js.map → unclean-exit-BcOB8A2e.js.map} +1 -1
  176. package/dist/{user-timing-BePqb1uN.js → user-timing-4KIJ74Vi.js} +2 -2
  177. package/dist/{user-timing-BePqb1uN.js.map → user-timing-4KIJ74Vi.js.map} +1 -1
  178. package/dist/{user-timing-D6XTmpuM.cjs → user-timing-BsU2wQKE.cjs} +2 -2
  179. package/dist/{user-timing-D6XTmpuM.cjs.map → user-timing-BsU2wQKE.cjs.map} +1 -1
  180. package/dist/utils/identity.d.cts +5 -0
  181. package/dist/utils/identity.d.ts +5 -0
  182. package/dist/{web-socket-CoIUBM3C.cjs → web-socket-Cs1ZbmmN.cjs} +2 -2
  183. package/dist/{web-socket-CoIUBM3C.cjs.map → web-socket-Cs1ZbmmN.cjs.map} +1 -1
  184. package/dist/{web-socket-DSHgDiZ6.js → web-socket-Zg0hj1LB.js} +4 -4
  185. package/dist/{web-socket-DSHgDiZ6.js.map → web-socket-Zg0hj1LB.js.map} +1 -1
  186. package/dist/{worker-protocol-x074Rpet.js → worker-protocol-CYpAbrVl.js} +4 -4
  187. package/dist/{worker-protocol-x074Rpet.js.map → worker-protocol-CYpAbrVl.js.map} +1 -1
  188. package/dist/{worker-protocol-QbvqNazn.cjs → worker-protocol-DFYXIFus.cjs} +2 -2
  189. package/dist/{worker-protocol-QbvqNazn.cjs.map → worker-protocol-DFYXIFus.cjs.map} +1 -1
  190. package/dist/{worker-server-CFe4nvos.cjs → worker-server--yGTadTA.cjs} +2 -2
  191. package/dist/{worker-server-CFe4nvos.cjs.map → worker-server--yGTadTA.cjs.map} +1 -1
  192. package/dist/{worker-server-iUVSjH8L.js → worker-server-BokySIII.js} +25 -25
  193. package/dist/{worker-server-iUVSjH8L.js.map → worker-server-BokySIII.js.map} +1 -1
  194. package/dist/worker-transport-BdEvh_-a.cjs +2 -0
  195. package/dist/worker-transport-BdEvh_-a.cjs.map +1 -0
  196. package/dist/{worker-transport-Dy1KMA7t.js → worker-transport-JK-Fby9J.js} +23 -19
  197. package/dist/worker-transport-JK-Fby9J.js.map +1 -0
  198. package/llms.txt +13 -10
  199. package/package.json +13 -5
  200. package/dist/bus-C39wspFV.js.map +0 -1
  201. package/dist/bus-_EaOVPGq.cjs +0 -2
  202. package/dist/bus-_EaOVPGq.cjs.map +0 -1
  203. package/dist/config-DUs7uHHt.cjs +0 -2
  204. package/dist/config-DUs7uHHt.cjs.map +0 -1
  205. package/dist/config-SgQcCP1_.js.map +0 -1
  206. package/dist/constants-CUyd9cTZ.js.map +0 -1
  207. package/dist/constants-CqdJhTxH.cjs +0 -2
  208. package/dist/constants-CqdJhTxH.cjs.map +0 -1
  209. package/dist/identity-DdhKgrpk.js.map +0 -1
  210. package/dist/identity-DlWRIuwy.cjs +0 -2
  211. package/dist/identity-DlWRIuwy.cjs.map +0 -1
  212. package/dist/interactions-CUkzK8sR.cjs +0 -2
  213. package/dist/interactions-CUkzK8sR.cjs.map +0 -1
  214. package/dist/interactions-DiFvCosX.js +0 -111
  215. package/dist/interactions-DiFvCosX.js.map +0 -1
  216. package/dist/rotation-Cwct4ckk.js.map +0 -1
  217. package/dist/rotation-D4qUAHAu.cjs +0 -2
  218. package/dist/rotation-D4qUAHAu.cjs.map +0 -1
  219. package/dist/worker-transport-CRAX-09c.cjs +0 -2
  220. package/dist/worker-transport-CRAX-09c.cjs.map +0 -1
  221. package/dist/worker-transport-Dy1KMA7t.js.map +0 -1
@@ -1 +1 @@
1
- {"version":3,"file":"otlp-BENHf3g9.cjs","names":["items","nested","ATTR_APP_NAMESPACE","TELEMETRY_SDK_NAME","SERIALIZER_NAME_OTLP","CONTENT_TYPE_JSON","require_constants","toAnyValue","value","item","toKeyValues","out","key","raw","source","resourceKeys","resourceKey","cached","resource","groupByResource","groups","record","records","group","groupByScope","namespace","name","scoped","otlpSerializer","resourceLogs","scope"],"sources":["../src/transport/serializers/otlp.ts"],"sourcesContent":["// src/transport/serializers/otlp.ts\n//\n// Serializes log batches as OTLP/JSON log records. Records are grouped by resource, and each\n// logger namespace gets its own instrumentation scope.\n// The OTLP metrics serializer reuses the value encoding and the resource grouping from here.\n\nimport {\n ATTR_APP_NAMESPACE,\n CONTENT_TYPE_JSON,\n SERIALIZER_NAME_OTLP,\n TELEMETRY_SDK_NAME,\n} from \"../../constants\";\nimport type { LogRecord } from \"../../models/log-record\";\nimport type { LogSerializer, SerializedBatch } from \"../../models/serializer\";\n\n/** An OTLP AnyValue with typed value wrappers. */\ntype AnyValue = Record<string, unknown>;\n\n/** An OTLP KeyValue pair. */\nexport interface KeyValue {\n /** The attribute key. */\n key: string;\n /** The typed AnyValue. */\n value: AnyValue;\n}\n\n/** Records that share the same resource attributes. */\nexport interface ResourceGroup {\n /** The resource attribute map. */\n resource: Record<string, unknown>;\n /** The resource's log records. */\n records: LogRecord[];\n}\n\n/**\n * Wraps a JavaScript value in an OTLP AnyValue.\n * @param value Raw attribute or resource value.\n * @returns Typed AnyValue object or null if unsupported.\n */\nfunction toAnyValue(value: unknown): AnyValue | null {\n if (value === null || value === undefined) {\n return null;\n }\n\n if (typeof value === \"string\") {\n return { stringValue: value };\n }\n\n if (typeof value === \"boolean\") {\n return { boolValue: value };\n }\n\n // Encode int64 as a decimal string, as the OTLP protobuf JSON mapping requires. A conforming\n // collector answers a number with a 400 status, and the response doesn't give the cause.\n // An integer above MAX_SAFE_INTEGER goes to doubleValue, because its text can be \"1e+21\" or\n // overflow int64.\n if (typeof value === \"number\") {\n return Number.isSafeInteger(value) ? { intValue: String(value) } : { doubleValue: value };\n }\n\n // Convert a BigInt to a decimal string. JSON.stringify throws on a BigInt and would lose\n // the batch.\n if (typeof value === \"bigint\") {\n return { intValue: value.toString() };\n }\n\n if (Array.isArray(value)) {\n const items: readonly unknown[] = value;\n const values = items.map(toAnyValue).filter((item): item is AnyValue => item !== null);\n\n return { arrayValue: { values } };\n }\n\n if (typeof value === \"object\") {\n const nested = value as Record<string, unknown>;\n return { kvlistValue: { values: toKeyValues(nested) } };\n }\n\n return null;\n}\n\n/**\n * Converts a plain object to an array of OTLP KeyValue pairs.\n * @param source Key-value attribute object.\n * @returns Array of valid KeyValue pairs.\n */\nexport function toKeyValues(source: Record<string, unknown>): KeyValue[] {\n const out: KeyValue[] = [];\n\n for (const [key, raw] of Object.entries(source)) {\n const value = toAnyValue(raw);\n if (value) {\n out.push({ key, value });\n }\n }\n\n return out;\n}\n\n/** Caches the JSON key of every resource object, which avoids a repeated stringify. */\nconst resourceKeys = new WeakMap<object, string>();\n\n/**\n * Returns the stable JSON key of a resource object, and caches it.\n * @param resource Resource attribute object.\n * @returns JSON key string.\n */\nfunction resourceKey(resource: Record<string, unknown>): string {\n const cached = resourceKeys.get(resource);\n if (cached !== undefined) {\n return cached;\n }\n\n const key = JSON.stringify(resource);\n resourceKeys.set(resource, key);\n\n return key;\n}\n\n/**\n * Groups records by their resource attributes, keeping the record order within each group.\n * @param records Records to group.\n * @returns One group per resource.\n */\nexport function groupByResource(records: LogRecord[]): ResourceGroup[] {\n const groups = new Map<string, ResourceGroup>();\n\n for (const record of records) {\n const key = resourceKey(record.resource);\n const group = groups.get(key);\n\n if (group) {\n group.records.push(record);\n continue;\n }\n\n groups.set(key, { resource: record.resource, records: [record] });\n }\n\n return [...groups.values()];\n}\n\n/** The records of one instrumentation scope. */\nexport interface ScopeGroup {\n /** The scope name, which is the logger namespace. */\n name: string;\n /** The scope's records. */\n records: LogRecord[];\n}\n\n/**\n * Groups records by their logger namespace, keeping the record order within each group.\n * A record without a namespace goes to the library's own scope.\n * @param records Records of one resource.\n * @returns One group per namespace.\n */\nexport function groupByScope(records: LogRecord[]): ScopeGroup[] {\n const groups = new Map<string, LogRecord[]>();\n\n for (const record of records) {\n const namespace: unknown = record.attributes[ATTR_APP_NAMESPACE];\n const name = typeof namespace === \"string\" && namespace ? namespace : TELEMETRY_SDK_NAME;\n const group = groups.get(name);\n\n if (group) {\n group.push(record);\n continue;\n }\n\n groups.set(name, [record]);\n }\n\n return [...groups].map(([name, scoped]) => ({ name, records: scoped }));\n}\n\n/** Writes log records as OTLP/JSON payloads. */\nexport const otlpSerializer: LogSerializer = {\n /** The format name. */\n name: SERIALIZER_NAME_OTLP,\n\n /**\n * Groups records by resource and encodes them as an OTLP\n * ExportLogsServiceRequest JSON payload.\n * @param records Array of log records to serialize.\n * @returns Serialized JSON batch payload.\n */\n serialize(records: LogRecord[]): SerializedBatch {\n const resourceLogs = groupByResource(records).map((group) => ({\n resource: { attributes: toKeyValues(group.resource) },\n scopeLogs: groupByScope(group.records).map((scope) => ({\n scope: { name: scope.name },\n logRecords: scope.records.map((record) => ({\n timeUnixNano: record.timeUnixNano,\n // Use timeUnixNano when observedTimeUnixNano is not set.\n observedTimeUnixNano: record.observedTimeUnixNano ?? record.timeUnixNano,\n severityNumber: record.severityNumber,\n severityText: record.severityText,\n body: { stringValue: record.body },\n traceId: record.traceId,\n spanId: record.spanId,\n flags: record.traceFlags,\n attributes: toKeyValues(record.attributes),\n })),\n })),\n }));\n\n return {\n body: JSON.stringify({ resourceLogs }),\n contentType: CONTENT_TYPE_JSON,\n };\n },\n};\n"],"mappings":"A,4CAuCA,SAASO,EAAW,EAAiC,CAuCnD,OAtCIC,GAAU,KACL,KAGL,OAAOA,GAAU,SACZ,CAAE,YAAaA,CAAM,EAG1B,OAAOA,GAAU,UACZ,CAAE,UAAWA,CAAM,EAOxB,OAAOA,GAAU,SACZ,OAAO,cAAcA,CAAK,EAAI,CAAE,SAAU,OAAOA,CAAK,CAAE,EAAI,CAAE,YAAaA,CAAM,EAKtF,OAAOA,GAAU,SACZ,CAAE,SAAUA,EAAM,SAAS,CAAE,EAGlC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I,EAEzBH,EACFA,EAAM,KAAKF,CAAM,EAInBD,EAAO,IAAIM,EAAM,CAACL,CAAM,CAAC,CAC3B,CAEA,MAAO,CAAC,GAAGD,CAAM,CAAC,CAAC,KAAK,CAACM,EAAMC,MAAa,CAAE,OAAM,QAASA,CAAO,EAAE,CACxE,CAGA,IAAaC,EAAgC,CAE3C,KAAMxB,EAAAA,GAQN,UAAU,EAAuC,CAC/C,IAAMyB,EAAeV,EAAgBG,CAAO,CAAC,CAAC,IAAK,IAAW,CAC5D,SAAU,CAAE,WAAYZ,EAAYa,EAAM,QAAQ,CAAE,EACpD,UAAWC,EAAaD,EAAM,OAAO,CAAC,CAAC,IAAK,IAAW,CACrD,MAAO,CAAE,KAAMO,EAAM,IAAK,EAC1B,WAAYA,EAAM,QAAQ,IAAK,IAAY,CACzC,aAAcT,EAAO,aAErB,qBAAsBA,EAAO,sBAAwBA,EAAO,aAC5D,eAAgBA,EAAO,eACvB,aAAcA,EAAO,aACrB,KAAM,CAAE,YAAaA,EAAO,IAAK,EACjC,QAASA,EAAO,QAChB,OAAQA,EAAO,OACf,MAAOA,EAAO,WACd,WAAYX,EAAYW,EAAO,UAAU,CAC3C,EAAE,CACJ,EAAE,CACJ,EAAE,EAEF,MAAO,CACL,KAAM,KAAK,UAAU,CAAE,cAAa,CAAC,EACrC,YAAahB,EAAAA,CACf,CACF,CACF,E"}
1
+ {"version":3,"file":"otlp-CrAWkQdO.cjs","names":["items","nested","ATTR_APP_NAMESPACE","TELEMETRY_SDK_NAME","SERIALIZER_NAME_OTLP","CONTENT_TYPE_JSON","require_constants","toAnyValue","value","item","toKeyValues","out","key","raw","source","resourceKeys","resourceKey","cached","resource","groupByResource","groups","record","records","group","groupByScope","namespace","name","scoped","otlpSerializer","resourceLogs","scope"],"sources":["../src/transport/serializers/otlp.ts"],"sourcesContent":["// src/transport/serializers/otlp.ts\n//\n// Serializes log batches as OTLP/JSON log records. Records are grouped by resource, and each\n// logger namespace gets its own instrumentation scope.\n// The OTLP metrics serializer reuses the value encoding and the resource grouping from here.\n\nimport {\n ATTR_APP_NAMESPACE,\n CONTENT_TYPE_JSON,\n SERIALIZER_NAME_OTLP,\n TELEMETRY_SDK_NAME,\n} from \"../../constants\";\nimport type { LogRecord } from \"../../models/log-record\";\nimport type { LogSerializer, SerializedBatch } from \"../../models/serializer\";\n\n/** An OTLP AnyValue with typed value wrappers. */\ntype AnyValue = Record<string, unknown>;\n\n/** An OTLP KeyValue pair. */\nexport interface KeyValue {\n /** The attribute key. */\n key: string;\n /** The typed AnyValue. */\n value: AnyValue;\n}\n\n/** Records that share the same resource attributes. */\nexport interface ResourceGroup {\n /** The resource attribute map. */\n resource: Record<string, unknown>;\n /** The resource's log records. */\n records: LogRecord[];\n}\n\n/**\n * Wraps a JavaScript value in an OTLP AnyValue.\n * @param value Raw attribute or resource value.\n * @returns Typed AnyValue object or null if unsupported.\n */\nfunction toAnyValue(value: unknown): AnyValue | null {\n if (value === null || value === undefined) {\n return null;\n }\n\n if (typeof value === \"string\") {\n return { stringValue: value };\n }\n\n if (typeof value === \"boolean\") {\n return { boolValue: value };\n }\n\n // Encode int64 as a decimal string, as the OTLP protobuf JSON mapping requires. A conforming\n // collector answers a number with a 400 status, and the response doesn't give the cause.\n // An integer above MAX_SAFE_INTEGER goes to doubleValue, because its text can be \"1e+21\" or\n // overflow int64.\n if (typeof value === \"number\") {\n return Number.isSafeInteger(value) ? { intValue: String(value) } : { doubleValue: value };\n }\n\n // Convert a BigInt to a decimal string. JSON.stringify throws on a BigInt and would lose\n // the batch.\n if (typeof value === \"bigint\") {\n return { intValue: value.toString() };\n }\n\n if (Array.isArray(value)) {\n const items: readonly unknown[] = value;\n const values = items.map(toAnyValue).filter((item): item is AnyValue => item !== null);\n\n return { arrayValue: { values } };\n }\n\n if (typeof value === \"object\") {\n const nested = value as Record<string, unknown>;\n return { kvlistValue: { values: toKeyValues(nested) } };\n }\n\n return null;\n}\n\n/**\n * Converts a plain object to an array of OTLP KeyValue pairs.\n * @param source Key-value attribute object.\n * @returns Array of valid KeyValue pairs.\n */\nexport function toKeyValues(source: Record<string, unknown>): KeyValue[] {\n const out: KeyValue[] = [];\n\n for (const [key, raw] of Object.entries(source)) {\n const value = toAnyValue(raw);\n if (value) {\n out.push({ key, value });\n }\n }\n\n return out;\n}\n\n/** Caches the JSON key of every resource object, which avoids a repeated stringify. */\nconst resourceKeys = new WeakMap<object, string>();\n\n/**\n * Returns the stable JSON key of a resource object, and caches it.\n * @param resource Resource attribute object.\n * @returns JSON key string.\n */\nfunction resourceKey(resource: Record<string, unknown>): string {\n const cached = resourceKeys.get(resource);\n if (cached !== undefined) {\n return cached;\n }\n\n const key = JSON.stringify(resource);\n resourceKeys.set(resource, key);\n\n return key;\n}\n\n/**\n * Groups records by their resource attributes, keeping the record order within each group.\n * @param records Records to group.\n * @returns One group per resource.\n */\nexport function groupByResource(records: LogRecord[]): ResourceGroup[] {\n const groups = new Map<string, ResourceGroup>();\n\n for (const record of records) {\n const key = resourceKey(record.resource);\n const group = groups.get(key);\n\n if (group) {\n group.records.push(record);\n continue;\n }\n\n groups.set(key, { resource: record.resource, records: [record] });\n }\n\n return [...groups.values()];\n}\n\n/** The records of one instrumentation scope. */\nexport interface ScopeGroup {\n /** The scope name, which is the logger namespace. */\n name: string;\n /** The scope's records. */\n records: LogRecord[];\n}\n\n/**\n * Groups records by their logger namespace, keeping the record order within each group.\n * A record without a namespace goes to the library's own scope.\n * @param records Records of one resource.\n * @returns One group per namespace.\n */\nexport function groupByScope(records: LogRecord[]): ScopeGroup[] {\n const groups = new Map<string, LogRecord[]>();\n\n for (const record of records) {\n const namespace: unknown = record.attributes[ATTR_APP_NAMESPACE];\n const name = typeof namespace === \"string\" && namespace ? namespace : TELEMETRY_SDK_NAME;\n const group = groups.get(name);\n\n if (group) {\n group.push(record);\n continue;\n }\n\n groups.set(name, [record]);\n }\n\n return [...groups].map(([name, scoped]) => ({ name, records: scoped }));\n}\n\n/** Writes log records as OTLP/JSON payloads. */\nexport const otlpSerializer: LogSerializer = {\n /** The format name. */\n name: SERIALIZER_NAME_OTLP,\n\n /**\n * Groups records by resource and encodes them as an OTLP\n * ExportLogsServiceRequest JSON payload.\n * @param records Array of log records to serialize.\n * @returns Serialized JSON batch payload.\n */\n serialize(records: LogRecord[]): SerializedBatch {\n const resourceLogs = groupByResource(records).map((group) => ({\n resource: { attributes: toKeyValues(group.resource) },\n scopeLogs: groupByScope(group.records).map((scope) => ({\n scope: { name: scope.name },\n logRecords: scope.records.map((record) => ({\n timeUnixNano: record.timeUnixNano,\n // Use timeUnixNano when observedTimeUnixNano is not set.\n observedTimeUnixNano: record.observedTimeUnixNano ?? record.timeUnixNano,\n severityNumber: record.severityNumber,\n severityText: record.severityText,\n body: { stringValue: record.body },\n traceId: record.traceId,\n spanId: record.spanId,\n flags: record.traceFlags,\n attributes: toKeyValues(record.attributes),\n })),\n })),\n }));\n\n return {\n body: JSON.stringify({ resourceLogs }),\n contentType: CONTENT_TYPE_JSON,\n };\n },\n};\n"],"mappings":"A,4CAuCA,SAASO,EAAW,EAAiC,CAuCnD,OAtCIC,GAAU,KACL,KAGL,OAAOA,GAAU,SACZ,CAAE,YAAaA,CAAM,EAG1B,OAAOA,GAAU,UACZ,CAAE,UAAWA,CAAM,EAOxB,OAAOA,GAAU,SACZ,OAAO,cAAcA,CAAK,EAAI,CAAE,SAAU,OAAOA,CAAK,CAAE,EAAI,CAAE,YAAaA,CAAM,EAKtF,OAAOA,GAAU,SACZ,CAAE,SAAUA,EAAM,SAAS,CAAE,EAGlC,MAAM,QAAQA,CAAK,EAId,CAAE,WAAY,CAAE,OAFRR,EAAM,IAAIO,CAAU,CAAC,CAAC,OAAQ,GAA2BE,IAAS,IAE1D,CAAO,CAAE,EAG9B,OAAOD,GAAU,SAEZ,CAAE,YAAa,CAAE,OAAQE,EAAYT,CAAM,CAAE,CAAE,EAGjD,IACT,CAOA,SAAgBS,EAAY,EAA6C,CACvE,IAAMC,EAAkB,CAAC,EAEzB,I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V,EAAgBG,CAAO,CAAC,CAAC,IAAK,IAAW,CAC5D,SAAU,CAAE,WAAYZ,EAAYa,EAAM,QAAQ,CAAE,EACpD,UAAWC,EAAaD,EAAM,OAAO,CAAC,CAAC,IAAK,IAAW,CACrD,MAAO,CAAE,KAAMO,EAAM,IAAK,EAC1B,WAAYA,EAAM,QAAQ,IAAK,IAAY,CACzC,aAAcT,EAAO,aAErB,qBAAsBA,EAAO,sBAAwBA,EAAO,aAC5D,eAAgBA,EAAO,eACvB,aAAcA,EAAO,aACrB,KAAM,CAAE,YAAaA,EAAO,IAAK,EACjC,QAASA,EAAO,QAChB,OAAQA,EAAO,OACf,MAAOA,EAAO,WACd,WAAYX,EAAYW,EAAO,UAAU,CAC3C,EAAE,CACJ,EAAE,CACJ,EAAE,EAEF,MAAO,CACL,KAAM,KAAK,UAAU,CAAE,cAAa,CAAC,EACrC,YAAahB,EAAAA,CACf,CACF,CACF,E"}
@@ -1,4 +1,4 @@
1
- import { $n as e, Fn as t, a as n, z as r } from "./constants-CUyd9cTZ.js";
1
+ import { Rn as e, a as t, nr as n, z as r } from "./constants-BwJDXzj6.js";
2
2
  // src/transport/serializers/otlp.ts
3
3
  function i(e) {
4
4
  return e == null ? null : typeof e == "string" ? { stringValue: e } : typeof e == "boolean" ? { boolValue: e } : typeof e == "number" ? Number.isSafeInteger(e) ? { intValue: String(e) } : { doubleValue: e } : typeof e == "bigint" ? { intValue: e.toString() } : Array.isArray(e) ? { arrayValue: { values: e.map(i).filter((e) => e !== null) } } : typeof e == "object" ? { kvlistValue: { values: a(e) } } : null;
@@ -32,10 +32,10 @@ function c(e) {
32
32
  }
33
33
  return [...t.values()];
34
34
  }
35
- function l(t) {
35
+ function l(e) {
36
36
  let r = /* @__PURE__ */ new Map();
37
- for (let i of t) {
38
- let t = i.attributes[n], a = typeof t == "string" && t ? t : e, o = r.get(a);
37
+ for (let i of e) {
38
+ let e = i.attributes[t], a = typeof e == "string" && e ? e : n, o = r.get(a);
39
39
  o ? o.push(i) : r.set(a, [i]);
40
40
  }
41
41
  return [...r].map(([e, t]) => ({
@@ -44,7 +44,7 @@ function l(t) {
44
44
  }));
45
45
  }
46
46
  var u = {
47
- name: t,
47
+ name: e,
48
48
  serialize(e) {
49
49
  let t = c(e).map((e) => ({
50
50
  resource: { attributes: a(e.resource) },
@@ -71,4 +71,4 @@ var u = {
71
71
  };
72
72
  export { a as i, l as n, u as r, c as t };
73
73
 
74
- //# sourceMappingURL=otlp-DimfrRor.js.map
74
+ //# sourceMappingURL=otlp-D6dRZyB8.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"otlp-DimfrRor.js","names":["items","nested","TELEMETRY_SDK_NAME","SERIALIZER_NAME_OTLP","ATTR_APP_NAMESPACE","CONTENT_TYPE_JSON","toAnyValue","value","item","toKeyValues","out","key","raw","source","resourceKeys","resourceKey","cached","resource","groupByResource","groups","record","records","group","groupByScope","namespace","name","scoped","otlpSerializer","resourceLogs","scope"],"sources":["../src/transport/serializers/otlp.ts"],"sourcesContent":["// src/transport/serializers/otlp.ts\n//\n// Serializes log batches as OTLP/JSON log records. Records are grouped by resource, and each\n// logger namespace gets its own instrumentation scope.\n// The OTLP metrics serializer reuses the value encoding and the resource grouping from here.\n\nimport {\n ATTR_APP_NAMESPACE,\n CONTENT_TYPE_JSON,\n SERIALIZER_NAME_OTLP,\n TELEMETRY_SDK_NAME,\n} from \"../../constants\";\nimport type { LogRecord } from \"../../models/log-record\";\nimport type { LogSerializer, SerializedBatch } from \"../../models/serializer\";\n\n/** An OTLP AnyValue with typed value wrappers. */\ntype AnyValue = Record<string, unknown>;\n\n/** An OTLP KeyValue pair. */\nexport interface KeyValue {\n /** The attribute key. */\n key: string;\n /** The typed AnyValue. */\n value: AnyValue;\n}\n\n/** Records that share the same resource attributes. */\nexport interface ResourceGroup {\n /** The resource attribute map. */\n resource: Record<string, unknown>;\n /** The resource's log records. */\n records: LogRecord[];\n}\n\n/**\n * Wraps a JavaScript value in an OTLP AnyValue.\n * @param value Raw attribute or resource value.\n * @returns Typed AnyValue object or null if unsupported.\n */\nfunction toAnyValue(value: unknown): AnyValue | null {\n if (value === null || value === undefined) {\n return null;\n }\n\n if (typeof value === \"string\") {\n return { stringValue: value };\n }\n\n if (typeof value === \"boolean\") {\n return { boolValue: value };\n }\n\n // Encode int64 as a decimal string, as the OTLP protobuf JSON mapping requires. A conforming\n // collector answers a number with a 400 status, and the response doesn't give the cause.\n // An integer above MAX_SAFE_INTEGER goes to doubleValue, because its text can be \"1e+21\" or\n // overflow int64.\n if (typeof value === \"number\") {\n return Number.isSafeInteger(value) ? { intValue: String(value) } : { doubleValue: value };\n }\n\n // Convert a BigInt to a decimal string. JSON.stringify throws on a BigInt and would lose\n // the batch.\n if (typeof value === \"bigint\") {\n return { intValue: value.toString() };\n }\n\n if (Array.isArray(value)) {\n const items: readonly unknown[] = value;\n const values = items.map(toAnyValue).filter((item): item is AnyValue => item !== null);\n\n return { arrayValue: { values } };\n }\n\n if (typeof value === \"object\") {\n const nested = value as Record<string, unknown>;\n return { kvlistValue: { values: toKeyValues(nested) } };\n }\n\n return null;\n}\n\n/**\n * Converts a plain object to an array of OTLP KeyValue pairs.\n * @param source Key-value attribute object.\n * @returns Array of valid KeyValue pairs.\n */\nexport function toKeyValues(source: Record<string, unknown>): KeyValue[] {\n const out: KeyValue[] = [];\n\n for (const [key, raw] of Object.entries(source)) {\n const value = toAnyValue(raw);\n if (value) {\n out.push({ key, value });\n }\n }\n\n return out;\n}\n\n/** Caches the JSON key of every resource object, which avoids a repeated stringify. */\nconst resourceKeys = new WeakMap<object, string>();\n\n/**\n * Returns the stable JSON key of a resource object, and caches it.\n * @param resource Resource attribute object.\n * @returns JSON key string.\n */\nfunction resourceKey(resource: Record<string, unknown>): string {\n const cached = resourceKeys.get(resource);\n if (cached !== undefined) {\n return cached;\n }\n\n const key = JSON.stringify(resource);\n resourceKeys.set(resource, key);\n\n return key;\n}\n\n/**\n * Groups records by their resource attributes, keeping the record order within each group.\n * @param records Records to group.\n * @returns One group per resource.\n */\nexport function groupByResource(records: LogRecord[]): ResourceGroup[] {\n const groups = new Map<string, ResourceGroup>();\n\n for (const record of records) {\n const key = resourceKey(record.resource);\n const group = groups.get(key);\n\n if (group) {\n group.records.push(record);\n continue;\n }\n\n groups.set(key, { resource: record.resource, records: [record] });\n }\n\n return [...groups.values()];\n}\n\n/** The records of one instrumentation scope. */\nexport interface ScopeGroup {\n /** The scope name, which is the logger namespace. */\n name: string;\n /** The scope's records. */\n records: LogRecord[];\n}\n\n/**\n * Groups records by their logger namespace, keeping the record order within each group.\n * A record without a namespace goes to the library's own scope.\n * @param records Records of one resource.\n * @returns One group per namespace.\n */\nexport function groupByScope(records: LogRecord[]): ScopeGroup[] {\n const groups = new Map<string, LogRecord[]>();\n\n for (const record of records) {\n const namespace: unknown = record.attributes[ATTR_APP_NAMESPACE];\n const name = typeof namespace === \"string\" && namespace ? namespace : TELEMETRY_SDK_NAME;\n const group = groups.get(name);\n\n if (group) {\n group.push(record);\n continue;\n }\n\n groups.set(name, [record]);\n }\n\n return [...groups].map(([name, scoped]) => ({ name, records: scoped }));\n}\n\n/** Writes log records as OTLP/JSON payloads. */\nexport const otlpSerializer: LogSerializer = {\n /** The format name. */\n name: SERIALIZER_NAME_OTLP,\n\n /**\n * Groups records by resource and encodes them as an OTLP\n * ExportLogsServiceRequest JSON payload.\n * @param records Array of log records to serialize.\n * @returns Serialized JSON batch payload.\n */\n serialize(records: LogRecord[]): SerializedBatch {\n const resourceLogs = groupByResource(records).map((group) => ({\n resource: { attributes: toKeyValues(group.resource) },\n scopeLogs: groupByScope(group.records).map((scope) => ({\n scope: { name: scope.name },\n logRecords: scope.records.map((record) => ({\n timeUnixNano: record.timeUnixNano,\n // Use timeUnixNano when observedTimeUnixNano is not set.\n observedTimeUnixNano: record.observedTimeUnixNano ?? record.timeUnixNano,\n severityNumber: record.severityNumber,\n severityText: record.severityText,\n body: { stringValue: record.body },\n traceId: record.traceId,\n spanId: record.spanId,\n flags: record.traceFlags,\n attributes: toKeyValues(record.attributes),\n })),\n })),\n }));\n\n return {\n body: JSON.stringify({ resourceLogs }),\n contentType: CONTENT_TYPE_JSON,\n };\n },\n};\n"],"mappings":";;AAuCA,SAASM,EAAW,GAAiC;CAuCnD,OAtCIC,KAAU,OACL,OAGL,OAAOA,KAAU,WACZ,EAAE,aAAaA,EAAM,IAG1B,OAAOA,KAAU,YACZ,EAAE,WAAWA,EAAM,IAOxB,OAAOA,KAAU,WACZ,OAAO,cAAcA,CAAK,IAAI,EAAE,UAAU,OAAOA,CAAK,EAAE,IAAI,EAAE,aAAaA,EAAM,IAKtF,OAAOA,KAAU,WACZ,EAAE,UAAUA,EAAM,SAAS,EAAE,IAGlC,MAAM,QAAQA,CAAK,IAId,EAAE,YAAY,EAAE,QAFRP,EAAM,IAAIM,CAAU,CAAC,CAAC,QAAQ,MAA2BE,MAAS,IAE1D,EAAO,EAAE,IAG9B,OAAOD,KAAU,WAEZ,EAAE,aAAa,EAAE,QAAQE,EAAYR,CAAM,EAAE,EAAE,IAGjD;AACT;AAOA,SAAgBQ,EAAY,GAA6C;CACvE,IAAMC,IAAkB,CAAC;CAEzB,KAAK,IAAM,CAACC,GAAKC,MAAQ,OAAO,QAAQC,CAAM,GAAG;EAC/C,IAAMN,IAAQD,EAAWM,CAAG;EAC5B,AAAIL,KACFG,EAAI,KAAK;GAAE;GAAK;EAAM,CAAC;CAE3B;CAEA,OAAOA;AACT;AAGA,IAAMI,oBAAe,IAAI,QAAwB;AAOjD,SAASC,EAAY,GAA2C;CAC9D,IAAMC,IAASF,EAAa,IAAIG,CAAQ;CACxC,IAAID,MAAW,KAAA,GACb,OAAOA;CAGT,IAAML,IAAM,KAAK,UAAUM,CAAQ;CAGnC,OAFAH,EAAa,IAAIG,GAAUN,CAAG,GAEvBA;AACT;AAOA,SAAgBO,EAAgB,GAAuC;CACrE,IAAMC,oBAAS,IAAI,IAA2B;CAE9C,KAAK,IAAMC,KAAUC,GAAS;EAC5B,IA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AE;EAEF,OAAO;GACL,MAAM,KAAK,UAAU,EAAE,gBAAa,CAAC;GACrC,aAAaf;EACf;CACF;AACF"}
1
+ {"version":3,"file":"otlp-D6dRZyB8.js","names":["items","nested","SERIALIZER_NAME_OTLP","ATTR_APP_NAMESPACE","TELEMETRY_SDK_NAME","CONTENT_TYPE_JSON","toAnyValue","value","item","toKeyValues","out","key","raw","source","resourceKeys","resourceKey","cached","resource","groupByResource","groups","record","records","group","groupByScope","namespace","name","scoped","otlpSerializer","resourceLogs","scope"],"sources":["../src/transport/serializers/otlp.ts"],"sourcesContent":["// src/transport/serializers/otlp.ts\n//\n// Serializes log batches as OTLP/JSON log records. Records are grouped by resource, and each\n// logger namespace gets its own instrumentation scope.\n// The OTLP metrics serializer reuses the value encoding and the resource grouping from here.\n\nimport {\n ATTR_APP_NAMESPACE,\n CONTENT_TYPE_JSON,\n SERIALIZER_NAME_OTLP,\n TELEMETRY_SDK_NAME,\n} from \"../../constants\";\nimport type { LogRecord } from \"../../models/log-record\";\nimport type { LogSerializer, SerializedBatch } from \"../../models/serializer\";\n\n/** An OTLP AnyValue with typed value wrappers. */\ntype AnyValue = Record<string, unknown>;\n\n/** An OTLP KeyValue pair. */\nexport interface KeyValue {\n /** The attribute key. */\n key: string;\n /** The typed AnyValue. */\n value: AnyValue;\n}\n\n/** Records that share the same resource attributes. */\nexport interface ResourceGroup {\n /** The resource attribute map. */\n resource: Record<string, unknown>;\n /** The resource's log records. */\n records: LogRecord[];\n}\n\n/**\n * Wraps a JavaScript value in an OTLP AnyValue.\n * @param value Raw attribute or resource value.\n * @returns Typed AnyValue object or null if unsupported.\n */\nfunction toAnyValue(value: unknown): AnyValue | null {\n if (value === null || value === undefined) {\n return null;\n }\n\n if (typeof value === \"string\") {\n return { stringValue: value };\n }\n\n if (typeof value === \"boolean\") {\n return { boolValue: value };\n }\n\n // Encode int64 as a decimal string, as the OTLP protobuf JSON mapping requires. A conforming\n // collector answers a number with a 400 status, and the response doesn't give the cause.\n // An integer above MAX_SAFE_INTEGER goes to doubleValue, because its text can be \"1e+21\" or\n // overflow int64.\n if (typeof value === \"number\") {\n return Number.isSafeInteger(value) ? { intValue: String(value) } : { doubleValue: value };\n }\n\n // Convert a BigInt to a decimal string. JSON.stringify throws on a BigInt and would lose\n // the batch.\n if (typeof value === \"bigint\") {\n return { intValue: value.toString() };\n }\n\n if (Array.isArray(value)) {\n const items: readonly unknown[] = value;\n const values = items.map(toAnyValue).filter((item): item is AnyValue => item !== null);\n\n return { arrayValue: { values } };\n }\n\n if (typeof value === \"object\") {\n const nested = value as Record<string, unknown>;\n return { kvlistValue: { values: toKeyValues(nested) } };\n }\n\n return null;\n}\n\n/**\n * Converts a plain object to an array of OTLP KeyValue pairs.\n * @param source Key-value attribute object.\n * @returns Array of valid KeyValue pairs.\n */\nexport function toKeyValues(source: Record<string, unknown>): KeyValue[] {\n const out: KeyValue[] = [];\n\n for (const [key, raw] of Object.entries(source)) {\n const value = toAnyValue(raw);\n if (value) {\n out.push({ key, value });\n }\n }\n\n return out;\n}\n\n/** Caches the JSON key of every resource object, which avoids a repeated stringify. */\nconst resourceKeys = new WeakMap<object, string>();\n\n/**\n * Returns the stable JSON key of a resource object, and caches it.\n * @param resource Resource attribute object.\n * @returns JSON key string.\n */\nfunction resourceKey(resource: Record<string, unknown>): string {\n const cached = resourceKeys.get(resource);\n if (cached !== undefined) {\n return cached;\n }\n\n const key = JSON.stringify(resource);\n resourceKeys.set(resource, key);\n\n return key;\n}\n\n/**\n * Groups records by their resource attributes, keeping the record order within each group.\n * @param records Records to group.\n * @returns One group per resource.\n */\nexport function groupByResource(records: LogRecord[]): ResourceGroup[] {\n const groups = new Map<string, ResourceGroup>();\n\n for (const record of records) {\n const key = resourceKey(record.resource);\n const group = groups.get(key);\n\n if (group) {\n group.records.push(record);\n continue;\n }\n\n groups.set(key, { resource: record.resource, records: [record] });\n }\n\n return [...groups.values()];\n}\n\n/** The records of one instrumentation scope. */\nexport interface ScopeGroup {\n /** The scope name, which is the logger namespace. */\n name: string;\n /** The scope's records. */\n records: LogRecord[];\n}\n\n/**\n * Groups records by their logger namespace, keeping the record order within each group.\n * A record without a namespace goes to the library's own scope.\n * @param records Records of one resource.\n * @returns One group per namespace.\n */\nexport function groupByScope(records: LogRecord[]): ScopeGroup[] {\n const groups = new Map<string, LogRecord[]>();\n\n for (const record of records) {\n const namespace: unknown = record.attributes[ATTR_APP_NAMESPACE];\n const name = typeof namespace === \"string\" && namespace ? namespace : TELEMETRY_SDK_NAME;\n const group = groups.get(name);\n\n if (group) {\n group.push(record);\n continue;\n }\n\n groups.set(name, [record]);\n }\n\n return [...groups].map(([name, scoped]) => ({ name, records: scoped }));\n}\n\n/** Writes log records as OTLP/JSON payloads. */\nexport const otlpSerializer: LogSerializer = {\n /** The format name. */\n name: SERIALIZER_NAME_OTLP,\n\n /**\n * Groups records by resource and encodes them as an OTLP\n * ExportLogsServiceRequest JSON payload.\n * @param records Array of log records to serialize.\n * @returns Serialized JSON batch payload.\n */\n serialize(records: LogRecord[]): SerializedBatch {\n const resourceLogs = groupByResource(records).map((group) => ({\n resource: { attributes: toKeyValues(group.resource) },\n scopeLogs: groupByScope(group.records).map((scope) => ({\n scope: { name: scope.name },\n logRecords: scope.records.map((record) => ({\n timeUnixNano: record.timeUnixNano,\n // Use timeUnixNano when observedTimeUnixNano is not set.\n observedTimeUnixNano: record.observedTimeUnixNano ?? record.timeUnixNano,\n severityNumber: record.severityNumber,\n severityText: record.severityText,\n body: { stringValue: record.body },\n traceId: record.traceId,\n spanId: record.spanId,\n flags: record.traceFlags,\n attributes: toKeyValues(record.attributes),\n })),\n })),\n }));\n\n return {\n body: JSON.stringify({ resourceLogs }),\n contentType: CONTENT_TYPE_JSON,\n };\n },\n};\n"],"mappings":";;AAuCA,SAASM,EAAW,GAAiC;CAuCnD,OAtCIC,KAAU,OACL,OAGL,OAAOA,KAAU,WACZ,EAAE,aAAaA,EAAM,IAG1B,OAAOA,KAAU,YACZ,EAAE,WAAWA,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EAAa,GAAoC;CAC/D,IAAMJ,oBAAS,IAAI,IAAyB;CAE5C,KAAK,IAAMC,KAAUC,GAAS;EAC5B,IAAMG,IAAqBJ,EAAO,WAAWjB,IACvCsB,IAAO,OAAOD,KAAc,YAAYA,IAAYA,IAAYpB,GAChEkB,IAAQH,EAAO,IAAIM,CAAI;EAE7B,AAAIH,IACFA,EAAM,KAAKF,CAAM,IAInBD,EAAO,IAAIM,GAAM,CAACL,CAAM,CAAC;CAC3B;CAEA,OAAO,CAAC,GAAGD,CAAM,CAAC,CAAC,KAAK,CAACM,GAAMC,QAAa;EAAE;EAAM,SAASA;CAAO,EAAE;AACxE;AAGA,IAAaC,IAAgC;CAE3C,MAAMzB;CAQN,UAAU,GAAuC;EAC/C,IAAM0B,IAAeV,EAAgBG,CAAO,CAAC,CAAC,KAAK,OAAW;GAC5D,UAAU,EAAE,YAAYZ,EAAYa,EAAM,QAAQ,EAAE;GACpD,WAAWC,EAAaD,EAAM,OAAO,CAAC,CAAC,KAAK,OAAW;IACrD,OAAO,EAAE,MAAMO,EAAM,KAAK;IAC1B,YAAYA,EAAM,QAAQ,KAAK,OAAY;KACzC,cAAcT,EAAO;KAErB,sBAAsBA,EAAO,wBAAwBA,EAAO;KAC5D,gBAAgBA,EAAO;KACvB,cAAcA,EAAO;KACrB,MAAM,EAAE,aAAaA,EAAO,KAAK;KACjC,SAASA,EAAO;KAChB,QAAQA,EAAO;KACf,OAAOA,EAAO;KACd,YAAYX,EAAYW,EAAO,UAAU;IAC3C,EAAE;GACJ,EAAE;EACJ,EAAE;EAEF,OAAO;GACL,MAAM,KAAK,UAAU,EAAE,gBAAa,CAAC;GACrC,aAAaf;EACf;CACF;AACF"}
@@ -1,4 +1,4 @@
1
- import { Ht as e, It as t, St as n, i as r, qt as i } from "./constants-CUyd9cTZ.js";
1
+ import { Ct as e, Lt as t, Ut as n, Xt as r, i } from "./constants-BwJDXzj6.js";
2
2
  import { t as a } from "./openfin-Bxelt0yg.js";
3
3
  // src/utils/platform.ts
4
4
  var o = null;
@@ -8,12 +8,12 @@ function s(e, t) {
8
8
  }
9
9
  function c(e) {
10
10
  if (o) return o;
11
- let t = globalThis, n = t.navigator?.userAgent ?? "", r = "browser", c, d, f = !1, p = a()?.me;
12
- return s(t, "ServiceWorkerGlobalScope") ? (r = "service_worker", f = !0) : s(t, "SharedWorkerGlobalScope") ? (r = "shared_worker", f = !0) : s(t, "WorkerGlobalScope") ? (r = "web_worker", f = !0) : p === void 0 ? t.Capacitor !== void 0 || t.Ionic !== void 0 ? r = "ionic" : t.cordova !== void 0 || l(n) ? r = "mobile_webview" : typeof document > "u" && typeof process < "u" && (r = "node") : (r = i.test(n) ? "openfin" : "openfin_web", e.guard("openfin.unavailable", "The library could not read fin.me.identity.", () => {
11
+ let t = globalThis, n = t.navigator?.userAgent ?? "", i = "browser", c, d, f = !1, p = a()?.me;
12
+ return s(t, "ServiceWorkerGlobalScope") ? (i = "service_worker", f = !0) : s(t, "SharedWorkerGlobalScope") ? (i = "shared_worker", f = !0) : s(t, "WorkerGlobalScope") ? (i = "web_worker", f = !0) : p === void 0 ? t.Capacitor !== void 0 || t.Ionic !== void 0 ? i = "ionic" : t.cordova !== void 0 || l(n) ? i = "mobile_webview" : typeof document > "u" && typeof process < "u" && (i = "node") : (i = r.test(n) ? "openfin" : "openfin_web", e.guard("openfin.unavailable", "The library could not read fin.me.identity.", () => {
13
13
  let e = p.identity;
14
14
  c = e?.uuid, d = e?.name;
15
15
  })), o = {
16
- platform: r,
16
+ platform: i,
17
17
  openfinUuid: c,
18
18
  openfinName: d,
19
19
  userAgent: n,
@@ -21,8 +21,8 @@ function c(e) {
21
21
  isTopLevelDocument: u(e)
22
22
  }, o;
23
23
  }
24
- function l(i) {
25
- return r.test(i) ? !0 : (n.test(i) || t.test(i) && e.test(i)) && i.includes("AppleWebKit") && !i.includes("Safari/");
24
+ function l(r) {
25
+ return i.test(r) ? !0 : (e.test(r) || t.test(r) && n.test(r)) && r.includes("AppleWebKit") && !r.includes("Safari/");
26
26
  }
27
27
  function u(e) {
28
28
  if (typeof window > "u") return !1;
@@ -59,4 +59,4 @@ function h() {
59
59
  }
60
60
  export { p as i, c as n, h as r, d as t };
61
61
 
62
- //# sourceMappingURL=platform-BaaFIPCU.js.map
62
+ //# sourceMappingURL=platform-8DLhjddo.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"platform-BaaFIPCU.js","names":["MOBILE_UA_PATTERN","MACINTOSH_UA_PATTERN","IOS_DEVICE_UA_PATTERN","ANDROID_WEBVIEW_UA_PATTERN","OPENFIN_UA_PATTERN","getFin","cached","isGlobalScope","scope","g","name","detectPlatform","ua","platform","openfinUuid","openfinName","isWorker","finMe","isWebView","diagnostics","identity","isTopLevel","currentUrl","USER_INFO_PATTERN","recordedUrl","transform","value","url","error","bare","fullUrls","stripUrlQuery","cut","isOnline"],"sources":["../src/utils/platform.ts"],"sourcesContent":["// src/utils/platform.ts\n//\n// Detects host platform capabilities, OpenFin container metadata, and worker execution\n// realms. The result is cached, because it doesn't change during the life of a realm. A\n// webview is also a browser, so test for a webview first.\n\nimport {\n ANDROID_WEBVIEW_UA_PATTERN,\n IOS_DEVICE_UA_PATTERN,\n MACINTOSH_UA_PATTERN,\n MOBILE_UA_PATTERN,\n OPENFIN_UA_PATTERN,\n SAFARI_UA_TOKEN,\n WEBKIT_UA_TOKEN,\n} from \"../constants\";\nimport type { Diagnostics } from \"../core/diagnostics\";\nimport { getFin } from \"./openfin\";\n\n/** Host runtime environment classification attached to resource attributes. */\nexport type PlatformType =\n | \"openfin\"\n | \"openfin_web\"\n | \"browser\"\n | \"mobile_webview\"\n | \"ionic\"\n | \"web_worker\"\n | \"shared_worker\"\n | \"service_worker\"\n | \"node\";\n\n/** Host environment and runtime container metadata resolved at startup. */\nexport interface PlatformMetadata {\n /** Detected platform runtime classification. */\n platform: PlatformType;\n /** OpenFin application UUID if running inside an OpenFin container. */\n openfinUuid?: string;\n /** OpenFin window or view identifier. */\n openfinName?: string;\n /** Raw navigator user agent string or empty string if unavailable. */\n userAgent: string;\n /** True if the code runs in a worker realm. */\n isWorker: boolean;\n /** True if this context is the top-level document rather than an iframe. */\n isTopLevelDocument: boolean;\n}\n\n/** Indexed globalThis type for probing runtime globals. */\ntype Global = typeof globalThis & Record<string, unknown>;\n\n/** Cached platform metadata instance. */\nlet cached: PlatformMetadata | null = null;\n\n/** Abstract constructor type for global scope prototype checks. */\ntype ScopeConstructor = abstract new (...args: never[]) => object;\n\n/**\n * Checks whether globalThis is an instance of the given global scope constructor.\n * @param g Global scope object.\n * @param name Name of the scope constructor to check.\n * @returns True if globalThis inherits from the named scope constructor.\n */\nfunction isGlobalScope(g: Global, name: string): boolean {\n const scope = g[name];\n if (scope === undefined) {\n return false;\n }\n return g instanceof (scope as ScopeConstructor);\n}\n\n/**\n * Detects and caches host platform metadata for the active realm.\n * @param diagnostics Diagnostics reporter.\n * @returns Detected PlatformMetadata.\n */\nexport function detectPlatform(diagnostics: Diagnostics): PlatformMetadata {\n if (cached) {\n return cached;\n }\n const g = globalThis as Global;\n\n const ua = (g.navigator as Navigator | undefined)?.userAgent ?? \"\";\n let platform: PlatformType = \"browser\";\n let openfinUuid: string | undefined;\n let openfinName: string | undefined;\n let isWorker = false;\n\n const finMe = getFin()?.me;\n\n if (isGlobalScope(g, \"ServiceWorkerGlobalScope\")) {\n platform = \"service_worker\";\n isWorker = true;\n } else if (isGlobalScope(g, \"SharedWorkerGlobalScope\")) {\n platform = \"shared_worker\";\n isWorker = true;\n } else if (isGlobalScope(g, \"WorkerGlobalScope\")) {\n platform = \"web_worker\";\n isWorker = true;\n } else if (finMe !== undefined) {\n platform = OPENFIN_UA_PATTERN.test(ua) ? \"openfin\" : \"openfin_web\";\n diagnostics.guard(\"openfin.unavailable\", \"The library could not read fin.me.identity.\", () => {\n const identity = finMe.identity;\n openfinUuid = identity?.uuid;\n openfinName = identity?.name;\n });\n } else if (g.Capacitor !== undefined || g.Ionic !== undefined) {\n platform = \"ionic\";\n } else if (g.cordova !== undefined || isWebView(ua)) {\n platform = \"mobile_webview\";\n } else if (typeof document === \"undefined\" && typeof process !== \"undefined\") {\n platform = \"node\";\n }\n\n cached = {\n platform,\n openfinUuid,\n openfinName,\n userAgent: ua,\n isWorker,\n isTopLevelDocument: isTopLevel(diagnostics),\n };\n return cached;\n}\n\n/**\n * Checks whether a user agent string belongs to an embedded mobile webview.\n * @param ua User agent string.\n * @returns True if the user agent matches Android or iOS webview signatures.\n */\nfunction isWebView(ua: string): boolean {\n if (ANDROID_WEBVIEW_UA_PATTERN.test(ua)) {\n return true;\n }\n const ios =\n IOS_DEVICE_UA_PATTERN.test(ua) || (MACINTOSH_UA_PATTERN.test(ua) && MOBILE_UA_PATTERN.test(ua));\n return ios && ua.includes(WEBKIT_UA_TOKEN) && !ua.includes(SAFARI_UA_TOKEN);\n}\n\n/**\n * Checks whether the current window is the top-level browsing context.\n * @param diagnostics Diagnostics reporter. Counts a blocked read of window.top.\n * @returns True if top-level, false if framed or inaccessible due to cross-origin boundaries.\n */\nexport function isTopLevel(diagnostics: Diagnostics): boolean {\n if (typeof window === \"undefined\") {\n return false;\n }\n try {\n return window.self === window.top;\n } catch {\n // A cross-origin parent blocks the read, which proves a frame. Count it, but don't report it.\n diagnostics.count(\"platform.api_blocked\");\n return false;\n }\n}\n\n/**\n * Reads the current document URL without caching.\n * @param diagnostics Diagnostics reporter. Counts a blocked read of location.href.\n * @returns The current location.href, or an empty string.\n */\nexport function currentUrl(diagnostics: Diagnostics): string {\n try {\n return typeof location !== \"undefined\" ? location.href : \"\";\n } catch {\n // A sandbox can block the read. Count the fault, because a report per record would be noise.\n diagnostics.count(\"platform.api_blocked\");\n return \"\";\n }\n}\n\n/** Matches the user info of an absolute URL, for example \"user:pass@\". */\nconst USER_INFO_PATTERN = /^([a-z][a-z\\d+.-]*:\\/\\/)[^/?#]*@/i;\n\n/**\n * Returns the form of a URL that the library records. A transform's result is recorded as is,\n * or \"\" if it throws or returns no string. Without a transform, the user info is always\n * removed, because it is a credential, and without fullUrls the query and the fragment go too.\n * @param url Absolute or relative URL.\n * @param fullUrls Value of `capture.fullUrls`.\n * @param transform Value of `capture.urlTransform`. Replaces the default rule.\n * @param diagnostics Diagnostics reporter for a transform that throws.\n * @returns The URL to record.\n */\nexport function recordedUrl(\n url: string,\n fullUrls: boolean,\n transform?: ((url: string) => string | null) | null,\n diagnostics?: Diagnostics,\n): string {\n if (transform) {\n try {\n const value = transform(url);\n return typeof value === \"string\" ? value : \"\";\n } catch (error) {\n // Report the fault. Otherwise every recorded URL is empty with no visible cause.\n diagnostics?.report(\n \"capture.record_failed\",\n \"capture.urlTransform threw an error. The library records an empty URL.\",\n undefined,\n error,\n );\n return \"\";\n }\n }\n const bare = url.replace(USER_INFO_PATTERN, \"$1\");\n return fullUrls ? bare : stripUrlQuery(bare);\n}\n\n/**\n * Drops the query string and fragment from a URL. Cuts the string instead of parsing it,\n * because a relative request target has no base URL.\n * @param url Absolute or relative URL.\n * @returns The URL up to the first \"?\" or \"#\".\n */\nexport function stripUrlQuery(url: string): string {\n const cut = url.search(/[?#]/);\n\n return cut === -1 ? url : url.slice(0, cut);\n}\n\n/**\n * Checks whether the browser can reach the network. A host without navigator.onLine counts as\n * online.\n * @returns False only when navigator.onLine is false.\n */\nexport function isOnline(): boolean {\n return (globalThis as { navigator?: { onLine?: boolean } }).navigator?.onLine !== false;\n}\n\n/** Resets the cached platform metadata for testing. */\nexport function resetPlatformCache(): void {\n cached = null;\n}\n"],"mappings":";;;AAkDA,IAAIM,IAAkC;AAWtC,SAASC,EAAc,GAAW,GAAuB;CACvD,IAAMC,IAAQC,EAAEC;CAIhB,OAHIF,MAAU,KAAA,KAGPC,aAAcD;AACvB;AAOA,SAAgBG,EAAe,GAA4C;CACzE,IAAIL,GACF,OAAOA;CAET,IAAMG,IAAI,YAEJG,IAAMH,EAAE,WAAqC,aAAa,IAC5DI,IAAyB,WACzBC,GACAC,GACAC,IAAW,IAETC,IAAQZ,EAAO,CAAC,EAA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MC,IAAQD,EAAUE,CAAG;EAC3B,OAAO,OAAOD,KAAU,WAAWA,IAAQ;CAC7C,SAASE,GAAO;EAQd,OANAT,GAAa,OACX,yBACA,0EACA,KAAA,GACAS,CACF,GACO;CACT;CAEF,IAAMC,IAAOF,EAAI,QAAQJ,GAAmB,IAAI;CAChD,OAAOO,IAAWD,IAAOE,EAAcF,CAAI;AAC7C;AAQA,SAAgBE,EAAc,GAAqB;CACjD,IAAMC,IAAML,EAAI,OAAO,MAAM;CAE7B,OAAOK,MAAQ,KAAKL,IAAMA,EAAI,MAAM,GAAGK,CAAG;AAC5C;AAOA,SAAgBC,IAAoB;CAClC,OAAQ,WAAoD,WAAW,WAAW;AACpF"}
1
+ {"version":3,"file":"platform-8DLhjddo.js","names":["IOS_DEVICE_UA_PATTERN","MACINTOSH_UA_PATTERN","MOBILE_UA_PATTERN","OPENFIN_UA_PATTERN","getFin","cached","isGlobalScope","scope","g","name","detectPlatform","ua","platform","openfinUuid","openfinName","isWorker","finMe","isWebView","diagnostics","identity","isTopLevel","ANDROID_WEBVIEW_UA_PATTERN","currentUrl","USER_INFO_PATTERN","recordedUrl","transform","value","url","error","bare","fullUrls","stripUrlQuery","cut","isOnline"],"sources":["../src/utils/platform.ts"],"sourcesContent":["// src/utils/platform.ts\n//\n// Detects host platform capabilities, OpenFin container metadata, and worker execution\n// realms. The result is cached, because it doesn't change during the life of a realm. A\n// webview is also a browser, so test for a webview first.\n\nimport {\n ANDROID_WEBVIEW_UA_PATTERN,\n IOS_DEVICE_UA_PATTERN,\n MACINTOSH_UA_PATTERN,\n MOBILE_UA_PATTERN,\n OPENFIN_UA_PATTERN,\n SAFARI_UA_TOKEN,\n WEBKIT_UA_TOKEN,\n} from \"../constants\";\nimport type { Diagnostics } from \"../core/diagnostics\";\nimport { getFin } from \"./openfin\";\n\n/** Host runtime environment classification attached to resource attributes. */\nexport type PlatformType =\n | \"openfin\"\n | \"openfin_web\"\n | \"browser\"\n | \"mobile_webview\"\n | \"ionic\"\n | \"web_worker\"\n | \"shared_worker\"\n | \"service_worker\"\n | \"node\";\n\n/** Host environment and runtime container metadata resolved at startup. */\nexport interface PlatformMetadata {\n /** Detected platform runtime classification. */\n platform: PlatformType;\n /** OpenFin application UUID if running inside an OpenFin container. */\n openfinUuid?: string;\n /** OpenFin window or view identifier. */\n openfinName?: string;\n /** Raw navigator user agent string or empty string if unavailable. */\n userAgent: string;\n /** True if the code runs in a worker realm. */\n isWorker: boolean;\n /** True if this context is the top-level document rather than an iframe. */\n isTopLevelDocument: boolean;\n}\n\n/** Indexed globalThis type for probing runtime globals. */\ntype Global = typeof globalThis & Record<string, unknown>;\n\n/** Cached platform metadata instance. */\nlet cached: PlatformMetadata | null = null;\n\n/** Abstract constructor type for global scope prototype checks. */\ntype ScopeConstructor = abstract new (...args: never[]) => object;\n\n/**\n * Checks whether globalThis is an instance of the given global scope constructor.\n * @param g Global scope object.\n * @param name Name of the scope constructor to check.\n * @returns True if globalThis inherits from the named scope constructor.\n */\nfunction isGlobalScope(g: Global, name: string): boolean {\n const scope = g[name];\n if (scope === undefined) {\n return false;\n }\n return g instanceof (scope as ScopeConstructor);\n}\n\n/**\n * Detects and caches host platform metadata for the active realm.\n * @param diagnostics Diagnostics reporter.\n * @returns Detected PlatformMetadata.\n */\nexport function detectPlatform(diagnostics: Diagnostics): PlatformMetadata {\n if (cached) {\n return cached;\n }\n const g = globalThis as Global;\n\n const ua = (g.navigator as Navigator | undefined)?.userAgent ?? \"\";\n let platform: PlatformType = \"browser\";\n let openfinUuid: string | undefined;\n let openfinName: string | undefined;\n let isWorker = false;\n\n const finMe = getFin()?.me;\n\n if (isGlobalScope(g, \"ServiceWorkerGlobalScope\")) {\n platform = \"service_worker\";\n isWorker = true;\n } else if (isGlobalScope(g, \"SharedWorkerGlobalScope\")) {\n platform = \"shared_worker\";\n isWorker = true;\n } else if (isGlobalScope(g, \"WorkerGlobalScope\")) {\n platform = \"web_worker\";\n isWorker = true;\n } else if (finMe !== undefined) {\n platform = OPENFIN_UA_PATTERN.test(ua) ? \"openfin\" : \"openfin_web\";\n diagnostics.guard(\"openfin.unavailable\", \"The library could not read fin.me.identity.\", () => {\n const identity = finMe.identity;\n openfinUuid = identity?.uuid;\n openfinName = identity?.name;\n });\n } else if (g.Capacitor !== undefined || g.Ionic !== undefined) {\n platform = \"ionic\";\n } else if (g.cordova !== undefined || isWebView(ua)) {\n platform = \"mobile_webview\";\n } else if (typeof document === \"undefined\" && typeof process !== \"undefined\") {\n platform = \"node\";\n }\n\n cached = {\n platform,\n openfinUuid,\n openfinName,\n userAgent: ua,\n isWorker,\n isTopLevelDocument: isTopLevel(diagnostics),\n };\n return cached;\n}\n\n/**\n * Checks whether a user agent string belongs to an embedded mobile webview.\n * @param ua User agent string.\n * @returns True if the user agent matches Android or iOS webview signatures.\n */\nfunction isWebView(ua: string): boolean {\n if (ANDROID_WEBVIEW_UA_PATTERN.test(ua)) {\n return true;\n }\n const ios =\n IOS_DEVICE_UA_PATTERN.test(ua) || (MACINTOSH_UA_PATTERN.test(ua) && MOBILE_UA_PATTERN.test(ua));\n return ios && ua.includes(WEBKIT_UA_TOKEN) && !ua.includes(SAFARI_UA_TOKEN);\n}\n\n/**\n * Checks whether the current window is the top-level browsing context.\n * @param diagnostics Diagnostics reporter. Counts a blocked read of window.top.\n * @returns True if top-level, false if framed or inaccessible due to cross-origin boundaries.\n */\nexport function isTopLevel(diagnostics: Diagnostics): boolean {\n if (typeof window === \"undefined\") {\n return false;\n }\n try {\n return window.self === window.top;\n } catch {\n // A cross-origin parent blocks the read, which proves a frame. Count it, but don't report it.\n diagnostics.count(\"platform.api_blocked\");\n return false;\n }\n}\n\n/**\n * Reads the current document URL without caching.\n * @param diagnostics Diagnostics reporter. Counts a blocked read of location.href.\n * @returns The current location.href, or an empty string.\n */\nexport function currentUrl(diagnostics: Diagnostics): string {\n try {\n return typeof location !== \"undefined\" ? location.href : \"\";\n } catch {\n // A sandbox can block the read. Count the fault, because a report per record would be noise.\n diagnostics.count(\"platform.api_blocked\");\n return \"\";\n }\n}\n\n/** Matches the user info of an absolute URL, for example \"user:pass@\". */\nconst USER_INFO_PATTERN = /^([a-z][a-z\\d+.-]*:\\/\\/)[^/?#]*@/i;\n\n/**\n * Returns the form of a URL that the library records. A transform's result is recorded as is,\n * or \"\" if it throws or returns no string. Without a transform, the user info is always\n * removed, because it is a credential, and without fullUrls the query and the fragment go too.\n * @param url Absolute or relative URL.\n * @param fullUrls Value of `capture.fullUrls`.\n * @param transform Value of `capture.urlTransform`. Replaces the default rule.\n * @param diagnostics Diagnostics reporter for a transform that throws.\n * @returns The URL to record.\n */\nexport function recordedUrl(\n url: string,\n fullUrls: boolean,\n transform?: ((url: string) => string | null) | null,\n diagnostics?: Diagnostics,\n): string {\n if (transform) {\n try {\n const value = transform(url);\n return typeof value === \"string\" ? value : \"\";\n } catch (error) {\n // Report the fault. Otherwise every recorded URL is empty with no visible cause.\n diagnostics?.report(\n \"capture.record_failed\",\n \"capture.urlTransform threw an error. The library records an empty URL.\",\n undefined,\n error,\n );\n return \"\";\n }\n }\n const bare = url.replace(USER_INFO_PATTERN, \"$1\");\n return fullUrls ? bare : stripUrlQuery(bare);\n}\n\n/**\n * Drops the query string and fragment from a URL. Cuts the string instead of parsing it,\n * because a relative request target has no base URL.\n * @param url Absolute or relative URL.\n * @returns The URL up to the first \"?\" or \"#\".\n */\nexport function stripUrlQuery(url: string): string {\n const cut = url.search(/[?#]/);\n\n return cut === -1 ? url : url.slice(0, cut);\n}\n\n/**\n * Checks whether the browser can reach the network. A host without navigator.onLine counts as\n * online.\n * @returns False only when navigator.onLine is false.\n */\nexport function isOnline(): boolean {\n return (globalThis as { navigator?: { onLine?: boolean } }).navigator?.onLine !== false;\n}\n\n/** Resets the cached platform metadata for testing. */\nexport function resetPlatformCache(): void {\n cached = null;\n}\n"],"mappings":";;;AAkDA,IAAIK,IAAkC;AAWtC,SAASC,EAAc,GAAW,GAAuB;CACvD,IAAMC,IAAQC,EAAEC;CAI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GAAkC;CAC3D,IAAI;EACF,OAAO,OAAO,WAAa,MAAc,SAAS,OAAO;CAC3D,QAAQ;EAGN,OADAJ,EAAY,MAAM,sBAAsB,GACjC;CACT;AACF;AAGA,IAAMK,IAAoB;AAY1B,SAAgBC,EACd,GACA,GACA,GACA,GACQ;CACR,IAAIC,GACF,IAAI;EACF,IAAMC,IAAQD,EAAUE,CAAG;EAC3B,OAAO,OAAOD,KAAU,WAAWA,IAAQ;CAC7C,SAASE,GAAO;EAQd,OANAV,GAAa,OACX,yBACA,0EACA,KAAA,GACAU,CACF,GACO;CACT;CAEF,IAAMC,IAAOF,EAAI,QAAQJ,GAAmB,IAAI;CAChD,OAAOO,IAAWD,IAAOE,EAAcF,CAAI;AAC7C;AAQA,SAAgBE,EAAc,GAAqB;CACjD,IAAMC,IAAML,EAAI,OAAO,MAAM;CAE7B,OAAOK,MAAQ,KAAKL,IAAMA,EAAI,MAAM,GAAGK,CAAG;AAC5C;AAOA,SAAgBC,IAAoB;CAClC,OAAQ,WAAoD,WAAW,WAAW;AACpF"}
@@ -1,2 +1,2 @@
1
- const e=require("./constants-CqdJhTxH.cjs"),t=require("./openfin-DtH2f7zX.cjs");var n=null;function r(e,t){let n=e[t];return n!==void 0&&e instanceof n}function i(i){if(n)return n;let s=globalThis,c=s.navigator?.userAgent??``,l=`browser`,u,d,f=!1,p=t.t()?.me;return r(s,`ServiceWorkerGlobalScope`)?(l=`service_worker`,f=!0):r(s,`SharedWorkerGlobalScope`)?(l=`shared_worker`,f=!0):r(s,`WorkerGlobalScope`)?(l=`web_worker`,f=!0):p===void 0?s.Capacitor!==void 0||s.Ionic!==void 0?l=`ionic`:s.cordova!==void 0||a(c)?l=`mobile_webview`:typeof document>`u`&&typeof process<`u`&&(l=`node`):(l=e.qt.test(c)?`openfin`:`openfin_web`,i.guard(`openfin.unavailable`,`The library could not read fin.me.identity.`,()=>{let e=p.identity;u=e?.uuid,d=e?.name})),n={platform:l,openfinUuid:u,openfinName:d,userAgent:c,isWorker:f,isTopLevelDocument:o(i)},n}function a(t){return e.i.test(t)?!0:(e.St.test(t)||e.It.test(t)&&e.Ht.test(t))&&t.includes(`AppleWebKit`)&&!t.includes(`Safari/`)}function o(e){if(typeof window>`u`)return!1;try{return window.self===window.top}catch{return e.count(`platform.api_blocked`),!1}}function s(e){try{return typeof location<`u`?location.href:``}catch{return e.count(`platform.api_blocked`),``}}var c=/^([a-z][a-z\d+.-]*:\/\/)[^/?#]*@/i;function l(e,t,n,r){if(n)try{let t=n(e);return typeof t==`string`?t:``}catch(e){return r?.report(`capture.record_failed`,`capture.urlTransform threw an error. The library records an empty URL.`,void 0,e),``}let i=e.replace(c,`$1`);return t?i:u(i)}function u(e){let t=e.search(/[?#]/);return t===-1?e:e.slice(0,t)}function d(){return globalThis.navigator?.onLine!==!1}Object.defineProperty(exports,"i",{enumerable:!0,get:function(){return l}}),Object.defineProperty(exports,"n",{enumerable:!0,get:function(){return i}}),Object.defineProperty(exports,"r",{enumerable:!0,get:function(){return d}}),Object.defineProperty(exports,"t",{enumerable:!0,get:function(){return s}});
2
- //# sourceMappingURL=platform-CfA3-7sJ.cjs.map
1
+ const e=require("./constants-CtF52hIV.cjs"),t=require("./openfin-DtH2f7zX.cjs");var n=null;function r(e,t){let n=e[t];return n!==void 0&&e instanceof n}function i(i){if(n)return n;let s=globalThis,c=s.navigator?.userAgent??``,l=`browser`,u,d,f=!1,p=t.t()?.me;return r(s,`ServiceWorkerGlobalScope`)?(l=`service_worker`,f=!0):r(s,`SharedWorkerGlobalScope`)?(l=`shared_worker`,f=!0):r(s,`WorkerGlobalScope`)?(l=`web_worker`,f=!0):p===void 0?s.Capacitor!==void 0||s.Ionic!==void 0?l=`ionic`:s.cordova!==void 0||a(c)?l=`mobile_webview`:typeof document>`u`&&typeof process<`u`&&(l=`node`):(l=e.Xt.test(c)?`openfin`:`openfin_web`,i.guard(`openfin.unavailable`,`The library could not read fin.me.identity.`,()=>{let e=p.identity;u=e?.uuid,d=e?.name})),n={platform:l,openfinUuid:u,openfinName:d,userAgent:c,isWorker:f,isTopLevelDocument:o(i)},n}function a(t){return e.i.test(t)?!0:(e.Ct.test(t)||e.Lt.test(t)&&e.Ut.test(t))&&t.includes(`AppleWebKit`)&&!t.includes(`Safari/`)}function o(e){if(typeof window>`u`)return!1;try{return window.self===window.top}catch{return e.count(`platform.api_blocked`),!1}}function s(e){try{return typeof location<`u`?location.href:``}catch{return e.count(`platform.api_blocked`),``}}var c=/^([a-z][a-z\d+.-]*:\/\/)[^/?#]*@/i;function l(e,t,n,r){if(n)try{let t=n(e);return typeof t==`string`?t:``}catch(e){return r?.report(`capture.record_failed`,`capture.urlTransform threw an error. The library records an empty URL.`,void 0,e),``}let i=e.replace(c,`$1`);return t?i:u(i)}function u(e){let t=e.search(/[?#]/);return t===-1?e:e.slice(0,t)}function d(){return globalThis.navigator?.onLine!==!1}Object.defineProperty(exports,"i",{enumerable:!0,get:function(){return l}}),Object.defineProperty(exports,"n",{enumerable:!0,get:function(){return i}}),Object.defineProperty(exports,"r",{enumerable:!0,get:function(){return d}}),Object.defineProperty(exports,"t",{enumerable:!0,get:function(){return s}});
2
+ //# sourceMappingURL=platform-BqRc-7RO.cjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"platform-CfA3-7sJ.cjs","names":["getFin","OPENFIN_UA_PATTERN","ANDROID_WEBVIEW_UA_PATTERN","IOS_DEVICE_UA_PATTERN","MACINTOSH_UA_PATTERN","MOBILE_UA_PATTERN","require_constants","require_openfin","cached","isGlobalScope","scope","g","name","detectPlatform","ua","platform","openfinUuid","openfinName","isWorker","finMe","isWebView","diagnostics","identity","isTopLevel","currentUrl","USER_INFO_PATTERN","recordedUrl","transform","value","url","error","bare","fullUrls","stripUrlQuery","cut","isOnline"],"sources":["../src/utils/platform.ts"],"sourcesContent":["// src/utils/platform.ts\n//\n// Detects host platform capabilities, OpenFin container metadata, and worker execution\n// realms. The result is cached, because it doesn't change during the life of a realm. A\n// webview is also a browser, so test for a webview first.\n\nimport {\n ANDROID_WEBVIEW_UA_PATTERN,\n IOS_DEVICE_UA_PATTERN,\n MACINTOSH_UA_PATTERN,\n MOBILE_UA_PATTERN,\n OPENFIN_UA_PATTERN,\n SAFARI_UA_TOKEN,\n WEBKIT_UA_TOKEN,\n} from \"../constants\";\nimport type { Diagnostics } from \"../core/diagnostics\";\nimport { getFin } from \"./openfin\";\n\n/** Host runtime environment classification attached to resource attributes. */\nexport type PlatformType =\n | \"openfin\"\n | \"openfin_web\"\n | \"browser\"\n | \"mobile_webview\"\n | \"ionic\"\n | \"web_worker\"\n | \"shared_worker\"\n | \"service_worker\"\n | \"node\";\n\n/** Host environment and runtime container metadata resolved at startup. */\nexport interface PlatformMetadata {\n /** Detected platform runtime classification. */\n platform: PlatformType;\n /** OpenFin application UUID if running inside an OpenFin container. */\n openfinUuid?: string;\n /** OpenFin window or view identifier. */\n openfinName?: string;\n /** Raw navigator user agent string or empty string if unavailable. */\n userAgent: string;\n /** True if the code runs in a worker realm. */\n isWorker: boolean;\n /** True if this context is the top-level document rather than an iframe. */\n isTopLevelDocument: boolean;\n}\n\n/** Indexed globalThis type for probing runtime globals. */\ntype Global = typeof globalThis & Record<string, unknown>;\n\n/** Cached platform metadata instance. */\nlet cached: PlatformMetadata | null = null;\n\n/** Abstract constructor type for global scope prototype checks. */\ntype ScopeConstructor = abstract new (...args: never[]) => object;\n\n/**\n * Checks whether globalThis is an instance of the given global scope constructor.\n * @param g Global scope object.\n * @param name Name of the scope constructor to check.\n * @returns True if globalThis inherits from the named scope constructor.\n */\nfunction isGlobalScope(g: Global, name: string): boolean {\n const scope = g[name];\n if (scope === undefined) {\n return false;\n }\n return g instanceof (scope as ScopeConstructor);\n}\n\n/**\n * Detects and caches host platform metadata for the active realm.\n * @param diagnostics Diagnostics reporter.\n * @returns Detected PlatformMetadata.\n */\nexport function detectPlatform(diagnostics: Diagnostics): PlatformMetadata {\n if (cached) {\n return cached;\n }\n const g = globalThis as Global;\n\n const ua = (g.navigator as Navigator | undefined)?.userAgent ?? \"\";\n let platform: PlatformType = \"browser\";\n let openfinUuid: string | undefined;\n let openfinName: string | undefined;\n let isWorker = false;\n\n const finMe = getFin()?.me;\n\n if (isGlobalScope(g, \"ServiceWorkerGlobalScope\")) {\n platform = \"service_worker\";\n isWorker = true;\n } else if (isGlobalScope(g, \"SharedWorkerGlobalScope\")) {\n platform = \"shared_worker\";\n isWorker = true;\n } else if (isGlobalScope(g, \"WorkerGlobalScope\")) {\n platform = \"web_worker\";\n isWorker = true;\n } else if (finMe !== undefined) {\n platform = OPENFIN_UA_PATTERN.test(ua) ? \"openfin\" : \"openfin_web\";\n diagnostics.guard(\"openfin.unavailable\", \"The library could not read fin.me.identity.\", () => {\n const identity = finMe.identity;\n openfinUuid = identity?.uuid;\n openfinName = identity?.name;\n });\n } else if (g.Capacitor !== undefined || g.Ionic !== undefined) {\n platform = \"ionic\";\n } else if (g.cordova !== undefined || isWebView(ua)) {\n platform = \"mobile_webview\";\n } else if (typeof document === \"undefined\" && typeof process !== \"undefined\") {\n platform = \"node\";\n }\n\n cached = {\n platform,\n openfinUuid,\n openfinName,\n userAgent: ua,\n isWorker,\n isTopLevelDocument: isTopLevel(diagnostics),\n };\n return cached;\n}\n\n/**\n * Checks whether a user agent string belongs to an embedded mobile webview.\n * @param ua User agent string.\n * @returns True if the user agent matches Android or iOS webview signatures.\n */\nfunction isWebView(ua: string): boolean {\n if (ANDROID_WEBVIEW_UA_PATTERN.test(ua)) {\n return true;\n }\n const ios =\n IOS_DEVICE_UA_PATTERN.test(ua) || (MACINTOSH_UA_PATTERN.test(ua) && MOBILE_UA_PATTERN.test(ua));\n return ios && ua.includes(WEBKIT_UA_TOKEN) && !ua.includes(SAFARI_UA_TOKEN);\n}\n\n/**\n * Checks whether the current window is the top-level browsing context.\n * @param diagnostics Diagnostics reporter. Counts a blocked read of window.top.\n * @returns True if top-level, false if framed or inaccessible due to cross-origin boundaries.\n */\nexport function isTopLevel(diagnostics: Diagnostics): boolean {\n if (typeof window === \"undefined\") {\n return false;\n }\n try {\n return window.self === window.top;\n } catch {\n // A cross-origin parent blocks the read, which proves a frame. Count it, but don't report it.\n diagnostics.count(\"platform.api_blocked\");\n return false;\n }\n}\n\n/**\n * Reads the current document URL without caching.\n * @param diagnostics Diagnostics reporter. Counts a blocked read of location.href.\n * @returns The current location.href, or an empty string.\n */\nexport function currentUrl(diagnostics: Diagnostics): string {\n try {\n return typeof location !== \"undefined\" ? location.href : \"\";\n } catch {\n // A sandbox can block the read. Count the fault, because a report per record would be noise.\n diagnostics.count(\"platform.api_blocked\");\n return \"\";\n }\n}\n\n/** Matches the user info of an absolute URL, for example \"user:pass@\". */\nconst USER_INFO_PATTERN = /^([a-z][a-z\\d+.-]*:\\/\\/)[^/?#]*@/i;\n\n/**\n * Returns the form of a URL that the library records. A transform's result is recorded as is,\n * or \"\" if it throws or returns no string. Without a transform, the user info is always\n * removed, because it is a credential, and without fullUrls the query and the fragment go too.\n * @param url Absolute or relative URL.\n * @param fullUrls Value of `capture.fullUrls`.\n * @param transform Value of `capture.urlTransform`. Replaces the default rule.\n * @param diagnostics Diagnostics reporter for a transform that throws.\n * @returns The URL to record.\n */\nexport function recordedUrl(\n url: string,\n fullUrls: boolean,\n transform?: ((url: string) => string | null) | null,\n diagnostics?: Diagnostics,\n): string {\n if (transform) {\n try {\n const value = transform(url);\n return typeof value === \"string\" ? value : \"\";\n } catch (error) {\n // Report the fault. Otherwise every recorded URL is empty with no visible cause.\n diagnostics?.report(\n \"capture.record_failed\",\n \"capture.urlTransform threw an error. The library records an empty URL.\",\n undefined,\n error,\n );\n return \"\";\n }\n }\n const bare = url.replace(USER_INFO_PATTERN, \"$1\");\n return fullUrls ? bare : stripUrlQuery(bare);\n}\n\n/**\n * Drops the query string and fragment from a URL. Cuts the string instead of parsing it,\n * because a relative request target has no base URL.\n * @param url Absolute or relative URL.\n * @returns The URL up to the first \"?\" or \"#\".\n */\nexport function stripUrlQuery(url: string): string {\n const cut = url.search(/[?#]/);\n\n return cut === -1 ? url : url.slice(0, cut);\n}\n\n/**\n * Checks whether the browser can reach the network. A host without navigator.onLine counts as\n * online.\n * @returns False only when navigator.onLine is false.\n */\nexport function isOnline(): boolean {\n return (globalThis as { navigator?: { onLine?: boolean } }).navigator?.onLine !== false;\n}\n\n/** Resets the cached platform metadata for testing. */\nexport function resetPlatformCache(): void {\n cached = null;\n}\n"],"mappings":"A,gFAkDA,IAAIQ,EAAkC,KAWtC,SAASC,EAAc,EAAW,EAAuB,CACvD,IAAMC,EAAQC,EAAEC,GAIhB,OAHIF,IAAU,IAAA,IAGPC,aAAcD,CACvB,CAOA,SAAgBG,EAAe,EAA4C,CACzE,GAAIL,EACF,OAAOA,EAET,IAAMG,EAAI,WAEJG,EAAMH,EAAE,WAAqC,WAAa,GAC5DI,EAAyB,UACzBC,EACAC,EACAC,EAAW,GAETC,EAAQnB,EAAAA,EAAO,CAAC,EAAE,GAkCxB,OAhCIS,EAAcE,EAAG,0BAA0B,GAC7C,EAAW,iBACX,EAAW,IACFF,EAAcE,EAAG,yBAAyB,GACnD,EAAW,gBACX,EAAW,IACFF,EAAcE,EAAG,mBAAmB,GAC7C,EAAW,aACX,EAAW,IACFQ,IAAU,IAAA,GAOVR,EAAE,YAAc,IAAA,IAAaA,EAAE,QAAU,IAAA,GAClD,EAAW,QACFA,EAAE,UAAY,IAAA,IAAaS,EAAUN,CAAE,EAChD,EAAW,iBACF,OAAO,SAAa,KAAe,OAAO,QAAY,MAC/D,EAAW,SAXX,EAAWb,EAAAA,GAAmB,KAAKa,CAAE,EAAI,UAAY,cACrDO,EAAY,MAAM,sBAAuB,kDAAqD,CAC5F,IAAMC,EAAWH,EAAM,SACvB,EAAcG,GAAU,KACxB,EAAcA,GAAU,IAC1B,CAAC,GASH,EAAS,CACP,WACA,cACA,cACA,UAAWR,EACX,WACA,mBAAoBS,EAAWF,CAAW,CAC5C,EACOb,CACT,CAOA,SAASY,EAAU,EAAqB,CAMtC,OALIlB,EAAAA,EAA2B,KAAKY,CAAE,EAC7B,IAGPX,EAAAA,GAAsB,KAAKW,CAAE,GAAMV,EAAAA,GAAqB,KAAKU,CAAE,GAAKT,EAAAA,GAAkB,KAAKS,CAAE,IACjFA,EAAG,SAAA,aAAwB,GAAK,CAACA,EAAG,SAAA,SAAwB,CAC5E,CAOA,SAAgBS,EAAW,EAAmC,CAC5D,GAAI,OAAO,OAAW,IACpB,MAAO,GAET,GAAI,CACF,OAAO,OAAO,OAAS,OAAO,GAChC,MAAQ,CAGN,OADAF,EAAY,MAAM,sBAAsB,EACjC,EACT,CACF,CAOA,SAAgBG,EAAW,EAAkC,CAC3D,GAAI,CACF,OAAO,OAAO,SAAa,IAAc,SAAS,KAAO,EAC3D,MAAQ,CAGN,OADAH,EAAY,MAAM,sBAAsB,EACjC,EACT,CACF,CAGA,IAAMI,EAAoB,oCAY1B,SAAgBC,EACd,EACA,EACA,EACA,EACQ,CACR,GAAIC,EACF,GAAI,CACF,IAAMC,EAAQD,EAAUE,CAAG,EAC3B,OAAO,OAAOD,GAAU,SAAWA,EAAQ,EAC7C,OAASE,EAAO,CAQd,OANAT,GAAa,OACX,wBACA,yEACA,IAAA,GACAS,CACF,EACO,EACT,CAEF,IAAMC,EAAOF,EAAI,QAAQJ,EAAmB,IAAI,EAChD,OAAOO,EAAWD,EAAOE,EAAcF,CAAI,CAC7C,CAQA,SAAgBE,EAAc,EAAqB,CACjD,IAAMC,EAAML,EAAI,OAAO,MAAM,EAE7B,OAAOK,IAAQ,GAAKL,EAAMA,EAAI,MAAM,EAAGK,CAAG,CAC5C,CAOA,SAAgBC,GAAoB,CAClC,OAAQ,WAAoD,WAAW,SAAW,EACpF,C"}
1
+ {"version":3,"file":"platform-BqRc-7RO.cjs","names":["getFin","OPENFIN_UA_PATTERN","ANDROID_WEBVIEW_UA_PATTERN","IOS_DEVICE_UA_PATTERN","MACINTOSH_UA_PATTERN","MOBILE_UA_PATTERN","require_constants","require_openfin","cached","isGlobalScope","scope","g","name","detectPlatform","ua","platform","openfinUuid","openfinName","isWorker","finMe","isWebView","diagnostics","identity","isTopLevel","currentUrl","USER_INFO_PATTERN","recordedUrl","transform","value","url","error","bare","fullUrls","stripUrlQuery","cut","isOnline"],"sources":["../src/utils/platform.ts"],"sourcesContent":["// src/utils/platform.ts\n//\n// Detects host platform capabilities, OpenFin container metadata, and worker execution\n// realms. The result is cached, because it doesn't change during the life of a realm. A\n// webview is also a browser, so test for a webview first.\n\nimport {\n ANDROID_WEBVIEW_UA_PATTERN,\n IOS_DEVICE_UA_PATTERN,\n MACINTOSH_UA_PATTERN,\n MOBILE_UA_PATTERN,\n OPENFIN_UA_PATTERN,\n SAFARI_UA_TOKEN,\n WEBKIT_UA_TOKEN,\n} from \"../constants\";\nimport type { Diagnostics } from \"../core/diagnostics\";\nimport { getFin } from \"./openfin\";\n\n/** Host runtime environment classification attached to resource attributes. */\nexport type PlatformType =\n | \"openfin\"\n | \"openfin_web\"\n | \"browser\"\n | \"mobile_webview\"\n | \"ionic\"\n | \"web_worker\"\n | \"shared_worker\"\n | \"service_worker\"\n | \"node\";\n\n/** Host environment and runtime container metadata resolved at startup. */\nexport interface PlatformMetadata {\n /** Detected platform runtime classification. */\n platform: PlatformType;\n /** OpenFin application UUID if running inside an OpenFin container. */\n openfinUuid?: string;\n /** OpenFin window or view identifier. */\n openfinName?: string;\n /** Raw navigator user agent string or empty string if unavailable. */\n userAgent: string;\n /** True if the code runs in a worker realm. */\n isWorker: boolean;\n /** True if this context is the top-level document rather than an iframe. */\n isTopLevelDocument: boolean;\n}\n\n/** Indexed globalThis type for probing runtime globals. */\ntype Global = typeof globalThis & Record<string, unknown>;\n\n/** Cached platform metadata instance. */\nlet cached: PlatformMetadata | null = null;\n\n/** Abstract constructor type for global scope prototype checks. */\ntype ScopeConstructor = abstract new (...args: never[]) => object;\n\n/**\n * Checks whether globalThis is an instance of the given global scope constructor.\n * @param g Global scope object.\n * @param name Name of the scope constructor to check.\n * @returns True if globalThis inherits from the named scope constructor.\n */\nfunction isGlobalScope(g: Global, name: string): boolean {\n const scope = g[name];\n if (scope === undefined) {\n return false;\n }\n return g instanceof (scope as ScopeConstructor);\n}\n\n/**\n * Detects and caches host platform metadata for the active realm.\n * @param diagnostics Diagnostics reporter.\n * @returns Detected PlatformMetadata.\n */\nexport function detectPlatform(diagnostics: Diagnostics): PlatformMetadata {\n if (cached) {\n return cached;\n }\n const g = globalThis as Global;\n\n const ua = (g.navigator as Navigator | undefined)?.userAgent ?? \"\";\n let platform: PlatformType = \"browser\";\n let openfinUuid: string | undefined;\n let openfinName: string | undefined;\n let isWorker = false;\n\n const finMe = getFin()?.me;\n\n if (isGlobalScope(g, \"ServiceWorkerGlobalScope\")) {\n platform = \"service_worker\";\n isWorker = true;\n } else if (isGlobalScope(g, \"SharedWorkerGlobalScope\")) {\n platform = \"shared_worker\";\n isWorker = true;\n } else if (isGlobalScope(g, \"WorkerGlobalScope\")) {\n platform = \"web_worker\";\n isWorker = true;\n } else if (finMe !== undefined) {\n platform = OPENFIN_UA_PATTERN.test(ua) ? \"openfin\" : \"openfin_web\";\n diagnostics.guard(\"openfin.unavailable\", \"The library could not read fin.me.identity.\", () => {\n const identity = finMe.identity;\n openfinUuid = identity?.uuid;\n openfinName = identity?.name;\n });\n } else if (g.Capacitor !== undefined || g.Ionic !== undefined) {\n platform = \"ionic\";\n } else if (g.cordova !== undefined || isWebView(ua)) {\n platform = \"mobile_webview\";\n } else if (typeof document === \"undefined\" && typeof process !== \"undefined\") {\n platform = \"node\";\n }\n\n cached = {\n platform,\n openfinUuid,\n openfinName,\n userAgent: ua,\n isWorker,\n isTopLevelDocument: isTopLevel(diagnostics),\n };\n return cached;\n}\n\n/**\n * Checks whether a user agent string belongs to an embedded mobile webview.\n * @param ua User agent string.\n * @returns True if the user agent matches Android or iOS webview signatures.\n */\nfunction isWebView(ua: string): boolean {\n if (ANDROID_WEBVIEW_UA_PATTERN.test(ua)) {\n return true;\n }\n const ios =\n IOS_DEVICE_UA_PATTERN.test(ua) || (MACINTOSH_UA_PATTERN.test(ua) && MOBILE_UA_PATTERN.test(ua));\n return ios && ua.includes(WEBKIT_UA_TOKEN) && !ua.includes(SAFARI_UA_TOKEN);\n}\n\n/**\n * Checks whether the current window is the top-level browsing context.\n * @param diagnostics Diagnostics reporter. Counts a blocked read of window.top.\n * @returns True if top-level, false if framed or inaccessible due to cross-origin boundaries.\n */\nexport function isTopLevel(diagnostics: Diagnostics): boolean {\n if (typeof window === \"undefined\") {\n return false;\n }\n try {\n return window.self === window.top;\n } catch {\n // A cross-origin parent blocks the read, which proves a frame. Count it, but don't report it.\n diagnostics.count(\"platform.api_blocked\");\n return false;\n }\n}\n\n/**\n * Reads the current document URL without caching.\n * @param diagnostics Diagnostics reporter. Counts a blocked read of location.href.\n * @returns The current location.href, or an empty string.\n */\nexport function currentUrl(diagnostics: Diagnostics): string {\n try {\n return typeof location !== \"undefined\" ? location.href : \"\";\n } catch {\n // A sandbox can block the read. Count the fault, because a report per record would be noise.\n diagnostics.count(\"platform.api_blocked\");\n return \"\";\n }\n}\n\n/** Matches the user info of an absolute URL, for example \"user:pass@\". */\nconst USER_INFO_PATTERN = /^([a-z][a-z\\d+.-]*:\\/\\/)[^/?#]*@/i;\n\n/**\n * Returns the form of a URL that the library records. A transform's result is recorded as is,\n * or \"\" if it throws or returns no string. Without a transform, the user info is always\n * removed, because it is a credential, and without fullUrls the query and the fragment go too.\n * @param url Absolute or relative URL.\n * @param fullUrls Value of `capture.fullUrls`.\n * @param transform Value of `capture.urlTransform`. Replaces the default rule.\n * @param diagnostics Diagnostics reporter for a transform that throws.\n * @returns The URL to record.\n */\nexport function recordedUrl(\n url: string,\n fullUrls: boolean,\n transform?: ((url: string) => string | null) | null,\n diagnostics?: Diagnostics,\n): string {\n if (transform) {\n try {\n const value = transform(url);\n return typeof value === \"string\" ? value : \"\";\n } catch (error) {\n // Report the fault. Otherwise every recorded URL is empty with no visible cause.\n diagnostics?.report(\n \"capture.record_failed\",\n \"capture.urlTransform threw an error. The library records an empty URL.\",\n undefined,\n error,\n );\n return \"\";\n }\n }\n const bare = url.replace(USER_INFO_PATTERN, \"$1\");\n return fullUrls ? bare : stripUrlQuery(bare);\n}\n\n/**\n * Drops the query string and fragment from a URL. Cuts the string instead of parsing it,\n * because a relative request target has no base URL.\n * @param url Absolute or relative URL.\n * @returns The URL up to the first \"?\" or \"#\".\n */\nexport function stripUrlQuery(url: string): string {\n const cut = url.search(/[?#]/);\n\n return cut === -1 ? url : url.slice(0, cut);\n}\n\n/**\n * Checks whether the browser can reach the network. A host without navigator.onLine counts as\n * online.\n * @returns False only when navigator.onLine is false.\n */\nexport function isOnline(): boolean {\n return (globalThis as { navigator?: { onLine?: boolean } }).navigator?.onLine !== false;\n}\n\n/** Resets the cached platform metadata for testing. */\nexport function resetPlatformCache(): void {\n cached = null;\n}\n"],"mappings":"A,gFAkDA,IAAIQ,EAAkC,KAWtC,SAASC,EAAc,EAAW,EAAuB,CACvD,IAAMC,EAAQC,EAAEC,GAIhB,OAHIF,IAAU,IAAA,IAGPC,aAAcD,CACvB,CAOA,SAAgBG,EAAe,EAA4C,CACzE,GAAIL,EACF,OAAOA,EAET,IAAMG,EAAI,WAEJG,EAAMH,EAAE,WAAqC,WAAa,GAC5DI,EAAyB,UACzBC,EACAC,EACAC,EAAW,GAETC,EAAQnB,EAAAA,EAAO,CAAC,EAAE,GAkCxB,OAhCIS,EAAcE,EAAG,0BAA0B,GAC7C,EAAW,iBACX,EAAW,IACFF,EAAcE,EAAG,yBAAyB,GACnD,EAAW,gBACX,EAAW,IACFF,EAAcE,EAAG,mBAAmB,GAC7C,EAAW,aACX,EAAW,IACFQ,IAAU,IAAA,GAOVR,EAAE,YAAc,IAAA,IAAaA,EAAE,QAAU,IAAA,GAClD,EAAW,QACFA,EAAE,UAAY,IAAA,IAAaS,EAAUN,CAAE,EAChD,EAAW,iBACF,OAAO,SAAa,KAAe,OAAO,QAAY,MAC/D,EAAW,SAXX,EAAWb,EAAAA,GAAmB,K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AAGK,CAAG,CAC5C,CAOA,SAAgBC,GAAoB,CAClC,OAAQ,WAAoD,WAAW,SAAW,EACpF,C"}
@@ -1,10 +1,10 @@
1
- import { $t as e, Jt as t, Xt as n, Yt as r, en as i, er as a, tn as o, zt as s } from "./constants-CUyd9cTZ.js";
1
+ import { $t as e, Bt as t, Qt as n, Zt as r, in as i, nn as a, rn as o, rr as s } from "./constants-BwJDXzj6.js";
2
2
  import { t as c } from "./unref-DgHPQeWv.js";
3
3
  import { t as l } from "./defineProperty-s2S8BXUc.js";
4
4
  // src/core/profile-buckets.ts
5
5
  var u = 16, d = u - 1;
6
6
  function f(e) {
7
- let t = Math.min(e, i);
7
+ let t = Math.min(e, o);
8
8
  if (t < u) return t;
9
9
  let n = 31 - Math.clz32(t) - 4;
10
10
  return n + 1 << 4 | t >>> n & d;
@@ -38,7 +38,7 @@ function h(e, t) {
38
38
  };
39
39
  }
40
40
  // src/core/profiler.ts
41
- var g = 4, _ = 0, v = 1, y = 2, b = 3, x = 2, S = 2 ** 31 - 1, C = 3, w = 3, T = Symbol.for(`${r}@${a}`), E = {
41
+ var g = 4, _ = 0, v = 1, y = 2, b = 3, x = 2, S = 2 ** 31 - 1, C = 3, w = 3, T = Symbol.for(`${n}@${s}`), E = {
42
42
  begin: () => -1,
43
43
  end: () => void 0,
44
44
  endAfterPaint: () => void 0,
@@ -47,15 +47,15 @@ var g = 4, _ = 0, v = 1, y = 2, b = 3, x = 2, S = 2 ** 31 - 1, C = 3, w = 3, T =
47
47
  constructor() {
48
48
  l(this, "registry", /* @__PURE__ */ new Map()), l(this, "limit", 0), l(this, "stats", /* @__PURE__ */ new Float64Array()), l(this, "hist", /* @__PURE__ */ new Uint32Array()), l(this, "selfHist", /* @__PURE__ */ new Uint32Array()), l(this, "stack", new Float64Array(32 * C)), l(this, "depth", 0), l(this, "ring", /* @__PURE__ */ new Float64Array()), l(this, "ringAt", 0), l(this, "linkMs", Infinity), l(this, "painted", []), l(this, "channel", void 0), l(this, "sampling", /* @__PURE__ */ new Int32Array()), l(this, "floor", -1), l(this, "timer", null), l(this, "startedAt", 0), l(this, "badTokens", 0), l(this, "overhead", void 0), l(this, "calibrated", !1), l(this, "sink", null), l(this, "reported", !1), l(this, "limitDue", !1);
49
49
  }
50
- probe(e, t, r) {
51
- if (typeof e != "string" || e === "") return r?.report("config.invalid", "The probe name must be a string that is not empty. The probe does nothing."), E;
52
- let i = this.registry.get(e);
50
+ probe(t, n, r) {
51
+ if (typeof t != "string" || t === "") return r?.report("config.invalid", "The probe name must be a string that is not empty. The probe does nothing."), E;
52
+ let i = this.registry.get(t);
53
53
  if (i) return i.probe;
54
- if (this.registry.size >= 1024) return r?.report("config.invalid", `The profiler keeps at most ${String(n)} probe names. The probe ${e} does nothing.`), E;
55
- let a = this.rulesOf(e, t, r), { period: o } = a;
56
- if (this.registry.has(e) || this.registry.size >= 1024) return this.probe(e, void 0, r);
57
- let s = this.registry.size + 1, c = this.makeProbe(e, s, a), { probe: l } = c;
58
- return this.registry.set(e, c), s < this.limit ? this.prime(s, o) : this.limit > 0 && !this.reported && (this.reported = !0, this.sink?.diagnostics.report("config.invalid", `The probe ${e} is above the profiler.maxProbes limit of ${String(this.limit - 1)}. The probe does nothing.`) === !1 && (this.limitDue = !0)), l;
54
+ if (this.registry.size >= 1024) return r?.report("config.invalid", `The profiler keeps at most ${String(e)} probe names. The probe ${t} does nothing.`), E;
55
+ let a = this.rulesOf(t, n, r), { period: o } = a;
56
+ if (this.registry.has(t) || this.registry.size >= 1024) return this.probe(t, void 0, r);
57
+ let s = this.registry.size + 1, c = this.makeProbe(t, s, a), { probe: l } = c;
58
+ return this.registry.set(t, c), s < this.limit ? this.prime(s, o) : this.limit > 0 && !this.reported && (this.reported = !0, this.sink?.diagnostics.report("config.invalid", `The probe ${t} is above the profiler.maxProbes limit of ${String(this.limit - 1)}. The probe does nothing.`) === !1 && (this.limitDue = !0)), l;
59
59
  }
60
60
  time(e, t, n) {
61
61
  this.probe(e, void 0, n);
@@ -124,46 +124,46 @@ var g = 4, _ = 0, v = 1, y = 2, b = 3, x = 2, S = 2 ** 31 - 1, C = 3, w = 3, T =
124
124
  }
125
125
  return typeof i == "number" && Number.isInteger(i) && i >= 1 && i <= S ? r.period = i : i !== void 0 && n?.report("config.invalid", `The sampleEvery option of the probe ${e} must be an integer from 1 to ${String(S)}. The library uses 1.`), typeof a == "number" && a >= 0 && a < Infinity ? r.threshold = a : a !== void 0 && n?.report("config.invalid", `The slowMs option of the probe ${e} must be a finite number, 0 or larger. The probe adds no breadcrumb.`), typeof o == "boolean" ? r.loose = o : o !== void 0 && n?.report("config.invalid", `The async option of the probe ${e} must be a boolean. The library uses false.`), r;
126
126
  }
127
- makeProbe(t, n, r) {
128
- let { period: i, threshold: a, loose: o } = r, s = (e) => {
129
- this.add(n, e), e > a && this.sink?.outlier(t, e);
130
- }, c = (e, t) => {
131
- n < this.limit && e > this.floor && s(t - e);
127
+ makeProbe(e, t, n) {
128
+ let { period: r, threshold: i, loose: o } = n, s = (n) => {
129
+ this.add(t, n), n > i && this.sink?.outlier(e, n);
130
+ }, c = (e, n) => {
131
+ t < this.limit && e > this.floor && s(n - e);
132
132
  }, l = (e) => {
133
- o || this.pop(n, e, performance.now());
133
+ o || this.pop(t, e, performance.now());
134
134
  }, u = (e) => {
135
- let t = typeof e == "number" && e >= 0 ? performance.now() : -1;
136
- if (t < 0) {
137
- e !== -1 && n < this.limit && this.badTokens++;
135
+ let n = typeof e == "number" && e >= 0 ? performance.now() : -1;
136
+ if (n < 0) {
137
+ e !== -1 && t < this.limit && this.badTokens++;
138
138
  return;
139
139
  }
140
140
  if (o) {
141
- c(e, t);
141
+ c(e, n);
142
142
  return;
143
143
  }
144
- if (n >= this.limit || e <= this.floor) return;
145
- let r = this.pop(n, e, t);
146
- s(t - e), r >= 0 && this.selfHist[n * 368 + f(Math.ceil(r * 1e3))]++;
144
+ if (t >= this.limit || e <= this.floor) return;
145
+ let r = this.pop(t, e, n);
146
+ s(n - e), r >= 0 && this.selfHist[t * 368 + f(Math.ceil(r * 1e3))]++;
147
147
  };
148
148
  return {
149
149
  probe: {
150
150
  begin: () => {
151
- if (n >= this.limit || !this.sampled(n)) return -1;
151
+ if (t >= this.limit || !this.sampled(t)) return -1;
152
152
  let e = performance.now();
153
- return o || this.push(n, e), e;
153
+ return o || this.push(t, e), e;
154
154
  },
155
155
  end: u,
156
156
  endAfterPaint: (e) => {
157
- typeof e == "number" && e >= 0 && n < this.limit && this.afterPaint((t) => {
157
+ typeof e == "number" && e >= 0 && t < this.limit && this.afterPaint((t) => {
158
158
  c(e, t);
159
159
  }) ? l(e) : u(e);
160
160
  },
161
- record: (r) => {
162
- n >= this.limit || (typeof r != "number" || !Number.isFinite(r) || r < 0 ? this.sink?.diagnostics.report("record.dropped_malformed", `The duration of the probe ${t} is not valid. The library dropped it.`, { [e.probe]: t }) : this.sampled(n) && s(r));
161
+ record: (n) => {
162
+ t >= this.limit || (typeof n != "number" || !Number.isFinite(n) || n < 0 ? this.sink?.diagnostics.report("record.dropped_malformed", `The duration of the probe ${e} is not valid. The library dropped it.`, { [a.probe]: e }) : this.sampled(t) && s(n));
163
163
  }
164
164
  },
165
- slot: n,
166
- period: i,
165
+ slot: t,
166
+ period: r,
167
167
  settle: c,
168
168
  leave: l
169
169
  };
@@ -237,32 +237,32 @@ var g = 4, _ = 0, v = 1, y = 2, b = 3, x = 2, S = 2 ** 31 - 1, C = 3, w = 3, T =
237
237
  for (let e = 1; e < this.limit; e++) if (this.stats[e * g + _] > 0) return !0;
238
238
  return !1;
239
239
  }
240
- emitSlot(t, n, r, i) {
241
- let { stats: a, hist: c } = this, l = r.slot * g, u = r.slot * 368, d = a[l + _], f = a[l + y], p = a[l + b], x = (e) => Math.min(Math.max(m(c, u, d, e) / 1e3, f), p), S = {
242
- [e.probe]: n,
243
- [e.sampleEvery]: r.period,
244
- [e.p50]: x(.5),
245
- [e.p90]: x(.9),
246
- [e.p99]: x(.99)
240
+ emitSlot(e, n, r, o) {
241
+ let { stats: s, hist: c } = this, l = r.slot * g, u = r.slot * 368, d = s[l + _], f = s[l + y], p = s[l + b], x = (e) => Math.min(Math.max(m(c, u, d, e) / 1e3, f), p), S = {
242
+ [a.probe]: n,
243
+ [a.sampleEvery]: r.period,
244
+ [a.p50]: x(.5),
245
+ [a.p90]: x(.9),
246
+ [a.p99]: x(.99)
247
247
  };
248
- this.overhead !== void 0 && (S[e.overhead] = this.overhead);
248
+ this.overhead !== void 0 && (S[a.overhead] = this.overhead);
249
249
  let { selfHist: C } = this, w = 0;
250
250
  for (let e = u; e < u + 368; e++) w += C[e];
251
- w > 0 && (S[e.selfP99] = Math.min(m(C, u, w, .99) / 1e3, p));
251
+ w > 0 && (S[a.selfP99] = Math.min(m(C, u, w, .99) / 1e3, p));
252
252
  let { bounds: T, counts: E } = h(c, u), D = {
253
- "metric.name": o,
253
+ "metric.name": i,
254
254
  "metric.unit": "ms",
255
255
  "metric.type": "histogram",
256
- [s.start]: i,
257
- [s.attributeKeys]: [e.probe, e.sampleEvery],
258
- [s.count]: d,
259
- [s.sum]: a[l + v],
260
- [s.min]: f,
261
- [s.max]: p,
262
- [s.bounds]: T,
263
- [s.buckets]: E
256
+ [t.start]: o,
257
+ [t.attributeKeys]: [a.probe, a.sampleEvery],
258
+ [t.count]: d,
259
+ [t.sum]: s[l + v],
260
+ [t.min]: f,
261
+ [t.max]: p,
262
+ [t.bounds]: T,
263
+ [t.buckets]: E
264
264
  };
265
- a.fill(0, l, l + g), c.fill(0, u, u + 368), C.fill(0, u, u + 368), t.emit(o, S, D);
265
+ s.fill(0, l, l + g), c.fill(0, u, u + 368), C.fill(0, u, u + 368), e.emit(i, S, D);
266
266
  }
267
267
  calibrate() {
268
268
  this.calibrated = !0;
@@ -270,15 +270,15 @@ var g = 4, _ = 0, v = 1, y = 2, b = 3, x = 2, S = 2 ** 31 - 1, C = 3, w = 3, T =
270
270
  period: 1,
271
271
  threshold: Infinity,
272
272
  loose: !1
273
- }), n = performance.now(), r = n;
274
- for (let e = 0; e < 1e5 && r === n; e++) r = performance.now();
275
- if (r === n) return;
276
- let i = r + 2, a = r, o = 0;
277
- for (let n = 0; n < t; n++) {
278
- let t = e.begin();
279
- if (e.end(t), t !== a && (a = t, o = n, t >= i)) break;
273
+ }), t = performance.now(), n = t;
274
+ for (let e = 0; e < 1e5 && n === t; e++) n = performance.now();
275
+ if (n === t) return;
276
+ let i = n + 2, a = n, o = 0;
277
+ for (let t = 0; t < r; t++) {
278
+ let n = e.begin();
279
+ if (e.end(n), n !== a && (a = n, o = t, n >= i)) break;
280
280
  }
281
- o > 0 && (this.overhead = Math.round((a - r) * 1e6 / o));
281
+ o > 0 && (this.overhead = Math.round((a - n) * 1e6 / o));
282
282
  }
283
283
  };
284
284
  function O() {
@@ -289,4 +289,4 @@ function O() {
289
289
  }
290
290
  export { O as t };
291
291
 
292
- //# sourceMappingURL=profiler-BAZoh7A4.js.map
292
+ //# sourceMappingURL=profiler-BaXSqCfz.js.map