@richard.fadiora/liveness-detection 1.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.
- package/dist/index.es.js +687 -0
- package/dist/index.umd.js +30 -0
- package/package.json +40 -0
package/dist/index.es.js
ADDED
|
@@ -0,0 +1,687 @@
|
|
|
1
|
+
import Pe, { useRef as fr, useState as H } from "react";
|
|
2
|
+
import dr from "react-webcam";
|
|
3
|
+
var Z = { exports: {} }, $ = {};
|
|
4
|
+
/**
|
|
5
|
+
* @license React
|
|
6
|
+
* react-jsx-runtime.production.min.js
|
|
7
|
+
*
|
|
8
|
+
* Copyright (c) Facebook, Inc. and its affiliates.
|
|
9
|
+
*
|
|
10
|
+
* This source code is licensed under the MIT license found in the
|
|
11
|
+
* LICENSE file in the root directory of this source tree.
|
|
12
|
+
*/
|
|
13
|
+
var Se;
|
|
14
|
+
function vr() {
|
|
15
|
+
if (Se) return $;
|
|
16
|
+
Se = 1;
|
|
17
|
+
var w = Pe, m = Symbol.for("react.element"), x = Symbol.for("react.fragment"), g = Object.prototype.hasOwnProperty, _ = w.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner, S = { key: !0, ref: !0, __self: !0, __source: !0 };
|
|
18
|
+
function y(T, f, R) {
|
|
19
|
+
var u, d = {}, b = null, W = null;
|
|
20
|
+
R !== void 0 && (b = "" + R), f.key !== void 0 && (b = "" + f.key), f.ref !== void 0 && (W = f.ref);
|
|
21
|
+
for (u in f) g.call(f, u) && !S.hasOwnProperty(u) && (d[u] = f[u]);
|
|
22
|
+
if (T && T.defaultProps) for (u in f = T.defaultProps, f) d[u] === void 0 && (d[u] = f[u]);
|
|
23
|
+
return { $$typeof: m, type: T, key: b, ref: W, props: d, _owner: _.current };
|
|
24
|
+
}
|
|
25
|
+
return $.Fragment = x, $.jsx = y, $.jsxs = y, $;
|
|
26
|
+
}
|
|
27
|
+
var L = {};
|
|
28
|
+
/**
|
|
29
|
+
* @license React
|
|
30
|
+
* react-jsx-runtime.development.js
|
|
31
|
+
*
|
|
32
|
+
* Copyright (c) Facebook, Inc. and its affiliates.
|
|
33
|
+
*
|
|
34
|
+
* This source code is licensed under the MIT license found in the
|
|
35
|
+
* LICENSE file in the root directory of this source tree.
|
|
36
|
+
*/
|
|
37
|
+
var Oe;
|
|
38
|
+
function pr() {
|
|
39
|
+
return Oe || (Oe = 1, process.env.NODE_ENV !== "production" && function() {
|
|
40
|
+
var w = Pe, m = Symbol.for("react.element"), x = Symbol.for("react.portal"), g = Symbol.for("react.fragment"), _ = Symbol.for("react.strict_mode"), S = Symbol.for("react.profiler"), y = Symbol.for("react.provider"), T = Symbol.for("react.context"), f = Symbol.for("react.forward_ref"), R = Symbol.for("react.suspense"), u = Symbol.for("react.suspense_list"), d = Symbol.for("react.memo"), b = Symbol.for("react.lazy"), W = Symbol.for("react.offscreen"), Q = Symbol.iterator, Ce = "@@iterator";
|
|
41
|
+
function je(e) {
|
|
42
|
+
if (e === null || typeof e != "object")
|
|
43
|
+
return null;
|
|
44
|
+
var r = Q && e[Q] || e[Ce];
|
|
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;
|
|
91
|
+
switch (e) {
|
|
92
|
+
case g:
|
|
93
|
+
return "Fragment";
|
|
94
|
+
case x:
|
|
95
|
+
return "Portal";
|
|
96
|
+
case S:
|
|
97
|
+
return "Profiler";
|
|
98
|
+
case _:
|
|
99
|
+
return "StrictMode";
|
|
100
|
+
case R:
|
|
101
|
+
return "Suspense";
|
|
102
|
+
case u:
|
|
103
|
+
return "SuspenseList";
|
|
104
|
+
}
|
|
105
|
+
if (typeof e == "object")
|
|
106
|
+
switch (e.$$typeof) {
|
|
107
|
+
case T:
|
|
108
|
+
var r = e;
|
|
109
|
+
return re(r) + ".Consumer";
|
|
110
|
+
case y:
|
|
111
|
+
var t = e;
|
|
112
|
+
return re(t._context) + ".Provider";
|
|
113
|
+
case f:
|
|
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;
|
|
120
|
+
try {
|
|
121
|
+
return O(o(s));
|
|
122
|
+
} catch {
|
|
123
|
+
return null;
|
|
124
|
+
}
|
|
125
|
+
}
|
|
126
|
+
}
|
|
127
|
+
return null;
|
|
128
|
+
}
|
|
129
|
+
var P = Object.assign, A = 0, te, ne, ae, oe, ie, se, ue;
|
|
130
|
+
function le() {
|
|
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();
|
|
209
|
+
}
|
|
210
|
+
function ce(e, r) {
|
|
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();
|
|
224
|
+
try {
|
|
225
|
+
if (r) {
|
|
226
|
+
var o = function() {
|
|
227
|
+
throw Error();
|
|
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
|
+
}
|
|
342
|
+
}
|
|
343
|
+
}
|
|
344
|
+
var Ke = Array.isArray;
|
|
345
|
+
function J(e) {
|
|
346
|
+
return Ke(e);
|
|
347
|
+
}
|
|
348
|
+
function Be(e) {
|
|
349
|
+
{
|
|
350
|
+
var r = typeof Symbol == "function" && Symbol.toStringTag, t = r && e[Symbol.toStringTag] || e.constructor.name || "Object";
|
|
351
|
+
return t;
|
|
352
|
+
}
|
|
353
|
+
}
|
|
354
|
+
function Je(e) {
|
|
355
|
+
try {
|
|
356
|
+
return ve(e), !1;
|
|
357
|
+
} catch {
|
|
358
|
+
return !0;
|
|
359
|
+
}
|
|
360
|
+
}
|
|
361
|
+
function ve(e) {
|
|
362
|
+
return "" + e;
|
|
363
|
+
}
|
|
364
|
+
function pe(e) {
|
|
365
|
+
if (Je(e))
|
|
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);
|
|
367
|
+
}
|
|
368
|
+
var he = k.ReactCurrentOwner, qe = {
|
|
369
|
+
key: !0,
|
|
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")) {
|
|
384
|
+
var r = Object.getOwnPropertyDescriptor(e, "key").get;
|
|
385
|
+
if (r && r.isReactWarning)
|
|
386
|
+
return !1;
|
|
387
|
+
}
|
|
388
|
+
return e.key !== void 0;
|
|
389
|
+
}
|
|
390
|
+
function Xe(e, r) {
|
|
391
|
+
typeof e.ref == "string" && he.current;
|
|
392
|
+
}
|
|
393
|
+
function He(e, r) {
|
|
394
|
+
{
|
|
395
|
+
var t = function() {
|
|
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
|
+
});
|
|
413
|
+
}
|
|
414
|
+
}
|
|
415
|
+
var Qe = function(e, r, t, n, i, s, o) {
|
|
416
|
+
var a = {
|
|
417
|
+
// This tag allows us to uniquely identify this as a React Element
|
|
418
|
+
$$typeof: m,
|
|
419
|
+
// Built-in properties that belong on the element
|
|
420
|
+
type: e,
|
|
421
|
+
key: r,
|
|
422
|
+
ref: t,
|
|
423
|
+
props: o,
|
|
424
|
+
// Record the component responsible for creating this element.
|
|
425
|
+
_owner: s
|
|
426
|
+
};
|
|
427
|
+
return a._store = {}, Object.defineProperty(a._store, "validated", {
|
|
428
|
+
configurable: !1,
|
|
429
|
+
enumerable: !1,
|
|
430
|
+
writable: !0,
|
|
431
|
+
value: !1
|
|
432
|
+
}), Object.defineProperty(a, "_self", {
|
|
433
|
+
configurable: !1,
|
|
434
|
+
enumerable: !1,
|
|
435
|
+
writable: !1,
|
|
436
|
+
value: n
|
|
437
|
+
}), Object.defineProperty(a, "_source", {
|
|
438
|
+
configurable: !1,
|
|
439
|
+
enumerable: !1,
|
|
440
|
+
writable: !1,
|
|
441
|
+
value: i
|
|
442
|
+
}), Object.freeze && (Object.freeze(a.props), Object.freeze(a)), a;
|
|
443
|
+
};
|
|
444
|
+
function er(e, r, t, n, i) {
|
|
445
|
+
{
|
|
446
|
+
var s, o = {}, a = null, p = null;
|
|
447
|
+
t !== void 0 && (pe(t), a = "" + t), Ge(r) && (pe(r.key), a = "" + r.key), ze(r) && (p = r.ref, Xe(r, i));
|
|
448
|
+
for (s in r)
|
|
449
|
+
I.call(r, s) && !qe.hasOwnProperty(s) && (o[s] = r[s]);
|
|
450
|
+
if (e && e.defaultProps) {
|
|
451
|
+
var l = e.defaultProps;
|
|
452
|
+
for (s in l)
|
|
453
|
+
o[s] === void 0 && (o[s] = l[s]);
|
|
454
|
+
}
|
|
455
|
+
if (a || p) {
|
|
456
|
+
var c = typeof e == "function" ? e.displayName || e.name || "Unknown" : e;
|
|
457
|
+
a && He(o, c), p && Ze(o, c);
|
|
458
|
+
}
|
|
459
|
+
return Qe(e, a, p, i, n, he.current, o);
|
|
460
|
+
}
|
|
461
|
+
}
|
|
462
|
+
var q = k.ReactCurrentOwner, Ee = k.ReactDebugCurrentFrame;
|
|
463
|
+
function D(e) {
|
|
464
|
+
if (e) {
|
|
465
|
+
var r = e._owner, t = M(e.type, e._source, r ? r.type : null);
|
|
466
|
+
Ee.setExtraStackFrame(t);
|
|
467
|
+
} else
|
|
468
|
+
Ee.setExtraStackFrame(null);
|
|
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:
|
|
607
|
+
let props = %s;
|
|
608
|
+
<%s {...props} />
|
|
609
|
+
React keys must be passed directly to JSX without using spread:
|
|
610
|
+
let props = %s;
|
|
611
|
+
<%s key={someKey} {...props} />`, X, C, lr, C), Te[C + X] = !0;
|
|
612
|
+
}
|
|
613
|
+
}
|
|
614
|
+
return e === g ? ar(c) : nr(c), c;
|
|
615
|
+
}
|
|
616
|
+
}
|
|
617
|
+
function or(e, r, t) {
|
|
618
|
+
return we(e, r, t, !0);
|
|
619
|
+
}
|
|
620
|
+
function ir(e, r, t) {
|
|
621
|
+
return we(e, r, t, !1);
|
|
622
|
+
}
|
|
623
|
+
var sr = ir, ur = or;
|
|
624
|
+
L.Fragment = g, L.jsx = sr, L.jsxs = ur;
|
|
625
|
+
}()), L;
|
|
626
|
+
}
|
|
627
|
+
process.env.NODE_ENV === "production" ? Z.exports = vr() : Z.exports = pr();
|
|
628
|
+
var j = Z.exports;
|
|
629
|
+
const yr = () => {
|
|
630
|
+
const w = fr(null), [m, x] = H("SMILE"), [g, _] = H(!1), [S, y] = H("Position your face"), T = async () => {
|
|
631
|
+
_(!0), y(`ACTION: ${m}`);
|
|
632
|
+
const f = [];
|
|
633
|
+
for (let u = 0; u < 10; u++) {
|
|
634
|
+
const d = w.current.getScreenshot();
|
|
635
|
+
f.push(d), await new Promise((b) => setTimeout(b, 100));
|
|
636
|
+
}
|
|
637
|
+
const R = new FormData();
|
|
638
|
+
for (let u = 0; u < f.length; u++) {
|
|
639
|
+
const d = await fetch(f[u]).then((b) => b.blob());
|
|
640
|
+
R.append("files", d, `frame_${u}.jpg`);
|
|
641
|
+
}
|
|
642
|
+
R.append("challenge", m);
|
|
643
|
+
try {
|
|
644
|
+
const d = await (await fetch("http://localhost:8000/v1/verify", {
|
|
645
|
+
method: "POST",
|
|
646
|
+
body: R
|
|
647
|
+
})).json();
|
|
648
|
+
d.is_live ? y("VERIFIED: LIVE USER") : y(`FAILED: ${d.reason || "SPOOF DETECTED"}`);
|
|
649
|
+
} catch {
|
|
650
|
+
y("Server Error. Check Python API.");
|
|
651
|
+
}
|
|
652
|
+
_(!1);
|
|
653
|
+
};
|
|
654
|
+
return /* @__PURE__ */ j.jsxs("div", { style: { textAlign: "center" }, children: [
|
|
655
|
+
/* @__PURE__ */ j.jsx("h2", { children: "Liveness Detection SDK" }),
|
|
656
|
+
/* @__PURE__ */ j.jsxs("div", { style: { position: "relative", display: "inline-block" }, children: [
|
|
657
|
+
/* @__PURE__ */ j.jsx(dr, { ref: w, screenshotFormat: "image/jpeg" }),
|
|
658
|
+
/* @__PURE__ */ j.jsx("div", { style: {
|
|
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
|
+
} })
|
|
668
|
+
] }),
|
|
669
|
+
/* @__PURE__ */ j.jsx("h3", { children: S }),
|
|
670
|
+
/* @__PURE__ */ j.jsx("button", { onClick: T, disabled: g, children: g ? "Analyzing..." : "Start Liveness Check" })
|
|
671
|
+
] });
|
|
672
|
+
}, Er = async (w, m, x) => {
|
|
673
|
+
const g = new FormData();
|
|
674
|
+
m.forEach((S, y) => {
|
|
675
|
+
g.append("files", S, `frame_${y}.jpg`);
|
|
676
|
+
}), g.append("challenge", x);
|
|
677
|
+
const _ = await fetch(`${w}/v1/verify`, {
|
|
678
|
+
method: "POST",
|
|
679
|
+
body: g
|
|
680
|
+
});
|
|
681
|
+
if (!_.ok) throw new Error("Network response was not ok");
|
|
682
|
+
return await _.json();
|
|
683
|
+
};
|
|
684
|
+
export {
|
|
685
|
+
yr as LivenessSDK,
|
|
686
|
+
Er as verifyLiveness
|
|
687
|
+
};
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
(function(T,m){typeof exports=="object"&&typeof module<"u"?m(exports,require("react"),require("react-webcam")):typeof define=="function"&&define.amd?define(["exports","react","react-webcam"],m):(T=typeof globalThis<"u"?globalThis:T||self,m(T.LivenessSDK={},T.React,T.Webcam))})(this,function(T,m,je){"use strict";var B={exports:{}},L={};/**
|
|
2
|
+
* @license React
|
|
3
|
+
* react-jsx-runtime.production.min.js
|
|
4
|
+
*
|
|
5
|
+
* Copyright (c) Facebook, Inc. and its affiliates.
|
|
6
|
+
*
|
|
7
|
+
* This source code is licensed under the MIT license found in the
|
|
8
|
+
* LICENSE file in the root directory of this source tree.
|
|
9
|
+
*/var ee;function Ce(){if(ee)return L;ee=1;var O=m,R=Symbol.for("react.element"),D=Symbol.for("react.fragment"),y=Object.prototype.hasOwnProperty,_=O.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,P={key:!0,ref:!0,__self:!0,__source:!0};function g(w,f,S){var u,d={},E=null,M=null;S!==void 0&&(E=""+S),f.key!==void 0&&(E=""+f.key),f.ref!==void 0&&(M=f.ref);for(u in f)y.call(f,u)&&!P.hasOwnProperty(u)&&(d[u]=f[u]);if(w&&w.defaultProps)for(u in f=w.defaultProps,f)d[u]===void 0&&(d[u]=f[u]);return{$$typeof:R,type:w,key:E,ref:M,props:d,_owner:_.current}}return L.Fragment=D,L.jsx=g,L.jsxs=g,L}var W={};/**
|
|
10
|
+
* @license React
|
|
11
|
+
* react-jsx-runtime.development.js
|
|
12
|
+
*
|
|
13
|
+
* Copyright (c) Facebook, Inc. and its affiliates.
|
|
14
|
+
*
|
|
15
|
+
* This source code is licensed under the MIT license found in the
|
|
16
|
+
* LICENSE file in the root directory of this source tree.
|
|
17
|
+
*/var re;function xe(){return re||(re=1,process.env.NODE_ENV!=="production"&&function(){var O=m,R=Symbol.for("react.element"),D=Symbol.for("react.portal"),y=Symbol.for("react.fragment"),_=Symbol.for("react.strict_mode"),P=Symbol.for("react.profiler"),g=Symbol.for("react.provider"),w=Symbol.for("react.context"),f=Symbol.for("react.forward_ref"),S=Symbol.for("react.suspense"),u=Symbol.for("react.suspense_list"),d=Symbol.for("react.memo"),E=Symbol.for("react.lazy"),M=Symbol.for("react.offscreen"),te=Symbol.iterator,Fe="@@iterator";function Ae(e){if(e===null||typeof e!="object")return null;var r=te&&e[te]||e[Fe];return typeof r=="function"?r:null}var F=O.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED;function v(e){{for(var r=arguments.length,t=new Array(r>1?r-1:0),n=1;n<r;n++)t[n-1]=arguments[n];Ie("error",e,t)}}function Ie(e,r,t){{var n=F.ReactDebugCurrentFrame,i=n.getStackAddendum();i!==""&&(r+="%s",t=t.concat([i]));var s=t.map(function(o){return String(o)});s.unshift("Warning: "+r),Function.prototype.apply.call(console[e],console,s)}}var Le=!1,We=!1,Ye=!1,Ve=!1,Me=!1,ne;ne=Symbol.for("react.module.reference");function $e(e){return!!(typeof e=="string"||typeof e=="function"||e===y||e===P||Me||e===_||e===S||e===u||Ve||e===M||Le||We||Ye||typeof e=="object"&&e!==null&&(e.$$typeof===E||e.$$typeof===d||e.$$typeof===g||e.$$typeof===w||e.$$typeof===f||e.$$typeof===ne||e.getModuleId!==void 0))}function Ue(e,r,t){var n=e.displayName;if(n)return n;var i=r.displayName||r.name||"";return i!==""?t+"("+i+")":t}function ae(e){return e.displayName||"Context"}function j(e){if(e==null)return null;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")return e.displayName||e.name||null;if(typeof e=="string")return e;switch(e){case y:return"Fragment";case D:return"Portal";case P:return"Profiler";case _:return"StrictMode";case S:return"Suspense";case u:return"SuspenseList"}if(typeof e=="object")switch(e.$$typeof){case w:var r=e;return ae(r)+".Consumer";case g:var t=e;return ae(t._context)+".Provider";case f:return Ue(e,e.render,"ForwardRef");case d:var n=e.displayName||null;return n!==null?n:j(e.type)||"Memo";case E:{var i=e,s=i._payload,o=i._init;try{return j(o(s))}catch{return null}}}return null}var x=Object.assign,Y=0,oe,ie,se,ue,le,ce,fe;function de(){}de.__reactDisabledLog=!0;function Ne(){{if(Y===0){oe=console.log,ie=console.info,se=console.warn,ue=console.error,le=console.group,ce=console.groupCollapsed,fe=console.groupEnd;var e={configurable:!0,enumerable:!0,value:de,writable:!0};Object.defineProperties(console,{info:e,log:e,warn:e,error:e,group:e,groupCollapsed:e,groupEnd:e})}Y++}}function Ke(){{if(Y--,Y===0){var e={configurable:!0,enumerable:!0,writable:!0};Object.defineProperties(console,{log:x({},e,{value:oe}),info:x({},e,{value:ie}),warn:x({},e,{value:se}),error:x({},e,{value:ue}),group:x({},e,{value:le}),groupCollapsed:x({},e,{value:ce}),groupEnd:x({},e,{value:fe})})}Y<0&&v("disabledDepth fell below zero. This is a bug in React. Please file an issue.")}}var J=F.ReactCurrentDispatcher,z;function $(e,r,t){{if(z===void 0)try{throw Error()}catch(i){var n=i.stack.trim().match(/\n( *(at )?)/);z=n&&n[1]||""}return`
|
|
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:
|
|
26
|
+
let props = %s;
|
|
27
|
+
<%s {...props} />
|
|
28
|
+
React keys must be passed directly to JSX without using spread:
|
|
29
|
+
let props = %s;
|
|
30
|
+
<%s key={someKey} {...props} />`,Q,k,pr,k),Oe[k+Q]=!0}}return e===y?lr(c):ur(c),c}}function cr(e,r,t){return Pe(e,r,t,!0)}function fr(e,r,t){return Pe(e,r,t,!1)}var dr=fr,vr=cr;W.Fragment=y,W.jsx=dr,W.jsxs=vr}()),W}process.env.NODE_ENV==="production"?B.exports=Ce():B.exports=xe();var C=B.exports;const ke=()=>{const O=m.useRef(null),[R,D]=m.useState("SMILE"),[y,_]=m.useState(!1),[P,g]=m.useState("Position your face"),w=async()=>{_(!0),g(`ACTION: ${R}`);const f=[];for(let u=0;u<10;u++){const d=O.current.getScreenshot();f.push(d),await new Promise(E=>setTimeout(E,100))}const S=new FormData;for(let u=0;u<f.length;u++){const d=await fetch(f[u]).then(E=>E.blob());S.append("files",d,`frame_${u}.jpg`)}S.append("challenge",R);try{const d=await(await fetch("http://localhost:8000/v1/verify",{method:"POST",body:S})).json();d.is_live?g("VERIFIED: LIVE USER"):g(`FAILED: ${d.reason||"SPOOF DETECTED"}`)}catch{g("Server Error. Check Python API.")}_(!1)};return C.jsxs("div",{style:{textAlign:"center"},children:[C.jsx("h2",{children:"Liveness Detection SDK"}),C.jsxs("div",{style:{position:"relative",display:"inline-block"},children:[C.jsx(je,{ref:O,screenshotFormat:"image/jpeg"}),C.jsx("div",{style:{position:"absolute",top:"10%",left:"15%",width:"70%",height:"80%",border:"4px solid white",borderRadius:"50%",pointerEvents:"none"}})]}),C.jsx("h3",{children:P}),C.jsx("button",{onClick:w,disabled:y,children:y?"Analyzing...":"Start Liveness Check"})]})},De=async(O,R,D)=>{const y=new FormData;R.forEach((P,g)=>{y.append("files",P,`frame_${g}.jpg`)}),y.append("challenge",D);const _=await fetch(`${O}/v1/verify`,{method:"POST",body:y});if(!_.ok)throw new Error("Network response was not ok");return await _.json()};T.LivenessSDK=ke,T.verifyLiveness=De,Object.defineProperty(T,Symbol.toStringTag,{value:"Module"})});
|
package/package.json
ADDED
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@richard.fadiora/liveness-detection",
|
|
3
|
+
"private": false,
|
|
4
|
+
"version": "1.0.0",
|
|
5
|
+
"type": "module",
|
|
6
|
+
"files": [
|
|
7
|
+
"dist"
|
|
8
|
+
],
|
|
9
|
+
"main": "./dist/index.umd.cjs",
|
|
10
|
+
"module": "./dist/index.js",
|
|
11
|
+
"exports": {
|
|
12
|
+
".": {
|
|
13
|
+
"import": "./dist/index.es.js",
|
|
14
|
+
"require": "./dist/index.umd.js"
|
|
15
|
+
}
|
|
16
|
+
},
|
|
17
|
+
"scripts": {
|
|
18
|
+
"dev": "vite",
|
|
19
|
+
"build": "vite build",
|
|
20
|
+
"preview": "vite preview"
|
|
21
|
+
},
|
|
22
|
+
"peerDependencies": {
|
|
23
|
+
"react": "^18.0.0",
|
|
24
|
+
"react-dom": "^18.0.0",
|
|
25
|
+
"react-webcam": "^7.2.0"
|
|
26
|
+
},
|
|
27
|
+
"dependencies": {
|
|
28
|
+
"react-webcam": "^7.2.0"
|
|
29
|
+
},
|
|
30
|
+
"devDependencies": {
|
|
31
|
+
"@types/react": "^18.0.0",
|
|
32
|
+
"@types/react-dom": "^18.0.0",
|
|
33
|
+
"@vitejs/plugin-react": "^4.0.0",
|
|
34
|
+
"vite": "^5.0.0"
|
|
35
|
+
},
|
|
36
|
+
"description": "",
|
|
37
|
+
"keywords": [],
|
|
38
|
+
"author": "",
|
|
39
|
+
"license": "ISC"
|
|
40
|
+
}
|