@incodetech/core 2.2.0 → 2.3.0-rc.1

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 (258) hide show
  1. package/THIRD_PARTY_NOTICES.txt +281 -0
  2. package/dist/BaseWasmProvider-Dyi6dKp1.d.ts +65 -0
  3. package/dist/{BrowserDiagnosticsCryptoProvider-B8vorxN5.esm.js → BrowserDiagnosticsCryptoProvider-CU6kBvqv.esm.js} +1 -1
  4. package/dist/{BrowserVisibilityObserverProvider-BX1BiLDK.esm.js → BrowserVisibilityObserverProvider-BrJN1B8A.esm.js} +2 -0
  5. package/dist/FaceDetectionProvider-BfhWkK90.esm.js +431 -0
  6. package/dist/FaceDetectionProvider-LdZ47bWy.d.ts +36 -0
  7. package/dist/{IIdCaptureCapability-DHTT3FC2.d.ts → IIdCaptureCapability-RNiFhvXR.d.ts} +7 -33
  8. package/dist/IWasmUtilCapability-CNWRl7jr.d.ts +117 -0
  9. package/dist/{MotionSensorProvider-DGiV77J_.esm.js → MotionSensorProvider-BgTYwg9L.esm.js} +1 -1
  10. package/dist/{StreamCanvasCapture-D2XcXCZ4.esm.js → StreamCanvasCapture-C9jtgBdT.esm.js} +2 -2
  11. package/dist/{deepsightService-DLVQS_RH.d.ts → StreamCanvasCapture-_8gdW5Lk.d.ts} +54 -41
  12. package/dist/StreamCanvasProcessingSession-CBnbTnOr.esm.js +42 -0
  13. package/dist/{addressSearch-D1XpBdUS.esm.js → addressSearch-DyHGgeX8.esm.js} +1 -1
  14. package/dist/advanceableErrors-CpF2cBy6.esm.js +21 -0
  15. package/dist/ae-signature.d.ts +4 -2
  16. package/dist/ae-signature.esm.js +1 -1
  17. package/dist/antifraud.esm.js +2 -2
  18. package/dist/{antifraudManager-CQFNgSPt.esm.js → antifraudManager-DNkw66oW.esm.js} +2 -2
  19. package/dist/{antifraudStateMachine-Bf_JVNwn.esm.js → antifraudStateMachine-DBeq47D2.esm.js} +1 -1
  20. package/dist/{apiError-BA1d_au0.esm.js → apiError-Budb6m6w.esm.js} +14 -2
  21. package/dist/authentication.d.ts +3 -3
  22. package/dist/authentication.esm.js +2 -2
  23. package/dist/{authenticationManager-BBMGTcwW.d.ts → authenticationManager-CjXBjC-c.d.ts} +7 -1
  24. package/dist/{authenticationManager-zh9TC62P.esm.js → authenticationManager-cMXhG70r.esm.js} +5 -5
  25. package/dist/{authenticationStateMachine-xzi-vnvE.esm.js → authenticationStateMachine-MOYz4HCf.esm.js} +6 -62
  26. package/dist/avatar.d.ts +1 -2
  27. package/dist/avatar.esm.js +1 -1
  28. package/dist/{backCameraStream-CUeYm5eu.esm.js → backCameraStream-BOtyQowf.esm.js} +83 -22
  29. package/dist/{camera-_2sXMXiF.esm.js → camera-sIa9ceW2.esm.js} +19 -1
  30. package/dist/camera.esm.js +1 -1
  31. package/dist/{canvas-E1zGkel4.esm.js → canvas-BxFzWTt-.esm.js} +19 -0
  32. package/dist/certificate-issuance.d.ts +2 -302
  33. package/dist/certificate-issuance.esm.js +3 -66
  34. package/dist/certificateIssuanceManager-C3-CI0_s.esm.js +69 -0
  35. package/dist/certificateIssuanceManager-DCgEidHz.d.ts +312 -0
  36. package/dist/{certificateIssuanceStateMachine-D_R92TYu.esm.js → certificateIssuanceStateMachine-CxqS_nD-.esm.js} +1 -1
  37. package/dist/consent.d.ts +1 -1
  38. package/dist/consent.esm.js +2 -2
  39. package/dist/{consentManager-BxjpLZAG.esm.js → consentManager-B6E1XJDw.esm.js} +2 -2
  40. package/dist/{consentManager-3Pbtj-RV.d.ts → consentManager-BhYFeKiG.d.ts} +4 -4
  41. package/dist/{consentStateMachine-D9D4ON8Z.esm.js → consentStateMachine-DTSfdGiW.esm.js} +1 -1
  42. package/dist/createCameraCycleOwnership-CX3hJGKc.esm.js +826 -0
  43. package/dist/{createFaceAvatar-DQKaRise.esm.js → createFaceAvatar-BNHdeFj8.esm.js} +2 -2
  44. package/dist/createFaceAvatar-BlcTYgJv.d.ts +497 -0
  45. package/dist/cross-document-data-match.esm.js +1 -1
  46. package/dist/{crossDocumentDataMatchManager-CGT0V6RV.esm.js → crossDocumentDataMatchManager-9XhFVZ5S.esm.js} +2 -2
  47. package/dist/curp-validation.d.ts +1 -1
  48. package/dist/curp-validation.esm.js +2 -2
  49. package/dist/{curpValidationManager-6Nmkn5u1.esm.js → curpValidationManager-DbIMYFcJ.esm.js} +2 -2
  50. package/dist/{curpValidationManager-DVGr7Fq7.d.ts → curpValidationManager-SSKNrm5Z.d.ts} +1 -1
  51. package/dist/{curpValidationStateMachine-Ds7KMacK.esm.js → curpValidationStateMachine-g5kMfuLj.esm.js} +1 -1
  52. package/dist/custom-fields.d.ts +2 -114
  53. package/dist/custom-fields.esm.js +2 -232
  54. package/dist/custom-watchlist.d.ts +2 -51
  55. package/dist/custom-watchlist.esm.js +3 -70
  56. package/dist/customFieldsManager-8-W2KY4n.d.ts +141 -0
  57. package/dist/customFieldsManager-CzWZTkW-.esm.js +264 -0
  58. package/dist/customWatchlistManager-DWTED5Ur.esm.js +73 -0
  59. package/dist/customWatchlistManager-PBWHr_oM.d.ts +64 -0
  60. package/dist/{customWatchlistStateMachine-YWSgKLbF.esm.js → customWatchlistStateMachine-DOQou6TW.esm.js} +1 -1
  61. package/dist/{deepsightLoader--wMKWECS.esm.js → deepsightLoader-DDv3vhXU.esm.js} +27 -71
  62. package/dist/device.d.ts +25 -2
  63. package/dist/device.esm.js +69 -7
  64. package/dist/document-capture.d.ts +2 -2
  65. package/dist/document-capture.esm.js +2 -2
  66. package/dist/{documentCaptureManager-DsQQhWry.esm.js → documentCaptureManager-CwAiM9WY.esm.js} +2 -2
  67. package/dist/{documentCaptureManager-B3t0ydtg.d.ts → documentCaptureManager-DensIj5F.d.ts} +83 -83
  68. package/dist/{documentCaptureStateMachine-BM4Ex_5x.esm.js → documentCaptureStateMachine-DfGOBapD.esm.js} +5 -5
  69. package/dist/dynamic-forms.d.ts +1 -1
  70. package/dist/dynamic-forms.esm.js +2 -2
  71. package/dist/{dynamicFormsManager-fFVIRBNv.esm.js → dynamicFormsManager-BbS-XMFc.esm.js} +16 -5
  72. package/dist/{dynamicFormsManager-fhK0yINk.d.ts → dynamicFormsManager-D5R_uxLQ.d.ts} +25 -3
  73. package/dist/{dynamicFormsStateMachine-D6D7oEYk.esm.js → dynamicFormsStateMachine-D8zHBCh4.esm.js} +35 -3
  74. package/dist/ekyb.d.ts +1 -1
  75. package/dist/ekyb.esm.js +3 -3
  76. package/dist/{ekybManager-Y3MkoXpC.esm.js → ekybManager-5aiac8wL.esm.js} +2 -2
  77. package/dist/{ekybStateMachine-3nlnqdlr.esm.js → ekybStateMachine-Bn2IE9rx.esm.js} +3 -3
  78. package/dist/ekyc.esm.js +2 -2
  79. package/dist/{ekycManager-DgT48ky6.esm.js → ekycManager-BlQ-Qj4E.esm.js} +2 -2
  80. package/dist/{ekycStateMachine-CQwqiR-R.esm.js → ekycStateMachine-CshSNJhh.esm.js} +2 -2
  81. package/dist/electronic-signature.d.ts +3 -3
  82. package/dist/electronic-signature.esm.js +2 -2
  83. package/dist/{electronicSignatureManager-DGbAJ00W.esm.js → electronicSignatureManager-BJJH0Tvi.esm.js} +357 -51
  84. package/dist/electronicSignatureManager-Ds-KEVTq.d.ts +2786 -0
  85. package/dist/email.esm.js +2 -2
  86. package/dist/{emailManager-BY0jeYwR.esm.js → emailManager-bR1N5rV_.esm.js} +2 -2
  87. package/dist/{emailStateMachine-Crw8QVmc.esm.js → emailStateMachine-Bc_6oIYw.esm.js} +1 -1
  88. package/dist/{endpoints-CCzL3XD_.esm.js → endpoints-B-3Q-LUw.esm.js} +24 -10
  89. package/dist/{events-DYiyoSlx.esm.js → events-ijlbX_Wx.esm.js} +2 -2
  90. package/dist/events.d.ts +1 -1
  91. package/dist/events.esm.js +1 -1
  92. package/dist/extensibility.d.ts +24 -64
  93. package/dist/extensibility.esm.js +35 -29
  94. package/dist/face-match.esm.js +2 -2
  95. package/dist/{faceCaptureManagerFactory-CVnZ0fa5.esm.js → faceCaptureManagerFactory-B7Ms6pSs.esm.js} +68 -7
  96. package/dist/{faceCaptureManagerFactory-BxWPpxyd.d.ts → faceCaptureManagerFactory-BeUl8fl1.d.ts} +86 -54
  97. package/dist/faceCaptureSetup-bkAlr5d8.esm.js +2067 -0
  98. package/dist/{faceMatchManager-Ri4UbNz0.esm.js → faceMatchManager-Bmv0HzuY.esm.js} +2 -2
  99. package/dist/{faceMatchStateMachine-20DdZ3jg.esm.js → faceMatchStateMachine-mRIHQ3dA.esm.js} +1 -1
  100. package/dist/{feature-management-CPQ4qv3F.esm.js → feature-management-E0mq0pMs.esm.js} +32 -7
  101. package/dist/feature-management.d.ts +1 -1
  102. package/dist/feature-management.esm.js +1 -1
  103. package/dist/field-comparison.esm.js +1 -1
  104. package/dist/{fieldComparisonManager-Cg6kPQQx.esm.js → fieldComparisonManager-CC-klG0h.esm.js} +2 -2
  105. package/dist/fiscal-qr.d.ts +2 -56
  106. package/dist/fiscal-qr.esm.js +2 -308
  107. package/dist/fiscalQrManager-B1STmT6z.d.ts +71 -0
  108. package/dist/fiscalQrManager-BunLVFbd.esm.js +34143 -0
  109. package/dist/flow-events.d.ts +1 -1
  110. package/dist/flow.d.ts +212 -185
  111. package/dist/flow.esm.js +119 -30
  112. package/dist/{flowCompletionService-tfeoGre9.esm.js → flowCompletionService-DJp1odGN.esm.js} +2 -2
  113. package/dist/{flowServices-f5Ruz7R9.esm.js → flowServices-DjPFGs_D.esm.js} +91 -26
  114. package/dist/geolocation.esm.js +2 -2
  115. package/dist/{geolocationManager-CH6RfqFH.esm.js → geolocationManager-D5906YXx.esm.js} +2 -2
  116. package/dist/{geolocationStateMachine-DmbWFely.esm.js → geolocationStateMachine-BVOduc3y.esm.js} +3 -3
  117. package/dist/getBrowser-CBiibsL-.esm.js +19 -0
  118. package/dist/{getBrowser-DNrQeL4T.esm.js → getBrowser-Cbe1C4Tn.esm.js} +2 -1
  119. package/dist/{getDeviceClass-9y-kbVDw.esm.js → getDeviceClass-5NYZg9s6.esm.js} +2 -2
  120. package/dist/getParsedUserAgent-B2iFDql1.esm.js +1278 -0
  121. package/dist/government-validation.d.ts +2 -85
  122. package/dist/government-validation.esm.js +3 -120
  123. package/dist/governmentValidationManager-CacFOtKO.esm.js +79 -0
  124. package/dist/governmentValidationManager-D02vT4yY.d.ts +63 -0
  125. package/dist/governmentValidationStateMachine-CoaZOSTP.esm.js +54 -0
  126. package/dist/home.d.ts +1 -1
  127. package/dist/home.esm.js +1 -1
  128. package/dist/id-ocr.d.ts +2 -2
  129. package/dist/id-ocr.esm.js +2 -2
  130. package/dist/id-selfie-flow.d.ts +3 -2
  131. package/dist/id-selfie-flow.esm.js +11 -10
  132. package/dist/id-verification.esm.js +2 -2
  133. package/dist/id.d.ts +29 -5
  134. package/dist/id.esm.js +48 -46
  135. package/dist/idCaptureDefaults-CbPA-Auz.esm.js +727 -0
  136. package/dist/{idCaptureManager-CqrqSjJV.d.ts → idCaptureManager-DKESug0R.d.ts} +230 -43
  137. package/dist/{idCaptureManager-BYwTZ2H8.esm.js → idCaptureManager-rfV9dIXy.esm.js} +259 -46
  138. package/dist/{idCaptureServices-44kwQItl.esm.js → idCaptureServices-i1KxugN7.esm.js} +285 -72
  139. package/dist/idCaptureStateMachine-Ne_PXth_.esm.js +5333 -0
  140. package/dist/{idOcrManager-DXc_xRN7.d.ts → idOcrManager-BF_cXZq8.d.ts} +1 -1
  141. package/dist/{idOcrManager-BIQYQXXj.esm.js → idOcrManager-r46XfZGE.esm.js} +2 -2
  142. package/dist/{idOcrStateMachine-cSxzHpHt.esm.js → idOcrStateMachine-ClDEP-VI.esm.js} +1 -1
  143. package/dist/{idVerificationManager-JpV_SAsl.esm.js → idVerificationManager-DT42c77H.esm.js} +2 -2
  144. package/dist/{idVerificationStateMachine-nPeUNyFq.esm.js → idVerificationStateMachine-DbDVIh9t.esm.js} +1 -1
  145. package/dist/identity-reuse.esm.js +2 -2
  146. package/dist/{identityReuseManager-kNCg9AbD.esm.js → identityReuseManager-yG3acUrQ.esm.js} +2 -2
  147. package/dist/{identityReuseStateMachine-DyulxDjP.esm.js → identityReuseStateMachine-BhAkuIra.esm.js} +1 -1
  148. package/dist/{index-CLMF0QLQ.d.ts → index-DLcJT5YP.d.ts} +1 -1
  149. package/dist/index.d.ts +1 -1
  150. package/dist/index.esm.js +1 -1
  151. package/dist/{invokeOnCaptureCallback-GpvMuz9o.esm.js → invokeOnCaptureCallback-BjzPjJ_p.esm.js} +1 -1
  152. package/dist/mandatory-consent.d.ts +2 -2
  153. package/dist/mandatory-consent.esm.js +2 -2
  154. package/dist/{mandatoryConsentManager-B4Niyg_u.esm.js → mandatoryConsentManager-7dI0D08q.esm.js} +2 -2
  155. package/dist/{mandatoryConsentManager-DyPzUmsZ.d.ts → mandatoryConsentManager-vhv1co_n.d.ts} +1 -1
  156. package/dist/{mandatoryConsentStateMachine-B4-1u-L8.esm.js → mandatoryConsentStateMachine-DC5Mo6M1.esm.js} +1 -1
  157. package/dist/multipartRecordingService-OEgIRvqC.esm.js +605 -0
  158. package/dist/{permissionGuards-KINpmKtI.esm.js → permissionGuards-uYZYFu4J.esm.js} +1 -1
  159. package/dist/{permissionServices-UvUcOSRb.esm.js → permissionServices-Bj_fyWtv.esm.js} +5 -5
  160. package/dist/personhood.d.ts +6 -5
  161. package/dist/personhood.esm.js +10 -10
  162. package/dist/phone.esm.js +2 -2
  163. package/dist/{phoneManager-FsJ0W2Ei.esm.js → phoneManager-IjhSv5XS.esm.js} +2 -2
  164. package/dist/{phoneStateMachine-Ba0wKHyX.esm.js → phoneStateMachine-CXdXufKg.esm.js} +1 -1
  165. package/dist/{platform-BJrm5nzZ.esm.js → platform-DkcRc9JV.esm.js} +29 -1
  166. package/dist/qe-signature.d.ts +5 -3
  167. package/dist/qe-signature.esm.js +2 -2
  168. package/dist/redirect-to-mobile.esm.js +2 -2
  169. package/dist/{redirectToMobileManager-y4VQB11M.esm.js → redirectToMobileManager-FLEWJtv8.esm.js} +2 -2
  170. package/dist/{redirectToMobileStateMachine-Cyv2x0PP.esm.js → redirectToMobileStateMachine-CSWWgUTO.esm.js} +1 -1
  171. package/dist/{rolldown-runtime-FZ4Itg2g.esm.js → rolldown-runtime-FDOR9p9I.esm.js} +1 -19
  172. package/dist/{runChildModule-Dukuw23X.esm.js → runChildModule-CI1gGWN1.esm.js} +3 -21
  173. package/dist/safeStorage-B-trhxg6.esm.js +423 -0
  174. package/dist/{sdkVersion-D1Bm59g6.esm.js → sdkVersion-BZh6dj53.esm.js} +1 -1
  175. package/dist/selfie.d.ts +5 -5
  176. package/dist/selfie.esm.js +14 -76
  177. package/dist/{selfieErrorUtils-C2PYBVsp.esm.js → selfieErrorUtils-UiQ46EBa.esm.js} +30 -4
  178. package/dist/{selfieManager-DwlCppg0.d.ts → selfieManager-4RRLi21P.d.ts} +8 -11
  179. package/dist/{selfieManager-Bj6B2ZVy.esm.js → selfieManager-B-2c1n_x.esm.js} +5 -5
  180. package/dist/selfieStateMachine-Bzx41R8d.esm.js +69 -0
  181. package/dist/{session-BFdLgN4i.esm.js → session-3LmvAU4S.esm.js} +4 -5
  182. package/dist/session.d.ts +21 -11
  183. package/dist/session.esm.js +5 -5
  184. package/dist/{sessionInitializer-dlfDehHk.esm.js → sessionInitializer-BFk33E67.esm.js} +187 -68
  185. package/dist/{setup-BIAtLa8k.esm.js → setup-BWG-hivt.esm.js} +226 -100
  186. package/dist/{setup-BgoWtvIS.d.ts → setup-Cv-JM9QC.d.ts} +63 -69
  187. package/dist/signature.esm.js +2 -2
  188. package/dist/{signatureManager-Ca43yhwk.esm.js → signatureManager-B72np4ZO.esm.js} +2 -2
  189. package/dist/{signatureStateMachine-K1LMRrxG.esm.js → signatureStateMachine-ce_XMA3l.esm.js} +1 -1
  190. package/dist/{src-0Jurt29N.esm.js → src-35ekGRzK.esm.js} +1 -1
  191. package/dist/{stats-B0nFKawG.esm.js → stats-CZcy2J53.esm.js} +1 -1
  192. package/dist/stats.esm.js +1 -1
  193. package/dist/{trueSightService---iW2KKJ.esm.js → trueSightService-BN-Hzw82.esm.js} +7 -7
  194. package/dist/trust-graph.esm.js +1 -1
  195. package/dist/{types-BX_XkMsQ2.d.ts → types-9_esGTPj.d.ts} +1 -1
  196. package/dist/types-BT_Oalip.d.ts +1 -0
  197. package/dist/{types-DelMqZLe.d.ts → types-BjSly8cp.d.ts} +1 -1
  198. package/dist/{types-Hmd7U0JA.d.ts → types-Bnl58jUQ.d.ts} +6 -85
  199. package/dist/types-ChAowIxT.d.ts +6 -0
  200. package/dist/{types-DVmXIdzW.d.ts → types-D0gekt4U.d.ts} +38 -5
  201. package/dist/types-DgDvvzg0.d.ts +10 -0
  202. package/dist/{types-KPvmag_B.d.ts → types-Do5rEXij.d.ts} +7 -4
  203. package/dist/{types-Bdf8_LYB2.d.ts → types-byBHOzCG2.d.ts} +305 -25
  204. package/dist/video-selfie.d.ts +59 -35
  205. package/dist/video-selfie.esm.js +510 -601
  206. package/dist/{videoSelfieCameraWarmer-NEhFZvWx.esm.js → videoSelfieCameraWarmer-B8PcYqmz.esm.js} +14 -153
  207. package/dist/videoSelfieFlowModuleMachine-BUe2uACW.esm.js +32 -0
  208. package/dist/{videoSelfieStepDetector-D3oo2ofo.d.ts → videoSelfieStepDetector-Co0Gu2k2.d.ts} +59 -13
  209. package/dist/virtualCameraCheck-Cjab7FTI.esm.js +48 -0
  210. package/dist/warmup-CUUnwYxe.esm.js +714 -0
  211. package/dist/warmup-Cis2p6O0.d.ts +128 -0
  212. package/dist/wasm.d.ts +30 -6
  213. package/dist/wasm.esm.js +36 -4
  214. package/dist/{wasmDsFlagSync-BqUCwLY8.esm.js → wasmDsFlagSync-B2e8p268.esm.js} +2 -2
  215. package/dist/{wasmWebClient-DM8lkb0z.esm.js → wasmWebClient-B7baE-Wf.esm.js} +358 -28
  216. package/dist/watchlist-for-business.d.ts +2 -78
  217. package/dist/watchlist-for-business.esm.js +3 -102
  218. package/dist/watchlist.esm.js +2 -2
  219. package/dist/watchlistForBusinessManager-CIMkpEhu.esm.js +107 -0
  220. package/dist/watchlistForBusinessManager-CsnJnG-C.d.ts +99 -0
  221. package/dist/{watchlistForBusinessStateMachine-CxFnlshm.esm.js → watchlistForBusinessStateMachine-CJ-MvUre.esm.js} +13 -6
  222. package/dist/{watchlistManager-LoNZH9qm.esm.js → watchlistManager-CixcLNDT.esm.js} +2 -2
  223. package/dist/{watchlistStateMachine-DIKQDoUT.esm.js → watchlistStateMachine-CBqk2w-h.esm.js} +1 -1
  224. package/dist/workflow.d.ts +12 -8
  225. package/dist/workflow.esm.js +48 -39
  226. package/package.json +4 -10
  227. package/dist/BrowserStorageProvider-k-FDkC4W.esm.js +0 -67
  228. package/dist/FaceDetectionProvider-Mh6q3EbA.d.ts +0 -349
  229. package/dist/IFaceAvatarCapability-BrL19G0s.d.ts +0 -23
  230. package/dist/IStorageCapability-ORkQfK3F.d.ts +0 -242
  231. package/dist/OpenViduRecordingProvider-Du98qevC.esm.js +0 -85
  232. package/dist/createFaceAvatar-BEj18KXi.d.ts +0 -50
  233. package/dist/document-upload.d.ts +0 -325
  234. package/dist/document-upload.esm.js +0 -197
  235. package/dist/electronicSignatureManager-CcUXQZS7.d.ts +0 -1300
  236. package/dist/faceCaptureSetup-Cd-04W_X.esm.js +0 -863
  237. package/dist/getBrowser-Cb8Zgrgp.esm.js +0 -7
  238. package/dist/getParsedUserAgent-pJjATANs.esm.js +0 -1622
  239. package/dist/governmentValidationStateMachine-CK9DrZXX.esm.js +0 -226
  240. package/dist/idCaptureDefaults-WeHbQM7W.esm.js +0 -225
  241. package/dist/idCaptureStateMachine-kZ5OpdfM.esm.js +0 -3342
  242. package/dist/lib-DAyUtOTj.esm.js +0 -12420
  243. package/dist/manualReviewService-D4IkipnN.esm.js +0 -15
  244. package/dist/mediaRecorderOptions-dALSV8af.esm.js +0 -40
  245. package/dist/onDeviceFaceResults-CUHwyZT4.esm.js +0 -646
  246. package/dist/openviduLazy-CCDpFWg1.esm.js +0 -10
  247. package/dist/recordingService-3NSENVwp.esm.js +0 -329
  248. package/dist/safeStorage-Ep56I-f_.esm.js +0 -982
  249. package/dist/selfieStateMachine-CHV_WNst.esm.js +0 -55
  250. package/dist/trueSight-B_icM8r2.esm.js +0 -1
  251. package/dist/types-EELWyWpd.d.ts +0 -6
  252. package/dist/types-Vb4P9ovf.d.ts +0 -22
  253. package/dist/warmup-Dv2alr2-.d.ts +0 -82
  254. package/dist/wasmDefaults-DTUrftxR.esm.js +0 -125
  255. package/dist/{Face2DProvider-UUQt_vRC.esm.js → Face2DProvider-BF48sz5c.esm.js} +1 -1
  256. package/dist/{PrivacyLensProvider-D8PS7AJa.esm.js → PrivacyLensProvider-EwnC_C5n.esm.js} +1 -1
  257. /package/dist/{types-BfgmV7s72.d.ts → types-BfgmV7s7.d.ts} +0 -0
  258. /package/dist/{types-CJ7Yl9K-2.d.ts → types-CJ7Yl9K-.d.ts} +0 -0
