@aws-amplify/ui-react-liveness 0.0.0-next-43a297e-20230410194306
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/LICENSE +201 -0
- package/README.md +23 -0
- package/dist/esm/components/FaceLivenessDetector/FaceLivenessDetector.mjs +1 -0
- package/dist/esm/components/FaceLivenessDetector/LivenessCheck/LivenessCameraModule.mjs +1 -0
- package/dist/esm/components/FaceLivenessDetector/LivenessCheck/LivenessCheck.mjs +1 -0
- package/dist/esm/components/FaceLivenessDetector/StartLiveness/StartLiveness.mjs +1 -0
- package/dist/esm/components/FaceLivenessDetector/StartLiveness/helpers.mjs +1 -0
- package/dist/esm/components/FaceLivenessDetector/displayText.mjs +1 -0
- package/dist/esm/components/FaceLivenessDetector/hooks/useLivenessActor.mjs +1 -0
- package/dist/esm/components/FaceLivenessDetector/hooks/useLivenessSelector.mjs +1 -0
- package/dist/esm/components/FaceLivenessDetector/hooks/useMediaStreamInVideo.mjs +1 -0
- package/dist/esm/components/FaceLivenessDetector/providers/FaceLivenessDetectorProvider.mjs +1 -0
- package/dist/esm/components/FaceLivenessDetector/service/machine/index.mjs +1 -0
- package/dist/esm/components/FaceLivenessDetector/service/types/faceDetection.mjs +1 -0
- package/dist/esm/components/FaceLivenessDetector/service/types/liveness.mjs +1 -0
- package/dist/esm/components/FaceLivenessDetector/service/utils/blazefaceFaceDetection.mjs +1 -0
- package/dist/esm/components/FaceLivenessDetector/service/utils/constants.mjs +1 -0
- package/dist/esm/components/FaceLivenessDetector/service/utils/eventUtils.mjs +1 -0
- package/dist/esm/components/FaceLivenessDetector/service/utils/freshnessColorDisplay.mjs +1 -0
- package/dist/esm/components/FaceLivenessDetector/service/utils/liveness.mjs +1 -0
- package/dist/esm/components/FaceLivenessDetector/service/utils/streamProvider.mjs +1 -0
- package/dist/esm/components/FaceLivenessDetector/service/utils/support.mjs +1 -0
- package/dist/esm/components/FaceLivenessDetector/service/utils/videoRecorder.mjs +1 -0
- package/dist/esm/components/FaceLivenessDetector/shared/CancelButton.mjs +1 -0
- package/dist/esm/components/FaceLivenessDetector/shared/DefaultStartScreenComponents.mjs +1 -0
- package/dist/esm/components/FaceLivenessDetector/shared/FaceLivenessErrorModal.mjs +1 -0
- package/dist/esm/components/FaceLivenessDetector/shared/GoodFitIllustration.mjs +1 -0
- package/dist/esm/components/FaceLivenessDetector/shared/Hint.mjs +1 -0
- package/dist/esm/components/FaceLivenessDetector/shared/LandscapeErrorModal.mjs +1 -0
- package/dist/esm/components/FaceLivenessDetector/shared/LivenessIconWithPopover.mjs +1 -0
- package/dist/esm/components/FaceLivenessDetector/shared/MatchIndicator.mjs +1 -0
- package/dist/esm/components/FaceLivenessDetector/shared/Overlay.mjs +1 -0
- package/dist/esm/components/FaceLivenessDetector/shared/RecordingIcon.mjs +1 -0
- package/dist/esm/components/FaceLivenessDetector/shared/StartScreenFigure.mjs +1 -0
- package/dist/esm/components/FaceLivenessDetector/shared/Toast.mjs +1 -0
- package/dist/esm/components/FaceLivenessDetector/shared/TooFarIllustration.mjs +1 -0
- package/dist/esm/components/FaceLivenessDetector/types/classNames.mjs +1 -0
- package/dist/esm/components/FaceLivenessDetector/utils/device.mjs +1 -0
- package/dist/esm/components/FaceLivenessDetector/utils/getDisplayText.mjs +1 -0
- package/dist/esm/index.mjs +1 -0
- package/dist/esm/node_modules/tslib/tslib.es6.mjs +1 -0
- package/dist/index.js +1 -0
- package/dist/styles.css +5028 -0
- package/dist/styles.js +2 -0
- package/dist/types/components/FaceLivenessDetector/FaceLivenessDetector.d.ts +12 -0
- package/dist/types/components/FaceLivenessDetector/LivenessCheck/LivenessCameraModule.d.ts +18 -0
- package/dist/types/components/FaceLivenessDetector/LivenessCheck/LivenessCheck.d.ts +15 -0
- package/dist/types/components/FaceLivenessDetector/LivenessCheck/index.d.ts +1 -0
- package/dist/types/components/FaceLivenessDetector/StartLiveness/StartLiveness.d.ts +9 -0
- package/dist/types/components/FaceLivenessDetector/StartLiveness/helpers.d.ts +1 -0
- package/dist/types/components/FaceLivenessDetector/StartLiveness/index.d.ts +1 -0
- package/dist/types/components/FaceLivenessDetector/displayText.d.ts +62 -0
- package/dist/types/components/FaceLivenessDetector/hooks/index.d.ts +3 -0
- package/dist/types/components/FaceLivenessDetector/hooks/useLivenessActor.d.ts +1 -0
- package/dist/types/components/FaceLivenessDetector/hooks/useLivenessSelector.d.ts +4 -0
- package/dist/types/components/FaceLivenessDetector/hooks/useMediaStreamInVideo.d.ts +7 -0
- package/dist/types/components/FaceLivenessDetector/index.d.ts +1 -0
- package/dist/types/components/FaceLivenessDetector/providers/FaceLivenessDetectorProvider.d.ts +12 -0
- package/dist/types/components/FaceLivenessDetector/providers/index.d.ts +1 -0
- package/dist/types/components/FaceLivenessDetector/service/index.d.ts +3 -0
- package/dist/types/components/FaceLivenessDetector/service/machine/index.d.ts +6 -0
- package/dist/types/components/FaceLivenessDetector/service/types/faceDetection.d.ts +36 -0
- package/dist/types/components/FaceLivenessDetector/service/types/index.d.ts +3 -0
- package/dist/types/components/FaceLivenessDetector/service/types/liveness.d.ts +98 -0
- package/dist/types/components/FaceLivenessDetector/service/types/machine.d.ts +102 -0
- package/dist/types/components/FaceLivenessDetector/service/types/service.d.ts +74 -0
- package/dist/types/components/FaceLivenessDetector/service/utils/blazefaceFaceDetection.d.ts +18 -0
- package/dist/types/components/FaceLivenessDetector/service/utils/constants.d.ts +3 -0
- package/dist/types/components/FaceLivenessDetector/service/utils/eventUtils.d.ts +12 -0
- package/dist/types/components/FaceLivenessDetector/service/utils/freshnessColorDisplay.d.ts +22 -0
- package/dist/types/components/FaceLivenessDetector/service/utils/index.d.ts +6 -0
- package/dist/types/components/FaceLivenessDetector/service/utils/liveness.d.ts +101 -0
- package/dist/types/components/FaceLivenessDetector/service/utils/streamProvider.d.ts +37 -0
- package/dist/types/components/FaceLivenessDetector/service/utils/support.d.ts +8 -0
- package/dist/types/components/FaceLivenessDetector/service/utils/videoRecorder.d.ts +30 -0
- package/dist/types/components/FaceLivenessDetector/shared/CancelButton.d.ts +5 -0
- package/dist/types/components/FaceLivenessDetector/shared/DefaultStartScreenComponents.d.ts +27 -0
- package/dist/types/components/FaceLivenessDetector/shared/FaceLivenessErrorModal.d.ts +29 -0
- package/dist/types/components/FaceLivenessDetector/shared/GoodFitIllustration.d.ts +7 -0
- package/dist/types/components/FaceLivenessDetector/shared/Hint.d.ts +12 -0
- package/dist/types/components/FaceLivenessDetector/shared/LandscapeErrorModal.d.ts +10 -0
- package/dist/types/components/FaceLivenessDetector/shared/LivenessIconWithPopover.d.ts +9 -0
- package/dist/types/components/FaceLivenessDetector/shared/MatchIndicator.d.ts +8 -0
- package/dist/types/components/FaceLivenessDetector/shared/Overlay.d.ts +11 -0
- package/dist/types/components/FaceLivenessDetector/shared/RecordingIcon.d.ts +6 -0
- package/dist/types/components/FaceLivenessDetector/shared/StartScreenFigure.d.ts +8 -0
- package/dist/types/components/FaceLivenessDetector/shared/Toast.d.ts +9 -0
- package/dist/types/components/FaceLivenessDetector/shared/TooFarIllustration.d.ts +7 -0
- package/dist/types/components/FaceLivenessDetector/shared/index.d.ts +8 -0
- package/dist/types/components/FaceLivenessDetector/types/classNames.d.ts +27 -0
- package/dist/types/components/FaceLivenessDetector/utils/device.d.ts +10 -0
- package/dist/types/components/FaceLivenessDetector/utils/getDisplayText.d.ts +17 -0
- package/dist/types/components/index.d.ts +1 -0
- package/dist/types/index.d.ts +1 -0
- package/dist/types/styles.d.ts +1 -0
- package/dist/types/version.d.ts +1 -0
- package/package.json +101 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,201 @@
|
|
|
1
|
+
Apache License
|
|
2
|
+
Version 2.0, January 2004
|
|
3
|
+
http://www.apache.org/licenses/
|
|
4
|
+
|
|
5
|
+
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
|
6
|
+
|
|
7
|
+
1. Definitions.
|
|
8
|
+
|
|
9
|
+
"License" shall mean the terms and conditions for use, reproduction,
|
|
10
|
+
and distribution as defined by Sections 1 through 9 of this document.
|
|
11
|
+
|
|
12
|
+
"Licensor" shall mean the copyright owner or entity authorized by
|
|
13
|
+
the copyright owner that is granting the License.
|
|
14
|
+
|
|
15
|
+
"Legal Entity" shall mean the union of the acting entity and all
|
|
16
|
+
other entities that control, are controlled by, or are under common
|
|
17
|
+
control with that entity. For the purposes of this definition,
|
|
18
|
+
"control" means (i) the power, direct or indirect, to cause the
|
|
19
|
+
direction or management of such entity, whether by contract or
|
|
20
|
+
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
|
21
|
+
outstanding shares, or (iii) beneficial ownership of such entity.
|
|
22
|
+
|
|
23
|
+
"You" (or "Your") shall mean an individual or Legal Entity
|
|
24
|
+
exercising permissions granted by this License.
|
|
25
|
+
|
|
26
|
+
"Source" form shall mean the preferred form for making modifications,
|
|
27
|
+
including but not limited to software source code, documentation
|
|
28
|
+
source, and configuration files.
|
|
29
|
+
|
|
30
|
+
"Object" form shall mean any form resulting from mechanical
|
|
31
|
+
transformation or translation of a Source form, including but
|
|
32
|
+
not limited to compiled object code, generated documentation,
|
|
33
|
+
and conversions to other media types.
|
|
34
|
+
|
|
35
|
+
"Work" shall mean the work of authorship, whether in Source or
|
|
36
|
+
Object form, made available under the License, as indicated by a
|
|
37
|
+
copyright notice that is included in or attached to the work
|
|
38
|
+
(an example is provided in the Appendix below).
|
|
39
|
+
|
|
40
|
+
"Derivative Works" shall mean any work, whether in Source or Object
|
|
41
|
+
form, that is based on (or derived from) the Work and for which the
|
|
42
|
+
editorial revisions, annotations, elaborations, or other modifications
|
|
43
|
+
represent, as a whole, an original work of authorship. For the purposes
|
|
44
|
+
of this License, Derivative Works shall not include works that remain
|
|
45
|
+
separable from, or merely link (or bind by name) to the interfaces of,
|
|
46
|
+
the Work and Derivative Works thereof.
|
|
47
|
+
|
|
48
|
+
"Contribution" shall mean any work of authorship, including
|
|
49
|
+
the original version of the Work and any modifications or additions
|
|
50
|
+
to that Work or Derivative Works thereof, that is intentionally
|
|
51
|
+
submitted to Licensor for inclusion in the Work by the copyright owner
|
|
52
|
+
or by an individual or Legal Entity authorized to submit on behalf of
|
|
53
|
+
the copyright owner. For the purposes of this definition, "submitted"
|
|
54
|
+
means any form of electronic, verbal, or written communication sent
|
|
55
|
+
to the Licensor or its representatives, including but not limited to
|
|
56
|
+
communication on electronic mailing lists, source code control systems,
|
|
57
|
+
and issue tracking systems that are managed by, or on behalf of, the
|
|
58
|
+
Licensor for the purpose of discussing and improving the Work, but
|
|
59
|
+
excluding communication that is conspicuously marked or otherwise
|
|
60
|
+
designated in writing by the copyright owner as "Not a Contribution."
|
|
61
|
+
|
|
62
|
+
"Contributor" shall mean Licensor and any individual or Legal Entity
|
|
63
|
+
on behalf of whom a Contribution has been received by Licensor and
|
|
64
|
+
subsequently incorporated within the Work.
|
|
65
|
+
|
|
66
|
+
2. Grant of Copyright License. Subject to the terms and conditions of
|
|
67
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
68
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
69
|
+
copyright license to reproduce, prepare Derivative Works of,
|
|
70
|
+
publicly display, publicly perform, sublicense, and distribute the
|
|
71
|
+
Work and such Derivative Works in Source or Object form.
|
|
72
|
+
|
|
73
|
+
3. Grant of Patent License. Subject to the terms and conditions of
|
|
74
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
75
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
76
|
+
(except as stated in this section) patent license to make, have made,
|
|
77
|
+
use, offer to sell, sell, import, and otherwise transfer the Work,
|
|
78
|
+
where such license applies only to those patent claims licensable
|
|
79
|
+
by such Contributor that are necessarily infringed by their
|
|
80
|
+
Contribution(s) alone or by combination of their Contribution(s)
|
|
81
|
+
with the Work to which such Contribution(s) was submitted. If You
|
|
82
|
+
institute patent litigation against any entity (including a
|
|
83
|
+
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
|
84
|
+
or a Contribution incorporated within the Work constitutes direct
|
|
85
|
+
or contributory patent infringement, then any patent licenses
|
|
86
|
+
granted to You under this License for that Work shall terminate
|
|
87
|
+
as of the date such litigation is filed.
|
|
88
|
+
|
|
89
|
+
4. Redistribution. You may reproduce and distribute copies of the
|
|
90
|
+
Work or Derivative Works thereof in any medium, with or without
|
|
91
|
+
modifications, and in Source or Object form, provided that You
|
|
92
|
+
meet the following conditions:
|
|
93
|
+
|
|
94
|
+
(a) You must give any other recipients of the Work or
|
|
95
|
+
Derivative Works a copy of this License; and
|
|
96
|
+
|
|
97
|
+
(b) You must cause any modified files to carry prominent notices
|
|
98
|
+
stating that You changed the files; and
|
|
99
|
+
|
|
100
|
+
(c) You must retain, in the Source form of any Derivative Works
|
|
101
|
+
that You distribute, all copyright, patent, trademark, and
|
|
102
|
+
attribution notices from the Source form of the Work,
|
|
103
|
+
excluding those notices that do not pertain to any part of
|
|
104
|
+
the Derivative Works; and
|
|
105
|
+
|
|
106
|
+
(d) If the Work includes a "NOTICE" text file as part of its
|
|
107
|
+
distribution, then any Derivative Works that You distribute must
|
|
108
|
+
include a readable copy of the attribution notices contained
|
|
109
|
+
within such NOTICE file, excluding those notices that do not
|
|
110
|
+
pertain to any part of the Derivative Works, in at least one
|
|
111
|
+
of the following places: within a NOTICE text file distributed
|
|
112
|
+
as part of the Derivative Works; within the Source form or
|
|
113
|
+
documentation, if provided along with the Derivative Works; or,
|
|
114
|
+
within a display generated by the Derivative Works, if and
|
|
115
|
+
wherever such third-party notices normally appear. The contents
|
|
116
|
+
of the NOTICE file are for informational purposes only and
|
|
117
|
+
do not modify the License. You may add Your own attribution
|
|
118
|
+
notices within Derivative Works that You distribute, alongside
|
|
119
|
+
or as an addendum to the NOTICE text from the Work, provided
|
|
120
|
+
that such additional attribution notices cannot be construed
|
|
121
|
+
as modifying the License.
|
|
122
|
+
|
|
123
|
+
You may add Your own copyright statement to Your modifications and
|
|
124
|
+
may provide additional or different license terms and conditions
|
|
125
|
+
for use, reproduction, or distribution of Your modifications, or
|
|
126
|
+
for any such Derivative Works as a whole, provided Your use,
|
|
127
|
+
reproduction, and distribution of the Work otherwise complies with
|
|
128
|
+
the conditions stated in this License.
|
|
129
|
+
|
|
130
|
+
5. Submission of Contributions. Unless You explicitly state otherwise,
|
|
131
|
+
any Contribution intentionally submitted for inclusion in the Work
|
|
132
|
+
by You to the Licensor shall be under the terms and conditions of
|
|
133
|
+
this License, without any additional terms or conditions.
|
|
134
|
+
Notwithstanding the above, nothing herein shall supersede or modify
|
|
135
|
+
the terms of any separate license agreement you may have executed
|
|
136
|
+
with Licensor regarding such Contributions.
|
|
137
|
+
|
|
138
|
+
6. Trademarks. This License does not grant permission to use the trade
|
|
139
|
+
names, trademarks, service marks, or product names of the Licensor,
|
|
140
|
+
except as required for reasonable and customary use in describing the
|
|
141
|
+
origin of the Work and reproducing the content of the NOTICE file.
|
|
142
|
+
|
|
143
|
+
7. Disclaimer of Warranty. Unless required by applicable law or
|
|
144
|
+
agreed to in writing, Licensor provides the Work (and each
|
|
145
|
+
Contributor provides its Contributions) on an "AS IS" BASIS,
|
|
146
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
|
147
|
+
implied, including, without limitation, any warranties or conditions
|
|
148
|
+
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
|
149
|
+
PARTICULAR PURPOSE. You are solely responsible for determining the
|
|
150
|
+
appropriateness of using or redistributing the Work and assume any
|
|
151
|
+
risks associated with Your exercise of permissions under this License.
|
|
152
|
+
|
|
153
|
+
8. Limitation of Liability. In no event and under no legal theory,
|
|
154
|
+
whether in tort (including negligence), contract, or otherwise,
|
|
155
|
+
unless required by applicable law (such as deliberate and grossly
|
|
156
|
+
negligent acts) or agreed to in writing, shall any Contributor be
|
|
157
|
+
liable to You for damages, including any direct, indirect, special,
|
|
158
|
+
incidental, or consequential damages of any character arising as a
|
|
159
|
+
result of this License or out of the use or inability to use the
|
|
160
|
+
Work (including but not limited to damages for loss of goodwill,
|
|
161
|
+
work stoppage, computer failure or malfunction, or any and all
|
|
162
|
+
other commercial damages or losses), even if such Contributor
|
|
163
|
+
has been advised of the possibility of such damages.
|
|
164
|
+
|
|
165
|
+
9. Accepting Warranty or Additional Liability. While redistributing
|
|
166
|
+
the Work or Derivative Works thereof, You may choose to offer,
|
|
167
|
+
and charge a fee for, acceptance of support, warranty, indemnity,
|
|
168
|
+
or other liability obligations and/or rights consistent with this
|
|
169
|
+
License. However, in accepting such obligations, You may act only
|
|
170
|
+
on Your own behalf and on Your sole responsibility, not on behalf
|
|
171
|
+
of any other Contributor, and only if You agree to indemnify,
|
|
172
|
+
defend, and hold each Contributor harmless for any liability
|
|
173
|
+
incurred by, or claims asserted against, such Contributor by reason
|
|
174
|
+
of your accepting any such warranty or additional liability.
|
|
175
|
+
|
|
176
|
+
END OF TERMS AND CONDITIONS
|
|
177
|
+
|
|
178
|
+
APPENDIX: How to apply the Apache License to your work.
|
|
179
|
+
|
|
180
|
+
To apply the Apache License to your work, attach the following
|
|
181
|
+
boilerplate notice, with the fields enclosed by brackets "{}"
|
|
182
|
+
replaced with your own identifying information. (Don't include
|
|
183
|
+
the brackets!) The text should be enclosed in the appropriate
|
|
184
|
+
comment syntax for the file format. We also recommend that a
|
|
185
|
+
file or class name and description of purpose be included on the
|
|
186
|
+
same "printed page" as the copyright notice for easier
|
|
187
|
+
identification within third-party archives.
|
|
188
|
+
|
|
189
|
+
Copyright 2017 - 2017 Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
|
190
|
+
|
|
191
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
|
192
|
+
you may not use this file except in compliance with the License.
|
|
193
|
+
You may obtain a copy of the License at
|
|
194
|
+
|
|
195
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
|
196
|
+
|
|
197
|
+
Unless required by applicable law or agreed to in writing, software
|
|
198
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
|
199
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
200
|
+
See the License for the specific language governing permissions and
|
|
201
|
+
limitations under the License.
|
package/README.md
ADDED
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
# Amplify UI
|
|
2
|
+
|
|
3
|
+
Amplify UI is an open-source UI library with cloud-connected components that are endlessly customizable, accessible, and can integrate into _any_ application. Amplify UI consists of:
|
|
4
|
+
|
|
5
|
+
1. Connected components that simplify complex cloud-connected workflows, like Authenticator.
|
|
6
|
+
2. Primitive components that create consistency across Amplify UI and allow you to build complete applications that fit your brand, like Buttons and Badges.
|
|
7
|
+
3. Data-bound components that make it easy to display dynamic data, like DataStoreCollections.
|
|
8
|
+
4. Theming capabilities that allow you to customize the appearance of Amplify UI to match your brand.
|
|
9
|
+
|
|
10
|
+
## React Documentation
|
|
11
|
+
|
|
12
|
+
- https://ui.docs.amplify.aws/react
|
|
13
|
+
|
|
14
|
+
## Features 🚀
|
|
15
|
+
|
|
16
|
+
- **Better developer experience** Connected-components like Authenticator are being written with framework-specific implementations so that they follow framework conventions and are easier to integrate into your application.
|
|
17
|
+
- **Endlessly customizable** Every detail of Amplify UI is customizable to match your brand. Style all of Amplify UI with themes, override components with your own, or build your own UI and use Amplify for complex state management.
|
|
18
|
+
- **Accessible** Amplify UI components follow [WCAG](https://www.w3.org/WAI/standards-guidelines/wcag/) and [WAI-ARIA](https://www.w3.org/TR/wai-aria-1.2/) best practices and guidelines such as color contrast, keyboard navigation, accessible labels, and focus management.
|
|
19
|
+
- **Primitive components (React only right now)** Primitive components are used in the connected components, like Authenticator, you can also customize them and use them to build the rest of your UI.
|
|
20
|
+
|
|
21
|
+
## We love contributors!!
|
|
22
|
+
|
|
23
|
+
See our contributing guide [CONTRIBUTING.md](/CONTRIBUTING.md) to help us scale Amplify UI!
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import*as e from"react";import{useInterpret as t,useActor as s}from"@xstate/react";import{livenessMachine as r}from"./service/machine/index.mjs";import"./service/types/liveness.mjs";import"@tensorflow/tfjs-core";import"@tensorflow-models/blazeface";import"@tensorflow/tfjs-backend-wasm";import"@tensorflow/tfjs-backend-cpu";import"@aws-amplify/core";import"./service/utils/liveness.mjs";import"./service/utils/streamProvider.mjs";import"./service/utils/freshnessColorDisplay.mjs";import{View as o,Flex as i}from"@aws-amplify/ui-react";import{FaceLivenessDetectorProvider as n}from"./providers/FaceLivenessDetectorProvider.mjs";import{StartLiveness as m}from"./StartLiveness/StartLiveness.mjs";import{LivenessCheck as a}from"./LivenessCheck/LivenessCheck.mjs";import{getVideoConstraints as c}from"./StartLiveness/helpers.mjs";import{getDisplayText as l}from"./utils/getDisplayText.mjs";function p(p){const{disableInstructionScreen:f=!1,components:v,config:u,displayText:d}=p,y=e.useRef(null),{hintDisplayText:x,cameraDisplayText:j,instructionDisplayText:D,streamDisplayText:T,errorDisplayText:h}=l(d),E=t(r,{devTools:"development"===process.env.NODE_ENV,context:{componentProps:Object.assign(Object.assign({},p),{config:null!=u?u:{}})}}),[b,L]=s(E),w=b.matches("start")||b.matches("userCancel"),C=e.useCallback((()=>{const e=c();L({type:"BEGIN",data:{videoConstraints:e}})}),[L]);return e.useLayoutEffect((()=>{f&&w&&C()}),[C,f,w]),e.createElement(o,{className:"liveness-detector",testId:"liveness-detector"},e.createElement(n,{componentProps:p,service:E},e.createElement(i,{direction:"column",ref:y},w?e.createElement(m,{beginLivenessCheck:C,components:v,instructionDisplayText:D}):e.createElement(a,{hintDisplayText:x,cameraDisplayText:j,streamDisplayText:T,errorDisplayText:h,components:v}))))}export{p as default};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import e,{useRef as t,useState as r}from"react";import a from"react-countdown-circle-timer";import o from"classnames";import{Loader as s,useTheme as i,Flex as n,View as c,Text as m}from"@aws-amplify/ui-react";import"../service/machine/index.mjs";import{FaceMatchState as l}from"../service/types/liveness.mjs";import"@tensorflow/tfjs-core";import"@tensorflow-models/blazeface";import"@tensorflow/tfjs-backend-wasm";import"@tensorflow/tfjs-backend-cpu";import"@aws-amplify/core";import"../service/utils/liveness.mjs";import"../service/utils/streamProvider.mjs";import"../service/utils/freshnessColorDisplay.mjs";import{useLivenessActor as d}from"../hooks/useLivenessActor.mjs";import{useLivenessSelector as h,createLivenessSelector as p}from"../hooks/useLivenessSelector.mjs";import{useMediaStreamInVideo as v}from"../hooks/useMediaStreamInVideo.mjs";import{CancelButton as u}from"../shared/CancelButton.mjs";import{selectErrorState as f,Hint as E}from"../shared/Hint.mjs";import{MatchIndicator as C}from"../shared/MatchIndicator.mjs";import{Overlay as y}from"../shared/Overlay.mjs";import{RecordingIcon as g}from"../shared/RecordingIcon.mjs";import{LivenessClassNames as j}from"../types/classNames.mjs";import{renderErrorModal as w,FaceLivenessErrorModal as N}from"../shared/FaceLivenessErrorModal.mjs";const T=p((e=>{var t;return null===(t=e.context.videoAssociatedParams)||void 0===t?void 0:t.videoConstraints})),x=p((e=>{var t;return null===(t=e.context.videoAssociatedParams)||void 0===t?void 0:t.videoMediaStream})),I=p((e=>e.context.faceMatchAssociatedParams.faceMatchPercentage)),A=p((e=>e.context.faceMatchAssociatedParams.faceMatchState)),M=e.createElement(s,{size:"large",className:j.Loader,"data-testid":"centered-loader"}),D=s=>{const{isMobileScreen:p,isRecordingStopped:D,streamDisplayText:b,hintDisplayText:k,errorDisplayText:R,components:S,testId:O}=s,{cancelLivenessCheckText:L,recordingIndicatorText:P}=b,{ErrorView:F=N}=null!=S?S:{},{tokens:_}=i(),[z,W]=d(),H=h(x),V=h(T),$=h(I),B=h(A),G=h(f),X=[l.TOO_FAR,l.CANT_IDENTIFY,l.FACE_IDENTIFIED],{videoRef:Y,videoWidth:q,videoHeight:J}=v(H,V),K=t(null),Q=t(null),[U,Z]=r(!1),[ee,te]=r(!1),re=z.matches("cameraCheck"),ae=z.matches("notRecording"),oe=z.matches("recording"),se=z.matches("checkSucceeded"),ie=z.matches({recording:"flashFreshnessColors"}),[ne,ce]=r(q),[me,le]=r(J),[de,he]=r((()=>q&&J?q/J:0));e.useLayoutEffect((()=>{ee&&W({type:"SET_DOM_AND_CAMERA_DETAILS",data:{videoEl:Y.current,canvasEl:K.current,freshnessColorEl:Q.current,isMobile:p}}),Y.current&&(ce(Y.current.videoWidth),le(Y.current.videoHeight),he(Y.current.videoWidth/Y.current.videoHeight))}),[W,Y,ee,p]);return re?e.createElement(n,{height:J,width:"100%",position:"relative"},M):e.createElement(n,{className:o(j.CameraModule,p&&`${j.CameraModule}--mobile`),"data-testid":O},!ee&&M,e.createElement(c,{as:"canvas",ref:Q,className:j.FreshnessCanvas,hidden:!0}),e.createElement(c,{className:j.VideoAnchor,style:{aspectRatio:`${de}`}},e.createElement("video",{ref:Y,muted:!0,autoPlay:!0,playsInline:!0,style:{transform:"scaleX(-1)"},width:ne,height:me,onCanPlay:()=>{te(!0),Z(!0)},"data-testid":"video",className:j.Video}),e.createElement(n,{className:o(j.OvalCanvas,p&&`${j.OvalCanvas}--mobile`,D&&j.FadeOut)},e.createElement(c,{as:"canvas",width:"100%",height:"100%",ref:K})),oe&&e.createElement(c,{className:j.RecordingIconContainer},e.createElement(g,null,P)),!se&&e.createElement(c,{className:j.CancelContainer},e.createElement(u,{ariaLabel:L})),U&&e.createElement(y,{anchorOrigin:{horizontal:"center",vertical:oe&&!ie?"start":"space-between"},className:j.InstructionOverlay},e.createElement(E,{hintDisplayText:k}),G&&e.createElement(F,{onRetry:()=>{W({type:"CANCEL"})}},w({errorState:G,overrideErrorDisplayText:R})),oe&&X.includes(B)?e.createElement(C,{percentage:$}):null,ae&&e.createElement(c,{className:j.CountdownContainer,testId:"liveness-camera-countdown-timer"},e.createElement(a.CountdownCircleTimer,{isPlaying:ae,size:85,strokeWidth:8,duration:3,rotation:"counterclockwise",colors:"#40aabf",trailColor:`${_.colors.background.primary}`,onComplete:()=>{W({type:"START_RECORDING"})}},(({remainingTime:t})=>e.createElement(m,{fontSize:"xxxl",fontWeight:"bold"},t)))))))};export{D as LivenessCameraModule,I as selectFaceMatchPercentage,A as selectFaceMatchState,T as selectVideoConstraints,x as selectVideoStream};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import*as e from"react";import{Flex as t,Text as r,Button as s,View as i}from"@aws-amplify/ui-react";import"../service/machine/index.mjs";import{LivenessErrorState as o}from"../service/types/liveness.mjs";import"@tensorflow/tfjs-core";import"@tensorflow-models/blazeface";import"@tensorflow/tfjs-backend-wasm";import"@tensorflow/tfjs-backend-cpu";import"@aws-amplify/core";import"../service/utils/liveness.mjs";import"../service/utils/streamProvider.mjs";import"../service/utils/freshnessColorDisplay.mjs";import{LivenessCameraModule as a}from"./LivenessCameraModule.mjs";import{useLivenessActor as n}from"../hooks/useLivenessActor.mjs";import{useLivenessSelector as m,createLivenessSelector as c}from"../hooks/useLivenessSelector.mjs";import"@aws-amplify/ui";import{isMobileScreen as l,getLandscapeMediaQuery as p}from"../utils/device.mjs";import{CancelButton as d}from"../shared/CancelButton.mjs";import{defaultErrorDisplayText as u}from"../displayText.mjs";import{LandscapeErrorModal as f}from"../shared/LandscapeErrorModal.mjs";const E=c((e=>e.context.errorState)),g=c((e=>e.context.isRecordingStopped)),y=({hintDisplayText:c,cameraDisplayText:y,streamDisplayText:x,errorDisplayText:h,components:R})=>{const[T,A]=n(),v=m(E),j=m(g),C=T.matches("permissionDenied"),M=l(),b=()=>{A({type:"RETRY_CAMERA_CHECK"})},{cameraMinSpecificationsHeadingText:L,cameraMinSpecificationsMessageText:k,cameraNotFoundHeadingText:D,cameraNotFoundMessageText:w,retryCameraPermissionsText:S}=y,{cancelLivenessCheckText:_}=x;e.useLayoutEffect((()=>{if(M){const e=e=>{e&&A({type:"MOBILE_LANDSCAPE_WARNING"})},t=p();return e(t.matches),t.addEventListener("change",(t=>{e(t.matches)})),()=>{t.removeEventListener("change",(t=>e(t.matches)))}}}),[M,A]);return e.createElement(t,{direction:"column",position:"relative",testId:"liveness-detector-check",className:"liveness-detector-check"},(()=>{if(v===o.MOBILE_LANDSCAPE_ERROR){const r=Object.assign(Object.assign({},u),h),{landscapeHeaderText:s,portraitMessageText:i,landscapeMessageText:o,tryAgainText:a}=r;return e.createElement(t,{backgroundColor:"background.primary",direction:"column",textAlign:"center",alignItems:"center",justifyContent:"center",position:"absolute",width:"100%"},e.createElement(f,{header:s,portraitMessage:i,landscapeMessage:o,tryAgainText:a,onRetry:()=>{A({type:"CANCEL"})}}))}return C?e.createElement(t,{backgroundColor:"background.primary",direction:"column",textAlign:"center",alignItems:"center",justifyContent:"center",width:"100%",height:480},e.createElement(r,{fontSize:"large",fontWeight:"bold"},v===o.CAMERA_FRAMERATE_ERROR?L:D),e.createElement(r,{maxWidth:300},v===o.CAMERA_FRAMERATE_ERROR?k:w),e.createElement(s,{variation:"primary",type:"button",onClick:b},S),e.createElement(i,{position:"absolute",top:"medium",right:"medium"},e.createElement(d,{ariaLabel:_}))):e.createElement(a,{isMobileScreen:M,isRecordingStopped:j,streamDisplayText:x,hintDisplayText:c,errorDisplayText:h,components:R})})())};export{y as LivenessCheck,E as selectErrorState,g as selectIsRecordingStopped};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import*as t from"react";import{Card as e,Flex as n,Button as i}from"@aws-amplify/ui-react";import{DefaultHeader as o,DefaultPhotosensitiveWarning as r,DefaultInstructions as s}from"../shared/DefaultStartScreenComponents.mjs";function a(a){const{beginLivenessCheck:c,components:l,instructionDisplayText:T}=a;return t.createElement(e,{className:"liveness-detector-start","data-testid":"liveness-detector-start"},t.createElement(n,{direction:"column"},(null==l?void 0:l.Header)?t.createElement(l.Header,null):t.createElement(o,{headingText:T.instructionsHeaderHeadingText,bodyText:T.instructionsHeaderBodyText}),(null==l?void 0:l.PhotosensitiveWarning)?t.createElement(l.PhotosensitiveWarning,null):t.createElement(r,{headingText:T.photosensitivyWarningHeadingText,bodyText:T.photosensitivyWarningBodyText,infoText:T.photosensitivyWarningInfoText}),(null==l?void 0:l.Instructions)?t.createElement(l.Instructions,null):t.createElement(s,{headingText:T.instructionListHeadingText,goodFitCaptionText:T.goodFitCaptionText,goodFitAltText:T.goodFitAltText,tooFarCaptionText:T.tooFarCaptionText,tooFarAltText:T.tooFarAltText,steps:[T.instructionListStepOneText,T.instructionListStepTwoText,T.instructionListStepThreeText,T.instructionListStepFourText]}),t.createElement(n,{justifyContent:"center"},t.createElement(i,{variation:"primary",type:"button",onClick:c},T.instructionsBeginCheckText))))}export{a as StartLiveness};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
function e(){return{width:{min:320,ideal:640},height:{min:240,ideal:480},frameRate:{min:15,ideal:30,max:30},facingMode:"user"}}export{e as getVideoConstraints};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
const e={timeoutHeaderText:"Time out",timeoutMessageText:"Face didn't fill oval within time limit. Try again and completely fill oval with face within 7 seconds.",faceDistanceHeaderText:"Check failed during countdown",faceDistanceMessageText:"Avoid moving closer during countdown and ensure only one face is in front of camera.",clientHeaderText:"Client error",clientMessageText:"Check failed due to client issue",serverHeaderText:"Server issue",serverMessageText:"Cannot complete check due to server issue",landscapeHeaderText:"Landscape orientation not supported",landscapeMessageText:"Rotate your device to portrait (vertical) orientation.",portraitMessageText:"Ensure your device remains in portrait (vertical) orientation for the check’s duration.",tryAgainText:"Try again"},t=Object.assign({instructionsHeaderHeadingText:"Liveness check",instructionsHeaderBodyText:"You will go through a face verification process to prove that you are a real person.",instructionsBeginCheckText:"Begin check",photosensitivyWarningHeadingText:"Photosensitivity warning",photosensitivyWarningBodyText:"This check displays colored lights. Use caution if you are photosensitive.",photosensitivyWarningInfoText:"A small percentage of individuals may experience epileptic seizures when exposed to colored lights. Use caution if you, or anyone in your family, have an epileptic condition.",instructionListHeadingText:"Follow the instructions to complete the check:",goodFitCaptionText:"Good fit",goodFitAltText:"Ilustration of a person's face, perfectly fitting inside of an oval.",tooFarCaptionText:"Too far",tooFarAltText:"Illustration of a person's face inside of an oval; there is a gap between the perimeter of the face and the boundaries of the oval.",instructionListStepOneText:"When an oval appears, fill the oval with your face within 7 seconds.",instructionListStepTwoText:"Maximize your screen's brightness.",instructionListStepThreeText:"Make sure your face is not covered with sunglasses or a mask.",instructionListStepFourText:"Move to a well-lit place that is not in direct sunlight.",cameraMinSpecificationsHeadingText:"Camera does not meet minimum specifications",cameraMinSpecificationsMessageText:"Camera must support at least 320*240 resolution and 15 frames per second.",cameraNotFoundHeadingText:"Camera not accessible.",cameraNotFoundMessageText:"Check that camera is connected and camera permissions are enabled in settings before retrying.",retryCameraPermissionsText:"Retry",cancelLivenessCheckText:"Cancel Liveness check",recordingIndicatorText:"Rec",hintMoveFaceFrontOfCameraText:"Move face in front of camera",hintTooManyFacesText:"Ensure only one face is in front of camera",hintFaceDetectedText:"Face detected",hintCanNotIdentifyText:"Move face in front of camera",hintTooCloseText:"Move back",hintTooFarText:"Move closer",hintHoldFacePositionCountdownText:"Hold face position during countdown",hintConnectingText:"Connecting...",hintVerifyingText:"Verifying...",hintIlluminationTooBrightText:"Move to dimmer area",hintIlluminationTooDarkText:"Move to brighter area",hintIlluminationNormalText:"Lighting conditions normal",hintHoldFaceForFreshnessText:"Hold still"},e);export{e as defaultErrorDisplayText,t as defaultLivenessDisplayText};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{useActor as r}from"@xstate/react";import{useFaceLivenessDetector as e}from"../providers/FaceLivenessDetectorProvider.mjs";function t(){const{service:t}=e();return r(t)}export{t as useLivenessActor};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{useSelector as r}from"@xstate/react";import{useFaceLivenessDetector as e}from"../providers/FaceLivenessDetectorProvider.mjs";function t(r){return r}function o(t){const{service:o}=e();return r(o,t)}export{t as createLivenessSelector,o as useLivenessSelector};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{useRef as t,useState as e,useEffect as r}from"react";import{isObject as i}from"@aws-amplify/ui";function o(o,c){const n=c.height.ideal,a=c.width.ideal,h=t(null),[d,s]=e(n),[f,g]=e(a);return r((()=>{if(o){i(h.current)&&(h.current.srcObject=o);const{height:t,width:e}=o.getTracks()[0].getSettings();s(t),g(e)}return()=>{o&&o.getTracks().forEach((t=>{o.removeTrack(t),t.stop()}))}}),[o]),{videoRef:h,videoHeight:d,videoWidth:f}}export{o as useMediaStreamInVideo};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{__rest as e}from"../../../node_modules/tslib/tslib.es6.mjs";import t from"react";const r=t.createContext(null);function n(n){var{children:o}=n,i=e(n,["children"]);return t.createElement(r.Provider,{value:i},o)}function o(){const e=t.useContext(r);if(null===e)throw new Error("useFaceLivenessDetector must be used within a FaceLivenessDetectorProvider");return e}export{n as FaceLivenessDetectorProvider,o as useFaceLivenessDetector};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{__awaiter as e,__asyncValues as t}from"../../../../node_modules/tslib/tslib.es6.mjs";import{createMachine as a,assign as o,spawn as r,actions as i}from"xstate";import{getBoundingBox as s,getColorsSequencesFromSessionInformation as n,LivenessErrorStateStringMap as c,isCameraDeviceVirtual as d,getFaceMatchState as l,isFaceDistanceBelowThreshold as v,estimateIllumination as m,getOvalDetailsFromSessionInformation as h,generateBboxFromLandmarks as g,drawLivenessOvalInCanvas as u,getOvalBoundingBox as f,getIntersectionOverUnion as S,getFaceMatchStateInLivenessOval as p,getStaticLivenessOvalDetails as F}from"../utils/liveness.mjs";import{LivenessErrorState as E,FaceMatchState as D}from"../types/liveness.mjs";import{BlazeFaceFaceDetection as A}from"../utils/blazefaceFaceDetection.mjs";import{LivenessStreamProvider as M}from"../utils/streamProvider.mjs";import{FreshnessColorDisplay as R}from"../utils/freshnessColorDisplay.mjs";import{nanoid as C}from"nanoid";import{isServerSesssionInformationEvent as P,isDisconnectionEvent as T,isValidationExceptionEvent as O,isInternalServerExceptionEvent as I,isThrottlingExceptionEvent as w,isServiceQuotaExceededExceptionEvent as y,isInvalidSignatureRegionException as b}from"../utils/eventUtils.mjs";const k=500;let B;const j=a({id:"livenessMachine",initial:"start",predictableActionArguments:!0,context:{challengeId:C(),maxFailedAttempts:0,failedAttempts:0,componentProps:void 0,serverSessionInformation:void 0,videoAssociatedParams:void 0,ovalAssociatedParams:void 0,faceMatchAssociatedParams:{illuminationState:void 0,faceMatchState:void 0,faceMatchPercentage:25,currentDetectedFace:void 0,startFace:void 0,endFace:void 0,initialFaceMatchTime:void 0},freshnessColorAssociatedParams:{freshnessColorEl:void 0,freshnessColors:[],freshnessColorsComplete:!1,freshnessColorDisplay:void 0},errorState:null,livenessStreamProvider:void 0,responseStreamActorRef:void 0,shouldDisconnect:!1,faceMatchStateBeforeStart:void 0,isFaceFarEnoughBeforeRecording:void 0,isRecordingStopped:!1},on:{CANCEL:"userCancel",TIMEOUT:{target:"retryableTimeout",actions:"updateErrorStateForTimeout"},SET_SESSION_INFO:{internal:!0,actions:"updateSessionInfo"},DISCONNECT_EVENT:{internal:!0,actions:"updateShouldDisconnect"},SET_DOM_AND_CAMERA_DETAILS:{actions:"setDOMAndCameraDetails"},SERVER_ERROR:{target:"error",actions:"updateErrorStateForServer"},MOBILE_LANDSCAPE_WARNING:{target:"mobileLandscapeWarning",actions:"updateErrorStateForServer"}},states:{start:{on:{BEGIN:"cameraCheck"}},cameraCheck:{entry:["resetErrorState","setVideoConstraints","initializeFaceDetector"],invoke:{src:"checkVirtualCameraAndGetStream",onDone:{target:"waitForDOMAndCameraDetails",actions:["updateVideoMediaStream"]},onError:{target:"permissionDenied"}}},waitForDOMAndCameraDetails:{after:{0:{target:"detectFaceBeforeStart",cond:"hasDOMAndCameraDetails"},500:{target:"waitForDOMAndCameraDetails"}}},detectFaceBeforeStart:{invoke:{src:"detectFace",onDone:{target:"checkFaceDetectedBeforeStart",actions:["updateFaceMatchBeforeStartDetails"]}}},checkFaceDetectedBeforeStart:{after:{0:{target:"detectFaceDistanceBeforeRecording",cond:"hasSingleFaceBeforeStart"},100:{target:"detectFaceBeforeStart"}}},detectFaceDistanceBeforeRecording:{invoke:{src:"detectFaceDistance",onDone:{target:"checkFaceDistanceBeforeRecording",actions:["updateFaceDistanceBeforeRecording"]}}},checkFaceDistanceBeforeRecording:{after:{0:{target:"initializeLivenessStream",cond:"hasEnoughFaceDistanceBeforeRecording"},100:{target:"detectFaceDistanceBeforeRecording"}}},initializeLivenessStream:{invoke:{src:"openLivenessStreamConnection",onDone:{target:"waitForSessionInfo",actions:["updateLivenessStreamProvider","spawnResponseStreamActor"]}}},waitForSessionInfo:{after:{0:{target:"notRecording",cond:"hasServerSessionInfo"},100:{target:"waitForSessionInfo"}}},notRecording:{on:{START_RECORDING:"recording"},initial:"detectFaceDistanceDuringCountdown",states:{detectFaceDistanceDuringCountdown:{invoke:{src:"detectFaceDistance",onDone:{target:"checkFaceDistanceDuringCountdown",actions:["updateFaceDistanceBeforeRecording"]}}},checkFaceDistanceDuringCountdown:{after:{0:{target:"failure",cond:"hasNotEnoughFaceDistanceBeforeRecording"},200:{target:"detectFaceDistanceDuringCountdown"}}},failure:{entry:"sendTimeoutAfterFaceDistanceDelay",type:"final"}}},recording:{entry:["clearErrorState","startRecording"],initial:"ovalDrawing",states:{ovalDrawing:{entry:["sendTimeoutAfterOvalDrawingDelay"],invoke:{src:"detectInitialFaceAndDrawOval",onDone:{target:"checkFaceDetected",actions:["updateOvalAndFaceDetailsPostDraw","sendTimeoutAfterOvalMatchDelay"]},onError:{target:"#livenessMachine.error",actions:"updateErrorStateForRuntime"}}},checkFaceDetected:{after:{0:{target:"checkRecordingStarted",cond:"hasSingleFace"},100:{target:"ovalDrawing"}}},checkRecordingStarted:{after:{0:{target:"ovalMatching",cond:"hasRecordingStarted",actions:["updateRecordingStartTimestampMs"]},100:{target:"checkRecordingStarted"}}},ovalMatching:{entry:["cancelOvalDrawingTimeout"],invoke:{src:"detectFaceAndMatchOval",onDone:{target:"checkMatch",actions:"updateFaceDetailsPostMatch"}}},checkMatch:{after:{0:{target:"flashFreshnessColors",cond:"hasFaceMatchedInOvalWithMinTime",actions:["updateEndFaceMatch","setupFlashFreshnessColors","cancelOvalMatchTimeout","cancelOvalDrawingTimeout"]},.1:{target:"ovalMatching",cond:"hasFaceMatchedInOval",actions:"setFaceMatchTimeAndStartFace"},1:{target:"ovalMatching",cond:"hasNotFaceMatchedInOval"}}},flashFreshnessColors:{invoke:{src:"flashColors",onDone:[{target:"success",cond:"hasFreshnessColorShown"},{target:"flashFreshnessColors",actions:"updateFreshnessDetails"}]}},flashFreshnessColorError:{entry:["updateErrorStateForFreshnessTimeout"],always:[{target:"#livenessMachine.timeout"}]},success:{entry:["stopRecording"],type:"final"}},onDone:"uploading"},uploading:{initial:"pending",states:{pending:{entry:["sendTimeoutAfterWaitingForDisconnect","pauseVideoStream"],invoke:{src:"stopVideo",onDone:"waitForDisconnectEvent",onError:{target:"#livenessMachine.error",actions:"updateErrorStateForRuntime"}}},waitForDisconnectEvent:{after:{0:{target:"getLivenessResult",cond:"getShouldDisconnect"},100:{target:"waitForDisconnectEvent"}}},getLivenessResult:{entry:["cancelWaitForDisconnectTimeout","freezeStream"],invoke:{src:"getLiveness",onError:{target:"#livenessMachine.error",actions:"updateErrorStateForServer"}}}}},retryableTimeout:{entry:"updateFailedAttempts",always:[{target:"timeout",cond:"shouldTimeoutOnFailedAttempts"},{target:"notRecording"}]},permissionDenied:{entry:"callUserPermissionDeniedCallback",on:{RETRY_CAMERA_CHECK:"cameraCheck"}},mobileLandscapeWarning:{entry:"callMobileLandscapeWarningCallback",always:[{target:"error"}]},timeout:{entry:["cleanUpResources","callUserTimeoutCallback","freezeStream"]},error:{entry:["cleanUpResources","callErrorCallback","cancelOvalDrawingTimeout","cancelWaitForDisconnectTimeout","cancelOvalMatchTimeout","freezeStream"]},userCancel:{entry:["cleanUpResources","callUserCancelCallback","resetContext"],always:[{target:"start"}]}}},{actions:{spawnResponseStreamActor:o({responseStreamActorRef:()=>r(_)}),updateFailedAttempts:o({failedAttempts:e=>e.failedAttempts+1}),setVideoConstraints:o({videoAssociatedParams:(e,t)=>{var a,o;return Object.assign(Object.assign({},e.videoAssociatedParams),{videoConstraints:(null===(a=t.data)||void 0===a?void 0:a.videoConstraints)||(null===(o=e.videoAssociatedParams)||void 0===o?void 0:o.videoConstraints)})}}),updateVideoMediaStream:o({videoAssociatedParams:(e,t)=>{var a;return Object.assign(Object.assign({},e.videoAssociatedParams),{videoMediaStream:null===(a=t.data)||void 0===a?void 0:a.stream})}}),initializeFaceDetector:o({ovalAssociatedParams:e=>{const{componentProps:t}=e,{faceModelUrl:a,binaryPath:o}=t.config,r=new A(o,a);return r.triggerModelLoading(),Object.assign(Object.assign({},e.ovalAssociatedParams),{faceDetector:r})}}),updateLivenessStreamProvider:o({livenessStreamProvider:(e,t)=>{var a;return null===(a=t.data)||void 0===a?void 0:a.livenessStreamProvider}}),setDOMAndCameraDetails:o({videoAssociatedParams:(e,t)=>{var a,o,r;return Object.assign(Object.assign({},e.videoAssociatedParams),{videoEl:null===(a=t.data)||void 0===a?void 0:a.videoEl,canvasEl:null===(o=t.data)||void 0===o?void 0:o.canvasEl,isMobile:null===(r=t.data)||void 0===r?void 0:r.isMobile})},freshnessColorAssociatedParams:(e,t)=>{var a;return Object.assign(Object.assign({},e.freshnessColorAssociatedParams),{freshnessColorEl:null===(a=t.data)||void 0===a?void 0:a.freshnessColorEl})}}),updateRecordingStartTimestampMs:o({videoAssociatedParams:e=>{const{challengeId:t,videoAssociatedParams:{videoMediaStream:a},ovalAssociatedParams:{initialFace:o},livenessStreamProvider:r}=e,{recordingStartApiTimestamp:i,recorderStartTimestamp:n}=r.videoRecorder,c=Math.round(.73*(n-i)+i),{width:d,height:l}=a.getTracks()[0].getSettings(),v=d-o.left-o.width;return e.livenessStreamProvider.sendClientInfo({Challenge:{FaceMovementAndLightChallenge:{ChallengeId:t,VideoStartTimestamp:c,InitialFace:{InitialFaceDetectedTimestamp:o.timestampMs,BoundingBox:s({deviceHeight:l,deviceWidth:d,height:o.height,width:o.width,top:o.top,left:v})}}}}),Object.assign(Object.assign({},e.videoAssociatedParams),{recordingStartTimestampMs:c})}}),startRecording:o({videoAssociatedParams:e=>{if(!e.serverSessionInformation)throw new Error("Session information was not received from response stream");return e.livenessStreamProvider.videoRecorder&&"recording"!==e.livenessStreamProvider.videoRecorder.getState()&&e.livenessStreamProvider.startRecordingLivenessVideo(),Object.assign({},e.videoAssociatedParams)}}),stopRecording:e=>{},updateFaceMatchBeforeStartDetails:o({faceMatchStateBeforeStart:(e,t)=>t.data.faceMatchState}),updateFaceDistanceBeforeRecording:o({isFaceFarEnoughBeforeRecording:(e,t)=>t.data.isFaceFarEnoughBeforeRecording}),updateOvalAndFaceDetailsPostDraw:o({ovalAssociatedParams:(e,t)=>Object.assign(Object.assign({},e.ovalAssociatedParams),{initialFace:t.data.initialFace,ovalDetails:t.data.ovalDetails,scaleFactor:t.data.scaleFactor}),faceMatchAssociatedParams:(e,t)=>Object.assign(Object.assign({},e.faceMatchAssociatedParams),{faceMatchState:t.data.faceMatchState,illuminationState:t.data.illuminationState})}),updateFaceDetailsPostMatch:o({faceMatchAssociatedParams:(e,t)=>Object.assign(Object.assign({},e.faceMatchAssociatedParams),{faceMatchState:t.data.faceMatchState,faceMatchPercentage:t.data.faceMatchPercentage,illuminationState:t.data.illuminationState,currentDetectedFace:t.data.detectedFace})}),updateEndFaceMatch:o({faceMatchAssociatedParams:e=>Object.assign(Object.assign({},e.faceMatchAssociatedParams),{endFace:e.faceMatchAssociatedParams.currentDetectedFace})}),setFaceMatchTimeAndStartFace:o({faceMatchAssociatedParams:e=>Object.assign(Object.assign({},e.faceMatchAssociatedParams),{startFace:void 0===e.faceMatchAssociatedParams.startFace?e.faceMatchAssociatedParams.currentDetectedFace:e.faceMatchAssociatedParams.startFace,initialFaceMatchTime:void 0===e.faceMatchAssociatedParams.initialFaceMatchTime?Date.now():e.faceMatchAssociatedParams.initialFaceMatchTime})}),resetFaceMatchTimeAndStartFace:o({faceMatchAssociatedParams:e=>Object.assign(Object.assign({},e.faceMatchAssociatedParams),{startFace:void 0,endFace:void 0,initialFaceMatchTime:void 0})}),resetErrorState:o({errorState:e=>{}}),updateErrorStateForTimeout:o({errorState:(e,t)=>{var a;return(null===(a=t.data)||void 0===a?void 0:a.errorState)||E.TIMEOUT}}),updateErrorStateForRuntime:o({errorState:e=>E.RUNTIME_ERROR}),updateErrorStateForServer:o({errorState:e=>E.SERVER_ERROR}),clearErrorState:o({errorState:e=>null}),updateSessionInfo:o({serverSessionInformation:(e,t)=>t.data.sessionInfo}),updateShouldDisconnect:o({shouldDisconnect:e=>!0}),updateFreshnessDetails:o({freshnessColorAssociatedParams:(e,t)=>Object.assign(Object.assign({},e.freshnessColorAssociatedParams),{freshnessColorsComplete:t.data.freshnessColorsComplete})}),updateErrorStateForFreshnessTimeout:o({errorState:e=>{const{freshnessColorAssociatedParams:{freshnessColorEl:t}}=e;return t.style.display="none",E.FRESHNESS_TIMEOUT}}),setupFlashFreshnessColors:o({freshnessColorAssociatedParams:e=>{const{serverSessionInformation:t}=e,a=n(t),o=new R(e,a);return Object.assign(Object.assign({},e.freshnessColorAssociatedParams),{freshnessColorDisplay:o})}}),sendTimeoutAfterOvalDrawingDelay:i.send({type:"TIMEOUT"},{delay:5e3,id:"ovalDrawingTimeout"}),cancelOvalDrawingTimeout:i.cancel("ovalDrawingTimeout"),sendTimeoutAfterOvalMatchDelay:i.send({type:"TIMEOUT"},{delay:7e3,id:"ovalMatchTimeout"}),cancelOvalMatchTimeout:i.cancel("ovalMatchTimeout"),sendTimeoutAfterWaitingForDisconnect:i.send({type:"TIMEOUT",data:{errorState:E.SERVER_ERROR}},{delay:2e4,id:"waitForDisconnectTimeout"}),cancelWaitForDisconnectTimeout:i.cancel("waitForDisconnectTimeout"),sendTimeoutAfterFaceDistanceDelay:i.send({type:"TIMEOUT",data:{errorState:E.FACE_DISTANCE_ERROR}},{delay:0,id:"faceDistanceTimeout"}),cancelFaceDistanceTimeout:i.cancel("faceDistanceTimeout"),callUserPermissionDeniedCallback:o({errorState:(e,t)=>{var a,o;let r;r=t.data.message.includes("15 fps")?E.CAMERA_FRAMERATE_ERROR:E.CAMERA_ACCESS_ERROR;const i=t.data.message||t.data.Message,s=new Error(i);return s.name=r,null===(o=(a=e.componentProps).onError)||void 0===o||o.call(a,s),r}}),callMobileLandscapeWarningCallback:o({errorState:e=>E.MOBILE_LANDSCAPE_ERROR}),callUserCancelCallback:t=>e(void 0,void 0,void 0,(function*(){var e,a;null===(a=(e=t.componentProps).onUserCancel)||void 0===a||a.call(e)})),callUserTimeoutCallback:t=>e(void 0,void 0,void 0,(function*(){var e,a;const o=new Error(c[t.errorState]);o.name=t.errorState,null===(a=(e=t.componentProps).onError)||void 0===a||a.call(e,o)})),callErrorCallback:(t,a)=>e(void 0,void 0,void 0,(function*(){var e,o,r,i,s,n;const c=(null===(o=null===(e=a.data)||void 0===e?void 0:e.error)||void 0===o?void 0:o.message)||(null===(i=null===(r=a.data)||void 0===r?void 0:r.error)||void 0===i?void 0:i.Message),d=new Error(c);d.name=t.errorState,null===(n=(s=t.componentProps).onError)||void 0===n||n.call(s,d)})),cleanUpResources:t=>e(void 0,void 0,void 0,(function*(){var e;const{freshnessColorAssociatedParams:{freshnessColorEl:a}}=t;a&&(a.style.display="none"),yield null===(e=t.livenessStreamProvider)||void 0===e?void 0:e.endStream()})),freezeStream:t=>e(void 0,void 0,void 0,(function*(){const{videoAssociatedParams:{videoMediaStream:e,videoEl:a}}=t;t.isRecordingStopped=!0,null==a||a.pause(),null==e||e.getTracks().forEach((function(e){e.stop()}))})),pauseVideoStream:t=>e(void 0,void 0,void 0,(function*(){const{videoAssociatedParams:{videoEl:e}}=t;t.isRecordingStopped=!0,e.pause()})),resetContext:o({challengeId:C(),maxFailedAttempts:0,failedAttempts:0,componentProps:e=>e.componentProps,serverSessionInformation:e=>{},videoAssociatedParams:e=>{},ovalAssociatedParams:e=>{},errorState:e=>null,livenessStreamProvider:e=>{},responseStreamActorRef:e=>{},shouldDisconnect:!1,faceMatchStateBeforeStart:e=>{},isFaceFarEnoughBeforeRecording:e=>{},isRecordingStopped:!1})},guards:{shouldTimeoutOnFailedAttempts:e=>e.failedAttempts>=e.maxFailedAttempts,hasFaceMatchedInOvalWithMinTime:e=>{const{faceMatchState:t,initialFaceMatchTime:a}=e.faceMatchAssociatedParams,o=Date.now()-a;return t===D.MATCHED&&o>=500},hasFaceMatchedInOval:e=>e.faceMatchAssociatedParams.faceMatchState===D.MATCHED,hasNotFaceMatchedInOval:e=>e.faceMatchAssociatedParams.faceMatchState!==D.MATCHED,hasSingleFace:e=>e.faceMatchAssociatedParams.faceMatchState===D.FACE_IDENTIFIED,hasSingleFaceBeforeStart:e=>e.faceMatchStateBeforeStart===D.FACE_IDENTIFIED,hasEnoughFaceDistanceBeforeRecording:e=>e.isFaceFarEnoughBeforeRecording,hasNotEnoughFaceDistanceBeforeRecording:e=>!e.isFaceFarEnoughBeforeRecording,hasLivenessCheckSucceeded:(e,t,a)=>a.state.event.data.isLive,hasFreshnessColorShown:e=>e.freshnessColorAssociatedParams.freshnessColorsComplete,hasServerSessionInfo:e=>void 0!==e.serverSessionInformation,hasDOMAndCameraDetails:e=>void 0!==e.videoAssociatedParams.videoEl&&void 0!==e.videoAssociatedParams.canvasEl&&void 0!==e.freshnessColorAssociatedParams.freshnessColorEl,getShouldDisconnect:e=>!!e.shouldDisconnect,hasRecordingStarted:e=>void 0!==e.livenessStreamProvider.videoRecorder.firstChunkTimestamp},services:{checkVirtualCameraAndGetStream(t){return e(this,void 0,void 0,(function*(){const{videoConstraints:e}=t.videoAssociatedParams,a=yield navigator.mediaDevices.getUserMedia({video:e,audio:!1}),o=(yield navigator.mediaDevices.enumerateDevices()).filter((e=>"videoinput"===e.kind)).filter((e=>!d(e)));if(!o.length)throw new Error("No real video devices found");const r=a.getTracks().filter((e=>e.getSettings().frameRate>=15));if(r.length<1)throw new Error("No camera found with more than 15 fps");const i=r[0].getSettings().deviceId;let s=a;return o.some((e=>e.deviceId===i))||(s=yield navigator.mediaDevices.getUserMedia({video:Object.assign(Object.assign({},e),{deviceId:{exact:o[0].deviceId}}),audio:!1})),{stream:s}}))},openLivenessStreamConnection(t){return e(this,void 0,void 0,(function*(){const e=new M(t.componentProps.sessionId,t.componentProps.region,t.videoAssociatedParams.videoMediaStream,t.videoAssociatedParams.videoEl);return B=e.getResponseStream(),{livenessStreamProvider:e}}))},detectFace(t){return e(this,void 0,void 0,(function*(){const{videoAssociatedParams:{videoEl:e},ovalAssociatedParams:{faceDetector:a}}=t;try{yield a.modelLoadingPromise}catch(e){console.log({err:e})}return{faceMatchState:yield l(a,e)}}))},detectFaceDistance(t){return e(this,void 0,void 0,(function*(){const{videoAssociatedParams:{videoEl:e,videoMediaStream:a,isMobile:o},ovalAssociatedParams:{faceDetector:r},isFaceFarEnoughBeforeRecording:i}=t,{width:s,height:n}=a.getTracks()[0].getSettings(),c=F({width:s,height:n});return{isFaceFarEnoughBeforeRecording:yield v({faceDetector:r,videoEl:e,ovalDetails:c,reduceThreshold:i,isMobile:o})}}))},detectInitialFaceAndDrawOval(t){return e(this,void 0,void 0,(function*(){const{videoAssociatedParams:{videoEl:e,canvasEl:a,isMobile:o},ovalAssociatedParams:{faceDetector:r},serverSessionInformation:i,livenessStreamProvider:s}=t;try{yield r.modelLoadingPromise,yield s.videoRecorder.recorderStarted}catch(e){console.log({err:e})}const n=yield r.detectFaces(e);let c,d,l;switch(n.length){case 0:d=D.CANT_IDENTIFY,l=m(e);break;case 1:d=D.FACE_IDENTIFIED,c=n[0];break;default:d=D.TOO_MANY}if(!c)return{faceMatchState:d,illuminationState:l};const{width:v,height:f}=e.getBoundingClientRect();o?(a.width=window.innerWidth,a.height=window.innerHeight):(a.width=v,a.height=f);const S=v/e.videoWidth,p=h({sessionInformation:i,videoWidth:e.width}),F=g(c,p);return c.top=F.top,c.left=F.left,c.height=F.bottom-F.top,c.width=F.right-F.left,u({canvas:a,oval:p,scaleFactor:S,videoEl:e}),{faceMatchState:d,ovalDetails:p,scaleFactor:S,initialFace:c}}))},detectFaceAndMatchOval(t){return e(this,void 0,void 0,(function*(){const{videoAssociatedParams:{videoEl:e},ovalAssociatedParams:{faceDetector:a,ovalDetails:o,initialFace:r},serverSessionInformation:i}=t,s=yield a.detectFaces(e);let n,c,d,l=0;const v=g(r,o),{ovalBoundingBox:h}=f(o),u=S(v,h);switch(s.length){case 0:n=D.CANT_IDENTIFY,d=m(e);break;case 1:{c=s[0];const{faceMatchState:e,faceMatchPercentage:t}=p(c,o,u,i);n=e,l=t;break}default:n=D.TOO_MANY}return{faceMatchState:n,faceMatchPercentage:l,illuminationState:d,detectedFace:c}}))},flashColors(t){return e(this,void 0,void 0,(function*(){const{freshnessColorAssociatedParams:{freshnessColorsComplete:e,freshnessColorDisplay:a}}=t;if(e)return;return{freshnessColorsComplete:yield a.displayColorTick()}}))},stopVideo(t){return e(this,void 0,void 0,(function*(){const{challengeId:e,videoAssociatedParams:{videoMediaStream:a},ovalAssociatedParams:{initialFace:o,ovalDetails:r},faceMatchAssociatedParams:{startFace:i,endFace:n},livenessStreamProvider:c}=t,{width:d,height:l}=a.getTracks()[0].getSettings(),v=d-o.left-o.width;yield c.stopVideo();const m={Challenge:{FaceMovementAndLightChallenge:{ChallengeId:e,InitialFace:{InitialFaceDetectedTimestamp:o.timestampMs,BoundingBox:s({deviceHeight:l,deviceWidth:d,height:o.height,width:o.width,top:o.top,left:v})},TargetFace:{FaceDetectedInTargetPositionStartTimestamp:i.timestampMs,FaceDetectedInTargetPositionEndTimestamp:n.timestampMs,BoundingBox:s({deviceHeight:l,deviceWidth:d,height:r.height,width:r.width,top:r.centerY-r.height/2,left:r.centerX-r.width/2})},VideoEndTimestamp:c.videoRecorder.recorderEndTimestamp}}};c.sendClientInfo(m),yield c.dispatchStopVideoEvent()}))},getLiveness(t){return e(this,void 0,void 0,(function*(){const{componentProps:{onAnalysisComplete:e},livenessStreamProvider:a}=t;a.endStream(),yield e()}))}}}),_=a=>e(void 0,void 0,void 0,(function*(){var e,o;const r=yield B;try{try{for(var i,s=t(r);!(i=yield s.next()).done;){const e=i.value;P(e)?a({type:"SET_SESSION_INFO",data:{sessionInfo:e.ServerSessionInformationEvent.SessionInformation}}):T(e)?a({type:"DISCONNECT_EVENT"}):O(e)?a({type:"SERVER_ERROR",data:{error:Object.assign({},e.ValidationException)}}):I(e)?a({type:"SERVER_ERROR",data:{error:Object.assign({},e.InternalServerException)}}):w(e)?a({type:"SERVER_ERROR",data:{error:Object.assign({},e.ThrottlingException)}}):y(e)&&a({type:"SERVER_ERROR",data:{error:Object.assign({},e.ServiceQuotaExceededException)}})}}catch(t){e={error:t}}finally{try{i&&!i.done&&(o=s.return)&&(yield o.call(s))}finally{if(e)throw e.error}}}catch(e){let t=e;b(e)&&(t=new Error("Invalid region in FaceLivenessDetector or credentials are scoped to the wrong region.")),a({type:"SERVER_ERROR",data:{error:t}})}}));export{k as MIN_FACE_MATCH_TIME,j as livenessMachine};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
class o{triggerModelLoading(){this.modelLoadingPromise=this.loadModels()}}export{o as FaceDetection};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
var E,R,A;!function(E){E.DARK="dark",E.BRIGHT="bright",E.NORMAL="normal"}(E||(E={})),function(E){E.MATCHED="MATCHED",E.TOO_FAR="TOO FAR",E.TOO_CLOSE="TOO CLOSE",E.CANT_IDENTIFY="CANNOT IDENTIFY",E.FACE_IDENTIFIED="ONE FACE IDENTIFIED",E.TOO_MANY="TOO MANY FACES"}(R||(R={})),function(E){E.TIMEOUT="TIMEOUT",E.RUNTIME_ERROR="RUNTIME_ERROR",E.FRESHNESS_TIMEOUT="FRESHNESS_TIMEOUT",E.SERVER_ERROR="SERVER_ERROR",E.CAMERA_FRAMERATE_ERROR="CAMERA_FRAMERATE_ERROR",E.CAMERA_ACCESS_ERROR="CAMERA_ACCESS_ERROR",E.FACE_DISTANCE_ERROR="FACE_DISTANCE_ERROR",E.MOBILE_LANDSCAPE_ERROR="MOBILE_LANDSCAPE_ERROR"}(A||(A={}));export{R as FaceMatchState,E as IlluminationState,A as LivenessErrorState};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{__awaiter as t}from"../../../../node_modules/tslib/tslib.es6.mjs";import*as e from"@tensorflow/tfjs-core";import*as o from"@tensorflow-models/blazeface";import*as s from"@tensorflow/tfjs-backend-wasm";import"@tensorflow/tfjs-backend-cpu";import{jitteredExponentialRetry as a}from"@aws-amplify/core";import{isWebAssemblySupported as i}from"./support.mjs";import{FaceDetection as r}from"../types/faceDetection.mjs";import"../types/liveness.mjs";class n extends r{constructor(t,e){super(),this.faceModelUrl=e,this.binaryPath=null!=t?t:`https://cdn.jsdelivr.net/npm/@tensorflow/tfjs-backend-wasm@${s.version_wasm}/dist/`}loadModels(){return t(this,void 0,void 0,(function*(){i()?yield this._loadWebAssemblyBackend():yield this._loadCPUBackend();try{yield e.ready(),this._model=yield a(o.load,[{modelUrl:this.faceModelUrl}])}catch(t){throw new Error("There was an error loading the blazeface model. If you are using a custom blazeface model url ensure that it is a fully qualified url that returns a json file.")}}))}detectFaces(e){return t(this,void 0,void 0,(function*(){const t=yield this._model.estimateFaces(e,!1,!0,!0),o=Date.now();return t.map((t=>{const{topLeft:e,bottomRight:s,probability:a,landmarks:i}=t;if(void 0===i)return;const[r,n]=e,[d,l]=s,m=Math.abs(r-d),c=Math.abs(l-n),f=i[0],h=i[1],u=i[2],p=i[3];return{top:n,left:d,width:m,height:c,timestampMs:o,probability:a[0],rightEye:f,leftEye:h,mouth:p,nose:u}}))}))}_loadWebAssemblyBackend(){return t(this,void 0,void 0,(function*(){try{s.setWasmPaths(this.binaryPath),yield a((()=>t(this,void 0,void 0,(function*(){if(!(yield e.setBackend("wasm")))throw new Error("Initialization of backend wasm failed")}))),[]),this.modelBackend="wasm"}catch(t){throw new Error('There was an error loading the TFJS WASM backend. If you are using a custom WASM path ensure that it ends with "/" and that it is not the full URL as @tensorflow/tfjs-backend-wasm will append the wasm binary file name. Read more: https://github.com/tensorflow/tfjs/blob/master/tfjs-backend-wasm/src/backend_wasm.ts#L475.')}}))}_loadCPUBackend(){return t(this,void 0,void 0,(function*(){yield e.setBackend("cpu"),this.modelBackend="cpu"}))}}export{n as BlazeFaceFaceDetection};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
const o=.32,t=.4,c=.37;export{o as FACE_DISTANCE_THRESHOLD,t as REDUCED_THRESHOLD,c as REDUCED_THRESHOLD_MOBILE};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
const n=n=>!!(null==n?void 0:n.ServerSessionInformationEvent),e=n=>!!(null==n?void 0:n.DisconnectionEvent),i=n=>!!(null==n?void 0:n.ValidationException),o=n=>!!(null==n?void 0:n.InternalServerException),t=n=>!!(null==n?void 0:n.ThrottlingException),l=n=>!!(null==n?void 0:n.ServiceQuotaExceededException),r=n=>{const{message:e,name:i}=n;return"InvalidSignatureException"===i&&e.includes("valid region")};export{e as isDisconnectionEvent,o as isInternalServerExceptionEvent,r as isInvalidSignatureRegionException,n as isServerSesssionInformationEvent,l as isServiceQuotaExceededExceptionEvent,t as isThrottlingExceptionEvent,i as isValidationExceptionEvent};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{__awaiter as e}from"../../../../node_modules/tslib/tslib.es6.mjs";import{fillOverlayCanvasFractional as t,getFaceMatchState as o,getRGBArrayFromColorString as s}from"./liveness.mjs";import{FaceMatchState as r}from"../types/liveness.mjs";var i;!function(e){e.SCROLLING="SCROLLING",e.FLAT="FLAT"}(i||(i={}));class l{constructor(e,t){this.context=e,this.freshnessColorsSequence=t,this.isFirstTick=!0}displayColorTick(){return e(this,void 0,void 0,(function*(){return new Promise(((e,t)=>{setTimeout((()=>{this.displayNextColorTick(e,t)}),Math.min(10))}))}))}init(){this.stageIndex=0,this.currColorIndex=0,this.currColorSequence=this.freshnessColorsSequence[0],this.prevColorSequence=this.freshnessColorsSequence[0],this.stage=i.FLAT,this.timeLastFlatOrScrollChange=Date.now(),this.timeLastFaceMatchChecked=Date.now()}displayNextColorTick(e,o){const{freshnessColorAssociatedParams:{freshnessColorEl:s},ovalAssociatedParams:{ovalDetails:r,scaleFactor:l},videoAssociatedParams:{videoEl:n}}=this.context,c=Date.now();this.isFirstTick&&(this.init(),this.isFirstTick=!1,this.sendColorStartTime({tickStartTime:c,currColor:this.currColorSequence.color,prevColor:this.currColorSequence.color,currColorIndex:this.stageIndex}));let a=c-this.timeLastFlatOrScrollChange;if(s.style.display="block",(this.stage===i.FLAT&&a>=this.currColorSequence.flatDisplayDuration||this.stage===i.SCROLLING&&a>=this.currColorSequence.downscrollDuration)&&(this.incrementStageIndex(c),a=0),this.currColorIndex<this.freshnessColorsSequence.length){const o=a/(this.stage===i.SCROLLING?this.currColorSequence.downscrollDuration:this.currColorSequence.flatDisplayDuration);t({overlayCanvas:s,prevColor:this.prevColorSequence.color,nextColor:this.currColorSequence.color,videoEl:n,ovalDetails:r,heightFraction:o,scaleFactor:l}),e(!1)}else s.style.display="none",e(!0)}incrementStageIndex(e){if(this.stageIndex+=1,this.prevColorSequence=this.freshnessColorsSequence[this.currColorIndex],this.stage===i.FLAT)this.currColorIndex+=1,this.stage=i.SCROLLING;else if(this.stage===i.SCROLLING){this.freshnessColorsSequence[this.currColorIndex].flatDisplayDuration>0?this.stage=i.FLAT:(this.stage=i.SCROLLING,this.currColorIndex+=1)}this.currColorSequence=this.freshnessColorsSequence[this.currColorIndex],this.timeLastFlatOrScrollChange=Date.now(),this.currColorSequence&&this.sendColorStartTime({tickStartTime:e,currColor:this.currColorSequence.color,prevColor:this.prevColorSequence.color,currColorIndex:this.stageIndex})}matchFaceInOval(t){return e(this,void 0,void 0,(function*(){const{ovalAssociatedParams:{faceDetector:e},videoAssociatedParams:{videoEl:s}}=this.context;if(Date.now()-this.timeLastFaceMatchChecked>100){const i=yield o(e,s);if(this.timeLastFaceMatchChecked=Date.now(),i===r.MATCHED)this.timeFaceMatched=Date.now();else{Date.now()-this.timeFaceMatched>1e3&&t()}}}))}sendColorStartTime({tickStartTime:e,currColor:t,prevColor:o,currColorIndex:r}){const{livenessStreamProvider:i,challengeId:l}=this.context;i.sendClientInfo({Challenge:{FaceMovementAndLightChallenge:{ChallengeId:l,ColorDisplayed:{CurrentColor:{RGB:s(t)},PreviousColor:{RGB:s(o)},SequenceNumber:r,CurrentColorStartTimestamp:e}}}})}}export{l as FreshnessColorDisplay};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{__awaiter as t}from"../../../../node_modules/tslib/tslib.es6.mjs";import{LivenessErrorState as e,FaceMatchState as o,IlluminationState as n}from"../types/liveness.mjs";import{FACE_DISTANCE_THRESHOLD as i,REDUCED_THRESHOLD_MOBILE as l,REDUCED_THRESHOLD as r}from"./constants.mjs";function a(t,e,o){return t*(o-e)+e}function h(t){const e=t.flippedCenterX-t.width/2,o=t.flippedCenterX+t.width/2,n=t.centerY-t.height/2,i=t.centerY+t.height/2;return{ovalBoundingBox:{left:e,top:n,right:o,bottom:i},minOvalX:e,maxOvalX:o,minOvalY:n,maxOvalY:i}}function c(t,e){const o=Math.max(t.left,e.left),n=Math.max(t.top,e.top),i=Math.min(t.right,e.right),l=Math.min(t.bottom,e.bottom),r=Math.abs(Math.max(0,i-o)*Math.max(0,l-n));if(0===r)return 0;return r/(Math.abs((t.right-t.left)*(t.bottom-t.top))+Math.abs((e.right-e.left)*(e.bottom-e.top))-r)}function d({sessionInformation:t,videoWidth:e}){var o,n;const i=null===(n=null===(o=null==t?void 0:t.Challenge)||void 0===o?void 0:o.FaceMovementAndLightChallenge)||void 0===n?void 0:n.OvalParameters;return{flippedCenterX:(null==i?void 0:i.CenterX)?e-(null==i?void 0:i.CenterX):void 0,centerX:null==i?void 0:i.CenterX,centerY:null==i?void 0:i.CenterY,width:null==i?void 0:i.Width,height:null==i?void 0:i.Height}}function s({width:t,height:e,widthSeed:o=1,centerXSeed:n=.5,centerYSeed:i=.5}){const l=e;let r=t;const h=.8*o,c=Math.floor(7*t/16),d=Math.floor(9*t/16),s=Math.floor(7*e/16),f=Math.floor(9*e/16),v=a(n,c,d),u=a(i,s,f);t>=e&&(r=3/4*l);const g=h*r,R=1.618*g;return{flippedCenterX:Math.floor(r-v),centerX:Math.floor(v),centerY:Math.floor(u),width:Math.floor(g),height:Math.floor(R)}}function f({canvas:t,oval:e,scaleFactor:o,videoEl:n}){const{flippedCenterX:i,centerY:l,width:r,height:a}=e,{width:h,height:c}=t.getBoundingClientRect(),d=t.getContext("2d");if(!d)throw new Error("Cannot find Canvas.");{d.clearRect(0,0,h,c),d.fillStyle="rgba(255, 255, 255, 1.0)",d.fillRect(0,0,h,c);const t={width:n.videoWidth,height:n.videoHeight},e={x:(h-t.width*o)/2,y:(c-t.height*o)/2};d.setTransform(o,0,0,o,e.x,e.y),d.beginPath(),d.ellipse(i,l,r/2,a/2,0,0,2*Math.PI),d.strokeStyle="#AEB3B7",d.lineWidth=3,d.stroke(),d.clip(),d.setTransform(1,0,0,1,0,0),d.clearRect(0,0,h,c)}}function v(t,e,n,i){let l;const{OvalIouThreshold:r,OvalIouHeightThreshold:a,OvalIouWidthThreshold:d,FaceIouHeightThreshold:s,FaceIouWidthThreshold:f}=i.Challenge.FaceMovementAndLightChallenge.ChallengeConfig,v=g(t,e),u=v.left,R=v.right,E=v.top,C=v.bottom,{ovalBoundingBox:M,minOvalX:p,minOvalY:m,maxOvalX:w,maxOvalY:O}=h(e),A=c(v,M),T=r,x=e.width*d,b=e.height*a,_=e.width*f,I=e.height*s,S=100*Math.max(Math.min(1,.75*(A-n)/(T-n)+.25),0);return l=A>T&&Math.abs(p-u)<x&&Math.abs(w-R)<x&&Math.abs(O-C)<b?o.MATCHED:m-E>I||C-O>I||p-u>_&&R-w>_?o.TOO_CLOSE:o.TOO_FAR,{faceMatchState:l,faceMatchPercentage:S}}function u(t){const{leftEye:e,rightEye:o,mouth:n}=t,i=[];i[0]=(e[0]+o[0])/2,i[1]=(e[1]+o[1])/2;return{pupilDistance:Math.sqrt(Math.pow(e[0]-o[0],2)+Math.pow(e[1]-o[1],2)),faceHeight:Math.sqrt(Math.pow(i[0]-n[0],2)+Math.pow(i[1]-n[1],2))}}function g(t,e){const{leftEye:o,rightEye:n,nose:i}=t,{height:l,centerY:r}=e,a=r-l/2,h=[];h[0]=(o[0]+n[0])/2,h[1]=(o[1]+n[1])/2;const{pupilDistance:c,faceHeight:d}=u(t),s=(2*c+1.8*d)/2,f=1.618*s;let v,g;h[1]<=(a+l)/2?(v=(h[0]+i[0])/2,g=(h[1]+i[1])/2):(v=h[0],g=h[1]);const R=v-s/2,E=g-f/2;return{left:R,top:E,right:R+s,bottom:E+f}}function R(t){const e=document.createElement("canvas");e.width=t.videoWidth,e.height=t.videoHeight;const o=e.getContext("2d");if(o){o.drawImage(t,0,0,e.width,e.height);const i=o.getImageData(0,0,e.width,e.height).data,l=8,r=new Array(l).fill(0);for(let t=0;t<i.length;t++){r[Math.round(.2126*i[t++]+.7152*i[t++]+.0722*i[t++])%32]++}let a=-1,h=0;for(let t=0;t<l;t++)r[t]>h&&(h=r[t],a=t);return e.remove(),0===a?n.DARK:a===l?n.BRIGHT:n.NORMAL}throw new Error("Cannot find Video Element.")}function E(t){return t.label.toLowerCase().includes("virtual")}const C={[e.RUNTIME_ERROR]:"RUNTIME_ERROR",[e.SERVER_ERROR]:"SERVER_ERROR",[e.TIMEOUT]:"TIMEOUT",[e.FACE_DISTANCE_ERROR]:"FACE_DISTANCE_ERROR",[e.CAMERA_FRAMERATE_ERROR]:"CAMERA_FRAMERATE_ERROR",[e.CAMERA_ACCESS_ERROR]:"CAMERA_ACCESS_ERROR",[e.MOBILE_LANDSCAPE_ERROR]:"MOBILE_LANDSCAPE_ERROR",[e.FRESHNESS_TIMEOUT]:"FRESHNESS_TIMEOUT"};function M({ctx:t,prevColor:e,nextColor:o,fraction:n}){const i=t.canvas.width,l=t.canvas.height;t.fillStyle=o,t.fillRect(0,0,i,l*n),1!==n&&(t.fillStyle=e,t.fillRect(0,l*n,i,l*(1-n)))}function p({overlayCanvas:t,prevColor:e,nextColor:o,videoEl:n,ovalDetails:i,heightFraction:l,scaleFactor:r}){const{x:a,y:h}=n.getBoundingClientRect(),{flippedCenterX:c,centerY:d,width:s,height:f}=i,v=c*r+a,u=d*r+h,g=t.width,R=t.height,E=t.getContext("2d");if(!E)throw new Error("Cannot find Overlay Canvas.");E.canvas.width=window.innerWidth,E.canvas.height=window.innerHeight,E.clearRect(0,0,g,R),M({ctx:E,prevColor:e,nextColor:o,fraction:l}),E.save(),E.beginPath(),E.rect(0,0,g,R),E.clip(),E.clearRect(0,0,g,R),E.globalAlpha=.9,M({ctx:E,prevColor:e,nextColor:o,fraction:l}),E.beginPath(),E.ellipse(v,u,s*r/2,f*r/2,0,0,2*Math.PI),E.strokeStyle="white",E.lineWidth=8,E.stroke(),E.clip(),E.clearRect(0,0,g,R),E.globalAlpha=.75,M({ctx:E,prevColor:e,nextColor:o,fraction:l}),E.restore()}const m=t=>!!t;function w(t){var e,o;const n=null===(o=null===(e=t.Challenge)||void 0===e?void 0:e.FaceMovementAndLightChallenge)||void 0===o?void 0:o.ColorSequences;return[...n||[]].map((({FreshnessColor:t,DownscrollDuration:e,FlatDisplayDuration:o})=>{const n=null==t?void 0:t.RGB,i=n?`rgb(${n[0]},${n[1]},${n[2]})`:"";return void 0!==i&&void 0!==e&&void 0!==o?{color:i,downscrollDuration:e,flatDisplayDuration:o}:void 0})).filter(m)}function O(t){return t.slice(t.indexOf("(")+1,t.indexOf(")")).split(",").map((t=>parseInt(t)))}function A(e,n){return t(this,void 0,void 0,(function*(){let t;switch((yield e.detectFaces(n)).length){case 0:t=o.CANT_IDENTIFY;break;case 1:t=o.FACE_IDENTIFIED;break;default:t=o.TOO_MANY}return t}))}function T({faceDetector:e,videoEl:o,ovalDetails:n,reduceThreshold:a=!1,isMobile:h=!1}){return t(this,void 0,void 0,(function*(){const t=yield e.detectFaces(o);let c,d=!1;switch(t.length){case 0:break;case 1:{c=t[0];const e=null==n?void 0:n.width,{pupilDistance:o,faceHeight:s}=u(c),f=2,v=(f*o+1.8*s)/2/f;e&&(d=v/e<(a?h?l:r:i));break}}return d}))}function x({deviceHeight:t,deviceWidth:e,height:o,width:n,top:i,left:l}){return{Height:o/t,Width:n/e,Top:i/t,Left:l/e}}export{C as LivenessErrorStateStringMap,f as drawLivenessOvalInCanvas,R as estimateIllumination,p as fillOverlayCanvasFractional,g as generateBboxFromLandmarks,x as getBoundingBox,w as getColorsSequencesFromSessionInformation,A as getFaceMatchState,v as getFaceMatchStateInLivenessOval,c as getIntersectionOverUnion,h as getOvalBoundingBox,d as getOvalDetailsFromSessionInformation,O as getRGBArrayFromColorString,s as getStaticLivenessOvalDetails,E as isCameraDeviceVirtual,m as isClientFreshnessColorSequence,T as isFaceDistanceBelowThreshold};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{__awaiter as e,__asyncGenerator as i,__await as t}from"../../../../node_modules/tslib/tslib.es6.mjs";import{Credentials as o,getAmplifyUserAgent as n}from"@aws-amplify/core";import{AmazonAIInterpretPredictionsProvider as s}from"@aws-amplify/predictions";import{RekognitionStreamingClient as r,StartFaceLivenessSessionCommand as d}from"@aws-sdk/client-rekognitionstreaming";import{VideoRecorder as a}from"./videoRecorder.mjs";const l=process.env.NEXT_PUBLIC_STREAMING_API_URL,h=1e3;function c(e){return void 0!==e.arrayBuffer}function v(e){return void 0!==e.Challenge}class m extends s{constructor(e,i,t,o){super(),this.sessionId=e,this.region=i,this._stream=t,this.videoEl=o,this.videoRecorder=new a(t),this.initPromise=this.init()}getResponseStream(){return e(this,void 0,void 0,(function*(){return yield this.initPromise,this.responseStream}))}startRecordingLivenessVideo(){this.videoRecorder.start(1e3)}sendClientInfo(e){this.videoRecorder.dispatch(new MessageEvent("clientSesssionInfo",{data:{clientInfo:e}}))}stopVideo(){return e(this,void 0,void 0,(function*(){yield this.videoRecorder.stop()}))}dispatchStopVideoEvent(){this.videoRecorder.dispatch(new Event("stopVideo"))}endStream(){return e(this,void 0,void 0,(function*(){if("recording"===this.videoRecorder.getState()&&(yield this.stopVideo(),this.dispatchStopVideoEvent()),this._reader)return yield this._reader.cancel(),this._reader.closed}))}init(){return e(this,void 0,void 0,(function*(){const e=yield o.get();if(!e)throw new Error("No credentials");const i={credentials:e,region:this.region,customUserAgent:n()};l&&(i.endpointProvider=()=>({url:new URL(l)})),this._client=new r(i),this.responseStream=yield this.startLivenessVideoConnection()}))}getAsyncGeneratorFromReadableStream(e){const o=this;return this._reader=e.getReader(),function(){return i(this,arguments,(function*(){for(;;){const{done:e,value:i}=yield t(o._reader.read());if(e)return yield t(void 0);if("stopVideo"===i)yield yield t({VideoEvent:{VideoChunk:[],TimestampMillis:Date.now()}});else if(c(i)){const e=yield t(i.arrayBuffer()),o=new Uint8Array(e);o.length>0&&(yield yield t({VideoEvent:{VideoChunk:o,TimestampMillis:Date.now()}}))}else v(i)&&(yield yield t({ClientSessionInformationEvent:{Challenge:i.Challenge}}))}}))}}startLivenessVideoConnection(){return e(this,void 0,void 0,(function*(){const e=this.getAsyncGeneratorFromReadableStream(this.videoRecorder.videoStream)();return(yield this._client.send(new d({ChallengeVersions:"FaceMovementAndLightChallenge_1.0.0",SessionId:this.sessionId,LivenessRequestStream:e,VideoWidth:this.videoEl.videoWidth.toString(),VideoHeight:this.videoEl.videoHeight.toString()}))).LivenessResponseStream}))}}export{m as LivenessStreamProvider,h as TIME_SLICE};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
function e(){try{return!(!window.WebAssembly||!window.WebAssembly.compile&&!window.WebAssembly.compileStreaming)}catch(e){return!1}}export{e as isWebAssemblySupported};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{__awaiter as e}from"../../../../node_modules/tslib/tslib.es6.mjs";class t{constructor(e,t={}){if("undefined"==typeof MediaRecorder)throw Error("MediaRecorder is not supported by this browser");this._stream=e,this._options=t,this._chunks=[],this._recorder=new MediaRecorder(e,{bitsPerSecond:1e6}),this._setupCallbacks()}getState(){var e;return null===(e=this._recorder)||void 0===e?void 0:e.state}start(e){var t;this.clearRecordedData(),this.recordingStartApiTimestamp=Date.now(),null===(t=this._recorder)||void 0===t||t.start(e)}stop(){var t;return e(this,void 0,void 0,(function*(){return"recording"===this.getState()&&(null===(t=this._recorder)||void 0===t||t.stop()),this._recorderStopped}))}pause(){var e;null===(e=this._recorder)||void 0===e||e.pause()}clearRecordedData(){this._chunks=[]}destroy(){this.stop(),this.clearRecordedData(),this._recorder=null}dispatch(e){var t;null===(t=this._recorder)||void 0===t||t.dispatchEvent(e)}_setupCallbacks(){this.videoStream=new ReadableStream({start:e=>{this._recorder&&(this._recorder.ondataavailable=t=>{t.data&&t.data.size>0&&(0===this._chunks.length&&(this.firstChunkTimestamp=Date.now()),this._chunks.push(t.data),e.enqueue(t.data))},this._recorder.addEventListener("clientSesssionInfo",(t=>{e.enqueue(t.data.clientInfo)})),this._recorder.addEventListener("stopVideo",(()=>{e.enqueue("stopVideo")})),this._recorder.addEventListener("endStream",(()=>{e.close()})))}}),this.recorderStarted=new Promise((e=>{this._recorder.onstart=()=>{this.recorderStartTimestamp=Date.now(),e()}})),this._recorderStopped=new Promise((e=>{this._recorder.onstop=()=>{this.recorderEndTimestamp=Date.now(),e()}})),this._recorder.onerror=()=>{"stopped"!==this.getState()&&this.stop()}}}export{t as VideoRecorder};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import e from"react";import{Button as t}from"@aws-amplify/ui-react";import{IconClose as r}from"@aws-amplify/ui-react/internal";import{useLivenessActor as a}from"../hooks/useLivenessActor.mjs";import"@xstate/react";import"../providers/FaceLivenessDetectorProvider.mjs";import"@aws-amplify/ui";import{LivenessClassNames as i}from"../types/classNames.mjs";const o=({ariaLabel:o})=>{const[s,m]=a();return s.done?null:e.createElement(t,{autoFocus:!0,variation:"link",onClick:()=>{m({type:"CANCEL"})},size:"large",className:i.CancelButton,"aria-label":o},e.createElement(r,{"aria-hidden":"true","data-testid":"close-icon"}))};export{o as CancelButton};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import e from"react";import{View as t,Flex as r,ComponentClassNames as o,Text as a}from"@aws-amplify/ui-react";import"@aws-amplify/ui-react/internal";import"@xstate/react";import"../providers/FaceLivenessDetectorProvider.mjs";import"@aws-amplify/ui";import{LivenessClassNames as i}from"../types/classNames.mjs";import"../service/machine/index.mjs";import"../service/types/liveness.mjs";import"@tensorflow/tfjs-core";import"@tensorflow-models/blazeface";import"@tensorflow/tfjs-backend-wasm";import"@tensorflow/tfjs-backend-cpu";import"@aws-amplify/core";import"../service/utils/liveness.mjs";import"../service/utils/streamProvider.mjs";import"../service/utils/freshnessColorDisplay.mjs";import{StartScreenFigure as s}from"./StartScreenFigure.mjs";import{GoodFitIllustration as m}from"./GoodFitIllustration.mjs";import{TooFarIllustration as l}from"./TooFarIllustration.mjs";import{LivenessIconWithPopover as n}from"./LivenessIconWithPopover.mjs";const c=({headingText:r,bodyText:o})=>e.createElement(t,{flex:"1"},e.createElement(t,{color:"font.primary",fontWeight:"bold"},r),e.createElement(t,{color:"font.primary"},o)),p=({headingText:a,bodyText:i,infoText:s})=>e.createElement(r,{className:o.Alert,color:"orange.80",backgroundColor:"orange.20",alignItems:"center"},e.createElement(t,{flex:"1"},e.createElement(t,{className:o.AlertHeading},a),e.createElement(t,{className:o.AlertBody},i)),e.createElement(n,null,s)),f=({headingText:t,goodFitCaptionText:o,goodFitAltText:n,tooFarCaptionText:c,tooFarAltText:p,steps:f})=>e.createElement(r,{direction:"column"},e.createElement(a,{color:"font.primary",fontWeight:"bold"},t),e.createElement(r,{className:i.Figures},e.createElement(s,{variation:"success",caption:o},e.createElement(m,{title:n})),e.createElement(s,{variation:"error",caption:c},e.createElement(l,{title:p}))),e.createElement(r,{as:"ol",className:i.InstructionList},f.map(((t,o)=>e.createElement(r,{as:"li",key:o+1},e.createElement(a,{as:"span","aria-hidden":"true"},o+1,"."),e.createElement(a,{as:"span"},t))))));export{c as DefaultHeader,f as DefaultInstructions,p as DefaultPhotosensitiveWarning};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import e from"react";import{Flex as t,Text as r,Button as s}from"@aws-amplify/ui-react";import{AlertIcon as a}from"@aws-amplify/ui-react/internal";import"../service/machine/index.mjs";import{LivenessErrorState as o}from"../service/types/liveness.mjs";import"@tensorflow/tfjs-core";import"@tensorflow-models/blazeface";import"@tensorflow/tfjs-backend-wasm";import"@tensorflow/tfjs-backend-cpu";import"@aws-amplify/core";import"../service/utils/liveness.mjs";import"../service/utils/streamProvider.mjs";import"../service/utils/freshnessColorDisplay.mjs";import{Toast as i}from"./Toast.mjs";import{Overlay as n}from"./Overlay.mjs";import{defaultErrorDisplayText as m}from"../displayText.mjs";const c=({errorState:s,overrideErrorDisplayText:i})=>{const n=Object.assign(Object.assign({},m),i);return s===o.CAMERA_ACCESS_ERROR||s===o.CAMERA_FRAMERATE_ERROR||s===o.MOBILE_LANDSCAPE_ERROR?null:(s=>{const{error:i,displayText:n}=s,{timeoutHeaderText:m,timeoutMessageText:c,faceDistanceHeaderText:l,faceDistanceMessageText:p,clientHeaderText:E,clientMessageText:f,serverHeaderText:R,serverMessageText:d}=n;let T,u;switch(i){case o.TIMEOUT:T=m,u=c;break;case o.FACE_DISTANCE_ERROR:T=l,u=p;break;case o.RUNTIME_ERROR:T=E,u=f;break;case o.SERVER_ERROR:default:T=R,u=d}return e.createElement(e.Fragment,null,e.createElement(t,{gap:"xs",alignItems:"center",justifyContent:"center",color:"font.error"},e.createElement(a,{ariaHidden:!0,variation:"error"}),e.createElement(r,{fontWeight:"bold"},T)),u)})({error:s,displayText:n})},l=r=>{const{children:a,onRetry:o,displayText:c}=r,l=Object.assign(Object.assign({},m),c),{tryAgainText:p}=l;return e.createElement(n,{backgroundColor:"overlay.40"},e.createElement(i,null,a,e.createElement(t,{justifyContent:"center"},e.createElement(s,{variation:"primary",type:"button",onClick:o},p))))};export{l as FaceLivenessErrorModal,c as renderErrorModal};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import l from"react";const e=({title:e,testId:t})=>l.createElement("svg",{width:"150",height:"150","data-testid":t},l.createElement("title",null,e),l.createElement("g",{fill:"none",fillRule:"evenodd",transform:"translate(0 -.001)"},l.createElement("path",{fill:"#5B361E",fillRule:"nonzero",d:"M124.655 0c9.173 8.155 9.394 17.812 13.258 32.385l.053.336.108.726.11.796.112.864.114.931.174 1.515.117 1.087.18 1.739.12 1.23.183 1.944.123 1.36.186 2.13.187 2.232.313 3.928.25 3.31.25 3.443.31 4.463.245 3.679.36 5.658.345 5.778.33 5.841.26 4.876.199 3.883.187 3.849.217 4.738.16 3.712.178 4.515.097 2.63v34.977L.519 150 .517 41.97c3-13.353 9.664-29.4 23.841-41.97h100.297Z"}),l.createElement("path",{fill:"#FCDDCC",fillRule:"nonzero",stroke:"#000",d:"m50.469 18.849.145.153c9.021 9.393 22.62 16.197 36.089 21.996l2.1.897 1.05.443 2.089.876 8.176 3.385 1.979.825 1.944.82c7.782 3.3 14.617 6.491 19.213 10.006 3.57 2.73 5.793 5.645 5.924 8.999v20.474l-.008.624-.016.669-.04 1.089-.04.777-.047.815-.06.853-.068.887-.08.918-.093.95-.104.978-.057.496-.123 1.016-.066.513-.144 1.049-.076.527-.165 1.077c-.057.36-.116.724-.178 1.086l-.193 1.103-.21 1.116-.11.557-.233 1.13c-.12.564-.247 1.13-.38 1.694l-.275 1.14c-1.037 4.147-2.426 8.3-4.271 11.978-6.17 9.34-12.996 16.035-19.28 20.691l-.8.584-.794.562-.784.539-1.165.77-1.147.724-.755.459c-.249.148-.497.294-.74.434l-.73.416-1.078.588-.702.367-1.033.517-.671.321-.657.303-.643.285-.541.23H68.149a75.81 75.81 0 0 1-.81-.284l-.918-.336a75.953 75.953 0 0 1-.935-.355l-.963-.382a85.513 85.513 0 0 1-1.988-.83l-1.032-.455c-.52-.233-1.05-.475-1.585-.727l-1.087-.517-1.113-.547c-.935-.465-1.893-.959-2.873-1.482l-1.193-.644a141.053 141.053 0 0 1-6.297-3.669l-1.33-.83c-17.11-10.783-22.636-33.458-23.66-49.98l-.071-1.267c-.02-.417-.038-.83-.053-1.235l-.037-1.212a86.317 86.317 0 0 1 .042-5.559l.047-1.002.06-.96.064-.843c1.09-2.51 2.164-4.304 3.296-5.882l.408-.558.415-.545.421-.538 2.026-2.492.481-.597.493-.624.507-.656.518-.69a61.722 61.722 0 0 0 3.769-5.754c4.03-6.917 7.127-14.806 9.544-21.668l.566-1.623.802-2.344 2.077-6.175.416-1.205.395-1.109.373-1.007.267-.682.253-.612c.47-.943.8-1.531 1.06-1.876l-.035.047Z"}),l.createElement("path",{fill:"#000",fillRule:"nonzero",d:"m94.566 121.353.722.895c-6.828 5.51-14.13 7.462-21.382 6.447-5.417-.758-10.535-3.2-13.987-6.186l-.318-.282.77-.854c3.285 2.964 8.343 5.434 13.694 6.183 6.797.95 13.632-.819 20.089-5.876l.412-.327Z"}),l.createElement("ellipse",{cx:"51.331",cy:"80.698",fill:"#000",fillRule:"nonzero",rx:"4.886",ry:"6.707"}),l.createElement("path",{fill:"#000",fillRule:"nonzero",d:"M42.539 63.719c4.453-2.586 11.355-3.268 17.22-.195l.35.19-.556 1.005c-5.437-3.01-11.946-2.479-16.175-.153l-.262.148-.577-.995Z"}),l.createElement("ellipse",{cx:"103.281",cy:"80.698",fill:"#000",fillRule:"nonzero",rx:"4.886",ry:"6.707"}),l.createElement("path",{fill:"#000",fillRule:"nonzero",d:"M94.492 63.719c4.453-2.586 11.355-3.268 17.22-.195l.35.19-.557 1.005c-5.436-3.01-11.946-2.479-16.174-.153l-.262.148-.577-.995Zm-22.972 32.9c0 4.216 2.006 7.72 5.831 7.48l.232-.018.115 1.144c-4.774.477-7.239-3.571-7.326-8.345l-.003-.26 1.15-.001h.001Z"}),l.createElement("path",{fill:"#FFF",fillRule:"nonzero",d:"M75.002.001H0v150h150v-150H75.002Zm0 0c25.627 0 46.402 33.579 46.402 75s-20.775 75-46.402 75c-25.627 0-46.402-33.579-46.402-75s20.775-75 46.402-75Z"}),l.createElement("path",{stroke:"#AEB3B7",strokeWidth:"2",d:"M120.921 75.001c0 20.555-5.214 39.117-13.589 52.507-8.386 13.406-19.838 21.493-32.313 21.493-12.476 0-23.928-8.087-32.312-21.493-8.377-13.39-13.59-31.952-13.59-52.507 0-20.555 5.214-39.116 13.589-52.507C51.091 9.09 62.543 1.001 75.018 1.001c12.476 0 23.928 8.088 32.314 21.493 8.375 13.39 13.588 31.952 13.588 52.507h.001Z"})));export{e as GoodFitIllustration};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import*as e from"react";import{Flex as t,Loader as r,View as n}from"@aws-amplify/ui-react";import"../service/machine/index.mjs";import{FaceMatchState as o,IlluminationState as a}from"../service/types/liveness.mjs";import"@tensorflow/tfjs-core";import"@tensorflow-models/blazeface";import"@tensorflow/tfjs-backend-wasm";import"@tensorflow/tfjs-backend-cpu";import"@aws-amplify/core";import"../service/utils/liveness.mjs";import"../service/utils/streamProvider.mjs";import"../service/utils/freshnessColorDisplay.mjs";import{useLivenessActor as i}from"../hooks/useLivenessActor.mjs";import{createLivenessSelector as c,useLivenessSelector as s}from"../hooks/useLivenessSelector.mjs";import"@aws-amplify/ui";import{Toast as l}from"./Toast.mjs";import{Overlay as m}from"./Overlay.mjs";const h=c((e=>e.context.errorState)),f=c((e=>e.context.faceMatchAssociatedParams.faceMatchState)),u=c((e=>e.context.faceMatchAssociatedParams.illuminationState)),T=c((e=>e.context.isFaceFarEnoughBeforeRecording)),p=c((e=>e.context.faceMatchStateBeforeStart)),E=({hintDisplayText:c})=>{const[E]=i(),O=s(h),d=s(f),x=s(u),F=s(p),g=s(T),v=E.matches("checkFaceDetectedBeforeStart"),C=E.matches("checkFaceDistanceBeforeRecording"),A=E.matches("recording"),y=E.matches("notRecording"),I=E.matches("waitForSessionInfo"),S=E.matches("uploading"),j=E.matches("checkSucceeded"),M=E.matches("checkFailed"),D=E.matches({recording:"flashFreshnessColors"}),k={[o.CANT_IDENTIFY]:c.hintCanNotIdentifyText,[o.FACE_IDENTIFIED]:c.hintTooFarText,[o.TOO_MANY]:c.hintTooManyFacesText,[o.TOO_CLOSE]:c.hintTooCloseText,[o.TOO_FAR]:c.hintTooFarText,[o.MATCHED]:void 0},w={[a.BRIGHT]:c.hintIlluminationTooBrightText,[a.DARK]:c.hintIlluminationTooDarkText,[a.NORMAL]:c.hintIlluminationNormalText},_=(()=>{if(!(O||M||j)){if(!A){if(v)return F===o.TOO_MANY?e.createElement(l,null,k[F]):e.createElement(l,null,c.hintMoveFaceFrontOfCameraText);if(C&&!1===g)return e.createElement(l,null,c.hintTooCloseText);if(y)return e.createElement(l,null,c.hintHoldFacePositionCountdownText);if(I)return e.createElement(l,null,e.createElement(t,{alignItems:"center",gap:"xs"},e.createElement(r,null),e.createElement(n,null,c.hintConnectingText)));if(S)return e.createElement(m,{backgroundColor:"overlay.40",anchorOrigin:{horizontal:"center",vertical:"end"}},e.createElement(l,null,e.createElement(t,{alignItems:"center",gap:"xs"},e.createElement(r,null),e.createElement(n,null,c.hintVerifyingText))));if(x&&x!==a.NORMAL)return e.createElement(l,null,w[x])}return D?e.createElement(l,{size:"large",variation:"primary"},c.hintHoldFaceForFreshnessText):A&&!D&&d!==o.MATCHED?e.createElement(l,{size:"large",variation:d===o.TOO_CLOSE?"error":"primary"},d===o.TOO_CLOSE?k[o.TOO_CLOSE]:k[o.TOO_FAR]):null}})();return _||null};export{E as Hint,h as selectErrorState,f as selectFaceMatchState,p as selectFaceMatchStateBeforeStart,u as selectIlluminationState,T as selectIsFaceFarEnoughBeforeRecording};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import*as e from"react";import{Flex as t,Text as n,Button as r}from"@aws-amplify/ui-react";import{getLandscapeMediaQuery as a}from"../utils/device.mjs";const o=o=>{const{onRetry:c,header:i,portraitMessage:s,landscapeMessage:m,tryAgainText:l}=o,[u,g]=e.useState(!0);return e.useLayoutEffect((()=>{const e=a();return g(e.matches),e.addEventListener("change",(e=>{g(e.matches)})),()=>{e.removeEventListener("change",(e=>g(e.matches)))}}),[]),e.createElement(t,{backgroundColor:"background.primary",direction:"column",textAlign:"center",alignItems:"center",justifyContent:"center",width:"100%",height:u?"auto":480},e.createElement(n,{fontSize:"large",fontWeight:"bold"},i),e.createElement(n,null,u?m:s),u?null:e.createElement(t,{justifyContent:"center"},e.createElement(r,{variation:"primary",type:"button",onClick:c},l)))};export{o as LandscapeErrorModal};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import*as e from"react";import{useTheme as r,Flex as t}from"@aws-amplify/ui-react";import{useThemeBreakpoint as o,AlertIcon as n}from"@aws-amplify/ui-react/internal";const a=({children:a})=>{const{tokens:s}=r(),i=o(),[l,d]=e.useState(!1),p=e.useRef(null),c="base"===i;return e.useEffect((()=>{function e(e){l&&p.current&&!p.current.contains(e.target)&&d(!1)}return document.addEventListener("mousedown",e),()=>{document.removeEventListener("mousedown",e)}}),[p,l]),e.createElement(t,{position:"relative",onClick:()=>d(!l),ref:p,style:{cursor:"pointer"},testId:"popover-icon"},e.createElement(n,{ariaHidden:!0,variation:"info"}),l&&e.createElement(e.Fragment,null,e.createElement(t,{position:"absolute",top:26,left:3,style:{zIndex:3,borderStyle:"solid",borderWidth:"0 9px 9px 9px",borderColor:`transparent transparent ${s.colors.background.primary} transparent`}}),e.createElement(t,{position:"absolute",top:24,left:2,style:{zIndex:2,borderStyle:"solid",borderWidth:"0 10px 10px 10px",borderColor:`transparent transparent ${s.colors.border.secondary} transparent`}}),e.createElement(t,{position:"absolute",backgroundColor:`${s.colors.background.primary}`,color:`${s.colors.font.primary}`,direction:"row",fontSize:s.fontSizes.xs,padding:s.space.small,top:33,minWidth:240,left:c?-190:-108,border:`1px solid ${s.colors.border.secondary}`,borderRadius:2,"data-testid":"popover-text"},a)))};a.displayName="LivenessIconWithPopover";export{a as LivenessIconWithPopover};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import e from"react";import{LivenessClassNames as t}from"../types/classNames.mjs";const a=({percentage:a,initialPercentage:c=25,testId:s})=>{const[r,n]=e.useState(c);e.useEffect((()=>{n(a<0?0:a>100?100:a)}),[a]);const i={"--percentage":`${r}%`};return e.createElement("div",{className:t.MatchIndicator,"data-testid":s},e.createElement("div",{className:`${t.MatchIndicator}__bar`,style:i}),e.createElement("div",{className:`${t.MatchIndicator}__pin`,style:i}))};export{a as MatchIndicator};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{__rest as t}from"../../../node_modules/tslib/tslib.es6.mjs";import*as i from"react";import{Flex as e}from"@aws-amplify/ui-react";const r=r=>{var{children:o,anchorOrigin:n={horizontal:"center",vertical:"center"}}=r,a=t(r,["children","anchorOrigin"]);return i.createElement(e,Object.assign({direction:"column",position:"absolute",left:"0",top:"0",alignItems:n.horizontal,justifyContent:n.vertical,width:"100%",height:"100%",padding:"xl"},a),o)};export{r as Overlay};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import e from"react";import{Flex as t,Icon as r,Text as c}from"@aws-amplify/ui-react";import{LivenessClassNames as i}from"../types/classNames.mjs";const a=({children:a})=>e.createElement(t,{className:i.RecordingIcon},e.createElement(t,{"data-testid":"rec-icon",justifyContent:"center"},e.createElement(r,{viewBox:{width:20,height:20},width:"20",height:"20"},e.createElement("circle",{cx:"10",cy:"10",r:"8",fill:"red"}))),e.createElement(c,{as:"span",fontWeight:"bold"},a));export{a as RecordingIcon};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{__rest as e}from"../../../node_modules/tslib/tslib.es6.mjs";import t from"react";import{Flex as a,View as r}from"@aws-amplify/ui-react";import{LivenessClassNames as i}from"../types/classNames.mjs";const l=l=>{var{children:n,caption:m,variation:s="default"}=l,c=e(l,["children","caption","variation"]);return t.createElement(a,Object.assign({as:"figure",className:`${i.Figure} ${i.Figure}--${s}`},c),t.createElement(r,{className:`${i.FigureImage} ${i.FigureImage}--${s}`},"success"===s?t.createElement("svg",{className:i.FigureIcon,"aria-hidden":"true",width:"24",height:"24"},t.createElement("g",{fill:"none"},t.createElement("path",{fill:"#365E3D",d:"M0 0h24v24H0z"}),t.createElement("path",{fill:"#FFF",d:"m9.435 15.62-4.054-4.055L4 12.936l5.435 5.435L21.101 6.704l-1.37-1.371z"}))):null,"error"===s?t.createElement("svg",{className:i.FigureIcon,"aria-hidden":"true",width:"24",height:"24"},t.createElement("g",{fill:"none"},t.createElement("path",{fill:"#600",d:"M0 0h24v24H0z"}),t.createElement("path",{fill:"#FFF",d:"M19 6.41 17.59 5 12 10.59 6.41 5 5 6.41 10.59 12 5 17.59 6.41 19 12 13.41 17.59 19 19 17.59 13.41 12z"}))):null,n),t.createElement(r,{as:"figcaption",className:`${i.FigureCaption} ${i.FigureCaption}--${s}`},m))};export{l as StartScreenFigure};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{__rest as e}from"../../../node_modules/tslib/tslib.es6.mjs";import*as a from"react";import{View as t,Flex as s}from"@aws-amplify/ui-react";import{LivenessClassNames as m}from"../types/classNames.mjs";const i=i=>{var{variation:r="default",size:o="medium",children:l}=i,n=e(i,["variation","size","children"]);return a.createElement(t,Object.assign({padding:"small",borderRadius:"medium",className:`${m.Toast} ${m.Toast}--${r} ${m.Toast}--${o}`,maxWidth:{base:"100%",small:"70%"}},n),a.createElement(s,{gap:"xs",direction:"column",alignItems:"center"},a.createElement(s,{className:`${m.Toast}__message`,textAlign:"center",direction:"column"},l)))};export{i as Toast};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import e from"react";const l=({title:l,testId:t})=>e.createElement("svg",{width:"150",height:"150","data-testid":t},e.createElement("title",null,l),e.createElement("defs",null,e.createElement("linearGradient",{id:"a",x1:"50%",x2:"50%",y1:"0%",y2:"100%"},e.createElement("stop",{offset:"0%",stopColor:"#C2C2C2"}),e.createElement("stop",{offset:"100%",stopColor:"#C2C2C2",stopOpacity:"0"}))),e.createElement("g",{fill:"none",fillRule:"evenodd",transform:"translate(2)"},e.createElement("path",{fill:"#FFF",fillRule:"nonzero",d:"M3.997 0h136v150h-136z"}),e.createElement("path",{fill:"url(#a)",fillRule:"nonzero",d:"M4.333 0h138v150h-138z"}),e.createElement("path",{fill:"#5B361E",fillRule:"nonzero",stroke:"#000",strokeWidth:"1.353",d:"m22.515 58.137-1.895 82.434 98.784-2.343c0-8.798.813-16.271.813-31.497 0-15.748-2.345-55.36-3.766-64.125C108.16 11.338 74.737 5.03 56.707 11.04c-28.425 9.475-33.64 35.095-34.192 47.097Z"}),e.createElement("path",{fill:"#EF992A",fillRule:"nonzero",d:"M38.104 138.228c8.339-3.98 5.1-1.525 15.916-3.104H90.5c5.448 0 9.541 3.104 28.904 3.104 6.391 0 5.987 8.988-2.473 8.988-24.315 1.08-66.07 1.08-78.281 0-77.975-6.896-10.97-4.014-.546-8.988Z"}),e.createElement("path",{fill:"#FCDDCC",fillRule:"nonzero",stroke:"#000",strokeWidth:"1.353",d:"m54.306 134.26 2.645-21.765h30.498l3.05 21.765c-15.778 14.791-30.703 6.163-36.193 0zm-27.59-54.458C25.42 66.68 33.467 67.18 37.653 69.07l2.837 25.314c-10.328-2.228-13.772-12.961-13.772-14.58zm89.512-.81c4.05-15.067-3.984-15.998-8.506-14.58L105.9 91.75c10.328-8.505 9.113-12.758 10.328-12.758z"}),e.createElement("path",{fill:"#FCDDCC",fillRule:"nonzero",stroke:"#000",strokeWidth:"1.353",d:"M53.564 109.804c-14.195-8.986-16.116-30.658-15.302-40.37 2.24-5.21 4.37-5.723 7.958-11.909 6.3-10.86 9.028-25.451 10.579-25.009 14.241 16.008 50.215 20.259 50.649 31.708v13.023c0 4.178-.911 14.358-4.558 21.65-8.986 13.674-20.131 18.612-24.58 19.372-2.334.922-10.55.521-24.746-8.465Z"}),e.createElement("path",{fill:"#000",fillRule:"nonzero",d:"m83.935 98.402.85 1.052c-7.974 6.435-17.2 5.243-23.018.18l-.23-.204.905-1.004c5.273 4.756 13.744 5.998 21.175.227l.318-.251Z"}),e.createElement("ellipse",{cx:"56.448",cy:"72.613",fill:"#000",fillRule:"nonzero",rx:"3.128",ry:"4.294"}),e.createElement("path",{fill:"#000",fillRule:"nonzero",d:"M50.664 61.476c2.917-1.694 7.404-2.147 11.244-.172l.31.165-.655 1.183c-3.348-1.854-7.361-1.545-9.985-.137l-.234.13-.68-1.17Z"}),e.createElement("ellipse",{cx:"89.709",cy:"72.613",fill:"#000",fillRule:"nonzero",rx:"3.128",ry:"4.294"}),e.createElement("path",{fill:"#000",fillRule:"nonzero",d:"M83.926 61.476c2.917-1.694 7.404-2.147 11.244-.172l.31.165-.655 1.183c-3.348-1.854-7.361-1.545-9.985-.137l-.234.13-.68-1.17Z"}),e.createElement("path",{stroke:"#000",strokeWidth:"1.353",d:"M69.005 82.806c0 1.858.859 5.487 4.287 5.144"}),e.createElement("path",{fill:"#FFF",d:"M73.004 0H0v150h146V0H73.004Zm.496 0C98.629 0 119 33.579 119 75s-20.371 75-45.5 75S28 116.421 28 75 48.371 0 73.5 0Z"}),e.createElement("path",{stroke:"#AEB3B7",strokeWidth:"2",d:"M118.4 75c0 20.555-5.156 39.117-13.441 52.507C96.665 140.913 85.338 149 72.999 149c-12.34 0-23.667-8.087-31.961-21.493C32.753 114.117 27.597 95.555 27.597 75c0-20.555 5.156-39.117 13.44-52.507C49.333 9.087 60.66 1 72.999 1c12.34 0 23.667 8.087 31.961 21.493C113.244 35.883 118.4 54.445 118.4 75Z"})));export{l as TooFarIllustration};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
var e;!function(e){e.CameraModule="amplify-liveness-camera-module",e.CancelContainer="amplify-liveness-cancel-container",e.CancelButton="amplify-liveness-cancel-button",e.CountdownContainer="amplify-liveness-countdown-container",e.DescriptionBullet="amplify-liveness-description-bullet",e.DescriptionBulletIndex="amplify-liveness-description-bullet__index",e.DescriptionBulletIndexText="amplify-liveness-description-bullet__index__text",e.DescriptionBulletMessage="amplify-liveness-description-bullet__message",e.FadeOut="amplify-liveness-fade-out",e.FreshnessCanvas="amplify-liveness-freshness-canvas",e.InstructionList="amplify-liveness-instruction-list",e.InstructionOverlay="amplify-liveness-instruction-overlay",e.Figure="amplify-liveness-figure",e.FigureCaption="amplify-liveness-figure__caption",e.FigureIcon="amplify-liveness-figure__icon",e.FigureImage="amplify-liveness-figure__image",e.Figures="amplify-liveness-figures",e.Loader="amplify-liveness-loader",e.MatchIndicator="amplify-liveness-match-indicator",e.OvalCanvas="amplify-liveness-oval-canvas",e.RecordingIconContainer="amplify-liveness-recording-icon-container",e.RecordingIcon="amplify-liveness-recording-icon",e.Toast="amplify-liveness-toast",e.Video="amplify-liveness-video",e.VideoAnchor="amplify-liveness-video-anchor"}(e||(e={}));export{e as LivenessClassNames};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
function n(){return/Android|iPhone|iPad/i.test(navigator.userAgent)||/Macintosh/i.test(navigator.userAgent)&&!!navigator.maxTouchPoints&&navigator.maxTouchPoints>1}function t(){return window.matchMedia("(orientation: landscape)")}export{t as getLandscapeMediaQuery,n as isMobileScreen};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{defaultLivenessDisplayText as e}from"../displayText.mjs";function t(t){const i=Object.assign(Object.assign({},e),t),{instructionsHeaderHeadingText:n,instructionsHeaderBodyText:a,instructionsBeginCheckText:o,photosensitivyWarningHeadingText:s,photosensitivyWarningBodyText:T,photosensitivyWarningInfoText:r,instructionListHeadingText:x,goodFitCaptionText:c,goodFitAltText:d,tooFarCaptionText:g,tooFarAltText:h,instructionListStepOneText:l,instructionListStepTwoText:u,instructionListStepThreeText:p,instructionListStepFourText:F,cameraMinSpecificationsHeadingText:m,cameraMinSpecificationsMessageText:H,cameraNotFoundHeadingText:y,cameraNotFoundMessageText:M,retryCameraPermissionsText:C,cancelLivenessCheckText:f,recordingIndicatorText:v,hintMoveFaceFrontOfCameraText:D,hintTooManyFacesText:I,hintFaceDetectedText:L,hintCanNotIdentifyText:S,hintTooCloseText:B,hintTooFarText:N,hintHoldFacePositionCountdownText:k,hintConnectingText:A,hintVerifyingText:O,hintIlluminationTooBrightText:W,hintIlluminationTooDarkText:w,hintIlluminationNormalText:P,hintHoldFaceForFreshnessText:j,timeoutHeaderText:b,timeoutMessageText:V,faceDistanceHeaderText:q,faceDistanceMessageText:z,clientHeaderText:E,clientMessageText:G,serverHeaderText:J,serverMessageText:K,landscapeHeaderText:Q,landscapeMessageText:R,portraitMessageText:U,tryAgainText:X}=i;return{hintDisplayText:{hintMoveFaceFrontOfCameraText:D,hintTooManyFacesText:I,hintFaceDetectedText:L,hintCanNotIdentifyText:S,hintTooCloseText:B,hintTooFarText:N,hintHoldFacePositionCountdownText:k,hintConnectingText:A,hintVerifyingText:O,hintIlluminationTooBrightText:W,hintIlluminationTooDarkText:w,hintIlluminationNormalText:P,hintHoldFaceForFreshnessText:j},cameraDisplayText:{cameraMinSpecificationsHeadingText:m,cameraMinSpecificationsMessageText:H,cameraNotFoundHeadingText:y,cameraNotFoundMessageText:M,retryCameraPermissionsText:C},instructionDisplayText:{instructionsHeaderHeadingText:n,instructionsHeaderBodyText:a,instructionsBeginCheckText:o,photosensitivyWarningHeadingText:s,photosensitivyWarningBodyText:T,photosensitivyWarningInfoText:r,instructionListHeadingText:x,goodFitCaptionText:c,goodFitAltText:d,tooFarCaptionText:g,tooFarAltText:h,instructionListStepOneText:l,instructionListStepTwoText:u,instructionListStepThreeText:p,instructionListStepFourText:F},streamDisplayText:{cancelLivenessCheckText:f,recordingIndicatorText:v},errorDisplayText:{timeoutHeaderText:b,timeoutMessageText:V,faceDistanceHeaderText:q,faceDistanceMessageText:z,clientHeaderText:E,clientMessageText:G,serverHeaderText:J,serverMessageText:K,landscapeHeaderText:Q,landscapeMessageText:R,portraitMessageText:U,tryAgainText:X}}}export{t as getDisplayText};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export{default as FaceLivenessDetector}from"./components/FaceLivenessDetector/FaceLivenessDetector.mjs";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
function n(n,t){var e={};for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&t.indexOf(r)<0&&(e[r]=n[r]);if(null!=n&&"function"==typeof Object.getOwnPropertySymbols){var o=0;for(r=Object.getOwnPropertySymbols(n);o<r.length;o++)t.indexOf(r[o])<0&&Object.prototype.propertyIsEnumerable.call(n,r[o])&&(e[r[o]]=n[r[o]])}return e}function t(n,t,e,r){return new(e||(e=Promise))((function(o,i){function c(n){try{f(r.next(n))}catch(n){i(n)}}function u(n){try{f(r.throw(n))}catch(n){i(n)}}function f(n){var t;n.done?o(n.value):(t=n.value,t instanceof e?t:new e((function(n){n(t)}))).then(c,u)}f((r=r.apply(n,t||[])).next())}))}function e(n){var t="function"==typeof Symbol&&Symbol.iterator,e=t&&n[t],r=0;if(e)return e.call(n);if(n&&"number"==typeof n.length)return{next:function(){return n&&r>=n.length&&(n=void 0),{value:n&&n[r++],done:!n}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")}function r(n){return this instanceof r?(this.v=n,this):new r(n)}function o(n,t,e){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var o,i=e.apply(n,t||[]),c=[];return o={},u("next"),u("throw"),u("return"),o[Symbol.asyncIterator]=function(){return this},o;function u(n){i[n]&&(o[n]=function(t){return new Promise((function(e,r){c.push([n,t,e,r])>1||f(n,t)}))})}function f(n,t){try{(e=i[n](t)).value instanceof r?Promise.resolve(e.value.v).then(a,l):y(c[0][2],e)}catch(n){y(c[0][3],n)}var e}function a(n){f("next",n)}function l(n){f("throw",n)}function y(n,t){n(t),c.shift(),c.length&&f(c[0][0],c[0][1])}}function i(n){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var t,r=n[Symbol.asyncIterator];return r?r.call(n):(n=e(n),t={},o("next"),o("throw"),o("return"),t[Symbol.asyncIterator]=function(){return this},t);function o(e){t[e]=n[e]&&function(t){return new Promise((function(r,o){(function(n,t,e,r){Promise.resolve(r).then((function(t){n({value:t,done:e})}),t)})(r,o,(t=n[e](t)).done,t.value)}))}}}export{o as __asyncGenerator,i as __asyncValues,r as __await,t as __awaiter,n as __rest,e as __values};
|