@incodetech/core 2.0.0-rc.0 → 2.0.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/package.json +3 -3
  2. package/dist/Actor-CI32dTbG.d.ts +0 -2
  3. package/dist/BaseWasmProvider-C_DLEI40.esm.js +0 -1118
  4. package/dist/BrowserStorageProvider-CuOW1Er2.esm.js +0 -55
  5. package/dist/BrowserTimerProvider-DhNc_x02.esm.js +0 -22
  6. package/dist/ITimerCapability-C67ZRskg.esm.js +0 -7
  7. package/dist/IpifyProvider-D7jx52AL.esm.js +0 -139
  8. package/dist/Manager-C8PrhBOx.d.ts +0 -19
  9. package/dist/MotionSensorProvider-4v7xkqAp.esm.js +0 -254
  10. package/dist/OpenViduRecordingProvider-CMu6XVdc.esm.js +0 -87
  11. package/dist/StateMachine-BCQrZJhf.d.ts +0 -2
  12. package/dist/WasmUtilProvider-j98OJf-S.esm.js +0 -114
  13. package/dist/addressSearch-BpTbTWCa.esm.js +0 -430
  14. package/dist/ae-signature-DDDZmWXj.esm.js +0 -12
  15. package/dist/ae-signature.d.ts +0 -25
  16. package/dist/ae-signature.esm.js +0 -8
  17. package/dist/antifraud.d.ts +0 -57
  18. package/dist/antifraud.esm.js +0 -45
  19. package/dist/antifraudStateMachine-O0TMf6yc.esm.js +0 -39
  20. package/dist/api-CESGtpbH.esm.js +0 -53
  21. package/dist/authentication.d.ts +0 -12
  22. package/dist/authentication.esm.js +0 -25
  23. package/dist/authenticationManager-5M-fKzXx.esm.js +0 -67
  24. package/dist/authenticationManager-C83GNIhl.d.ts +0 -66
  25. package/dist/authenticationStateMachine-BMZqatiF.esm.js +0 -139
  26. package/dist/backCameraStream-DMdMeGk2.esm.js +0 -346
  27. package/dist/browserSimulation-gxD8cSpM.esm.js +0 -20
  28. package/dist/camera-DBSxa6ML.d.ts +0 -4
  29. package/dist/camera-PA2Ljri3.esm.js +0 -22
  30. package/dist/camera.d.ts +0 -15
  31. package/dist/camera.esm.js +0 -5
  32. package/dist/chunk-CRF6K_H_.esm.js +0 -49
  33. package/dist/consent.d.ts +0 -398
  34. package/dist/consent.esm.js +0 -79
  35. package/dist/consentStateMachine-CCT-B60O.esm.js +0 -151
  36. package/dist/cpf-PPz2Njto.esm.js +0 -38
  37. package/dist/cpf-ocr.d.ts +0 -204
  38. package/dist/cpf-ocr.esm.js +0 -177
  39. package/dist/cross-document-data-match.d.ts +0 -34
  40. package/dist/cross-document-data-match.esm.js +0 -71
  41. package/dist/curp-validation.d.ts +0 -188
  42. package/dist/curp-validation.esm.js +0 -110
  43. package/dist/curpValidationStateMachine-CitWLr2c.esm.js +0 -595
  44. package/dist/custom-fields.d.ts +0 -115
  45. package/dist/custom-fields.esm.js +0 -177
  46. package/dist/custom-watchlist.d.ts +0 -66
  47. package/dist/custom-watchlist.esm.js +0 -86
  48. package/dist/dateUtils-UoN5xswP.esm.js +0 -23
  49. package/dist/deepsightLoader-Cm4JIT_z.esm.js +0 -52
  50. package/dist/deepsightService-CEVxzehb.d.ts +0 -412
  51. package/dist/deepsightService-O74l4Y__.esm.js +0 -489
  52. package/dist/device.d.ts +0 -46
  53. package/dist/device.esm.js +0 -106
  54. package/dist/displayErrors-DqJ_IbsG.d.ts +0 -39
  55. package/dist/document-capture.d.ts +0 -906
  56. package/dist/document-capture.esm.js +0 -156
  57. package/dist/document-upload.d.ts +0 -331
  58. package/dist/document-upload.esm.js +0 -203
  59. package/dist/documentCaptureStateMachine-BqzTDy9k.esm.js +0 -394
  60. package/dist/dynamic-forms.d.ts +0 -178
  61. package/dist/dynamic-forms.esm.js +0 -323
  62. package/dist/ekyb.d.ts +0 -148
  63. package/dist/ekyb.esm.js +0 -127
  64. package/dist/ekybStateMachine-B59rQjgj.esm.js +0 -674
  65. package/dist/ekyc.d.ts +0 -164
  66. package/dist/ekyc.esm.js +0 -104
  67. package/dist/ekycStateMachine-oeO0Iekd.esm.js +0 -10626
  68. package/dist/electronic-signature.d.ts +0 -4
  69. package/dist/electronic-signature.esm.js +0 -7
  70. package/dist/electronicSignatureManager-D9OHzTpG.esm.js +0 -428
  71. package/dist/email.d.ts +0 -4
  72. package/dist/email.esm.js +0 -9
  73. package/dist/emailManager-DIfnS5g1.d.ts +0 -352
  74. package/dist/emailManager-wAV0LE-H.esm.js +0 -238
  75. package/dist/emailStateMachine-DOf4j58N.esm.js +0 -292
  76. package/dist/endpoints-CnN3SyDa.esm.js +0 -87
  77. package/dist/events-D6-e4vok.esm.js +0 -596
  78. package/dist/events.d.ts +0 -265
  79. package/dist/events.esm.js +0 -4
  80. package/dist/extensibility.d.ts +0 -122
  81. package/dist/extensibility.esm.js +0 -43
  82. package/dist/face-match.d.ts +0 -228
  83. package/dist/face-match.esm.js +0 -173
  84. package/dist/faceCaptureManagerFactory-Dh2PdGlF.esm.js +0 -290
  85. package/dist/faceCaptureManagerFactory-yqtpxjnN.d.ts +0 -690
  86. package/dist/faceCaptureSetup-B3faSpYA.esm.js +0 -873
  87. package/dist/faceMatchStateMachine-DNFrxTFS.esm.js +0 -127
  88. package/dist/flow-events.d.ts +0 -6
  89. package/dist/flow-events.esm.js +0 -0
  90. package/dist/flow.d.ts +0 -358
  91. package/dist/flow.esm.js +0 -825
  92. package/dist/flowCompletionService-DhkT4SRY.d.ts +0 -10
  93. package/dist/flowCompletionService-P54yzGvA.esm.js +0 -13
  94. package/dist/flowServices-DTsm-Vf1.esm.js +0 -188
  95. package/dist/geolocation.d.ts +0 -127
  96. package/dist/geolocation.esm.js +0 -89
  97. package/dist/geolocationStateMachine-asasuHY2.esm.js +0 -105
  98. package/dist/getBrowser-BSXUTWXw.esm.js +0 -41
  99. package/dist/getDeviceClass-BSntT9_j.esm.js +0 -14
  100. package/dist/government-validation.d.ts +0 -67
  101. package/dist/government-validation.esm.js +0 -81
  102. package/dist/governmentValidationStateMachine-BDDYrJTo.esm.js +0 -271
  103. package/dist/home.d.ts +0 -99
  104. package/dist/home.esm.js +0 -61
  105. package/dist/http.d.ts +0 -68
  106. package/dist/http.esm.js +0 -3
  107. package/dist/id-ocr.d.ts +0 -635
  108. package/dist/id-ocr.esm.js +0 -86
  109. package/dist/id-verification.d.ts +0 -190
  110. package/dist/id-verification.esm.js +0 -43
  111. package/dist/id.d.ts +0 -24
  112. package/dist/id.esm.js +0 -164
  113. package/dist/idCaptureManager-B9TGA5dq.d.ts +0 -956
  114. package/dist/idCaptureManager-DMK0GIt3.esm.js +0 -581
  115. package/dist/idCaptureStateMachine-Bq0fVZXl.esm.js +0 -2954
  116. package/dist/idOcrStateMachine-YbjjC_Gg.esm.js +0 -388
  117. package/dist/idVerificationStateMachine-xbw9HP1Z.esm.js +0 -71
  118. package/dist/identity-reuse.d.ts +0 -530
  119. package/dist/identity-reuse.esm.js +0 -274
  120. package/dist/index-BLKtMA0g.d.ts +0 -1177
  121. package/dist/index-BcRG8rtJ.d.ts +0 -97
  122. package/dist/index.d.ts +0 -3
  123. package/dist/index.esm.js +0 -12
  124. package/dist/invokeOnCaptureCallback-rc6kBHo5.esm.js +0 -30
  125. package/dist/lib-BB0B_qQX.esm.js +0 -12499
  126. package/dist/mandatory-consent.d.ts +0 -412
  127. package/dist/mandatory-consent.esm.js +0 -78
  128. package/dist/mandatoryConsentStateMachine-Cnco1jvn.esm.js +0 -126
  129. package/dist/openviduLazy-Cm0XFh_v.esm.js +0 -3
  130. package/dist/openviduLazy-Cok70ZSg.esm.js +0 -12
  131. package/dist/permissionServices-D_i6nzEw.esm.js +0 -50
  132. package/dist/phone.d.ts +0 -4
  133. package/dist/phone.esm.js +0 -9
  134. package/dist/phoneManager-B6M30hKE.d.ts +0 -397
  135. package/dist/phoneManager-DAJbGhlY.esm.js +0 -256
  136. package/dist/phoneStateMachine-CuPARRaT.esm.js +0 -351
  137. package/dist/platform-CfrjKhmi.esm.js +0 -83
  138. package/dist/qe-signature-DFo_Cc-I.esm.js +0 -12
  139. package/dist/qe-signature.d.ts +0 -25
  140. package/dist/qe-signature.esm.js +0 -8
  141. package/dist/recordingService-Ig2UgbLv.esm.js +0 -1003
  142. package/dist/redirect-to-mobile.d.ts +0 -107
  143. package/dist/redirect-to-mobile.esm.js +0 -102
  144. package/dist/redirectToMobileStateMachine-BOEqe46A.esm.js +0 -249
  145. package/dist/runChildModule-CqqwqAkW.esm.js +0 -219
  146. package/dist/selfie.d.ts +0 -26
  147. package/dist/selfie.esm.js +0 -146
  148. package/dist/selfieManager-D0lSgd-J.d.ts +0 -68
  149. package/dist/selfieManager-Duisl7qN.esm.js +0 -60
  150. package/dist/selfieStateMachine-D76whWEf.esm.js +0 -68
  151. package/dist/session-BS-d_vuE.esm.js +0 -3206
  152. package/dist/session.d.ts +0 -217
  153. package/dist/session.esm.js +0 -9
  154. package/dist/setup-Buy-hyj4.esm.js +0 -887
  155. package/dist/setup-C5AITV8m.d.ts +0 -254
  156. package/dist/signature.d.ts +0 -94
  157. package/dist/signature.esm.js +0 -66
  158. package/dist/signatureStateMachine-B5-QVUve.esm.js +0 -132
  159. package/dist/stats-CIfiPzb1.esm.js +0 -16
  160. package/dist/stats.d.ts +0 -16
  161. package/dist/stats.esm.js +0 -4
  162. package/dist/trust-graph.d.ts +0 -54
  163. package/dist/trust-graph.esm.js +0 -56
  164. package/dist/types-B06Ypu2F.d.ts +0 -49
  165. package/dist/types-BP1m8VRw.d.ts +0 -340
  166. package/dist/types-CAD4va6a.d.ts +0 -5
  167. package/dist/types-CFV9G_7j.d.ts +0 -24
  168. package/dist/warmup-CEcppFiS.d.ts +0 -63
  169. package/dist/wasm.d.ts +0 -15
  170. package/dist/wasm.esm.js +0 -12
  171. package/dist/watchlist-for-business.d.ts +0 -79
  172. package/dist/watchlist-for-business.esm.js +0 -148
  173. package/dist/watchlist.d.ts +0 -62
  174. package/dist/watchlist.esm.js +0 -86
  175. package/dist/watchlistServices-DMbUhkBX.esm.js +0 -12
  176. package/dist/workflow.d.ts +0 -907
  177. package/dist/workflow.esm.js +0 -702
  178. package/dist/xstate.esm-B70JrNqo.esm.js +0 -3404
@@ -1,55 +0,0 @@
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 };
@@ -1,22 +0,0 @@
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 };
@@ -1,7 +0,0 @@
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 };
@@ -1,139 +0,0 @@
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 };
@@ -1,19 +0,0 @@
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 };
@@ -1,254 +0,0 @@
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 };
@@ -1,87 +0,0 @@
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 };
@@ -1,2 +0,0 @@
1
- import { AnyStateMachine, StateMachine, fromPromise } from "xstate";
2
- export { StateMachine as n, fromPromise as r, AnyStateMachine as t };
@@ -1,114 +0,0 @@
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 };