@richard.fadiora/liveness-detection 1.0.0 → 1.0.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.
- package/dist/index.es.js +335 -613
- package/dist/index.umd.js +7 -15
- package/package.json +3 -3
package/dist/index.es.js
CHANGED
|
@@ -1,687 +1,409 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
3
|
-
var
|
|
1
|
+
import oe, { useRef as se, useState as w, useEffect as X } from "react";
|
|
2
|
+
import ae from "react-webcam";
|
|
3
|
+
var z = { exports: {} }, P = {};
|
|
4
4
|
/**
|
|
5
5
|
* @license React
|
|
6
|
-
* react-jsx-runtime.production.
|
|
6
|
+
* react-jsx-runtime.production.js
|
|
7
7
|
*
|
|
8
|
-
* Copyright (c)
|
|
8
|
+
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
9
9
|
*
|
|
10
10
|
* This source code is licensed under the MIT license found in the
|
|
11
11
|
* LICENSE file in the root directory of this source tree.
|
|
12
12
|
*/
|
|
13
|
-
var
|
|
14
|
-
function
|
|
15
|
-
if (
|
|
16
|
-
|
|
17
|
-
var
|
|
18
|
-
function
|
|
19
|
-
var
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
13
|
+
var Z;
|
|
14
|
+
function ie() {
|
|
15
|
+
if (Z) return P;
|
|
16
|
+
Z = 1;
|
|
17
|
+
var d = Symbol.for("react.transitional.element"), m = Symbol.for("react.fragment");
|
|
18
|
+
function b(u, i, a) {
|
|
19
|
+
var v = null;
|
|
20
|
+
if (a !== void 0 && (v = "" + a), i.key !== void 0 && (v = "" + i.key), "key" in i) {
|
|
21
|
+
a = {};
|
|
22
|
+
for (var l in i)
|
|
23
|
+
l !== "key" && (a[l] = i[l]);
|
|
24
|
+
} else a = i;
|
|
25
|
+
return i = a.ref, {
|
|
26
|
+
$$typeof: d,
|
|
27
|
+
type: u,
|
|
28
|
+
key: v,
|
|
29
|
+
ref: i !== void 0 ? i : null,
|
|
30
|
+
props: a
|
|
31
|
+
};
|
|
24
32
|
}
|
|
25
|
-
return
|
|
33
|
+
return P.Fragment = m, P.jsx = b, P.jsxs = b, P;
|
|
26
34
|
}
|
|
27
|
-
var
|
|
35
|
+
var A = {};
|
|
28
36
|
/**
|
|
29
37
|
* @license React
|
|
30
38
|
* react-jsx-runtime.development.js
|
|
31
39
|
*
|
|
32
|
-
* Copyright (c)
|
|
40
|
+
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
33
41
|
*
|
|
34
42
|
* This source code is licensed under the MIT license found in the
|
|
35
43
|
* LICENSE file in the root directory of this source tree.
|
|
36
44
|
*/
|
|
37
|
-
var
|
|
38
|
-
function
|
|
39
|
-
return
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
if (
|
|
43
|
-
return null;
|
|
44
|
-
|
|
45
|
-
return typeof r == "function" ? r : null;
|
|
46
|
-
}
|
|
47
|
-
var k = w.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED;
|
|
48
|
-
function v(e) {
|
|
49
|
-
{
|
|
50
|
-
for (var r = arguments.length, t = new Array(r > 1 ? r - 1 : 0), n = 1; n < r; n++)
|
|
51
|
-
t[n - 1] = arguments[n];
|
|
52
|
-
xe("error", e, t);
|
|
53
|
-
}
|
|
54
|
-
}
|
|
55
|
-
function xe(e, r, t) {
|
|
56
|
-
{
|
|
57
|
-
var n = k.ReactDebugCurrentFrame, i = n.getStackAddendum();
|
|
58
|
-
i !== "" && (r += "%s", t = t.concat([i]));
|
|
59
|
-
var s = t.map(function(o) {
|
|
60
|
-
return String(o);
|
|
61
|
-
});
|
|
62
|
-
s.unshift("Warning: " + r), Function.prototype.apply.call(console[e], console, s);
|
|
63
|
-
}
|
|
64
|
-
}
|
|
65
|
-
var ke = !1, De = !1, Fe = !1, Ae = !1, Ie = !1, ee;
|
|
66
|
-
ee = Symbol.for("react.module.reference");
|
|
67
|
-
function $e(e) {
|
|
68
|
-
return !!(typeof e == "string" || typeof e == "function" || e === g || e === S || Ie || e === _ || e === R || e === u || Ae || e === W || ke || De || Fe || typeof e == "object" && e !== null && (e.$$typeof === b || e.$$typeof === d || e.$$typeof === y || e.$$typeof === T || e.$$typeof === f || // This needs to include all possible module reference object
|
|
69
|
-
// types supported by any Flight configuration anywhere since
|
|
70
|
-
// we don't know which Flight build this will end up being used
|
|
71
|
-
// with.
|
|
72
|
-
e.$$typeof === ee || e.getModuleId !== void 0));
|
|
73
|
-
}
|
|
74
|
-
function Le(e, r, t) {
|
|
75
|
-
var n = e.displayName;
|
|
76
|
-
if (n)
|
|
77
|
-
return n;
|
|
78
|
-
var i = r.displayName || r.name || "";
|
|
79
|
-
return i !== "" ? t + "(" + i + ")" : t;
|
|
80
|
-
}
|
|
81
|
-
function re(e) {
|
|
82
|
-
return e.displayName || "Context";
|
|
83
|
-
}
|
|
84
|
-
function O(e) {
|
|
85
|
-
if (e == null)
|
|
86
|
-
return null;
|
|
87
|
-
if (typeof e.tag == "number" && v("Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue."), typeof e == "function")
|
|
88
|
-
return e.displayName || e.name || null;
|
|
89
|
-
if (typeof e == "string")
|
|
90
|
-
return e;
|
|
45
|
+
var Q;
|
|
46
|
+
function le() {
|
|
47
|
+
return Q || (Q = 1, process.env.NODE_ENV !== "production" && function() {
|
|
48
|
+
function d(e) {
|
|
49
|
+
if (e == null) return null;
|
|
50
|
+
if (typeof e == "function")
|
|
51
|
+
return e.$$typeof === re ? null : e.displayName || e.name || null;
|
|
52
|
+
if (typeof e == "string") return e;
|
|
91
53
|
switch (e) {
|
|
92
|
-
case
|
|
54
|
+
case k:
|
|
93
55
|
return "Fragment";
|
|
94
|
-
case
|
|
95
|
-
return "Portal";
|
|
96
|
-
case S:
|
|
56
|
+
case I:
|
|
97
57
|
return "Profiler";
|
|
98
|
-
case
|
|
58
|
+
case N:
|
|
99
59
|
return "StrictMode";
|
|
100
|
-
case
|
|
60
|
+
case h:
|
|
101
61
|
return "Suspense";
|
|
102
|
-
case
|
|
62
|
+
case f:
|
|
103
63
|
return "SuspenseList";
|
|
64
|
+
case ee:
|
|
65
|
+
return "Activity";
|
|
104
66
|
}
|
|
105
67
|
if (typeof e == "object")
|
|
106
|
-
switch (
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
68
|
+
switch (typeof e.tag == "number" && console.error(
|
|
69
|
+
"Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue."
|
|
70
|
+
), e.$$typeof) {
|
|
71
|
+
case S:
|
|
72
|
+
return "Portal";
|
|
73
|
+
case Y:
|
|
74
|
+
return e.displayName || "Context";
|
|
75
|
+
case L:
|
|
76
|
+
return (e._context.displayName || "Context") + ".Consumer";
|
|
77
|
+
case c:
|
|
78
|
+
var r = e.render;
|
|
79
|
+
return e = e.displayName, e || (e = r.displayName || r.name || "", e = e !== "" ? "ForwardRef(" + e + ")" : "ForwardRef"), e;
|
|
110
80
|
case y:
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
return Le(e, e.render, "ForwardRef");
|
|
115
|
-
case d:
|
|
116
|
-
var n = e.displayName || null;
|
|
117
|
-
return n !== null ? n : O(e.type) || "Memo";
|
|
118
|
-
case b: {
|
|
119
|
-
var i = e, s = i._payload, o = i._init;
|
|
81
|
+
return r = e.displayName || null, r !== null ? r : d(e.type) || "Memo";
|
|
82
|
+
case E:
|
|
83
|
+
r = e._payload, e = e._init;
|
|
120
84
|
try {
|
|
121
|
-
return
|
|
85
|
+
return d(e(r));
|
|
122
86
|
} catch {
|
|
123
|
-
return null;
|
|
124
87
|
}
|
|
125
|
-
}
|
|
126
88
|
}
|
|
127
89
|
return null;
|
|
128
90
|
}
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
}
|
|
132
|
-
le.__reactDisabledLog = !0;
|
|
133
|
-
function We() {
|
|
134
|
-
{
|
|
135
|
-
if (A === 0) {
|
|
136
|
-
te = console.log, ne = console.info, ae = console.warn, oe = console.error, ie = console.group, se = console.groupCollapsed, ue = console.groupEnd;
|
|
137
|
-
var e = {
|
|
138
|
-
configurable: !0,
|
|
139
|
-
enumerable: !0,
|
|
140
|
-
value: le,
|
|
141
|
-
writable: !0
|
|
142
|
-
};
|
|
143
|
-
Object.defineProperties(console, {
|
|
144
|
-
info: e,
|
|
145
|
-
log: e,
|
|
146
|
-
warn: e,
|
|
147
|
-
error: e,
|
|
148
|
-
group: e,
|
|
149
|
-
groupCollapsed: e,
|
|
150
|
-
groupEnd: e
|
|
151
|
-
});
|
|
152
|
-
}
|
|
153
|
-
A++;
|
|
154
|
-
}
|
|
155
|
-
}
|
|
156
|
-
function Ye() {
|
|
157
|
-
{
|
|
158
|
-
if (A--, A === 0) {
|
|
159
|
-
var e = {
|
|
160
|
-
configurable: !0,
|
|
161
|
-
enumerable: !0,
|
|
162
|
-
writable: !0
|
|
163
|
-
};
|
|
164
|
-
Object.defineProperties(console, {
|
|
165
|
-
log: P({}, e, {
|
|
166
|
-
value: te
|
|
167
|
-
}),
|
|
168
|
-
info: P({}, e, {
|
|
169
|
-
value: ne
|
|
170
|
-
}),
|
|
171
|
-
warn: P({}, e, {
|
|
172
|
-
value: ae
|
|
173
|
-
}),
|
|
174
|
-
error: P({}, e, {
|
|
175
|
-
value: oe
|
|
176
|
-
}),
|
|
177
|
-
group: P({}, e, {
|
|
178
|
-
value: ie
|
|
179
|
-
}),
|
|
180
|
-
groupCollapsed: P({}, e, {
|
|
181
|
-
value: se
|
|
182
|
-
}),
|
|
183
|
-
groupEnd: P({}, e, {
|
|
184
|
-
value: ue
|
|
185
|
-
})
|
|
186
|
-
});
|
|
187
|
-
}
|
|
188
|
-
A < 0 && v("disabledDepth fell below zero. This is a bug in React. Please file an issue.");
|
|
189
|
-
}
|
|
190
|
-
}
|
|
191
|
-
var N = k.ReactCurrentDispatcher, K;
|
|
192
|
-
function Y(e, r, t) {
|
|
193
|
-
{
|
|
194
|
-
if (K === void 0)
|
|
195
|
-
try {
|
|
196
|
-
throw Error();
|
|
197
|
-
} catch (i) {
|
|
198
|
-
var n = i.stack.trim().match(/\n( *(at )?)/);
|
|
199
|
-
K = n && n[1] || "";
|
|
200
|
-
}
|
|
201
|
-
return `
|
|
202
|
-
` + K + e;
|
|
203
|
-
}
|
|
204
|
-
}
|
|
205
|
-
var B = !1, V;
|
|
206
|
-
{
|
|
207
|
-
var Ve = typeof WeakMap == "function" ? WeakMap : Map;
|
|
208
|
-
V = new Ve();
|
|
91
|
+
function m(e) {
|
|
92
|
+
return "" + e;
|
|
209
93
|
}
|
|
210
|
-
function
|
|
211
|
-
if (!e || B)
|
|
212
|
-
return "";
|
|
213
|
-
{
|
|
214
|
-
var t = V.get(e);
|
|
215
|
-
if (t !== void 0)
|
|
216
|
-
return t;
|
|
217
|
-
}
|
|
218
|
-
var n;
|
|
219
|
-
B = !0;
|
|
220
|
-
var i = Error.prepareStackTrace;
|
|
221
|
-
Error.prepareStackTrace = void 0;
|
|
222
|
-
var s;
|
|
223
|
-
s = N.current, N.current = null, We();
|
|
94
|
+
function b(e) {
|
|
224
95
|
try {
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
if (Object.defineProperty(o.prototype, "props", {
|
|
230
|
-
set: function() {
|
|
231
|
-
throw Error();
|
|
232
|
-
}
|
|
233
|
-
}), typeof Reflect == "object" && Reflect.construct) {
|
|
234
|
-
try {
|
|
235
|
-
Reflect.construct(o, []);
|
|
236
|
-
} catch (h) {
|
|
237
|
-
n = h;
|
|
238
|
-
}
|
|
239
|
-
Reflect.construct(e, [], o);
|
|
240
|
-
} else {
|
|
241
|
-
try {
|
|
242
|
-
o.call();
|
|
243
|
-
} catch (h) {
|
|
244
|
-
n = h;
|
|
245
|
-
}
|
|
246
|
-
e.call(o.prototype);
|
|
247
|
-
}
|
|
248
|
-
} else {
|
|
249
|
-
try {
|
|
250
|
-
throw Error();
|
|
251
|
-
} catch (h) {
|
|
252
|
-
n = h;
|
|
253
|
-
}
|
|
254
|
-
e();
|
|
255
|
-
}
|
|
256
|
-
} catch (h) {
|
|
257
|
-
if (h && n && typeof h.stack == "string") {
|
|
258
|
-
for (var a = h.stack.split(`
|
|
259
|
-
`), p = n.stack.split(`
|
|
260
|
-
`), l = a.length - 1, c = p.length - 1; l >= 1 && c >= 0 && a[l] !== p[c]; )
|
|
261
|
-
c--;
|
|
262
|
-
for (; l >= 1 && c >= 0; l--, c--)
|
|
263
|
-
if (a[l] !== p[c]) {
|
|
264
|
-
if (l !== 1 || c !== 1)
|
|
265
|
-
do
|
|
266
|
-
if (l--, c--, c < 0 || a[l] !== p[c]) {
|
|
267
|
-
var E = `
|
|
268
|
-
` + a[l].replace(" at new ", " at ");
|
|
269
|
-
return e.displayName && E.includes("<anonymous>") && (E = E.replace("<anonymous>", e.displayName)), typeof e == "function" && V.set(e, E), E;
|
|
270
|
-
}
|
|
271
|
-
while (l >= 1 && c >= 0);
|
|
272
|
-
break;
|
|
273
|
-
}
|
|
274
|
-
}
|
|
275
|
-
} finally {
|
|
276
|
-
B = !1, N.current = s, Ye(), Error.prepareStackTrace = i;
|
|
277
|
-
}
|
|
278
|
-
var F = e ? e.displayName || e.name : "", C = F ? Y(F) : "";
|
|
279
|
-
return typeof e == "function" && V.set(e, C), C;
|
|
280
|
-
}
|
|
281
|
-
function Me(e, r, t) {
|
|
282
|
-
return ce(e, !1);
|
|
283
|
-
}
|
|
284
|
-
function Ue(e) {
|
|
285
|
-
var r = e.prototype;
|
|
286
|
-
return !!(r && r.isReactComponent);
|
|
287
|
-
}
|
|
288
|
-
function M(e, r, t) {
|
|
289
|
-
if (e == null)
|
|
290
|
-
return "";
|
|
291
|
-
if (typeof e == "function")
|
|
292
|
-
return ce(e, Ue(e));
|
|
293
|
-
if (typeof e == "string")
|
|
294
|
-
return Y(e);
|
|
295
|
-
switch (e) {
|
|
296
|
-
case R:
|
|
297
|
-
return Y("Suspense");
|
|
298
|
-
case u:
|
|
299
|
-
return Y("SuspenseList");
|
|
300
|
-
}
|
|
301
|
-
if (typeof e == "object")
|
|
302
|
-
switch (e.$$typeof) {
|
|
303
|
-
case f:
|
|
304
|
-
return Me(e.render);
|
|
305
|
-
case d:
|
|
306
|
-
return M(e.type, r, t);
|
|
307
|
-
case b: {
|
|
308
|
-
var n = e, i = n._payload, s = n._init;
|
|
309
|
-
try {
|
|
310
|
-
return M(s(i), r, t);
|
|
311
|
-
} catch {
|
|
312
|
-
}
|
|
313
|
-
}
|
|
314
|
-
}
|
|
315
|
-
return "";
|
|
316
|
-
}
|
|
317
|
-
var I = Object.prototype.hasOwnProperty, fe = {}, de = k.ReactDebugCurrentFrame;
|
|
318
|
-
function U(e) {
|
|
319
|
-
if (e) {
|
|
320
|
-
var r = e._owner, t = M(e.type, e._source, r ? r.type : null);
|
|
321
|
-
de.setExtraStackFrame(t);
|
|
322
|
-
} else
|
|
323
|
-
de.setExtraStackFrame(null);
|
|
324
|
-
}
|
|
325
|
-
function Ne(e, r, t, n, i) {
|
|
326
|
-
{
|
|
327
|
-
var s = Function.call.bind(I);
|
|
328
|
-
for (var o in e)
|
|
329
|
-
if (s(e, o)) {
|
|
330
|
-
var a = void 0;
|
|
331
|
-
try {
|
|
332
|
-
if (typeof e[o] != "function") {
|
|
333
|
-
var p = Error((n || "React class") + ": " + t + " type `" + o + "` is invalid; it must be a function, usually from the `prop-types` package, but received `" + typeof e[o] + "`.This often happens because of typos such as `PropTypes.function` instead of `PropTypes.func`.");
|
|
334
|
-
throw p.name = "Invariant Violation", p;
|
|
335
|
-
}
|
|
336
|
-
a = e[o](r, o, n, t, null, "SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED");
|
|
337
|
-
} catch (l) {
|
|
338
|
-
a = l;
|
|
339
|
-
}
|
|
340
|
-
a && !(a instanceof Error) && (U(i), v("%s: type specification of %s `%s` is invalid; the type checker function must return `null` or an `Error` but returned a %s. You may have forgotten to pass an argument to the type checker creator (arrayOf, instanceOf, objectOf, oneOf, oneOfType, and shape all require an argument).", n || "React class", t, o, typeof a), U(null)), a instanceof Error && !(a.message in fe) && (fe[a.message] = !0, U(i), v("Failed %s type: %s", t, a.message), U(null));
|
|
341
|
-
}
|
|
96
|
+
m(e);
|
|
97
|
+
var r = !1;
|
|
98
|
+
} catch {
|
|
99
|
+
r = !0;
|
|
342
100
|
}
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
return t;
|
|
101
|
+
if (r) {
|
|
102
|
+
r = console;
|
|
103
|
+
var t = r.error, o = typeof Symbol == "function" && Symbol.toStringTag && e[Symbol.toStringTag] || e.constructor.name || "Object";
|
|
104
|
+
return t.call(
|
|
105
|
+
r,
|
|
106
|
+
"The provided key is an unsupported type %s. This value must be coerced to a string before using it here.",
|
|
107
|
+
o
|
|
108
|
+
), m(e);
|
|
352
109
|
}
|
|
353
110
|
}
|
|
354
|
-
function
|
|
111
|
+
function u(e) {
|
|
112
|
+
if (e === k) return "<>";
|
|
113
|
+
if (typeof e == "object" && e !== null && e.$$typeof === E)
|
|
114
|
+
return "<...>";
|
|
355
115
|
try {
|
|
356
|
-
|
|
116
|
+
var r = d(e);
|
|
117
|
+
return r ? "<" + r + ">" : "<...>";
|
|
357
118
|
} catch {
|
|
358
|
-
return
|
|
119
|
+
return "<...>";
|
|
359
120
|
}
|
|
360
121
|
}
|
|
361
|
-
function
|
|
362
|
-
|
|
122
|
+
function i() {
|
|
123
|
+
var e = $.A;
|
|
124
|
+
return e === null ? null : e.getOwner();
|
|
363
125
|
}
|
|
364
|
-
function
|
|
365
|
-
|
|
366
|
-
return v("The provided key is an unsupported type %s. This value must be coerced to a string before before using it here.", Be(e)), ve(e);
|
|
126
|
+
function a() {
|
|
127
|
+
return Error("react-stack-top-frame");
|
|
367
128
|
}
|
|
368
|
-
|
|
369
|
-
key
|
|
370
|
-
ref: !0,
|
|
371
|
-
__self: !0,
|
|
372
|
-
__source: !0
|
|
373
|
-
}, ge, ye;
|
|
374
|
-
function ze(e) {
|
|
375
|
-
if (I.call(e, "ref")) {
|
|
376
|
-
var r = Object.getOwnPropertyDescriptor(e, "ref").get;
|
|
377
|
-
if (r && r.isReactWarning)
|
|
378
|
-
return !1;
|
|
379
|
-
}
|
|
380
|
-
return e.ref !== void 0;
|
|
381
|
-
}
|
|
382
|
-
function Ge(e) {
|
|
383
|
-
if (I.call(e, "key")) {
|
|
129
|
+
function v(e) {
|
|
130
|
+
if (V.call(e, "key")) {
|
|
384
131
|
var r = Object.getOwnPropertyDescriptor(e, "key").get;
|
|
385
|
-
if (r && r.isReactWarning)
|
|
386
|
-
return !1;
|
|
132
|
+
if (r && r.isReactWarning) return !1;
|
|
387
133
|
}
|
|
388
134
|
return e.key !== void 0;
|
|
389
135
|
}
|
|
390
|
-
function
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
ge || (ge = !0, v("%s: `key` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://reactjs.org/link/special-props)", r));
|
|
397
|
-
};
|
|
398
|
-
t.isReactWarning = !0, Object.defineProperty(e, "key", {
|
|
399
|
-
get: t,
|
|
400
|
-
configurable: !0
|
|
401
|
-
});
|
|
402
|
-
}
|
|
403
|
-
}
|
|
404
|
-
function Ze(e, r) {
|
|
405
|
-
{
|
|
406
|
-
var t = function() {
|
|
407
|
-
ye || (ye = !0, v("%s: `ref` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://reactjs.org/link/special-props)", r));
|
|
408
|
-
};
|
|
409
|
-
t.isReactWarning = !0, Object.defineProperty(e, "ref", {
|
|
410
|
-
get: t,
|
|
411
|
-
configurable: !0
|
|
412
|
-
});
|
|
136
|
+
function l(e, r) {
|
|
137
|
+
function t() {
|
|
138
|
+
G || (G = !0, console.error(
|
|
139
|
+
"%s: `key` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://react.dev/link/special-props)",
|
|
140
|
+
r
|
|
141
|
+
));
|
|
413
142
|
}
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
|
|
143
|
+
t.isReactWarning = !0, Object.defineProperty(e, "key", {
|
|
144
|
+
get: t,
|
|
145
|
+
configurable: !0
|
|
146
|
+
});
|
|
147
|
+
}
|
|
148
|
+
function p() {
|
|
149
|
+
var e = d(this.type);
|
|
150
|
+
return q[e] || (q[e] = !0, console.error(
|
|
151
|
+
"Accessing element.ref was removed in React 19. ref is now a regular prop. It will be removed from the JSX Element type in a future release."
|
|
152
|
+
)), e = this.props.ref, e !== void 0 ? e : null;
|
|
153
|
+
}
|
|
154
|
+
function C(e, r, t, o, O, D) {
|
|
155
|
+
var s = t.ref;
|
|
156
|
+
return e = {
|
|
157
|
+
$$typeof: R,
|
|
420
158
|
type: e,
|
|
421
159
|
key: r,
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
|
|
160
|
+
props: t,
|
|
161
|
+
_owner: o
|
|
162
|
+
}, (s !== void 0 ? s : null) !== null ? Object.defineProperty(e, "ref", {
|
|
163
|
+
enumerable: !1,
|
|
164
|
+
get: p
|
|
165
|
+
}) : Object.defineProperty(e, "ref", { enumerable: !1, value: null }), e._store = {}, Object.defineProperty(e._store, "validated", {
|
|
428
166
|
configurable: !1,
|
|
429
167
|
enumerable: !1,
|
|
430
168
|
writable: !0,
|
|
431
|
-
value:
|
|
432
|
-
}), Object.defineProperty(
|
|
169
|
+
value: 0
|
|
170
|
+
}), Object.defineProperty(e, "_debugInfo", {
|
|
433
171
|
configurable: !1,
|
|
434
172
|
enumerable: !1,
|
|
435
|
-
writable: !
|
|
436
|
-
value:
|
|
437
|
-
}), Object.defineProperty(
|
|
173
|
+
writable: !0,
|
|
174
|
+
value: null
|
|
175
|
+
}), Object.defineProperty(e, "_debugStack", {
|
|
438
176
|
configurable: !1,
|
|
439
177
|
enumerable: !1,
|
|
440
|
-
writable: !
|
|
441
|
-
value:
|
|
442
|
-
}), Object.
|
|
443
|
-
|
|
444
|
-
|
|
445
|
-
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
|
|
452
|
-
|
|
453
|
-
|
|
454
|
-
|
|
455
|
-
|
|
456
|
-
|
|
457
|
-
|
|
458
|
-
|
|
459
|
-
|
|
460
|
-
|
|
461
|
-
|
|
462
|
-
|
|
463
|
-
|
|
464
|
-
|
|
465
|
-
|
|
466
|
-
|
|
467
|
-
|
|
468
|
-
|
|
469
|
-
}
|
|
470
|
-
var z;
|
|
471
|
-
z = !1;
|
|
472
|
-
function G(e) {
|
|
473
|
-
return typeof e == "object" && e !== null && e.$$typeof === m;
|
|
474
|
-
}
|
|
475
|
-
function be() {
|
|
476
|
-
{
|
|
477
|
-
if (q.current) {
|
|
478
|
-
var e = O(q.current.type);
|
|
479
|
-
if (e)
|
|
480
|
-
return `
|
|
481
|
-
|
|
482
|
-
Check the render method of \`` + e + "`.";
|
|
483
|
-
}
|
|
484
|
-
return "";
|
|
485
|
-
}
|
|
486
|
-
}
|
|
487
|
-
function rr(e) {
|
|
488
|
-
return "";
|
|
489
|
-
}
|
|
490
|
-
var me = {};
|
|
491
|
-
function tr(e) {
|
|
492
|
-
{
|
|
493
|
-
var r = be();
|
|
494
|
-
if (!r) {
|
|
495
|
-
var t = typeof e == "string" ? e : e.displayName || e.name;
|
|
496
|
-
t && (r = `
|
|
497
|
-
|
|
498
|
-
Check the top-level render call using <` + t + ">.");
|
|
499
|
-
}
|
|
500
|
-
return r;
|
|
501
|
-
}
|
|
502
|
-
}
|
|
503
|
-
function _e(e, r) {
|
|
504
|
-
{
|
|
505
|
-
if (!e._store || e._store.validated || e.key != null)
|
|
506
|
-
return;
|
|
507
|
-
e._store.validated = !0;
|
|
508
|
-
var t = tr(r);
|
|
509
|
-
if (me[t])
|
|
510
|
-
return;
|
|
511
|
-
me[t] = !0;
|
|
512
|
-
var n = "";
|
|
513
|
-
e && e._owner && e._owner !== q.current && (n = " It was passed a child from " + O(e._owner.type) + "."), D(e), v('Each child in a list should have a unique "key" prop.%s%s See https://reactjs.org/link/warning-keys for more information.', t, n), D(null);
|
|
514
|
-
}
|
|
515
|
-
}
|
|
516
|
-
function Re(e, r) {
|
|
517
|
-
{
|
|
518
|
-
if (typeof e != "object")
|
|
519
|
-
return;
|
|
520
|
-
if (J(e))
|
|
521
|
-
for (var t = 0; t < e.length; t++) {
|
|
522
|
-
var n = e[t];
|
|
523
|
-
G(n) && _e(n, r);
|
|
524
|
-
}
|
|
525
|
-
else if (G(e))
|
|
526
|
-
e._store && (e._store.validated = !0);
|
|
527
|
-
else if (e) {
|
|
528
|
-
var i = je(e);
|
|
529
|
-
if (typeof i == "function" && i !== e.entries)
|
|
530
|
-
for (var s = i.call(e), o; !(o = s.next()).done; )
|
|
531
|
-
G(o.value) && _e(o.value, r);
|
|
532
|
-
}
|
|
533
|
-
}
|
|
534
|
-
}
|
|
535
|
-
function nr(e) {
|
|
536
|
-
{
|
|
537
|
-
var r = e.type;
|
|
538
|
-
if (r == null || typeof r == "string")
|
|
539
|
-
return;
|
|
540
|
-
var t;
|
|
541
|
-
if (typeof r == "function")
|
|
542
|
-
t = r.propTypes;
|
|
543
|
-
else if (typeof r == "object" && (r.$$typeof === f || // Note: Memo only checks outer props here.
|
|
544
|
-
// Inner props are checked in the reconciler.
|
|
545
|
-
r.$$typeof === d))
|
|
546
|
-
t = r.propTypes;
|
|
547
|
-
else
|
|
548
|
-
return;
|
|
549
|
-
if (t) {
|
|
550
|
-
var n = O(r);
|
|
551
|
-
Ne(t, e.props, "prop", n, e);
|
|
552
|
-
} else if (r.PropTypes !== void 0 && !z) {
|
|
553
|
-
z = !0;
|
|
554
|
-
var i = O(r);
|
|
555
|
-
v("Component %s declared `PropTypes` instead of `propTypes`. Did you misspell the property assignment?", i || "Unknown");
|
|
556
|
-
}
|
|
557
|
-
typeof r.getDefaultProps == "function" && !r.getDefaultProps.isReactClassApproved && v("getDefaultProps is only used on classic React.createClass definitions. Use a static property named `defaultProps` instead.");
|
|
558
|
-
}
|
|
559
|
-
}
|
|
560
|
-
function ar(e) {
|
|
561
|
-
{
|
|
562
|
-
for (var r = Object.keys(e.props), t = 0; t < r.length; t++) {
|
|
563
|
-
var n = r[t];
|
|
564
|
-
if (n !== "children" && n !== "key") {
|
|
565
|
-
D(e), v("Invalid prop `%s` supplied to `React.Fragment`. React.Fragment can only have `key` and `children` props.", n), D(null);
|
|
566
|
-
break;
|
|
567
|
-
}
|
|
568
|
-
}
|
|
569
|
-
e.ref !== null && (D(e), v("Invalid attribute `ref` supplied to `React.Fragment`."), D(null));
|
|
570
|
-
}
|
|
571
|
-
}
|
|
572
|
-
var Te = {};
|
|
573
|
-
function we(e, r, t, n, i, s) {
|
|
574
|
-
{
|
|
575
|
-
var o = $e(e);
|
|
576
|
-
if (!o) {
|
|
577
|
-
var a = "";
|
|
578
|
-
(e === void 0 || typeof e == "object" && e !== null && Object.keys(e).length === 0) && (a += " You likely forgot to export your component from the file it's defined in, or you might have mixed up default and named imports.");
|
|
579
|
-
var p = rr();
|
|
580
|
-
p ? a += p : a += be();
|
|
581
|
-
var l;
|
|
582
|
-
e === null ? l = "null" : J(e) ? l = "array" : e !== void 0 && e.$$typeof === m ? (l = "<" + (O(e.type) || "Unknown") + " />", a = " Did you accidentally export a JSX literal instead of a component?") : l = typeof e, v("React.jsx: type is invalid -- expected a string (for built-in components) or a class/function (for composite components) but got: %s.%s", l, a);
|
|
583
|
-
}
|
|
584
|
-
var c = er(e, r, t, i, s);
|
|
585
|
-
if (c == null)
|
|
586
|
-
return c;
|
|
587
|
-
if (o) {
|
|
588
|
-
var E = r.children;
|
|
589
|
-
if (E !== void 0)
|
|
590
|
-
if (n)
|
|
591
|
-
if (J(E)) {
|
|
592
|
-
for (var F = 0; F < E.length; F++)
|
|
593
|
-
Re(E[F], e);
|
|
594
|
-
Object.freeze && Object.freeze(E);
|
|
595
|
-
} else
|
|
596
|
-
v("React.jsx: Static children should always be an array. You are likely explicitly calling React.jsxs or React.jsxDEV. Use the Babel transform instead.");
|
|
597
|
-
else
|
|
598
|
-
Re(E, e);
|
|
599
|
-
}
|
|
600
|
-
if (I.call(r, "key")) {
|
|
601
|
-
var C = O(e), h = Object.keys(r).filter(function(cr) {
|
|
602
|
-
return cr !== "key";
|
|
603
|
-
}), X = h.length > 0 ? "{key: someKey, " + h.join(": ..., ") + ": ...}" : "{key: someKey}";
|
|
604
|
-
if (!Te[C + X]) {
|
|
605
|
-
var lr = h.length > 0 ? "{" + h.join(": ..., ") + ": ...}" : "{}";
|
|
606
|
-
v(`A props object containing a "key" prop is being spread into JSX:
|
|
178
|
+
writable: !0,
|
|
179
|
+
value: O
|
|
180
|
+
}), Object.defineProperty(e, "_debugTask", {
|
|
181
|
+
configurable: !1,
|
|
182
|
+
enumerable: !1,
|
|
183
|
+
writable: !0,
|
|
184
|
+
value: D
|
|
185
|
+
}), Object.freeze && (Object.freeze(e.props), Object.freeze(e)), e;
|
|
186
|
+
}
|
|
187
|
+
function T(e, r, t, o, O, D) {
|
|
188
|
+
var s = r.children;
|
|
189
|
+
if (s !== void 0)
|
|
190
|
+
if (o)
|
|
191
|
+
if (te(s)) {
|
|
192
|
+
for (o = 0; o < s.length; o++)
|
|
193
|
+
g(s[o]);
|
|
194
|
+
Object.freeze && Object.freeze(s);
|
|
195
|
+
} else
|
|
196
|
+
console.error(
|
|
197
|
+
"React.jsx: Static children should always be an array. You are likely explicitly calling React.jsxs or React.jsxDEV. Use the Babel transform instead."
|
|
198
|
+
);
|
|
199
|
+
else g(s);
|
|
200
|
+
if (V.call(r, "key")) {
|
|
201
|
+
s = d(e);
|
|
202
|
+
var x = Object.keys(r).filter(function(ne) {
|
|
203
|
+
return ne !== "key";
|
|
204
|
+
});
|
|
205
|
+
o = 0 < x.length ? "{key: someKey, " + x.join(": ..., ") + ": ...}" : "{key: someKey}", J[s + o] || (x = 0 < x.length ? "{" + x.join(": ..., ") + ": ...}" : "{}", console.error(
|
|
206
|
+
`A props object containing a "key" prop is being spread into JSX:
|
|
607
207
|
let props = %s;
|
|
608
208
|
<%s {...props} />
|
|
609
209
|
React keys must be passed directly to JSX without using spread:
|
|
610
210
|
let props = %s;
|
|
611
|
-
<%s key={someKey} {...props} />`,
|
|
612
|
-
|
|
613
|
-
|
|
614
|
-
|
|
211
|
+
<%s key={someKey} {...props} />`,
|
|
212
|
+
o,
|
|
213
|
+
s,
|
|
214
|
+
x,
|
|
215
|
+
s
|
|
216
|
+
), J[s + o] = !0);
|
|
615
217
|
}
|
|
616
|
-
|
|
617
|
-
|
|
618
|
-
|
|
619
|
-
|
|
620
|
-
|
|
621
|
-
return
|
|
622
|
-
|
|
623
|
-
|
|
624
|
-
|
|
625
|
-
|
|
218
|
+
if (s = null, t !== void 0 && (b(t), s = "" + t), v(r) && (b(r.key), s = "" + r.key), "key" in r) {
|
|
219
|
+
t = {};
|
|
220
|
+
for (var U in r)
|
|
221
|
+
U !== "key" && (t[U] = r[U]);
|
|
222
|
+
} else t = r;
|
|
223
|
+
return s && l(
|
|
224
|
+
t,
|
|
225
|
+
typeof e == "function" ? e.displayName || e.name || "Unknown" : e
|
|
226
|
+
), C(
|
|
227
|
+
e,
|
|
228
|
+
s,
|
|
229
|
+
t,
|
|
230
|
+
i(),
|
|
231
|
+
O,
|
|
232
|
+
D
|
|
233
|
+
);
|
|
234
|
+
}
|
|
235
|
+
function g(e) {
|
|
236
|
+
j(e) ? e._store && (e._store.validated = 1) : typeof e == "object" && e !== null && e.$$typeof === E && (e._payload.status === "fulfilled" ? j(e._payload.value) && e._payload.value._store && (e._payload.value._store.validated = 1) : e._store && (e._store.validated = 1));
|
|
237
|
+
}
|
|
238
|
+
function j(e) {
|
|
239
|
+
return typeof e == "object" && e !== null && e.$$typeof === R;
|
|
240
|
+
}
|
|
241
|
+
var _ = oe, R = Symbol.for("react.transitional.element"), S = Symbol.for("react.portal"), k = Symbol.for("react.fragment"), N = Symbol.for("react.strict_mode"), I = Symbol.for("react.profiler"), L = Symbol.for("react.consumer"), Y = Symbol.for("react.context"), c = Symbol.for("react.forward_ref"), h = Symbol.for("react.suspense"), f = Symbol.for("react.suspense_list"), y = Symbol.for("react.memo"), E = Symbol.for("react.lazy"), ee = Symbol.for("react.activity"), re = Symbol.for("react.client.reference"), $ = _.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE, V = Object.prototype.hasOwnProperty, te = Array.isArray, F = console.createTask ? console.createTask : function() {
|
|
242
|
+
return null;
|
|
243
|
+
};
|
|
244
|
+
_ = {
|
|
245
|
+
react_stack_bottom_frame: function(e) {
|
|
246
|
+
return e();
|
|
247
|
+
}
|
|
248
|
+
};
|
|
249
|
+
var G, q = {}, B = _.react_stack_bottom_frame.bind(
|
|
250
|
+
_,
|
|
251
|
+
a
|
|
252
|
+
)(), H = F(u(a)), J = {};
|
|
253
|
+
A.Fragment = k, A.jsx = function(e, r, t) {
|
|
254
|
+
var o = 1e4 > $.recentlyCreatedOwnerStacks++;
|
|
255
|
+
return T(
|
|
256
|
+
e,
|
|
257
|
+
r,
|
|
258
|
+
t,
|
|
259
|
+
!1,
|
|
260
|
+
o ? Error("react-stack-top-frame") : B,
|
|
261
|
+
o ? F(u(e)) : H
|
|
262
|
+
);
|
|
263
|
+
}, A.jsxs = function(e, r, t) {
|
|
264
|
+
var o = 1e4 > $.recentlyCreatedOwnerStacks++;
|
|
265
|
+
return T(
|
|
266
|
+
e,
|
|
267
|
+
r,
|
|
268
|
+
t,
|
|
269
|
+
!0,
|
|
270
|
+
o ? Error("react-stack-top-frame") : B,
|
|
271
|
+
o ? F(u(e)) : H
|
|
272
|
+
);
|
|
273
|
+
};
|
|
274
|
+
}()), A;
|
|
626
275
|
}
|
|
627
|
-
process.env.NODE_ENV === "production" ?
|
|
628
|
-
var
|
|
629
|
-
const
|
|
630
|
-
const
|
|
631
|
-
|
|
632
|
-
|
|
633
|
-
|
|
634
|
-
|
|
635
|
-
|
|
636
|
-
|
|
637
|
-
|
|
638
|
-
|
|
639
|
-
|
|
640
|
-
|
|
641
|
-
|
|
642
|
-
|
|
276
|
+
process.env.NODE_ENV === "production" ? z.exports = ie() : z.exports = le();
|
|
277
|
+
var n = z.exports;
|
|
278
|
+
const ce = ["Smile", "Blink", "Turn_Head", "Thumbs_Up"], K = 90, de = ({ apiUrl: d, onComplete: m }) => {
|
|
279
|
+
const b = se(null), [u, i] = w([]), [a, v] = w(0), [l, p] = w("idle"), [C, T] = w(3), [g, j] = w(K), [_, R] = w(!1), S = () => {
|
|
280
|
+
const c = [...ce].sort(() => 0.5 - Math.random()).slice(0, 3);
|
|
281
|
+
i(c), v(0), p("idle"), T(3), j(K), R(!1);
|
|
282
|
+
};
|
|
283
|
+
X(() => {
|
|
284
|
+
S();
|
|
285
|
+
}, []);
|
|
286
|
+
const k = () => {
|
|
287
|
+
S();
|
|
288
|
+
};
|
|
289
|
+
X(() => {
|
|
290
|
+
let c;
|
|
291
|
+
return _ && g > 0 ? c = setInterval(() => {
|
|
292
|
+
j((h) => h - 1);
|
|
293
|
+
}, 1e3) : g === 0 && l !== "success" && (p("timeout"), R(!1), m && m(!1)), () => clearInterval(c);
|
|
294
|
+
}, [_, g, l]);
|
|
295
|
+
const N = async () => {
|
|
296
|
+
_ || R(!0), p("counting");
|
|
297
|
+
let c = 3;
|
|
298
|
+
const h = setInterval(() => {
|
|
299
|
+
c -= 1, T(c), c === 0 && (clearInterval(h), I());
|
|
300
|
+
}, 1e3);
|
|
301
|
+
}, I = async () => {
|
|
302
|
+
p("capturing");
|
|
303
|
+
const c = [], h = 20;
|
|
304
|
+
for (let f = 0; f < h; f++) {
|
|
305
|
+
const y = b.current.getScreenshot();
|
|
306
|
+
c.push(y), await new Promise((E) => setTimeout(E, 100));
|
|
307
|
+
}
|
|
308
|
+
L(c);
|
|
309
|
+
}, L = async (c) => {
|
|
310
|
+
p("verifying");
|
|
311
|
+
const h = new FormData();
|
|
312
|
+
for (let f = 0; f < c.length; f++) {
|
|
313
|
+
const y = await fetch(c[f]).then((E) => E.blob());
|
|
314
|
+
h.append("files", y, `frame_${f}.jpg`);
|
|
315
|
+
}
|
|
316
|
+
h.append("challenge", u[a]);
|
|
643
317
|
try {
|
|
644
|
-
const
|
|
318
|
+
const y = await (await fetch(`${d}/v1/verify`, {
|
|
645
319
|
method: "POST",
|
|
646
|
-
body:
|
|
320
|
+
body: h
|
|
647
321
|
})).json();
|
|
648
|
-
|
|
649
|
-
} catch {
|
|
650
|
-
|
|
651
|
-
}
|
|
652
|
-
|
|
322
|
+
console.log("API Response:", y.status), y.is_live ? a < 2 ? (v((E) => E + 1), T(3), p("idle")) : (p("success"), m && m(!0)) : (alert("Action not recognized. Please try again!"), p("idle"), T(3));
|
|
323
|
+
} catch (f) {
|
|
324
|
+
console.error("API Error:", f), p("fail");
|
|
325
|
+
}
|
|
326
|
+
}, Y = {
|
|
327
|
+
Smile: "Show us a big SMILE! 😁",
|
|
328
|
+
Blink: "BLINK your eyes rapidly! 👁️",
|
|
329
|
+
Turn_Head: "Slowly TURN your head left and right! ↔️",
|
|
330
|
+
Thumbs_Up: "Give a THUMBS UP! 👍"
|
|
653
331
|
};
|
|
654
|
-
return /* @__PURE__ */
|
|
655
|
-
/* @__PURE__ */
|
|
656
|
-
|
|
657
|
-
|
|
658
|
-
|
|
659
|
-
position: "absolute",
|
|
660
|
-
top: "10%",
|
|
661
|
-
left: "15%",
|
|
662
|
-
width: "70%",
|
|
663
|
-
height: "80%",
|
|
664
|
-
border: "4px solid white",
|
|
665
|
-
borderRadius: "50%",
|
|
666
|
-
pointerEvents: "none"
|
|
667
|
-
} })
|
|
332
|
+
return /* @__PURE__ */ n.jsxs("div", { style: { textAlign: "center", padding: "20px", fontFamily: "sans-serif" }, children: [
|
|
333
|
+
_ && l !== "success" && /* @__PURE__ */ n.jsxs("div", { style: { fontSize: "20px", fontWeight: "bold", color: g < 10 ? "red" : "black" }, children: [
|
|
334
|
+
"Time Remaining: ",
|
|
335
|
+
g,
|
|
336
|
+
"s"
|
|
668
337
|
] }),
|
|
669
|
-
/* @__PURE__ */
|
|
670
|
-
|
|
338
|
+
l === "success" && /* @__PURE__ */ n.jsxs("div", { children: [
|
|
339
|
+
/* @__PURE__ */ n.jsx("h2", { children: "✅ Verification Passed!" }),
|
|
340
|
+
/* @__PURE__ */ n.jsx("button", { onClick: k, style: { ...W, backgroundColor: "#6c757d" }, children: "Verify Again" })
|
|
341
|
+
] }),
|
|
342
|
+
l === "timeout" && /* @__PURE__ */ n.jsxs("div", { children: [
|
|
343
|
+
/* @__PURE__ */ n.jsx("h2", { style: { color: "#dc3545" }, children: "⏰ Session Expired" }),
|
|
344
|
+
/* @__PURE__ */ n.jsx("p", { children: "You didn't complete the challenges in time." }),
|
|
345
|
+
/* @__PURE__ */ n.jsx("p", { children: "Please ensure you follow the instructions and perform the tasks within the time limit. (60 secsonds)" }),
|
|
346
|
+
/* @__PURE__ */ n.jsx("button", { onClick: S, style: W, children: "🔄 Try Again" })
|
|
347
|
+
] }),
|
|
348
|
+
["idle", "counting", "capturing", "verifying"].includes(l) && /* @__PURE__ */ n.jsxs(n.Fragment, { children: [
|
|
349
|
+
/* @__PURE__ */ n.jsx("h2", { children: "Please be in a well-lit room where your face can be well seen." }),
|
|
350
|
+
/* @__PURE__ */ n.jsxs("h3", { children: [
|
|
351
|
+
"Challenge ",
|
|
352
|
+
a + 1,
|
|
353
|
+
" of 3"
|
|
354
|
+
] }),
|
|
355
|
+
/* @__PURE__ */ n.jsx("h2", { style: { color: "#007bff" }, children: Y[u[a]] }),
|
|
356
|
+
/* @__PURE__ */ n.jsxs("div", { style: { position: "relative", width: "fit-content", margin: "auto" }, children: [
|
|
357
|
+
/* @__PURE__ */ n.jsx(
|
|
358
|
+
ae,
|
|
359
|
+
{
|
|
360
|
+
audio: !1,
|
|
361
|
+
ref: b,
|
|
362
|
+
screenshotFormat: "image/jpeg",
|
|
363
|
+
style: { borderRadius: "10px", width: "100%", maxWidth: "400px", transform: "scaleX(-1)" }
|
|
364
|
+
}
|
|
365
|
+
),
|
|
366
|
+
l === "counting" && /* @__PURE__ */ n.jsx("div", { style: M, children: C }),
|
|
367
|
+
l === "verifying" && /* @__PURE__ */ n.jsx("div", { style: M, children: "Analyzing..." }),
|
|
368
|
+
l === "capturing" && /* @__PURE__ */ n.jsx("div", { style: { ...M, background: "rgba(40, 167, 69, 0.3)" }, children: "Recording..." })
|
|
369
|
+
] }),
|
|
370
|
+
/* @__PURE__ */ n.jsx("div", { style: { marginTop: "20px" }, children: l === "idle" && /* @__PURE__ */ n.jsx("button", { onClick: N, style: W, children: "I'm Ready" }) })
|
|
371
|
+
] })
|
|
671
372
|
] });
|
|
672
|
-
},
|
|
673
|
-
|
|
674
|
-
|
|
675
|
-
|
|
676
|
-
|
|
677
|
-
|
|
373
|
+
}, M = {
|
|
374
|
+
position: "absolute",
|
|
375
|
+
top: 0,
|
|
376
|
+
left: 0,
|
|
377
|
+
right: 0,
|
|
378
|
+
bottom: 0,
|
|
379
|
+
background: "rgba(0,0,0,0.5)",
|
|
380
|
+
color: "white",
|
|
381
|
+
display: "flex",
|
|
382
|
+
alignItems: "center",
|
|
383
|
+
justifyContent: "center",
|
|
384
|
+
fontSize: "48px",
|
|
385
|
+
borderRadius: "10px"
|
|
386
|
+
}, W = {
|
|
387
|
+
padding: "10px 30px",
|
|
388
|
+
fontSize: "18px",
|
|
389
|
+
cursor: "pointer",
|
|
390
|
+
backgroundColor: "#28a745",
|
|
391
|
+
color: "white",
|
|
392
|
+
border: "none",
|
|
393
|
+
borderRadius: "5px"
|
|
394
|
+
}, me = async (d, m, b) => {
|
|
395
|
+
const u = new FormData();
|
|
396
|
+
m.forEach((a, v) => {
|
|
397
|
+
u.append("files", a, `frame_${v}.jpg`);
|
|
398
|
+
}), u.append("challenge", b);
|
|
399
|
+
const i = await fetch(`${d}/v1/verify`, {
|
|
678
400
|
method: "POST",
|
|
679
|
-
body:
|
|
401
|
+
body: u
|
|
680
402
|
});
|
|
681
|
-
if (!
|
|
682
|
-
return await
|
|
403
|
+
if (!i.ok) throw new Error("Network response was not ok");
|
|
404
|
+
return await i.json();
|
|
683
405
|
};
|
|
684
406
|
export {
|
|
685
|
-
|
|
686
|
-
|
|
407
|
+
de as LivenessSDK,
|
|
408
|
+
me as verifyLiveness
|
|
687
409
|
};
|
package/dist/index.umd.js
CHANGED
|
@@ -1,30 +1,22 @@
|
|
|
1
|
-
(function(
|
|
1
|
+
(function(E,u){typeof exports=="object"&&typeof module<"u"?u(exports,require("react"),require("react-webcam")):typeof define=="function"&&define.amd?define(["exports","react","react-webcam"],u):(E=typeof globalThis<"u"?globalThis:E||self,u(E.LivenessSDK={},E.React,E.Webcam))})(this,function(E,u,ee){"use strict";var N={exports:{}},j={};/**
|
|
2
2
|
* @license React
|
|
3
|
-
* react-jsx-runtime.production.
|
|
3
|
+
* react-jsx-runtime.production.js
|
|
4
4
|
*
|
|
5
|
-
* Copyright (c)
|
|
5
|
+
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
6
6
|
*
|
|
7
7
|
* This source code is licensed under the MIT license found in the
|
|
8
8
|
* LICENSE file in the root directory of this source tree.
|
|
9
|
-
*/var
|
|
9
|
+
*/var B;function re(){if(B)return j;B=1;var m=Symbol.for("react.transitional.element"),p=Symbol.for("react.fragment");function v(f,i,a){var y=null;if(a!==void 0&&(y=""+a),i.key!==void 0&&(y=""+i.key),"key"in i){a={};for(var l in i)l!=="key"&&(a[l]=i[l])}else a=i;return i=a.ref,{$$typeof:m,type:f,key:y,ref:i!==void 0?i:null,props:a}}return j.Fragment=p,j.jsx=v,j.jsxs=v,j}var k={};/**
|
|
10
10
|
* @license React
|
|
11
11
|
* react-jsx-runtime.development.js
|
|
12
12
|
*
|
|
13
|
-
* Copyright (c)
|
|
13
|
+
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
14
14
|
*
|
|
15
15
|
* This source code is licensed under the MIT license found in the
|
|
16
16
|
* LICENSE file in the root directory of this source tree.
|
|
17
|
-
*/var
|
|
18
|
-
`+z+e}}var G=!1,U;{var Be=typeof WeakMap=="function"?WeakMap:Map;U=new Be}function ve(e,r){if(!e||G)return"";{var t=U.get(e);if(t!==void 0)return t}var n;G=!0;var i=Error.prepareStackTrace;Error.prepareStackTrace=void 0;var s;s=J.current,J.current=null,Ne();try{if(r){var o=function(){throw Error()};if(Object.defineProperty(o.prototype,"props",{set:function(){throw Error()}}),typeof Reflect=="object"&&Reflect.construct){try{Reflect.construct(o,[])}catch(h){n=h}Reflect.construct(e,[],o)}else{try{o.call()}catch(h){n=h}e.call(o.prototype)}}else{try{throw Error()}catch(h){n=h}e()}}catch(h){if(h&&n&&typeof h.stack=="string"){for(var a=h.stack.split(`
|
|
19
|
-
`),p=n.stack.split(`
|
|
20
|
-
`),l=a.length-1,c=p.length-1;l>=1&&c>=0&&a[l]!==p[c];)c--;for(;l>=1&&c>=0;l--,c--)if(a[l]!==p[c]){if(l!==1||c!==1)do if(l--,c--,c<0||a[l]!==p[c]){var b=`
|
|
21
|
-
`+a[l].replace(" at new "," at ");return e.displayName&&b.includes("<anonymous>")&&(b=b.replace("<anonymous>",e.displayName)),typeof e=="function"&&U.set(e,b),b}while(l>=1&&c>=0);break}}}finally{G=!1,J.current=s,Ke(),Error.prepareStackTrace=i}var I=e?e.displayName||e.name:"",k=I?$(I):"";return typeof e=="function"&&U.set(e,k),k}function Je(e,r,t){return ve(e,!1)}function ze(e){var r=e.prototype;return!!(r&&r.isReactComponent)}function N(e,r,t){if(e==null)return"";if(typeof e=="function")return ve(e,ze(e));if(typeof e=="string")return $(e);switch(e){case S:return $("Suspense");case u:return $("SuspenseList")}if(typeof e=="object")switch(e.$$typeof){case f:return Je(e.render);case d:return N(e.type,r,t);case E:{var n=e,i=n._payload,s=n._init;try{return N(s(i),r,t)}catch{}}}return""}var V=Object.prototype.hasOwnProperty,pe={},he=F.ReactDebugCurrentFrame;function K(e){if(e){var r=e._owner,t=N(e.type,e._source,r?r.type:null);he.setExtraStackFrame(t)}else he.setExtraStackFrame(null)}function Ge(e,r,t,n,i){{var s=Function.call.bind(V);for(var o in e)if(s(e,o)){var a=void 0;try{if(typeof e[o]!="function"){var p=Error((n||"React class")+": "+t+" type `"+o+"` is invalid; it must be a function, usually from the `prop-types` package, but received `"+typeof e[o]+"`.This often happens because of typos such as `PropTypes.function` instead of `PropTypes.func`.");throw p.name="Invariant Violation",p}a=e[o](r,o,n,t,null,"SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED")}catch(l){a=l}a&&!(a instanceof Error)&&(K(i),v("%s: type specification of %s `%s` is invalid; the type checker function must return `null` or an `Error` but returned a %s. You may have forgotten to pass an argument to the type checker creator (arrayOf, instanceOf, objectOf, oneOf, oneOfType, and shape all require an argument).",n||"React class",t,o,typeof a),K(null)),a instanceof Error&&!(a.message in pe)&&(pe[a.message]=!0,K(i),v("Failed %s type: %s",t,a.message),K(null))}}}var Xe=Array.isArray;function X(e){return Xe(e)}function qe(e){{var r=typeof Symbol=="function"&&Symbol.toStringTag,t=r&&e[Symbol.toStringTag]||e.constructor.name||"Object";return t}}function He(e){try{return ye(e),!1}catch{return!0}}function ye(e){return""+e}function ge(e){if(He(e))return v("The provided key is an unsupported type %s. This value must be coerced to a string before before using it here.",qe(e)),ye(e)}var be=F.ReactCurrentOwner,Ze={key:!0,ref:!0,__self:!0,__source:!0},Ee,me;function Qe(e){if(V.call(e,"ref")){var r=Object.getOwnPropertyDescriptor(e,"ref").get;if(r&&r.isReactWarning)return!1}return e.ref!==void 0}function er(e){if(V.call(e,"key")){var r=Object.getOwnPropertyDescriptor(e,"key").get;if(r&&r.isReactWarning)return!1}return e.key!==void 0}function rr(e,r){typeof e.ref=="string"&&be.current}function tr(e,r){{var t=function(){Ee||(Ee=!0,v("%s: `key` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://reactjs.org/link/special-props)",r))};t.isReactWarning=!0,Object.defineProperty(e,"key",{get:t,configurable:!0})}}function nr(e,r){{var t=function(){me||(me=!0,v("%s: `ref` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://reactjs.org/link/special-props)",r))};t.isReactWarning=!0,Object.defineProperty(e,"ref",{get:t,configurable:!0})}}var ar=function(e,r,t,n,i,s,o){var a={$$typeof:R,type:e,key:r,ref:t,props:o,_owner:s};return a._store={},Object.defineProperty(a._store,"validated",{configurable:!1,enumerable:!1,writable:!0,value:!1}),Object.defineProperty(a,"_self",{configurable:!1,enumerable:!1,writable:!1,value:n}),Object.defineProperty(a,"_source",{configurable:!1,enumerable:!1,writable:!1,value:i}),Object.freeze&&(Object.freeze(a.props),Object.freeze(a)),a};function or(e,r,t,n,i){{var s,o={},a=null,p=null;t!==void 0&&(ge(t),a=""+t),er(r)&&(ge(r.key),a=""+r.key),Qe(r)&&(p=r.ref,rr(r,i));for(s in r)V.call(r,s)&&!Ze.hasOwnProperty(s)&&(o[s]=r[s]);if(e&&e.defaultProps){var l=e.defaultProps;for(s in l)o[s]===void 0&&(o[s]=l[s])}if(a||p){var c=typeof e=="function"?e.displayName||e.name||"Unknown":e;a&&tr(o,c),p&&nr(o,c)}return ar(e,a,p,i,n,be.current,o)}}var q=F.ReactCurrentOwner,Re=F.ReactDebugCurrentFrame;function A(e){if(e){var r=e._owner,t=N(e.type,e._source,r?r.type:null);Re.setExtraStackFrame(t)}else Re.setExtraStackFrame(null)}var H;H=!1;function Z(e){return typeof e=="object"&&e!==null&&e.$$typeof===R}function _e(){{if(q.current){var e=j(q.current.type);if(e)return`
|
|
22
|
-
|
|
23
|
-
Check the render method of \``+e+"`."}return""}}function ir(e){return""}var Se={};function sr(e){{var r=_e();if(!r){var t=typeof e=="string"?e:e.displayName||e.name;t&&(r=`
|
|
24
|
-
|
|
25
|
-
Check the top-level render call using <`+t+">.")}return r}}function Te(e,r){{if(!e._store||e._store.validated||e.key!=null)return;e._store.validated=!0;var t=sr(r);if(Se[t])return;Se[t]=!0;var n="";e&&e._owner&&e._owner!==q.current&&(n=" It was passed a child from "+j(e._owner.type)+"."),A(e),v('Each child in a list should have a unique "key" prop.%s%s See https://reactjs.org/link/warning-keys for more information.',t,n),A(null)}}function we(e,r){{if(typeof e!="object")return;if(X(e))for(var t=0;t<e.length;t++){var n=e[t];Z(n)&&Te(n,r)}else if(Z(e))e._store&&(e._store.validated=!0);else if(e){var i=Ae(e);if(typeof i=="function"&&i!==e.entries)for(var s=i.call(e),o;!(o=s.next()).done;)Z(o.value)&&Te(o.value,r)}}}function ur(e){{var r=e.type;if(r==null||typeof r=="string")return;var t;if(typeof r=="function")t=r.propTypes;else if(typeof r=="object"&&(r.$$typeof===f||r.$$typeof===d))t=r.propTypes;else return;if(t){var n=j(r);Ge(t,e.props,"prop",n,e)}else if(r.PropTypes!==void 0&&!H){H=!0;var i=j(r);v("Component %s declared `PropTypes` instead of `propTypes`. Did you misspell the property assignment?",i||"Unknown")}typeof r.getDefaultProps=="function"&&!r.getDefaultProps.isReactClassApproved&&v("getDefaultProps is only used on classic React.createClass definitions. Use a static property named `defaultProps` instead.")}}function lr(e){{for(var r=Object.keys(e.props),t=0;t<r.length;t++){var n=r[t];if(n!=="children"&&n!=="key"){A(e),v("Invalid prop `%s` supplied to `React.Fragment`. React.Fragment can only have `key` and `children` props.",n),A(null);break}}e.ref!==null&&(A(e),v("Invalid attribute `ref` supplied to `React.Fragment`."),A(null))}}var Oe={};function Pe(e,r,t,n,i,s){{var o=$e(e);if(!o){var a="";(e===void 0||typeof e=="object"&&e!==null&&Object.keys(e).length===0)&&(a+=" You likely forgot to export your component from the file it's defined in, or you might have mixed up default and named imports.");var p=ir();p?a+=p:a+=_e();var l;e===null?l="null":X(e)?l="array":e!==void 0&&e.$$typeof===R?(l="<"+(j(e.type)||"Unknown")+" />",a=" Did you accidentally export a JSX literal instead of a component?"):l=typeof e,v("React.jsx: type is invalid -- expected a string (for built-in components) or a class/function (for composite components) but got: %s.%s",l,a)}var c=or(e,r,t,i,s);if(c==null)return c;if(o){var b=r.children;if(b!==void 0)if(n)if(X(b)){for(var I=0;I<b.length;I++)we(b[I],e);Object.freeze&&Object.freeze(b)}else v("React.jsx: Static children should always be an array. You are likely explicitly calling React.jsxs or React.jsxDEV. Use the Babel transform instead.");else we(b,e)}if(V.call(r,"key")){var k=j(e),h=Object.keys(r).filter(function(hr){return hr!=="key"}),Q=h.length>0?"{key: someKey, "+h.join(": ..., ")+": ...}":"{key: someKey}";if(!Oe[k+Q]){var pr=h.length>0?"{"+h.join(": ..., ")+": ...}":"{}";v(`A props object containing a "key" prop is being spread into JSX:
|
|
17
|
+
*/var H;function te(){return H||(H=1,process.env.NODE_ENV!=="production"&&function(){function m(e){if(e==null)return null;if(typeof e=="function")return e.$$typeof===ie?null:e.displayName||e.name||null;if(typeof e=="string")return e;switch(e){case O:return"Fragment";case F:return"Profiler";case D:return"StrictMode";case b:return"Suspense";case d:return"SuspenseList";case ae:return"Activity"}if(typeof e=="object")switch(typeof e.tag=="number"&&console.error("Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue."),e.$$typeof){case A:return"Portal";case U:return e.displayName||"Context";case M:return(e._context.displayName||"Context")+".Consumer";case c:var r=e.render;return e=e.displayName,e||(e=r.displayName||r.name||"",e=e!==""?"ForwardRef("+e+")":"ForwardRef"),e;case R:return r=e.displayName||null,r!==null?r:m(e.type)||"Memo";case g:r=e._payload,e=e._init;try{return m(e(r))}catch{}}return null}function p(e){return""+e}function v(e){try{p(e);var r=!1}catch{r=!0}if(r){r=console;var n=r.error,s=typeof Symbol=="function"&&Symbol.toStringTag&&e[Symbol.toStringTag]||e.constructor.name||"Object";return n.call(r,"The provided key is an unsupported type %s. This value must be coerced to a string before using it here.",s),p(e)}}function f(e){if(e===O)return"<>";if(typeof e=="object"&&e!==null&&e.$$typeof===g)return"<...>";try{var r=m(e);return r?"<"+r+">":"<...>"}catch{return"<...>"}}function i(){var e=W.A;return e===null?null:e.getOwner()}function a(){return Error("react-stack-top-frame")}function y(e){if(X.call(e,"key")){var r=Object.getOwnPropertyDescriptor(e,"key").get;if(r&&r.isReactWarning)return!1}return e.key!==void 0}function l(e,r){function n(){K||(K=!0,console.error("%s: `key` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://react.dev/link/special-props)",r))}n.isReactWarning=!0,Object.defineProperty(e,"key",{get:n,configurable:!0})}function h(){var e=m(this.type);return Z[e]||(Z[e]=!0,console.error("Accessing element.ref was removed in React 19. ref is now a regular prop. It will be removed from the JSX Element type in a future release.")),e=this.props.ref,e!==void 0?e:null}function Y(e,r,n,s,C,V){var o=n.ref;return e={$$typeof:x,type:e,key:r,props:n,_owner:s},(o!==void 0?o:null)!==null?Object.defineProperty(e,"ref",{enumerable:!1,get:h}):Object.defineProperty(e,"ref",{enumerable:!1,value:null}),e._store={},Object.defineProperty(e._store,"validated",{configurable:!1,enumerable:!1,writable:!0,value:0}),Object.defineProperty(e,"_debugInfo",{configurable:!1,enumerable:!1,writable:!0,value:null}),Object.defineProperty(e,"_debugStack",{configurable:!1,enumerable:!1,writable:!0,value:C}),Object.defineProperty(e,"_debugTask",{configurable:!1,enumerable:!1,writable:!0,value:V}),Object.freeze&&(Object.freeze(e.props),Object.freeze(e)),e}function S(e,r,n,s,C,V){var o=r.children;if(o!==void 0)if(s)if(le(o)){for(s=0;s<o.length;s++)T(o[s]);Object.freeze&&Object.freeze(o)}else console.error("React.jsx: Static children should always be an array. You are likely explicitly calling React.jsxs or React.jsxDEV. Use the Babel transform instead.");else T(o);if(X.call(r,"key")){o=m(e);var w=Object.keys(r).filter(function(ce){return ce!=="key"});s=0<w.length?"{key: someKey, "+w.join(": ..., ")+": ...}":"{key: someKey}",q[o+s]||(w=0<w.length?"{"+w.join(": ..., ")+": ...}":"{}",console.error(`A props object containing a "key" prop is being spread into JSX:
|
|
26
18
|
let props = %s;
|
|
27
19
|
<%s {...props} />
|
|
28
20
|
React keys must be passed directly to JSX without using spread:
|
|
29
21
|
let props = %s;
|
|
30
|
-
<%s key={someKey} {...props} />`,
|
|
22
|
+
<%s key={someKey} {...props} />`,s,o,w,o),q[o+s]=!0)}if(o=null,n!==void 0&&(v(n),o=""+n),y(r)&&(v(r.key),o=""+r.key),"key"in r){n={};for(var G in r)G!=="key"&&(n[G]=r[G])}else n=r;return o&&l(n,typeof e=="function"?e.displayName||e.name||"Unknown":e),Y(e,o,n,i(),C,V)}function T(e){P(e)?e._store&&(e._store.validated=1):typeof e=="object"&&e!==null&&e.$$typeof===g&&(e._payload.status==="fulfilled"?P(e._payload.value)&&e._payload.value._store&&(e._payload.value._store.validated=1):e._store&&(e._store.validated=1))}function P(e){return typeof e=="object"&&e!==null&&e.$$typeof===x}var _=u,x=Symbol.for("react.transitional.element"),A=Symbol.for("react.portal"),O=Symbol.for("react.fragment"),D=Symbol.for("react.strict_mode"),F=Symbol.for("react.profiler"),M=Symbol.for("react.consumer"),U=Symbol.for("react.context"),c=Symbol.for("react.forward_ref"),b=Symbol.for("react.suspense"),d=Symbol.for("react.suspense_list"),R=Symbol.for("react.memo"),g=Symbol.for("react.lazy"),ae=Symbol.for("react.activity"),ie=Symbol.for("react.client.reference"),W=_.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,X=Object.prototype.hasOwnProperty,le=Array.isArray,z=console.createTask?console.createTask:function(){return null};_={react_stack_bottom_frame:function(e){return e()}};var K,Z={},Q=_.react_stack_bottom_frame.bind(_,a)(),$=z(f(a)),q={};k.Fragment=O,k.jsx=function(e,r,n){var s=1e4>W.recentlyCreatedOwnerStacks++;return S(e,r,n,!1,s?Error("react-stack-top-frame"):Q,s?z(f(e)):$)},k.jsxs=function(e,r,n){var s=1e4>W.recentlyCreatedOwnerStacks++;return S(e,r,n,!0,s?Error("react-stack-top-frame"):Q,s?z(f(e)):$)}}()),k}process.env.NODE_ENV==="production"?N.exports=re():N.exports=te();var t=N.exports;const ne=["Smile","Blink","Turn_Head","Thumbs_Up"],J=90,se=({apiUrl:m,onComplete:p})=>{const v=u.useRef(null),[f,i]=u.useState([]),[a,y]=u.useState(0),[l,h]=u.useState("idle"),[Y,S]=u.useState(3),[T,P]=u.useState(J),[_,x]=u.useState(!1),A=()=>{const c=[...ne].sort(()=>.5-Math.random()).slice(0,3);i(c),y(0),h("idle"),S(3),P(J),x(!1)};u.useEffect(()=>{A()},[]);const O=()=>{A()};u.useEffect(()=>{let c;return _&&T>0?c=setInterval(()=>{P(b=>b-1)},1e3):T===0&&l!=="success"&&(h("timeout"),x(!1),p&&p(!1)),()=>clearInterval(c)},[_,T,l]);const D=async()=>{_||x(!0),h("counting");let c=3;const b=setInterval(()=>{c-=1,S(c),c===0&&(clearInterval(b),F())},1e3)},F=async()=>{h("capturing");const c=[],b=20;for(let d=0;d<b;d++){const R=v.current.getScreenshot();c.push(R),await new Promise(g=>setTimeout(g,100))}M(c)},M=async c=>{h("verifying");const b=new FormData;for(let d=0;d<c.length;d++){const R=await fetch(c[d]).then(g=>g.blob());b.append("files",R,`frame_${d}.jpg`)}b.append("challenge",f[a]);try{const R=await(await fetch(`${m}/v1/verify`,{method:"POST",body:b})).json();console.log("API Response:",R.status),R.is_live?a<2?(y(g=>g+1),S(3),h("idle")):(h("success"),p&&p(!0)):(alert("Action not recognized. Please try again!"),h("idle"),S(3))}catch(d){console.error("API Error:",d),h("fail")}},U={Smile:"Show us a big SMILE! 😁",Blink:"BLINK your eyes rapidly! 👁️",Turn_Head:"Slowly TURN your head left and right! ↔️",Thumbs_Up:"Give a THUMBS UP! 👍"};return t.jsxs("div",{style:{textAlign:"center",padding:"20px",fontFamily:"sans-serif"},children:[_&&l!=="success"&&t.jsxs("div",{style:{fontSize:"20px",fontWeight:"bold",color:T<10?"red":"black"},children:["Time Remaining: ",T,"s"]}),l==="success"&&t.jsxs("div",{children:[t.jsx("h2",{children:"✅ Verification Passed!"}),t.jsx("button",{onClick:O,style:{...L,backgroundColor:"#6c757d"},children:"Verify Again"})]}),l==="timeout"&&t.jsxs("div",{children:[t.jsx("h2",{style:{color:"#dc3545"},children:"⏰ Session Expired"}),t.jsx("p",{children:"You didn't complete the challenges in time."}),t.jsx("p",{children:"Please ensure you follow the instructions and perform the tasks within the time limit. (60 secsonds)"}),t.jsx("button",{onClick:A,style:L,children:"🔄 Try Again"})]}),["idle","counting","capturing","verifying"].includes(l)&&t.jsxs(t.Fragment,{children:[t.jsx("h2",{children:"Please be in a well-lit room where your face can be well seen."}),t.jsxs("h3",{children:["Challenge ",a+1," of 3"]}),t.jsx("h2",{style:{color:"#007bff"},children:U[f[a]]}),t.jsxs("div",{style:{position:"relative",width:"fit-content",margin:"auto"},children:[t.jsx(ee,{audio:!1,ref:v,screenshotFormat:"image/jpeg",style:{borderRadius:"10px",width:"100%",maxWidth:"400px",transform:"scaleX(-1)"}}),l==="counting"&&t.jsx("div",{style:I,children:Y}),l==="verifying"&&t.jsx("div",{style:I,children:"Analyzing..."}),l==="capturing"&&t.jsx("div",{style:{...I,background:"rgba(40, 167, 69, 0.3)"},children:"Recording..."})]}),t.jsx("div",{style:{marginTop:"20px"},children:l==="idle"&&t.jsx("button",{onClick:D,style:L,children:"I'm Ready"})})]})]})},I={position:"absolute",top:0,left:0,right:0,bottom:0,background:"rgba(0,0,0,0.5)",color:"white",display:"flex",alignItems:"center",justifyContent:"center",fontSize:"48px",borderRadius:"10px"},L={padding:"10px 30px",fontSize:"18px",cursor:"pointer",backgroundColor:"#28a745",color:"white",border:"none",borderRadius:"5px"},oe=async(m,p,v)=>{const f=new FormData;p.forEach((a,y)=>{f.append("files",a,`frame_${y}.jpg`)}),f.append("challenge",v);const i=await fetch(`${m}/v1/verify`,{method:"POST",body:f});if(!i.ok)throw new Error("Network response was not ok");return await i.json()};E.LivenessSDK=se,E.verifyLiveness=oe,Object.defineProperty(E,Symbol.toStringTag,{value:"Module"})});
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@richard.fadiora/liveness-detection",
|
|
3
3
|
"private": false,
|
|
4
|
-
"version": "1.0.
|
|
4
|
+
"version": "1.0.1",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"files": [
|
|
7
7
|
"dist"
|
|
@@ -20,8 +20,8 @@
|
|
|
20
20
|
"preview": "vite preview"
|
|
21
21
|
},
|
|
22
22
|
"peerDependencies": {
|
|
23
|
-
"react": "
|
|
24
|
-
"react-dom": "
|
|
23
|
+
"react": ">=18.0.0 <20.0",
|
|
24
|
+
"react-dom": ">=18.0.0 <20.0",
|
|
25
25
|
"react-webcam": "^7.2.0"
|
|
26
26
|
},
|
|
27
27
|
"dependencies": {
|