@incodetech/core 2.4.1-agentic.11 → 2.4.1-agentic.12

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 (216) hide show
  1. package/dist/{CameraCompositor-ppyMYVoY.esm.js → CameraCompositor-C7N1N61V.esm.js} +55 -1
  2. package/dist/{FaceDetectionProvider-2NzWDbV8.esm.js → FaceDetectionProvider-WtuJ6QBK.esm.js} +16 -11
  3. package/dist/{IWasmUtilCapability-BRn0wz8v.d.ts → IWasmUtilCapability-XcOtT1TP.d.ts} +5 -4
  4. package/dist/{MultipartRecordingProvider-CduV32Qa.esm.js → MultipartRecordingProvider-BtMQZEbg.esm.js} +1 -1
  5. package/dist/{StreamCanvasCapture-ixfy84ys.d.ts → StreamCanvasCapture-BnBfA6fb.d.ts} +24 -2
  6. package/dist/{StreamCanvasCapture-C9jtgBdT.esm.js → StreamCanvasCapture-CXd87trH.esm.js} +18 -3
  7. package/dist/{WasmUtilProvider-DdhAHHw4.esm.js → WasmUtilProvider-D5RMElzw.esm.js} +7 -0
  8. package/dist/{WorkerEncoderRecordingProvider-CsDED9UU.esm.js → WorkerEncoderRecordingProvider-BO7urYwT.esm.js} +1 -1
  9. package/dist/{addressSearch-Rxm1K67A.esm.js → addressSearch-BzAy6lhp.esm.js} +2 -4
  10. package/dist/ae-signature.esm.js +1 -1
  11. package/dist/antifraud.esm.js +2 -2
  12. package/dist/{antifraudManager-DKNOi9-z.esm.js → antifraudManager-Bw5nw5fh.esm.js} +3 -3
  13. package/dist/{antifraudStateMachine-BJ6PmCsw.esm.js → antifraudStateMachine-kOfsaAuT.esm.js} +2 -4
  14. package/dist/{api-CZpuJuZl.esm.js → api-DSZSaaWr.esm.js} +2 -0
  15. package/dist/{apiError-BamZ815u.esm.js → apiError-BDuL1wTs.esm.js} +1 -1
  16. package/dist/{attemptCarry-BecGGZK8.esm.js → attemptCarry-QFQkA3na.esm.js} +1 -1
  17. package/dist/authentication.d.ts +3 -3
  18. package/dist/authentication.esm.js +2 -2
  19. package/dist/{authenticationManager-yBVGiIf_.esm.js → authenticationManager-B0SioAdd.esm.js} +6 -6
  20. package/dist/{authenticationManager-DRaugLgH.d.ts → authenticationManager-eYcurNiS.d.ts} +1 -1
  21. package/dist/{authenticationStateMachine-DPqTOJPp.esm.js → authenticationStateMachine-n1OrhPTv.esm.js} +3 -3
  22. package/dist/{backCameraStream-DS1oDiUq.esm.js → backCameraStream-6qVHvj76.esm.js} +2 -2
  23. package/dist/{browser-pQZA35G2-DxIBykpe.esm.js → browser-pQZA35G2-CG3C-xGt.esm.js} +1 -1
  24. package/dist/calendarDate-DcqGuEht.esm.js +35 -0
  25. package/dist/camera-9yYDUOsO.d.ts +5 -0
  26. package/dist/{camera-E_Kcre4O.esm.js → camera-CJKApt0x.esm.js} +10 -3
  27. package/dist/camera.d.ts +2 -2
  28. package/dist/camera.esm.js +1 -1
  29. package/dist/certificate-issuance.esm.js +2 -2
  30. package/dist/{certificateIssuanceManager-Dxl9UwR0.esm.js → certificateIssuanceManager-DPT8E9zV.esm.js} +3 -3
  31. package/dist/{certificateIssuanceStateMachine-CM4q71h1.esm.js → certificateIssuanceStateMachine-BwDb3ezx.esm.js} +1 -1
  32. package/dist/consent.d.ts +1 -1
  33. package/dist/consent.esm.js +2 -2
  34. package/dist/{consentManager-B2F_VeAo.d.ts → consentManager-B0YKqYtZ.d.ts} +9 -9
  35. package/dist/{consentManager-BPocwpm2.esm.js → consentManager-DRMJ3O4r.esm.js} +3 -3
  36. package/dist/{consentStateMachine-DgiIcT9q.esm.js → consentStateMachine-Br0JbW7k.esm.js} +4 -7
  37. package/dist/cross-document-data-match.esm.js +1 -1
  38. package/dist/{crossDocumentDataMatchManager-BfA29Aji.esm.js → crossDocumentDataMatchManager-BIQ-SYcR.esm.js} +3 -4
  39. package/dist/curp-validation.d.ts +1 -1
  40. package/dist/curp-validation.esm.js +2 -2
  41. package/dist/{curpValidationManager-CbvBDoE1.esm.js → curpValidationManager-BKUDQ55W.esm.js} +3 -3
  42. package/dist/{curpValidationManager-Ci2iVuog.d.ts → curpValidationManager-DgUZySoq.d.ts} +1 -1
  43. package/dist/{curpValidationStateMachine-BQ8XK2Y3.esm.js → curpValidationStateMachine-BwUBkyyi.esm.js} +13 -14
  44. package/dist/custom-fields.esm.js +1 -1
  45. package/dist/custom-watchlist.esm.js +2 -2
  46. package/dist/{customFieldsManager-BRqSCR9R.esm.js → customFieldsManager-CPhONu5i.esm.js} +12 -16
  47. package/dist/{customWatchlistManager-Bd1ooIDB.esm.js → customWatchlistManager-cN57usIW.esm.js} +3 -3
  48. package/dist/{customWatchlistStateMachine-r8nGhyo1.esm.js → customWatchlistStateMachine-C1Xq1ugl.esm.js} +2 -4
  49. package/dist/{deepsightLoader-CEY2mSPM.esm.js → deepsightLoader-ClCQCdeL.esm.js} +5 -5
  50. package/dist/{desktopCameraElection-enVPfRsQ.esm.js → desktopCameraElection-btFONYx6.esm.js} +22 -10
  51. package/dist/device.d.ts +3 -3
  52. package/dist/device.esm.js +15 -15
  53. package/dist/document-capture.d.ts +2 -2
  54. package/dist/document-capture.esm.js +2 -2
  55. package/dist/document-signature.d.ts +123 -0
  56. package/dist/document-signature.esm.js +149 -0
  57. package/dist/{documentCaptureManager-C11k5BO-.esm.js → documentCaptureManager-5I3lKDVW.esm.js} +3 -3
  58. package/dist/{documentCaptureManager-BZBmcOKI.d.ts → documentCaptureManager-BkaPpoKy.d.ts} +1 -1
  59. package/dist/{documentCaptureStateMachine-g0gfL0_1.esm.js → documentCaptureStateMachine-jtQHasPA.esm.js} +7 -10
  60. package/dist/documentSignatureStateMachine-DKtU0H-F.esm.js +218 -0
  61. package/dist/dynamic-forms.esm.js +2 -2
  62. package/dist/{dynamicFormsManager-BmfCZ2zV.esm.js → dynamicFormsManager-B6Bv32wU.esm.js} +3 -3
  63. package/dist/{dynamicFormsStateMachine-B-eYytau.esm.js → dynamicFormsStateMachine-Kauq2oB-.esm.js} +10 -11
  64. package/dist/ekyb.d.ts +1 -1
  65. package/dist/ekyb.esm.js +2 -2
  66. package/dist/{ekybManager-BPaMfbgw.esm.js → ekybManager-wi135kG-.esm.js} +3 -3
  67. package/dist/{ekybStateMachine-C_lEw4I7.esm.js → ekybStateMachine-Vjb6_mFt.esm.js} +4 -6
  68. package/dist/ekyc-prefill.d.ts +1 -1
  69. package/dist/ekyc-prefill.esm.js +2 -2
  70. package/dist/ekyc.esm.js +3 -3
  71. package/dist/{ekycManager-nRT0rxei.esm.js → ekycManager-DWCL912J.esm.js} +3 -3
  72. package/dist/{ekycPrefillManager-DOTl3Y2w.d.ts → ekycPrefillManager-BcLhkpp8.d.ts} +4 -4
  73. package/dist/{ekycPrefillManager-CCtbmrFd.esm.js → ekycPrefillManager-C27Cu6rn.esm.js} +1 -1
  74. package/dist/{ekycPrefillStateMachine-XpxgCAoC.esm.js → ekycPrefillStateMachine-DqXvupSw.esm.js} +4 -6
  75. package/dist/{ekycRules-DXP2hqVw.esm.js → ekycRules-1hyjJ6bw.esm.js} +7 -4
  76. package/dist/{ekycStateMachine-nwJRel2s.esm.js → ekycStateMachine-DjiGyQtm.esm.js} +149 -13
  77. package/dist/{ekycUtils-FcqA6oU4.esm.js → ekycUtils-D9ui9Ztp.esm.js} +5 -0
  78. package/dist/electronic-signature.esm.js +1 -1
  79. package/dist/{electronicSignatureManager-M2O2VDks.esm.js → electronicSignatureManager-BHnxFx7u.esm.js} +8 -16
  80. package/dist/email.esm.js +2 -2
  81. package/dist/{emailManager-Co4jarT1.esm.js → emailManager-CfvR6pQN.esm.js} +3 -3
  82. package/dist/{emailStateMachine-CTEaYncs.esm.js → emailStateMachine-C4FouMzc.esm.js} +3 -5
  83. package/dist/{events-CP3yOzAl.esm.js → events-CsPmTidH.esm.js} +2 -2
  84. package/dist/events.d.ts +1 -0
  85. package/dist/events.esm.js +2 -2
  86. package/dist/extensibility.d.ts +14 -14
  87. package/dist/extensibility.esm.js +36 -36
  88. package/dist/face-match.esm.js +2 -2
  89. package/dist/{faceCaptureManagerFactory-3Or5qfbA.esm.js → faceCaptureManagerFactory-BjVIUTMM.esm.js} +5 -5
  90. package/dist/{faceCaptureManagerFactory-CRGajjZ4.d.ts → faceCaptureManagerFactory-DhDPxxp-.d.ts} +12 -6
  91. package/dist/{faceCaptureSetup-Cf87i0rT.esm.js → faceCaptureSetup-q33e6ah9.esm.js} +26 -15
  92. package/dist/{faceMatchManager-CGmNGbov.esm.js → faceMatchManager-CsPFaja4.esm.js} +3 -3
  93. package/dist/{faceMatchStateMachine-BuHt7kec.esm.js → faceMatchStateMachine-Co2S7iN8.esm.js} +8 -19
  94. package/dist/{feature-management-DG016L6E.esm.js → feature-management-BhRKAG--.esm.js} +3 -2
  95. package/dist/feature-management.esm.js +1 -1
  96. package/dist/field-comparison.esm.js +1 -1
  97. package/dist/{fieldComparisonManager-VgCU4X96.esm.js → fieldComparisonManager-Chn80m_n.esm.js} +4 -6
  98. package/dist/fiscal-qr.esm.js +1 -1
  99. package/dist/{fiscalQrManager-DOLq45ph.esm.js → fiscalQrManager-CpX6MOy_.esm.js} +6 -7
  100. package/dist/flow-events.d.ts +1 -1
  101. package/dist/flow.d.ts +6 -6
  102. package/dist/flow.esm.js +5 -5
  103. package/dist/{flowCompletionService-BpeAbbXc.esm.js → flowCompletionService-E_6ChYsV.esm.js} +2 -2
  104. package/dist/{flowServices-rDg1bAMs.esm.js → flowServices-C23o7MqO.esm.js} +10 -9
  105. package/dist/geolocation.esm.js +2 -2
  106. package/dist/{geolocationManager-T8m4lqvF.esm.js → geolocationManager-dgMVi0ed.esm.js} +3 -3
  107. package/dist/{geolocationStateMachine-NWmA1Dtn.esm.js → geolocationStateMachine-CCVd9xGh.esm.js} +6 -8
  108. package/dist/{getDeviceClass-DoIWuKI8.esm.js → getDeviceClass-Dcy9erbl.esm.js} +1 -1
  109. package/dist/government-validation.esm.js +2 -2
  110. package/dist/{governmentValidationManager-6JQQkzha.esm.js → governmentValidationManager-D2KGYDws.esm.js} +3 -3
  111. package/dist/{governmentValidationStateMachine-wBunpfQ9.esm.js → governmentValidationStateMachine-DRG-5jwQ.esm.js} +2 -4
  112. package/dist/home.d.ts +1 -1
  113. package/dist/home.esm.js +2 -2
  114. package/dist/http.esm.js +1 -1
  115. package/dist/id-ocr.d.ts +1 -1
  116. package/dist/id-ocr.esm.js +2 -2
  117. package/dist/id-selfie-flow.d.ts +2 -2
  118. package/dist/id-selfie-flow.esm.js +10 -10
  119. package/dist/id-verification.esm.js +2 -2
  120. package/dist/id.d.ts +3 -3
  121. package/dist/id.esm.js +3 -3
  122. package/dist/{idCaptureDefaults-Cjesf5i9.esm.js → idCaptureDefaults-BivjtJka.esm.js} +1 -1
  123. package/dist/{idCaptureManager-5-ReVgbB.esm.js → idCaptureManager-B_deOVCC.esm.js} +12 -14
  124. package/dist/{idCaptureManager-Cqx2y_fC.d.ts → idCaptureManager-DzAMWmRO.d.ts} +12 -5
  125. package/dist/{idCaptureServices-exB6I9lV.esm.js → idCaptureServices-BFCsusKB.esm.js} +17 -25
  126. package/dist/{idCaptureStateMachine-DQ14d3GR.esm.js → idCaptureStateMachine--CMATkG9.esm.js} +49 -56
  127. package/dist/{idOcrManager-im7VfJQi.esm.js → idOcrManager-C-_bzBSX.esm.js} +3 -3
  128. package/dist/{idOcrManager-C0C7lFGd.d.ts → idOcrManager-DflRx-_u.d.ts} +1 -1
  129. package/dist/{idOcrStateMachine-B832arAl.esm.js → idOcrStateMachine-BNtBkAXC.esm.js} +10 -7
  130. package/dist/{idVerificationManager-PMGM4hXY.esm.js → idVerificationManager-CdvGdtg2.esm.js} +3 -3
  131. package/dist/{idVerificationStateMachine-DeeugC00.esm.js → idVerificationStateMachine-mozw0CIg.esm.js} +2 -4
  132. package/dist/identity-reuse.esm.js +2 -2
  133. package/dist/identity-search.esm.js +3 -4
  134. package/dist/{identityReuseManager-CjFZ7WRa.esm.js → identityReuseManager-Z1Re4UGd.esm.js} +3 -3
  135. package/dist/{identityReuseStateMachine-CLFjPp13.esm.js → identityReuseStateMachine-C_3fSFCw.esm.js} +3 -7
  136. package/dist/{index-DxYNO94y.d.ts → index-C0WIMlJE.d.ts} +1 -1
  137. package/dist/{index-DM43R87x.d.ts → index-CNck5TLp.d.ts} +1 -1
  138. package/dist/index.d.ts +1 -1
  139. package/dist/index.esm.js +1 -1
  140. package/dist/{invokeOnCaptureCallback-lXP41N7b.esm.js → invokeOnCaptureCallback-DNQX9k5e.esm.js} +1 -1
  141. package/dist/kyb-checks.esm.js +2 -2
  142. package/dist/{kybChecksManager-CZfdCkLC.esm.js → kybChecksManager-D-mVF14T.esm.js} +1 -1
  143. package/dist/{kybChecksStateMachine-DkWxSU4L.esm.js → kybChecksStateMachine-BARZh9GN.esm.js} +5 -9
  144. package/dist/mandatory-consent.d.ts +2 -2
  145. package/dist/mandatory-consent.esm.js +2 -2
  146. package/dist/{mandatoryConsentManager-Dh3pBhOe.esm.js → mandatoryConsentManager-CKzzbbRe.esm.js} +3 -3
  147. package/dist/{mandatoryConsentManager-Bh1asNJh.d.ts → mandatoryConsentManager-D6tBmPDy.d.ts} +8 -8
  148. package/dist/{mandatoryConsentStateMachine-BjuI72HZ.esm.js → mandatoryConsentStateMachine-DpK7fg3E.esm.js} +4 -7
  149. package/dist/{mediaRecorderOptions-g1TwTlhd.esm.js → mediaRecorderOptions-Di_V9TnZ.esm.js} +1 -1
  150. package/dist/{multipartRecordingService-WgK8ieRI.esm.js → multipartRecordingService-CEtaAPz4.esm.js} +2 -2
  151. package/dist/{permissionGuards-D-4_VU7-.esm.js → permissionGuards-BJIaHxvI.esm.js} +1 -1
  152. package/dist/{permissionServices-DpccEnzE.esm.js → permissionServices-6Mdq1hDk.esm.js} +8 -5
  153. package/dist/phone.esm.js +2 -2
  154. package/dist/{phoneManager-rA7updqF.esm.js → phoneManager-D8-l6-0y.esm.js} +3 -3
  155. package/dist/{phoneServices-CFXcwCFr.esm.js → phoneServices-C9lFIuCM.esm.js} +3 -7
  156. package/dist/{phoneStateMachine-DKdY2Scx.esm.js → phoneStateMachine-CGLBgJJR.esm.js} +2 -2
  157. package/dist/{platform-aPh7gTWh.esm.js → platform-GIg4uPWe.esm.js} +1 -4
  158. package/dist/{processFaceMatch-B_DkDTE5.esm.js → processFaceMatch-B1Mhqkep.esm.js} +1 -1
  159. package/dist/qe-signature.esm.js +1 -1
  160. package/dist/{recordingService-DxiwS8TV.esm.js → recordingService-CLGnDCDl.esm.js} +7 -6
  161. package/dist/redirect-to-mobile.esm.js +2 -2
  162. package/dist/{redirectToMobileManager-DTB_pWuS.esm.js → redirectToMobileManager-Djb_daci.esm.js} +3 -3
  163. package/dist/{redirectToMobileStateMachine-nP9DM01_.esm.js → redirectToMobileStateMachine-BCyQFlpn.esm.js} +7 -17
  164. package/dist/{runChildModule-CXLcOcXN.esm.js → runChildModule-DF2c6TxC.esm.js} +2 -2
  165. package/dist/{sdkVersion-fqxsdqFZ.esm.js → sdkVersion-B5_kVegT.esm.js} +1 -1
  166. package/dist/selfie.d.ts +5 -5
  167. package/dist/selfie.esm.js +11 -11
  168. package/dist/{selfieErrorUtils-MOfYdGPz.esm.js → selfieErrorUtils-BVuv5qO7.esm.js} +1 -1
  169. package/dist/{selfieManager-DihwheJ6.d.ts → selfieManager-C5a6Fw6W.d.ts} +1 -1
  170. package/dist/{selfieManager-Dq8tIqGd.esm.js → selfieManager-Dnb5h3qV.esm.js} +6 -6
  171. package/dist/{selfieStateMachine-BZVDQB8R.esm.js → selfieStateMachine-BT69FLFb.esm.js} +3 -3
  172. package/dist/{session-C7x_iJ-p.esm.js → session-OCc4b-Iv.esm.js} +4 -4
  173. package/dist/session.d.ts +1 -1
  174. package/dist/session.esm.js +5 -5
  175. package/dist/{sessionInitializer-k-hKIBg8.esm.js → sessionInitializer-BUUpdBy6.esm.js} +11 -13
  176. package/dist/{setup-CpXbdA1X.d.ts → setup-BpD7lYSf.d.ts} +5 -4
  177. package/dist/{setup-BRbhjHiU.esm.js → setup-CJMohzTE.esm.js} +10 -10
  178. package/dist/signature.esm.js +2 -2
  179. package/dist/{signatureManager-BgAja97K.esm.js → signatureManager-B6dRieBV.esm.js} +3 -3
  180. package/dist/{signatureStateMachine-CVPmvU2p.esm.js → signatureStateMachine-DSW5-ZO0.esm.js} +3 -5
  181. package/dist/{stats-DoByUnTa.esm.js → stats-VqHbD5rn.esm.js} +1 -1
  182. package/dist/stats.esm.js +1 -1
  183. package/dist/{tri-CI2exudk.esm.js → tri-B5Yh5glk.esm.js} +2 -2
  184. package/dist/tri.d.ts +1 -1
  185. package/dist/tri.esm-DYdFtcDH.esm.js +3105 -0
  186. package/dist/tri.esm.js +1 -1
  187. package/dist/{trueSightService-DhW2O8mB.esm.js → trueSightService-D9D2IdEj.esm.js} +6 -7
  188. package/dist/trust-graph.esm.js +2 -2
  189. package/dist/{types-Ddc4Tr_f.d.ts → types-B2DGXHe6.d.ts} +2 -0
  190. package/dist/{types-Cpdum4vi.d.ts → types-BBHnkH6S.d.ts} +4 -4
  191. package/dist/types-BNkzXOXE.d.ts +45 -0
  192. package/dist/{types-DJPU3W2M.d.ts → types-BkWUNheX.d.ts} +1 -1
  193. package/dist/types-C2uJrJrS.d.ts +6 -0
  194. package/dist/{types-DYYMdAGv.esm.js → types-CBQN04Rh.esm.js} +2 -1
  195. package/dist/{types-CyNndVAT.d.ts → types-CaVUb1DL.d.ts} +1 -1
  196. package/dist/{types-DFP7eSle.d.ts → types-Crg7oL-l.d.ts} +1 -1
  197. package/dist/{types-9wlf1-GE.d.ts → types-x5MQKskR.d.ts} +4 -2
  198. package/dist/video-selfie.d.ts +2 -2
  199. package/dist/video-selfie.esm.js +9 -9
  200. package/dist/{videoSelfieCameraWarmer-YwO_uP-b.esm.js → videoSelfieCameraWarmer-CYEHPKK6.esm.js} +9 -9
  201. package/dist/{videoSelfieStepDetector-DRrh4P0A.d.ts → videoSelfieStepDetector-DGXi_TXk.d.ts} +18 -8
  202. package/dist/wasm.d.ts +1 -1
  203. package/dist/wasm.esm.js +1 -1
  204. package/dist/{wasmDsFlagSync-D_6e8W62.esm.js → wasmDsFlagSync-BNttW5Sm.esm.js} +1 -1
  205. package/dist/watchlist-for-business.esm.js +2 -2
  206. package/dist/watchlist.esm.js +2 -2
  207. package/dist/{watchlistForBusinessManager-BH6M4kqA.esm.js → watchlistForBusinessManager-CfLnsL8p.esm.js} +3 -3
  208. package/dist/{watchlistForBusinessStateMachine-BMWm5mcP.esm.js → watchlistForBusinessStateMachine-EzlC_4I4.esm.js} +9 -6
  209. package/dist/{watchlistManager-BDaVjzLW.esm.js → watchlistManager-CGXbemnp.esm.js} +3 -3
  210. package/dist/{watchlistStateMachine-Cx-6QAvu.esm.js → watchlistStateMachine-CsNEmiXL.esm.js} +2 -4
  211. package/dist/workflow.d.ts +1 -1
  212. package/dist/workflow.esm.js +40 -38
  213. package/package.json +6 -1
  214. package/dist/camera-9wWD-pwg.d.ts +0 -4
  215. package/dist/tri.esm-CxLWmTZk.esm.js +0 -2287
  216. package/dist/types-CE1jkHw3.d.ts +0 -6
