@tracelog/lib 0.8.0 → 0.8.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (510) hide show
  1. package/README.md +28 -7
  2. package/dist/browser/tracelog.esm.js +669 -693
  3. package/dist/browser/tracelog.esm.js.map +1 -1
  4. package/dist/browser/tracelog.js +2 -2
  5. package/dist/browser/tracelog.js.map +1 -1
  6. package/dist/cjs/api.d.ts +2 -1
  7. package/dist/cjs/api.d.ts.map +1 -0
  8. package/dist/cjs/api.js +7 -6
  9. package/dist/cjs/api.js.map +1 -0
  10. package/dist/cjs/app.constants.d.ts +2 -0
  11. package/dist/cjs/app.constants.d.ts.map +1 -0
  12. package/dist/cjs/app.constants.js +17 -1
  13. package/dist/cjs/app.constants.js.map +1 -0
  14. package/dist/cjs/app.d.ts +2 -1
  15. package/dist/cjs/app.d.ts.map +1 -0
  16. package/dist/cjs/app.js +9 -9
  17. package/dist/cjs/app.js.map +1 -0
  18. package/dist/cjs/constants/config.constants.d.ts +8 -2
  19. package/dist/cjs/constants/config.constants.d.ts.map +1 -0
  20. package/dist/cjs/constants/config.constants.js +13 -6
  21. package/dist/cjs/constants/config.constants.js.map +1 -0
  22. package/dist/cjs/constants/error.constants.d.ts +1 -0
  23. package/dist/cjs/constants/error.constants.d.ts.map +1 -0
  24. package/dist/cjs/constants/error.constants.js +1 -0
  25. package/dist/cjs/constants/error.constants.js.map +1 -0
  26. package/dist/cjs/constants/index.d.ts +1 -0
  27. package/dist/cjs/constants/index.d.ts.map +1 -0
  28. package/dist/cjs/constants/index.js +1 -0
  29. package/dist/cjs/constants/index.js.map +1 -0
  30. package/dist/cjs/constants/performance.constants.d.ts +1 -0
  31. package/dist/cjs/constants/performance.constants.d.ts.map +1 -0
  32. package/dist/cjs/constants/performance.constants.js +1 -0
  33. package/dist/cjs/constants/performance.constants.js.map +1 -0
  34. package/dist/cjs/constants/storage.constants.d.ts +1 -0
  35. package/dist/cjs/constants/storage.constants.d.ts.map +1 -0
  36. package/dist/cjs/constants/storage.constants.js +1 -0
  37. package/dist/cjs/constants/storage.constants.js.map +1 -0
  38. package/dist/cjs/handlers/click.handler.d.ts +1 -0
  39. package/dist/cjs/handlers/click.handler.d.ts.map +1 -0
  40. package/dist/cjs/handlers/click.handler.js +1 -0
  41. package/dist/cjs/handlers/click.handler.js.map +1 -0
  42. package/dist/cjs/handlers/error.handler.d.ts +1 -0
  43. package/dist/cjs/handlers/error.handler.d.ts.map +1 -0
  44. package/dist/cjs/handlers/error.handler.js +1 -0
  45. package/dist/cjs/handlers/error.handler.js.map +1 -0
  46. package/dist/cjs/handlers/page-view.handler.d.ts +1 -0
  47. package/dist/cjs/handlers/page-view.handler.d.ts.map +1 -0
  48. package/dist/cjs/handlers/page-view.handler.js +2 -1
  49. package/dist/cjs/handlers/page-view.handler.js.map +1 -0
  50. package/dist/cjs/handlers/performance.handler.d.ts +1 -0
  51. package/dist/cjs/handlers/performance.handler.d.ts.map +1 -0
  52. package/dist/cjs/handlers/performance.handler.js +1 -0
  53. package/dist/cjs/handlers/performance.handler.js.map +1 -0
  54. package/dist/cjs/handlers/scroll.handler.d.ts +1 -0
  55. package/dist/cjs/handlers/scroll.handler.d.ts.map +1 -0
  56. package/dist/cjs/handlers/scroll.handler.js +4 -1
  57. package/dist/cjs/handlers/scroll.handler.js.map +1 -0
  58. package/dist/cjs/handlers/session.handler.d.ts +3 -2
  59. package/dist/cjs/handlers/session.handler.d.ts.map +1 -0
  60. package/dist/cjs/handlers/session.handler.js +7 -6
  61. package/dist/cjs/handlers/session.handler.js.map +1 -0
  62. package/dist/cjs/integrations/google-analytics.integration.d.ts +1 -0
  63. package/dist/cjs/integrations/google-analytics.integration.d.ts.map +1 -0
  64. package/dist/cjs/integrations/google-analytics.integration.js +7 -2
  65. package/dist/cjs/integrations/google-analytics.integration.js.map +1 -0
  66. package/dist/cjs/listeners/activity-listener-manager.d.ts +1 -0
  67. package/dist/cjs/listeners/activity-listener-manager.d.ts.map +1 -0
  68. package/dist/cjs/listeners/activity-listener-manager.js +1 -0
  69. package/dist/cjs/listeners/activity-listener-manager.js.map +1 -0
  70. package/dist/cjs/listeners/index.d.ts +1 -0
  71. package/dist/cjs/listeners/index.d.ts.map +1 -0
  72. package/dist/cjs/listeners/index.js +1 -0
  73. package/dist/cjs/listeners/index.js.map +1 -0
  74. package/dist/cjs/listeners/input-listener-managers.d.ts +1 -0
  75. package/dist/cjs/listeners/input-listener-managers.d.ts.map +1 -0
  76. package/dist/cjs/listeners/input-listener-managers.js +1 -0
  77. package/dist/cjs/listeners/input-listener-managers.js.map +1 -0
  78. package/dist/cjs/listeners/listeners.types.d.ts +1 -0
  79. package/dist/cjs/listeners/listeners.types.d.ts.map +1 -0
  80. package/dist/cjs/listeners/listeners.types.js +1 -0
  81. package/dist/cjs/listeners/listeners.types.js.map +1 -0
  82. package/dist/cjs/listeners/touch-listener-manager.d.ts +1 -0
  83. package/dist/cjs/listeners/touch-listener-manager.d.ts.map +1 -0
  84. package/dist/cjs/listeners/touch-listener-manager.js +1 -0
  85. package/dist/cjs/listeners/touch-listener-manager.js.map +1 -0
  86. package/dist/cjs/listeners/unload-listener-manager.d.ts +1 -0
  87. package/dist/cjs/listeners/unload-listener-manager.d.ts.map +1 -0
  88. package/dist/cjs/listeners/unload-listener-manager.js +1 -0
  89. package/dist/cjs/listeners/unload-listener-manager.js.map +1 -0
  90. package/dist/cjs/listeners/visibility-listener-manager.d.ts +1 -0
  91. package/dist/cjs/listeners/visibility-listener-manager.d.ts.map +1 -0
  92. package/dist/cjs/listeners/visibility-listener-manager.js +1 -0
  93. package/dist/cjs/listeners/visibility-listener-manager.js.map +1 -0
  94. package/dist/cjs/managers/event.manager.d.ts +1 -0
  95. package/dist/cjs/managers/event.manager.d.ts.map +1 -0
  96. package/dist/cjs/managers/event.manager.js +4 -3
  97. package/dist/cjs/managers/event.manager.js.map +1 -0
  98. package/dist/cjs/managers/sender.manager.d.ts +1 -8
  99. package/dist/cjs/managers/sender.manager.d.ts.map +1 -0
  100. package/dist/cjs/managers/sender.manager.js +32 -115
  101. package/dist/cjs/managers/sender.manager.js.map +1 -0
  102. package/dist/cjs/managers/session.manager.d.ts +3 -2
  103. package/dist/cjs/managers/session.manager.d.ts.map +1 -0
  104. package/dist/cjs/managers/session.manager.js +26 -27
  105. package/dist/cjs/managers/session.manager.js.map +1 -0
  106. package/dist/cjs/managers/state.manager.d.ts +1 -0
  107. package/dist/cjs/managers/state.manager.d.ts.map +1 -0
  108. package/dist/cjs/managers/state.manager.js +1 -0
  109. package/dist/cjs/managers/state.manager.js.map +1 -0
  110. package/dist/cjs/managers/storage.manager.d.ts +1 -0
  111. package/dist/cjs/managers/storage.manager.d.ts.map +1 -0
  112. package/dist/cjs/managers/storage.manager.js +4 -1
  113. package/dist/cjs/managers/storage.manager.js.map +1 -0
  114. package/dist/cjs/managers/user.manager.d.ts +1 -0
  115. package/dist/cjs/managers/user.manager.d.ts.map +1 -0
  116. package/dist/cjs/managers/user.manager.js +1 -0
  117. package/dist/cjs/managers/user.manager.js.map +1 -0
  118. package/dist/cjs/public-api.d.ts +2 -1
  119. package/dist/cjs/public-api.d.ts.map +1 -0
  120. package/dist/cjs/public-api.js +1 -0
  121. package/dist/cjs/public-api.js.map +1 -0
  122. package/dist/cjs/test-bridge.d.ts +2 -5
  123. package/dist/cjs/test-bridge.d.ts.map +1 -0
  124. package/dist/cjs/test-bridge.js +3 -10
  125. package/dist/cjs/test-bridge.js.map +1 -0
  126. package/dist/cjs/types/common.types.d.ts +6 -1
  127. package/dist/cjs/types/common.types.d.ts.map +1 -0
  128. package/dist/cjs/types/common.types.js +1 -0
  129. package/dist/cjs/types/common.types.js.map +1 -0
  130. package/dist/cjs/types/config.types.d.ts +1 -0
  131. package/dist/cjs/types/config.types.d.ts.map +1 -0
  132. package/dist/cjs/types/config.types.js +1 -0
  133. package/dist/cjs/types/config.types.js.map +1 -0
  134. package/dist/cjs/types/device.types.d.ts +1 -0
  135. package/dist/cjs/types/device.types.d.ts.map +1 -0
  136. package/dist/cjs/types/device.types.js +1 -0
  137. package/dist/cjs/types/device.types.js.map +1 -0
  138. package/dist/cjs/types/emitter.types.d.ts +1 -0
  139. package/dist/cjs/types/emitter.types.d.ts.map +1 -0
  140. package/dist/cjs/types/emitter.types.js +1 -0
  141. package/dist/cjs/types/emitter.types.js.map +1 -0
  142. package/dist/cjs/types/error.types.d.ts +1 -0
  143. package/dist/cjs/types/error.types.d.ts.map +1 -0
  144. package/dist/cjs/types/error.types.js +1 -0
  145. package/dist/cjs/types/error.types.js.map +1 -0
  146. package/dist/cjs/types/event.types.d.ts +1 -0
  147. package/dist/cjs/types/event.types.d.ts.map +1 -0
  148. package/dist/cjs/types/event.types.js +1 -0
  149. package/dist/cjs/types/event.types.js.map +1 -0
  150. package/dist/cjs/types/index.d.ts +1 -0
  151. package/dist/cjs/types/index.d.ts.map +1 -0
  152. package/dist/cjs/types/index.js +1 -0
  153. package/dist/cjs/types/index.js.map +1 -0
  154. package/dist/cjs/types/log.types.d.ts +1 -0
  155. package/dist/cjs/types/log.types.d.ts.map +1 -0
  156. package/dist/cjs/types/log.types.js +1 -0
  157. package/dist/cjs/types/log.types.js.map +1 -0
  158. package/dist/cjs/types/mode.types.d.ts +1 -0
  159. package/dist/cjs/types/mode.types.d.ts.map +1 -0
  160. package/dist/cjs/types/mode.types.js +1 -0
  161. package/dist/cjs/types/mode.types.js.map +1 -0
  162. package/dist/cjs/types/queue.types.d.ts +1 -0
  163. package/dist/cjs/types/queue.types.d.ts.map +1 -0
  164. package/dist/cjs/types/queue.types.js +1 -0
  165. package/dist/cjs/types/queue.types.js.map +1 -0
  166. package/dist/cjs/types/session.types.d.ts +1 -0
  167. package/dist/cjs/types/session.types.d.ts.map +1 -0
  168. package/dist/cjs/types/session.types.js +1 -0
  169. package/dist/cjs/types/session.types.js.map +1 -0
  170. package/dist/cjs/types/state.types.d.ts +1 -0
  171. package/dist/cjs/types/state.types.d.ts.map +1 -0
  172. package/dist/cjs/types/state.types.js +1 -0
  173. package/dist/cjs/types/state.types.js.map +1 -0
  174. package/dist/cjs/types/test-bridge.types.d.ts +2 -1
  175. package/dist/cjs/types/test-bridge.types.d.ts.map +1 -0
  176. package/dist/cjs/types/test-bridge.types.js +1 -0
  177. package/dist/cjs/types/test-bridge.types.js.map +1 -0
  178. package/dist/cjs/types/validation-error.types.d.ts +1 -0
  179. package/dist/cjs/types/validation-error.types.d.ts.map +1 -0
  180. package/dist/cjs/types/validation-error.types.js +1 -0
  181. package/dist/cjs/types/validation-error.types.js.map +1 -0
  182. package/dist/cjs/types/window.types.d.ts +1 -0
  183. package/dist/cjs/types/window.types.d.ts.map +1 -0
  184. package/dist/cjs/types/window.types.js +1 -0
  185. package/dist/cjs/types/window.types.js.map +1 -0
  186. package/dist/cjs/utils/browser/device-detector.utils.d.ts +1 -0
  187. package/dist/cjs/utils/browser/device-detector.utils.d.ts.map +1 -0
  188. package/dist/cjs/utils/browser/device-detector.utils.js +1 -0
  189. package/dist/cjs/utils/browser/device-detector.utils.js.map +1 -0
  190. package/dist/cjs/utils/browser/index.d.ts +1 -0
  191. package/dist/cjs/utils/browser/index.d.ts.map +1 -0
  192. package/dist/cjs/utils/browser/index.js +1 -0
  193. package/dist/cjs/utils/browser/index.js.map +1 -0
  194. package/dist/cjs/utils/browser/qa-mode.utils.d.ts +1 -0
  195. package/dist/cjs/utils/browser/qa-mode.utils.d.ts.map +1 -0
  196. package/dist/cjs/utils/browser/qa-mode.utils.js +1 -0
  197. package/dist/cjs/utils/browser/qa-mode.utils.js.map +1 -0
  198. package/dist/cjs/utils/browser/utm-params.utils.d.ts +1 -0
  199. package/dist/cjs/utils/browser/utm-params.utils.d.ts.map +1 -0
  200. package/dist/cjs/utils/browser/utm-params.utils.js +1 -0
  201. package/dist/cjs/utils/browser/utm-params.utils.js.map +1 -0
  202. package/dist/cjs/utils/data/index.d.ts +1 -0
  203. package/dist/cjs/utils/data/index.d.ts.map +1 -0
  204. package/dist/cjs/utils/data/index.js +1 -0
  205. package/dist/cjs/utils/data/index.js.map +1 -0
  206. package/dist/cjs/utils/data/uuid.utils.d.ts +1 -0
  207. package/dist/cjs/utils/data/uuid.utils.d.ts.map +1 -0
  208. package/dist/cjs/utils/data/uuid.utils.js +1 -0
  209. package/dist/cjs/utils/data/uuid.utils.js.map +1 -0
  210. package/dist/cjs/utils/emitter.utils.d.ts +1 -0
  211. package/dist/cjs/utils/emitter.utils.d.ts.map +1 -0
  212. package/dist/cjs/utils/emitter.utils.js +4 -1
  213. package/dist/cjs/utils/emitter.utils.js.map +1 -0
  214. package/dist/cjs/utils/index.d.ts +1 -0
  215. package/dist/cjs/utils/index.d.ts.map +1 -0
  216. package/dist/cjs/utils/index.js +1 -0
  217. package/dist/cjs/utils/index.js.map +1 -0
  218. package/dist/cjs/utils/logging.utils.d.ts +1 -0
  219. package/dist/cjs/utils/logging.utils.d.ts.map +1 -0
  220. package/dist/cjs/utils/logging.utils.js +1 -0
  221. package/dist/cjs/utils/logging.utils.js.map +1 -0
  222. package/dist/cjs/utils/network/index.d.ts +1 -0
  223. package/dist/cjs/utils/network/index.d.ts.map +1 -0
  224. package/dist/cjs/utils/network/index.js +1 -0
  225. package/dist/cjs/utils/network/index.js.map +1 -0
  226. package/dist/cjs/utils/network/url.utils.d.ts +1 -0
  227. package/dist/cjs/utils/network/url.utils.d.ts.map +1 -0
  228. package/dist/cjs/utils/network/url.utils.js +1 -0
  229. package/dist/cjs/utils/network/url.utils.js.map +1 -0
  230. package/dist/cjs/utils/security/index.d.ts +1 -0
  231. package/dist/cjs/utils/security/index.d.ts.map +1 -0
  232. package/dist/cjs/utils/security/index.js +1 -0
  233. package/dist/cjs/utils/security/index.js.map +1 -0
  234. package/dist/cjs/utils/security/sanitize.utils.d.ts +1 -0
  235. package/dist/cjs/utils/security/sanitize.utils.d.ts.map +1 -0
  236. package/dist/cjs/utils/security/sanitize.utils.js +2 -1
  237. package/dist/cjs/utils/security/sanitize.utils.js.map +1 -0
  238. package/dist/cjs/utils/validations/config-validations.utils.d.ts +1 -0
  239. package/dist/cjs/utils/validations/config-validations.utils.d.ts.map +1 -0
  240. package/dist/cjs/utils/validations/config-validations.utils.js +1 -0
  241. package/dist/cjs/utils/validations/config-validations.utils.js.map +1 -0
  242. package/dist/cjs/utils/validations/event-validations.utils.d.ts +1 -0
  243. package/dist/cjs/utils/validations/event-validations.utils.d.ts.map +1 -0
  244. package/dist/cjs/utils/validations/event-validations.utils.js +1 -0
  245. package/dist/cjs/utils/validations/event-validations.utils.js.map +1 -0
  246. package/dist/cjs/utils/validations/index.d.ts +1 -0
  247. package/dist/cjs/utils/validations/index.d.ts.map +1 -0
  248. package/dist/cjs/utils/validations/index.js +1 -0
  249. package/dist/cjs/utils/validations/index.js.map +1 -0
  250. package/dist/cjs/utils/validations/metadata-validations.utils.d.ts +1 -0
  251. package/dist/cjs/utils/validations/metadata-validations.utils.d.ts.map +1 -0
  252. package/dist/cjs/utils/validations/metadata-validations.utils.js +3 -2
  253. package/dist/cjs/utils/validations/metadata-validations.utils.js.map +1 -0
  254. package/dist/cjs/utils/validations/type-guards.utils.d.ts +5 -2
  255. package/dist/cjs/utils/validations/type-guards.utils.d.ts.map +1 -0
  256. package/dist/cjs/utils/validations/type-guards.utils.js +15 -2
  257. package/dist/cjs/utils/validations/type-guards.utils.js.map +1 -0
  258. package/dist/esm/api.d.ts +2 -1
  259. package/dist/esm/api.d.ts.map +1 -0
  260. package/dist/esm/api.js +7 -6
  261. package/dist/esm/api.js.map +1 -0
  262. package/dist/esm/app.constants.d.ts +2 -0
  263. package/dist/esm/app.constants.d.ts.map +1 -0
  264. package/dist/esm/app.constants.js +2 -0
  265. package/dist/esm/app.constants.js.map +1 -0
  266. package/dist/esm/app.d.ts +2 -1
  267. package/dist/esm/app.d.ts.map +1 -0
  268. package/dist/esm/app.js +9 -9
  269. package/dist/esm/app.js.map +1 -0
  270. package/dist/esm/constants/config.constants.d.ts +8 -2
  271. package/dist/esm/constants/config.constants.d.ts.map +1 -0
  272. package/dist/esm/constants/config.constants.js +11 -4
  273. package/dist/esm/constants/config.constants.js.map +1 -0
  274. package/dist/esm/constants/error.constants.d.ts +1 -0
  275. package/dist/esm/constants/error.constants.d.ts.map +1 -0
  276. package/dist/esm/constants/error.constants.js +1 -0
  277. package/dist/esm/constants/error.constants.js.map +1 -0
  278. package/dist/esm/constants/index.d.ts +1 -0
  279. package/dist/esm/constants/index.d.ts.map +1 -0
  280. package/dist/esm/constants/index.js +1 -0
  281. package/dist/esm/constants/index.js.map +1 -0
  282. package/dist/esm/constants/performance.constants.d.ts +1 -0
  283. package/dist/esm/constants/performance.constants.d.ts.map +1 -0
  284. package/dist/esm/constants/performance.constants.js +1 -0
  285. package/dist/esm/constants/performance.constants.js.map +1 -0
  286. package/dist/esm/constants/storage.constants.d.ts +1 -0
  287. package/dist/esm/constants/storage.constants.d.ts.map +1 -0
  288. package/dist/esm/constants/storage.constants.js +1 -0
  289. package/dist/esm/constants/storage.constants.js.map +1 -0
  290. package/dist/esm/handlers/click.handler.d.ts +1 -0
  291. package/dist/esm/handlers/click.handler.d.ts.map +1 -0
  292. package/dist/esm/handlers/click.handler.js +1 -0
  293. package/dist/esm/handlers/click.handler.js.map +1 -0
  294. package/dist/esm/handlers/error.handler.d.ts +1 -0
  295. package/dist/esm/handlers/error.handler.d.ts.map +1 -0
  296. package/dist/esm/handlers/error.handler.js +1 -0
  297. package/dist/esm/handlers/error.handler.js.map +1 -0
  298. package/dist/esm/handlers/page-view.handler.d.ts +1 -0
  299. package/dist/esm/handlers/page-view.handler.d.ts.map +1 -0
  300. package/dist/esm/handlers/page-view.handler.js +2 -1
  301. package/dist/esm/handlers/page-view.handler.js.map +1 -0
  302. package/dist/esm/handlers/performance.handler.d.ts +1 -0
  303. package/dist/esm/handlers/performance.handler.d.ts.map +1 -0
  304. package/dist/esm/handlers/performance.handler.js +1 -0
  305. package/dist/esm/handlers/performance.handler.js.map +1 -0
  306. package/dist/esm/handlers/scroll.handler.d.ts +1 -0
  307. package/dist/esm/handlers/scroll.handler.d.ts.map +1 -0
  308. package/dist/esm/handlers/scroll.handler.js +4 -1
  309. package/dist/esm/handlers/scroll.handler.js.map +1 -0
  310. package/dist/esm/handlers/session.handler.d.ts +3 -2
  311. package/dist/esm/handlers/session.handler.d.ts.map +1 -0
  312. package/dist/esm/handlers/session.handler.js +7 -6
  313. package/dist/esm/handlers/session.handler.js.map +1 -0
  314. package/dist/esm/integrations/google-analytics.integration.d.ts +1 -0
  315. package/dist/esm/integrations/google-analytics.integration.d.ts.map +1 -0
  316. package/dist/esm/integrations/google-analytics.integration.js +7 -2
  317. package/dist/esm/integrations/google-analytics.integration.js.map +1 -0
  318. package/dist/esm/listeners/activity-listener-manager.d.ts +1 -0
  319. package/dist/esm/listeners/activity-listener-manager.d.ts.map +1 -0
  320. package/dist/esm/listeners/activity-listener-manager.js +1 -0
  321. package/dist/esm/listeners/activity-listener-manager.js.map +1 -0
  322. package/dist/esm/listeners/index.d.ts +1 -0
  323. package/dist/esm/listeners/index.d.ts.map +1 -0
  324. package/dist/esm/listeners/index.js +1 -0
  325. package/dist/esm/listeners/index.js.map +1 -0
  326. package/dist/esm/listeners/input-listener-managers.d.ts +1 -0
  327. package/dist/esm/listeners/input-listener-managers.d.ts.map +1 -0
  328. package/dist/esm/listeners/input-listener-managers.js +1 -0
  329. package/dist/esm/listeners/input-listener-managers.js.map +1 -0
  330. package/dist/esm/listeners/listeners.types.d.ts +1 -0
  331. package/dist/esm/listeners/listeners.types.d.ts.map +1 -0
  332. package/dist/esm/listeners/listeners.types.js +1 -0
  333. package/dist/esm/listeners/listeners.types.js.map +1 -0
  334. package/dist/esm/listeners/touch-listener-manager.d.ts +1 -0
  335. package/dist/esm/listeners/touch-listener-manager.d.ts.map +1 -0
  336. package/dist/esm/listeners/touch-listener-manager.js +1 -0
  337. package/dist/esm/listeners/touch-listener-manager.js.map +1 -0
  338. package/dist/esm/listeners/unload-listener-manager.d.ts +1 -0
  339. package/dist/esm/listeners/unload-listener-manager.d.ts.map +1 -0
  340. package/dist/esm/listeners/unload-listener-manager.js +1 -0
  341. package/dist/esm/listeners/unload-listener-manager.js.map +1 -0
  342. package/dist/esm/listeners/visibility-listener-manager.d.ts +1 -0
  343. package/dist/esm/listeners/visibility-listener-manager.d.ts.map +1 -0
  344. package/dist/esm/listeners/visibility-listener-manager.js +1 -0
  345. package/dist/esm/listeners/visibility-listener-manager.js.map +1 -0
  346. package/dist/esm/managers/event.manager.d.ts +1 -0
  347. package/dist/esm/managers/event.manager.d.ts.map +1 -0
  348. package/dist/esm/managers/event.manager.js +4 -3
  349. package/dist/esm/managers/event.manager.js.map +1 -0
  350. package/dist/esm/managers/sender.manager.d.ts +1 -8
  351. package/dist/esm/managers/sender.manager.d.ts.map +1 -0
  352. package/dist/esm/managers/sender.manager.js +33 -116
  353. package/dist/esm/managers/sender.manager.js.map +1 -0
  354. package/dist/esm/managers/session.manager.d.ts +3 -2
  355. package/dist/esm/managers/session.manager.d.ts.map +1 -0
  356. package/dist/esm/managers/session.manager.js +26 -27
  357. package/dist/esm/managers/session.manager.js.map +1 -0
  358. package/dist/esm/managers/state.manager.d.ts +1 -0
  359. package/dist/esm/managers/state.manager.d.ts.map +1 -0
  360. package/dist/esm/managers/state.manager.js +1 -0
  361. package/dist/esm/managers/state.manager.js.map +1 -0
  362. package/dist/esm/managers/storage.manager.d.ts +1 -0
  363. package/dist/esm/managers/storage.manager.d.ts.map +1 -0
  364. package/dist/esm/managers/storage.manager.js +4 -1
  365. package/dist/esm/managers/storage.manager.js.map +1 -0
  366. package/dist/esm/managers/user.manager.d.ts +1 -0
  367. package/dist/esm/managers/user.manager.d.ts.map +1 -0
  368. package/dist/esm/managers/user.manager.js +1 -0
  369. package/dist/esm/managers/user.manager.js.map +1 -0
  370. package/dist/esm/public-api.d.ts +2 -1
  371. package/dist/esm/public-api.d.ts.map +1 -0
  372. package/dist/esm/public-api.js +1 -0
  373. package/dist/esm/public-api.js.map +1 -0
  374. package/dist/esm/test-bridge.d.ts +2 -5
  375. package/dist/esm/test-bridge.d.ts.map +1 -0
  376. package/dist/esm/test-bridge.js +3 -10
  377. package/dist/esm/test-bridge.js.map +1 -0
  378. package/dist/esm/types/common.types.d.ts +6 -1
  379. package/dist/esm/types/common.types.d.ts.map +1 -0
  380. package/dist/esm/types/common.types.js +1 -0
  381. package/dist/esm/types/common.types.js.map +1 -0
  382. package/dist/esm/types/config.types.d.ts +1 -0
  383. package/dist/esm/types/config.types.d.ts.map +1 -0
  384. package/dist/esm/types/config.types.js +1 -0
  385. package/dist/esm/types/config.types.js.map +1 -0
  386. package/dist/esm/types/device.types.d.ts +1 -0
  387. package/dist/esm/types/device.types.d.ts.map +1 -0
  388. package/dist/esm/types/device.types.js +1 -0
  389. package/dist/esm/types/device.types.js.map +1 -0
  390. package/dist/esm/types/emitter.types.d.ts +1 -0
  391. package/dist/esm/types/emitter.types.d.ts.map +1 -0
  392. package/dist/esm/types/emitter.types.js +1 -0
  393. package/dist/esm/types/emitter.types.js.map +1 -0
  394. package/dist/esm/types/error.types.d.ts +1 -0
  395. package/dist/esm/types/error.types.d.ts.map +1 -0
  396. package/dist/esm/types/error.types.js +1 -0
  397. package/dist/esm/types/error.types.js.map +1 -0
  398. package/dist/esm/types/event.types.d.ts +1 -0
  399. package/dist/esm/types/event.types.d.ts.map +1 -0
  400. package/dist/esm/types/event.types.js +1 -0
  401. package/dist/esm/types/event.types.js.map +1 -0
  402. package/dist/esm/types/index.d.ts +1 -0
  403. package/dist/esm/types/index.d.ts.map +1 -0
  404. package/dist/esm/types/index.js +1 -0
  405. package/dist/esm/types/index.js.map +1 -0
  406. package/dist/esm/types/log.types.d.ts +1 -0
  407. package/dist/esm/types/log.types.d.ts.map +1 -0
  408. package/dist/esm/types/log.types.js +1 -0
  409. package/dist/esm/types/log.types.js.map +1 -0
  410. package/dist/esm/types/mode.types.d.ts +1 -0
  411. package/dist/esm/types/mode.types.d.ts.map +1 -0
  412. package/dist/esm/types/mode.types.js +1 -0
  413. package/dist/esm/types/mode.types.js.map +1 -0
  414. package/dist/esm/types/queue.types.d.ts +1 -0
  415. package/dist/esm/types/queue.types.d.ts.map +1 -0
  416. package/dist/esm/types/queue.types.js +1 -0
  417. package/dist/esm/types/queue.types.js.map +1 -0
  418. package/dist/esm/types/session.types.d.ts +1 -0
  419. package/dist/esm/types/session.types.d.ts.map +1 -0
  420. package/dist/esm/types/session.types.js +1 -0
  421. package/dist/esm/types/session.types.js.map +1 -0
  422. package/dist/esm/types/state.types.d.ts +1 -0
  423. package/dist/esm/types/state.types.d.ts.map +1 -0
  424. package/dist/esm/types/state.types.js +1 -0
  425. package/dist/esm/types/state.types.js.map +1 -0
  426. package/dist/esm/types/test-bridge.types.d.ts +2 -1
  427. package/dist/esm/types/test-bridge.types.d.ts.map +1 -0
  428. package/dist/esm/types/test-bridge.types.js +1 -0
  429. package/dist/esm/types/test-bridge.types.js.map +1 -0
  430. package/dist/esm/types/validation-error.types.d.ts +1 -0
  431. package/dist/esm/types/validation-error.types.d.ts.map +1 -0
  432. package/dist/esm/types/validation-error.types.js +1 -0
  433. package/dist/esm/types/validation-error.types.js.map +1 -0
  434. package/dist/esm/types/window.types.d.ts +1 -0
  435. package/dist/esm/types/window.types.d.ts.map +1 -0
  436. package/dist/esm/types/window.types.js +1 -0
  437. package/dist/esm/types/window.types.js.map +1 -0
  438. package/dist/esm/utils/browser/device-detector.utils.d.ts +1 -0
  439. package/dist/esm/utils/browser/device-detector.utils.d.ts.map +1 -0
  440. package/dist/esm/utils/browser/device-detector.utils.js +1 -0
  441. package/dist/esm/utils/browser/device-detector.utils.js.map +1 -0
  442. package/dist/esm/utils/browser/index.d.ts +1 -0
  443. package/dist/esm/utils/browser/index.d.ts.map +1 -0
  444. package/dist/esm/utils/browser/index.js +1 -0
  445. package/dist/esm/utils/browser/index.js.map +1 -0
  446. package/dist/esm/utils/browser/qa-mode.utils.d.ts +1 -0
  447. package/dist/esm/utils/browser/qa-mode.utils.d.ts.map +1 -0
  448. package/dist/esm/utils/browser/qa-mode.utils.js +1 -0
  449. package/dist/esm/utils/browser/qa-mode.utils.js.map +1 -0
  450. package/dist/esm/utils/browser/utm-params.utils.d.ts +1 -0
  451. package/dist/esm/utils/browser/utm-params.utils.d.ts.map +1 -0
  452. package/dist/esm/utils/browser/utm-params.utils.js +1 -0
  453. package/dist/esm/utils/browser/utm-params.utils.js.map +1 -0
  454. package/dist/esm/utils/data/index.d.ts +1 -0
  455. package/dist/esm/utils/data/index.d.ts.map +1 -0
  456. package/dist/esm/utils/data/index.js +1 -0
  457. package/dist/esm/utils/data/index.js.map +1 -0
  458. package/dist/esm/utils/data/uuid.utils.d.ts +1 -0
  459. package/dist/esm/utils/data/uuid.utils.d.ts.map +1 -0
  460. package/dist/esm/utils/data/uuid.utils.js +1 -0
  461. package/dist/esm/utils/data/uuid.utils.js.map +1 -0
  462. package/dist/esm/utils/emitter.utils.d.ts +1 -0
  463. package/dist/esm/utils/emitter.utils.d.ts.map +1 -0
  464. package/dist/esm/utils/emitter.utils.js +4 -1
  465. package/dist/esm/utils/emitter.utils.js.map +1 -0
  466. package/dist/esm/utils/index.d.ts +1 -0
  467. package/dist/esm/utils/index.d.ts.map +1 -0
  468. package/dist/esm/utils/index.js +1 -0
  469. package/dist/esm/utils/index.js.map +1 -0
  470. package/dist/esm/utils/logging.utils.d.ts +1 -0
  471. package/dist/esm/utils/logging.utils.d.ts.map +1 -0
  472. package/dist/esm/utils/logging.utils.js +1 -0
  473. package/dist/esm/utils/logging.utils.js.map +1 -0
  474. package/dist/esm/utils/network/index.d.ts +1 -0
  475. package/dist/esm/utils/network/index.d.ts.map +1 -0
  476. package/dist/esm/utils/network/index.js +1 -0
  477. package/dist/esm/utils/network/index.js.map +1 -0
  478. package/dist/esm/utils/network/url.utils.d.ts +1 -0
  479. package/dist/esm/utils/network/url.utils.d.ts.map +1 -0
  480. package/dist/esm/utils/network/url.utils.js +1 -0
  481. package/dist/esm/utils/network/url.utils.js.map +1 -0
  482. package/dist/esm/utils/security/index.d.ts +1 -0
  483. package/dist/esm/utils/security/index.d.ts.map +1 -0
  484. package/dist/esm/utils/security/index.js +1 -0
  485. package/dist/esm/utils/security/index.js.map +1 -0
  486. package/dist/esm/utils/security/sanitize.utils.d.ts +1 -0
  487. package/dist/esm/utils/security/sanitize.utils.d.ts.map +1 -0
  488. package/dist/esm/utils/security/sanitize.utils.js +3 -2
  489. package/dist/esm/utils/security/sanitize.utils.js.map +1 -0
  490. package/dist/esm/utils/validations/config-validations.utils.d.ts +1 -0
  491. package/dist/esm/utils/validations/config-validations.utils.d.ts.map +1 -0
  492. package/dist/esm/utils/validations/config-validations.utils.js +1 -0
  493. package/dist/esm/utils/validations/config-validations.utils.js.map +1 -0
  494. package/dist/esm/utils/validations/event-validations.utils.d.ts +1 -0
  495. package/dist/esm/utils/validations/event-validations.utils.d.ts.map +1 -0
  496. package/dist/esm/utils/validations/event-validations.utils.js +1 -0
  497. package/dist/esm/utils/validations/event-validations.utils.js.map +1 -0
  498. package/dist/esm/utils/validations/index.d.ts +1 -0
  499. package/dist/esm/utils/validations/index.d.ts.map +1 -0
  500. package/dist/esm/utils/validations/index.js +1 -0
  501. package/dist/esm/utils/validations/index.js.map +1 -0
  502. package/dist/esm/utils/validations/metadata-validations.utils.d.ts +1 -0
  503. package/dist/esm/utils/validations/metadata-validations.utils.d.ts.map +1 -0
  504. package/dist/esm/utils/validations/metadata-validations.utils.js +4 -3
  505. package/dist/esm/utils/validations/metadata-validations.utils.js.map +1 -0
  506. package/dist/esm/utils/validations/type-guards.utils.d.ts +5 -2
  507. package/dist/esm/utils/validations/type-guards.utils.d.ts.map +1 -0
  508. package/dist/esm/utils/validations/type-guards.utils.js +16 -3
  509. package/dist/esm/utils/validations/type-guards.utils.js.map +1 -0
  510. package/package.json +2 -2
