@incodetech/core 2.0.0 → 2.0.1-rc.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (178) hide show
  1. package/dist/Actor-CI32dTbG.d.ts +2 -0
  2. package/dist/BaseWasmProvider-C_DLEI40.esm.js +1118 -0
  3. package/dist/BrowserStorageProvider-CuOW1Er2.esm.js +55 -0
  4. package/dist/BrowserTimerProvider-DhNc_x02.esm.js +22 -0
  5. package/dist/ITimerCapability-C67ZRskg.esm.js +7 -0
  6. package/dist/IpifyProvider-D7jx52AL.esm.js +139 -0
  7. package/dist/Manager-C8PrhBOx.d.ts +19 -0
  8. package/dist/MotionSensorProvider-4v7xkqAp.esm.js +254 -0
  9. package/dist/OpenViduRecordingProvider-CMu6XVdc.esm.js +87 -0
  10. package/dist/StateMachine-BCQrZJhf.d.ts +2 -0
  11. package/dist/WasmUtilProvider-j98OJf-S.esm.js +114 -0
  12. package/dist/addressSearch-BpTbTWCa.esm.js +430 -0
  13. package/dist/ae-signature-DDDZmWXj.esm.js +12 -0
  14. package/dist/ae-signature.d.ts +25 -0
  15. package/dist/ae-signature.esm.js +8 -0
  16. package/dist/antifraud.d.ts +57 -0
  17. package/dist/antifraud.esm.js +45 -0
  18. package/dist/antifraudStateMachine-O0TMf6yc.esm.js +39 -0
  19. package/dist/api-CESGtpbH.esm.js +53 -0
  20. package/dist/authentication.d.ts +12 -0
  21. package/dist/authentication.esm.js +25 -0
  22. package/dist/authenticationManager-5M-fKzXx.esm.js +67 -0
  23. package/dist/authenticationManager-C83GNIhl.d.ts +66 -0
  24. package/dist/authenticationStateMachine-BMZqatiF.esm.js +139 -0
  25. package/dist/backCameraStream-DMdMeGk2.esm.js +346 -0
  26. package/dist/browserSimulation-gxD8cSpM.esm.js +20 -0
  27. package/dist/camera-DBSxa6ML.d.ts +4 -0
  28. package/dist/camera-PA2Ljri3.esm.js +22 -0
  29. package/dist/camera.d.ts +15 -0
  30. package/dist/camera.esm.js +5 -0
  31. package/dist/chunk-CRF6K_H_.esm.js +49 -0
  32. package/dist/consent.d.ts +398 -0
  33. package/dist/consent.esm.js +79 -0
  34. package/dist/consentStateMachine-CCT-B60O.esm.js +151 -0
  35. package/dist/cpf-PPz2Njto.esm.js +38 -0
  36. package/dist/cpf-ocr.d.ts +204 -0
  37. package/dist/cpf-ocr.esm.js +177 -0
  38. package/dist/cross-document-data-match.d.ts +34 -0
  39. package/dist/cross-document-data-match.esm.js +71 -0
  40. package/dist/curp-validation.d.ts +188 -0
  41. package/dist/curp-validation.esm.js +110 -0
  42. package/dist/curpValidationStateMachine-CitWLr2c.esm.js +595 -0
  43. package/dist/custom-fields.d.ts +115 -0
  44. package/dist/custom-fields.esm.js +177 -0
  45. package/dist/custom-watchlist.d.ts +66 -0
  46. package/dist/custom-watchlist.esm.js +86 -0
  47. package/dist/dateUtils-UoN5xswP.esm.js +23 -0
  48. package/dist/deepsightLoader-Cm4JIT_z.esm.js +52 -0
  49. package/dist/deepsightService-CEVxzehb.d.ts +412 -0
  50. package/dist/deepsightService-O74l4Y__.esm.js +489 -0
  51. package/dist/device.d.ts +46 -0
  52. package/dist/device.esm.js +106 -0
  53. package/dist/displayErrors-DqJ_IbsG.d.ts +39 -0
  54. package/dist/document-capture.d.ts +906 -0
  55. package/dist/document-capture.esm.js +156 -0
  56. package/dist/document-upload.d.ts +331 -0
  57. package/dist/document-upload.esm.js +203 -0
  58. package/dist/documentCaptureStateMachine-BqzTDy9k.esm.js +394 -0
  59. package/dist/dynamic-forms.d.ts +178 -0
  60. package/dist/dynamic-forms.esm.js +323 -0
  61. package/dist/ekyb.d.ts +148 -0
  62. package/dist/ekyb.esm.js +127 -0
  63. package/dist/ekybStateMachine-BR2let5f.esm.js +674 -0
  64. package/dist/ekyc.d.ts +164 -0
  65. package/dist/ekyc.esm.js +104 -0
  66. package/dist/ekycStateMachine-oeO0Iekd.esm.js +10626 -0
  67. package/dist/electronic-signature.d.ts +4 -0
  68. package/dist/electronic-signature.esm.js +7 -0
  69. package/dist/electronicSignatureManager-D9OHzTpG.esm.js +428 -0
  70. package/dist/email.d.ts +4 -0
  71. package/dist/email.esm.js +9 -0
  72. package/dist/emailManager-DIfnS5g1.d.ts +352 -0
  73. package/dist/emailManager-wAV0LE-H.esm.js +238 -0
  74. package/dist/emailStateMachine-DOf4j58N.esm.js +292 -0
  75. package/dist/endpoints-CnN3SyDa.esm.js +87 -0
  76. package/dist/events-D6-e4vok.esm.js +596 -0
  77. package/dist/events.d.ts +265 -0
  78. package/dist/events.esm.js +4 -0
  79. package/dist/extensibility.d.ts +122 -0
  80. package/dist/extensibility.esm.js +43 -0
  81. package/dist/face-match.d.ts +228 -0
  82. package/dist/face-match.esm.js +173 -0
  83. package/dist/faceCaptureManagerFactory-Dh2PdGlF.esm.js +290 -0
  84. package/dist/faceCaptureManagerFactory-yqtpxjnN.d.ts +690 -0
  85. package/dist/faceCaptureSetup-B3faSpYA.esm.js +873 -0
  86. package/dist/faceMatchStateMachine-DNFrxTFS.esm.js +127 -0
  87. package/dist/flow-events.d.ts +6 -0
  88. package/dist/flow-events.esm.js +0 -0
  89. package/dist/flow.d.ts +358 -0
  90. package/dist/flow.esm.js +825 -0
  91. package/dist/flowCompletionService-DhkT4SRY.d.ts +10 -0
  92. package/dist/flowCompletionService-P54yzGvA.esm.js +13 -0
  93. package/dist/flowServices-DG3IdWw6.esm.js +188 -0
  94. package/dist/geolocation.d.ts +127 -0
  95. package/dist/geolocation.esm.js +89 -0
  96. package/dist/geolocationStateMachine-asasuHY2.esm.js +105 -0
  97. package/dist/getBrowser-BSXUTWXw.esm.js +41 -0
  98. package/dist/getDeviceClass-BSntT9_j.esm.js +14 -0
  99. package/dist/government-validation.d.ts +67 -0
  100. package/dist/government-validation.esm.js +81 -0
  101. package/dist/governmentValidationStateMachine-BDDYrJTo.esm.js +271 -0
  102. package/dist/home.d.ts +99 -0
  103. package/dist/home.esm.js +61 -0
  104. package/dist/http.d.ts +68 -0
  105. package/dist/http.esm.js +3 -0
  106. package/dist/id-ocr.d.ts +635 -0
  107. package/dist/id-ocr.esm.js +86 -0
  108. package/dist/id-verification.d.ts +190 -0
  109. package/dist/id-verification.esm.js +43 -0
  110. package/dist/id.d.ts +24 -0
  111. package/dist/id.esm.js +164 -0
  112. package/dist/idCaptureManager-Fyd0eam-.d.ts +958 -0
  113. package/dist/idCaptureManager-ZPkD7Gjk.esm.js +581 -0
  114. package/dist/idCaptureStateMachine-BK0bPHoc.esm.js +2963 -0
  115. package/dist/idOcrStateMachine-YbjjC_Gg.esm.js +388 -0
  116. package/dist/idVerificationStateMachine-xbw9HP1Z.esm.js +71 -0
  117. package/dist/identity-reuse.d.ts +530 -0
  118. package/dist/identity-reuse.esm.js +274 -0
  119. package/dist/index-BcRG8rtJ.d.ts +97 -0
  120. package/dist/index-DZoqeAo9.d.ts +1177 -0
  121. package/dist/index.d.ts +3 -0
  122. package/dist/index.esm.js +12 -0
  123. package/dist/invokeOnCaptureCallback-rc6kBHo5.esm.js +30 -0
  124. package/dist/lib-BB0B_qQX.esm.js +12499 -0
  125. package/dist/mandatory-consent.d.ts +412 -0
  126. package/dist/mandatory-consent.esm.js +78 -0
  127. package/dist/mandatoryConsentStateMachine-Cnco1jvn.esm.js +126 -0
  128. package/dist/openviduLazy-Cm0XFh_v.esm.js +3 -0
  129. package/dist/openviduLazy-Cok70ZSg.esm.js +12 -0
  130. package/dist/permissionServices-D_i6nzEw.esm.js +50 -0
  131. package/dist/phone.d.ts +4 -0
  132. package/dist/phone.esm.js +9 -0
  133. package/dist/phoneManager-B6M30hKE.d.ts +397 -0
  134. package/dist/phoneManager-DAJbGhlY.esm.js +256 -0
  135. package/dist/phoneStateMachine-CuPARRaT.esm.js +351 -0
  136. package/dist/platform-CfrjKhmi.esm.js +83 -0
  137. package/dist/qe-signature-DFo_Cc-I.esm.js +12 -0
  138. package/dist/qe-signature.d.ts +25 -0
  139. package/dist/qe-signature.esm.js +8 -0
  140. package/dist/recordingService-Ig2UgbLv.esm.js +1003 -0
  141. package/dist/redirect-to-mobile.d.ts +107 -0
  142. package/dist/redirect-to-mobile.esm.js +102 -0
  143. package/dist/redirectToMobileStateMachine-BOEqe46A.esm.js +249 -0
  144. package/dist/runChildModule-CqqwqAkW.esm.js +219 -0
  145. package/dist/selfie.d.ts +26 -0
  146. package/dist/selfie.esm.js +146 -0
  147. package/dist/selfieManager-D0lSgd-J.d.ts +68 -0
  148. package/dist/selfieManager-Duisl7qN.esm.js +60 -0
  149. package/dist/selfieStateMachine-D76whWEf.esm.js +68 -0
  150. package/dist/session-CGtQJJzB.esm.js +3206 -0
  151. package/dist/session.d.ts +217 -0
  152. package/dist/session.esm.js +9 -0
  153. package/dist/setup-C5AITV8m.d.ts +254 -0
  154. package/dist/setup-DsM8IG7k.esm.js +887 -0
  155. package/dist/signature.d.ts +94 -0
  156. package/dist/signature.esm.js +66 -0
  157. package/dist/signatureStateMachine-B5-QVUve.esm.js +132 -0
  158. package/dist/stats-CIfiPzb1.esm.js +16 -0
  159. package/dist/stats.d.ts +16 -0
  160. package/dist/stats.esm.js +4 -0
  161. package/dist/trust-graph.d.ts +54 -0
  162. package/dist/trust-graph.esm.js +56 -0
  163. package/dist/types-B06Ypu2F.d.ts +49 -0
  164. package/dist/types-BP1m8VRw.d.ts +340 -0
  165. package/dist/types-CAD4va6a.d.ts +5 -0
  166. package/dist/types-CFV9G_7j.d.ts +24 -0
  167. package/dist/warmup-CEcppFiS.d.ts +63 -0
  168. package/dist/wasm.d.ts +15 -0
  169. package/dist/wasm.esm.js +12 -0
  170. package/dist/watchlist-for-business.d.ts +79 -0
  171. package/dist/watchlist-for-business.esm.js +148 -0
  172. package/dist/watchlist.d.ts +62 -0
  173. package/dist/watchlist.esm.js +86 -0
  174. package/dist/watchlistServices-DMbUhkBX.esm.js +12 -0
  175. package/dist/workflow.d.ts +907 -0
  176. package/dist/workflow.esm.js +702 -0
  177. package/dist/xstate.esm-B70JrNqo.esm.js +3404 -0
  178. package/package.json +1 -1