@@ -1,2287 +0,0 @@
1
- //#region ../../node_modules/.pnpm/@incodetech+tri-sdk@0.6.0-dev-20261116191152-a41c6976608191fa0c97dbf43a4ba2877182acac/node_modules/@incodetech/tri-sdk/dist/tri.esm.js
2
- function t(t, n, e) {
3
- let i = t, r = n;
4
- if ("devicepixelratiochange" === n) {
5
- const t = window.devicePixelRatio;
6
- i = window.matchMedia(`(resolution: ${t}dppx)`), r = "change";
7
- }
8
- i.addEventListener(r, e, {
9
- capture: !0,
10
- passive: !0
11
- });
12
- }
13
- function n(t, n, e) {
14
- let i = t, r = n;
15
- if ("devicepixelratiochange" === n) {
16
- const t = window.devicePixelRatio;
17
- i = window.matchMedia(`(resolution: ${t}dppx)`), r = "change";
18
- }
19
- i.removeEventListener(r, e, { capture: !0 });
20
- }
21
- const i = class e {
22
- constructor() {
23
- this.t = !1;
24
- }
25
- static get instance() {
26
- return e.i || (e.i = new e()), e.i;
27
- }
28
- get DEBUG() {
29
- return this.t;
30
- }
31
- set DEBUG(t) {
32
- this.t = t;
33
- }
34
- warn(t, n, ...e) {
35
- this.t && this.o("warn", t, n, ...e);
36
- }
37
- error(t, n, ...e) {
38
- this.t && this.o("error", t, n, ...e);
39
- }
40
- info(t, n, ...e) {
41
- this.t && this.o("info", t, n, ...e);
42
- }
43
- fatal(t, n, e, ...i) {
44
- this.o(t, n, e, ...i);
45
- }
46
- o(t, n, e, ...i) {
47
- const r = n ? `[${n}]` : "", s = console?.[t];
48
- s && s(`[IncodeTRI]${r} ${e}`, ...i);
49
- }
50
- }.instance;
51
- const r = globalThis.setTimeout.bind(globalThis);
52
- const s = globalThis.clearTimeout.bind(globalThis);
53
- function o(t, n) {
54
- try {
55
- return t();
56
- } catch (t) {
57
- i.warn("utils", "safeSync swallowed error:", t);
58
- }
59
- }
60
- async function a(t) {
61
- try {
62
- return await t();
63
- } catch (t) {
64
- i.warn("utils", "safeAsync swallowed error:", t);
65
- }
66
- }
67
- function c(t) {
68
- return (n) => o(() => t(n));
69
- }
70
- function l(t) {
71
- return (...n) => {
72
- try {
73
- t(...n);
74
- } catch (t) {
75
- i.warn("utils", "safeTimer swallowed error:", t);
76
- }
77
- };
78
- }
79
- function u(t, n) {
80
- return r(l(t), n);
81
- }
82
- function h(t) {
83
- if (null !== t) try {
84
- s(t);
85
- } catch (t) {
86
- i.warn("utils", "safeClearTimeout swallowed error:", t);
87
- }
88
- }
89
- function f(t) {
90
- function n() {
91
- return globalThis.window && globalThis.window[t] && void 0 !== globalThis.window[t];
92
- }
93
- return {
94
- get: function(e) {
95
- if (!n()) return null;
96
- try {
97
- const n = window[t].getItem(e) ?? "null";
98
- return "null" === n ? null : JSON.parse(n);
99
- } catch {
100
- return null;
101
- }
102
- },
103
- set: function(e, i) {
104
- n() && o(() => window[t].setItem(e, JSON.stringify(i)));
105
- },
106
- remove: function(e) {
107
- n() && o(() => window[t].removeItem(e));
108
- },
109
- key: function(e) {
110
- return n() ? window[t].key(e) : null;
111
- },
112
- get length() {
113
- return n() ? window[t].length : 0;
114
- }
115
- };
116
- }
117
- const d = f("localStorage");
118
- const p = f("sessionStorage");
119
- const y = "__tri_session";
120
- function v() {
121
- const t = o(() => p.get(y)), n = {
122
- setups: 0,
123
- resets: 0,
124
- activities: 0,
125
- activityId: null,
126
- previousActivityId: null
127
- };
128
- return t && "object" == typeof t ? ("number" == typeof t.setups && (n.setups = t.setups), "number" == typeof t.resets && (n.resets = t.resets), "number" == typeof t.activities && (n.activities = t.activities), "string" == typeof t.activityId && (n.activityId = t.activityId), "string" == typeof t.previousActivityId && (n.previousActivityId = t.previousActivityId), n) : n;
129
- }
130
- function g(t) {
131
- o(() => {
132
- const n = v();
133
- t(n), p.set(y, n);
134
- });
135
- }
136
- const m = {
137
- "fpSignalsLib.js": "5248ca624da2f1551ff2b6264a4494368d16aa0eaba50484dfe03f940acf4611",
138
- "fpSignalsLib.wasm": "d15c1930d57310356a7ea6cb803f590d98792409d8d8b455c00cecd9af4bf2ea",
139
- "fpSignalsLibSimd.js": "08abec3f0f04dd816076b493712ae27920769f36e232ea8038a218cac15a3a60",
140
- "fpSignalsLibSimd.wasm": "08c3faf6d5615dfa1ede01875c9d29305626ab2e85603bae8c4af3a15b933d3a"
141
- };
142
- var b = class extends Error {
143
- constructor(t, n) {
144
- super(n), this.name = "FpSignalsLoadError", this.reason = t;
145
- }
146
- };
147
- async function k(t) {
148
- const n = new URL(t).pathname.split("/").pop() ?? "", e = m[n];
149
- if (!e) throw new b("integrity-mismatch", `fpSignals: no digest for ${n}`);
150
- const i = globalThis.crypto?.subtle;
151
- if (!i) throw new b("no-crypto-subtle", "fpSignals: crypto.subtle is unavailable, so the files cannot be verified. Serve the page over HTTPS.");
152
- const r = await async function(t, n) {
153
- try {
154
- const n = await fetch(t);
155
- if (!n.ok) throw new Error(`HTTP ${n.status}`);
156
- return new Uint8Array(await n.arrayBuffer());
157
- } catch (t) {
158
- throw new b("network-or-csp", `fpSignals: ${n} could not be fetched: ${String(t)}`);
159
- }
160
- }(t, n);
161
- if (function(t) {
162
- let n = "";
163
- for (const e of new Uint8Array(t)) n += e.toString(16).padStart(2, "0");
164
- return n;
165
- }(await i.digest("SHA-256", r)) !== e) throw new b("integrity-mismatch", `fpSignals: ${n} does not match the pinned build`);
166
- return r;
167
- }
168
- var S;
169
- async function T(t) {
170
- const n = t.replace(/\.wasm($|\?)/, ".js$1"), e = await async function(t) {
171
- const n = await k(t), e = URL.createObjectURL(new Blob([n], { type: "text/javascript" }));
172
- try {
173
- return await import(
174
- /* @vite-ignore */
175
- /* webpackIgnore: true */
176
- e
177
- );
178
- } catch (t) {
179
- throw new b("network-or-csp", `fpSignals: the verified glue could not be imported: ${String(t)}`);
180
- } finally {
181
- URL.revokeObjectURL(e);
182
- }
183
- }(n), i = e.Module ?? e.default;
184
- if (!i) throw new Error(`Failed to import Module from ${n}`);
185
- const r = await k(t), s = window.wasmArrayBuffer;
186
- window.wasmArrayBuffer = r;
187
- try {
188
- return await i({ wasmBinary: r });
189
- } finally {
190
- window.wasmArrayBuffer = s;
191
- }
192
- }
193
- (function(t) {
194
- t[t.Device = 1] = "Device", t[t.Behaviour = 2] = "Behaviour", t[t.PID = 3] = "PID", t[t.Network = 4] = "Network", t[t.External = 5] = "External";
195
- })(S || (S = {}));
196
- var _ = class {
197
- constructor() {
198
- this.wasmModule = null, this.signalsApi = null, this.usedSimd_ = !1;
199
- }
200
- async initialize(t, n, e = !0, r, s) {
201
- if (this.signalsApi) return;
202
- const o = e && !!n;
203
- try {
204
- this.wasmModule = await T(o ? n : t), this.usedSimd_ = o;
205
- } catch (n) {
206
- if (!o) throw n;
207
- i.warn("FpSignals", "SIMD init error:", n), this.wasmModule = await T(t), this.usedSimd_ = !1;
208
- }
209
- this.signalsApi = function(t, n, e) {
210
- const r = void 0 === e ? "" : String(e);
211
- try {
212
- if (r) return new t.FpSignals(n ?? "", r);
213
- if (n) return new t.FpSignals(n);
214
- } catch (t) {
215
- i.warn("FpSignals", "constructor arguments not supported:", t);
216
- }
217
- return new t.FpSignals();
218
- }(this.wasmModule, r, s);
219
- }
220
- get usedSimd() {
221
- return this.usedSimd_;
222
- }
223
- isReady() {
224
- return null !== this.signalsApi;
225
- }
226
- setHostInfo(t, n) {
227
- this.api().shi(t, n);
228
- }
229
- async collect() {
230
- const t = this.api();
231
- for (; !t.ppf();) await new Promise((t) => setTimeout(t, 0));
232
- }
233
- setBehaviourCollectionEnabled(t) {
234
- this.api().sbc(t);
235
- }
236
- getSignals(t) {
237
- return this.api().gsd(t);
238
- }
239
- hasMethod(t) {
240
- return "function" == typeof this.signalsApi?.[t];
241
- }
242
- getSignalsWithReason(t, n) {
243
- const e = this.api();
244
- return "function" == typeof e.gsr ? e.gsr(t, n) : e.gsd(t);
245
- }
246
- getBufferFill() {
247
- const t = this.api();
248
- if ("function" != typeof t.gbf) return null;
249
- const n = t.gbf();
250
- return "number" == typeof n && Number.isFinite(n) ? n : null;
251
- }
252
- setCapturePolicy(t) {
253
- const n = this.api();
254
- return "function" == typeof n.scp && (n.scp(JSON.stringify(t)), !0);
255
- }
256
- setUrlSanitizer(t) {
257
- const n = this.api();
258
- return "function" == typeof n.sus && (n.sus(t), !0);
259
- }
260
- addSignal(t, n) {
261
- const e = this.api();
262
- return "function" == typeof e.as && !0 === e.as(t, n);
263
- }
264
- setSessionToken(t) {
265
- const n = this.api();
266
- return "function" == typeof n.sst && (n.sst(t), !0);
267
- }
268
- freeResources() {
269
- this.signalsApi && (this.signalsApi.delete(), this.signalsApi = null), this.wasmModule = null;
270
- }
271
- api() {
272
- if (!this.signalsApi) throw new Error("FpSignals has not been initialized");
273
- return this.signalsApi;
274
- }
275
- };
276
- function I(t, n) {
277
- return !t || (t[n]?.enabled ?? !1);
278
- }
279
- const A = {
280
- pointer: { events: {
281
- pointer: ["pointerButtons"],
282
- click: ["clicks"],
283
- dblclick: ["dblclicks"],
284
- contextmenu: ["contextmenus"]
285
- } },
286
- pointermove: { all: ["pointerMoves"] },
287
- hover: { all: ["hover"] },
288
- focus: { all: ["focus"] },
289
- input: { all: ["input"] },
290
- keystroke: { all: ["keys"] },
291
- clipboard: { events: {
292
- paste: ["paste"],
293
- cut: ["cut"],
294
- copy: ["copy"]
295
- } },
296
- form: { events: {
297
- submit: ["submit"],
298
- invalid: ["invalid"],
299
- snapshot: ["snapshots"]
300
- } },
301
- change: { all: ["change"] },
302
- selection: { all: ["selection"] },
303
- scroll: { all: ["scroll"] },
304
- wheel: { all: ["wheel"] },
305
- viewportresize: { all: ["resize"] },
306
- viewport: { events: {
307
- orientationchange: ["screenOrientation"],
308
- devicepixelratiochange: ["devicePixelRatio"]
309
- } },
310
- sensors: { events: {
311
- motion: ["deviceMotion"],
312
- orientation: ["deviceOrientation"],
313
- light: ["ambientLight"]
314
- } },
315
- visibility: { all: ["visibility"] },
316
- screen: { all: ["screenChanges"] },
317
- networkconnection: { all: ["online"] }
318
- };
319
- const E = ["pointerButtons", "pointerMoves"];
320
- function C(t, n) {
321
- return !0 === t[n]?.enabled;
322
- }
323
- function R(t, n, e) {
324
- const i = t[n];
325
- if (!i || !i.enabled) return !1;
326
- return ("events" in i ? i.events : void 0)?.[e]?.enabled ?? !0;
327
- }
328
- function $(t) {
329
- const n = [];
330
- for (const e of Object.keys(A)) {
331
- const i = A[e];
332
- if ("all" in i) C(t, e) || n.push(...i.all);
333
- else for (const r of Object.keys(i.events)) R(t, e, r) || n.push(...i.events[r]);
334
- }
335
- let e = !0;
336
- for (const t of E) n.includes(t) || (e = !1);
337
- return e && n.push("touch"), n;
338
- }
339
- const M = "idle";
340
- const P = "ready";
341
- const x = "started";
342
- const z = "collection-disabled";
343
- const L = "init-failed";
344
- const F = {
345
- flush: {
346
- intervalMs: 2e3,
347
- maxIntervalMs: 3e4,
348
- size: 50,
349
- backoffFailureThreshold: 2
350
- },
351
- queue: { size: 100 }
352
- };
353
- const B = "redact";
354
- const j = [
355
- "session",
356
- "tab",
357
- "navigation",
358
- "page_complexity",
359
- "network_request",
360
- "fp_signals_load"
361
- ];
362
- const D = F.queue.size;
363
- const O = F.flush.size;
364
- const q = ["navigation", "network-request"];
365
- const U = Object.freeze({
366
- session: 80,
367
- tab: 80,
368
- navigation: 80,
369
- page_complexity: 80,
370
- fp_signals: 80,
371
- fp_signals_load: 80,
372
- network_request: 60
373
- });
374
- function N(t) {
375
- return U[t.name];
376
- }
377
- let H = null;
378
- const J = /* @__PURE__ */ new Set([
379
- "xmlhttprequest",
380
- "fetch",
381
- "beacon",
382
- "navigation",
383
- "script",
384
- "link",
385
- "css",
386
- "img",
387
- "iframe",
388
- "video",
389
- "audio"
390
- ]);
391
- const V = /* @__PURE__ */ new Set([
392
- "xmlhttprequest",
393
- "fetch",
394
- "beacon"
395
- ]);
396
- function K(t, n) {
397
- return n ? t : null;
398
- }
399
- function Z(t, n) {
400
- const e = t.responseStart > 0, i = e ? t.transferSize : null, r = e ? t.encodedBodySize : null, s = e ? t.decodedBodySize : null, o = e && t.nextHopProtocol || null, a = e && void 0 !== t.deliveryType ? t.deliveryType : null, c = t.responseStatus, l = void 0 !== c && 0 !== c ? c : null, u = {
401
- name: "network_request",
402
- timestamp: Date.now(),
403
- performanceTime: t.startTime + t.duration,
404
- url: n(t.name),
405
- initiatorType: (h = t.initiatorType, J.has(h) ? h : "other"),
406
- startTime: t.startTime,
407
- durationMs: t.duration,
408
- fetchStart: t.fetchStart,
409
- domainLookupStart: K(t.domainLookupStart, e),
410
- domainLookupEnd: K(t.domainLookupEnd, e),
411
- connectStart: K(t.connectStart, e),
412
- connectEnd: K(t.connectEnd, e),
413
- secureConnectionStart: K(t.secureConnectionStart, e),
414
- requestStart: K(t.requestStart, e),
415
- responseStart: K(t.responseStart, e),
416
- responseEnd: t.responseEnd,
417
- transferSize: i,
418
- encodedBodySize: r,
419
- decodedBodySize: s,
420
- nextHopProtocol: o,
421
- deliveryType: a,
422
- responseStatus: l
423
- };
424
- var h;
425
- return Object.assign(u, function(t, n) {
426
- return {
427
- dnsLookupMs: K(t.domainLookupEnd - t.domainLookupStart, n),
428
- tcpConnectMs: K(t.connectEnd - t.connectStart, n),
429
- tlsHandshakeMs: K(t.connectEnd > 0 && t.secureConnectionStart > 0 ? t.connectEnd - t.secureConnectionStart : 0, n),
430
- ttfbMs: K(t.responseStart - t.requestStart, n),
431
- responseDownloadMs: K(t.responseEnd - t.responseStart, n)
432
- };
433
- }(t, e)), u;
434
- }
435
- function G() {}
436
- function W(t, n, e, i, r) {
437
- return {
438
- name: "navigation",
439
- timestamp: Date.now(),
440
- ts: performance.now(),
441
- phase: t,
442
- type: n,
443
- from: e.from,
444
- to: e.to,
445
- timeOrigin: i,
446
- timing: r
447
- };
448
- }
449
- function X(t, n) {
450
- if (t.firstElementChild) return t.firstElementChild;
451
- let e = t;
452
- for (; null !== e && e !== n;) {
453
- if (e.nextElementSibling) return e.nextElementSibling;
454
- e = e.parentElement;
455
- }
456
- return null;
457
- }
458
- function Q(t, n) {
459
- switch (t) {
460
- case "FORM":
461
- n.formCount++;
462
- break;
463
- case "INPUT":
464
- n.inputCount++;
465
- break;
466
- case "BUTTON":
467
- n.buttonCount++;
468
- break;
469
- case "A":
470
- n.linkCount++;
471
- break;
472
- case "SELECT":
473
- n.selectCount++;
474
- break;
475
- case "TEXTAREA":
476
- n.textareaCount++;
477
- break;
478
- case "IFRAME":
479
- n.iframeCount++;
480
- break;
481
- case "SCRIPT":
482
- n.scriptCount++;
483
- break;
484
- case "IMG": n.imageCount++;
485
- }
486
- }
487
- function Y(t) {
488
- let n = null, e = null, i = null;
489
- function r() {
490
- if (h(n), n = null, h(i), i = null, null !== e) {
491
- const t = e;
492
- e = null, o(() => window.cancelIdleCallback?.(t));
493
- }
494
- }
495
- return {
496
- schedule: function(s, o, a) {
497
- r();
498
- const c = function(t) {
499
- if (!t) return null;
500
- try {
501
- return new URL(t, location.href).pathname;
502
- } catch {
503
- return null;
504
- }
505
- }(a);
506
- n = u(() => {
507
- n = null, function(t) {
508
- const n = window;
509
- "function" != typeof n.requestIdleCallback ? i = u(() => {
510
- i = null, t();
511
- }, 0) : e = n.requestIdleCallback(l(() => {
512
- e = null, t();
513
- }), { timeout: 2e3 });
514
- }(() => function(n, e, i) {
515
- const r = function(t = 2e4) {
516
- const n = {
517
- textLength: 0,
518
- interactiveCount: 0,
519
- scrollHeight: 0,
520
- innerHeight: 0,
521
- nodeCount: 0,
522
- formCount: 0,
523
- inputCount: 0,
524
- buttonCount: 0,
525
- linkCount: 0,
526
- selectCount: 0,
527
- textareaCount: 0,
528
- iframeCount: 0,
529
- scriptCount: 0,
530
- imageCount: 0,
531
- truncated: !1
532
- }, e = document.documentElement;
533
- let i = e;
534
- for (; null !== i;) {
535
- if (n.nodeCount >= t) {
536
- n.truncated = !0;
537
- break;
538
- }
539
- n.nodeCount++, Q(i.tagName, n), i = X(i, e);
540
- }
541
- return n.textLength = document.body?.textContent?.length ?? 0, n.interactiveCount = document.querySelectorAll("input,button,a,select,textarea").length, n.scrollHeight = document.documentElement?.scrollHeight ?? 0, n.innerHeight = window.innerHeight, n;
542
- }(), s = {
543
- name: "page_complexity",
544
- timestamp: Date.now(),
545
- ts: performance.now(),
546
- phase: n,
547
- type: e,
548
- path: i,
549
- ...r
550
- };
551
- t.push(s);
552
- }(s, o, c));
553
- }, "load" === s ? 1500 : 500);
554
- },
555
- dispose: r
556
- };
557
- }
558
- function tt() {
559
- return function() {};
560
- }
561
- const nt = {
562
- pointer: {
563
- create: tt,
564
- layer: "behavioral",
565
- events: [
566
- "pointer",
567
- "click",
568
- "dblclick",
569
- "contextmenu"
570
- ]
571
- },
572
- pointermove: {
573
- create: tt,
574
- layer: "behavioral"
575
- },
576
- focus: {
577
- create: tt,
578
- layer: "behavioral"
579
- },
580
- input: {
581
- create: tt,
582
- layer: "behavioral"
583
- },
584
- keystroke: {
585
- create: tt,
586
- layer: "behavioral"
587
- },
588
- clipboard: {
589
- create: tt,
590
- layer: "behavioral",
591
- events: [
592
- "paste",
593
- "cut",
594
- "copy"
595
- ]
596
- },
597
- form: {
598
- create: tt,
599
- layer: "behavioral",
600
- events: [
601
- "submit",
602
- "invalid",
603
- "snapshot"
604
- ]
605
- },
606
- change: {
607
- create: tt,
608
- layer: "behavioral"
609
- },
610
- selection: {
611
- create: tt,
612
- layer: "behavioral"
613
- },
614
- tab: {
615
- create: tt,
616
- layer: "session",
617
- events: ["state", "count"]
618
- },
619
- visibility: {
620
- create: tt,
621
- layer: "session"
622
- },
623
- navigation: {
624
- create: function(e) {
625
- let i = e.sanitizeUrl(document.referrer || "");
626
- const r = Y(e);
627
- function s(t) {
628
- e.push(t), i = t.to ?? "", r && "hide" !== t.phase && r.schedule(t.phase, t.type, t.to);
629
- }
630
- const a = c(() => {
631
- const [t] = performance.getEntriesByType("navigation");
632
- var n;
633
- s(W("load", t?.type ?? "navigate", {
634
- from: document.referrer ? e.sanitizeUrl(document.referrer) : null,
635
- to: e.sanitizeUrl(location.href)
636
- }, performance.timeOrigin, t ? {
637
- fetchStart: (n = t).fetchStart,
638
- domainLookupStart: n.domainLookupStart,
639
- domainLookupEnd: n.domainLookupEnd,
640
- connectStart: n.connectStart,
641
- connectEnd: n.connectEnd,
642
- requestStart: n.requestStart,
643
- responseStart: n.responseStart,
644
- responseEnd: n.responseEnd,
645
- domInteractive: n.domInteractive,
646
- domContentLoadedEventStart: n.domContentLoadedEventStart,
647
- domContentLoadedEventEnd: n.domContentLoadedEventEnd,
648
- domComplete: n.domComplete,
649
- loadEventStart: n.loadEventStart,
650
- loadEventEnd: n.loadEventEnd,
651
- redirectCount: n.redirectCount,
652
- transferSize: n.transferSize,
653
- encodedBodySize: n.encodedBodySize,
654
- decodedBodySize: n.decodedBodySize
655
- } : void 0));
656
- }), l = c((t) => {
657
- const n = t;
658
- if (null === n.navigationType) return;
659
- const r = e.sanitizeUrl(location.href);
660
- r !== i && s(W("change", n.navigationType, {
661
- from: i,
662
- to: r
663
- }, performance.timeOrigin));
664
- }), u = c(() => f("traverse")), h = c(() => f("hashchange"));
665
- function f(t) {
666
- const n = e.sanitizeUrl(location.href);
667
- "hashchange" === t && n === i || s(W("change", t, {
668
- from: i,
669
- to: n
670
- }, performance.timeOrigin));
671
- }
672
- const d = history.pushState, p = history.replaceState, y = function(...t) {
673
- const n = d.apply(this, t);
674
- return o(() => f("push")), n;
675
- }, v = function(...t) {
676
- const n = p.apply(this, t);
677
- return o(() => f("replace")), n;
678
- };
679
- return window.navigation ? t(window.navigation, "currententrychange", l) : (history.pushState = y, history.replaceState = v, t(window, "popstate", u), t(window, "hashchange", h)), "complete" === document.readyState ? a(new Event("load")) : t(window, "load", a), () => {
680
- r?.dispose(), window.navigation ? n(window.navigation, "currententrychange", l) : (history.pushState === y && (history.pushState = d), history.replaceState === v && (history.replaceState = p), n(window, "popstate", u), n(window, "hashchange", h)), n(window, "load", a);
681
- };
682
- },
683
- layer: "session"
684
- },
685
- networkconnection: {
686
- create: tt,
687
- layer: "session"
688
- },
689
- scroll: {
690
- create: tt,
691
- layer: "behavioral"
692
- },
693
- viewportresize: {
694
- create: tt,
695
- layer: "behavioral"
696
- },
697
- viewport: {
698
- create: tt,
699
- layer: "behavioral",
700
- events: ["orientationchange", "devicepixelratiochange"]
701
- },
702
- sensors: {
703
- create: tt,
704
- layer: "behavioral",
705
- events: [
706
- "motion",
707
- "orientation",
708
- "light"
709
- ]
710
- },
711
- "network-request": {
712
- create: function(t) {
713
- var n;
714
- const e = function(t, n, e, r = V) {
715
- if ("undefined" == typeof PerformanceObserver) return G;
716
- let s = null;
717
- try {
718
- s = new PerformanceObserver((i) => {
719
- for (const s of i.getEntries()) {
720
- const i = s;
721
- r.has(i.initiatorType) && (n(i.name) || t(Z(i, e)));
722
- }
723
- }), s.observe({
724
- type: "resource",
725
- buffered: !0
726
- });
727
- } catch {
728
- return i.warn("network-request", "PerformanceObserver failed to start"), G;
729
- }
730
- return function() {
731
- s?.disconnect(), s = null;
732
- };
733
- }(function(n) {
734
- o(() => t.push(n));
735
- }, (n = t.ignoredOrigins, function(t) {
736
- try {
737
- return n.has(new URL(t).origin);
738
- } catch {
739
- return !1;
740
- }
741
- }), t.sanitizeUrl);
742
- return function() {
743
- e();
744
- };
745
- },
746
- layer: "session"
747
- },
748
- screen: {
749
- create: tt,
750
- layer: "session"
751
- },
752
- wheel: {
753
- create: tt,
754
- layer: "behavioral"
755
- },
756
- hover: {
757
- create: tt,
758
- layer: "behavioral"
759
- },
760
- fpsignals: {
761
- create: function(e, r = "off", s) {
762
- const u = I(s, "device"), h = I(s, "pid"), f = I(s, "behaviour"), d = performance.now(), p = new _();
763
- let y, g = !1, m = !1, k = null, T = null, A = null, E = null, C = null, R = null, M = null, P = !1, x = !1, z = 0, L = !1, F = null, B = "";
764
- const q = new Promise(function(t) {
765
- y = t;
766
- });
767
- function U() {
768
- const t = e.getActivityId?.() ?? "";
769
- t !== F && p.setSessionToken(t) && (F = t);
770
- }
771
- function J() {
772
- const t = e.getActivityId?.() ?? "";
773
- t && t !== B && et();
774
- }
775
- function V(t, n) {
776
- if (!m || !p.isReady()) return null;
777
- o(U), o(J);
778
- const i = n ? p.getSignalsWithReason(t, n) : p.getSignals(t);
779
- return function(t, n) {
780
- if (!t) return !1;
781
- const i = {
782
- name: "fp_signals",
783
- timestamp: Date.now(),
784
- signals: t
785
- };
786
- return n && (i.reason = n), e.push(i), !0;
787
- }(i, n) ? i : null;
788
- }
789
- function K(t) {
790
- return !!f && null !== V(S.Behaviour, t);
791
- }
792
- function Z(t) {
793
- if (!m || !k) return !1;
794
- z = 0;
795
- const n = null !== V(S.Network, t), e = null !== V(S.External, t);
796
- return n || e;
797
- }
798
- function G(t) {
799
- o(() => Z(function(t) {
800
- return "interval" === t || "submit" === t ? t : "capacity" === t ? "fill" : void 0;
801
- }(t)));
802
- }
803
- function W(t) {
804
- z += t, L || e.requestFlush?.(z >= O);
805
- }
806
- function X(t) {
807
- return o(() => V(t)) ?? null;
808
- }
809
- function Q() {
810
- null !== C && clearInterval(C), null !== R && clearTimeout(R), C = null, R = null;
811
- }
812
- function Y(t = "partial") {
813
- return !(!u || P || x || !m || !p.isReady() || !p.hasMethod("gsr") || null === V(S.Device, t) || (P = !0, Q(), 0));
814
- }
815
- function tt() {
816
- u && p.hasMethod("gsr") && (C = setInterval(l(function() {
817
- Y();
818
- }), 250), R = setTimeout(l(Q), 5e3));
819
- }
820
- function nt() {
821
- if (!m || !p.isReady()) return;
822
- const t = p.getBufferFill();
823
- null !== t && t >= .5 && (K("fill"), Z("fill"));
824
- }
825
- function et() {
826
- var t;
827
- B = e.getActivityId?.() ?? "", e.push((t = e.collectorSelection ?? {}, {
828
- name: "session",
829
- timestamp: Date.now(),
830
- ts: performance.now(),
831
- ...v(),
832
- collectors: t
833
- }));
834
- }
835
- function it() {
836
- if (k) if (p.hasMethod("as")) {
837
- L = !0;
838
- try {
839
- k.open(function(t, n) {
840
- return p.addSignal(t, n);
841
- });
842
- } finally {
843
- L = !1;
844
- }
845
- z > 0 && Z("load") && e.requestFlush?.(!0);
846
- } else k.close();
847
- }
848
- function rt() {
849
- p.setUrlSanitizer(null);
850
- }
851
- H = q;
852
- const st = c((t) => {
853
- ("click" !== t.type || t.target instanceof Element && t.target.closest("[data-tri-flush]")) && (K("click" === t.type ? "flush-click" : "submit"), e.flush());
854
- }), ot = e.registerBehaviourReader ? e.registerBehaviourReader(function(t) {
855
- const n = o(() => Y("partial-now")) ?? !1, e = o(() => K(t)) ?? !1, i = o(() => Z(t)) ?? !1;
856
- return n || e || i;
857
- }) : null;
858
- return o(function() {
859
- if (!e.registerEventRouter) return;
860
- const t = function(t = {}) {
861
- const n = t.maxPending ?? D;
862
- let e = [], r = null, s = !1;
863
- function o(t, n) {
864
- try {
865
- const { signalsType: e, jsonValue: r } = function(t) {
866
- if ("network_request" === t.name) {
867
- const { name: n, ...e } = t;
868
- return {
869
- signalsType: S.Network,
870
- jsonValue: JSON.stringify(e)
871
- };
872
- }
873
- return {
874
- signalsType: S.External,
875
- jsonValue: JSON.stringify(t)
876
- };
877
- }(n);
878
- if (t(e, r)) return !0;
879
- i.warn("fpSignals", "the module refused a TRI event — dropped", n.name);
880
- } catch (t) {
881
- i.warn("fpSignals", "as threw — event dropped:", t);
882
- }
883
- return !1;
884
- }
885
- function a(n) {
886
- if (0 !== n && t.onHanded) try {
887
- t.onHanded(n);
888
- } catch (t) {
889
- i.warn("fpSignals", "onHanded threw:", t);
890
- }
891
- }
892
- const c = {
893
- route: function(t) {
894
- return !(!function(t) {
895
- return !(!j.includes(t.name) || "fp_signals_load" === t.name && !1 === t.ok);
896
- }(t) || !s && (r ? (a(o(r, t) ? 1 : 0), 0) : (e.length < n ? e.push(t) : function(t) {
897
- const n = N(t);
898
- for (let r = 0; r < e.length; r++) if (N(e[r]) < n) return e.splice(r, 1), e.push(t), void i.warn("fpSignals", "TRI event buffer full — a lower-priority event dropped");
899
- i.warn("fpSignals", "TRI event buffer full — event dropped", t.name);
900
- }(t), 0)));
901
- },
902
- open: function(t) {
903
- if (s) return;
904
- r = t;
905
- const n = e;
906
- e = [];
907
- let i = 0;
908
- for (let e = 0; e < n.length; e++) o(t, n[e]) && i++;
909
- a(i);
910
- },
911
- close: function() {
912
- s = !0, r = null, e = [];
913
- }
914
- };
915
- return t.beforeFlush && (c.beforeFlush = t.beforeFlush), c;
916
- }({
917
- onHanded: W,
918
- beforeFlush: G
919
- });
920
- k = t, T = e.registerEventRouter(t), et();
921
- }), a(async () => {
922
- const n = await ("object" != typeof WebAssembly || null === WebAssembly ? Promise.resolve("no-webassembly") : new Promise(function(t) {
923
- let n = !1;
924
- M = function() {
925
- n || (n = !0, clearTimeout(r), t("timeout"));
926
- };
927
- const r = setTimeout(l(function() {
928
- n || (n = !0, t("timeout"));
929
- }), 3e4);
930
- function s(e) {
931
- n ? null === e && o(() => p.freeResources()) : (n = !0, clearTimeout(r), t(e));
932
- }
933
- p.initialize("https://cdn.incodesmile.com/ml-wasm-kit-release/v2.14.54-pre1-fpsignals10/fpSignals/fpSignalsLib.wasm", "https://cdn.incodesmile.com/ml-wasm-kit-release/v2.14.54-pre1-fpsignals10/fpSignals/fpSignalsLibSimd.wasm", !0, o(() => e.getTabId()) || void 0).then(function() {
934
- s(null);
935
- }, function(t) {
936
- i.warn("fpSignals", "module failed to load:", t), s(function(t) {
937
- return t instanceof b ? t.reason : "instantiate-failed";
938
- }(t));
939
- });
940
- }));
941
- if (null !== n && o(() => k?.close()), g || o(() => function(t) {
942
- const n = null === t, i = {
943
- name: "fp_signals_load",
944
- timestamp: Date.now(),
945
- loadMs: Math.max(0, performance.now() - d),
946
- simd: n && p.usedSimd,
947
- ok: n
948
- };
949
- null !== t && (i.reason = t), e.push(i);
950
- }(n)), null !== n) return;
951
- if (g) return void p.freeResources();
952
- if (m = !0, o(() => p.setHostInfo(e.host.platform, e.host.version)), o(() => p.setUrlSanitizer(function(t) {
953
- return e.sanitizeUrl(t);
954
- })), o(() => {
955
- return p.setCapturePolicy({
956
- v: 2,
957
- element: e.captureElementLevel,
958
- content: r,
959
- ignore: ["[data-tri-ignore]"],
960
- redact: ["[data-tri-redact]"],
961
- redactAttrsAttribute: "data-tri-redact-attrs",
962
- interactive: ["[data-tri-interactive]"],
963
- off: (t = e.collectorSelection) ? $(t) : []
964
- });
965
- var t;
966
- }), o(U), o(it), f && (o(() => p.setBehaviourCollectionEnabled(!0)), A = setInterval(l(function() {
967
- K("interval");
968
- }), 2e3), t(document, "submit", st), t(document, "click", st)), p.hasMethod("gbf") && (E = setInterval(l(nt), 1e3)), !u && !h) return;
969
- if (o(tt), await p.collect(), x = !0, Q(), g) return;
970
- const s = u ? X(S.Device) : null, a = h ? X(S.PID) : null;
971
- y({
972
- pid: a,
973
- device: s
974
- });
975
- }).then(function() {
976
- y(null);
977
- }), function() {
978
- g = !0, M?.(), y(null), H === q && (H = null), null !== A && clearInterval(A), null !== E && clearInterval(E), Q(), n(document, "submit", st), n(document, "click", st), ot?.(), o(() => {
979
- K("stop");
980
- }), o(() => {
981
- Z("stop");
982
- }), o(() => k?.close()), o(() => T?.()), m && o(rt), o(() => p.freeResources());
983
- };
984
- },
985
- layer: "device-fingerprinting",
986
- events: [
987
- "device",
988
- "pid",
989
- "behaviour"
990
- ]
991
- }
992
- };
993
- const et = Object.keys(nt);
994
- const it = [
995
- /^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i,
996
- /^0b[01]+$/i,
997
- /^0o[0-7]+$/i,
998
- /^0x[0-9a-f]+$/i,
999
- /^[a-z][a-z0-9]{1,12}:[A-Za-z0-9+/=_-]{6,}$/i,
1000
- /^[a-z]{2,8}_(?=.*\d)[A-Za-z0-9]{3,}$/,
1001
- /^\d{4,}$/,
1002
- /@/,
1003
- /^[A-Za-z0-9_-]{10,}\.[A-Za-z0-9_-]{5,}\.[A-Za-z0-9_-]{10,}$/,
1004
- /^[A-Za-z0-9_-]{20,}={0,2}$/,
1005
- /^[0-9a-f]{7,}$/i
1006
- ];
1007
- function rt(t) {
1008
- try {
1009
- const n = new URL(t, location.href);
1010
- n.username = "", n.password = "", n.hash = "";
1011
- const e = [...n.searchParams.keys()], i = e.length > 0 ? "?" + e.map((t) => `${encodeURIComponent(t)}=<redacted>`).join("&") : "";
1012
- n.search = "", n.pathname = n.pathname.split("/").map((t) => "" !== t && function(t) {
1013
- for (const n of it) if (n.test(t)) return !0;
1014
- return !1;
1015
- }(t) ? ":param" : t).join("/");
1016
- const r = n.origin + n.pathname + i;
1017
- return r.length > 2048 ? r.slice(0, 2048) : r;
1018
- } catch {
1019
- return "";
1020
- }
1021
- }
1022
- function st() {
1023
- const t = {};
1024
- for (const n of et) t[n] = ct(n, void 0, !0);
1025
- return t;
1026
- }
1027
- function ot(t) {
1028
- const n = {};
1029
- for (const e of et) n[e] = ct(e, void 0, t[nt[e].layer] ?? !1);
1030
- return n;
1031
- }
1032
- function at(t) {
1033
- for (const n of Object.keys(t)) -1 === et.indexOf(n) && i.fatal("warn", "SDK", `collectors has an unknown key '${n}' — ignored. Known collectors: ${et.join(", ")}.`);
1034
- const n = {};
1035
- for (const e of et) {
1036
- const i = t[e];
1037
- n[e] = ct(e, i, i?.enabled ?? !1);
1038
- }
1039
- return n;
1040
- }
1041
- function ct(t, n, e) {
1042
- const i = nt[t]?.events ?? [];
1043
- if (0 === i.length) return { enabled: e };
1044
- const r = n?.events, s = {};
1045
- for (const t of i) s[t] = { enabled: r?.[t] ?? !0 };
1046
- return {
1047
- enabled: e,
1048
- events: s
1049
- };
1050
- }
1051
- function lt(t) {
1052
- if (!t) return null;
1053
- const n = t.split(".")[1], e = atob(n.replace(/-/g, "+").replace(/_/g, "/"));
1054
- return JSON.parse(e);
1055
- }
1056
- const ut = function(t, n = 30) {
1057
- if (!t) return !0;
1058
- const e = lt(t);
1059
- return !e || "number" != typeof e.exp || 1e3 * e.exp <= Date.now() + 1e3 * n;
1060
- };
1061
- async function ht(t, n) {
1062
- return globalThis.navigator && "locks" in globalThis.navigator && "request" in globalThis.navigator.locks && "query" in globalThis.navigator.locks ? navigator.locks.request(t, { mode: "exclusive" }, async () => a(n)) : a(n);
1063
- }
1064
- const ft = "__tri";
1065
- const dt = `${ft}_activity_token`;
1066
- const pt = `${ft}_activity_id`;
1067
- const yt = `${ft}_activity_status`;
1068
- const vt = "__tri_activity_lock";
1069
- var gt = class {
1070
- constructor(t) {
1071
- this.context = t, this.l = null, this.u = null, this.h = null, this.p = null, this.m = null, this.k = !1;
1072
- }
1073
- getToken() {
1074
- return this.l;
1075
- }
1076
- getActivityId() {
1077
- return this.u ?? "";
1078
- }
1079
- isActive() {
1080
- return "ACTIVE" === this.h && null !== this.l;
1081
- }
1082
- async start() {
1083
- return this.k = !0, this.p || (this.p = this.S()), this.p;
1084
- }
1085
- async stop() {
1086
- const t = this.T();
1087
- this.m = t;
1088
- try {
1089
- await t;
1090
- } finally {
1091
- this.m === t && (this.m = null);
1092
- }
1093
- }
1094
- async T() {
1095
- this.k = !1, this.h = "INACTIVE", this._(null), this.p = null, this.l && await this.context.stopActivity(), this.I(null);
1096
- }
1097
- async refresh() {
1098
- if (!this.k) return;
1099
- const t = this.l;
1100
- await ht(vt, async () => {
1101
- if (this.l && this.l !== t && !ut(this.l) && "ACTIVE" === this.h) return;
1102
- const n = this.A();
1103
- n && n.token !== t && !ut(n.token) && "ACTIVE" === n.activityStatus ? this.I(n) : (this.C(), await this.R());
1104
- });
1105
- }
1106
- async S() {
1107
- try {
1108
- if (this.m && await this.m, this.l && !ut(this.l)) return;
1109
- await ht(vt, async () => {
1110
- await this.R();
1111
- });
1112
- } finally {
1113
- this.p = null;
1114
- }
1115
- }
1116
- async R() {
1117
- const t = this.A();
1118
- if (t && !ut(t.token) && "ACTIVE" === t.activityStatus) return void this.I(t);
1119
- t && this.C();
1120
- const n = await this.context.startActivity();
1121
- if (!n.ok) return;
1122
- if (!n.data.token) return;
1123
- const e = n.data;
1124
- this.I(e), this.$(e);
1125
- }
1126
- A() {
1127
- const [t, n, e] = [
1128
- d.get(dt),
1129
- d.get(pt),
1130
- d.get(yt)
1131
- ];
1132
- return t && n && e ? {
1133
- token: t,
1134
- activityId: n,
1135
- activityStatus: e
1136
- } : ((t || n || e) && this.C(), null);
1137
- }
1138
- $(t) {
1139
- d.set(dt, t.token), d.set(pt, t.activityId), d.set(yt, t.activityStatus);
1140
- }
1141
- C() {
1142
- this._(null), this.I(null);
1143
- }
1144
- _(t) {
1145
- if (!t) return d.remove(dt), d.remove(pt), void d.remove(yt);
1146
- d.set(dt, t.token), d.set(pt, t.activityId), d.set(yt, t.activityStatus);
1147
- }
1148
- I(t) {
1149
- if (!t) return this.l = null, this.u = null, void (this.h = null);
1150
- var n;
1151
- (n = t.activityId) && g(function(t) {
1152
- t.activityId !== n && (t.previousActivityId = t.activityId, t.activityId = n, t.activities += 1);
1153
- }), this.l = t.token, this.u = t.activityId, this.h = t.activityStatus;
1154
- }
1155
- };
1156
- const wt = [
1157
- 401,
1158
- 403,
1159
- 409
1160
- ];
1161
- const mt = Object.freeze({ "fp-signals": "/events/capture/fp-signals" });
1162
- function bt(t) {
1163
- return "fp_signals" === t.name || "fp_signals_load" === t.name && !1 === t.ok ? "fp-signals" : null;
1164
- }
1165
- const kt = new Array(256);
1166
- for (let t = 0; t < 256; t++) kt[t] = (t + 256).toString(16).slice(1);
1167
- const St = /* @__PURE__ */ new Uint8Array(16);
1168
- function Tt(t) {
1169
- return kt[t[0]] + kt[t[1]] + kt[t[2]] + kt[t[3]] + "-" + kt[t[4]] + kt[t[5]] + "-" + kt[t[6]] + kt[t[7]] + "-" + kt[t[8]] + kt[t[9]] + "-" + kt[t[10]] + kt[t[11]] + kt[t[12]] + kt[t[13]] + kt[t[14]] + kt[t[15]];
1170
- }
1171
- function _t() {
1172
- return crypto.randomUUID();
1173
- }
1174
- function It() {
1175
- return crypto.getRandomValues(St), St[6] = 15 & St[6] | 64, St[8] = 63 & St[8] | 128, Tt(St);
1176
- }
1177
- function At() {
1178
- for (let t = 0; t < 16; t++) St[t] = 256 * Math.random() | 0;
1179
- return St[6] = 15 & St[6] | 64, St[8] = 63 & St[8] | 128, Tt(St);
1180
- }
1181
- const Et = function() {
1182
- if ("undefined" != typeof crypto) {
1183
- if ("function" == typeof crypto.randomUUID) return _t;
1184
- if ("function" == typeof crypto.getRandomValues) return It;
1185
- }
1186
- return At;
1187
- }();
1188
- function Ct() {
1189
- return Et();
1190
- }
1191
- var Rt = class {
1192
- constructor(t, n) {
1193
- this.M = t, this.P = n, this.L = [], this.F = null, this.B = [], this.j = null, this.k = !1, this.D = !0, this.O = 0, this.q = 0, this.U = 0, this.N = null, this.H = !1, this.J = t.flush.intervalMs;
1194
- }
1195
- push(t) {
1196
- this.k ? this.N && this.V(this.N, t) || (null !== bt(t) ? (this.K(t), this.Z()) : i.warn("Transport", "event has no capture route — dropped", t.name)) : i.warn("Transport", "push() called before start() — event dropped");
1197
- }
1198
- setEventRouter(t) {
1199
- this.N = t;
1200
- }
1201
- getEventRouter() {
1202
- return this.N;
1203
- }
1204
- requestFlush(t) {
1205
- if (this.k && this.D) return t && !this.H && this.P.isActivityActive() ? (h(this.F), this.F = null, void this.flush("capacity")) : void this.G();
1206
- }
1207
- W(t) {
1208
- const n = this.N;
1209
- n?.beforeFlush && this.holdCapacityFlush(() => {
1210
- try {
1211
- n.beforeFlush?.(t);
1212
- } catch (t) {
1213
- i.warn("Transport", "event router beforeFlush threw:", t);
1214
- }
1215
- });
1216
- }
1217
- V(t, n) {
1218
- try {
1219
- return !0 === t.route(n);
1220
- } catch (t) {
1221
- return i.warn("Transport", "event router threw:", t), !1;
1222
- }
1223
- }
1224
- K(t) {
1225
- this.L.length < this.X() ? this.L.push(t) : this.Y(t);
1226
- }
1227
- holdCapacityFlush(t) {
1228
- const n = this.H;
1229
- this.H = !0;
1230
- try {
1231
- t();
1232
- } finally {
1233
- this.H = n;
1234
- }
1235
- }
1236
- Z() {
1237
- if (this.D) return this.L.length >= this.M.flush.size && !this.H ? (h(this.F), this.F = null, void this.flush("capacity")) : void this.G();
1238
- }
1239
- flush(t) {
1240
- if (this.k && this.P.isActivityActive()) try {
1241
- if (this.W(t ?? "interval"), "lifecycle" === t) return void this.tt();
1242
- if (0 === this.L.length) return;
1243
- if ("submit" === t && !this.D) return;
1244
- const n = "submit" === t;
1245
- for (const e of this.nt(!1, n)) {
1246
- const r = this.et(e, t, n ? this.it() : void 0);
1247
- r && (n ? this.rt(r) : this.P.ingest(r, !1)).then((t) => this.st(t, r)).catch(() => {
1248
- i.warn("Transport", "ingest threw unexpectedly — batch dropped");
1249
- });
1250
- }
1251
- this.L.length > 0 && this.G();
1252
- } catch (t) {
1253
- i.warn("Transport", "flush() threw unexpectedly:", t);
1254
- }
1255
- }
1256
- start() {
1257
- this.k || (this.k = !0, this.D = "undefined" == typeof navigator || navigator.onLine);
1258
- }
1259
- stop() {
1260
- if (!this.k) return Promise.resolve();
1261
- h(this.F), this.F = null, h(this.j), this.j = null, this.P.isActivityActive() && this.W("lifecycle");
1262
- const t = this.tt();
1263
- return this.k = !1, this.B = [], t;
1264
- }
1265
- onConnectionChange() {
1266
- const t = "undefined" == typeof navigator || navigator.onLine;
1267
- if (t !== this.D) {
1268
- if (this.D = t, !this.D) return h(this.F), this.F = null, h(this.j), void (this.j = null);
1269
- (this.L.length > 0 || this.N?.beforeFlush) && this.G(), this.B.length > 0 && this.ot();
1270
- }
1271
- }
1272
- G() {
1273
- this.k && this.D && null === this.F && (this.F = u(() => {
1274
- this.F = null, this.flush("interval");
1275
- }, this.J));
1276
- }
1277
- ot() {
1278
- this.k && this.D && null === this.j && (this.j = u(() => {
1279
- this.j = null, this.ct();
1280
- }, this.J));
1281
- }
1282
- ct() {
1283
- if (!this.k || !this.D || 0 === this.B.length || !this.P.isActivityActive()) return;
1284
- const t = this.B.shift();
1285
- this.P.ingest(t.batch, !1).then((n) => this.lt(n, t)).catch(() => {
1286
- i.warn("Transport", "retry drain ingest threw unexpectedly — batch dropped"), this.B.length > 0 && this.ot();
1287
- });
1288
- }
1289
- ut(t, n) {
1290
- this.B.length >= 5 && (this.B.shift(), i.warn("Transport", "retry queue full — oldest batch evicted")), this.B.push({
1291
- batch: t,
1292
- attempts: n
1293
- }), this.ot();
1294
- }
1295
- st(t, n) {
1296
- this.k && this.P.isActivityActive() && (t.ok ? this.ht() : this.ft(t) && this.ut(n, 1));
1297
- }
1298
- lt(t, n) {
1299
- if (this.k && this.P.isActivityActive()) {
1300
- if (t.ok) return this.ht(), void (this.B.length > 0 && this.ot());
1301
- if (this.ft(t)) {
1302
- if (n.attempts >= 3) return this.dt(), i.warn("Transport", "batch dropped after MAX_RETRY_ATTEMPTS", n.batch.batchId), void (this.B.length > 0 && this.ot());
1303
- this.dt(), this.ut(n.batch, n.attempts + 1);
1304
- } else this.B.length > 0 && this.ot();
1305
- }
1306
- }
1307
- dt() {
1308
- this.O++, this.O % this.M.flush.backoffFailureThreshold === 0 && (this.J = Math.min(2 * this.J, this.M.flush.maxIntervalMs));
1309
- }
1310
- ht() {
1311
- this.O = 0, this.J = this.M.flush.intervalMs;
1312
- }
1313
- X() {
1314
- return this.M.queue.size * (this.D ? 1 : 2);
1315
- }
1316
- async tt() {
1317
- if (!this.P.isActivityActive()) return Promise.resolve();
1318
- if (!this.D) return;
1319
- const t = [];
1320
- let n = this.it();
1321
- for (const e of this.nt(!0, !0)) {
1322
- const r = this.et(e, "lifecycle", n);
1323
- r && (n -= $t(r.events), t.push(this.rt(r).then((t) => this.st(t, r)).catch(() => {
1324
- i.warn("Transport", "lifecycle ingest threw — batch dropped");
1325
- })));
1326
- }
1327
- const e = [];
1328
- for (const r of this.B) {
1329
- const s = $t(r.batch.events);
1330
- s > n ? e.push(r) : (n -= s, t.push(this.rt(r.batch).then((t) => this.lt(t, r)).catch(() => {
1331
- i.warn("Transport", "lifecycle retry ingest threw — batch dropped");
1332
- })));
1333
- }
1334
- return this.B = e, Promise.allSettled(t).then(() => {});
1335
- }
1336
- it() {
1337
- return Math.max(0, 49152 - this.U);
1338
- }
1339
- rt(t) {
1340
- const n = $t(t.events);
1341
- return this.U += n, this.P.ingest(t, !0).finally(() => {
1342
- this.U -= n;
1343
- });
1344
- }
1345
- Y(t) {
1346
- const n = N(t);
1347
- for (let e = 0; e < this.L.length; e++) if (N(this.L[e]) < n) {
1348
- for (let t = e; t < this.L.length - 1; t++) this.L[t] = this.L[t + 1];
1349
- this.L.length -= 1, this.L.push(t);
1350
- return;
1351
- }
1352
- }
1353
- et(t, n, e) {
1354
- const i = "lifecycle" === n, r = this.yt(t, i, i ? 200 : this.M.flush.size, e);
1355
- return 0 === r.length ? null : {
1356
- activityId: "",
1357
- batchId: Ct(),
1358
- batchSequence: this.q++,
1359
- clientTimestamp: Date.now(),
1360
- schemaVersion: "0.1.0",
1361
- sdkVersion: "0.5.1",
1362
- sdkPlatform: "web",
1363
- tabId: this.P.getTabId(),
1364
- events: r
1365
- };
1366
- }
1367
- yt(t, n, e, i) {
1368
- const r = /* @__PURE__ */ new Set();
1369
- let s = 0;
1370
- for (let o = 0; o < this.L.length && r.size < e; o++) {
1371
- const e = n ? this.L.length - 1 - o : o, a = this.L[e];
1372
- if (bt(a) === t) {
1373
- if (void 0 !== i) {
1374
- const t = Mt(a);
1375
- if (s + t > i) continue;
1376
- s += t;
1377
- }
1378
- r.add(e);
1379
- }
1380
- }
1381
- if (0 === r.size) return [];
1382
- const o = [], a = [];
1383
- for (let t = 0; t < this.L.length; t++) r.has(t) ? o.push(this.L[t]) : a.push(this.L[t]);
1384
- return this.L = a, o;
1385
- }
1386
- nt(t, n = !1) {
1387
- const e = [];
1388
- for (let n = 0; n < this.L.length; n++) {
1389
- const i = bt(this.L[t ? this.L.length - 1 - n : n]);
1390
- null === i || e.includes(i) || e.push(i);
1391
- }
1392
- if (n) {
1393
- const t = e.indexOf("fp-signals");
1394
- t > 0 && (e.splice(t, 1), e.unshift("fp-signals"));
1395
- }
1396
- return e;
1397
- }
1398
- ft(t) {
1399
- if (t.ok) return !1;
1400
- switch (t.kind) {
1401
- case "timeout":
1402
- case "server":
1403
- case "rate_limited":
1404
- case "network": return !0;
1405
- default: return !1;
1406
- }
1407
- }
1408
- };
1409
- function $t(t) {
1410
- let n = 0;
1411
- for (let e = 0; e < t.length; e++) n += Mt(t[e]);
1412
- return n;
1413
- }
1414
- function Mt(t) {
1415
- try {
1416
- return JSON.stringify(t).length + 1;
1417
- } catch {
1418
- return 0;
1419
- }
1420
- }
1421
- const Pt = "tri:bcast:";
1422
- const xt = "function" == typeof BroadcastChannel ? BroadcastChannel : function() {
1423
- if ("undefined" == typeof Storage || "undefined" == typeof window) return !1;
1424
- try {
1425
- const t = "__tri_bcast_probe__";
1426
- localStorage.setItem(t, "1");
1427
- const n = "1" === localStorage.getItem(t);
1428
- return localStorage.removeItem(t), n;
1429
- } catch {
1430
- return !1;
1431
- }
1432
- }() ? class {
1433
- constructor(t) {
1434
- this.seq = 0, this.closed = !1, this.listeners = /* @__PURE__ */ new Set(), this.onStorageEvent = (t) => {
1435
- if (this.closed) return;
1436
- if (!t.key || !t.key.startsWith(`${Pt}${this.channelName}:`)) return;
1437
- if (null === t.newValue) return;
1438
- let n;
1439
- o(() => d.remove(t.key));
1440
- try {
1441
- n = JSON.parse(t.newValue);
1442
- } catch {
1443
- return;
1444
- }
1445
- const e = { data: n };
1446
- for (const t of this.listeners) o(() => t(e));
1447
- }, this.channelName = t, this.senderId = Ct(), window.addEventListener("storage", this.onStorageEvent);
1448
- }
1449
- postMessage(t) {
1450
- if (this.closed) return;
1451
- const n = `${Pt}${this.channelName}:${this.senderId}:${this.seq++}`;
1452
- o(() => {
1453
- d.set(n, t), d.remove(n);
1454
- });
1455
- }
1456
- addEventListener(t, n) {
1457
- this.listeners.add(n);
1458
- }
1459
- removeEventListener(t, n) {
1460
- this.listeners.delete(n);
1461
- }
1462
- close() {
1463
- this.closed || (this.closed = !0, window.removeEventListener("storage", this.onStorageEvent), this.listeners.clear());
1464
- }
1465
- } : class {
1466
- constructor(t) {
1467
- i.warn("BroadcastChannel", "BroadcastChannel is unavailable and localStorage is not writable in this context. Cross-tab discovery is disabled; tab count will always be reported as 1.");
1468
- }
1469
- postMessage(t) {}
1470
- addEventListener(t, n) {}
1471
- removeEventListener(t, n) {}
1472
- close() {}
1473
- };
1474
- const zt = "__tri_tabId";
1475
- var Lt = class {
1476
- constructor(t) {
1477
- this.context = t, this.vt = "", this.k = !1, this.gt = null, this.wt = null, this.bt = null, this.kt = /* @__PURE__ */ new Map(), this.St = -1, this.Tt = null;
1478
- }
1479
- async start() {
1480
- this.k || (this.k = !0, this.getTabId(), this._t(), this.It({
1481
- type: "hello",
1482
- tabId: this.vt,
1483
- ts: Date.now()
1484
- }), this.At(), this.Et("active"), this.Ct());
1485
- }
1486
- stop() {
1487
- this.k && (this.k = !1, this.Et("inactive"), this.It({
1488
- type: "bye",
1489
- tabId: this.vt,
1490
- ts: Date.now()
1491
- }), this.Rt(this.$t()), this.Mt(), this.Pt(), this.xt());
1492
- }
1493
- getTabId() {
1494
- return this.vt || (this.vt = this.zt()), this.vt;
1495
- }
1496
- queryTabsNumber() {
1497
- return this.kt.size + 1;
1498
- }
1499
- _t() {
1500
- try {
1501
- this.gt = new xt("__tri_tab_channel"), this.Tt = this.Lt.bind(this), this.gt.addEventListener("message", this.Tt);
1502
- } catch (t) {
1503
- i.warn("TabManager", "failed to open broadcast channel:", t);
1504
- }
1505
- }
1506
- xt() {
1507
- try {
1508
- if (!this.gt) return;
1509
- this.Tt && this.gt.removeEventListener("message", this.Tt), this.gt.close();
1510
- } catch {} finally {
1511
- this.gt = null, this.Tt = null;
1512
- }
1513
- }
1514
- At() {
1515
- this.wt = setInterval(() => {
1516
- const t = Date.now();
1517
- this.It({
1518
- type: "heartbeat",
1519
- tabId: this.vt,
1520
- ts: t
1521
- });
1522
- }, 1e3);
1523
- }
1524
- Mt() {
1525
- null != this.wt && (clearInterval(this.wt), this.wt = null);
1526
- }
1527
- Ct() {
1528
- null != this.bt && clearTimeout(this.bt), this.bt = setTimeout(() => {
1529
- this.bt = null;
1530
- const t = this.$t() + 1;
1531
- t !== this.St && (this.St = t, this.Rt(t));
1532
- }, 1e3);
1533
- }
1534
- Pt() {
1535
- null != this.bt && (clearTimeout(this.bt), this.bt = null);
1536
- }
1537
- It(t) {
1538
- try {
1539
- if (!this.gt) return;
1540
- this.gt.postMessage(t);
1541
- } catch {
1542
- i.warn("TabManager", "failed to broadcast message:", t);
1543
- }
1544
- }
1545
- Lt(t) {
1546
- const { type: n, tabId: e } = t.data;
1547
- if (e === this.vt) return;
1548
- const i = Date.now();
1549
- "hello" === n ? (this.It({
1550
- type: "ack",
1551
- tabId: this.vt,
1552
- ts: i,
1553
- to: e
1554
- }), this.kt.set(e, i)) : "heartbeat" === n || "ack" === n ? this.kt.set(e, i) : "bye" === n && this.kt.delete(e);
1555
- }
1556
- Rt(t) {
1557
- this.context.events.count && this.context.push({
1558
- name: "tab",
1559
- type: "count",
1560
- tabId: this.vt,
1561
- timestamp: Date.now(),
1562
- ts: performance.now(),
1563
- value: t
1564
- });
1565
- }
1566
- Et(t) {
1567
- this.context.events.state && this.context.push({
1568
- name: "tab",
1569
- type: "state",
1570
- tabId: this.vt,
1571
- timestamp: Date.now(),
1572
- ts: performance.now(),
1573
- value: t
1574
- });
1575
- }
1576
- zt() {
1577
- const t = p.get(zt);
1578
- if (t) return t;
1579
- const n = Ct();
1580
- return p.set(zt, n), n;
1581
- }
1582
- $t(t = Date.now()) {
1583
- let n = 0;
1584
- for (const [e, i] of this.kt.entries()) t - i >= 3e3 ? this.kt.delete(e) : n++;
1585
- return n;
1586
- }
1587
- };
1588
- const Ft = globalThis.CompressionStream;
1589
- const Bt = globalThis.Response;
1590
- const jt = globalThis.Blob;
1591
- const Dt = new TextEncoder();
1592
- let Ot = null;
1593
- async function qt(t) {
1594
- const n = await async function(t) {
1595
- if ("function" != typeof Ft) return null;
1596
- try {
1597
- const n = Dt.encode(t), e = new jt([n]).stream().pipeThrough(new Ft("gzip"));
1598
- return await new Bt(e).arrayBuffer();
1599
- } catch (t) {
1600
- return i.warn("compression", "Native gzip failed:", t), null;
1601
- }
1602
- }(t);
1603
- return null !== n ? n : async function(t) {
1604
- try {
1605
- const n = await function() {
1606
- if (null === Ot) {
1607
- const t = function(t, n = 1e4) {
1608
- let e = null;
1609
- const r = new Promise((t) => {
1610
- e = u(() => {
1611
- i.warn("import", `Import timed out after ${n}ms`), t(null);
1612
- }, n);
1613
- }), s = Promise.resolve().then(t).catch((t) => (i.warn("import", "Import failed:", t), null));
1614
- return Promise.race([s, r]).finally(() => {
1615
- h(e);
1616
- });
1617
- }(() => import("./browser-pQZA35G2-DxIBykpe.esm.js"), 1e4);
1618
- Ot = t, t.then((n) => {
1619
- null === n && u(() => {
1620
- Ot === t && (Ot = null);
1621
- }, 1e4);
1622
- });
1623
- }
1624
- return Ot;
1625
- }();
1626
- if (null === n) return null;
1627
- const { gzipSync: e } = n, r = e(Dt.encode(t));
1628
- return r.buffer.slice(r.byteOffset, r.byteOffset + r.byteLength);
1629
- } catch (t) {
1630
- return i.warn("compression", "fflate gzip failed:", t), null;
1631
- }
1632
- }(t);
1633
- }
1634
- function Ut(t, n) {
1635
- const e = [JSON.stringify(t)];
1636
- for (let t = 0; t < n.length; t++) try {
1637
- e.push(JSON.stringify(n[t]));
1638
- } catch {}
1639
- return e.join("\n");
1640
- }
1641
- function Nt(t) {
1642
- const n = { Accept: "application/json" };
1643
- return t?.hasBody && ("json" === t.contentType ? n["Content-Type"] = "application/json" : "ndjson" === t.contentType && (n["Content-Type"] = "application/x-ndjson"), "gzip" === t.contentEncoding && (n["Content-Encoding"] = "gzip")), t?.token && (n.Authorization = `Bearer ${t.token}`), t?.profileId && (n["x-profile-id"] = t.profileId), t?.api?.version && (n["x-api-version"] = t.api.version), t?.customHeaders && Object.entries(t.customHeaders).forEach(([t, e]) => {
1644
- n[t] = e;
1645
- }), n;
1646
- }
1647
- const Ht = "function" == typeof globalThis.fetch ? globalThis.fetch.bind(globalThis) : void 0;
1648
- function Jt(t) {
1649
- "undefined" != typeof document && "function" == typeof globalThis.fetch || i.warn("FalconService", "createFalconServiceManager called in a non-browser environment — all requests will resolve with { ok: false, kind: 'network' }.");
1650
- const n = function(t) {
1651
- const n = t?.timeout, e = t?.baseUrl ?? "", i = t?.api;
1652
- async function r(t, r, s) {
1653
- if (void 0 === Ht) return {
1654
- ok: !1,
1655
- kind: "network"
1656
- };
1657
- const o = e ? `${e}${r}` : r, a = new AbortController();
1658
- let c = null, l = !1;
1659
- c = u(() => {
1660
- l = !0, a.abort();
1661
- }, n);
1662
- const f = s?.signal;
1663
- let d, p = () => {};
1664
- if (f) if (f.aborted) a.abort();
1665
- else {
1666
- const t = () => a.abort();
1667
- f.addEventListener("abort", t, { once: !0 }), p = () => f.removeEventListener("abort", t);
1668
- }
1669
- if (null != s && "body" in s && null != s.body) {
1670
- const t = function(t) {
1671
- if (null == t) return {
1672
- ok: !0,
1673
- body: void 0
1674
- };
1675
- if ("string" == typeof t || t instanceof ArrayBuffer || ArrayBuffer.isView(t) || t instanceof Blob || t instanceof FormData || t instanceof URLSearchParams || t instanceof ReadableStream) return {
1676
- ok: !0,
1677
- body: t
1678
- };
1679
- try {
1680
- return {
1681
- ok: !0,
1682
- body: JSON.stringify(t)
1683
- };
1684
- } catch {
1685
- return { ok: !1 };
1686
- }
1687
- }(s.body);
1688
- if (!t.ok) return h(c), p(), {
1689
- ok: !1,
1690
- kind: "serialize"
1691
- };
1692
- d = t.body;
1693
- }
1694
- try {
1695
- const n = await Ht(o, {
1696
- method: t,
1697
- headers: Nt({
1698
- token: s?.token,
1699
- profileId: s?.profileId,
1700
- contentType: s?.contentType,
1701
- contentEncoding: s?.contentEncoding,
1702
- api: i,
1703
- hasBody: void 0 !== d,
1704
- customHeaders: s?.customHeaders
1705
- }),
1706
- body: d,
1707
- signal: a.signal,
1708
- keepalive: s?.keepalive
1709
- });
1710
- if (!n.ok) return 429 === (y = n.status) ? {
1711
- ok: !1,
1712
- kind: "rate_limited",
1713
- status: y
1714
- } : y >= 400 && y < 500 ? {
1715
- ok: !1,
1716
- kind: "client",
1717
- status: y
1718
- } : {
1719
- ok: !1,
1720
- kind: "server",
1721
- status: y
1722
- };
1723
- if (204 === n.status) return {
1724
- ok: !0,
1725
- data: void 0,
1726
- status: 204
1727
- };
1728
- try {
1729
- return {
1730
- ok: !0,
1731
- data: await n.json(),
1732
- status: n.status
1733
- };
1734
- } catch {
1735
- return a.signal.aborted ? l ? {
1736
- ok: !1,
1737
- kind: "timeout"
1738
- } : {
1739
- ok: !1,
1740
- kind: "abort"
1741
- } : {
1742
- ok: !1,
1743
- kind: "parse",
1744
- status: n.status
1745
- };
1746
- }
1747
- } catch {
1748
- return l ? {
1749
- ok: !1,
1750
- kind: "timeout"
1751
- } : a.signal.aborted ? {
1752
- ok: !1,
1753
- kind: "abort"
1754
- } : {
1755
- ok: !1,
1756
- kind: "network"
1757
- };
1758
- } finally {
1759
- h(c), p();
1760
- }
1761
- var y;
1762
- }
1763
- return {
1764
- post: async function(t, n) {
1765
- return r("POST", t, n);
1766
- },
1767
- get: async function(t, n) {
1768
- return r("GET", t, n);
1769
- }
1770
- };
1771
- }({
1772
- baseUrl: `${t.api.url}/api/v1`,
1773
- timeout: 1e4,
1774
- api: { version: t.api.version }
1775
- }), e = function(t) {
1776
- const { getToken: n, refresh: e } = t;
1777
- let r = null;
1778
- return { withAuth: async function(t, s) {
1779
- if (r) {
1780
- const n = await r;
1781
- if (n) return t(n);
1782
- }
1783
- const o = n() ?? "", a = await t(o);
1784
- if ((c = a).ok || !("rejected" === c.kind || "client" === c.kind && wt.includes(c.status)) || !1 === s?.refreshable) return a;
1785
- var c;
1786
- const l = await (r || (r = async function() {
1787
- try {
1788
- return await e(), n();
1789
- } catch (t) {
1790
- return i.warn("AuthMiddleware", "auth refresh failed", t), null;
1791
- }
1792
- }().finally(() => {
1793
- r = null;
1794
- }), r));
1795
- return l && l !== o ? t(l) : a;
1796
- } };
1797
- }(t), r = () => ({ profileId: t.getProfileId() ?? void 0 });
1798
- return { api: {
1799
- ingest: async function(i, s) {
1800
- return e.withAuth(async (e) => {
1801
- const { events: o, ...a } = i, c = {
1802
- ...a,
1803
- activityId: t.getActivityId()
1804
- };
1805
- let l, u = !1;
1806
- try {
1807
- if (s) l = Ut(c, o);
1808
- else {
1809
- const t = await async function(t, n) {
1810
- const e = Ut(t, n), i = await qt(e);
1811
- return i ? {
1812
- type: "gzip",
1813
- body: i
1814
- } : {
1815
- type: "ndjson",
1816
- body: e
1817
- };
1818
- }(c, o);
1819
- l = t.body, u = "gzip" === t.type;
1820
- }
1821
- } catch {
1822
- return {
1823
- ok: !1,
1824
- kind: "serialize"
1825
- };
1826
- }
1827
- const h = await n.post(function(t) {
1828
- const n = t.length > 0 ? bt(t[0]) : null;
1829
- return mt[n ?? "fp-signals"];
1830
- }(o), {
1831
- body: l,
1832
- token: e,
1833
- keepalive: s,
1834
- contentType: "ndjson",
1835
- contentEncoding: u ? "gzip" : void 0,
1836
- ...r()
1837
- });
1838
- return function(t) {
1839
- return t.ok && !0 === t.data?.malformedBatch;
1840
- }(h) ? {
1841
- ok: !1,
1842
- kind: "rejected",
1843
- status: h.status
1844
- } : h;
1845
- }, { refreshable: !s });
1846
- },
1847
- reportEvent: async function(t) {
1848
- return e.withAuth((e) => n.post("/events/report-event", {
1849
- body: t,
1850
- token: e,
1851
- contentType: "json",
1852
- ...r()
1853
- }));
1854
- },
1855
- startActivity: async function() {
1856
- return n.post("/events/start-activity", {
1857
- token: t.getSdkToken(),
1858
- ...r()
1859
- });
1860
- },
1861
- stopActivity: async function() {
1862
- return e.withAuth((t) => n.post("/events/end-activity", {
1863
- token: t,
1864
- keepalive: !0,
1865
- ...r()
1866
- }), { refreshable: !1 });
1867
- },
1868
- collectionStatus: async function() {
1869
- return n.get("/sdk/collection-status", {
1870
- token: t.getSdkToken(),
1871
- ...r()
1872
- });
1873
- },
1874
- linkInterview: async function(i) {
1875
- const s = t.getToken();
1876
- return s && !ut(s) || await t.refresh(), e.withAuth((t) => n.post("/events/link-interview", {
1877
- token: t,
1878
- contentType: "json",
1879
- ...r(),
1880
- customHeaders: { "X-Incode-Hardware-Id": i }
1881
- }), { refreshable: !1 });
1882
- }
1883
- } };
1884
- }
1885
- var Vt = class {
1886
- constructor(t) {
1887
- this.context = t;
1888
- }
1889
- stop() {}
1890
- async report(t, n) {
1891
- const e = {
1892
- name: t,
1893
- metadata: n,
1894
- timestamp: Date.now(),
1895
- activityId: this.context.getActivityId() ?? ""
1896
- };
1897
- try {
1898
- const r = await this.context.reportEvent(e);
1899
- if (r.ok) return r;
1900
- i.warn("EventReport", "Failed to report event:", t, n, "with result:", r);
1901
- } catch (e) {
1902
- i.warn("EventReport", "Failed to report event:", t, n, "with error:", e);
1903
- }
1904
- }
1905
- };
1906
- async function Kt(e, r) {
1907
- const { collectors: s, sdk: a } = e;
1908
- let l = null, u = null, h = null, f = null;
1909
- try {
1910
- l = Jt({
1911
- api: {
1912
- version: a.api.version,
1913
- url: a.api.url
1914
- },
1915
- getSdkToken: () => a.token,
1916
- getProfileId: () => r.getProfileId(),
1917
- getToken: () => u?.getToken() ?? null,
1918
- refresh: async () => u?.refresh() ?? Promise.resolve(),
1919
- getActivityId: () => u?.getActivityId() ?? ""
1920
- });
1921
- const e = await l.api.collectionStatus();
1922
- if (!e.ok || !0 !== e.data.eventsCollectionEnabled) return { status: "collection-disabled" };
1923
- u = new gt({
1924
- startActivity: () => l.api.startActivity(),
1925
- stopActivity: () => l.api.stopActivity()
1926
- }), h = new Rt(F, {
1927
- ingest: (t, n) => l.api.ingest(t, n),
1928
- getTabId: () => f?.getTabId() ?? "unknown",
1929
- isActivityActive: () => u?.isActive() ?? !1
1930
- });
1931
- const d = s.tab;
1932
- f = new Lt({
1933
- push: (t) => h?.push(t),
1934
- events: {
1935
- state: d.enabled && d.events.state.enabled,
1936
- count: d.enabled && d.events.count.enabled
1937
- }
1938
- });
1939
- const p = /* @__PURE__ */ new Set();
1940
- try {
1941
- p.add(new URL(a.api.url).origin);
1942
- } catch {}
1943
- const y = function(t, n, e = "off") {
1944
- const i = /* @__PURE__ */ new Map(), r = /* @__PURE__ */ new Set(), s = {
1945
- ...t,
1946
- registerBehaviourReader: function(t) {
1947
- return r.add(t), function() {
1948
- r.delete(t);
1949
- };
1950
- },
1951
- collectorSelection: n
1952
- };
1953
- function a(t) {
1954
- if (i.has(t)) return;
1955
- const r = nt[t];
1956
- if (!r || !function(t, n) {
1957
- return n[t]?.enabled ?? !1;
1958
- }(t, n)) return;
1959
- if (q.includes(t) && !function(t) {
1960
- return !0 === t.fpsignals?.enabled;
1961
- }(n)) return;
1962
- const o = n[t], a = r.create(s, e, o && "events" in o ? o.events : void 0);
1963
- i.set(t, a);
1964
- }
1965
- return {
1966
- start: a,
1967
- stopCollector: function(t) {
1968
- const n = i.get(t);
1969
- n && (n(), i.delete(t));
1970
- },
1971
- stop: function() {
1972
- for (const [, t] of i) t();
1973
- i.clear();
1974
- },
1975
- isRunning: function(t) {
1976
- return i.has(t);
1977
- },
1978
- autocapture: function() {
1979
- a("fpsignals");
1980
- for (const t of et) a(t);
1981
- },
1982
- readBehaviour: function(t) {
1983
- let n = !1;
1984
- for (const e of r) o(() => e(t)) && (n = !0);
1985
- return n;
1986
- }
1987
- };
1988
- }({
1989
- push: (t) => h?.push(t),
1990
- flush: () => h?.flush("submit"),
1991
- sanitizeUrl: a.sanitizeUrl,
1992
- ignoredOrigins: p,
1993
- host: a.host,
1994
- getTabId: () => f?.getTabId() ?? "",
1995
- captureElementLevel: a.capture?.element ?? B,
1996
- requestFlush: (t) => h?.requestFlush(t),
1997
- getActivityId: () => u?.getActivityId() ?? "",
1998
- registerEventRouter: (t) => (h?.setEventRouter(t), function() {
1999
- h?.getEventRouter() === t && h.setEventRouter(null);
2000
- })
2001
- }, s, a.capture?.content), v = function(e) {
2002
- let i = !1;
2003
- function r(t) {
2004
- o(() => e.isActivityActive()) && (o(() => e.holdCapacityFlush(function() {
2005
- "pagehide" === t && o(() => e.stopTab()), o(() => e.readBehaviour(t));
2006
- })), o(() => e.flush()), "pagehide" === t && (e.getShouldSkipStopActivity() || e.stopActivity()));
2007
- }
2008
- const s = c((t) => {
2009
- "hidden" === document.visibilityState && r("hidden");
2010
- }), a = c((t) => {
2011
- r("pagehide");
2012
- }), l = c((t) => {
2013
- r("beforeunload");
2014
- }), u = c((t) => {
2015
- t.persisted && e.resume();
2016
- }), h = c(() => e.onConnectionChange());
2017
- return {
2018
- start: function() {
2019
- t(document, "visibilitychange", s), t(window, "pagehide", a), function() {
2020
- if ("undefined" == typeof navigator) return !1;
2021
- const t = navigator.userAgentData;
2022
- return t && "boolean" == typeof t.mobile ? !t.mobile : !/Mobi|Android|iPhone|iPad|iPod/i.test(navigator.userAgent ?? "");
2023
- }() && !/Firefox\//.test(navigator.userAgent ?? "") && (t(window, "beforeunload", l), i = !0), t(window, "pageshow", u), t(window, "online", h), t(window, "offline", h);
2024
- },
2025
- stop: function() {
2026
- n(document, "visibilitychange", s), n(window, "pagehide", a), i && (n(window, "beforeunload", l), i = !1), n(window, "pageshow", u), n(window, "online", h), n(window, "offline", h);
2027
- },
2028
- onHide: r
2029
- };
2030
- }({
2031
- readBehaviour: (t) => y.readBehaviour(t),
2032
- isActivityActive: () => u?.isActive() ?? !1,
2033
- holdCapacityFlush: (t) => {
2034
- h ? h.holdCapacityFlush(t) : t();
2035
- },
2036
- flush: () => h?.flush("lifecycle"),
2037
- stopActivity: async () => u?.stop(),
2038
- stopTab: () => f?.stop(),
2039
- getShouldSkipStopActivity: () => (f?.queryTabsNumber() ?? 0) > 1,
2040
- onConnectionChange: () => h?.onConnectionChange(),
2041
- resume: async () => {
2042
- try {
2043
- await u?.start(), await f?.start();
2044
- } catch (t) {
2045
- i.warn("IncodeTRI", "resume after bfcache restore failed:", t);
2046
- }
2047
- }
2048
- }), g = new Vt({
2049
- getActivityId: () => u?.getActivityId() ?? "",
2050
- reportEvent: (t) => l.api.reportEvent(t)
2051
- });
2052
- return {
2053
- status: "ready",
2054
- managers: {
2055
- falconServiceManager: l,
2056
- activityManager: u,
2057
- transportManager: h,
2058
- tabManager: f,
2059
- lifecycleManager: v,
2060
- collectorManager: y,
2061
- eventReportManager: g
2062
- }
2063
- };
2064
- } catch (t) {
2065
- return i.warn("IncodeTRI", "setup() failed during construction:", t), { status: "init-failed" };
2066
- }
2067
- }
2068
- let Zt = class t {
2069
- constructor() {
2070
- this.Ft = 0, this.Bt = null, this.jt = M;
2071
- }
2072
- static get instance() {
2073
- return t.i || (t.i = new t()), t.i;
2074
- }
2075
- async setup(t) {
2076
- if (this.jt !== M) return i.fatal("error", "setup()", `cannot set up from state '${this.jt}' — call reset() (or reload) first. Ignoring.`), L;
2077
- try {
2078
- const n = function(t) {
2079
- if ("undefined" == typeof document) return i.fatal("error", "IncodeTRI", "TRI is not available in a non-browser environment."), null;
2080
- if (!t?.token) return i.fatal("error", "SDK", "token is required."), null;
2081
- if (!t.apiURL) return i.fatal("error", "SDK", "Couldn't initialise SDK — apiURL isn't provided."), null;
2082
- const { element: n, content: e } = t.capture ?? {}, r = {
2083
- token: t.token,
2084
- capture: {
2085
- element: n ?? B,
2086
- content: e ?? "off"
2087
- },
2088
- api: {
2089
- version: t.apiVersion ?? "1.0",
2090
- url: t.apiURL
2091
- },
2092
- sanitizeUrl: (a = t.sanitizeUrl, a ? function(t) {
2093
- return o(() => a(t, rt)) ?? rt(t);
2094
- } : rt),
2095
- host: (s = t.host, "string" == typeof s?.platform && "" !== s.platform && "string" == typeof s.version && "" !== s.version ? {
2096
- platform: s.platform,
2097
- version: s.version
2098
- } : (void 0 !== s && i.warn("SDK", "host needs a non-empty platform and version — reporting TRI itself."), {
2099
- platform: "tri-web",
2100
- version: "0.5.1"
2101
- })),
2102
- DEBUG: t.DEBUG ?? !1
2103
- };
2104
- var s, a;
2105
- return void 0 === t.collectors && void 0 === t.layers ? {
2106
- sdk: r,
2107
- collectors: st()
2108
- } : void 0 !== t.collectors ? {
2109
- sdk: r,
2110
- collectors: at(t.collectors)
2111
- } : {
2112
- sdk: r,
2113
- collectors: ot(t.layers)
2114
- };
2115
- }(t);
2116
- if (!n) return this.jt = L, L;
2117
- i.DEBUG = n.sdk.DEBUG;
2118
- const e = await Kt(n, { getProfileId: () => null });
2119
- return "collection-disabled" === e.status ? (i.fatal("warn", "setup()", "Collection is disabled for the provided API Key."), this.jt = z, z) : "init-failed" === e.status ? (this.jt = L, L) : (this.Bt = e.managers, this.jt = P, g(function(t) {
2120
- t.setups += 1;
2121
- }), !1 !== t.autostart ? this.start() : P);
2122
- } catch (t) {
2123
- return i.warn("setup()", "failed:", t), this.jt = L, L;
2124
- }
2125
- }
2126
- async start() {
2127
- if (this.jt === M) return i.warn("start()", "start() requires a prior successful setup() — ignoring."), this.jt;
2128
- if (this.jt !== P) return i.fatal("warn", "start()", "TRI is either already started or isn't ready — ignoring."), this.jt;
2129
- this.jt = "starting";
2130
- const t = ++this.Ft;
2131
- return await this.S(t), this.jt;
2132
- }
2133
- async stop() {
2134
- i.warn("stop()", "called");
2135
- const t = this.Bt;
2136
- return t ? (++this.Ft, t.lifecycleManager.stop(), t.tabManager.stop(), t.collectorManager.stop(), t.eventReportManager.stop(), this.jt = P, this.Dt(t)) : Promise.resolve(this.jt);
2137
- }
2138
- async reset() {
2139
- this.Bt && g(function(t) {
2140
- t.resets += 1;
2141
- });
2142
- const t = this.stop();
2143
- return this.jt = M, this.Bt = null, t.then(() => this.jt);
2144
- }
2145
- async Dt(t) {
2146
- return await function(t) {
2147
- let n = null;
2148
- const e = new Promise((t) => {
2149
- n = u(t, 2e3);
2150
- });
2151
- return Promise.race([t.finally(() => h(n)), e]);
2152
- }(Promise.resolve(t.transportManager.stop())), await t.activityManager.stop(), this.jt;
2153
- }
2154
- async S(t) {
2155
- const n = this.Bt;
2156
- if (n) {
2157
- try {
2158
- if (await n.activityManager.start(), t !== this.Ft) return;
2159
- if (n.transportManager.start(), n.collectorManager.autocapture(), await n.tabManager.start(), t !== this.Ft) return;
2160
- n.lifecycleManager.start();
2161
- } catch (n) {
2162
- i.warn("start()", "failed during monitoring start:", n), t === this.Ft && (this.jt = P);
2163
- return;
2164
- }
2165
- t === this.Ft && (this.jt = x);
2166
- }
2167
- }
2168
- async linkInterview(t) {
2169
- if (this.jt !== x || !this.Bt) return i.warn("linkInterview()", "linkInterview() called before start() completed — ignoring."), !1;
2170
- if (!t) return i.warn("linkInterview()", "linkInterview() called without sessionToken — ignoring."), !1;
2171
- try {
2172
- return (await this.Bt.falconServiceManager.api.linkInterview(t)).ok;
2173
- } catch (t) {
2174
- return i.warn("linkInterview()", "failed:", t), !1;
2175
- }
2176
- }
2177
- async getFpSignals() {
2178
- if (this.jt !== x) return i.warn("getFpSignals()", "getFpSignals() called before start() completed — ignoring."), null;
2179
- try {
2180
- return await (H ?? Promise.resolve(null));
2181
- } catch (t) {
2182
- return i.warn("getFpSignals()", "failed:", t), null;
2183
- }
2184
- }
2185
- addFpSignals(t) {
2186
- const n = this.Bt;
2187
- if (this.jt !== x || !n) return i.warn("addFpSignals()", "addFpSignals() called before start() completed — ignoring."), !1;
2188
- if (n.collectorManager.isRunning("fpsignals")) return i.warn("addFpSignals()", "the fpsignals collector is on and sends its own results — ignoring."), !1;
2189
- if ("string" != typeof t || !t) return i.warn("addFpSignals()", "signals is empty — ignoring."), !1;
2190
- try {
2191
- return n.transportManager.push({
2192
- name: "fp_signals",
2193
- timestamp: Date.now(),
2194
- signals: t
2195
- }), !0;
2196
- } catch (t) {
2197
- return i.warn("addFpSignals()", "failed:", t), !1;
2198
- }
2199
- }
2200
- getActivityId() {
2201
- const t = this.Bt;
2202
- if (this.jt !== x || !t) return i.warn("getActivityId()", "getActivityId() called before start() completed — returning null."), null;
2203
- try {
2204
- const { activityManager: n } = t;
2205
- return n.isActive() && n.getActivityId() || null;
2206
- } catch (t) {
2207
- return i.warn("getActivityId()", "failed:", t), null;
2208
- }
2209
- }
2210
- };
2211
- async function Gt(t, n) {
2212
- const e = function(t) {
2213
- if ("string" != typeof t) return null;
2214
- const n = t.trim();
2215
- try {
2216
- const { protocol: t } = new URL(n);
2217
- return "http:" === t || "https:" === t ? n : null;
2218
- } catch {
2219
- return null;
2220
- }
2221
- }(n?.apiURL);
2222
- if (!e) return {
2223
- token: null,
2224
- expiresAt: null,
2225
- tokenType: null,
2226
- eventsCollectionEnabled: !1,
2227
- error: {
2228
- status: 0,
2229
- message: "[TRI] createSession: apiURL must be an absolute http(s) URL."
2230
- }
2231
- };
2232
- const i = n?.timeout ?? 1e4, r = new AbortController();
2233
- let s = null, o = !1, a = () => {};
2234
- i && (s = u(() => {
2235
- o = !0, r.abort();
2236
- }, i));
2237
- const c = n?.signal;
2238
- if (c) if (c.aborted) r.abort();
2239
- else {
2240
- const t = () => r.abort();
2241
- c.addEventListener("abort", t, { once: !0 }), a = () => c.removeEventListener("abort", t);
2242
- }
2243
- try {
2244
- const n = await fetch(`${e}/api/v1/sdk/init`, {
2245
- method: "POST",
2246
- headers: {
2247
- "content-type": "application/json",
2248
- "x-api-key": t,
2249
- "x-api-version": "1.0"
2250
- },
2251
- signal: r.signal
2252
- });
2253
- if (!n.ok) {
2254
- let t = n.statusText;
2255
- try {
2256
- const e = await n.json();
2257
- e.errorMessage && (t = e.errorMessage);
2258
- } catch {}
2259
- return {
2260
- token: null,
2261
- expiresAt: null,
2262
- tokenType: null,
2263
- eventsCollectionEnabled: !1,
2264
- error: {
2265
- status: n.status,
2266
- message: t
2267
- }
2268
- };
2269
- }
2270
- const i = await n.json();
2271
- return {
2272
- token: i.token,
2273
- expiresAt: i.expiresAt,
2274
- tokenType: i.tokenType,
2275
- eventsCollectionEnabled: !0,
2276
- error: null
2277
- };
2278
- } catch (t) {
2279
- throw new Error((o ? "[TRI] createSession timed out" : "[TRI] Failed to create session:") + " " + t.message);
2280
- } finally {
2281
- h(s), a();
2282
- }
2283
- }
2284
- Zt.i = null;
2285
- const Wt = Zt.instance;
2286
- //#endregion
2287
- export { Gt as createSession, Wt as default };