@@ -1,4 +1,6 @@
1
- const P = "data-tlog", be = [
1
+ const Ft = 120, Gt = 8192, $t = 10, zt = 10, Bt = 20, Qt = 1, Xt = 50, jt = 100, Wt = 2e3, Yt = 51200, Kt = 2;
2
+ const qt = 1e3, Zt = 500, Jt = 100;
3
+ const P = "data-tlog", Oe = [
2
4
  "button",
3
5
  "a",
4
6
  'input[type="button"]',
@@ -30,7 +32,7 @@ const P = "data-tlog", be = [
30
32
  ".menu-item",
31
33
  "[data-testid]",
32
34
  '[tabindex="0"]'
33
- ], Oe = ["utm_source", "utm_medium", "utm_campaign", "utm_term", "utm_content"];
35
+ ], Pe = ["utm_source", "utm_medium", "utm_campaign", "utm_term", "utm_content"];
34
36
  const m = {
35
37
  INVALID_SESSION_TIMEOUT: "Session timeout must be between 30000ms (30 seconds) and 86400000ms (24 hours)",
36
38
  INVALID_SAMPLING_RATE: "Sampling rate must be between 0 and 1",
@@ -41,7 +43,7 @@ const m = {
41
43
  INVALID_SCROLL_CONTAINER_SELECTORS: "Scroll container selectors must be valid CSS selectors",
42
44
  INVALID_GLOBAL_METADATA: "Global metadata must be an object",
43
45
  INVALID_SENSITIVE_QUERY_PARAMS: "Sensitive query params must be an array of strings"
44
- }, Pe = [
46
+ }, De = [
45
47
  /<script\b[^<]*(?:(?!<\/script>)<[^<]*)*<\/script>/gi,
46
48
  /javascript:/gi,
47
49
  /on\w+\s*=/gi,
@@ -49,29 +51,29 @@ const m = {
49
51
  /<embed\b[^>]*>/gi,
50
52
  /<object\b[^<]*(?:(?!<\/object>)<[^<]*)*<\/object>/gi
51
53
  ];
52
- var X = /* @__PURE__ */ ((s) => (s.Localhost = "localhost:8080", s.Fail = "localhost:9999", s))(X || {}), _ = /* @__PURE__ */ ((s) => (s.Mobile = "mobile", s.Tablet = "tablet", s.Desktop = "desktop", s.Unknown = "unknown", s))(_ || {}), W = /* @__PURE__ */ ((s) => (s.EVENT = "event", s.QUEUE = "queue", s))(W || {});
53
- class I extends Error {
54
+ var j = /* @__PURE__ */ ((r) => (r.Localhost = "localhost:8080", r.Fail = "localhost:9999", r))(j || {}), _ = /* @__PURE__ */ ((r) => (r.Mobile = "mobile", r.Tablet = "tablet", r.Desktop = "desktop", r.Unknown = "unknown", r))(_ || {}), W = /* @__PURE__ */ ((r) => (r.EVENT = "event", r.QUEUE = "queue", r))(W || {});
55
+ class A extends Error {
54
56
  constructor(e, t) {
55
- super(e), this.statusCode = t, this.name = "PermanentError", Error.captureStackTrace && Error.captureStackTrace(this, I);
57
+ super(e), this.statusCode = t, this.name = "PermanentError", Error.captureStackTrace && Error.captureStackTrace(this, A);
56
58
  }
57
59
  }
58
- var d = /* @__PURE__ */ ((s) => (s.PAGE_VIEW = "page_view", s.CLICK = "click", s.SCROLL = "scroll", s.SESSION_START = "session_start", s.SESSION_END = "session_end", s.CUSTOM = "custom", s.WEB_VITALS = "web_vitals", s.ERROR = "error", s))(d || {}), k = /* @__PURE__ */ ((s) => (s.UP = "up", s.DOWN = "down", s))(k || {}), R = /* @__PURE__ */ ((s) => (s.JS_ERROR = "js_error", s.PROMISE_REJECTION = "promise_rejection", s))(R || {}), C = /* @__PURE__ */ ((s) => (s.QA = "qa", s))(C || {});
60
+ var d = /* @__PURE__ */ ((r) => (r.PAGE_VIEW = "page_view", r.CLICK = "click", r.SCROLL = "scroll", r.SESSION_START = "session_start", r.SESSION_END = "session_end", r.CUSTOM = "custom", r.WEB_VITALS = "web_vitals", r.ERROR = "error", r))(d || {}), k = /* @__PURE__ */ ((r) => (r.UP = "up", r.DOWN = "down", r))(k || {}), C = /* @__PURE__ */ ((r) => (r.JS_ERROR = "js_error", r.PROMISE_REJECTION = "promise_rejection", r))(C || {}), R = /* @__PURE__ */ ((r) => (r.QA = "qa", r))(R || {});
59
61
  class b extends Error {
60
- constructor(e, t, r) {
61
- super(e), this.errorCode = t, this.layer = r, this.name = this.constructor.name, Error.captureStackTrace && Error.captureStackTrace(this, this.constructor);
62
+ constructor(e, t, s) {
63
+ super(e), this.errorCode = t, this.layer = s, this.name = this.constructor.name, Error.captureStackTrace && Error.captureStackTrace(this, this.constructor);
62
64
  }
63
65
  }
64
- class A extends b {
66
+ class y extends b {
65
67
  constructor(e, t = "config") {
66
68
  super(e, "APP_CONFIG_INVALID", t);
67
69
  }
68
70
  }
69
- class De extends b {
71
+ class ke extends b {
70
72
  constructor(e, t = "config") {
71
73
  super(e, "SESSION_TIMEOUT_INVALID", t);
72
74
  }
73
75
  }
74
- class ce extends b {
76
+ class le extends b {
75
77
  constructor(e, t = "config") {
76
78
  super(e, "SAMPLING_RATE_INVALID", t);
77
79
  }
@@ -81,57 +83,57 @@ class v extends b {
81
83
  super(e, "INTEGRATION_INVALID", t);
82
84
  }
83
85
  }
84
- class Ft extends b {
85
- constructor(e, t, r = "runtime") {
86
- super(e, "INITIALIZATION_TIMEOUT", r), this.timeoutMs = t;
86
+ class er extends b {
87
+ constructor(e, t, s = "runtime") {
88
+ super(e, "INITIALIZATION_TIMEOUT", s), this.timeoutMs = t;
87
89
  }
88
90
  }
89
- const ke = (s, e) => {
91
+ const Ue = (r, e) => {
90
92
  if (e) {
91
93
  if (e instanceof Error) {
92
94
  const t = e.message.replace(/\s+at\s+.*$/gm, "").replace(/\(.*?:\d+:\d+\)/g, "");
93
- return `[TraceLog] ${s}: ${t}`;
95
+ return `[TraceLog] ${r}: ${t}`;
94
96
  }
95
- return `[TraceLog] ${s}: ${e instanceof Error ? e.message : "Unknown error"}`;
97
+ return `[TraceLog] ${r}: ${e instanceof Error ? e.message : "Unknown error"}`;
96
98
  }
97
- return `[TraceLog] ${s}`;
98
- }, o = (s, e, t) => {
99
- const { error: r, data: n, showToClient: i = !1 } = t ?? {}, a = r ? ke(e, r) : `[TraceLog] ${e}`, c = s === "error" ? "error" : s === "warn" ? "warn" : "log";
100
- if (!(s === "debug" || s === "info" && !i))
99
+ return `[TraceLog] ${r}`;
100
+ }, o = (r, e, t) => {
101
+ const { error: s, data: n, showToClient: i = !1 } = t ?? {}, a = s ? Ue(e, s) : `[TraceLog] ${e}`, l = r === "error" ? "error" : r === "warn" ? "warn" : "log";
102
+ if (!(r === "debug" || r === "info" && !i))
101
103
  if (n !== void 0) {
102
- const l = Ue(n);
103
- console[c](a, l);
104
- } else n !== void 0 ? console[c](a, n) : console[c](a);
105
- }, Ue = (s) => {
104
+ const c = He(n);
105
+ console[l](a, c);
106
+ } else n !== void 0 ? console[l](a, n) : console[l](a);
107
+ }, He = (r) => {
106
108
  const e = {}, t = ["token", "password", "secret", "key", "apikey", "api_key", "sessionid", "session_id"];
107
- for (const [r, n] of Object.entries(s)) {
108
- const i = r.toLowerCase();
109
- t.some((a) => i.includes(a)) ? e[r] = "[REDACTED]" : e[r] = n;
109
+ for (const [s, n] of Object.entries(r)) {
110
+ const i = s.toLowerCase();
111
+ t.some((a) => i.includes(a)) ? e[s] = "[REDACTED]" : e[s] = n;
110
112
  }
111
113
  return e;
112
114
  };
113
115
  let Y, _e;
114
- const He = () => {
116
+ const xe = () => {
115
117
  typeof window < "u" && !Y && (Y = window.matchMedia("(pointer: coarse)"), _e = window.matchMedia("(hover: none)"));
116
- }, xe = () => {
118
+ }, Ve = () => {
117
119
  try {
118
- const s = navigator;
119
- if (s.userAgentData && typeof s.userAgentData.mobile == "boolean")
120
- return s.userAgentData.platform && /ipad|tablet/i.test(s.userAgentData.platform) ? _.Tablet : s.userAgentData.mobile ? _.Mobile : _.Desktop;
121
- He();
122
- const e = window.innerWidth, t = Y?.matches ?? !1, r = _e?.matches ?? !1, n = "ontouchstart" in window || navigator.maxTouchPoints > 0, i = navigator.userAgent.toLowerCase(), a = /mobile|android|iphone|ipod|blackberry|iemobile|opera mini/.test(i), c = /tablet|ipad|android(?!.*mobile)/.test(i);
123
- return e <= 767 || a && n ? _.Mobile : e >= 768 && e <= 1024 || c || t && r && n ? _.Tablet : _.Desktop;
124
- } catch (s) {
125
- return o("warn", "Device detection failed, defaulting to desktop", { error: s }), _.Desktop;
126
- }
127
- }, T = "tlog", le = `${T}:qa_mode`, Ve = `${T}:uid`, Fe = (s) => s ? `${T}:${s}:queue` : `${T}:queue`, Ge = (s) => s ? `${T}:${s}:session` : `${T}:session`, ze = (s) => s ? `${T}:${s}:broadcast` : `${T}:broadcast`, Te = {
120
+ const r = navigator;
121
+ if (r.userAgentData && typeof r.userAgentData.mobile == "boolean")
122
+ return r.userAgentData.platform && /ipad|tablet/i.test(r.userAgentData.platform) ? _.Tablet : r.userAgentData.mobile ? _.Mobile : _.Desktop;
123
+ xe();
124
+ const e = window.innerWidth, t = Y?.matches ?? !1, s = _e?.matches ?? !1, n = "ontouchstart" in window || navigator.maxTouchPoints > 0, i = navigator.userAgent.toLowerCase(), a = /mobile|android|iphone|ipod|blackberry|iemobile|opera mini/.test(i), l = /tablet|ipad|android(?!.*mobile)/.test(i);
125
+ return e <= 767 || a && n ? _.Mobile : e >= 768 && e <= 1024 || l || t && s && n ? _.Tablet : _.Desktop;
126
+ } catch (r) {
127
+ return o("warn", "Device detection failed, defaulting to desktop", { error: r }), _.Desktop;
128
+ }
129
+ }, T = "tlog", ce = `${T}:qa_mode`, Fe = `${T}:uid`, Ge = (r) => r ? `${T}:${r}:queue` : `${T}:queue`, $e = (r) => r ? `${T}:${r}:session` : `${T}:session`, ze = (r) => r ? `${T}:${r}:broadcast` : `${T}:broadcast`, Te = {
128
130
  LCP: 4e3,
129
131
  FCP: 1800,
130
132
  CLS: 0.25,
131
133
  INP: 200,
132
134
  TTFB: 800,
133
135
  LONG_TASK: 50
134
- }, $e = 1e3, ve = [
136
+ }, Be = 1e3, ve = [
135
137
  // Email addresses
136
138
  /\b[A-Za-z0-9._%+-]+@[A-Za-z0-9.-]+\.[A-Z|a-z]{2,}\b/gi,
137
139
  // US Phone numbers (various formats)
@@ -146,12 +148,12 @@ const He = () => {
146
148
  /Bearer\s+[A-Za-z0-9_-]+(?:\.[A-Za-z0-9_-]+)?(?:\.[A-Za-z0-9_-]+)?/gi,
147
149
  // Passwords in connection strings (protocol://user:password@host)
148
150
  /:\/\/[^:/]+:([^@]+)@/gi
149
- ], ue = 500, de = 5e3, U = 50, Qe = U * 2, Be = 6e4, he = "tlog_mode", je = "qa", Xe = () => {
150
- if (sessionStorage.getItem(le) === "true")
151
+ ], ue = 500, de = 5e3, U = 50, Qe = U * 2, Xe = 6e4, he = "tlog_mode", je = "qa", We = () => {
152
+ if (sessionStorage.getItem(ce) === "true")
151
153
  return !0;
152
- const e = new URLSearchParams(window.location.search), r = e.get(he) === je;
153
- if (r) {
154
- sessionStorage.setItem(le, "true"), e.delete(he);
154
+ const e = new URLSearchParams(window.location.search), s = e.get(he) === je;
155
+ if (s) {
156
+ sessionStorage.setItem(ce, "true"), e.delete(he);
155
157
  const n = e.toString(), i = `${window.location.pathname}${n ? "?" + n : ""}${window.location.hash}`;
156
158
  try {
157
159
  window.history.replaceState({}, "", i);
@@ -163,148 +165,148 @@ const He = () => {
163
165
  "background: #ff9800; color: white; font-weight: bold; padding: 2px 8px; border-radius: 3px;"
164
166
  );
165
167
  }
166
- return r;
168
+ return s;
167
169
  }, fe = () => {
168
- const s = new URLSearchParams(window.location.search), e = {};
169
- return Oe.forEach((r) => {
170
- const n = s.get(r);
170
+ const r = new URLSearchParams(window.location.search), e = {};
171
+ return Pe.forEach((s) => {
172
+ const n = r.get(s);
171
173
  if (n) {
172
- const i = r.split("utm_")[1];
174
+ const i = s.split("utm_")[1];
173
175
  e[i] = n;
174
176
  }
175
177
  }), Object.keys(e).length ? e : void 0;
176
- }, We = () => typeof crypto < "u" && crypto.randomUUID ? crypto.randomUUID() : "xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g, (s) => {
178
+ }, Ye = () => typeof crypto < "u" && crypto.randomUUID ? crypto.randomUUID() : "xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g, (r) => {
177
179
  const e = Math.random() * 16 | 0;
178
- return (s === "x" ? e : e & 3 | 8).toString(16);
179
- }), Ye = () => {
180
- const s = Date.now();
180
+ return (r === "x" ? e : e & 3 | 8).toString(16);
181
+ }), Ke = () => {
182
+ const r = Date.now();
181
183
  let e = "";
182
184
  try {
183
185
  if (typeof crypto < "u" && crypto.getRandomValues) {
184
186
  const t = crypto.getRandomValues(new Uint8Array(4));
185
- t && (e = Array.from(t, (r) => r.toString(16).padStart(2, "0")).join(""));
187
+ t && (e = Array.from(t, (s) => s.toString(16).padStart(2, "0")).join(""));
186
188
  }
187
189
  } catch {
188
190
  }
189
- return e || (e = Math.floor(Math.random() * 4294967295).toString(16).padStart(8, "0")), `${s}-${e}`;
190
- }, ge = (s, e = !1) => {
191
+ return e || (e = Math.floor(Math.random() * 4294967295).toString(16).padStart(8, "0")), `${r}-${e}`;
192
+ }, ge = (r, e = !1) => {
191
193
  try {
192
- const t = new URL(s), r = t.protocol === "https:", n = t.protocol === "http:";
193
- return r || e && n;
194
+ const t = new URL(r), s = t.protocol === "https:", n = t.protocol === "http:";
195
+ return s || e && n;
194
196
  } catch {
195
197
  return !1;
196
198
  }
197
- }, Ke = (s) => {
198
- if (s.integrations?.tracelog?.projectId) {
199
+ }, qe = (r) => {
200
+ if (r.integrations?.tracelog?.projectId) {
199
201
  const n = new URL(window.location.href).hostname.split(".");
200
202
  if (n.length === 0)
201
203
  throw new Error("Invalid URL");
202
- const i = s.integrations.tracelog.projectId, a = n.slice(-2).join("."), c = `https://${i}.${a}/collect`;
203
- if (!ge(c))
204
+ const i = r.integrations.tracelog.projectId, a = n.slice(-2).join("."), l = `https://${i}.${a}/collect`;
205
+ if (!ge(l))
204
206
  throw new Error("Invalid URL");
205
- return c;
207
+ return l;
206
208
  }
207
- const e = s.integrations?.custom?.collectApiUrl;
209
+ const e = r.integrations?.custom?.collectApiUrl;
208
210
  if (e) {
209
- const t = s.integrations?.custom?.allowHttp ?? !1;
211
+ const t = r.integrations?.custom?.allowHttp ?? !1;
210
212
  if (!ge(e, t))
211
213
  throw new Error("Invalid URL");
212
214
  return e;
213
215
  }
214
216
  return "";
215
- }, K = (s, e = []) => {
217
+ }, K = (r, e = []) => {
216
218
  try {
217
- const t = new URL(s), r = t.searchParams;
219
+ const t = new URL(r), s = t.searchParams;
218
220
  let n = !1;
219
221
  const i = [];
220
- return e.forEach((c) => {
221
- r.has(c) && (r.delete(c), n = !0, i.push(c));
222
- }), !n && s.includes("?") ? s : (t.search = r.toString(), t.toString());
222
+ return e.forEach((l) => {
223
+ s.has(l) && (s.delete(l), n = !0, i.push(l));
224
+ }), !n && r.includes("?") ? r : (t.search = s.toString(), t.toString());
223
225
  } catch (t) {
224
- return o("warn", "URL normalization failed, returning original", { error: t, data: { url: s.slice(0, 100) } }), s;
226
+ return o("warn", "URL normalization failed, returning original", { error: t, data: { url: r.slice(0, 100) } }), r;
225
227
  }
226
- }, Se = (s) => {
227
- if (!s || typeof s != "string" || s.trim().length === 0)
228
+ }, Ee = (r) => {
229
+ if (!r || typeof r != "string" || r.trim().length === 0)
228
230
  return "";
229
- let e = s;
230
- s.length > 1e3 && (e = s.slice(0, Math.max(0, 1e3)));
231
+ let e = r;
232
+ r.length > 1e3 && (e = r.slice(0, Math.max(0, 1e3)));
231
233
  let t = 0;
232
- for (const n of Pe) {
234
+ for (const n of De) {
233
235
  const i = e;
234
236
  e = e.replace(n, ""), i !== e && t++;
235
237
  }
236
238
  return t > 0 && o("warn", "XSS patterns detected and removed", {
237
239
  data: {
238
240
  patternMatches: t,
239
- originalValue: s.slice(0, 100)
241
+ originalValue: r.slice(0, 100)
240
242
  }
241
243
  }), e = e.replaceAll("&", "&amp;").replaceAll("<", "&lt;").replaceAll(">", "&gt;").replaceAll('"', "&quot;").replaceAll("'", "&#x27;").replaceAll("/", "&#x2F;"), e.trim();
242
- }, q = (s, e = 0) => {
243
- if (e > 3 || s == null)
244
+ }, q = (r, e = 0) => {
245
+ if (e > 3 || r == null)
244
246
  return null;
245
- if (typeof s == "string")
246
- return Se(s);
247
- if (typeof s == "number")
248
- return !Number.isFinite(s) || s < -Number.MAX_SAFE_INTEGER || s > Number.MAX_SAFE_INTEGER ? 0 : s;
249
- if (typeof s == "boolean")
250
- return s;
251
- if (Array.isArray(s))
252
- return s.slice(0, 100).map((n) => q(n, e + 1)).filter((n) => n !== null);
253
- if (typeof s == "object") {
254
- const t = {}, n = Object.entries(s).slice(0, 20);
247
+ if (typeof r == "string")
248
+ return Ee(r);
249
+ if (typeof r == "number")
250
+ return !Number.isFinite(r) || r < -Number.MAX_SAFE_INTEGER || r > Number.MAX_SAFE_INTEGER ? 0 : r;
251
+ if (typeof r == "boolean")
252
+ return r;
253
+ if (Array.isArray(r))
254
+ return r.slice(0, 100).map((n) => q(n, e + 1)).filter((n) => n !== null);
255
+ if (typeof r == "object") {
256
+ const t = {}, n = Object.entries(r).slice(0, 20);
255
257
  for (const [i, a] of n) {
256
- const c = Se(i);
257
- if (c) {
258
- const l = q(a, e + 1);
259
- l !== null && (t[c] = l);
258
+ const l = Ee(i);
259
+ if (l) {
260
+ const c = q(a, e + 1);
261
+ c !== null && (t[l] = c);
260
262
  }
261
263
  }
262
264
  return t;
263
265
  }
264
266
  return null;
265
- }, qe = (s) => {
266
- if (typeof s != "object" || s === null)
267
+ }, Ze = (r) => {
268
+ if (typeof r != "object" || r === null)
267
269
  return {};
268
270
  try {
269
- const e = q(s);
271
+ const e = q(r);
270
272
  return typeof e == "object" && e !== null ? e : {};
271
273
  } catch (e) {
272
274
  const t = e instanceof Error ? e.message : String(e);
273
275
  throw new Error(`[TraceLog] Metadata sanitization failed: ${t}`);
274
276
  }
275
- }, Ze = (s) => {
276
- if (s !== void 0 && (s === null || typeof s != "object"))
277
- throw new A("Configuration must be an object", "config");
278
- if (s) {
279
- if (s.sessionTimeout !== void 0 && (typeof s.sessionTimeout != "number" || s.sessionTimeout < 3e4 || s.sessionTimeout > 864e5))
280
- throw new De(m.INVALID_SESSION_TIMEOUT, "config");
281
- if (s.globalMetadata !== void 0 && (typeof s.globalMetadata != "object" || s.globalMetadata === null))
282
- throw new A(m.INVALID_GLOBAL_METADATA, "config");
283
- if (s.scrollContainerSelectors !== void 0 && et(s.scrollContainerSelectors), s.integrations && tt(s.integrations), s.sensitiveQueryParams !== void 0) {
284
- if (!Array.isArray(s.sensitiveQueryParams))
285
- throw new A(m.INVALID_SENSITIVE_QUERY_PARAMS, "config");
286
- for (const e of s.sensitiveQueryParams)
277
+ }, Je = (r) => {
278
+ if (r !== void 0 && (r === null || typeof r != "object"))
279
+ throw new y("Configuration must be an object", "config");
280
+ if (r) {
281
+ if (r.sessionTimeout !== void 0 && (typeof r.sessionTimeout != "number" || r.sessionTimeout < 3e4 || r.sessionTimeout > 864e5))
282
+ throw new ke(m.INVALID_SESSION_TIMEOUT, "config");
283
+ if (r.globalMetadata !== void 0 && (typeof r.globalMetadata != "object" || r.globalMetadata === null))
284
+ throw new y(m.INVALID_GLOBAL_METADATA, "config");
285
+ if (r.scrollContainerSelectors !== void 0 && tt(r.scrollContainerSelectors), r.integrations && rt(r.integrations), r.sensitiveQueryParams !== void 0) {
286
+ if (!Array.isArray(r.sensitiveQueryParams))
287
+ throw new y(m.INVALID_SENSITIVE_QUERY_PARAMS, "config");
288
+ for (const e of r.sensitiveQueryParams)
287
289
  if (typeof e != "string")
288
- throw new A("All sensitive query params must be strings", "config");
290
+ throw new y("All sensitive query params must be strings", "config");
289
291
  }
290
- if (s.errorSampling !== void 0 && (typeof s.errorSampling != "number" || s.errorSampling < 0 || s.errorSampling > 1))
291
- throw new ce(m.INVALID_ERROR_SAMPLING_RATE, "config");
292
- if (s.samplingRate !== void 0 && (typeof s.samplingRate != "number" || s.samplingRate < 0 || s.samplingRate > 1))
293
- throw new ce(m.INVALID_SAMPLING_RATE, "config");
292
+ if (r.errorSampling !== void 0 && (typeof r.errorSampling != "number" || r.errorSampling < 0 || r.errorSampling > 1))
293
+ throw new le(m.INVALID_ERROR_SAMPLING_RATE, "config");
294
+ if (r.samplingRate !== void 0 && (typeof r.samplingRate != "number" || r.samplingRate < 0 || r.samplingRate > 1))
295
+ throw new le(m.INVALID_SAMPLING_RATE, "config");
294
296
  }
295
- }, Je = (s) => {
296
- if (s.includes("<") || s.includes(">") || /on\w+\s*=/i.test(s) || !/^[a-zA-Z0-9\-_#.[\]="':, >+~*()]+$/.test(s))
297
+ }, et = (r) => {
298
+ if (r.includes("<") || r.includes(">") || /on\w+\s*=/i.test(r) || !/^[a-zA-Z0-9\-_#.[\]="':, >+~*()]+$/.test(r))
297
299
  return !1;
298
300
  let t = 0;
299
- for (const n of s)
301
+ for (const n of r)
300
302
  if (n === "(" && t++, n === ")" && t--, t < 0) return !1;
301
303
  if (t !== 0) return !1;
302
- let r = 0;
303
- for (const n of s)
304
- if (n === "[" && r++, n === "]" && r--, r < 0) return !1;
305
- return r === 0;
306
- }, et = (s) => {
307
- const e = Array.isArray(s) ? s : [s];
304
+ let s = 0;
305
+ for (const n of r)
306
+ if (n === "[" && s++, n === "]" && s--, s < 0) return !1;
307
+ return s === 0;
308
+ }, tt = (r) => {
309
+ const e = Array.isArray(r) ? r : [r];
308
310
  for (const t of e) {
309
311
  if (typeof t != "string" || t.trim() === "")
310
312
  throw o("error", "Invalid scroll container selector", {
@@ -314,87 +316,92 @@ const He = () => {
314
316
  type: typeof t,
315
317
  isEmpty: t === "" || typeof t == "string" && t.trim() === ""
316
318
  }
317
- }), new A(m.INVALID_SCROLL_CONTAINER_SELECTORS, "config");
318
- if (!Je(t))
319
+ }), new y(m.INVALID_SCROLL_CONTAINER_SELECTORS, "config");
320
+ if (!et(t))
319
321
  throw o("error", "Invalid or potentially unsafe CSS selector", {
320
322
  showToClient: !0,
321
323
  data: {
322
324
  selector: t,
323
325
  reason: "Failed security validation"
324
326
  }
325
- }), new A("Invalid or potentially unsafe CSS selector", "config");
327
+ }), new y("Invalid or potentially unsafe CSS selector", "config");
326
328
  }
327
- }, tt = (s) => {
328
- if (s) {
329
- if (s.tracelog && (!s.tracelog.projectId || typeof s.tracelog.projectId != "string" || s.tracelog.projectId.trim() === ""))
329
+ }, rt = (r) => {
330
+ if (r) {
331
+ if (r.tracelog && (!r.tracelog.projectId || typeof r.tracelog.projectId != "string" || r.tracelog.projectId.trim() === ""))
330
332
  throw new v(m.INVALID_TRACELOG_PROJECT_ID, "config");
331
- if (s.custom) {
332
- if (!s.custom.collectApiUrl || typeof s.custom.collectApiUrl != "string" || s.custom.collectApiUrl.trim() === "")
333
+ if (r.custom) {
334
+ if (!r.custom.collectApiUrl || typeof r.custom.collectApiUrl != "string" || r.custom.collectApiUrl.trim() === "")
333
335
  throw new v(m.INVALID_CUSTOM_API_URL, "config");
334
- if (s.custom.allowHttp !== void 0 && typeof s.custom.allowHttp != "boolean")
336
+ if (r.custom.allowHttp !== void 0 && typeof r.custom.allowHttp != "boolean")
335
337
  throw new v("allowHttp must be a boolean", "config");
336
- const e = s.custom.collectApiUrl.trim();
338
+ const e = r.custom.collectApiUrl.trim();
337
339
  if (!e.startsWith("http://") && !e.startsWith("https://"))
338
340
  throw new v('Custom API URL must start with "http://" or "https://"', "config");
339
- if (!(s.custom.allowHttp ?? !1) && e.startsWith("http://"))
341
+ if (!(r.custom.allowHttp ?? !1) && e.startsWith("http://"))
340
342
  throw new v(
341
343
  "Custom API URL must use HTTPS in production. Set allowHttp: true in integration config to allow HTTP (not recommended)",
342
344
  "config"
343
345
  );
344
346
  }
345
- if (s.googleAnalytics) {
346
- if (!s.googleAnalytics.measurementId || typeof s.googleAnalytics.measurementId != "string" || s.googleAnalytics.measurementId.trim() === "")
347
+ if (r.googleAnalytics) {
348
+ if (!r.googleAnalytics.measurementId || typeof r.googleAnalytics.measurementId != "string" || r.googleAnalytics.measurementId.trim() === "")
347
349
  throw new v(m.INVALID_GOOGLE_ANALYTICS_ID, "config");
348
- if (!s.googleAnalytics.measurementId.trim().match(/^(G-|UA-)/))
350
+ if (!r.googleAnalytics.measurementId.trim().match(/^(G-|UA-)/))
349
351
  throw new v('Google Analytics measurement ID must start with "G-" or "UA-"', "config");
350
352
  }
351
353
  }
352
- }, rt = (s) => {
353
- Ze(s);
354
+ }, st = (r) => {
355
+ Je(r);
354
356
  const e = {
355
- ...s ?? {},
356
- sessionTimeout: s?.sessionTimeout ?? 9e5,
357
- globalMetadata: s?.globalMetadata ?? {},
358
- sensitiveQueryParams: s?.sensitiveQueryParams ?? [],
359
- errorSampling: s?.errorSampling ?? 1,
360
- samplingRate: s?.samplingRate ?? 1
357
+ ...r ?? {},
358
+ sessionTimeout: r?.sessionTimeout ?? 9e5,
359
+ globalMetadata: r?.globalMetadata ?? {},
360
+ sensitiveQueryParams: r?.sensitiveQueryParams ?? [],
361
+ errorSampling: r?.errorSampling ?? 1,
362
+ samplingRate: r?.samplingRate ?? 1
361
363
  };
362
364
  return e.integrations?.custom && (e.integrations.custom = {
363
365
  ...e.integrations.custom,
364
366
  allowHttp: e.integrations.custom.allowHttp ?? !1
365
367
  }), e;
366
- }, st = (s) => {
367
- if (typeof s == "string")
368
+ }, nt = (r) => {
369
+ if (typeof r == "string")
368
370
  return !0;
369
- if (typeof s == "object" && s !== null && !Array.isArray(s)) {
370
- const e = Object.entries(s);
371
+ if (typeof r == "object" && r !== null && !Array.isArray(r)) {
372
+ const e = Object.entries(r);
371
373
  if (e.length > 20)
372
374
  return !1;
373
375
  for (const [, t] of e) {
374
376
  if (t == null)
375
377
  continue;
376
- const r = typeof t;
377
- if (r !== "string" && r !== "number" && r !== "boolean")
378
+ const s = typeof t;
379
+ if (s !== "string" && s !== "number" && s !== "boolean")
378
380
  return !1;
379
381
  }
380
382
  return !0;
381
383
  }
382
384
  return !1;
383
- }, nt = (s) => {
384
- if (typeof s != "object" || s === null)
385
+ }, Ie = (r, e = 0) => {
386
+ if (typeof r != "object" || r === null || e > 1)
385
387
  return !1;
386
- for (const e of Object.values(s)) {
387
- if (e == null)
388
+ for (const t of Object.values(r)) {
389
+ if (t == null)
388
390
  continue;
389
- const t = typeof e;
390
- if (!(t === "string" || t === "number" || t === "boolean")) {
391
- if (Array.isArray(e)) {
392
- if (e.length === 0)
391
+ const s = typeof t;
392
+ if (!(s === "string" || s === "number" || s === "boolean")) {
393
+ if (Array.isArray(t)) {
394
+ if (t.length === 0)
393
395
  continue;
394
- if (typeof e[0] == "string") {
395
- if (!e.every((i) => typeof i == "string"))
396
+ if (typeof t[0] == "string") {
397
+ if (!t.every((a) => typeof a == "string"))
396
398
  return !1;
397
- } else if (!e.every((i) => st(i)))
399
+ } else if (!t.every((a) => nt(a)))
400
+ return !1;
401
+ continue;
402
+ }
403
+ if (s === "object" && e === 0) {
404
+ if (!Ie(t, e + 1))
398
405
  return !1;
399
406
  continue;
400
407
  }
@@ -402,31 +409,31 @@ const He = () => {
402
409
  }
403
410
  }
404
411
  return !0;
405
- }, it = (s) => typeof s != "string" ? {
412
+ }, it = (r) => typeof r != "string" ? {
406
413
  valid: !1,
407
414
  error: "Event name must be a string"
408
- } : s.length === 0 ? {
415
+ } : r.length === 0 ? {
409
416
  valid: !1,
410
417
  error: "Event name cannot be empty"
411
- } : s.length > 120 ? {
418
+ } : r.length > 120 ? {
412
419
  valid: !1,
413
420
  error: "Event name is too long (max 120 characters)"
414
- } : s.includes("<") || s.includes(">") || s.includes("&") ? {
421
+ } : r.includes("<") || r.includes(">") || r.includes("&") ? {
415
422
  valid: !1,
416
423
  error: "Event name contains invalid characters"
417
- } : ["constructor", "prototype", "__proto__", "eval", "function", "var", "let", "const"].includes(s.toLowerCase()) ? {
424
+ } : ["constructor", "prototype", "__proto__", "eval", "function", "var", "let", "const"].includes(r.toLowerCase()) ? {
418
425
  valid: !1,
419
426
  error: "Event name cannot be a reserved word"
420
- } : { valid: !0 }, Ee = (s, e, t) => {
421
- const r = qe(e), n = `${t} "${s}" metadata error`;
422
- if (!nt(r))
427
+ } : { valid: !0 }, Se = (r, e, t) => {
428
+ const s = Ze(e), n = `${t} "${r}" metadata error`;
429
+ if (!Ie(s))
423
430
  return {
424
431
  valid: !1,
425
432
  error: `${n}: object has invalid types. Valid types are string, number, boolean or string arrays.`
426
433
  };
427
434
  let i;
428
435
  try {
429
- i = JSON.stringify(r);
436
+ i = JSON.stringify(s);
430
437
  } catch {
431
438
  return {
432
439
  valid: !1,
@@ -438,38 +445,38 @@ const He = () => {
438
445
  valid: !1,
439
446
  error: `${n}: object is too large (max ${8192 / 1024} KB).`
440
447
  };
441
- if (Object.keys(r).length > 10)
448
+ if (Object.keys(s).length > 10)
442
449
  return {
443
450
  valid: !1,
444
451
  error: `${n}: object has too many keys (max 10 keys).`
445
452
  };
446
- for (const [c, l] of Object.entries(r)) {
447
- if (Array.isArray(l)) {
448
- if (l.length > 10)
453
+ for (const [l, c] of Object.entries(s)) {
454
+ if (Array.isArray(c)) {
455
+ if (c.length > 10)
449
456
  return {
450
457
  valid: !1,
451
- error: `${n}: array property "${c}" is too large (max 10 items).`
458
+ error: `${n}: array property "${l}" is too large (max 10 items).`
452
459
  };
453
- for (const u of l)
460
+ for (const u of c)
454
461
  if (typeof u == "string" && u.length > 500)
455
462
  return {
456
463
  valid: !1,
457
- error: `${n}: array property "${c}" contains strings that are too long (max 500 characters).`
464
+ error: `${n}: array property "${l}" contains strings that are too long (max 500 characters).`
458
465
  };
459
466
  }
460
- if (typeof l == "string" && l.length > 1e3)
467
+ if (typeof c == "string" && c.length > 1e3)
461
468
  return {
462
469
  valid: !1,
463
- error: `${n}: property "${c}" is too long (max 1000 characters).`
470
+ error: `${n}: property "${l}" is too long (max 1000 characters).`
464
471
  };
465
472
  }
466
473
  return {
467
474
  valid: !0,
468
- sanitizedMetadata: r
475
+ sanitizedMetadata: s
469
476
  };
470
- }, at = (s, e, t) => {
477
+ }, at = (r, e, t) => {
471
478
  if (Array.isArray(e)) {
472
- const r = [], n = `${t} "${s}" metadata error`;
479
+ const s = [], n = `${t} "${r}" metadata error`;
473
480
  for (let i = 0; i < e.length; i++) {
474
481
  const a = e[i];
475
482
  if (typeof a != "object" || a === null || Array.isArray(a))
@@ -477,102 +484,93 @@ const He = () => {
477
484
  valid: !1,
478
485
  error: `${n}: array item at index ${i} must be an object.`
479
486
  };
480
- const c = Ee(s, a, t);
481
- if (!c.valid)
487
+ const l = Se(r, a, t);
488
+ if (!l.valid)
482
489
  return {
483
490
  valid: !1,
484
- error: `${n}: array item at index ${i} is invalid: ${c.error}`
491
+ error: `${n}: array item at index ${i} is invalid: ${l.error}`
485
492
  };
486
- c.sanitizedMetadata && r.push(c.sanitizedMetadata);
493
+ l.sanitizedMetadata && s.push(l.sanitizedMetadata);
487
494
  }
488
495
  return {
489
496
  valid: !0,
490
- sanitizedMetadata: r
497
+ sanitizedMetadata: s
491
498
  };
492
499
  }
493
- return Ee(s, e, t);
494
- }, ot = (s, e) => {
495
- const t = it(s);
500
+ return Se(r, e, t);
501
+ }, ot = (r, e) => {
502
+ const t = it(r);
496
503
  if (!t.valid)
497
504
  return o("error", "Event name validation failed", {
498
505
  showToClient: !0,
499
- data: { eventName: s, error: t.error }
506
+ data: { eventName: r, error: t.error }
500
507
  }), t;
501
508
  if (!e)
502
509
  return { valid: !0 };
503
- const r = at(s, e, "customEvent");
504
- return r.valid || o("error", "Event metadata validation failed", {
510
+ const s = at(r, e, "customEvent");
511
+ return s.valid || o("error", "Event metadata validation failed", {
505
512
  showToClient: !0,
506
513
  data: {
507
- eventName: s,
508
- error: r.error
514
+ eventName: r,
515
+ error: s.error
509
516
  }
510
- }), r;
517
+ }), s;
511
518
  };
512
- class ct {
519
+ class lt {
513
520
  listeners = /* @__PURE__ */ new Map();
514
521
  on(e, t) {
515
522
  this.listeners.has(e) || this.listeners.set(e, []), this.listeners.get(e).push(t);
516
523
  }
517
524
  off(e, t) {
518
- const r = this.listeners.get(e);
519
- if (r) {
520
- const n = r.indexOf(t);
521
- n > -1 && r.splice(n, 1);
525
+ const s = this.listeners.get(e);
526
+ if (s) {
527
+ const n = s.indexOf(t);
528
+ n > -1 && s.splice(n, 1);
522
529
  }
523
530
  }
524
531
  emit(e, t) {
525
- const r = this.listeners.get(e);
526
- r && r.forEach((n) => n(t));
532
+ const s = this.listeners.get(e);
533
+ s && s.forEach((n) => {
534
+ n(t);
535
+ });
527
536
  }
528
537
  removeAllListeners() {
529
538
  this.listeners.clear();
530
539
  }
531
540
  }
532
- const Q = {};
541
+ const B = {};
533
542
  class f {
534
543
  get(e) {
535
- return Q[e];
544
+ return B[e];
536
545
  }
537
546
  set(e, t) {
538
- Q[e] = t;
547
+ B[e] = t;
539
548
  }
540
549
  getState() {
541
- return { ...Q };
550
+ return { ...B };
542
551
  }
543
552
  }
544
- class lt extends f {
553
+ class ct extends f {
545
554
  storeManager;
546
- retryTimeoutId = null;
547
- retryCount = 0;
548
- isRetrying = !1;
549
555
  lastPermanentErrorLog = null;
550
556
  constructor(e) {
551
557
  super(), this.storeManager = e;
552
558
  }
553
559
  getQueueStorageKey() {
554
560
  const e = this.get("userId") || "anonymous";
555
- return Fe(e);
561
+ return Ge(e);
556
562
  }
557
563
  sendEventsQueueSync(e) {
558
- if (this.shouldSkipSend())
559
- return this.resetRetryState(), !0;
560
- if (this.get("config")?.integrations?.custom?.collectApiUrl === X.Fail)
561
- return o("warn", "Fail mode: simulating network failure (sync)", {
562
- data: { events: e.events.length }
563
- }), !1;
564
- const r = this.sendQueueSyncInternal(e);
565
- return r && this.resetRetryState(), r;
564
+ return this.shouldSkipSend() ? !0 : this.get("config")?.integrations?.custom?.collectApiUrl === j.Fail ? (o("warn", "Fail mode: simulating network failure (sync)", {
565
+ data: { events: e.events.length }
566
+ }), !1) : this.sendQueueSyncInternal(e);
566
567
  }
567
568
  async sendEventsQueue(e, t) {
568
- this.shouldSkipSend() || this.persistEvents(e) || o("warn", "Failed to persist events, attempting immediate send");
569
569
  try {
570
- const r = await this.send(e);
571
- return r ? (this.clearPersistedEvents(), this.resetRetryState(), t?.onSuccess?.(e.events.length, e.events, e)) : (this.scheduleRetry(e, t), t?.onFailure?.()), r;
572
- } catch (r) {
573
- if (r instanceof I)
574
- return this.logPermanentError("Permanent error, not retrying", r), this.clearPersistedEvents(), this.resetRetryState(), t?.onFailure?.(), !1;
575
- throw r;
570
+ const s = await this.send(e);
571
+ return s ? (this.clearPersistedEvents(), t?.onSuccess?.(e.events.length, e.events, e)) : (this.persistEvents(e), t?.onFailure?.()), s;
572
+ } catch (s) {
573
+ return s instanceof A ? (this.logPermanentError("Permanent error, not retrying", s), this.clearPersistedEvents(), t?.onFailure?.(), !1) : (this.persistEvents(e), t?.onFailure?.(), !1);
576
574
  }
577
575
  }
578
576
  async recoverPersistedEvents(e) {
@@ -582,76 +580,68 @@ class lt extends f {
582
580
  this.clearPersistedEvents();
583
581
  return;
584
582
  }
585
- const r = this.createRecoveryBody(t);
586
- await this.send(r) ? (this.clearPersistedEvents(), this.resetRetryState(), e?.onSuccess?.(t.events.length, t.events, r)) : (this.scheduleRetry(r, e), e?.onFailure?.());
583
+ const s = this.createRecoveryBody(t);
584
+ await this.send(s) ? (this.clearPersistedEvents(), e?.onSuccess?.(t.events.length, t.events, s)) : e?.onFailure?.();
587
585
  } catch (t) {
588
- if (t instanceof I) {
589
- this.logPermanentError("Permanent error during recovery, clearing persisted events", t), this.clearPersistedEvents(), this.resetRetryState(), e?.onFailure?.();
586
+ if (t instanceof A) {
587
+ this.logPermanentError("Permanent error during recovery, clearing persisted events", t), this.clearPersistedEvents(), e?.onFailure?.();
590
588
  return;
591
589
  }
592
- o("error", "Failed to recover persisted events", { error: t }), this.clearPersistedEvents();
590
+ o("error", "Failed to recover persisted events", { error: t });
593
591
  }
594
592
  }
595
- persistEventsForRecovery(e) {
596
- return this.persistEvents(e);
597
- }
598
- async sendEventsQueueAsync(e) {
599
- return this.sendEventsQueue(e);
600
- }
601
593
  stop() {
602
- this.clearRetryTimeout(), this.resetRetryState();
603
594
  }
604
595
  async send(e) {
605
596
  if (this.shouldSkipSend())
606
597
  return this.simulateSuccessfulSend();
607
- if (this.get("config")?.integrations?.custom?.collectApiUrl === X.Fail)
598
+ if (this.get("config")?.integrations?.custom?.collectApiUrl === j.Fail)
608
599
  return o("warn", "Fail mode: simulating network failure", {
609
600
  data: { events: e.events.length }
610
601
  }), !1;
611
- const { url: r, payload: n } = this.prepareRequest(e);
602
+ const { url: s, payload: n } = this.prepareRequest(e);
612
603
  try {
613
- return (await this.sendWithTimeout(r, n)).ok;
604
+ return (await this.sendWithTimeout(s, n)).ok;
614
605
  } catch (i) {
615
- if (i instanceof I)
606
+ if (i instanceof A)
616
607
  throw i;
617
608
  return o("error", "Send request failed", {
618
609
  error: i,
619
610
  data: {
620
611
  events: e.events.length,
621
- url: r.replace(/\/\/[^/]+/, "//[DOMAIN]")
612
+ url: s.replace(/\/\/[^/]+/, "//[DOMAIN]")
622
613
  }
623
614
  }), !1;
624
615
  }
625
616
  }
626
617
  async sendWithTimeout(e, t) {
627
- const r = new AbortController(), n = setTimeout(() => r.abort(), 1e4);
618
+ const s = new AbortController(), n = setTimeout(() => {
619
+ s.abort();
620
+ }, 1e4);
628
621
  try {
629
622
  const i = await fetch(e, {
630
623
  method: "POST",
631
624
  body: t,
632
625
  keepalive: !0,
633
626
  credentials: "include",
634
- signal: r.signal,
627
+ signal: s.signal,
635
628
  headers: {
636
629
  "Content-Type": "application/json"
637
630
  }
638
631
  });
639
632
  if (!i.ok)
640
- throw i.status >= 400 && i.status < 500 ? new I(`HTTP ${i.status}: ${i.statusText}`, i.status) : new Error(`HTTP ${i.status}: ${i.statusText}`);
633
+ throw i.status >= 400 && i.status < 500 ? new A(`HTTP ${i.status}: ${i.statusText}`, i.status) : new Error(`HTTP ${i.status}: ${i.statusText}`);
641
634
  return i;
642
635
  } finally {
643
636
  clearTimeout(n);
644
637
  }
645
638
  }
646
639
  sendQueueSyncInternal(e) {
647
- const { url: t, payload: r } = this.prepareRequest(e), n = new Blob([r], { type: "application/json" });
648
- if (this.isSendBeaconAvailable()) {
649
- if (navigator.sendBeacon(t, n))
650
- return !0;
651
- o("warn", "sendBeacon failed, persisting events for recovery");
652
- } else
653
- o("warn", "sendBeacon not available, persisting events for recovery");
654
- return this.persistEventsForRecovery(e), !1;
640
+ const { url: t, payload: s } = this.prepareRequest(e), n = new Blob([s], { type: "application/json" });
641
+ if (!this.isSendBeaconAvailable())
642
+ return o("warn", "sendBeacon not available, persisting events for recovery"), this.persistEvents(e), !1;
643
+ const i = navigator.sendBeacon(t, n);
644
+ return i || (o("warn", "sendBeacon rejected request, persisting events for recovery"), this.persistEvents(e)), i;
655
645
  }
656
646
  prepareRequest(e) {
657
647
  const t = {
@@ -697,8 +687,8 @@ class lt extends f {
697
687
  events: e.events,
698
688
  timestamp: Date.now(),
699
689
  ...e.global_metadata && { global_metadata: e.global_metadata }
700
- }, r = this.getQueueStorageKey();
701
- return this.storeManager.setItem(r, JSON.stringify(t)), !!this.storeManager.getItem(r);
690
+ }, s = this.getQueueStorageKey();
691
+ return this.storeManager.setItem(s, JSON.stringify(t)), !!this.storeManager.getItem(s);
702
692
  } catch (t) {
703
693
  return o("warn", "Failed to persist events", { error: t }), !1;
704
694
  }
@@ -711,32 +701,6 @@ class lt extends f {
711
701
  o("warn", "Failed to clear persisted events", { error: e });
712
702
  }
713
703
  }
714
- resetRetryState() {
715
- this.retryCount = 0, this.isRetrying = !1, this.clearRetryTimeout();
716
- }
717
- scheduleRetry(e, t) {
718
- if (this.retryTimeoutId !== null || this.isRetrying)
719
- return;
720
- if (this.retryCount >= 3) {
721
- o("warn", "Max retries reached, giving up", { data: { retryCount: this.retryCount } }), this.clearPersistedEvents(), this.resetRetryState(), t?.onFailure?.();
722
- return;
723
- }
724
- const r = 5e3 * Math.pow(2, this.retryCount);
725
- this.isRetrying = !0, this.retryTimeoutId = window.setTimeout(async () => {
726
- this.retryTimeoutId = null, this.retryCount++;
727
- try {
728
- await this.send(e) ? (this.clearPersistedEvents(), this.resetRetryState(), t?.onSuccess?.(e.events.length)) : this.retryCount >= 3 ? (this.clearPersistedEvents(), this.resetRetryState(), t?.onFailure?.()) : this.scheduleRetry(e, t);
729
- } catch (n) {
730
- if (n instanceof I) {
731
- this.logPermanentError("Permanent error detected during retry, giving up", n), this.clearPersistedEvents(), this.resetRetryState(), t?.onFailure?.();
732
- return;
733
- }
734
- this.retryCount >= 3 ? (this.clearPersistedEvents(), this.resetRetryState(), t?.onFailure?.()) : this.scheduleRetry(e, t);
735
- } finally {
736
- this.isRetrying = !1;
737
- }
738
- }, r);
739
- }
740
704
  shouldSkipSend() {
741
705
  return !this.get("collectApiUrl");
742
706
  }
@@ -747,14 +711,11 @@ class lt extends f {
747
711
  isSendBeaconAvailable() {
748
712
  return typeof navigator < "u" && typeof navigator.sendBeacon == "function";
749
713
  }
750
- clearRetryTimeout() {
751
- this.retryTimeoutId !== null && (clearTimeout(this.retryTimeoutId), this.retryTimeoutId = null);
752
- }
753
714
  logPermanentError(e, t) {
754
- const r = Date.now();
755
- (!this.lastPermanentErrorLog || this.lastPermanentErrorLog.statusCode !== t.statusCode || r - this.lastPermanentErrorLog.timestamp >= Be) && (o("error", e, {
715
+ const s = Date.now();
716
+ (!this.lastPermanentErrorLog || this.lastPermanentErrorLog.statusCode !== t.statusCode || s - this.lastPermanentErrorLog.timestamp >= Xe) && (o("error", e, {
756
717
  data: { status: t.statusCode, message: t.message }
757
- }), this.lastPermanentErrorLog = { statusCode: t.statusCode, timestamp: r });
718
+ }), this.lastPermanentErrorLog = { statusCode: t.statusCode, timestamp: s });
758
719
  }
759
720
  }
760
721
  class ut extends f {
@@ -768,18 +729,18 @@ class ut extends f {
768
729
  sendIntervalId = null;
769
730
  rateLimitCounter = 0;
770
731
  rateLimitWindowStart = 0;
771
- constructor(e, t = null, r = null) {
772
- super(), this.googleAnalytics = t, this.dataSender = new lt(e), this.emitter = r;
732
+ constructor(e, t = null, s = null) {
733
+ super(), this.googleAnalytics = t, this.dataSender = new ct(e), this.emitter = s;
773
734
  }
774
735
  async recoverPersistedEvents() {
775
736
  await this.dataSender.recoverPersistedEvents({
776
- onSuccess: (e, t, r) => {
737
+ onSuccess: (e, t, s) => {
777
738
  if (t && t.length > 0) {
778
739
  const n = t.map((i) => i.id);
779
- this.removeProcessedEvents(n), r && this.emitEventsQueue(r);
740
+ this.removeProcessedEvents(n), s && this.emitEventsQueue(s);
780
741
  }
781
742
  },
782
- onFailure: async () => {
743
+ onFailure: () => {
783
744
  o("warn", "Failed to recover persisted events");
784
745
  }
785
746
  });
@@ -787,12 +748,12 @@ class ut extends f {
787
748
  track({
788
749
  type: e,
789
750
  page_url: t,
790
- from_page_url: r,
751
+ from_page_url: s,
791
752
  scroll_data: n,
792
753
  click_data: i,
793
754
  custom_event: a,
794
- web_vitals: c,
795
- error_data: l,
755
+ web_vitals: l,
756
+ error_data: c,
796
757
  session_end_reason: u
797
758
  }) {
798
759
  if (!e) {
@@ -805,12 +766,12 @@ class ut extends f {
805
766
  })), this.pendingEventsBuffer.push({
806
767
  type: e,
807
768
  page_url: t,
808
- from_page_url: r,
769
+ from_page_url: s,
809
770
  scroll_data: n,
810
771
  click_data: i,
811
772
  custom_event: a,
812
- web_vitals: c,
813
- error_data: l,
773
+ web_vitals: l,
774
+ error_data: c,
814
775
  session_end_reason: u
815
776
  });
816
777
  return;
@@ -818,15 +779,15 @@ class ut extends f {
818
779
  const p = e === d.SESSION_START || e === d.SESSION_END;
819
780
  if (!p && !this.checkRateLimit())
820
781
  return;
821
- const N = e, Re = N === d.SESSION_START, Ce = t || this.get("pageUrl"), $ = this.buildEventPayload({
822
- type: N,
823
- page_url: Ce,
824
- from_page_url: r,
782
+ const L = e, Re = L === d.SESSION_START, be = t || this.get("pageUrl"), z = this.buildEventPayload({
783
+ type: L,
784
+ page_url: be,
785
+ from_page_url: s,
825
786
  scroll_data: n,
826
787
  click_data: i,
827
788
  custom_event: a,
828
- web_vitals: c,
829
- error_data: l,
789
+ web_vitals: l,
790
+ error_data: c,
830
791
  session_end_reason: u
831
792
  });
832
793
  if (!(!p && !this.shouldSample())) {
@@ -844,15 +805,15 @@ class ut extends f {
844
805
  }
845
806
  this.set("hasStartSession", !0);
846
807
  }
847
- if (!this.isDuplicateEvent($)) {
848
- if (this.get("mode") === C.QA && N === d.CUSTOM && a) {
808
+ if (!this.isDuplicateEvent(z)) {
809
+ if (this.get("mode") === R.QA && L === d.CUSTOM && a) {
849
810
  console.log("[TraceLog] Event", {
850
811
  name: a.name,
851
812
  ...a.metadata && { metadata: a.metadata }
852
- }), this.emitEvent($);
813
+ }), this.emitEvent(z);
853
814
  return;
854
815
  }
855
- this.addToQueue($);
816
+ this.addToQueue(z);
856
817
  }
857
818
  }
858
819
  }
@@ -878,8 +839,8 @@ class ut extends f {
878
839
  return;
879
840
  }
880
841
  const t = [...this.pendingEventsBuffer];
881
- this.pendingEventsBuffer = [], t.forEach((r) => {
882
- this.track(r);
842
+ this.pendingEventsBuffer = [], t.forEach((s) => {
843
+ this.track(s);
883
844
  });
884
845
  }
885
846
  clearSendInterval() {
@@ -888,7 +849,7 @@ class ut extends f {
888
849
  flushEvents(e) {
889
850
  if (this.eventsQueue.length === 0)
890
851
  return e ? !0 : Promise.resolve(!0);
891
- const t = this.buildEventsPayload(), r = [...this.eventsQueue], n = r.map((i) => i.id);
852
+ const t = this.buildEventsPayload(), s = [...this.eventsQueue], n = s.map((i) => i.id);
892
853
  if (e) {
893
854
  const i = this.dataSender.sendEventsQueueSync(t);
894
855
  return i && (this.removeProcessedEvents(n), this.clearSendInterval(), this.emitEventsQueue(t)), i;
@@ -899,7 +860,7 @@ class ut extends f {
899
860
  },
900
861
  onFailure: () => {
901
862
  o("warn", "Async flush failed", {
902
- data: { eventCount: r.length }
863
+ data: { eventCount: s.length }
903
864
  });
904
865
  }
905
866
  });
@@ -907,12 +868,12 @@ class ut extends f {
907
868
  async sendEventsQueue() {
908
869
  if (!this.get("sessionId") || this.eventsQueue.length === 0)
909
870
  return;
910
- const e = this.buildEventsPayload(), t = [...this.eventsQueue], r = t.map((n) => n.id);
871
+ const e = this.buildEventsPayload(), t = [...this.eventsQueue], s = t.map((n) => n.id);
911
872
  await this.dataSender.sendEventsQueue(e, {
912
873
  onSuccess: () => {
913
- this.removeProcessedEvents(r), this.emitEventsQueue(e);
874
+ this.removeProcessedEvents(s), this.emitEventsQueue(e);
914
875
  },
915
- onFailure: async () => {
876
+ onFailure: () => {
916
877
  o("warn", "Events send failed, keeping in queue", {
917
878
  data: { eventCount: t.length }
918
879
  });
@@ -925,21 +886,21 @@ class ut extends f {
925
886
  const i = this.createEventSignature(n);
926
887
  e.has(i) || t.push(i), e.set(i, n);
927
888
  }
928
- const r = t.map((n) => e.get(n)).filter((n) => !!n).sort((n, i) => n.timestamp - i.timestamp);
889
+ const s = t.map((n) => e.get(n)).filter((n) => !!n).sort((n, i) => n.timestamp - i.timestamp);
929
890
  return {
930
891
  user_id: this.get("userId"),
931
892
  session_id: this.get("sessionId"),
932
893
  device: this.get("device"),
933
- events: r,
894
+ events: s,
934
895
  ...this.get("config")?.globalMetadata && { global_metadata: this.get("config")?.globalMetadata }
935
896
  };
936
897
  }
937
898
  buildEventPayload(e) {
938
- const t = e.type === d.SESSION_START, r = e.page_url ?? this.get("pageUrl");
899
+ const t = e.type === d.SESSION_START, s = e.page_url ?? this.get("pageUrl");
939
900
  return {
940
- id: Ye(),
901
+ id: Ke(),
941
902
  type: e.type,
942
- page_url: r,
903
+ page_url: s,
943
904
  timestamp: Date.now(),
944
905
  ...t && { referrer: document.referrer || "Direct" },
945
906
  ...e.from_page_url && { from_page_url: e.from_page_url },
@@ -953,14 +914,14 @@ class ut extends f {
953
914
  };
954
915
  }
955
916
  isDuplicateEvent(e) {
956
- const t = Date.now(), r = this.createEventFingerprint(e);
957
- return this.lastEventFingerprint === r && t - this.lastEventTime < 500 ? !0 : (this.lastEventFingerprint = r, this.lastEventTime = t, !1);
917
+ const t = Date.now(), s = this.createEventFingerprint(e);
918
+ return this.lastEventFingerprint === s && t - this.lastEventTime < 500 ? !0 : (this.lastEventFingerprint = s, this.lastEventTime = t, !1);
958
919
  }
959
920
  createEventFingerprint(e) {
960
921
  let t = `${e.type}_${e.page_url}`;
961
922
  if (e.click_data) {
962
- const r = Math.round((e.click_data.x || 0) / 10) * 10, n = Math.round((e.click_data.y || 0) / 10) * 10;
963
- t += `_click_${r}_${n}`;
923
+ const s = Math.round((e.click_data.x || 0) / 10) * 10, n = Math.round((e.click_data.y || 0) / 10) * 10;
924
+ t += `_click_${s}_${n}`;
964
925
  }
965
926
  return e.scroll_data && (t += `_scroll_${e.scroll_data.depth}_${e.scroll_data.direction}`), e.custom_event && (t += `_custom_${e.custom_event.name}`), e.web_vitals && (t += `_vitals_${e.web_vitals.type}`), e.error_data && (t += `_error_${e.error_data.type}_${e.error_data.message}`), t;
966
927
  }
@@ -971,13 +932,13 @@ class ut extends f {
971
932
  if (this.eventsQueue.push(e), this.emitEvent(e), this.eventsQueue.length > 100) {
972
933
  const t = this.eventsQueue.findIndex(
973
934
  (n) => n.type !== d.SESSION_START && n.type !== d.SESSION_END
974
- ), r = t >= 0 ? this.eventsQueue.splice(t, 1)[0] : this.eventsQueue.shift();
935
+ ), s = t >= 0 ? this.eventsQueue.splice(t, 1)[0] : this.eventsQueue.shift();
975
936
  o("warn", "Event queue overflow, oldest non-critical event removed", {
976
937
  data: {
977
938
  maxLength: 100,
978
939
  currentLength: this.eventsQueue.length,
979
- removedEventType: r?.type,
980
- wasCritical: r?.type === d.SESSION_START || r?.type === d.SESSION_END
940
+ removedEventType: s?.type,
941
+ wasCritical: s?.type === d.SESSION_START || s?.type === d.SESSION_END
981
942
  }
982
943
  });
983
944
  }
@@ -990,7 +951,7 @@ class ut extends f {
990
951
  }
991
952
  handleGoogleAnalyticsIntegration(e) {
992
953
  if (this.googleAnalytics && e.type === d.CUSTOM && e.custom_event) {
993
- if (this.get("mode") === C.QA)
954
+ if (this.get("mode") === R.QA)
994
955
  return;
995
956
  this.googleAnalytics.trackEvent(e.custom_event.name, e.custom_event.metadata ?? {});
996
957
  }
@@ -1005,7 +966,7 @@ class ut extends f {
1005
966
  }
1006
967
  removeProcessedEvents(e) {
1007
968
  const t = new Set(e);
1008
- this.eventsQueue = this.eventsQueue.filter((r) => !t.has(r.id));
969
+ this.eventsQueue = this.eventsQueue.filter((s) => !t.has(s.id));
1009
970
  }
1010
971
  emitEvent(e) {
1011
972
  this.emitter && this.emitter.emit(W.EVENT, e);
@@ -1024,10 +985,10 @@ class dt {
1024
985
  * @returns Persistent unique user ID
1025
986
  */
1026
987
  static getId(e) {
1027
- const t = Ve, r = e.getItem(t);
1028
- if (r)
1029
- return r;
1030
- const n = We();
988
+ const t = Fe, s = e.getItem(t);
989
+ if (s)
990
+ return s;
991
+ const n = Ye();
1031
992
  return e.setItem(t, n), n;
1032
993
  }
1033
994
  }
@@ -1041,8 +1002,8 @@ class ht extends f {
1041
1002
  visibilityChangeHandler = null;
1042
1003
  beforeUnloadHandler = null;
1043
1004
  isTracking = !1;
1044
- constructor(e, t, r) {
1045
- super(), this.storageManager = e, this.eventManager = t, this.projectId = r;
1005
+ constructor(e, t, s) {
1006
+ super(), this.storageManager = e, this.eventManager = t, this.projectId = s;
1046
1007
  }
1047
1008
  initCrossTabSync() {
1048
1009
  if (typeof BroadcastChannel > "u") {
@@ -1051,9 +1012,9 @@ class ht extends f {
1051
1012
  }
1052
1013
  const e = this.getProjectId();
1053
1014
  this.broadcastChannel = new BroadcastChannel(ze(e)), this.broadcastChannel.onmessage = (t) => {
1054
- const { action: r, sessionId: n, timestamp: i, projectId: a } = t.data ?? {};
1015
+ const { action: s, sessionId: n, timestamp: i, projectId: a } = t.data ?? {};
1055
1016
  if (a === e) {
1056
- if (r === "session_end") {
1017
+ if (s === "session_end") {
1057
1018
  this.resetSessionState();
1058
1019
  return;
1059
1020
  }
@@ -1070,13 +1031,18 @@ class ht extends f {
1070
1031
  });
1071
1032
  }
1072
1033
  broadcastSessionEnd(e, t) {
1073
- e && this.broadcastChannel && typeof this.broadcastChannel.postMessage == "function" && this.broadcastChannel.postMessage({
1074
- action: "session_end",
1075
- projectId: this.getProjectId(),
1076
- sessionId: e,
1077
- reason: t,
1078
- timestamp: Date.now()
1079
- });
1034
+ if (e && this.broadcastChannel && typeof this.broadcastChannel.postMessage == "function")
1035
+ try {
1036
+ this.broadcastChannel.postMessage({
1037
+ action: "session_end",
1038
+ projectId: this.getProjectId(),
1039
+ sessionId: e,
1040
+ reason: t,
1041
+ timestamp: Date.now()
1042
+ });
1043
+ } catch (s) {
1044
+ o("warn", "Failed to broadcast session end", { error: s, data: { sessionId: e, reason: t } });
1045
+ }
1080
1046
  }
1081
1047
  cleanupCrossTabSync() {
1082
1048
  this.broadcastChannel && (typeof this.broadcastChannel.close == "function" && this.broadcastChannel.close(), this.broadcastChannel = null);
@@ -1103,8 +1069,8 @@ class ht extends f {
1103
1069
  if (!t)
1104
1070
  return null;
1105
1071
  try {
1106
- const r = JSON.parse(t);
1107
- return !r.id || typeof r.lastActivity != "number" ? null : r;
1072
+ const s = JSON.parse(t);
1073
+ return !s.id || typeof s.lastActivity != "number" ? null : s;
1108
1074
  } catch {
1109
1075
  return this.storageManager.removeItem(e), null;
1110
1076
  }
@@ -1114,20 +1080,20 @@ class ht extends f {
1114
1080
  this.storageManager.setItem(t, JSON.stringify(e));
1115
1081
  }
1116
1082
  getSessionStorageKey() {
1117
- return Ge(this.getProjectId());
1083
+ return $e(this.getProjectId());
1118
1084
  }
1119
1085
  getProjectId() {
1120
1086
  return this.projectId;
1121
1087
  }
1122
- async startTracking() {
1088
+ startTracking() {
1123
1089
  if (this.isTracking) {
1124
1090
  o("warn", "Session tracking already active");
1125
1091
  return;
1126
1092
  }
1127
- const e = this.recoverSession(), t = e ?? this.generateSessionId(), r = !!e;
1093
+ const e = this.recoverSession(), t = e ?? this.generateSessionId(), s = !!e;
1128
1094
  this.isTracking = !0;
1129
1095
  try {
1130
- this.set("sessionId", t), this.persistSession(t), r || this.eventManager.track({
1096
+ this.set("sessionId", t), this.persistSession(t), s || this.eventManager.track({
1131
1097
  type: d.SESSION_START
1132
1098
  }), this.initCrossTabSync(), this.shareSession(t), this.setupSessionTimeout(), this.setupActivityListeners(), this.setupLifecycleListeners();
1133
1099
  } catch (n) {
@@ -1153,7 +1119,9 @@ class ht extends f {
1153
1119
  this.sessionTimeoutId && (clearTimeout(this.sessionTimeoutId), this.sessionTimeoutId = null);
1154
1120
  }
1155
1121
  setupActivityListeners() {
1156
- this.activityHandler = () => this.resetSessionTimeout(), document.addEventListener("click", this.activityHandler, { passive: !0 }), document.addEventListener("keydown", this.activityHandler, { passive: !0 }), document.addEventListener("scroll", this.activityHandler, { passive: !0 });
1122
+ this.activityHandler = () => {
1123
+ this.resetSessionTimeout();
1124
+ }, document.addEventListener("click", this.activityHandler, { passive: !0 }), document.addEventListener("keydown", this.activityHandler, { passive: !0 }), document.addEventListener("scroll", this.activityHandler, { passive: !0 });
1157
1125
  }
1158
1126
  cleanupActivityListeners() {
1159
1127
  this.activityHandler && (document.removeEventListener("click", this.activityHandler), document.removeEventListener("keydown", this.activityHandler), document.removeEventListener("scroll", this.activityHandler), this.activityHandler = null);
@@ -1168,7 +1136,7 @@ class ht extends f {
1168
1136
  cleanupLifecycleListeners() {
1169
1137
  this.visibilityChangeHandler && (document.removeEventListener("visibilitychange", this.visibilityChangeHandler), this.visibilityChangeHandler = null), this.beforeUnloadHandler && (window.removeEventListener("beforeunload", this.beforeUnloadHandler), this.beforeUnloadHandler = null);
1170
1138
  }
1171
- async endSession(e) {
1139
+ endSession(e) {
1172
1140
  const t = this.get("sessionId");
1173
1141
  if (!t) {
1174
1142
  o("warn", "endSession called without active session", { data: { reason: e } }), this.resetSessionState(e);
@@ -1177,25 +1145,15 @@ class ht extends f {
1177
1145
  this.eventManager.track({
1178
1146
  type: d.SESSION_END,
1179
1147
  session_end_reason: e
1180
- });
1181
- const r = () => {
1182
- this.broadcastSessionEnd(t, e), this.resetSessionState(e);
1183
- };
1184
- if (this.eventManager.flushImmediatelySync()) {
1185
- r();
1186
- return;
1187
- }
1188
- try {
1189
- await this.eventManager.flushImmediately(), r();
1190
- } catch (i) {
1191
- o("warn", "Async flush failed during session end", { error: i }), r();
1192
- }
1148
+ }), this.eventManager.flushImmediatelySync() || o("warn", "Sync flush failed during session end, events persisted for recovery", {
1149
+ data: { reason: e, sessionId: t }
1150
+ }), this.broadcastSessionEnd(t, e), this.resetSessionState(e);
1193
1151
  }
1194
1152
  resetSessionState(e) {
1195
1153
  this.clearSessionTimeout(), this.cleanupActivityListeners(), this.cleanupLifecycleListeners(), this.cleanupCrossTabSync(), e !== "page_unload" && this.clearStoredSession(), this.set("sessionId", null), this.set("hasStartSession", !1), this.isTracking = !1;
1196
1154
  }
1197
- async stopTracking() {
1198
- await this.endSession("manual_stop");
1155
+ stopTracking() {
1156
+ this.endSession("manual_stop");
1199
1157
  }
1200
1158
  destroy() {
1201
1159
  this.clearSessionTimeout(), this.cleanupActivityListeners(), this.cleanupCrossTabSync(), this.cleanupLifecycleListeners(), this.isTracking = !1, this.set("hasStartSession", !1);
@@ -1209,7 +1167,7 @@ class ft extends f {
1209
1167
  constructor(e, t) {
1210
1168
  super(), this.eventManager = t, this.storageManager = e;
1211
1169
  }
1212
- async startTracking() {
1170
+ startTracking() {
1213
1171
  if (this.isActive())
1214
1172
  return;
1215
1173
  if (this.destroyed) {
@@ -1220,8 +1178,8 @@ class ft extends f {
1220
1178
  if (!t)
1221
1179
  throw new Error("Cannot start session tracking: config not available");
1222
1180
  try {
1223
- this.sessionManager = new ht(this.storageManager, this.eventManager, t), await this.sessionManager.startTracking(), this.eventManager.flushPendingEvents();
1224
- } catch (r) {
1181
+ this.sessionManager = new ht(this.storageManager, this.eventManager, t), this.sessionManager.startTracking(), this.eventManager.flushPendingEvents();
1182
+ } catch (s) {
1225
1183
  if (this.sessionManager) {
1226
1184
  try {
1227
1185
  this.sessionManager.destroy();
@@ -1229,17 +1187,17 @@ class ft extends f {
1229
1187
  }
1230
1188
  this.sessionManager = null;
1231
1189
  }
1232
- throw o("error", "Failed to start session tracking", { error: r }), r;
1190
+ throw o("error", "Failed to start session tracking", { error: s }), s;
1233
1191
  }
1234
1192
  }
1235
1193
  isActive() {
1236
1194
  return this.sessionManager !== null && !this.destroyed;
1237
1195
  }
1238
- async cleanupSessionManager() {
1239
- this.sessionManager && (await this.sessionManager.stopTracking(), this.sessionManager.destroy(), this.sessionManager = null);
1196
+ cleanupSessionManager() {
1197
+ this.sessionManager && (this.sessionManager.stopTracking(), this.sessionManager.destroy(), this.sessionManager = null);
1240
1198
  }
1241
- async stopTracking() {
1242
- await this.cleanupSessionManager();
1199
+ stopTracking() {
1200
+ this.cleanupSessionManager();
1243
1201
  }
1244
1202
  destroy() {
1245
1203
  this.destroyed || (this.sessionManager && (this.sessionManager.destroy(), this.sessionManager = null), this.destroyed = !0, this.set("hasStartSession", !1));
@@ -1261,22 +1219,22 @@ class gt extends f {
1261
1219
  }
1262
1220
  patchHistory(e) {
1263
1221
  const t = window.history[e];
1264
- e === "pushState" && !this.originalPushState ? this.originalPushState = t : e === "replaceState" && !this.originalReplaceState && (this.originalReplaceState = t), window.history[e] = (...r) => {
1265
- t.apply(window.history, r), this.trackCurrentPage();
1222
+ e === "pushState" && !this.originalPushState ? this.originalPushState = t : e === "replaceState" && !this.originalReplaceState && (this.originalReplaceState = t), window.history[e] = (...s) => {
1223
+ t.apply(window.history, s), this.trackCurrentPage();
1266
1224
  };
1267
1225
  }
1268
- trackCurrentPage = async () => {
1226
+ trackCurrentPage = () => {
1269
1227
  const e = window.location.href, t = K(e, this.get("config").sensitiveQueryParams);
1270
1228
  if (this.get("pageUrl") === t)
1271
1229
  return;
1272
1230
  this.onTrack();
1273
- const r = this.get("pageUrl");
1231
+ const s = this.get("pageUrl");
1274
1232
  this.set("pageUrl", t);
1275
1233
  const n = this.extractPageViewData();
1276
1234
  this.eventManager.track({
1277
1235
  type: d.PAGE_VIEW,
1278
1236
  page_url: this.get("pageUrl"),
1279
- from_page_url: r,
1237
+ from_page_url: s,
1280
1238
  ...n && { page_view: n }
1281
1239
  });
1282
1240
  };
@@ -1289,17 +1247,17 @@ class gt extends f {
1289
1247
  }), this.onTrack();
1290
1248
  }
1291
1249
  extractPageViewData() {
1292
- const { pathname: e, search: t, hash: r } = window.location, { referrer: n } = document, { title: i } = document;
1293
- return !n && !i && !e && !t && !r ? void 0 : {
1250
+ const { pathname: e, search: t, hash: s } = window.location, { referrer: n } = document, { title: i } = document;
1251
+ return !n && !i && !e && !t && !s ? void 0 : {
1294
1252
  ...n && { referrer: n },
1295
1253
  ...i && { title: i },
1296
1254
  ...e && { pathname: e },
1297
1255
  ...t && { search: t },
1298
- ...r && { hash: r }
1256
+ ...s && { hash: s }
1299
1257
  };
1300
1258
  }
1301
1259
  }
1302
- class St extends f {
1260
+ class Et extends f {
1303
1261
  eventManager;
1304
1262
  clickHandler;
1305
1263
  constructor(e) {
@@ -1307,12 +1265,12 @@ class St extends f {
1307
1265
  }
1308
1266
  startTracking() {
1309
1267
  this.clickHandler || (this.clickHandler = (e) => {
1310
- const t = e, r = t.target, n = typeof HTMLElement < "u" && r instanceof HTMLElement ? r : typeof HTMLElement < "u" && r instanceof Node && r.parentElement instanceof HTMLElement ? r.parentElement : null;
1268
+ const t = e, s = t.target, n = typeof HTMLElement < "u" && s instanceof HTMLElement ? s : typeof HTMLElement < "u" && s instanceof Node && s.parentElement instanceof HTMLElement ? s.parentElement : null;
1311
1269
  if (!n) {
1312
1270
  o("warn", "Click target not found or not an element");
1313
1271
  return;
1314
1272
  }
1315
- const i = this.findTrackingElement(n), a = this.getRelevantClickElement(n), c = this.calculateClickCoordinates(t, n);
1273
+ const i = this.findTrackingElement(n), a = this.getRelevantClickElement(n), l = this.calculateClickCoordinates(t, n);
1316
1274
  if (i) {
1317
1275
  const u = this.extractTrackingData(i);
1318
1276
  if (u) {
@@ -1326,10 +1284,10 @@ class St extends f {
1326
1284
  });
1327
1285
  }
1328
1286
  }
1329
- const l = this.generateClickData(n, a, c);
1287
+ const c = this.generateClickData(n, a, l);
1330
1288
  this.eventManager.track({
1331
1289
  type: d.CLICK,
1332
- click_data: l
1290
+ click_data: c
1333
1291
  });
1334
1292
  }, window.addEventListener("click", this.clickHandler, !0));
1335
1293
  }
@@ -1340,15 +1298,15 @@ class St extends f {
1340
1298
  return e.hasAttribute(`${P}-name`) ? e : e.closest(`[${P}-name]`) || void 0;
1341
1299
  }
1342
1300
  getRelevantClickElement(e) {
1343
- for (const t of be)
1301
+ for (const t of Oe)
1344
1302
  try {
1345
1303
  if (e.matches(t))
1346
1304
  return e;
1347
- const r = e.closest(t);
1348
- if (r)
1349
- return r;
1350
- } catch (r) {
1351
- o("warn", "Invalid selector in element search", { error: r, data: { selector: t } });
1305
+ const s = e.closest(t);
1306
+ if (s)
1307
+ return s;
1308
+ } catch (s) {
1309
+ o("warn", "Invalid selector in element search", { error: s, data: { selector: t } });
1352
1310
  continue;
1353
1311
  }
1354
1312
  return e;
@@ -1357,29 +1315,29 @@ class St extends f {
1357
1315
  return Math.max(0, Math.min(1, Number(e.toFixed(3))));
1358
1316
  }
1359
1317
  calculateClickCoordinates(e, t) {
1360
- const r = t.getBoundingClientRect(), n = e.clientX, i = e.clientY, a = r.width > 0 ? this.clamp((n - r.left) / r.width) : 0, c = r.height > 0 ? this.clamp((i - r.top) / r.height) : 0;
1361
- return { x: n, y: i, relativeX: a, relativeY: c };
1318
+ const s = t.getBoundingClientRect(), n = e.clientX, i = e.clientY, a = s.width > 0 ? this.clamp((n - s.left) / s.width) : 0, l = s.height > 0 ? this.clamp((i - s.top) / s.height) : 0;
1319
+ return { x: n, y: i, relativeX: a, relativeY: l };
1362
1320
  }
1363
1321
  extractTrackingData(e) {
1364
- const t = e.getAttribute(`${P}-name`), r = e.getAttribute(`${P}-value`);
1322
+ const t = e.getAttribute(`${P}-name`), s = e.getAttribute(`${P}-value`);
1365
1323
  if (t)
1366
1324
  return {
1367
1325
  element: e,
1368
1326
  name: t,
1369
- ...r && { value: r }
1327
+ ...s && { value: s }
1370
1328
  };
1371
1329
  }
1372
- generateClickData(e, t, r) {
1373
- const { x: n, y: i, relativeX: a, relativeY: c } = r, l = this.getRelevantText(e, t), u = this.extractElementAttributes(t);
1330
+ generateClickData(e, t, s) {
1331
+ const { x: n, y: i, relativeX: a, relativeY: l } = s, c = this.getRelevantText(e, t), u = this.extractElementAttributes(t);
1374
1332
  return {
1375
1333
  x: n,
1376
1334
  y: i,
1377
1335
  relativeX: a,
1378
- relativeY: c,
1336
+ relativeY: l,
1379
1337
  tag: t.tagName.toLowerCase(),
1380
1338
  ...t.id && { id: t.id },
1381
1339
  ...t.className && { class: t.className },
1382
- ...l && { text: l },
1340
+ ...c && { text: c },
1383
1341
  ...u.href && { href: u.href },
1384
1342
  ...u.title && { title: u.title },
1385
1343
  ...u.alt && { alt: u.alt },
@@ -1389,8 +1347,8 @@ class St extends f {
1389
1347
  };
1390
1348
  }
1391
1349
  getRelevantText(e, t) {
1392
- const r = e.textContent?.trim() ?? "", n = t.textContent?.trim() ?? "";
1393
- return !r && !n ? "" : r && r.length <= 255 ? r : n.length <= 255 ? n : n.slice(0, 252) + "...";
1350
+ const s = e.textContent?.trim() ?? "", n = t.textContent?.trim() ?? "";
1351
+ return !s && !n ? "" : s && s.length <= 255 ? s : n.length <= 255 ? n : n.slice(0, 252) + "...";
1394
1352
  }
1395
1353
  extractElementAttributes(e) {
1396
1354
  const t = [
@@ -1404,12 +1362,12 @@ class St extends f {
1404
1362
  "name",
1405
1363
  "alt",
1406
1364
  "role"
1407
- ], r = {};
1365
+ ], s = {};
1408
1366
  for (const n of t) {
1409
1367
  const i = e.getAttribute(n);
1410
- i && (r[n] = i);
1368
+ i && (s[n] = i);
1411
1369
  }
1412
- return r;
1370
+ return s;
1413
1371
  }
1414
1372
  createCustomEventData(e) {
1415
1373
  return {
@@ -1418,7 +1376,7 @@ class St extends f {
1418
1376
  };
1419
1377
  }
1420
1378
  }
1421
- class Et extends f {
1379
+ class St extends f {
1422
1380
  eventManager;
1423
1381
  containers = [];
1424
1382
  limitWarningLogged = !1;
@@ -1439,16 +1397,18 @@ class Et extends f {
1439
1397
  this.containers.length = 0, this.set("scrollEventCount", 0), this.limitWarningLogged = !1;
1440
1398
  }
1441
1399
  trySetupContainers(e, t) {
1442
- const r = e.map((n) => this.safeQuerySelector(n)).filter(
1400
+ const s = e.map((n) => this.safeQuerySelector(n)).filter(
1443
1401
  (n) => n != null && typeof HTMLElement < "u" && n instanceof HTMLElement
1444
1402
  );
1445
- if (r.length > 0) {
1446
- for (const n of r)
1403
+ if (s.length > 0) {
1404
+ for (const n of s)
1447
1405
  this.containers.some((a) => a.element === n) || this.setupScrollContainer(n);
1448
1406
  return;
1449
1407
  }
1450
1408
  if (t < 5) {
1451
- setTimeout(() => this.trySetupContainers(e, t + 1), 200);
1409
+ setTimeout(() => {
1410
+ this.trySetupContainers(e, t + 1);
1411
+ }, 200);
1452
1412
  return;
1453
1413
  }
1454
1414
  this.containers.length === 0 && this.setupScrollContainer(window);
@@ -1465,11 +1425,11 @@ class Et extends f {
1465
1425
  }
1466
1426
  n.debounceTimer = null;
1467
1427
  }, 250));
1468
- }, r = this.getScrollTop(e), n = {
1428
+ }, s = this.getScrollTop(e), n = {
1469
1429
  element: e,
1470
- lastScrollPos: r,
1430
+ lastScrollPos: s,
1471
1431
  lastDepth: this.calculateScrollDepth(
1472
- r,
1432
+ s,
1473
1433
  this.getScrollHeight(e),
1474
1434
  this.getViewportHeight(e)
1475
1435
  ),
@@ -1480,18 +1440,18 @@ class Et extends f {
1480
1440
  };
1481
1441
  this.containers.push(n), e instanceof Window ? window.addEventListener("scroll", t, { passive: !0 }) : e.addEventListener("scroll", t, { passive: !0 });
1482
1442
  }
1483
- processScrollEvent(e, t, r) {
1484
- if (!this.shouldEmitScrollEvent(e, t, r))
1443
+ processScrollEvent(e, t, s) {
1444
+ if (!this.shouldEmitScrollEvent(e, t, s))
1485
1445
  return;
1486
- e.lastEventTime = r, e.lastDepth = t.depth, e.lastDirection = t.direction;
1446
+ e.lastEventTime = s, e.lastDepth = t.depth, e.lastDirection = t.direction;
1487
1447
  const n = this.get("scrollEventCount") ?? 0;
1488
1448
  this.set("scrollEventCount", n + 1), this.eventManager.track({
1489
1449
  type: d.SCROLL,
1490
1450
  scroll_data: t
1491
1451
  });
1492
1452
  }
1493
- shouldEmitScrollEvent(e, t, r) {
1494
- return this.hasReachedSessionLimit() ? (this.logLimitOnce(), !1) : !(!this.hasElapsedMinimumInterval(e, r) || !this.hasSignificantDepthChange(e, t.depth));
1453
+ shouldEmitScrollEvent(e, t, s) {
1454
+ return this.hasReachedSessionLimit() ? (this.logLimitOnce(), !1) : !(!this.hasElapsedMinimumInterval(e, s) || !this.hasSignificantDepthChange(e, t.depth));
1495
1455
  }
1496
1456
  hasReachedSessionLimit() {
1497
1457
  return (this.get("scrollEventCount") ?? 0) >= this.maxEventsPerSession;
@@ -1519,18 +1479,18 @@ class Et extends f {
1519
1479
  getScrollDirection(e, t) {
1520
1480
  return e > t ? k.DOWN : k.UP;
1521
1481
  }
1522
- calculateScrollDepth(e, t, r) {
1523
- if (t <= r)
1482
+ calculateScrollDepth(e, t, s) {
1483
+ if (t <= s)
1524
1484
  return 0;
1525
- const n = t - r;
1485
+ const n = t - s;
1526
1486
  return Math.min(100, Math.max(0, Math.floor(e / n * 100)));
1527
1487
  }
1528
1488
  calculateScrollData(e) {
1529
- const { element: t, lastScrollPos: r } = e, n = this.getScrollTop(t);
1530
- if (Math.abs(n - r) < 10 || t === window && !this.isWindowScrollable())
1489
+ const { element: t, lastScrollPos: s } = e, n = this.getScrollTop(t);
1490
+ if (Math.abs(n - s) < 10 || t === window && !this.isWindowScrollable())
1531
1491
  return null;
1532
- const a = this.getViewportHeight(t), c = this.getScrollHeight(t), l = this.getScrollDirection(n, r), u = this.calculateScrollDepth(n, c, a);
1533
- return e.lastScrollPos = n, { depth: u, direction: l };
1492
+ const a = this.getViewportHeight(t), l = this.getScrollHeight(t), c = this.getScrollDirection(n, s), u = this.calculateScrollDepth(n, l, a);
1493
+ return e.lastScrollPos = n, { depth: u, direction: c };
1534
1494
  }
1535
1495
  getScrollTop(e) {
1536
1496
  return e instanceof Window ? window.scrollY : e.scrollTop;
@@ -1542,8 +1502,8 @@ class Et extends f {
1542
1502
  return e instanceof Window ? document.documentElement.scrollHeight : e.scrollHeight;
1543
1503
  }
1544
1504
  isElementScrollable(e) {
1545
- const t = getComputedStyle(e), r = t.overflowY === "auto" || t.overflowY === "scroll" || t.overflowX === "auto" || t.overflowX === "scroll" || t.overflow === "auto" || t.overflow === "scroll", n = e.scrollHeight > e.clientHeight || e.scrollWidth > e.clientWidth;
1546
- return r && n;
1505
+ const t = getComputedStyle(e), s = t.overflowY === "auto" || t.overflowY === "scroll" || t.overflowX === "auto" || t.overflowX === "scroll" || t.overflow === "auto" || t.overflow === "scroll", n = e.scrollHeight > e.clientHeight || e.scrollWidth > e.clientWidth;
1506
+ return s && n;
1547
1507
  }
1548
1508
  safeQuerySelector(e) {
1549
1509
  try {
@@ -1570,17 +1530,17 @@ class mt extends f {
1570
1530
  return;
1571
1531
  }
1572
1532
  await this.loadScript(e), this.configureGtag(e, t), this.isInitialized = !0;
1573
- } catch (r) {
1574
- o("error", "Google Analytics initialization failed", { error: r });
1533
+ } catch (s) {
1534
+ o("error", "Google Analytics initialization failed", { error: s });
1575
1535
  }
1576
1536
  }
1577
1537
  trackEvent(e, t) {
1578
1538
  if (!(!e?.trim() || !this.isInitialized || typeof window.gtag != "function"))
1579
1539
  try {
1580
- const r = Array.isArray(t) ? { items: t } : t;
1581
- window.gtag("event", e, r);
1582
- } catch (r) {
1583
- o("error", "Google Analytics event tracking failed", { error: r });
1540
+ const s = Array.isArray(t) ? { items: t } : t;
1541
+ window.gtag("event", e, s);
1542
+ } catch (s) {
1543
+ o("error", "Google Analytics event tracking failed", { error: s });
1584
1544
  }
1585
1545
  }
1586
1546
  cleanup() {
@@ -1592,21 +1552,25 @@ class mt extends f {
1592
1552
  return document.getElementById("tracelog-ga-script") ? !0 : !!document.querySelector('script[src*="googletagmanager.com/gtag/js"]');
1593
1553
  }
1594
1554
  async loadScript(e) {
1595
- return new Promise((t, r) => {
1555
+ return new Promise((t, s) => {
1596
1556
  const n = document.createElement("script");
1597
- n.id = "tracelog-ga-script", n.async = !0, n.src = `https://www.googletagmanager.com/gtag/js?id=${e}`, n.onload = () => t(), n.onerror = () => r(new Error("Failed to load Google Analytics script")), document.head.appendChild(n);
1557
+ n.id = "tracelog-ga-script", n.async = !0, n.src = `https://www.googletagmanager.com/gtag/js?id=${e}`, n.onload = () => {
1558
+ t();
1559
+ }, n.onerror = () => {
1560
+ s(new Error("Failed to load Google Analytics script"));
1561
+ }, document.head.appendChild(n);
1598
1562
  });
1599
1563
  }
1600
1564
  configureGtag(e, t) {
1601
- const r = document.createElement("script");
1602
- r.innerHTML = `
1565
+ const s = document.createElement("script");
1566
+ s.innerHTML = `
1603
1567
  window.dataLayer = window.dataLayer || [];
1604
1568
  function gtag(){dataLayer.push(arguments);}
1605
1569
  gtag('js', new Date());
1606
1570
  gtag('config', '${e}', {
1607
1571
  'user_id': '${t}'
1608
1572
  });
1609
- `, document.head.appendChild(r);
1573
+ `, document.head.appendChild(s);
1610
1574
  }
1611
1575
  }
1612
1576
  class pt {
@@ -1638,8 +1602,8 @@ class pt {
1638
1602
  this.storage.setItem(e, t);
1639
1603
  return;
1640
1604
  }
1641
- } catch (r) {
1642
- if (r instanceof DOMException && r.name === "QuotaExceededError")
1605
+ } catch (s) {
1606
+ if (s instanceof DOMException && s.name === "QuotaExceededError")
1643
1607
  if (this.hasQuotaExceededError = !0, o("warn", "localStorage quota exceeded, attempting cleanup", {
1644
1608
  data: { key: e, valueSize: t.length }
1645
1609
  }), this.cleanupOldData())
@@ -1656,7 +1620,7 @@ class pt {
1656
1620
  }
1657
1621
  else
1658
1622
  o("error", "localStorage quota exceeded and no data to cleanup - data will not persist", {
1659
- error: r,
1623
+ error: s,
1660
1624
  data: { key: e, valueSize: t.length }
1661
1625
  });
1662
1626
  }
@@ -1682,10 +1646,12 @@ class pt {
1682
1646
  try {
1683
1647
  const e = [];
1684
1648
  for (let t = 0; t < this.storage.length; t++) {
1685
- const r = this.storage.key(t);
1686
- r?.startsWith("tracelog_") && e.push(r);
1649
+ const s = this.storage.key(t);
1650
+ s?.startsWith("tracelog_") && e.push(s);
1687
1651
  }
1688
- e.forEach((t) => this.storage.removeItem(t)), this.fallbackStorage.clear();
1652
+ e.forEach((t) => {
1653
+ this.storage.removeItem(t);
1654
+ }), this.fallbackStorage.clear();
1689
1655
  } catch (e) {
1690
1656
  o("error", "Failed to clear storage", { error: e }), this.fallbackStorage.clear();
1691
1657
  }
@@ -1723,7 +1689,7 @@ class pt {
1723
1689
  } catch {
1724
1690
  }
1725
1691
  }), !0;
1726
- const r = ["tracelog_session_", "tracelog_user_id", "tracelog_device_id", "tracelog_config"], n = e.filter((i) => !r.some((a) => i.startsWith(a)));
1692
+ const s = ["tracelog_session_", "tracelog_user_id", "tracelog_device_id", "tracelog_config"], n = e.filter((i) => !s.some((a) => i.startsWith(a)));
1727
1693
  return n.length > 0 ? (n.slice(0, 5).forEach((a) => {
1728
1694
  try {
1729
1695
  this.storage.removeItem(a);
@@ -1741,8 +1707,8 @@ class pt {
1741
1707
  if (typeof window > "u")
1742
1708
  return null;
1743
1709
  try {
1744
- const t = e === "localStorage" ? window.localStorage : window.sessionStorage, r = "__tracelog_test__";
1745
- return t.setItem(r, "test"), t.removeItem(r), t;
1710
+ const t = e === "localStorage" ? window.localStorage : window.sessionStorage, s = "__tracelog_test__";
1711
+ return t.setItem(s, "test"), t.removeItem(s), t;
1746
1712
  } catch {
1747
1713
  return null;
1748
1714
  }
@@ -1767,9 +1733,9 @@ class pt {
1767
1733
  this.sessionStorageRef.setItem(e, t);
1768
1734
  return;
1769
1735
  }
1770
- } catch (r) {
1771
- r instanceof DOMException && r.name === "QuotaExceededError" && o("error", "sessionStorage quota exceeded - data will not persist", {
1772
- error: r,
1736
+ } catch (s) {
1737
+ s instanceof DOMException && s.name === "QuotaExceededError" && o("error", "sessionStorage quota exceeded - data will not persist", {
1738
+ error: s,
1773
1739
  data: { key: e, valueSize: t.length }
1774
1740
  });
1775
1741
  }
@@ -1801,16 +1767,16 @@ class _t extends f {
1801
1767
  this.observers.forEach((e, t) => {
1802
1768
  try {
1803
1769
  e.disconnect();
1804
- } catch (r) {
1805
- o("warn", "Failed to disconnect performance observer", { error: r, data: { observerIndex: t } });
1770
+ } catch (s) {
1771
+ o("warn", "Failed to disconnect performance observer", { error: s, data: { observerIndex: t } });
1806
1772
  }
1807
1773
  }), this.observers.length = 0, this.reportedByNav.clear();
1808
1774
  }
1809
1775
  observeWebVitalsFallback() {
1810
1776
  this.reportTTFB(), this.safeObserve(
1811
1777
  "largest-contentful-paint",
1812
- (r) => {
1813
- const n = r.getEntries(), i = n[n.length - 1];
1778
+ (s) => {
1779
+ const n = s.getEntries(), i = n[n.length - 1];
1814
1780
  i && this.sendVital({ type: "LCP", value: Number(i.startTime.toFixed(2)) });
1815
1781
  },
1816
1782
  { type: "largest-contentful-paint", buffered: !0 },
@@ -1819,35 +1785,35 @@ class _t extends f {
1819
1785
  let e = 0, t = this.getNavigationId();
1820
1786
  this.safeObserve(
1821
1787
  "layout-shift",
1822
- (r) => {
1788
+ (s) => {
1823
1789
  const n = this.getNavigationId();
1824
1790
  n !== t && (e = 0, t = n);
1825
- const i = r.getEntries();
1791
+ const i = s.getEntries();
1826
1792
  for (const a of i) {
1827
1793
  if (a.hadRecentInput === !0)
1828
1794
  continue;
1829
- const c = typeof a.value == "number" ? a.value : 0;
1830
- e += c;
1795
+ const l = typeof a.value == "number" ? a.value : 0;
1796
+ e += l;
1831
1797
  }
1832
1798
  this.sendVital({ type: "CLS", value: Number(e.toFixed(2)) });
1833
1799
  },
1834
1800
  { type: "layout-shift", buffered: !0 }
1835
1801
  ), this.safeObserve(
1836
1802
  "paint",
1837
- (r) => {
1838
- for (const n of r.getEntries())
1803
+ (s) => {
1804
+ for (const n of s.getEntries())
1839
1805
  n.name === "first-contentful-paint" && this.sendVital({ type: "FCP", value: Number(n.startTime.toFixed(2)) });
1840
1806
  },
1841
1807
  { type: "paint", buffered: !0 },
1842
1808
  !0
1843
1809
  ), this.safeObserve(
1844
1810
  "event",
1845
- (r) => {
1811
+ (s) => {
1846
1812
  let n = 0;
1847
- const i = r.getEntries();
1813
+ const i = s.getEntries();
1848
1814
  for (const a of i) {
1849
- const c = (a.processingEnd ?? 0) - (a.startTime ?? 0);
1850
- n = Math.max(n, c);
1815
+ const l = (a.processingEnd ?? 0) - (a.startTime ?? 0);
1816
+ n = Math.max(n, l);
1851
1817
  }
1852
1818
  n > 0 && this.sendVital({ type: "INP", value: Number(n.toFixed(2)) });
1853
1819
  },
@@ -1856,11 +1822,11 @@ class _t extends f {
1856
1822
  }
1857
1823
  async initWebVitals() {
1858
1824
  try {
1859
- const { onLCP: e, onCLS: t, onFCP: r, onTTFB: n, onINP: i } = await Promise.resolve().then(() => Vt), a = (c) => (l) => {
1860
- const u = Number(l.value.toFixed(2));
1861
- this.sendVital({ type: c, value: u });
1825
+ const { onLCP: e, onCLS: t, onFCP: s, onTTFB: n, onINP: i } = await Promise.resolve().then(() => Vt), a = (l) => (c) => {
1826
+ const u = Number(c.value.toFixed(2));
1827
+ this.sendVital({ type: l, value: u });
1862
1828
  };
1863
- e(a("LCP")), t(a("CLS")), r(a("FCP")), n(a("TTFB")), i(a("INP"));
1829
+ e(a("LCP")), t(a("CLS")), s(a("FCP")), n(a("TTFB")), i(a("INP"));
1864
1830
  } catch (e) {
1865
1831
  o("warn", "Failed to load web-vitals library, using fallback", { error: e }), this.observeWebVitalsFallback();
1866
1832
  }
@@ -1881,9 +1847,9 @@ class _t extends f {
1881
1847
  "longtask",
1882
1848
  (e) => {
1883
1849
  const t = e.getEntries();
1884
- for (const r of t) {
1885
- const n = Number(r.duration.toFixed(2)), i = Date.now();
1886
- i - this.lastLongTaskSentAt >= $e && (this.shouldSendVital("LONG_TASK", n) && this.trackWebVital("LONG_TASK", n), this.lastLongTaskSentAt = i);
1850
+ for (const s of t) {
1851
+ const n = Number(s.duration.toFixed(2)), i = Date.now();
1852
+ i - this.lastLongTaskSentAt >= Be && (this.shouldSendVital("LONG_TASK", n) && this.trackWebVital("LONG_TASK", n), this.lastLongTaskSentAt = i);
1887
1853
  }
1888
1854
  },
1889
1855
  { type: "longtask", buffered: !0 }
@@ -1894,10 +1860,10 @@ class _t extends f {
1894
1860
  return;
1895
1861
  const t = this.getNavigationId();
1896
1862
  if (t) {
1897
- const r = this.reportedByNav.get(t);
1898
- if (r?.has(e.type))
1863
+ const s = this.reportedByNav.get(t);
1864
+ if (s?.has(e.type))
1899
1865
  return;
1900
- r ? r.add(e.type) : this.reportedByNav.set(t, /* @__PURE__ */ new Set([e.type]));
1866
+ s ? s.add(e.type) : this.reportedByNav.set(t, /* @__PURE__ */ new Set([e.type]));
1901
1867
  }
1902
1868
  this.trackWebVital(e.type, e.value);
1903
1869
  }
@@ -1919,8 +1885,8 @@ class _t extends f {
1919
1885
  const e = performance.getEntriesByType("navigation")[0];
1920
1886
  if (!e)
1921
1887
  return null;
1922
- const t = e.startTime || performance.now(), r = Math.random().toString(36).substr(2, 5);
1923
- return `${t.toFixed(2)}_${window.location.pathname}_${r}`;
1888
+ const t = e.startTime || performance.now(), s = Math.random().toString(36).substr(2, 5);
1889
+ return `${t.toFixed(2)}_${window.location.pathname}_${s}`;
1924
1890
  } catch (e) {
1925
1891
  return o("warn", "Failed to get navigation ID", { error: e }), null;
1926
1892
  }
@@ -1930,26 +1896,26 @@ class _t extends f {
1930
1896
  const t = PerformanceObserver.supportedEntryTypes;
1931
1897
  return !t || t.includes(e);
1932
1898
  }
1933
- safeObserve(e, t, r, n = !1) {
1899
+ safeObserve(e, t, s, n = !1) {
1934
1900
  try {
1935
1901
  if (!this.isObserverSupported(e))
1936
1902
  return !1;
1937
- const i = new PerformanceObserver((a, c) => {
1903
+ const i = new PerformanceObserver((a, l) => {
1938
1904
  try {
1939
- t(a, c);
1940
- } catch (l) {
1905
+ t(a, l);
1906
+ } catch (c) {
1941
1907
  o("warn", "Observer callback failed", {
1942
- error: l,
1908
+ error: c,
1943
1909
  data: { type: e }
1944
1910
  });
1945
1911
  }
1946
1912
  if (n)
1947
1913
  try {
1948
- c.disconnect();
1914
+ l.disconnect();
1949
1915
  } catch {
1950
1916
  }
1951
1917
  });
1952
- return i.observe(r ?? { type: e, buffered: !0 }), n || this.observers.push(i), !0;
1918
+ return i.observe(s ?? { type: e, buffered: !0 }), n || this.observers.push(i), !0;
1953
1919
  } catch (i) {
1954
1920
  return o("warn", "Failed to create performance observer", {
1955
1921
  error: i,
@@ -1960,8 +1926,8 @@ class _t extends f {
1960
1926
  shouldSendVital(e, t) {
1961
1927
  if (typeof t != "number" || !Number.isFinite(t))
1962
1928
  return o("warn", "Invalid web vital value", { data: { type: e, value: t } }), !1;
1963
- const r = this.vitalThresholds[e];
1964
- return !(typeof r == "number" && t <= r);
1929
+ const s = this.vitalThresholds[e];
1930
+ return !(typeof s == "number" && t <= s);
1965
1931
  }
1966
1932
  }
1967
1933
  class Tt extends f {
@@ -1984,10 +1950,10 @@ class Tt extends f {
1984
1950
  if (!this.shouldSample())
1985
1951
  return;
1986
1952
  const t = this.sanitize(e.message || "Unknown error");
1987
- this.shouldSuppressError(R.JS_ERROR, t) || this.eventManager.track({
1953
+ this.shouldSuppressError(C.JS_ERROR, t) || this.eventManager.track({
1988
1954
  type: d.ERROR,
1989
1955
  error_data: {
1990
- type: R.JS_ERROR,
1956
+ type: C.JS_ERROR,
1991
1957
  message: t,
1992
1958
  ...e.filename && { filename: e.filename },
1993
1959
  ...e.lineno && { line: e.lineno },
@@ -1998,12 +1964,12 @@ class Tt extends f {
1998
1964
  handleRejection = (e) => {
1999
1965
  if (!this.shouldSample())
2000
1966
  return;
2001
- const t = this.extractRejectionMessage(e.reason), r = this.sanitize(t);
2002
- this.shouldSuppressError(R.PROMISE_REJECTION, r) || this.eventManager.track({
1967
+ const t = this.extractRejectionMessage(e.reason), s = this.sanitize(t);
1968
+ this.shouldSuppressError(C.PROMISE_REJECTION, s) || this.eventManager.track({
2003
1969
  type: d.ERROR,
2004
1970
  error_data: {
2005
- type: R.PROMISE_REJECTION,
2006
- message: r
1971
+ type: C.PROMISE_REJECTION,
1972
+ message: s
2007
1973
  }
2008
1974
  });
2009
1975
  };
@@ -2022,15 +1988,15 @@ class Tt extends f {
2022
1988
  }
2023
1989
  sanitize(e) {
2024
1990
  let t = e.length > ue ? e.slice(0, ue) + "..." : e;
2025
- for (const r of ve) {
2026
- const n = new RegExp(r.source, r.flags);
1991
+ for (const s of ve) {
1992
+ const n = new RegExp(s.source, s.flags);
2027
1993
  t = t.replace(n, "[REDACTED]");
2028
1994
  }
2029
1995
  return t;
2030
1996
  }
2031
1997
  shouldSuppressError(e, t) {
2032
- const r = Date.now(), n = `${e}:${t}`, i = this.recentErrors.get(n);
2033
- return i && r - i < de ? (this.recentErrors.set(n, r), !0) : (this.recentErrors.set(n, r), this.recentErrors.size > Qe ? (this.recentErrors.clear(), this.recentErrors.set(n, r), !1) : (this.recentErrors.size > U && this.pruneOldErrors(), !1));
1998
+ const s = Date.now(), n = `${e}:${t}`, i = this.recentErrors.get(n);
1999
+ return i && s - i < de ? (this.recentErrors.set(n, s), !0) : (this.recentErrors.set(n, s), this.recentErrors.size > Qe ? (this.recentErrors.clear(), this.recentErrors.set(n, s), !1) : (this.recentErrors.size > U && this.pruneOldErrors(), !1));
2034
2000
  }
2035
2001
  pruneOldErrors() {
2036
2002
  const e = Date.now();
@@ -2038,8 +2004,8 @@ class Tt extends f {
2038
2004
  e - i > de && this.recentErrors.delete(n);
2039
2005
  if (this.recentErrors.size <= U)
2040
2006
  return;
2041
- const t = Array.from(this.recentErrors.entries()).sort((n, i) => n[1] - i[1]), r = this.recentErrors.size - U;
2042
- for (let n = 0; n < r; n += 1) {
2007
+ const t = Array.from(this.recentErrors.entries()).sort((n, i) => n[1] - i[1]), s = this.recentErrors.size - U;
2008
+ for (let n = 0; n < s; n += 1) {
2043
2009
  const i = t[n];
2044
2010
  i && this.recentErrors.delete(i[0]);
2045
2011
  }
@@ -2048,7 +2014,7 @@ class Tt extends f {
2048
2014
  class vt extends f {
2049
2015
  isInitialized = !1;
2050
2016
  suppressNextScrollTimer = null;
2051
- emitter = new ct();
2017
+ emitter = new lt();
2052
2018
  managers = {};
2053
2019
  handlers = {};
2054
2020
  integrations = {};
@@ -2059,22 +2025,22 @@ class vt extends f {
2059
2025
  if (!this.isInitialized) {
2060
2026
  this.managers.storage = new pt();
2061
2027
  try {
2062
- this.setupState(e), await this.setupIntegrations(), this.managers.event = new ut(this.managers.storage, this.integrations.googleAnalytics, this.emitter), await this.initializeHandlers(), await this.managers.event.recoverPersistedEvents().catch((t) => {
2028
+ this.setupState(e), await this.setupIntegrations(), this.managers.event = new ut(this.managers.storage, this.integrations.googleAnalytics, this.emitter), this.initializeHandlers(), await this.managers.event.recoverPersistedEvents().catch((t) => {
2063
2029
  o("warn", "Failed to recover persisted events", { error: t });
2064
2030
  }), this.isInitialized = !0;
2065
2031
  } catch (t) {
2066
- await this.destroy(!0);
2067
- const r = t instanceof Error ? t.message : String(t);
2068
- throw new Error(`[TraceLog] TraceLog initialization failed: ${r}`);
2032
+ this.destroy(!0);
2033
+ const s = t instanceof Error ? t.message : String(t);
2034
+ throw new Error(`[TraceLog] TraceLog initialization failed: ${s}`);
2069
2035
  }
2070
2036
  }
2071
2037
  }
2072
2038
  sendCustomEvent(e, t) {
2073
2039
  if (!this.managers.event)
2074
2040
  return;
2075
- const { valid: r, error: n, sanitizedMetadata: i } = ot(e, t);
2076
- if (!r) {
2077
- if (this.get("mode") === C.QA)
2041
+ const { valid: s, error: n, sanitizedMetadata: i } = ot(e, t);
2042
+ if (!s) {
2043
+ if (this.get("mode") === R.QA)
2078
2044
  throw new Error(`[TraceLog] Custom event "${e}" validation failed: ${n}`);
2079
2045
  return;
2080
2046
  }
@@ -2092,30 +2058,26 @@ class vt extends f {
2092
2058
  off(e, t) {
2093
2059
  this.emitter.off(e, t);
2094
2060
  }
2095
- async destroy(e = !1) {
2096
- if (!this.isInitialized && !e)
2097
- return;
2098
- this.integrations.googleAnalytics?.cleanup();
2099
- const t = Object.values(this.handlers).filter(Boolean).map(async (r) => {
2061
+ destroy(e = !1) {
2062
+ !this.isInitialized && !e || (this.integrations.googleAnalytics?.cleanup(), Object.values(this.handlers).filter(Boolean).forEach((t) => {
2100
2063
  try {
2101
- await r.stopTracking();
2102
- } catch (n) {
2103
- o("warn", "Failed to stop tracking", { error: n });
2064
+ t.stopTracking();
2065
+ } catch (s) {
2066
+ o("warn", "Failed to stop tracking", { error: s });
2104
2067
  }
2105
- });
2106
- await Promise.allSettled(t), this.suppressNextScrollTimer && (clearTimeout(this.suppressNextScrollTimer), this.suppressNextScrollTimer = null), this.managers.event?.flushImmediatelySync(), this.managers.event?.stop(), this.emitter.removeAllListeners(), this.set("hasStartSession", !1), this.set("suppressNextScroll", !1), this.set("sessionId", null), this.isInitialized = !1, this.handlers = {};
2068
+ }), this.suppressNextScrollTimer && (clearTimeout(this.suppressNextScrollTimer), this.suppressNextScrollTimer = null), this.managers.event?.flushImmediatelySync(), this.managers.event?.stop(), this.emitter.removeAllListeners(), this.set("hasStartSession", !1), this.set("suppressNextScroll", !1), this.set("sessionId", null), this.isInitialized = !1, this.handlers = {});
2107
2069
  }
2108
2070
  setupState(e = {}) {
2109
2071
  this.set("config", e);
2110
2072
  const t = dt.getId(this.managers.storage);
2111
2073
  this.set("userId", t);
2112
- const r = Ke(e);
2113
- this.set("collectApiUrl", r);
2114
- const n = xe();
2074
+ const s = qe(e);
2075
+ this.set("collectApiUrl", s);
2076
+ const n = Ve();
2115
2077
  this.set("device", n);
2116
2078
  const i = K(window.location.href, e.sensitiveQueryParams);
2117
2079
  this.set("pageUrl", i);
2118
- const a = Xe() ? C.QA : void 0;
2080
+ const a = We() ? R.QA : void 0;
2119
2081
  a && this.set("mode", a);
2120
2082
  }
2121
2083
  async setupIntegrations() {
@@ -2126,47 +2088,47 @@ class vt extends f {
2126
2088
  this.integrations.googleAnalytics = void 0;
2127
2089
  }
2128
2090
  }
2129
- async initializeHandlers() {
2091
+ initializeHandlers() {
2130
2092
  this.handlers.session = new ft(
2131
2093
  this.managers.storage,
2132
2094
  this.managers.event
2133
- ), await this.handlers.session.startTracking();
2095
+ ), this.handlers.session.startTracking();
2134
2096
  const e = () => {
2135
2097
  this.set("suppressNextScroll", !0), this.suppressNextScrollTimer && clearTimeout(this.suppressNextScrollTimer), this.suppressNextScrollTimer = window.setTimeout(() => {
2136
2098
  this.set("suppressNextScroll", !1);
2137
2099
  }, 250 * 2);
2138
2100
  };
2139
- this.handlers.pageView = new gt(this.managers.event, e), this.handlers.pageView.startTracking(), this.handlers.click = new St(this.managers.event), this.handlers.click.startTracking(), this.handlers.scroll = new Et(this.managers.event), this.handlers.scroll.startTracking(), this.handlers.performance = new _t(this.managers.event), this.handlers.performance.startTracking().catch((t) => {
2101
+ this.handlers.pageView = new gt(this.managers.event, e), this.handlers.pageView.startTracking(), this.handlers.click = new Et(this.managers.event), this.handlers.click.startTracking(), this.handlers.scroll = new St(this.managers.event), this.handlers.scroll.startTracking(), this.handlers.performance = new _t(this.managers.event), this.handlers.performance.startTracking().catch((t) => {
2140
2102
  o("warn", "Failed to start performance tracking", { error: t });
2141
2103
  }), this.handlers.error = new Tt(this.managers.event), this.handlers.error.startTracking();
2142
2104
  }
2143
2105
  }
2144
- const y = [];
2106
+ const I = [];
2145
2107
  let h = null, M = !1, H = !1;
2146
- const It = async (s) => {
2108
+ const It = async (r) => {
2147
2109
  if (typeof window > "u" || typeof document > "u")
2148
2110
  throw new Error("[TraceLog] This library can only be used in a browser environment");
2149
2111
  if (!window.__traceLogDisabled && !h && !M) {
2150
2112
  M = !0;
2151
2113
  try {
2152
- const e = rt(s ?? {}), t = new vt();
2114
+ const e = st(r ?? {}), t = new vt();
2153
2115
  try {
2154
- y.forEach(({ event: i, callback: a }) => {
2116
+ I.forEach(({ event: i, callback: a }) => {
2155
2117
  t.on(i, a);
2156
- }), y.length = 0;
2157
- const r = t.init(e), n = new Promise((i, a) => {
2118
+ }), I.length = 0;
2119
+ const s = t.init(e), n = new Promise((i, a) => {
2158
2120
  setTimeout(() => {
2159
2121
  a(new Error("[TraceLog] Initialization timeout after 10000ms"));
2160
2122
  }, 1e4);
2161
2123
  });
2162
- await Promise.race([r, n]), h = t;
2163
- } catch (r) {
2124
+ await Promise.race([s, n]), h = t;
2125
+ } catch (s) {
2164
2126
  try {
2165
- await t.destroy(!0);
2127
+ t.destroy(!0);
2166
2128
  } catch (n) {
2167
2129
  o("error", "Failed to cleanup partially initialized app", { error: n });
2168
2130
  }
2169
- throw r;
2131
+ throw s;
2170
2132
  }
2171
2133
  } catch (e) {
2172
2134
  throw h = null, e;
@@ -2174,45 +2136,45 @@ const It = async (s) => {
2174
2136
  M = !1;
2175
2137
  }
2176
2138
  }
2177
- }, yt = (s, e) => {
2139
+ }, At = (r, e) => {
2178
2140
  if (!h)
2179
2141
  throw new Error("[TraceLog] TraceLog not initialized. Please call init() first.");
2180
2142
  if (H)
2181
2143
  throw new Error("[TraceLog] Cannot send events while TraceLog is being destroyed");
2182
- h.sendCustomEvent(s, e);
2183
- }, At = (s, e) => {
2144
+ h.sendCustomEvent(r, e);
2145
+ }, yt = (r, e) => {
2184
2146
  if (!h || M) {
2185
- y.push({ event: s, callback: e });
2147
+ I.push({ event: r, callback: e });
2186
2148
  return;
2187
2149
  }
2188
- h.on(s, e);
2189
- }, wt = (s, e) => {
2150
+ h.on(r, e);
2151
+ }, wt = (r, e) => {
2190
2152
  if (!h) {
2191
- const t = y.findIndex((r) => r.event === s && r.callback === e);
2192
- t !== -1 && y.splice(t, 1);
2153
+ const t = I.findIndex((s) => s.event === r && s.callback === e);
2154
+ t !== -1 && I.splice(t, 1);
2193
2155
  return;
2194
2156
  }
2195
- h.off(s, e);
2196
- }, Mt = () => h !== null, Lt = async () => {
2197
- if (!h)
2198
- throw new Error("[TraceLog] App not initialized");
2157
+ h.off(r, e);
2158
+ }, Mt = () => h !== null, Nt = () => {
2199
2159
  if (H)
2200
2160
  throw new Error("[TraceLog] Destroy operation already in progress");
2161
+ if (!h)
2162
+ throw new Error("[TraceLog] App not initialized");
2201
2163
  H = !0;
2202
2164
  try {
2203
- await h.destroy(), h = null, M = !1, y.length = 0;
2204
- } catch (s) {
2205
- h = null, M = !1, y.length = 0, o("warn", "Error during destroy, forced cleanup completed", { error: s });
2165
+ h.destroy(), h = null, M = !1, I.length = 0;
2166
+ } catch (r) {
2167
+ h = null, M = !1, I.length = 0, o("warn", "Error during destroy, forced cleanup completed", { error: r });
2206
2168
  } finally {
2207
2169
  H = !1;
2208
2170
  }
2209
- }, Gt = {
2171
+ }, tr = {
2210
2172
  WEB_VITALS_THRESHOLDS: Te
2211
2173
  // Business thresholds for performance analysis
2212
- }, zt = {
2174
+ }, rr = {
2213
2175
  PII_PATTERNS: ve
2214
2176
  // Patterns for sensitive data protection
2215
- }, $t = {
2177
+ }, sr = {
2216
2178
  LOW_ACTIVITY_EVENT_COUNT: 50,
2217
2179
  HIGH_ACTIVITY_EVENT_COUNT: 1e3,
2218
2180
  MIN_EVENTS_FOR_DYNAMIC_CALCULATION: 100,
@@ -2222,7 +2184,7 @@ const It = async (s) => {
2222
2184
  MIN_ENGAGED_SESSION_DURATION_MS: 30 * 1e3,
2223
2185
  MIN_SCROLL_DEPTH_ENGAGEMENT: 25
2224
2186
  // 25% scroll depth for engagement
2225
- }, Qt = {
2187
+ }, nr = {
2226
2188
  INACTIVITY_TIMEOUT_MS: 30 * 60 * 1e3,
2227
2189
  // 30min for analytics (vs 15min client)
2228
2190
  SHORT_SESSION_THRESHOLD_MS: 30 * 1e3,
@@ -2230,20 +2192,20 @@ const It = async (s) => {
2230
2192
  LONG_SESSION_THRESHOLD_MS: 30 * 60 * 1e3,
2231
2193
  MAX_REALISTIC_SESSION_DURATION_MS: 8 * 60 * 60 * 1e3
2232
2194
  // Filter outliers
2233
- }, Bt = {
2195
+ }, ir = {
2234
2196
  MOBILE_MAX_WIDTH: 768,
2235
2197
  TABLET_MAX_WIDTH: 1024,
2236
2198
  MOBILE_PERFORMANCE_FACTOR: 1.5,
2237
2199
  // Mobile typically 1.5x slower
2238
2200
  TABLET_PERFORMANCE_FACTOR: 1.2
2239
- }, jt = {
2201
+ }, ar = {
2240
2202
  MIN_TEXT_LENGTH_FOR_ANALYSIS: 10,
2241
2203
  MIN_CLICKS_FOR_HOT_ELEMENT: 10,
2242
2204
  // Popular element threshold
2243
2205
  MIN_SCROLL_COMPLETION_PERCENT: 80,
2244
2206
  // Page consumption threshold
2245
2207
  MIN_TIME_ON_PAGE_FOR_READ_MS: 15 * 1e3
2246
- }, Xt = {
2208
+ }, or = {
2247
2209
  SIGNIFICANT_CHANGE_PERCENT: 20,
2248
2210
  MAJOR_CHANGE_PERCENT: 50,
2249
2211
  MIN_EVENTS_FOR_INSIGHT: 100,
@@ -2253,19 +2215,19 @@ const It = async (s) => {
2253
2215
  LOW_ERROR_RATE_PERCENT: 1,
2254
2216
  HIGH_ERROR_RATE_PERCENT: 5,
2255
2217
  CRITICAL_ERROR_RATE_PERCENT: 10
2256
- }, Wt = {
2218
+ }, lr = {
2257
2219
  SHORT_TERM_TREND_HOURS: 24,
2258
2220
  MEDIUM_TERM_TREND_DAYS: 7,
2259
2221
  LONG_TERM_TREND_DAYS: 30,
2260
2222
  MIN_DATA_POINTS_FOR_TREND: 5,
2261
2223
  WEEKLY_PATTERN_MIN_WEEKS: 4,
2262
2224
  DAILY_PATTERN_MIN_DAYS: 14
2263
- }, Yt = {
2225
+ }, cr = {
2264
2226
  MIN_SEGMENT_SIZE: 10,
2265
2227
  MIN_COHORT_SIZE: 5,
2266
2228
  COHORT_ANALYSIS_DAYS: [1, 3, 7, 14, 30],
2267
2229
  MIN_FUNNEL_EVENTS: 20
2268
- }, Kt = {
2230
+ }, ur = {
2269
2231
  DEFAULT_EVENTS_LIMIT: 5,
2270
2232
  DEFAULT_SESSIONS_LIMIT: 5,
2271
2233
  DEFAULT_PAGES_LIMIT: 5,
@@ -2273,143 +2235,143 @@ const It = async (s) => {
2273
2235
  MAX_TIME_RANGE_DAYS: 365,
2274
2236
  ANALYTICS_BATCH_SIZE: 1e3
2275
2237
  // For historical analysis
2276
- }, qt = {
2238
+ }, dr = {
2277
2239
  ANOMALY_THRESHOLD_SIGMA: 2.5,
2278
2240
  STRONG_ANOMALY_THRESHOLD_SIGMA: 3,
2279
2241
  TRAFFIC_DROP_ALERT_PERCENT: -30,
2280
2242
  TRAFFIC_SPIKE_ALERT_PERCENT: 200,
2281
2243
  MIN_BASELINE_DAYS: 7,
2282
2244
  MIN_EVENTS_FOR_ANOMALY_DETECTION: 50
2283
- }, Zt = {
2245
+ }, hr = {
2284
2246
  PAGE_URL_EXCLUDED: "excluded",
2285
2247
  PAGE_URL_UNKNOWN: "unknown"
2286
- }, Jt = {
2248
+ }, fr = {
2287
2249
  init: It,
2288
- event: yt,
2289
- on: At,
2250
+ event: At,
2251
+ on: yt,
2290
2252
  off: wt,
2291
2253
  isInitialized: Mt,
2292
- destroy: Lt
2254
+ destroy: Nt
2293
2255
  };
2294
- var Z, Ie = -1, L = function(s) {
2256
+ var Z, Ae = -1, N = function(r) {
2295
2257
  addEventListener("pageshow", function(e) {
2296
- e.persisted && (Ie = e.timeStamp, s(e));
2258
+ e.persisted && (Ae = e.timeStamp, r(e));
2297
2259
  }, !0);
2298
2260
  }, ne = function() {
2299
- var s = self.performance && performance.getEntriesByType && performance.getEntriesByType("navigation")[0];
2300
- if (s && s.responseStart > 0 && s.responseStart < performance.now()) return s;
2261
+ var r = self.performance && performance.getEntriesByType && performance.getEntriesByType("navigation")[0];
2262
+ if (r && r.responseStart > 0 && r.responseStart < performance.now()) return r;
2301
2263
  }, F = function() {
2302
- var s = ne();
2303
- return s && s.activationStart || 0;
2304
- }, S = function(s, e) {
2305
- var t = ne(), r = "navigate";
2306
- return Ie >= 0 ? r = "back-forward-cache" : t && (document.prerendering || F() > 0 ? r = "prerender" : document.wasDiscarded ? r = "restore" : t.type && (r = t.type.replace(/_/g, "-"))), { name: s, value: e === void 0 ? -1 : e, rating: "good", delta: 0, entries: [], id: "v4-".concat(Date.now(), "-").concat(Math.floor(8999999999999 * Math.random()) + 1e12), navigationType: r };
2307
- }, O = function(s, e, t) {
2264
+ var r = ne();
2265
+ return r && r.activationStart || 0;
2266
+ }, E = function(r, e) {
2267
+ var t = ne(), s = "navigate";
2268
+ return Ae >= 0 ? s = "back-forward-cache" : t && (document.prerendering || F() > 0 ? s = "prerender" : document.wasDiscarded ? s = "restore" : t.type && (s = t.type.replace(/_/g, "-"))), { name: r, value: e === void 0 ? -1 : e, rating: "good", delta: 0, entries: [], id: "v4-".concat(Date.now(), "-").concat(Math.floor(8999999999999 * Math.random()) + 1e12), navigationType: s };
2269
+ }, O = function(r, e, t) {
2308
2270
  try {
2309
- if (PerformanceObserver.supportedEntryTypes.includes(s)) {
2310
- var r = new PerformanceObserver(function(n) {
2271
+ if (PerformanceObserver.supportedEntryTypes.includes(r)) {
2272
+ var s = new PerformanceObserver(function(n) {
2311
2273
  Promise.resolve().then(function() {
2312
2274
  e(n.getEntries());
2313
2275
  });
2314
2276
  });
2315
- return r.observe(Object.assign({ type: s, buffered: !0 }, t || {})), r;
2277
+ return s.observe(Object.assign({ type: r, buffered: !0 }, t || {})), s;
2316
2278
  }
2317
2279
  } catch {
2318
2280
  }
2319
- }, E = function(s, e, t, r) {
2281
+ }, S = function(r, e, t, s) {
2320
2282
  var n, i;
2321
2283
  return function(a) {
2322
- e.value >= 0 && (a || r) && ((i = e.value - (n || 0)) || n === void 0) && (n = e.value, e.delta = i, e.rating = function(c, l) {
2323
- return c > l[1] ? "poor" : c > l[0] ? "needs-improvement" : "good";
2324
- }(e.value, t), s(e));
2284
+ e.value >= 0 && (a || s) && ((i = e.value - (n || 0)) || n === void 0) && (n = e.value, e.delta = i, e.rating = function(l, c) {
2285
+ return l > c[1] ? "poor" : l > c[0] ? "needs-improvement" : "good";
2286
+ }(e.value, t), r(e));
2325
2287
  };
2326
- }, ie = function(s) {
2288
+ }, ie = function(r) {
2327
2289
  requestAnimationFrame(function() {
2328
2290
  return requestAnimationFrame(function() {
2329
- return s();
2291
+ return r();
2330
2292
  });
2331
2293
  });
2332
- }, G = function(s) {
2294
+ }, G = function(r) {
2333
2295
  document.addEventListener("visibilitychange", function() {
2334
- document.visibilityState === "hidden" && s();
2296
+ document.visibilityState === "hidden" && r();
2335
2297
  });
2336
- }, ae = function(s) {
2298
+ }, ae = function(r) {
2337
2299
  var e = !1;
2338
2300
  return function() {
2339
- e || (s(), e = !0);
2301
+ e || (r(), e = !0);
2340
2302
  };
2341
2303
  }, w = -1, me = function() {
2342
2304
  return document.visibilityState !== "hidden" || document.prerendering ? 1 / 0 : 0;
2343
- }, V = function(s) {
2344
- document.visibilityState === "hidden" && w > -1 && (w = s.type === "visibilitychange" ? s.timeStamp : 0, Nt());
2305
+ }, V = function(r) {
2306
+ document.visibilityState === "hidden" && w > -1 && (w = r.type === "visibilitychange" ? r.timeStamp : 0, Lt());
2345
2307
  }, pe = function() {
2346
2308
  addEventListener("visibilitychange", V, !0), addEventListener("prerenderingchange", V, !0);
2347
- }, Nt = function() {
2309
+ }, Lt = function() {
2348
2310
  removeEventListener("visibilitychange", V, !0), removeEventListener("prerenderingchange", V, !0);
2349
2311
  }, ye = function() {
2350
- return w < 0 && (w = me(), pe(), L(function() {
2312
+ return w < 0 && (w = me(), pe(), N(function() {
2351
2313
  setTimeout(function() {
2352
2314
  w = me(), pe();
2353
2315
  }, 0);
2354
2316
  })), { get firstHiddenTime() {
2355
2317
  return w;
2356
2318
  } };
2357
- }, z = function(s) {
2319
+ }, $ = function(r) {
2358
2320
  document.prerendering ? addEventListener("prerenderingchange", function() {
2359
- return s();
2360
- }, !0) : s();
2361
- }, J = [1800, 3e3], Ae = function(s, e) {
2362
- e = e || {}, z(function() {
2363
- var t, r = ye(), n = S("FCP"), i = O("paint", function(a) {
2364
- a.forEach(function(c) {
2365
- c.name === "first-contentful-paint" && (i.disconnect(), c.startTime < r.firstHiddenTime && (n.value = Math.max(c.startTime - F(), 0), n.entries.push(c), t(!0)));
2321
+ return r();
2322
+ }, !0) : r();
2323
+ }, J = [1800, 3e3], we = function(r, e) {
2324
+ e = e || {}, $(function() {
2325
+ var t, s = ye(), n = E("FCP"), i = O("paint", function(a) {
2326
+ a.forEach(function(l) {
2327
+ l.name === "first-contentful-paint" && (i.disconnect(), l.startTime < s.firstHiddenTime && (n.value = Math.max(l.startTime - F(), 0), n.entries.push(l), t(!0)));
2366
2328
  });
2367
2329
  });
2368
- i && (t = E(s, n, J, e.reportAllChanges), L(function(a) {
2369
- n = S("FCP"), t = E(s, n, J, e.reportAllChanges), ie(function() {
2330
+ i && (t = S(r, n, J, e.reportAllChanges), N(function(a) {
2331
+ n = E("FCP"), t = S(r, n, J, e.reportAllChanges), ie(function() {
2370
2332
  n.value = performance.now() - a.timeStamp, t(!0);
2371
2333
  });
2372
2334
  }));
2373
2335
  });
2374
- }, ee = [0.1, 0.25], Rt = function(s, e) {
2375
- e = e || {}, Ae(ae(function() {
2376
- var t, r = S("CLS", 0), n = 0, i = [], a = function(l) {
2377
- l.forEach(function(u) {
2336
+ }, ee = [0.1, 0.25], Ct = function(r, e) {
2337
+ e = e || {}, we(ae(function() {
2338
+ var t, s = E("CLS", 0), n = 0, i = [], a = function(c) {
2339
+ c.forEach(function(u) {
2378
2340
  if (!u.hadRecentInput) {
2379
- var p = i[0], N = i[i.length - 1];
2380
- n && u.startTime - N.startTime < 1e3 && u.startTime - p.startTime < 5e3 ? (n += u.value, i.push(u)) : (n = u.value, i = [u]);
2341
+ var p = i[0], L = i[i.length - 1];
2342
+ n && u.startTime - L.startTime < 1e3 && u.startTime - p.startTime < 5e3 ? (n += u.value, i.push(u)) : (n = u.value, i = [u]);
2381
2343
  }
2382
- }), n > r.value && (r.value = n, r.entries = i, t());
2383
- }, c = O("layout-shift", a);
2384
- c && (t = E(s, r, ee, e.reportAllChanges), G(function() {
2385
- a(c.takeRecords()), t(!0);
2386
- }), L(function() {
2387
- n = 0, r = S("CLS", 0), t = E(s, r, ee, e.reportAllChanges), ie(function() {
2344
+ }), n > s.value && (s.value = n, s.entries = i, t());
2345
+ }, l = O("layout-shift", a);
2346
+ l && (t = S(r, s, ee, e.reportAllChanges), G(function() {
2347
+ a(l.takeRecords()), t(!0);
2348
+ }), N(function() {
2349
+ n = 0, s = E("CLS", 0), t = S(r, s, ee, e.reportAllChanges), ie(function() {
2388
2350
  return t();
2389
2351
  });
2390
2352
  }), setTimeout(t, 0));
2391
2353
  }));
2392
- }, we = 0, B = 1 / 0, D = 0, Ct = function(s) {
2393
- s.forEach(function(e) {
2394
- e.interactionId && (B = Math.min(B, e.interactionId), D = Math.max(D, e.interactionId), we = D ? (D - B) / 7 + 1 : 0);
2354
+ }, Me = 0, Q = 1 / 0, D = 0, Rt = function(r) {
2355
+ r.forEach(function(e) {
2356
+ e.interactionId && (Q = Math.min(Q, e.interactionId), D = Math.max(D, e.interactionId), Me = D ? (D - Q) / 7 + 1 : 0);
2395
2357
  });
2396
- }, Me = function() {
2397
- return Z ? we : performance.interactionCount || 0;
2358
+ }, Ne = function() {
2359
+ return Z ? Me : performance.interactionCount || 0;
2398
2360
  }, bt = function() {
2399
- "interactionCount" in performance || Z || (Z = O("event", Ct, { type: "event", buffered: !0, durationThreshold: 0 }));
2361
+ "interactionCount" in performance || Z || (Z = O("event", Rt, { type: "event", buffered: !0, durationThreshold: 0 }));
2400
2362
  }, g = [], x = /* @__PURE__ */ new Map(), Le = 0, Ot = function() {
2401
- var s = Math.min(g.length - 1, Math.floor((Me() - Le) / 50));
2402
- return g[s];
2403
- }, Pt = [], Dt = function(s) {
2363
+ var r = Math.min(g.length - 1, Math.floor((Ne() - Le) / 50));
2364
+ return g[r];
2365
+ }, Pt = [], Dt = function(r) {
2404
2366
  if (Pt.forEach(function(n) {
2405
- return n(s);
2406
- }), s.interactionId || s.entryType === "first-input") {
2407
- var e = g[g.length - 1], t = x.get(s.interactionId);
2408
- if (t || g.length < 10 || s.duration > e.latency) {
2409
- if (t) s.duration > t.latency ? (t.entries = [s], t.latency = s.duration) : s.duration === t.latency && s.startTime === t.entries[0].startTime && t.entries.push(s);
2367
+ return n(r);
2368
+ }), r.interactionId || r.entryType === "first-input") {
2369
+ var e = g[g.length - 1], t = x.get(r.interactionId);
2370
+ if (t || g.length < 10 || r.duration > e.latency) {
2371
+ if (t) r.duration > t.latency ? (t.entries = [r], t.latency = r.duration) : r.duration === t.latency && r.startTime === t.entries[0].startTime && t.entries.push(r);
2410
2372
  else {
2411
- var r = { id: s.interactionId, latency: s.duration, entries: [s] };
2412
- x.set(r.id, r), g.push(r);
2373
+ var s = { id: r.interactionId, latency: r.duration, entries: [r] };
2374
+ x.set(s.id, s), g.push(s);
2413
2375
  }
2414
2376
  g.sort(function(n, i) {
2415
2377
  return i.latency - n.latency;
@@ -2418,62 +2380,62 @@ var Z, Ie = -1, L = function(s) {
2418
2380
  });
2419
2381
  }
2420
2382
  }
2421
- }, Ne = function(s) {
2383
+ }, Ce = function(r) {
2422
2384
  var e = self.requestIdleCallback || self.setTimeout, t = -1;
2423
- return s = ae(s), document.visibilityState === "hidden" ? s() : (t = e(s), G(s)), t;
2424
- }, te = [200, 500], kt = function(s, e) {
2425
- "PerformanceEventTiming" in self && "interactionId" in PerformanceEventTiming.prototype && (e = e || {}, z(function() {
2385
+ return r = ae(r), document.visibilityState === "hidden" ? r() : (t = e(r), G(r)), t;
2386
+ }, te = [200, 500], kt = function(r, e) {
2387
+ "PerformanceEventTiming" in self && "interactionId" in PerformanceEventTiming.prototype && (e = e || {}, $(function() {
2426
2388
  var t;
2427
2389
  bt();
2428
- var r, n = S("INP"), i = function(c) {
2429
- Ne(function() {
2430
- c.forEach(Dt);
2431
- var l = Ot();
2432
- l && l.latency !== n.value && (n.value = l.latency, n.entries = l.entries, r());
2390
+ var s, n = E("INP"), i = function(l) {
2391
+ Ce(function() {
2392
+ l.forEach(Dt);
2393
+ var c = Ot();
2394
+ c && c.latency !== n.value && (n.value = c.latency, n.entries = c.entries, s());
2433
2395
  });
2434
2396
  }, a = O("event", i, { durationThreshold: (t = e.durationThreshold) !== null && t !== void 0 ? t : 40 });
2435
- r = E(s, n, te, e.reportAllChanges), a && (a.observe({ type: "first-input", buffered: !0 }), G(function() {
2436
- i(a.takeRecords()), r(!0);
2437
- }), L(function() {
2438
- Le = Me(), g.length = 0, x.clear(), n = S("INP"), r = E(s, n, te, e.reportAllChanges);
2397
+ s = S(r, n, te, e.reportAllChanges), a && (a.observe({ type: "first-input", buffered: !0 }), G(function() {
2398
+ i(a.takeRecords()), s(!0);
2399
+ }), N(function() {
2400
+ Le = Ne(), g.length = 0, x.clear(), n = E("INP"), s = S(r, n, te, e.reportAllChanges);
2439
2401
  }));
2440
2402
  }));
2441
- }, re = [2500, 4e3], j = {}, Ut = function(s, e) {
2442
- e = e || {}, z(function() {
2443
- var t, r = ye(), n = S("LCP"), i = function(l) {
2444
- e.reportAllChanges || (l = l.slice(-1)), l.forEach(function(u) {
2445
- u.startTime < r.firstHiddenTime && (n.value = Math.max(u.startTime - F(), 0), n.entries = [u], t());
2403
+ }, re = [2500, 4e3], X = {}, Ut = function(r, e) {
2404
+ e = e || {}, $(function() {
2405
+ var t, s = ye(), n = E("LCP"), i = function(c) {
2406
+ e.reportAllChanges || (c = c.slice(-1)), c.forEach(function(u) {
2407
+ u.startTime < s.firstHiddenTime && (n.value = Math.max(u.startTime - F(), 0), n.entries = [u], t());
2446
2408
  });
2447
2409
  }, a = O("largest-contentful-paint", i);
2448
2410
  if (a) {
2449
- t = E(s, n, re, e.reportAllChanges);
2450
- var c = ae(function() {
2451
- j[n.id] || (i(a.takeRecords()), a.disconnect(), j[n.id] = !0, t(!0));
2411
+ t = S(r, n, re, e.reportAllChanges);
2412
+ var l = ae(function() {
2413
+ X[n.id] || (i(a.takeRecords()), a.disconnect(), X[n.id] = !0, t(!0));
2452
2414
  });
2453
- ["keydown", "click"].forEach(function(l) {
2454
- addEventListener(l, function() {
2455
- return Ne(c);
2415
+ ["keydown", "click"].forEach(function(c) {
2416
+ addEventListener(c, function() {
2417
+ return Ce(l);
2456
2418
  }, { once: !0, capture: !0 });
2457
- }), G(c), L(function(l) {
2458
- n = S("LCP"), t = E(s, n, re, e.reportAllChanges), ie(function() {
2459
- n.value = performance.now() - l.timeStamp, j[n.id] = !0, t(!0);
2419
+ }), G(l), N(function(c) {
2420
+ n = E("LCP"), t = S(r, n, re, e.reportAllChanges), ie(function() {
2421
+ n.value = performance.now() - c.timeStamp, X[n.id] = !0, t(!0);
2460
2422
  });
2461
2423
  });
2462
2424
  }
2463
2425
  });
2464
- }, se = [800, 1800], Ht = function s(e) {
2465
- document.prerendering ? z(function() {
2466
- return s(e);
2426
+ }, se = [800, 1800], Ht = function r(e) {
2427
+ document.prerendering ? $(function() {
2428
+ return r(e);
2467
2429
  }) : document.readyState !== "complete" ? addEventListener("load", function() {
2468
- return s(e);
2430
+ return r(e);
2469
2431
  }, !0) : setTimeout(e, 0);
2470
- }, xt = function(s, e) {
2432
+ }, xt = function(r, e) {
2471
2433
  e = e || {};
2472
- var t = S("TTFB"), r = E(s, t, se, e.reportAllChanges);
2434
+ var t = E("TTFB"), s = S(r, t, se, e.reportAllChanges);
2473
2435
  Ht(function() {
2474
2436
  var n = ne();
2475
- n && (t.value = Math.max(n.responseStart - F(), 0), t.entries = [n], r(!0), L(function() {
2476
- t = S("TTFB", 0), (r = E(s, t, se, e.reportAllChanges))(!0);
2437
+ n && (t.value = Math.max(n.responseStart - F(), 0), t.entries = [n], s(!0), N(function() {
2438
+ t = E("TTFB", 0), (s = S(r, t, se, e.reportAllChanges))(!0);
2477
2439
  }));
2478
2440
  });
2479
2441
  };
@@ -2484,38 +2446,52 @@ const Vt = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
2484
2446
  INPThresholds: te,
2485
2447
  LCPThresholds: re,
2486
2448
  TTFBThresholds: se,
2487
- onCLS: Rt,
2488
- onFCP: Ae,
2449
+ onCLS: Ct,
2450
+ onFCP: we,
2489
2451
  onINP: kt,
2490
2452
  onLCP: Ut,
2491
2453
  onTTFB: xt
2492
2454
  }, Symbol.toStringTag, { value: "Module" }));
2493
2455
  export {
2494
- Kt as ANALYTICS_QUERY_LIMITS,
2495
- qt as ANOMALY_DETECTION,
2496
- A as AppConfigValidationError,
2497
- jt as CONTENT_ANALYTICS,
2498
- zt as DATA_PROTECTION,
2499
- Bt as DEVICE_ANALYTICS,
2456
+ ur as ANALYTICS_QUERY_LIMITS,
2457
+ dr as ANOMALY_DETECTION,
2458
+ y as AppConfigValidationError,
2459
+ ar as CONTENT_ANALYTICS,
2460
+ rr as DATA_PROTECTION,
2461
+ ir as DEVICE_ANALYTICS,
2500
2462
  _ as DeviceType,
2501
- $t as ENGAGEMENT_THRESHOLDS,
2463
+ sr as ENGAGEMENT_THRESHOLDS,
2502
2464
  W as EmitterEvent,
2503
- R as ErrorType,
2465
+ C as ErrorType,
2504
2466
  d as EventType,
2505
- Xt as INSIGHT_THRESHOLDS,
2506
- Ft as InitializationTimeoutError,
2467
+ or as INSIGHT_THRESHOLDS,
2468
+ er as InitializationTimeoutError,
2507
2469
  v as IntegrationValidationError,
2508
- C as Mode,
2509
- Gt as PERFORMANCE_CONFIG,
2510
- I as PermanentError,
2511
- Yt as SEGMENTATION_ANALYTICS,
2512
- Qt as SESSION_ANALYTICS,
2513
- Zt as SPECIAL_PAGE_URLS,
2514
- ce as SamplingRateValidationError,
2470
+ Jt as MAX_ARRAY_LENGTH,
2471
+ zt as MAX_CUSTOM_EVENT_ARRAY_SIZE,
2472
+ jt as MAX_CUSTOM_EVENT_ARRAY_SIZE_BACKEND,
2473
+ Yt as MAX_CUSTOM_EVENT_JSON_SIZE_BACKEND,
2474
+ $t as MAX_CUSTOM_EVENT_KEYS,
2475
+ Xt as MAX_CUSTOM_EVENT_KEYS_BACKEND,
2476
+ Ft as MAX_CUSTOM_EVENT_NAME_LENGTH,
2477
+ Gt as MAX_CUSTOM_EVENT_STRING_SIZE,
2478
+ Qt as MAX_METADATA_NESTING_DEPTH,
2479
+ Kt as MAX_METADATA_NESTING_DEPTH_BACKEND,
2480
+ Bt as MAX_NESTED_OBJECT_KEYS,
2481
+ qt as MAX_STRING_LENGTH,
2482
+ Wt as MAX_STRING_LENGTH_BACKEND,
2483
+ Zt as MAX_STRING_LENGTH_IN_ARRAY,
2484
+ R as Mode,
2485
+ tr as PERFORMANCE_CONFIG,
2486
+ A as PermanentError,
2487
+ cr as SEGMENTATION_ANALYTICS,
2488
+ nr as SESSION_ANALYTICS,
2489
+ hr as SPECIAL_PAGE_URLS,
2490
+ le as SamplingRateValidationError,
2515
2491
  k as ScrollDirection,
2516
- De as SessionTimeoutValidationError,
2517
- X as SpecialApiUrl,
2518
- Wt as TEMPORAL_ANALYSIS,
2492
+ ke as SessionTimeoutValidationError,
2493
+ j as SpecialApiUrl,
2494
+ lr as TEMPORAL_ANALYSIS,
2519
2495
  b as TraceLogValidationError,
2520
- Jt as tracelog
2496
+ fr as tracelog
2521
2497
  };