@@ -0,0 +1,714 @@
1
+ import { _ as WASM_PIPELINE_OPTIONAL_MODEL_NAMES, b as resolveWasmSource, d as SemaphoreProvider, h as WASM_PIPELINE_MODELS, l as loadWasmModule, n as createWebApiHostAdapter, p as WASM_MODEL_FILES, u as acquireWasmStorageFallback, v as buildModelVariantSources, y as missingWasmModelError } from "./wasmWebClient-B7baE-Wf.esm.js";
2
+ //#region ../infra/src/wasm/wasmEnumMaps.ts
3
+ function pipelineTypeToWasmEnum(wasmModule, type) {
4
+ switch (type) {
5
+ case 0: return wasmModule.WorkflowType.IdBlurGlareWorkflow;
6
+ case 1: return wasmModule.WorkflowType.IdBarcodeAndTextQualityWorkflow;
7
+ case 2: return wasmModule.WorkflowType.IdVideoSelfieWorkflow;
8
+ case 3: return wasmModule.WorkflowType.SelfieWithAggregationMetrics;
9
+ case 4: return wasmModule.WorkflowType.SelfieWithQualityMetrics;
10
+ case 5: return wasmModule.WorkflowType.OnDeviceSelfieWorkflow;
11
+ case 6: return wasmModule.WorkflowType.IdBlurGlareCoreWorkflow;
12
+ case 7: return wasmModule.WorkflowType.IdBarcodeAndTextQualityCoreWorkflow;
13
+ case 8: return wasmModule.WorkflowType.IdFaceQualityCoreWorkflow;
14
+ default: throw new Error("Unknown pipeline type");
15
+ }
16
+ }
17
+ function pipelineTypeFromWasmEnum(wasmModule, type) {
18
+ switch (type) {
19
+ case wasmModule.WorkflowType.IdBlurGlareWorkflow: return 0;
20
+ case wasmModule.WorkflowType.IdBarcodeAndTextQualityWorkflow: return 1;
21
+ case wasmModule.WorkflowType.IdVideoSelfieWorkflow: return 2;
22
+ case wasmModule.WorkflowType.SelfieWithAggregationMetrics: return 3;
23
+ case wasmModule.WorkflowType.SelfieWithQualityMetrics: return 4;
24
+ case wasmModule.WorkflowType.OnDeviceSelfieWorkflow: return 5;
25
+ case wasmModule.WorkflowType.IdBlurGlareCoreWorkflow: return 6;
26
+ case wasmModule.WorkflowType.IdBarcodeAndTextQualityCoreWorkflow: return 7;
27
+ case wasmModule.WorkflowType.IdFaceQualityCoreWorkflow: return 8;
28
+ default: throw new Error("Unknown pipeline type");
29
+ }
30
+ }
31
+ function idCaptureModelTypeToWasmEnum(wasmModule, type) {
32
+ switch (type) {
33
+ case 0: return wasmModule.IdCaptureModelType.IdCaptureV1x;
34
+ case 1: return wasmModule.IdCaptureModelType.IdCaptureV2x;
35
+ case 2: return wasmModule.IdCaptureModelType.IdCaptureV3x;
36
+ default: throw new Error("Unknown Id Capture model type");
37
+ }
38
+ }
39
+ function idCaptureModelTypeFromWasmEnum(wasmModule, type) {
40
+ switch (type) {
41
+ case wasmModule.IdCaptureModelType.IdCaptureV1x: return 0;
42
+ case wasmModule.IdCaptureModelType.IdCaptureV2x: return 1;
43
+ case wasmModule.IdCaptureModelType.IdCaptureV3x: return 2;
44
+ default: throw new Error("Unknown Id Capture model type");
45
+ }
46
+ }
47
+ //#endregion
48
+ //#region ../infra/src/wasm/CameraCycleOwnershipDomain.ts
49
+ const CAMERA_CYCLE_OWNERSHIP_DOMAIN = Symbol("cameraCycleOwnershipDomain");
50
+ var CameraCycleOwnershipDomain = class {
51
+ constructor() {
52
+ this.generation = 0;
53
+ }
54
+ snapshot() {
55
+ return {
56
+ generation: this.generation,
57
+ activeOwner: this.activeOwner
58
+ };
59
+ }
60
+ transfer(owner) {
61
+ this.generation += 1;
62
+ this.activeOwner = owner;
63
+ }
64
+ releaseController(creationGeneration, createdWithoutOwner) {
65
+ if (!createdWithoutOwner || this.generation !== creationGeneration || this.activeOwner !== void 0) return false;
66
+ this.generation += 1;
67
+ this.activeOwner = void 0;
68
+ return true;
69
+ }
70
+ releaseAttempt(owner) {
71
+ if (this.activeOwner !== owner) return false;
72
+ this.generation += 1;
73
+ this.activeOwner = void 0;
74
+ return true;
75
+ }
76
+ };
77
+ function getCameraCycleOwnershipDomain(owner) {
78
+ const domainOwner = owner;
79
+ const existing = domainOwner[CAMERA_CYCLE_OWNERSHIP_DOMAIN];
80
+ if (existing) return existing;
81
+ const domain = new CameraCycleOwnershipDomain();
82
+ Object.defineProperty(domainOwner, CAMERA_CYCLE_OWNERSHIP_DOMAIN, {
83
+ configurable: false,
84
+ enumerable: false,
85
+ value: domain,
86
+ writable: false
87
+ });
88
+ return domain;
89
+ }
90
+ //#endregion
91
+ //#region ../infra/src/wasm/WasmRuntime.ts
92
+ function attemptCleanup(firstFailure, cleanup) {
93
+ try {
94
+ cleanup();
95
+ } catch (error) {
96
+ return firstFailure ?? { error };
97
+ }
98
+ return firstFailure;
99
+ }
100
+ function stopStreamTracks(stream) {
101
+ let firstFailure = null;
102
+ let tracks = [];
103
+ try {
104
+ tracks = stream?.getTracks() ?? [];
105
+ } catch (error) {
106
+ firstFailure = { error };
107
+ }
108
+ for (const track of tracks) try {
109
+ track.stop();
110
+ } catch (error) {
111
+ firstFailure ??= { error };
112
+ }
113
+ return firstFailure;
114
+ }
115
+ function deleteWasmHandle(firstFailure, handle) {
116
+ const deleteHandle = handle?.delete;
117
+ if (!deleteHandle) return firstFailure;
118
+ return attemptCleanup(firstFailure, () => deleteHandle.call(handle));
119
+ }
120
+ function releaseCameraCycleResources(stream, cameraCycleApi) {
121
+ return attemptCleanup(stopStreamTracks(stream), () => cameraCycleApi?.rcc());
122
+ }
123
+ var WasmRuntime = class WasmRuntime {
124
+ constructor(loadModule = loadWasmModule) {
125
+ this.loadModule = loadModule;
126
+ this[CAMERA_CYCLE_OWNERSHIP_DOMAIN] = new CameraCycleOwnershipDomain();
127
+ this.loadedModels = /* @__PURE__ */ new Map();
128
+ this.modelsBuffers = null;
129
+ this.inputImageBuffer = null;
130
+ this.wasmModule = null;
131
+ this.workflowApiUtilities = null;
132
+ this.utilityApi = null;
133
+ this.idCaptureWasmApi = null;
134
+ this.faceProcessingWasmApi = null;
135
+ this.cameraCycleApi = null;
136
+ this.webApi = null;
137
+ this.storageFallbackLease = null;
138
+ this.unprotectedStream = null;
139
+ this.imageWidth_ = null;
140
+ this.imageHeight_ = null;
141
+ this.pipelines_ = null;
142
+ this.isInitialized_ = false;
143
+ this.usedSimd_ = true;
144
+ this.mlCallSemaphore = new SemaphoreProvider();
145
+ }
146
+ async initialize({ module, pipelines }) {
147
+ await this.freeResources();
148
+ try {
149
+ this.pipelines_ = pipelines;
150
+ this.storageFallbackLease = acquireWasmStorageFallback();
151
+ const { wasmModule, simdUsed } = await this.loadModule(module);
152
+ this.wasmModule = wasmModule;
153
+ this.usedSimd_ = simdUsed;
154
+ this.workflowApiUtilities = new this.wasmModule.WorkflowApiUtilities();
155
+ this.utilityApi = new this.wasmModule.UtilityApi();
156
+ this.idCaptureWasmApi = new this.wasmModule.IdCaptureApi();
157
+ this.faceProcessingWasmApi = new this.wasmModule.FaceProcessingApi();
158
+ this.cameraCycleApi = new this.wasmModule.CameraCycleApi();
159
+ this.webApi = new this.wasmModule.WebApi(createWebApiHostAdapter());
160
+ this.isInitialized_ = true;
161
+ return simdUsed;
162
+ } catch (error) {
163
+ try {
164
+ await this.freeResources();
165
+ } catch {}
166
+ throw error;
167
+ }
168
+ }
169
+ /**
170
+ * Returns initialization status
171
+ * @returns
172
+ */
173
+ isInitialized() {
174
+ return this.workflowApiUtilities != null && this.utilityApi != null && this.idCaptureWasmApi != null && this.faceProcessingWasmApi != null && this.isInitialized_;
175
+ }
176
+ /**
177
+ * Allocate shared memory for image buffers (RGBA format)
178
+ * Use it every time when the frame dimentions changes
179
+ * @param {number} imageWidth - image width
180
+ * @param {number} imageHeight - image height
181
+ */
182
+ async allocateImageBuffers(imageWidth, imageHeight) {
183
+ const workflowApiUtilities = this.requireWorkflowApiUtilities("Unable to allocate image buffers, cpp API hasn't been initialized");
184
+ if (imageWidth && imageHeight && imageWidth == this.imageWidth_ && imageHeight == this.imageHeight_ && this.inputImageBuffer && this.inputImageBuffer.byteLength !== 0 && imageWidth * imageHeight * 4 === this.inputImageBuffer.length) return;
185
+ this.imageWidth_ = imageWidth;
186
+ this.imageHeight_ = imageHeight;
187
+ this.inputImageBuffer = workflowApiUtilities.allocateInputImageBuffer(imageWidth, imageHeight, 4);
188
+ }
189
+ /**
190
+ * Copies one frame into the shared input image buffer.
191
+ *
192
+ * The only write path into `inputImageBuffer`, so no caller outside this class
193
+ * touches the field. It is the guard + `set()` pair that `process`,
194
+ * `runIdCapture`, `runSelfieCapture` and `analyzeFrame` each performed inline,
195
+ * including the error message: semantically identical at all four sites, and
196
+ * byte-identical at three. `analyzeFrame`'s local capture (`const
197
+ * inputImageBuffer = this.inputImageBuffer`, then `.set()` on the local) is
198
+ * folded into a double read of the field, which cannot observe two different
199
+ * values because nothing awaits between the guard and the `set()`.
200
+ *
201
+ * Buffers must already be sized by {@link allocateImageBuffers}.
202
+ */
203
+ writeFrame(image) {
204
+ if (this.inputImageBuffer === null) throw new Error("Unable to process the image, buffers haven't been allocated!");
205
+ if (image) this.inputImageBuffer.set(image.data);
206
+ }
207
+ async handleDetectionCallAndUpdateState(type) {
208
+ this.requireWorkflowApiUtilities("Unable to update pipeline state, cpp API hasn't been initialized").handleDetectionCallAndUpdateState(this.pipelineTypeToWasmEnum(type));
209
+ }
210
+ /**
211
+ * Free allocated memory
212
+ */
213
+ async freeResources() {
214
+ this.loadedModels.clear();
215
+ const stream = this.unprotectedStream;
216
+ const modelsBuffers = this.modelsBuffers;
217
+ const workflowApiUtilities = this.workflowApiUtilities;
218
+ const utilityApi = this.utilityApi;
219
+ const idCaptureWasmApi = this.idCaptureWasmApi;
220
+ const faceProcessingWasmApi = this.faceProcessingWasmApi;
221
+ const cameraCycleApi = this.cameraCycleApi;
222
+ const webApi = this.webApi;
223
+ const storageFallbackLease = this.storageFallbackLease;
224
+ this.unprotectedStream = null;
225
+ this.workflowApiUtilities = null;
226
+ this.utilityApi = null;
227
+ this.idCaptureWasmApi = null;
228
+ this.faceProcessingWasmApi = null;
229
+ this.cameraCycleApi = null;
230
+ this.webApi = null;
231
+ this.storageFallbackLease = null;
232
+ this.wasmModule = null;
233
+ this.modelsBuffers = null;
234
+ this.inputImageBuffer = null;
235
+ this.imageWidth_ = null;
236
+ this.imageHeight_ = null;
237
+ this.pipelines_ = null;
238
+ this.isInitialized_ = false;
239
+ if (typeof window !== "undefined") window.wasmArrayBuffer = null;
240
+ let firstFailure = releaseCameraCycleResources(stream, cameraCycleApi);
241
+ firstFailure = deleteWasmHandle(firstFailure, modelsBuffers);
242
+ firstFailure = deleteWasmHandle(firstFailure, workflowApiUtilities);
243
+ firstFailure = deleteWasmHandle(firstFailure, utilityApi);
244
+ firstFailure = deleteWasmHandle(firstFailure, idCaptureWasmApi);
245
+ firstFailure = deleteWasmHandle(firstFailure, faceProcessingWasmApi);
246
+ firstFailure = deleteWasmHandle(firstFailure, cameraCycleApi);
247
+ firstFailure = deleteWasmHandle(firstFailure, webApi);
248
+ firstFailure = attemptCleanup(firstFailure, () => storageFallbackLease?.release());
249
+ if (firstFailure) throw firstFailure.error;
250
+ }
251
+ /**
252
+ * Clear pipeline state
253
+ */
254
+ resetPipeline(type) {
255
+ this.requireWorkflowApiUtilities("Unable to reset pipeline, cpp API hasn't been initialized").resetWorkflow(this.pipelineTypeToWasmEnum(type));
256
+ }
257
+ /**
258
+ * Clear all pipelines states
259
+ */
260
+ resetAllPipelines() {
261
+ const pipelines = this.pipelines_;
262
+ if (!this.isInitialized() || pipelines === null) throw new Error("Unable to reset pipelines, cpp API hasn't been initialized");
263
+ for (const [type] of pipelines) this.resetPipeline(type);
264
+ }
265
+ async process(typeOrImage, imageOrType) {
266
+ const legacyOrder = typeof typeOrImage !== "number";
267
+ const type = legacyOrder ? typeof imageOrType === "number" ? imageOrType : void 0 : typeOrImage;
268
+ const image = legacyOrder ? typeOrImage : typeof imageOrType === "number" ? void 0 : imageOrType;
269
+ const message = "Unable to process the image, cpp API hasn't been initialized";
270
+ const idCaptureWasmApi = this.requireIdCaptureApi(message);
271
+ const faceProcessingWasmApi = this.requireFaceProcessingApi(message);
272
+ if (image) {
273
+ await this.allocateImageBuffers(image.width, image.height);
274
+ this.writeFrame(image);
275
+ }
276
+ switch (type) {
277
+ case 0:
278
+ case 1:
279
+ case 6:
280
+ case 7:
281
+ case 8: return idCaptureWasmApi.runIdCaptureWorkflow(this.pipelineTypeToWasmEnum(type));
282
+ case 2: return idCaptureWasmApi.runIdVideoSelfieWorkflow();
283
+ case 3:
284
+ case 4:
285
+ case 5: return faceProcessingWasmApi.runSelfieWorkflow(this.pipelineTypeToWasmEnum(type));
286
+ default: throw new Error("Unknown pipeline type");
287
+ }
288
+ }
289
+ async loadModels(pipelines = this.pipelines_) {
290
+ const message = "Unable load the models, cpp API hasn't been initialized";
291
+ const buffSizes = new (this.requireWasmModule(message)).WorkflowTypeToIntMap();
292
+ const modelData = /* @__PURE__ */ new Map();
293
+ const sizeVectors = [];
294
+ let operationFailure = null;
295
+ let cleanupFailure = null;
296
+ try {
297
+ if (pipelines === null) throw new Error(message);
298
+ for (const [type, modelsPaths] of pipelines) {
299
+ const wasmType = this.pipelineTypeToWasmEnum(type);
300
+ const pipelineBuffers = [];
301
+ const sizes = new (this.requireWasmModule(message)).VectorInt();
302
+ sizeVectors.push(sizes);
303
+ for (const path of modelsPaths) {
304
+ const resolvedSource = this.resolveModelSource(path);
305
+ let model = this.loadedModels.get(resolvedSource);
306
+ if (!model) {
307
+ model = await resolveWasmSource(resolvedSource, "model");
308
+ this.loadedModels.set(resolvedSource, model);
309
+ }
310
+ sizes.push_back(model.byteLength);
311
+ pipelineBuffers.push(model);
312
+ }
313
+ buffSizes.set(wasmType, sizes);
314
+ modelData.set(wasmType, pipelineBuffers);
315
+ }
316
+ const modelsBuffers = this.requireWorkflowApiUtilities(message).allocateModelsBuffers(buffSizes);
317
+ for (const [type, paths] of pipelines) this.pipelines_?.set(type, paths);
318
+ this.modelsBuffers = modelsBuffers;
319
+ for (const [type, data] of modelData) {
320
+ let buffers = null;
321
+ try {
322
+ buffers = modelsBuffers.get(type) ?? null;
323
+ if (!buffers) throw new Error("Unable to get model buffer from shared memory!");
324
+ for (let k = 0; k < buffers.size(); k++) {
325
+ const buffer = buffers.get(k);
326
+ if (buffer) buffer.set(data[k]);
327
+ else throw new Error("Unable to get model buffer from shared memory!");
328
+ }
329
+ } finally {
330
+ cleanupFailure = deleteWasmHandle(cleanupFailure, buffers);
331
+ }
332
+ }
333
+ } catch (error) {
334
+ operationFailure = { error };
335
+ } finally {
336
+ for (const sizes of sizeVectors) cleanupFailure = deleteWasmHandle(cleanupFailure, sizes);
337
+ cleanupFailure = deleteWasmHandle(cleanupFailure, buffSizes);
338
+ }
339
+ if (operationFailure) throw operationFailure.error;
340
+ if (cleanupFailure) throw cleanupFailure.error;
341
+ }
342
+ async initializePipelines() {
343
+ const message = "Unable to initialize pipelines, cpp API hasn't been initialized";
344
+ this.requireWorkflowApiUtilities(message);
345
+ if (!this.modelsBuffers) await this.loadModels();
346
+ this.requireWorkflowApiUtilities(message).initializeWorkflows();
347
+ }
348
+ getPipelineState() {
349
+ return this.requireWorkflowApiUtilities("Unable to get pipeline state, cpp API hasn't been initialized").getWorkflowState();
350
+ }
351
+ getCurrentPipeline() {
352
+ const workflowApiUtilities = this.requireWorkflowApiUtilities("Unable to get current pipeline, cpp API hasn't been initialized");
353
+ return this.pipelineTypeFromWasmEnum(workflowApiUtilities.getCurrentWorkflow());
354
+ }
355
+ setOnDeviceMode(_enabled) {}
356
+ adoptCameraStream(stream, constraints, options = {}) {
357
+ return this.requireCameraCycleApi("Unable to adopt stream, cpp API hasn't been initialized").ads(stream, constraints, options);
358
+ }
359
+ setWorkflowConsuming(type, consuming) {
360
+ const accepted = this.requireWorkflowApiUtilities("Unable to set workflow consuming, cpp API hasn't been initialized").setWorkflowConsuming(this.pipelineTypeToWasmEnum(type), consuming);
361
+ return consuming ? accepted : true;
362
+ }
363
+ captureProtectedFrame(target) {
364
+ return this.requireCameraCycleApi("Unable to capture protected frame, cpp API hasn't been initialized").mcp(target);
365
+ }
366
+ paintFrameToCanvas(canvas, options) {
367
+ return this.requireCameraCycleApi("Unable to paint frame, cpp API hasn't been initialized").pfc(canvas, options);
368
+ }
369
+ getCaptureSize() {
370
+ return this.requireCameraCycleApi("Unable to get capture size, cpp API hasn't been initialized").gcs();
371
+ }
372
+ getUnprotectedStream() {
373
+ const nextStream = this.requireCameraCycleApi("Unable to get unprotected stream, cpp API hasn't been initialized").gus();
374
+ const previousStream = this.unprotectedStream;
375
+ this.unprotectedStream = nextStream;
376
+ if (previousStream && previousStream !== nextStream) {
377
+ const failure = stopStreamTracks(previousStream);
378
+ if (failure) throw failure.error;
379
+ }
380
+ return nextStream;
381
+ }
382
+ postProtectedRequest(request) {
383
+ const extras = "extras" in request ? request.extras : {};
384
+ return this.requireWebApi("Unable to post protected request, cpp API hasn't been initialized").pse(request.target, extras, request.config ?? {});
385
+ }
386
+ releaseCameraCycle() {
387
+ const stream = this.unprotectedStream;
388
+ this.unprotectedStream = null;
389
+ const firstFailure = releaseCameraCycleResources(stream, this.cameraCycleApi);
390
+ if (firstFailure) throw firstFailure.error;
391
+ }
392
+ resolveModelSource(source) {
393
+ if (typeof source === "object" && !(source instanceof ArrayBuffer) && !(source instanceof Uint8Array)) return this.usedSimd_ ? source.current : source.legacy;
394
+ return source;
395
+ }
396
+ pipelineTypeToWasmEnum(type) {
397
+ return pipelineTypeToWasmEnum(this.requireWasmModule(WasmRuntime.UNINITIALIZED_ENUM_MAP_MESSAGE), type);
398
+ }
399
+ pipelineTypeFromWasmEnum(type) {
400
+ return pipelineTypeFromWasmEnum(this.requireWasmModule(WasmRuntime.UNINITIALIZED_ENUM_MAP_MESSAGE), type);
401
+ }
402
+ IdCaptureModelTypeToWasmEnum(type) {
403
+ return idCaptureModelTypeToWasmEnum(this.requireWasmModule(WasmRuntime.UNINITIALIZED_ENUM_MAP_MESSAGE), type);
404
+ }
405
+ /**
406
+ * Kept as an upstream mirror (`src/web/wasmApi.ts` declares the reverse map)
407
+ * but has no callers, so it stays **private** and off {@link WasmRuntimeApi}:
408
+ * dead code must not become public surface.
409
+ */
410
+ IdCaptureModelTypeFromWasmEnum(type) {
411
+ return idCaptureModelTypeFromWasmEnum(this.requireWasmModule(WasmRuntime.UNINITIALIZED_ENUM_MAP_MESSAGE), type);
412
+ }
413
+ /**
414
+ * Handle accessors. Each throws the caller's message when the C++ API is not
415
+ * initialized and otherwise returns the non-null handle, so every wrapper gets
416
+ * a narrowed handle without repeating a null check. The message is the
417
+ * caller's, not this class's, so the wrapper's own pre-init contract is
418
+ * preserved verbatim.
419
+ *
420
+ * `isInitialized()` checks the four ML handles plus `isInitialized_`; it does
421
+ * not check `wasmModule` or `webApi`. Both are set in `initialize()` and
422
+ * cleared in `freeResources()`, i.e. they share the exact lifetime of the four
423
+ * checked handles, so the extra `=== null` clause is unreachable in practice —
424
+ * it turns a would-be `TypeError` into the same `Error(message)` in a state
425
+ * that cannot occur. `!this.isInitialized()` is tested first so the observable
426
+ * message never changes.
427
+ */
428
+ requireWorkflowApiUtilities(message) {
429
+ if (!this.isInitialized() || this.workflowApiUtilities === null) throw new Error(message);
430
+ return this.workflowApiUtilities;
431
+ }
432
+ requireUtilityApi(message) {
433
+ if (!this.isInitialized() || this.utilityApi === null) throw new Error(message);
434
+ return this.utilityApi;
435
+ }
436
+ requireIdCaptureApi(message) {
437
+ if (!this.isInitialized() || this.idCaptureWasmApi === null) throw new Error(message);
438
+ return this.idCaptureWasmApi;
439
+ }
440
+ requireFaceProcessingApi(message) {
441
+ if (!this.isInitialized() || this.faceProcessingWasmApi === null) throw new Error(message);
442
+ return this.faceProcessingWasmApi;
443
+ }
444
+ requireCameraCycleApi(message) {
445
+ if (!this.isInitialized() || this.cameraCycleApi === null) throw new Error(message);
446
+ return this.cameraCycleApi;
447
+ }
448
+ requireWasmModule(message) {
449
+ if (!this.isInitialized() || this.wasmModule === null) throw new Error(message);
450
+ return this.wasmModule;
451
+ }
452
+ requireWebApi(message) {
453
+ if (!this.isInitialized() || this.webApi === null) throw new Error(message);
454
+ return this.webApi;
455
+ }
456
+ };
457
+ WasmRuntime.UNINITIALIZED_ENUM_MAP_MESSAGE = "Unable to map pipeline type, cpp API hasn't been initialized";
458
+ /** Process-wide runtime. One binary, one heap, one owner. */
459
+ const wasmRuntime = new WasmRuntime();
460
+ //#endregion
461
+ //#region ../infra/src/wasm/warmup.ts
462
+ /**
463
+ * Pipelines preloaded when no explicit `pipelines` array is passed to
464
+ * {@link warmupWasm}. The on-device selfie bundle is opt-in (loaded only when
465
+ * a SELFIE/AUTH module has `onDeviceFaceResultsSubmissionEnabled: true`), so
466
+ * it is intentionally excluded here to keep the default warmup small.
467
+ */
468
+ const WASM_PIPELINES = ["selfie", "idCapture"];
469
+ let state = "idle";
470
+ let loadingPromise = null;
471
+ let wasmError = null;
472
+ let loadedPipelines = [];
473
+ let lastConfig = null;
474
+ let lastModelVariant = null;
475
+ let pipelinesInFlight = [];
476
+ function mapPipelineToWasmType(pipeline) {
477
+ switch (pipeline) {
478
+ case "selfie": return 4;
479
+ case "onDeviceSelfie": return 5;
480
+ case "idCapture": return 0;
481
+ case "videoSelfie": return 3;
482
+ case "videoSelfieId": return 2;
483
+ default: throw new Error(`Unknown pipeline: ${pipeline}`);
484
+ }
485
+ }
486
+ /**
487
+ * Derives the models base path from the WASM path.
488
+ * Assumes models are in a 'models' subdirectory relative to the WASM binary location.
489
+ * e.g., '/wasm/v2/binary.wasm' -> '/wasm/v2/models'
490
+ */
491
+ function deriveModelsBasePath(wasmPath) {
492
+ const lastSlashIndex = wasmPath.lastIndexOf("/");
493
+ if (lastSlashIndex === -1) return "models";
494
+ return `${wasmPath.substring(0, lastSlashIndex)}/models`;
495
+ }
496
+ /**
497
+ * The models base path resolved from the last successful warmup, mirroring the
498
+ * load-time resolution (explicit `modelsBasePath`, else derived from
499
+ * `wasmPath`). `undefined` before any warmup. Used to locate lazily-loaded
500
+ * models such as the PDF417 barcode enhancement model at the correct base so
501
+ * self-hosted / air-gapped deployments resolve it too.
502
+ */
503
+ function getResolvedModelsBasePath() {
504
+ if (!lastConfig) return;
505
+ if (lastConfig.modelsBasePath) return lastConfig.modelsBasePath;
506
+ return typeof lastConfig.wasmPath === "string" ? deriveModelsBasePath(lastConfig.wasmPath) : void 0;
507
+ }
508
+ function getResolvedModelSource(fileName, pipeline) {
509
+ if (!lastConfig) return;
510
+ const explicit = lastModelVariant === "legacy" ? lastConfig.legacyModelUrls?.[fileName] ?? lastConfig.modelUrls?.[fileName] : lastConfig.modelUrls?.[fileName];
511
+ if (explicit !== void 0) return explicit;
512
+ if (lastConfig.selfHosted) throw missingWasmModelError(fileName, pipeline);
513
+ const basePath = getResolvedModelsBasePath();
514
+ if (!basePath) return;
515
+ const source = buildModelVariantSources(basePath, fileName);
516
+ if (typeof source === "string") return source;
517
+ return lastModelVariant === "legacy" ? source.legacy : source.current;
518
+ }
519
+ function resolveConfiguredModelSource(config, modelFile, pipeline, modelsBasePath) {
520
+ const current = config.modelUrls?.[modelFile];
521
+ if (current === void 0) {
522
+ if (config.selfHosted) throw missingWasmModelError(modelFile, pipeline);
523
+ if (!modelsBasePath) throw new Error("[Incode SDK] modelsBasePath is required when wasmPath is a byte source.");
524
+ return buildModelVariantSources(modelsBasePath, modelFile);
525
+ }
526
+ const legacy = config.legacyModelUrls?.[modelFile];
527
+ return legacy === void 0 ? current : {
528
+ current,
529
+ legacy
530
+ };
531
+ }
532
+ /**
533
+ * Warns once per warmup that an optional model listed in
534
+ * {@link WASM_PIPELINE_OPTIONAL_MODEL_NAMES} was not supplied, so the Core
535
+ * profile that needs it is skipped instead of failing the whole warmup.
536
+ */
537
+ function warnMissingOptionalModel(pipeline, models) {
538
+ console.warn(`[Incode SDK] The "${pipeline}" self-hosted WASM configuration omits ${models.join(", ")}. The protected ID face-quality workflow stays unavailable; ID capture is unaffected.`);
539
+ }
540
+ /**
541
+ * Builds the pipelines map with model paths for WASM initialization.
542
+ * @param pipelines - Array of pipeline types to initialize
543
+ * @param config - Module and model resolution configuration
544
+ */
545
+ function buildPipelinesMap(pipelines, config) {
546
+ const pipelinesMap = /* @__PURE__ */ new Map();
547
+ const modelsBasePath = config.modelsBasePath ?? (typeof config.wasmPath === "string" ? deriveModelsBasePath(config.wasmPath) : void 0);
548
+ for (const pipeline of pipelines) {
549
+ const wasmType = mapPipelineToWasmType(pipeline);
550
+ if (!pipelinesMap.has(wasmType)) {
551
+ const modelPaths = (config.pipelineModels?.[pipeline] ?? WASM_PIPELINE_MODELS[pipeline]).map((modelFile) => resolveConfiguredModelSource(config, modelFile, pipeline, modelsBasePath));
552
+ pipelinesMap.set(wasmType, modelPaths);
553
+ if (pipeline === "idCapture") {
554
+ const resolveIdModels = (modelFiles) => modelFiles.map((modelFile) => resolveConfiguredModelSource(config, modelFile, pipeline, modelsBasePath));
555
+ pipelinesMap.set(6, resolveIdModels([WASM_MODEL_FILES.idCapture]));
556
+ pipelinesMap.set(7, resolveIdModels([WASM_MODEL_FILES.idCapture]));
557
+ const missingOptional = WASM_PIPELINE_OPTIONAL_MODEL_NAMES[pipeline].filter((name) => config.selfHosted === true && config.modelUrls?.[WASM_MODEL_FILES[name]] === void 0);
558
+ if (missingOptional.length === 0) pipelinesMap.set(8, resolveIdModels([
559
+ WASM_MODEL_FILES.idCapture,
560
+ WASM_MODEL_FILES.idFiqa,
561
+ WASM_MODEL_FILES.idFaceDetector
562
+ ]));
563
+ else warnMissingOptionalModel(pipeline, missingOptional);
564
+ }
565
+ }
566
+ }
567
+ return pipelinesMap;
568
+ }
569
+ /**
570
+ * Preloads WASM binary and ML models at app startup.
571
+ * Runs asynchronously - app can continue while WASM loads in background.
572
+ *
573
+ * Model files are automatically loaded based on the pipeline type.
574
+ * By default, models are expected in a 'models' subdirectory relative to the WASM binary.
575
+ *
576
+ * @param config - Configuration for WASM warmup
577
+ * @returns Promise that resolves when WASM is ready
578
+ *
579
+ * @example
580
+ * ```ts
581
+ * // Basic usage - models loaded from /wasm/v2/models/
582
+ * warmupWasm({
583
+ * wasmPath: '/wasm/v2/ml-wasm.wasm',
584
+ * glueCodePath: '/wasm/v2/ml-wasm.js',
585
+ * pipelines: ['selfie', 'idCapture'],
586
+ * });
587
+ *
588
+ * // With explicit models path
589
+ * warmupWasm({
590
+ * wasmPath: '/wasm/v2/ml-wasm.wasm',
591
+ * glueCodePath: '/wasm/v2/ml-wasm.js',
592
+ * modelsBasePath: 'https://cdn.example.com/wasm/v2/models',
593
+ * pipelines: ['selfie'],
594
+ * });
595
+ * ```
596
+ */
597
+ async function warmupWasm(config) {
598
+ const pipelines = config.pipelines ?? [...WASM_PIPELINES];
599
+ if (state === "loading" && loadingPromise) {
600
+ if (lastConfig && pipelines.every((p) => loadedPipelines.includes(p))) return;
601
+ const inFlight = loadingPromise;
602
+ if (pipelines.filter((p) => !pipelinesInFlight.includes(p)).length === 0) return inFlight;
603
+ return inFlight.then(() => warmupWasm(config));
604
+ }
605
+ if (state === "ready") {
606
+ const missingPipelines = pipelines.filter((p) => !loadedPipelines.includes(p));
607
+ if (missingPipelines.length === 0) return;
608
+ if (!lastConfig) throw new Error("Cannot add pipelines: original warmup config not available");
609
+ if (lastConfig.wasmPath !== config.wasmPath || lastConfig.glueCodePath !== config.glueCodePath || (lastConfig.wasmSimdPath ?? lastConfig.wasmPath) !== (config.wasmSimdPath ?? config.wasmPath) || (lastConfig.glueCodeSimdPath ?? "") !== (config.glueCodeSimdPath ?? "") || lastConfig.loadGlue !== config.loadGlue || lastConfig.loadGlueSimd !== config.loadGlueSimd || (lastConfig.useSimd ?? true) !== (config.useSimd ?? true)) throw new Error("Cannot add pipelines: WASM config mismatch. Use same wasmPath, glueCodePath, and useSimd settings.");
610
+ const combinedPipelines = [.../* @__PURE__ */ new Set([...loadedPipelines, ...pipelines])];
611
+ state = "loading";
612
+ pipelinesInFlight = combinedPipelines;
613
+ wasmError = null;
614
+ loadingPromise = (async () => {
615
+ try {
616
+ const pipelinesMap = buildPipelinesMap(missingPipelines, lastConfig);
617
+ await wasmRuntime.loadModels(pipelinesMap);
618
+ await wasmRuntime.initializePipelines();
619
+ state = "ready";
620
+ loadedPipelines = combinedPipelines;
621
+ lastConfig = {
622
+ ...lastConfig,
623
+ pipelines: combinedPipelines
624
+ };
625
+ loadingPromise = null;
626
+ } catch (error) {
627
+ state = "ready";
628
+ wasmError = error instanceof Error ? error : new Error(String(error));
629
+ loadingPromise = null;
630
+ pipelinesInFlight = [];
631
+ throw wasmError;
632
+ }
633
+ })();
634
+ return loadingPromise;
635
+ }
636
+ state = "loading";
637
+ pipelinesInFlight = [...pipelines];
638
+ wasmError = null;
639
+ loadingPromise = (async () => {
640
+ try {
641
+ const pipelinesMap = buildPipelinesMap(pipelines, config);
642
+ if (config.onDeviceMode !== void 0) wasmRuntime.setOnDeviceMode(config.onDeviceMode);
643
+ const simdUsed = await wasmRuntime.initialize({
644
+ module: config,
645
+ pipelines: pipelinesMap
646
+ });
647
+ await wasmRuntime.loadModels();
648
+ await wasmRuntime.initializePipelines();
649
+ state = "ready";
650
+ lastModelVariant = simdUsed ? "current" : "legacy";
651
+ loadedPipelines = [...pipelines];
652
+ lastConfig = {
653
+ ...config,
654
+ pipelines
655
+ };
656
+ loadingPromise = null;
657
+ } catch (error) {
658
+ state = "error";
659
+ lastModelVariant = null;
660
+ wasmError = error instanceof Error ? error : new Error(String(error));
661
+ loadingPromise = null;
662
+ pipelinesInFlight = [];
663
+ throw wasmError;
664
+ }
665
+ })();
666
+ return loadingPromise;
667
+ }
668
+ /**
669
+ * Returns the current warmup status.
670
+ * Useful for showing loading indicators.
671
+ *
672
+ * @returns Current warmup status
673
+ */
674
+ function getWasmStatus() {
675
+ return {
676
+ isReady: state === "ready",
677
+ isLoading: state === "loading",
678
+ error: wasmError ?? void 0,
679
+ loadedPipelines: [...loadedPipelines]
680
+ };
681
+ }
682
+ /**
683
+ * Returns true if WASM is fully initialized and ready.
684
+ *
685
+ * @returns True if WASM is ready
686
+ */
687
+ function isWasmReady() {
688
+ return state === "ready";
689
+ }
690
+ /**
691
+ * Returns a promise that resolves when WASM is ready.
692
+ * - If ready: resolves immediately
693
+ * - If loading: waits for completion, then resolves
694
+ * - If not started: rejects with error
695
+ *
696
+ * @returns Promise that resolves when WASM is ready
697
+ * @throws Error if WASM is in error state or was never started
698
+ */
699
+ function waitForWasm() {
700
+ if (state === "ready") return Promise.resolve();
701
+ if (state === "loading" && loadingPromise) return loadingPromise;
702
+ if (state === "error") return Promise.reject(wasmError ?? /* @__PURE__ */ new Error("WASM initialization failed"));
703
+ return Promise.reject(/* @__PURE__ */ new Error("WASM warmup was not started. Call warmupWasm() first."));
704
+ }
705
+ /**
706
+ * Retained compatibility surface for callers that used the removed native
707
+ * on-device-mode setter. Both values are native-free no-ops for the pinned
708
+ * runtime and do not alter initialization, capture, or fingerprint lifecycle.
709
+ */
710
+ function setWasmOnDeviceMode(enabled) {
711
+ wasmRuntime.setOnDeviceMode(enabled);
712
+ }
713
+ //#endregion
714
+ export { waitForWasm as a, CAMERA_CYCLE_OWNERSHIP_DOMAIN as c, setWasmOnDeviceMode as i, getCameraCycleOwnershipDomain as l, getWasmStatus as n, warmupWasm as o, isWasmReady as r, wasmRuntime as s, getResolvedModelSource as t };