@@ -0,0 +1,55 @@
1
+ //#region ../infra/src/providers/browser/BrowserStorageProvider.ts
2
+ /**
3
+ * Browser-based storage provider wrapping localStorage.
4
+ * Handles JSON serialization/deserialization automatically.
5
+ */
6
+ var BrowserStorageProvider = class {
7
+ /**
8
+ * Retrieves a value from localStorage.
9
+ * @param key - The storage key
10
+ * @returns The stored value or null if not found
11
+ * @throws Error if stored value is invalid JSON
12
+ */
13
+ async get(key) {
14
+ try {
15
+ const item = localStorage.getItem(key);
16
+ if (item === null) return null;
17
+ return JSON.parse(item);
18
+ } catch (error) {
19
+ if (error instanceof SyntaxError) throw new Error(`Invalid JSON stored at key "${key}": ${error.message}`);
20
+ throw error;
21
+ }
22
+ }
23
+ /**
24
+ * Stores a value in localStorage.
25
+ * @param key - The storage key
26
+ * @param value - The value to store (will be serialized as JSON)
27
+ * @throws Error if value cannot be serialized or quota is exceeded
28
+ */
29
+ async set(key, value) {
30
+ try {
31
+ const serialized = JSON.stringify(value);
32
+ localStorage.setItem(key, serialized);
33
+ } catch (error) {
34
+ if ((error instanceof DOMException || error.name === "QuotaExceededError") && error.name === "QuotaExceededError") throw new Error(`Storage quota exceeded for key "${key}"`);
35
+ if (error instanceof TypeError) throw new Error(`Failed to serialize value for key "${key}": ${error.message}`);
36
+ throw error;
37
+ }
38
+ }
39
+ /**
40
+ * Removes a value from localStorage.
41
+ * @param key - The storage key to remove
42
+ */
43
+ async remove(key) {
44
+ localStorage.removeItem(key);
45
+ }
46
+ /**
47
+ * Clears all values from localStorage.
48
+ */
49
+ async clear() {
50
+ localStorage.clear();
51
+ }
52
+ };
53
+
54
+ //#endregion
55
+ export { BrowserStorageProvider as t };
@@ -0,0 +1,22 @@
1
+ //#region ../infra/src/providers/browser/BrowserTimerProvider.ts
2
+ var BrowserTimerProvider = class BrowserTimerProvider {
3
+ static getInstance() {
4
+ if (!BrowserTimerProvider.instance) BrowserTimerProvider.instance = new BrowserTimerProvider();
5
+ return BrowserTimerProvider.instance;
6
+ }
7
+ setTimeout(callback, delayMs) {
8
+ return setTimeout(callback, delayMs);
9
+ }
10
+ setInterval(callback, delayMs) {
11
+ return setInterval(callback, delayMs);
12
+ }
13
+ clearTimeout(handle) {
14
+ clearTimeout(handle);
15
+ }
16
+ clearInterval(handle) {
17
+ clearInterval(handle);
18
+ }
19
+ };
20
+
21
+ //#endregion
22
+ export { BrowserTimerProvider as t };
@@ -0,0 +1,7 @@
1
+ //#region ../infra/src/capabilities/ITimerCapability.ts
2
+ function sleep(ms) {
3
+ return new Promise((resolve) => setTimeout(resolve, ms));
4
+ }
5
+
6
+ //#endregion
7
+ export { sleep as t };
@@ -0,0 +1,139 @@
1
+ //#region ../infra/src/providers/browser/BrowserEnvironmentProvider.ts
2
+ var BrowserEnvironmentProvider = class {
3
+ getScreenDimensions() {
4
+ if (typeof screen === "undefined") return {
5
+ width: 0,
6
+ height: 0
7
+ };
8
+ return {
9
+ width: screen.width,
10
+ height: screen.height
11
+ };
12
+ }
13
+ generateCanvasFingerprint() {
14
+ try {
15
+ if (typeof document === "undefined") return "";
16
+ const canvas = document.createElement("canvas");
17
+ const ctx = canvas.getContext("2d");
18
+ if (!ctx) return "";
19
+ ctx.textBaseline = "top";
20
+ ctx.font = "14px Arial";
21
+ ctx.fillText("fingerprint", 2, 2);
22
+ return canvas.toDataURL().slice(-50);
23
+ } catch {
24
+ return "";
25
+ }
26
+ }
27
+ getWebGLRenderer() {
28
+ try {
29
+ if (typeof document === "undefined") return "";
30
+ const canvas = document.createElement("canvas");
31
+ const gl = canvas.getContext("webgl") || canvas.getContext("experimental-webgl");
32
+ if (!gl) return "";
33
+ const debugInfo = gl.getExtension("WEBGL_debug_renderer_info");
34
+ if (!debugInfo) return "";
35
+ return gl.getParameter(debugInfo.UNMASKED_RENDERER_WEBGL) || "";
36
+ } catch {
37
+ return "";
38
+ }
39
+ }
40
+ getWindowProperty(prop) {
41
+ if (typeof window === "undefined") return;
42
+ return window[prop];
43
+ }
44
+ getNavigatorProperty(prop) {
45
+ if (typeof navigator === "undefined") return;
46
+ return navigator[prop];
47
+ }
48
+ getNavigatorPrefixes() {
49
+ if (typeof navigator === "undefined") return {
50
+ webkit: false,
51
+ moz: false,
52
+ o: false,
53
+ ms: false
54
+ };
55
+ const nav = navigator;
56
+ return {
57
+ webkit: nav.webkitGetUserMedia !== void 0,
58
+ moz: nav.mozGetUserMedia !== void 0,
59
+ o: nav.oGetUserMedia !== void 0,
60
+ ms: nav.msGetUserMedia !== void 0
61
+ };
62
+ }
63
+ async fetchJson(url, timeoutMs = 3e3) {
64
+ try {
65
+ if (typeof fetch === "undefined") return null;
66
+ const controller = new AbortController();
67
+ const timeoutId = setTimeout(() => controller.abort(), timeoutMs);
68
+ const response = await fetch(url, { signal: controller.signal });
69
+ clearTimeout(timeoutId);
70
+ return await response.json();
71
+ } catch {
72
+ return null;
73
+ }
74
+ }
75
+ async enumerateVideoDeviceLabels() {
76
+ try {
77
+ if (typeof navigator === "undefined" || !navigator.mediaDevices?.enumerateDevices) return [];
78
+ return (await navigator.mediaDevices.enumerateDevices()).filter((device) => device.kind === "videoinput").map((device) => device.label);
79
+ } catch {
80
+ return [];
81
+ }
82
+ }
83
+ getTimestamp() {
84
+ return Date.now();
85
+ }
86
+ };
87
+
88
+ //#endregion
89
+ //#region ../infra/src/providers/browser/IpifyProvider.ts
90
+ let cachedIp;
91
+ let inFlightLookup;
92
+ /**
93
+ * Resets the module-level IP cache. Intended for tests and full session resets.
94
+ */
95
+ function resetIpifyCache() {
96
+ cachedIp = void 0;
97
+ inFlightLookup = void 0;
98
+ }
99
+ async function fetchIpFromIpify() {
100
+ if (typeof fetch === "undefined") return "";
101
+ let timeoutId = 0;
102
+ const controller = new AbortController();
103
+ if (AbortSignal.timeout) {
104
+ const signal = AbortSignal.timeout(3e3);
105
+ return (await (await fetch("https://api.ipify.org?format=json", { signal })).json()).ip;
106
+ }
107
+ const timeoutPromise = new Promise((_, reject) => {
108
+ timeoutId = setTimeout(() => {
109
+ controller.abort();
110
+ reject(/* @__PURE__ */ new Error("Request timeout"));
111
+ }, 3e3);
112
+ });
113
+ const fetchPromise = fetch("https://api.ipify.org?format=json", { signal: controller.signal }).then((res) => res.json()).then((data) => data.ip);
114
+ const result = await Promise.race([fetchPromise, timeoutPromise]);
115
+ clearTimeout(timeoutId);
116
+ return result;
117
+ }
118
+ var IpifyProvider = class {
119
+ async getIp() {
120
+ if (cachedIp !== void 0) return cachedIp;
121
+ if (inFlightLookup) return inFlightLookup;
122
+ inFlightLookup = (async () => {
123
+ try {
124
+ const ip = await fetchIpFromIpify();
125
+ cachedIp = ip;
126
+ return ip;
127
+ } catch {
128
+ cachedIp = "";
129
+ return "";
130
+ } finally {
131
+ inFlightLookup = void 0;
132
+ }
133
+ })();
134
+ return inFlightLookup;
135
+ }
136
+ };
137
+
138
+ //#endregion
139
+ export { resetIpifyCache as n, BrowserEnvironmentProvider as r, IpifyProvider as t };
@@ -0,0 +1,19 @@
1
+ //#region ../infra/src/manager/Manager.d.ts
2
+ /**
3
+ * Base manager interface providing state access, subscriptions, and lifecycle control.
4
+ * @template TPublicState - The public state type exposed to consumers
5
+ */
6
+ type Manager<TPublicState> = {
7
+ /** Returns the current mapped public state */
8
+ getState(): TPublicState;
9
+ /**
10
+ * Subscribes to state changes.
11
+ * @param listener - Callback invoked on every state change
12
+ * @returns Unsubscribe function to stop receiving updates
13
+ */
14
+ subscribe(listener: (state: TPublicState) => void): () => void;
15
+ /** Stops the underlying actor and cleans up resources */
16
+ stop(): void;
17
+ };
18
+ //#endregion
19
+ export { Manager as t };
@@ -0,0 +1,254 @@
1
+ //#region ../infra/src/providers/browser/MotionSensorProvider.ts
2
+ var MotionSensorProvider = class {
3
+ constructor(thresholds) {
4
+ this._isRunning = false;
5
+ this._hasPermission = true;
6
+ this.acl = null;
7
+ this.gyro = null;
8
+ this.minNumberOfFrames = 3;
9
+ this.maxFrequency = 60;
10
+ this.emptyParams = {
11
+ meanX: 0,
12
+ meanY: 0,
13
+ meanZ: 0,
14
+ m2X: 0,
15
+ m2Y: 0,
16
+ m2Z: 0,
17
+ cumulativeAbsErrorX: 0,
18
+ cumulativeAbsErrorY: 0,
19
+ cumulativeAbsErrorZ: 0,
20
+ ptsNum: 0
21
+ };
22
+ this.paramsAcc = { ...this.emptyParams };
23
+ this.paramsGyro = { ...this.emptyParams };
24
+ this.paramsAccGrOld = { ...this.emptyParams };
25
+ this.paramsAccOld = { ...this.emptyParams };
26
+ this.paramsGyroscopeOld = { ...this.emptyParams };
27
+ this.paramsOrientationOld = { ...this.emptyParams };
28
+ this.deviceMotionListener = (event) => {
29
+ if (event.accelerationIncludingGravity) {
30
+ const accGrVal = {
31
+ x: event.accelerationIncludingGravity.x,
32
+ y: event.accelerationIncludingGravity.y,
33
+ z: event.accelerationIncludingGravity.z
34
+ };
35
+ if (this.checkFields(accGrVal)) {
36
+ this.paramsAccGrOld.ptsNum += 1;
37
+ this.updateParams(this.paramsAccGrOld, accGrVal);
38
+ }
39
+ }
40
+ if (event.acceleration) {
41
+ const accVal = {
42
+ x: event.acceleration.x,
43
+ y: event.acceleration.y,
44
+ z: event.acceleration.z
45
+ };
46
+ if (this.checkFields(accVal)) {
47
+ this.paramsAccOld.ptsNum += 1;
48
+ this.updateParams(this.paramsAccOld, accVal);
49
+ }
50
+ }
51
+ if (event.rotationRate) {
52
+ const gyroVal = {
53
+ x: event.rotationRate.alpha,
54
+ y: event.rotationRate.beta,
55
+ z: event.rotationRate.gamma
56
+ };
57
+ if (this.checkFields(gyroVal)) {
58
+ this.paramsGyroscopeOld.ptsNum += 1;
59
+ this.updateParams(this.paramsGyroscopeOld, gyroVal);
60
+ }
61
+ }
62
+ };
63
+ this.deviceOrientationListener = (event) => {
64
+ const orientationVal = {
65
+ x: event.alpha,
66
+ y: event.beta,
67
+ z: event.gamma
68
+ };
69
+ if (this.checkFields(orientationVal)) {
70
+ this.paramsOrientationOld.ptsNum += 1;
71
+ this.updateParams(this.paramsOrientationOld, orientationVal);
72
+ }
73
+ };
74
+ this.thresholds = {
75
+ accThreshold: thresholds?.accThreshold ?? .3,
76
+ gyroThreshold: thresholds?.gyroThreshold ?? .3,
77
+ accGrOldThreshold: thresholds?.accGrOldThreshold ?? .3,
78
+ accOldThreshold: thresholds?.accOldThreshold ?? .3,
79
+ gyroscopeOldThreshold: thresholds?.gyroscopeOldThreshold ?? 10,
80
+ orientationOldThreshold: thresholds?.orientationOldThreshold ?? 10,
81
+ maeAccThreshold: thresholds?.maeAccThreshold ?? .3,
82
+ maeGyroThreshold: thresholds?.maeGyroThreshold ?? .3,
83
+ maeAccGrOldThreshold: thresholds?.maeAccGrOldThreshold ?? .3,
84
+ maeAccOldThreshold: thresholds?.maeAccOldThreshold ?? .3,
85
+ maeGyroscopeOldThreshold: thresholds?.maeGyroscopeOldThreshold ?? 10,
86
+ maeOrientationOldThreshold: thresholds?.maeOrientationOldThreshold ?? 10
87
+ };
88
+ }
89
+ get isRunning() {
90
+ return this._isRunning;
91
+ }
92
+ get hasPermission() {
93
+ return this._hasPermission;
94
+ }
95
+ async requestPermission() {
96
+ if (typeof DeviceMotionEvent !== "undefined" && typeof DeviceMotionEvent.requestPermission === "function") {
97
+ sessionStorage.setItem("motionSensorsPermissionsRequested", String(true));
98
+ try {
99
+ if (await DeviceMotionEvent.requestPermission() !== "granted") {
100
+ this._hasPermission = false;
101
+ return "denied";
102
+ }
103
+ return "granted";
104
+ } catch {
105
+ this._hasPermission = false;
106
+ return "denied";
107
+ }
108
+ }
109
+ return "not-required";
110
+ }
111
+ initializeAccelerometer() {
112
+ if (!("Accelerometer" in window)) return;
113
+ try {
114
+ const AccelerometerConstructor = window.Accelerometer;
115
+ if (AccelerometerConstructor) {
116
+ this.acl = new AccelerometerConstructor({ frequency: this.maxFrequency });
117
+ this.acl.addEventListener("reading", () => this.updateAcc());
118
+ }
119
+ } catch {}
120
+ }
121
+ initializeGyroscope() {
122
+ if (!("Gyroscope" in window)) return;
123
+ try {
124
+ const GyroscopeConstructor = window.Gyroscope;
125
+ if (GyroscopeConstructor) {
126
+ this.gyro = new GyroscopeConstructor({ frequency: this.maxFrequency });
127
+ this.gyro.addEventListener("reading", () => this.updateGyro());
128
+ }
129
+ } catch {}
130
+ }
131
+ async start() {
132
+ if (this._isRunning || !this._hasPermission) return;
133
+ try {
134
+ this.initializeAccelerometer();
135
+ if (this.acl) this.acl.start();
136
+ } catch {}
137
+ try {
138
+ this.initializeGyroscope();
139
+ if (this.gyro) this.gyro.start();
140
+ } catch {}
141
+ window.addEventListener("devicemotion", this.deviceMotionListener);
142
+ window.addEventListener("deviceorientation", this.deviceOrientationListener);
143
+ this._isRunning = true;
144
+ }
145
+ stop() {
146
+ this._isRunning = false;
147
+ if (this.acl) this.acl.stop();
148
+ if (this.gyro) this.gyro.stop();
149
+ window.removeEventListener("devicemotion", this.deviceMotionListener);
150
+ window.removeEventListener("deviceorientation", this.deviceOrientationListener);
151
+ this.paramsAcc = { ...this.emptyParams };
152
+ this.paramsGyro = { ...this.emptyParams };
153
+ this.paramsAccGrOld = { ...this.emptyParams };
154
+ this.paramsAccOld = { ...this.emptyParams };
155
+ this.paramsGyroscopeOld = { ...this.emptyParams };
156
+ this.paramsOrientationOld = { ...this.emptyParams };
157
+ }
158
+ updateAcc() {
159
+ if (!this._isRunning || !this.acl) return;
160
+ this.paramsAcc.ptsNum += 1;
161
+ const val = {
162
+ x: this.acl.x,
163
+ y: this.acl.y,
164
+ z: this.acl.z
165
+ };
166
+ if (this.checkFields(val)) this.updateParams(this.paramsAcc, val);
167
+ }
168
+ updateGyro() {
169
+ if (!this._isRunning || !this.gyro) return;
170
+ this.paramsGyro.ptsNum += 1;
171
+ const val = {
172
+ x: this.gyro.x,
173
+ y: this.gyro.y,
174
+ z: this.gyro.z
175
+ };
176
+ if (this.checkFields(val)) this.updateParams(this.paramsGyro, val);
177
+ }
178
+ check() {
179
+ if (!this._hasPermission) return "UNCLEAR";
180
+ const result = this.checkStability();
181
+ return result === null ? "UNCLEAR" : result ? "FAIL" : "PASS";
182
+ }
183
+ checkStability() {
184
+ if (!this._isRunning) return null;
185
+ const filteredStdChecks = [
186
+ this.gyro ? this.isBelowStdThreshold(this.paramsGyro, this.thresholds.gyroThreshold) : null,
187
+ this.acl ? this.isBelowStdThreshold(this.paramsAcc, this.thresholds.accThreshold) : null,
188
+ this.isBelowStdThreshold(this.paramsAccGrOld, this.thresholds.accGrOldThreshold),
189
+ this.isBelowStdThreshold(this.paramsAccOld, this.thresholds.accOldThreshold),
190
+ this.isBelowStdThreshold(this.paramsGyroscopeOld, this.thresholds.gyroscopeOldThreshold),
191
+ this.isBelowStdThreshold(this.paramsOrientationOld, this.thresholds.orientationOldThreshold)
192
+ ].filter((check) => check !== null);
193
+ const finalStdCheck = filteredStdChecks.length > 0 ? filteredStdChecks.every((check) => check) : null;
194
+ const filteredMaeChecks = [
195
+ this.gyro ? this.isBelowMaeThreshold(this.paramsGyro, this.thresholds.maeGyroThreshold) : null,
196
+ this.acl ? this.isBelowMaeThreshold(this.paramsAcc, this.thresholds.maeAccThreshold) : null,
197
+ this.isBelowMaeThreshold(this.paramsAccGrOld, this.thresholds.maeAccGrOldThreshold),
198
+ this.isBelowMaeThreshold(this.paramsAccOld, this.thresholds.maeAccOldThreshold),
199
+ this.isBelowMaeThreshold(this.paramsGyroscopeOld, this.thresholds.maeGyroscopeOldThreshold),
200
+ this.isBelowMaeThreshold(this.paramsOrientationOld, this.thresholds.maeOrientationOldThreshold)
201
+ ].filter((check) => check !== null);
202
+ const finalMaeCheck = filteredMaeChecks.length > 0 ? filteredMaeChecks.every((check) => check) : null;
203
+ return finalStdCheck === null ? finalMaeCheck === null ? null : finalMaeCheck : finalMaeCheck !== null ? finalStdCheck && finalMaeCheck : finalStdCheck;
204
+ }
205
+ updateParams(params, val) {
206
+ const deltaX = val.x - params.meanX;
207
+ const deltaY = val.y - params.meanY;
208
+ const deltaZ = val.z - params.meanZ;
209
+ params.meanX += deltaX / params.ptsNum;
210
+ params.meanY += deltaY / params.ptsNum;
211
+ params.meanZ += deltaZ / params.ptsNum;
212
+ params.m2X += deltaX * (val.x - params.meanX);
213
+ params.m2Y += deltaY * (val.y - params.meanY);
214
+ params.m2Z += deltaZ * (val.z - params.meanZ);
215
+ params.cumulativeAbsErrorX += Math.abs(val.x - params.meanX);
216
+ params.cumulativeAbsErrorY += Math.abs(val.y - params.meanY);
217
+ params.cumulativeAbsErrorZ += Math.abs(val.z - params.meanZ);
218
+ }
219
+ calculateStd(params) {
220
+ const variance = {
221
+ x: params.m2X / params.ptsNum,
222
+ y: params.m2Y / params.ptsNum,
223
+ z: params.m2Z / params.ptsNum
224
+ };
225
+ return {
226
+ x: Math.sqrt(variance.x),
227
+ y: Math.sqrt(variance.y),
228
+ z: Math.sqrt(variance.z)
229
+ };
230
+ }
231
+ calculateMae(params) {
232
+ return {
233
+ x: params.cumulativeAbsErrorX / params.ptsNum,
234
+ y: params.cumulativeAbsErrorY / params.ptsNum,
235
+ z: params.cumulativeAbsErrorZ / params.ptsNum
236
+ };
237
+ }
238
+ checkFields(point) {
239
+ return point.x !== null && point.y !== null && point.z !== null;
240
+ }
241
+ isBelowStdThreshold(params, threshold) {
242
+ if (params.ptsNum < this.minNumberOfFrames) return null;
243
+ const std = this.calculateStd(params);
244
+ return std.x < threshold && std.y < threshold && std.z < threshold;
245
+ }
246
+ isBelowMaeThreshold(params, threshold) {
247
+ if (params.ptsNum < this.minNumberOfFrames) return null;
248
+ const mae = this.calculateMae(params);
249
+ return mae.x < threshold && mae.y < threshold && mae.z < threshold;
250
+ }
251
+ };
252
+
253
+ //#endregion
254
+ export { MotionSensorProvider as t };
@@ -0,0 +1,87 @@
1
+ import { t as loadOpenVidu } from "./openviduLazy-Cok70ZSg.esm.js";
2
+
3
+ //#region ../infra/src/providers/browser/OpenViduRecordingProvider.ts
4
+ function createHiddenContainer() {
5
+ const id = `inc_rec_${Math.random().toString(36).slice(2)}`;
6
+ const existing = document.getElementById(id);
7
+ if (existing) return {
8
+ id,
9
+ element: existing
10
+ };
11
+ const div = document.createElement("div");
12
+ div.id = id;
13
+ div.style.display = "none";
14
+ document.body.appendChild(div);
15
+ return {
16
+ id,
17
+ element: div
18
+ };
19
+ }
20
+ var OpenViduRecordingProvider = class {
21
+ async connect(params) {
22
+ const { OpenVidu } = await loadOpenVidu();
23
+ const container = createHiddenContainer();
24
+ const ov = new OpenVidu();
25
+ const session = ov.initSession();
26
+ const videoTrack = params.stream.getVideoTracks()[0];
27
+ const audioTrack = params.stream.getAudioTracks()[0];
28
+ const hasAudio = audioTrack !== void 0;
29
+ const publisher = ov.initPublisher(container.id, {
30
+ publishAudio: hasAudio,
31
+ audioSource: hasAudio ? audioTrack : false,
32
+ videoSource: videoTrack ?? false,
33
+ frameRate: 30
34
+ });
35
+ session.on("exception", (event) => {
36
+ const e = event;
37
+ params.events?.onSessionException?.({
38
+ name: e?.name,
39
+ message: e?.message,
40
+ sessionId: session.sessionId
41
+ });
42
+ });
43
+ publisher.on("streamCreated", () => {
44
+ params.events?.onPublisherCreated?.({
45
+ sessionId: session.sessionId,
46
+ streamId: publisher.stream?.streamId
47
+ });
48
+ });
49
+ await session.connect(params.sessionToken);
50
+ params.events?.onSessionConnected?.(session.sessionId);
51
+ try {
52
+ await session.publish(publisher);
53
+ } catch (error) {
54
+ const message = error instanceof Error ? error.message : String(error);
55
+ params.events?.onPublisherError?.({
56
+ message,
57
+ sessionId: session.sessionId,
58
+ streamId: publisher.stream?.streamId
59
+ });
60
+ throw error;
61
+ }
62
+ return {
63
+ sessionId: session.sessionId,
64
+ publisher: {
65
+ getStreamId: () => publisher.stream?.streamId,
66
+ replaceVideoTrack: async (track) => {
67
+ await publisher.replaceTrack(track);
68
+ },
69
+ destroy: () => {}
70
+ },
71
+ disconnect: async () => {
72
+ try {
73
+ session.disconnect();
74
+ params.stream.getTracks().forEach((t) => {
75
+ t.stop();
76
+ });
77
+ } finally {
78
+ params.events?.onSessionDisconnected?.(session.sessionId);
79
+ if (container.element.parentNode) container.element.parentNode.removeChild(container.element);
80
+ }
81
+ }
82
+ };
83
+ }
84
+ };
85
+
86
+ //#endregion
87
+ export { OpenViduRecordingProvider };
@@ -0,0 +1,2 @@
1
+ import { AnyStateMachine, StateMachine, fromPromise } from "xstate";
2
+ export { StateMachine as n, fromPromise as r, AnyStateMachine as t };
@@ -0,0 +1,114 @@
1
+ import { r as mlWasmJSApi_default, t as BaseWasmProvider } from "./BaseWasmProvider-C_DLEI40.esm.js";
2
+
3
+ //#region ../infra/src/providers/wasm/WasmUtilProvider.ts
4
+ var WasmUtilProvider = class WasmUtilProvider extends BaseWasmProvider {
5
+ static async getInstance() {
6
+ if (WasmUtilProvider.instance) return WasmUtilProvider.instance;
7
+ if (WasmUtilProvider.initPromise) return WasmUtilProvider.initPromise;
8
+ WasmUtilProvider.initPromise = (async () => {
9
+ const instance = new WasmUtilProvider();
10
+ await instance.initializeBase({}, "selfie");
11
+ WasmUtilProvider.instance = instance;
12
+ return instance;
13
+ })();
14
+ return WasmUtilProvider.initPromise;
15
+ }
16
+ static resetInstance() {
17
+ WasmUtilProvider.instance = void 0;
18
+ WasmUtilProvider.initPromise = void 0;
19
+ }
20
+ constructor() {
21
+ super(void 0);
22
+ }
23
+ async initialize(config) {
24
+ if (this.initialized) return;
25
+ const pipeline = config.pipelines?.[0] ?? "selfie";
26
+ await this.initializeBase(config, pipeline);
27
+ }
28
+ async processFrame(_image) {
29
+ throw new Error("WasmUtilProvider does not support frame processing. Use encryptImage() instead.");
30
+ }
31
+ encryptImage(image) {
32
+ this.ensureInitialized();
33
+ return mlWasmJSApi_default.ens(image);
34
+ }
35
+ setSdkVersion(version) {
36
+ this.ensureInitialized();
37
+ mlWasmJSApi_default.setSdkVersion(version);
38
+ }
39
+ setSdkPlatform(platform) {
40
+ this.ensureInitialized();
41
+ mlWasmJSApi_default.setSdkPlatform(platform);
42
+ }
43
+ setDeviceInfo(deviceInfo, overrideExisting = true) {
44
+ this.ensureInitialized();
45
+ mlWasmJSApi_default.setDeviceInfo(deviceInfo, overrideExisting);
46
+ }
47
+ setBrowserInfo(browserInfo, overrideExisting = true) {
48
+ this.ensureInitialized();
49
+ mlWasmJSApi_default.setBrowserInfo(browserInfo, overrideExisting);
50
+ }
51
+ setCameraInfo(cameraInfo, overrideExisting = true) {
52
+ this.ensureInitialized();
53
+ mlWasmJSApi_default.setCameraInfo(cameraInfo, overrideExisting);
54
+ }
55
+ setMotionStatus(status) {
56
+ this.ensureInitialized();
57
+ mlWasmJSApi_default.setMotionStatus(status);
58
+ }
59
+ setBackgroundMode(backgroundMode) {
60
+ this.ensureInitialized();
61
+ mlWasmJSApi_default.setBackgroundMode(backgroundMode);
62
+ }
63
+ setZc(zc) {
64
+ this.ensureInitialized();
65
+ mlWasmJSApi_default.setZc(zc);
66
+ }
67
+ setInspectorOpened(opened) {
68
+ this.ensureInitialized();
69
+ mlWasmJSApi_default.setInspectorOpened(opened);
70
+ }
71
+ getMetadata() {
72
+ this.ensureInitialized();
73
+ return mlWasmJSApi_default.getMetadata();
74
+ }
75
+ async analyzeFrame(image) {
76
+ this.ensureInitialized();
77
+ await mlWasmJSApi_default.analyzeFrame(image);
78
+ }
79
+ getCheck() {
80
+ this.ensureInitialized();
81
+ return mlWasmJSApi_default.getCheck();
82
+ }
83
+ getPipelineState() {
84
+ this.ensureInitialized();
85
+ return mlWasmJSApi_default.getPipelineState();
86
+ }
87
+ estimatePerformance() {
88
+ this.ensureInitialized();
89
+ return mlWasmJSApi_default.estimatePerformance();
90
+ }
91
+ isVirtualCamera(label) {
92
+ this.ensureInitialized();
93
+ return mlWasmJSApi_default.isVirtualCamera(label);
94
+ }
95
+ async prc() {
96
+ this.ensureInitialized();
97
+ await mlWasmJSApi_default.prc();
98
+ }
99
+ async poc(output) {
100
+ this.ensureInitialized();
101
+ await mlWasmJSApi_default.poc(output);
102
+ }
103
+ ckvcks(data) {
104
+ this.ensureInitialized();
105
+ mlWasmJSApi_default.ckvcks(data);
106
+ }
107
+ async getVersions() {
108
+ this.ensureInitialized();
109
+ return mlWasmJSApi_default.getVersions();
110
+ }
111
+ };
112
+
113
+ //#endregion
114
+ export { WasmUtilProvider as t };