@authme/util 2.2.0 → 2.2.1-rc.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (66) hide show
  1. package/index.cjs +1717 -0
  2. package/index.js +1678 -0
  3. package/package.json +7 -6
  4. package/src/index.d.ts +3 -2
  5. package/src/lib/authme-error.d.ts +29 -0
  6. package/src/lib/authme-log.d.ts +1 -0
  7. package/src/lib/common/index.d.ts +7 -7
  8. package/src/lib/enum/index.d.ts +1 -0
  9. package/src/lib/enum/timeUnit.enum.d.ts +5 -0
  10. package/src/lib/shared-util.d.ts +5 -2
  11. package/src/lib/storage/index.d.ts +1 -1
  12. package/src/lib/storage/storage.d.ts +11 -11
  13. package/src/lib/version.d.ts +1 -0
  14. package/src/ui/camera.d.ts +35 -30
  15. package/src/ui/canvas/clear-canvas.d.ts +1 -1
  16. package/src/ui/canvas/get-canvas-size.d.ts +19 -19
  17. package/src/ui/canvas/index.d.ts +3 -3
  18. package/src/ui/canvas/video-to-image.d.ts +14 -14
  19. package/src/ui/element-style.d.ts +2 -2
  20. package/src/ui/error-message.d.ts +5 -5
  21. package/src/ui/icon.d.ts +3 -3
  22. package/src/ui/index.d.ts +8 -8
  23. package/src/ui/popup.d.ts +3 -3
  24. package/src/ui/sdk-loading.d.ts +2 -2
  25. package/src/ui/spinner.d.ts +2 -2
  26. package/src/ui/ui-lottie/index.d.ts +1 -1
  27. package/src/ui/ui-lottie/sdk_loading.d.ts +239 -239
  28. package/CHANGELOG.md +0 -376
  29. package/src/index.js +0 -6
  30. package/src/index.js.map +0 -1
  31. package/src/lib/common/index.js +0 -93
  32. package/src/lib/common/index.js.map +0 -1
  33. package/src/lib/shared-util.js +0 -6
  34. package/src/lib/shared-util.js.map +0 -1
  35. package/src/lib/storage/index.js +0 -5
  36. package/src/lib/storage/index.js.map +0 -1
  37. package/src/lib/storage/storage.js +0 -26
  38. package/src/lib/storage/storage.js.map +0 -1
  39. package/src/ui/camera.js +0 -143
  40. package/src/ui/camera.js.map +0 -1
  41. package/src/ui/canvas/clear-canvas.js +0 -9
  42. package/src/ui/canvas/clear-canvas.js.map +0 -1
  43. package/src/ui/canvas/get-canvas-size.js +0 -85
  44. package/src/ui/canvas/get-canvas-size.js.map +0 -1
  45. package/src/ui/canvas/index.js +0 -7
  46. package/src/ui/canvas/index.js.map +0 -1
  47. package/src/ui/canvas/video-to-image.js +0 -27
  48. package/src/ui/canvas/video-to-image.js.map +0 -1
  49. package/src/ui/element-style.js +0 -14
  50. package/src/ui/element-style.js.map +0 -1
  51. package/src/ui/error-message.js +0 -80
  52. package/src/ui/error-message.js.map +0 -1
  53. package/src/ui/icon.js +0 -8
  54. package/src/ui/icon.js.map +0 -1
  55. package/src/ui/index.js +0 -12
  56. package/src/ui/index.js.map +0 -1
  57. package/src/ui/popup.js +0 -58
  58. package/src/ui/popup.js.map +0 -1
  59. package/src/ui/sdk-loading.js +0 -33
  60. package/src/ui/sdk-loading.js.map +0 -1
  61. package/src/ui/spinner.js +0 -28
  62. package/src/ui/spinner.js.map +0 -1
  63. package/src/ui/ui-lottie/index.js +0 -5
  64. package/src/ui/ui-lottie/index.js.map +0 -1
  65. package/src/ui/ui-lottie/sdk_loading.js +0 -971
  66. package/src/ui/ui-lottie/sdk_loading.js.map +0 -1
package/index.cjs ADDED
@@ -0,0 +1,1717 @@
1
+ 'use strict';
2
+
3
+ Object.defineProperty(exports, '__esModule', { value: true });
4
+
5
+ require('core-js/modules/es.array.iterator.js');
6
+ require('core-js/modules/es.array-buffer.slice.js');
7
+ require('core-js/modules/es.typed-array.uint8-array.js');
8
+ require('core-js/modules/es.typed-array.fill.js');
9
+ require('core-js/modules/es.typed-array.set.js');
10
+ require('core-js/modules/es.typed-array.sort.js');
11
+ require('core-js/modules/es.typed-array.to-locale-string.js');
12
+ require('core-js/modules/es.promise.js');
13
+ require('core-js/modules/es.regexp.exec.js');
14
+ require('core-js/modules/web.dom-collections.iterator.js');
15
+ require('core-js/modules/web.url-search-params.js');
16
+ require('core-js/modules/es.string.search.js');
17
+ require('core-js/modules/es.string.match.js');
18
+ require('core-js/modules/es.array.sort.js');
19
+ require('core-js/modules/es.array.includes.js');
20
+ require('core-js/modules/es.string.includes.js');
21
+ var lottie = require('lottie-web');
22
+ require('core-js/modules/es.symbol.description.js');
23
+
24
+ function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
25
+
26
+ var lottie__default = /*#__PURE__*/_interopDefaultLegacy(lottie);
27
+
28
+ const GLOBAL_KEY = '_AuthmeConfig';
29
+ function getItem(key) {
30
+ return window[GLOBAL_KEY][key];
31
+ }
32
+ function setItem(key, val) {
33
+ if (!window[GLOBAL_KEY]) {
34
+ window[GLOBAL_KEY] = {};
35
+ }
36
+ return window[GLOBAL_KEY][key] = val;
37
+ }
38
+ function removeItem(key) {
39
+ return delete window[GLOBAL_KEY][key];
40
+ }
41
+ function clear() {
42
+ window[GLOBAL_KEY] = {};
43
+ }
44
+ const Storage = {
45
+ getItem,
46
+ setItem,
47
+ removeItem,
48
+ clear
49
+ };
50
+
51
+ /******************************************************************************
52
+ Copyright (c) Microsoft Corporation.
53
+
54
+ Permission to use, copy, modify, and/or distribute this software for any
55
+ purpose with or without fee is hereby granted.
56
+
57
+ THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
58
+ REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
59
+ AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
60
+ INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
61
+ LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
62
+ OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
63
+ PERFORMANCE OF THIS SOFTWARE.
64
+ ***************************************************************************** */
65
+
66
+ function __awaiter(thisArg, _arguments, P, generator) {
67
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
68
+ return new (P || (P = Promise))(function (resolve, reject) {
69
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
70
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
71
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
72
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
73
+ });
74
+ }
75
+
76
+ function __values(o) {
77
+ var s = typeof Symbol === "function" && Symbol.iterator, m = s && o[s], i = 0;
78
+ if (m) return m.call(o);
79
+ if (o && typeof o.length === "number") return {
80
+ next: function () {
81
+ if (o && i >= o.length) o = void 0;
82
+ return { value: o && o[i++], done: !o };
83
+ }
84
+ };
85
+ throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined.");
86
+ }
87
+
88
+ function __await(v) {
89
+ return this instanceof __await ? (this.v = v, this) : new __await(v);
90
+ }
91
+
92
+ function __asyncGenerator(thisArg, _arguments, generator) {
93
+ if (!Symbol.asyncIterator) throw new TypeError("Symbol.asyncIterator is not defined.");
94
+ var g = generator.apply(thisArg, _arguments || []), i, q = [];
95
+ return i = {}, verb("next"), verb("throw"), verb("return"), i[Symbol.asyncIterator] = function () { return this; }, i;
96
+ function verb(n) { if (g[n]) i[n] = function (v) { return new Promise(function (a, b) { q.push([n, v, a, b]) > 1 || resume(n, v); }); }; }
97
+ function resume(n, v) { try { step(g[n](v)); } catch (e) { settle(q[0][3], e); } }
98
+ function step(r) { r.value instanceof __await ? Promise.resolve(r.value.v).then(fulfill, reject) : settle(q[0][2], r); }
99
+ function fulfill(value) { resume("next", value); }
100
+ function reject(value) { resume("throw", value); }
101
+ function settle(f, v) { if (f(v), q.shift(), q.length) resume(q[0][0], q[0][1]); }
102
+ }
103
+
104
+ function __asyncValues(o) {
105
+ if (!Symbol.asyncIterator) throw new TypeError("Symbol.asyncIterator is not defined.");
106
+ var m = o[Symbol.asyncIterator], i;
107
+ return m ? m.call(o) : (o = typeof __values === "function" ? __values(o) : o[Symbol.iterator](), i = {}, verb("next"), verb("throw"), verb("return"), i[Symbol.asyncIterator] = function () { return this; }, i);
108
+ function verb(n) { i[n] = o[n] && function (v) { return new Promise(function (resolve, reject) { v = o[n](v), settle(resolve, reject, v.done, v.value); }); }; }
109
+ function settle(resolve, reject, d, v) { Promise.resolve(v).then(function(v) { resolve({ value: v, done: d }); }, reject); }
110
+ }
111
+
112
+ function dataURItoBlob(dataURI) {
113
+ // convert base64/URLEncoded data component to raw binary data held in a string
114
+ const byteString = atob(dataURI.split(',')[1]);
115
+ // separate out the mime component
116
+ const mimeString = dataURI.split(',')[0].split(':')[1].split(';')[0];
117
+ // write the bytes of the string to a typed array
118
+ const ia = new Uint8Array(byteString.length);
119
+ for (let i = 0; i < byteString.length; i++) {
120
+ ia[i] = byteString.charCodeAt(i);
121
+ }
122
+ const blob = new Blob([ia], {
123
+ type: mimeString
124
+ });
125
+ return blob;
126
+ }
127
+ function UintArrayToBlob(width, height, data, canvasEle, imageFormat) {
128
+ if (document) {
129
+ if (!canvasEle) {
130
+ canvasEle = document.createElement('canvas');
131
+ }
132
+ const ctx = canvasEle.getContext('2d');
133
+ canvasEle.height = height;
134
+ canvasEle.width = width;
135
+ if (ctx) {
136
+ const imageData = ctx.createImageData(canvasEle.width, canvasEle.height);
137
+ imageData.data.set(data);
138
+ ctx.putImageData(imageData, 0, 0);
139
+ if (imageFormat === 'png') {
140
+ return dataURItoBlob(canvasEle.toDataURL('image/png'));
141
+ } else {
142
+ return dataURItoBlob(canvasEle.toDataURL('image/jpeg', 0.85));
143
+ }
144
+ }
145
+ throw '[UintArrayToBlob] not running in browser.';
146
+ } else {
147
+ throw '[UintArrayToBlob] not running in browser.';
148
+ }
149
+ }
150
+ function waitTime(ms) {
151
+ return new Promise(res => {
152
+ setTimeout(() => {
153
+ res();
154
+ }, ms);
155
+ });
156
+ }
157
+ function retryPromiseWithCondition(promiseFactory, conditionFactory) {
158
+ return __awaiter(this, void 0, void 0, function* () {
159
+ try {
160
+ const res = yield promiseFactory();
161
+ return res;
162
+ } catch (e) {
163
+ console.error(e);
164
+ const retry = yield conditionFactory(e);
165
+ if (retry) {
166
+ return retryPromiseWithCondition(promiseFactory, conditionFactory);
167
+ } else {
168
+ throw e;
169
+ }
170
+ }
171
+ });
172
+ }
173
+ function getUserAgent() {
174
+ return `platform: ${navigator === null || navigator === void 0 ? void 0 : navigator.platform}`;
175
+ }
176
+ function isMobileOrTablet() {
177
+ return function (a) {
178
+ return !!(/(android|bb\d+|meego).+mobile|avantgo|bada\/|blackberry|blazer|compal|elaine|fennec|hiptop|iemobile|ip(hone|od)|iris|kindle|lge |maemo|midp|mmp|mobile.+firefox|netfront|opera m(ob|in)i|palm( os)?|phone|p(ixi|re)\/|plucker|pocket|psp|series(4|6)0|symbian|treo|up\.(browser|link)|vodafone|wap|windows ce|xda|xiino/i.test(a) || /1207|6310|6590|3gso|4thp|50[1-6]i|770s|802s|a wa|abac|ac(er|oo|s-)|ai(ko|rn)|al(av|ca|co)|amoi|an(ex|ny|yw)|aptu|ar(ch|go)|as(te|us)|attw|au(di|-m|r |s )|avan|be(ck|ll|nq)|bi(lb|rd)|bl(ac|az)|br(e|v)w|bumb|bw-(n|u)|c55\/|capi|ccwa|cdm-|cell|chtm|cldc|cmd-|co(mp|nd)|craw|da(it|ll|ng)|dbte|dc-s|devi|dica|dmob|do(c|p)o|ds(12|-d)|el(49|ai)|em(l2|ul)|er(ic|k0)|esl8|ez([4-7]0|os|wa|ze)|fetc|fly(-|_)|g1 u|g560|gene|gf-5|g-mo|go(\.w|od)|gr(ad|un)|haie|hcit|hd-(m|p|t)|hei-|hi(pt|ta)|hp( i|ip)|hs-c|ht(c(-| |_|a|g|p|s|t)|tp)|hu(aw|tc)|i-(20|go|ma)|i230|iac( |-|\/)|ibro|idea|ig01|ikom|im1k|inno|ipaq|iris|ja(t|v)a|jbro|jemu|jigs|kddi|keji|kgt( |\/)|klon|kpt |kwc-|kyo(c|k)|le(no|xi)|lg( g|\/(k|l|u)|50|54|-[a-w])|libw|lynx|m1-w|m3ga|m50\/|ma(te|ui|xo)|mc(01|21|ca)|m-cr|me(rc|ri)|mi(o8|oa|ts)|mmef|mo(01|02|bi|de|do|t(-| |o|v)|zz)|mt(50|p1|v )|mwbp|mywa|n10[0-2]|n20[2-3]|n30(0|2)|n50(0|2|5)|n7(0(0|1)|10)|ne((c|m)-|on|tf|wf|wg|wt)|nok(6|i)|nzph|o2im|op(ti|wv)|oran|owg1|p800|pan(a|d|t)|pdxg|pg(13|-([1-8]|c))|phil|pire|pl(ay|uc)|pn-2|po(ck|rt|se)|prox|psio|pt-g|qa-a|qc(07|12|21|32|60|-[2-7]|i-)|qtek|r380|r600|raks|rim9|ro(ve|zo)|s55\/|sa(ge|ma|mm|ms|ny|va)|sc(01|h-|oo|p-)|sdk\/|se(c(-|0|1)|47|mc|nd|ri)|sgh-|shar|sie(-|m)|sk-0|sl(45|id)|sm(al|ar|b3|it|t5)|so(ft|ny)|sp(01|h-|v-|v )|sy(01|mb)|t2(18|50)|t6(00|10|18)|ta(gt|lk)|tcl-|tdg-|tel(i|m)|tim-|t-mo|to(pl|sh)|ts(70|m-|m3|m5)|tx-9|up(\.b|g1|si)|utst|v400|v750|veri|vi(rg|te)|vk(40|5[0-3]|-v)|vm40|voda|vulc|vx(52|53|60|61|70|80|81|83|85|98)|w3c(-| )|webc|whit|wi(g |nc|nw)|wmlb|wonu|x700|yas-|your|zeto|zte-/i.test(a.substr(0, 4)) || /Android|webOS|iPhone|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent) || navigator.maxTouchPoints && navigator.maxTouchPoints > 2);
179
+ }(navigator.userAgent || navigator.vendor || window.opera);
180
+ }
181
+ function isMobile() {
182
+ return function (a) {
183
+ return !!(/(android|bb\d+|meego).+mobile|avantgo|bada\/|blackberry|blazer|compal|elaine|fennec|hiptop|iemobile|ip(hone|od)|iris|kindle|lge |maemo|midp|mmp|mobile.+firefox|netfront|opera m(ob|in)i|palm( os)?|phone|p(ixi|re)\/|plucker|pocket|psp|series(4|6)0|symbian|treo|up\.(browser|link)|vodafone|wap|windows ce|xda|xiino/i.test(a) || /1207|6310|6590|3gso|4thp|50[1-6]i|770s|802s|a wa|abac|ac(er|oo|s-)|ai(ko|rn)|al(av|ca|co)|amoi|an(ex|ny|yw)|aptu|ar(ch|go)|as(te|us)|attw|au(di|-m|r |s )|avan|be(ck|ll|nq)|bi(lb|rd)|bl(ac|az)|br(e|v)w|bumb|bw-(n|u)|c55\/|capi|ccwa|cdm-|cell|chtm|cldc|cmd-|co(mp|nd)|craw|da(it|ll|ng)|dbte|dc-s|devi|dica|dmob|do(c|p)o|ds(12|-d)|el(49|ai)|em(l2|ul)|er(ic|k0)|esl8|ez([4-7]0|os|wa|ze)|fetc|fly(-|_)|g1 u|g560|gene|gf-5|g-mo|go(\.w|od)|gr(ad|un)|haie|hcit|hd-(m|p|t)|hei-|hi(pt|ta)|hp( i|ip)|hs-c|ht(c(-| |_|a|g|p|s|t)|tp)|hu(aw|tc)|i-(20|go|ma)|i230|iac( |-|\/)|ibro|idea|ig01|ikom|im1k|inno|ipaq|iris|ja(t|v)a|jbro|jemu|jigs|kddi|keji|kgt( |\/)|klon|kpt |kwc-|kyo(c|k)|le(no|xi)|lg( g|\/(k|l|u)|50|54|-[a-w])|libw|lynx|m1-w|m3ga|m50\/|ma(te|ui|xo)|mc(01|21|ca)|m-cr|me(rc|ri)|mi(o8|oa|ts)|mmef|mo(01|02|bi|de|do|t(-| |o|v)|zz)|mt(50|p1|v )|mwbp|mywa|n10[0-2]|n20[2-3]|n30(0|2)|n50(0|2|5)|n7(0(0|1)|10)|ne((c|m)-|on|tf|wf|wg|wt)|nok(6|i)|nzph|o2im|op(ti|wv)|oran|owg1|p800|pan(a|d|t)|pdxg|pg(13|-([1-8]|c))|phil|pire|pl(ay|uc)|pn-2|po(ck|rt|se)|prox|psio|pt-g|qa-a|qc(07|12|21|32|60|-[2-7]|i-)|qtek|r380|r600|raks|rim9|ro(ve|zo)|s55\/|sa(ge|ma|mm|ms|ny|va)|sc(01|h-|oo|p-)|sdk\/|se(c(-|0|1)|47|mc|nd|ri)|sgh-|shar|sie(-|m)|sk-0|sl(45|id)|sm(al|ar|b3|it|t5)|so(ft|ny)|sp(01|h-|v-|v )|sy(01|mb)|t2(18|50)|t6(00|10|18)|ta(gt|lk)|tcl-|tdg-|tel(i|m)|tim-|t-mo|to(pl|sh)|ts(70|m-|m3|m5)|tx-9|up(\.b|g1|si)|utst|v400|v750|veri|vi(rg|te)|vk(40|5[0-3]|-v)|vm40|voda|vulc|vx(52|53|60|61|70|80|81|83|85|98)|w3c(-| )|webc|whit|wi(g |nc|nw)|wmlb|wonu|x700|yas-|your|zeto|zte-/i.test(a.substr(0, 4)) || /Android|webOS|iPhone|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent));
184
+ }(navigator.userAgent || navigator.vendor || window.opera);
185
+ }
186
+
187
+ class AuthmeError {
188
+ constructor(code, cause = null) {
189
+ this._cause = null;
190
+ this._code = null;
191
+ this._code = code;
192
+ this._cause = cause;
193
+ }
194
+ get message() {
195
+ return '[Authme SDK Error] Code: ' + this.code;
196
+ }
197
+ setCode(code) {
198
+ this._code = code;
199
+ }
200
+ get code() {
201
+ return this._code;
202
+ }
203
+ get cause() {
204
+ return this._cause;
205
+ }
206
+ }
207
+ exports.ErrorCode = void 0;
208
+ (function (ErrorCode) {
209
+ // 1XX for engine
210
+ ErrorCode[ErrorCode["BROWSER_NOT_SUPPORT"] = 100] = "BROWSER_NOT_SUPPORT";
211
+ ErrorCode[ErrorCode["ENGINE_INIT_ERROR"] = 101] = "ENGINE_INIT_ERROR";
212
+ ErrorCode[ErrorCode["ENGINE_MODULE_IS_INITIALIZING"] = 102] = "ENGINE_MODULE_IS_INITIALIZING";
213
+ ErrorCode[ErrorCode["ENGINE_MODULE_INIT_ERROR"] = 103] = "ENGINE_MODULE_INIT_ERROR";
214
+ ErrorCode[ErrorCode["RECOGNITION_NOT_AVAILABLE"] = 104] = "RECOGNITION_NOT_AVAILABLE";
215
+ ErrorCode[ErrorCode["RECOGNITION_ERROR"] = 105] = "RECOGNITION_ERROR";
216
+ ErrorCode[ErrorCode["INVALID_AUTH_ERROR"] = 106] = "INVALID_AUTH_ERROR";
217
+ ErrorCode[ErrorCode["SCREEN_RESOLUTION_TOO_LOW"] = 107] = "SCREEN_RESOLUTION_TOO_LOW";
218
+ ErrorCode[ErrorCode["SCREEN_SIZE_CHANGED"] = 108] = "SCREEN_SIZE_CHANGED";
219
+ // 2 for LIVENESS
220
+ ErrorCode[ErrorCode["LIVENESS_NOT_PASSED"] = 201] = "LIVENESS_NOT_PASSED";
221
+ // 3 for ID-Recognition
222
+ ErrorCode[ErrorCode["ID_RECOGNITION_CONFIRM_INFO_ERROR"] = 301] = "ID_RECOGNITION_CONFIRM_INFO_ERROR";
223
+ ErrorCode[ErrorCode["ID_RECOGNITION_TIMEOUT"] = 302] = "ID_RECOGNITION_TIMEOUT";
224
+ // 4 for Anti-fraud
225
+ ErrorCode[ErrorCode["ID_RECOGNITION_ANTI_FRAUD_NOT_PASSED"] = 401] = "ID_RECOGNITION_ANTI_FRAUD_NOT_PASSED";
226
+ // 9 for common
227
+ ErrorCode[ErrorCode["SDK_INTERNAL_ERROR"] = 900] = "SDK_INTERNAL_ERROR";
228
+ ErrorCode[ErrorCode["NETWORK_ERROR"] = 901] = "NETWORK_ERROR";
229
+ ErrorCode[ErrorCode["HTTP_ERROR_RESPONSE"] = 902] = "HTTP_ERROR_RESPONSE";
230
+ ErrorCode[ErrorCode["USER_CANCEL"] = 903] = "USER_CANCEL";
231
+ ErrorCode[ErrorCode["CAMERA_NOT_SUPPORT"] = 904] = "CAMERA_NOT_SUPPORT";
232
+ })(exports.ErrorCode || (exports.ErrorCode = {}));
233
+
234
+ function debugLog(message, ...others) {
235
+ if (new URLSearchParams(location.search).get('authme-debug') === 'true') {
236
+ console.log(message, ...others);
237
+ }
238
+ }
239
+
240
+ exports.TIME_UNIT = void 0;
241
+ (function (TIME_UNIT) {
242
+ TIME_UNIT[TIME_UNIT["SECOND"] = 1000] = "SECOND";
243
+ TIME_UNIT[TIME_UNIT["MINUTE"] = 60000] = "MINUTE";
244
+ TIME_UNIT[TIME_UNIT["HOUR"] = 3600000] = "HOUR";
245
+ })(exports.TIME_UNIT || (exports.TIME_UNIT = {}));
246
+
247
+ function getImageData(canvas, ctx, video, sizeInfo, base64 = false, imageType = 'jpg') {
248
+ canvas.width = sizeInfo.canvasWidth;
249
+ canvas.height = sizeInfo.canvasHeight;
250
+ ctx.drawImage(video, sizeInfo.startX, sizeInfo.startY, sizeInfo.width, sizeInfo.height, 0, 0, sizeInfo.canvasWidth, sizeInfo.canvasHeight);
251
+ return {
252
+ data: ctx.getImageData(0, 0, sizeInfo.canvasWidth, sizeInfo.canvasHeight).data,
253
+ base64: base64 ? {
254
+ jpg: imageType === 'jpg' || imageType === 'all' ? canvas.toDataURL('image/jpeg', 0.85) : '',
255
+ png: imageType === 'png' || imageType === 'all' ? canvas.toDataURL('image/png') : ''
256
+ } : {
257
+ jpg: '',
258
+ png: ''
259
+ }
260
+ };
261
+ }
262
+
263
+ function clearCanvas(canvas) {
264
+ const ctx = canvas.getContext('2d');
265
+ ctx.clearRect(0, 0, canvas.width, canvas.height);
266
+ }
267
+
268
+ function resize(originWidth, originHeight, targetWidth, targetHeight) {
269
+ const originRatio = originWidth / originHeight;
270
+ const targetRatio = targetWidth / targetHeight;
271
+ if (originRatio > targetRatio) {
272
+ return {
273
+ width: originHeight * targetRatio,
274
+ height: originHeight,
275
+ startX: (originWidth - originHeight * targetRatio) / 2,
276
+ startY: 0
277
+ };
278
+ } else {
279
+ return {
280
+ width: originWidth,
281
+ height: originWidth * targetRatio,
282
+ startX: 0,
283
+ startY: (originHeight - originWidth * targetRatio) / 2
284
+ };
285
+ }
286
+ }
287
+ function getCanvasSize(video) {
288
+ return __awaiter(this, void 0, void 0, function* () {
289
+ let videoWidth = video.videoWidth;
290
+ let videoHeight = video.videoHeight;
291
+ while (video.videoWidth === 0 || video.videoHeight === 0) {
292
+ yield waitTime(200);
293
+ videoWidth = video.videoWidth;
294
+ videoHeight = video.videoHeight;
295
+ }
296
+ const result = {
297
+ height: 0,
298
+ width: 0,
299
+ startX: 0,
300
+ startY: 0,
301
+ canvasWidth: 0,
302
+ canvasHeight: 0
303
+ };
304
+ const windowWidth = window.innerWidth;
305
+ const windowHeight = window.innerHeight;
306
+ const videoRatio = videoWidth / videoHeight;
307
+ const windowRatio = windowWidth / windowHeight;
308
+ if (videoRatio > windowRatio) {
309
+ result.height = videoHeight;
310
+ result.width = Math.floor(videoHeight * windowRatio);
311
+ result.startX = Math.floor((videoWidth - result.width) / 2);
312
+ result.startY = 0;
313
+ } else {
314
+ result.width = videoWidth;
315
+ result.height = Math.floor(videoWidth / windowRatio);
316
+ result.startX = 0;
317
+ result.startY = Math.floor((videoHeight - result.height) / 2);
318
+ }
319
+ const maxHeight = videoHeight > videoWidth ? 1280 : 720;
320
+ const maxWidth = videoHeight > videoWidth ? 720 : 1280;
321
+ const resizeRatioH = maxHeight / Math.max(result.height, maxHeight);
322
+ const resizeRatioW = maxWidth / Math.max(result.width, maxWidth);
323
+ const resizeRatio = Math.max(resizeRatioH, resizeRatioW);
324
+ // const resizeRatio = 1;
325
+ result.canvasWidth = Math.floor(result.width * resizeRatio);
326
+ result.canvasHeight = Math.floor(result.height * resizeRatio);
327
+ return result;
328
+ });
329
+ }
330
+ function cropByRatio(width, height, ratio) {
331
+ let expectedHeight = height;
332
+ let expectedWidth = Math.floor(height * ratio);
333
+ if (expectedWidth > width) {
334
+ expectedWidth = width;
335
+ expectedHeight = Math.floor(width / ratio);
336
+ }
337
+ return {
338
+ width: expectedWidth,
339
+ height: expectedHeight
340
+ };
341
+ }
342
+
343
+ function startSpinner(text) {
344
+ const body = document.querySelector('.authme-container');
345
+ const spinnerOuter = document.createElement('div');
346
+ spinnerOuter.className = 'loading-outer';
347
+ const spinner = document.createElement('div');
348
+ spinner.className = 'loading';
349
+ const spinnerText = document.createElement('div');
350
+ spinnerOuter.appendChild(spinner);
351
+ if (text) {
352
+ spinnerText.className = 'loading-text';
353
+ spinnerText.textContent = text;
354
+ spinnerOuter.appendChild(spinnerText);
355
+ }
356
+ body === null || body === void 0 ? void 0 : body.appendChild(spinnerOuter);
357
+ }
358
+ function stopSpinner() {
359
+ const body = document.querySelector('.authme-container');
360
+ const spinner = document.querySelector('.loading-outer');
361
+ if (spinner) {
362
+ body === null || body === void 0 ? void 0 : body.removeChild(spinner);
363
+ }
364
+ }
365
+
366
+ exports.Icon = void 0;
367
+ (function (Icon) {
368
+ Icon["CloseIcon"] = "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACgAAAAoCAYAAACM/rhtAAAACXBIWXMAAAsTAAALEwEAmpwYAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAALdSURBVHgBzZm/bhpBEMY/TINEgxuUEjoKpNDhzrhLid8geQDkuAopUM6ioYstXoA2lUmXVJy7hMoukOhyaWlCCqS4y3znPXJcuD97rOF+0rCnu13p0+zO7O6QQ0ra7XZLmobYqWpLyshSzFH2IGaPx2MbKcjpdBZRFHAh9tYnJimOmC12JWKdpIMSCVTCPihhJhghodB8XAcRR4+NxVowB5dEu1ar/Z7P5/dRHSMFiriP0lhiBZiHs0KRJRH5NaxTLkQYB9/CrNeioBfPZMqXwQ9HIQNs7E8c4ZTfbvvw3xSraW1j/1S2TfeGQBH3WpoBDseJCpxv3ov1GhRxFWkmYhUcFq7Dqrce/WvQwuHFES/nurgeVN77gWxxTC96HrSQPdxdyxN4Cg3K5TL6/b7bmuwbgDsY8upUorXHdrtd1Ot1NJtNTKdTrFYrRImrVquuTSYTaFCQiL6jB1vQZDgcYrFYRHrH/419OSYFjbyopPdqOqPoMXqOHqSAoCeD4nq9ntum4JEC38nDC2gSJrJYLJoSRwo5WYO/oH/4XBP0lvfOgDjippnU4ohfCIUZFEdKR8g4FLjEDgSnOC66NVnuJHBbtPqn24BIh1F8Bs00EyaObVwK0uQ7BTLFvNIZFZfnDIr8xCm+1x3V6XRiozUY3RyTAjsvp1dH7SaJb26z2czdWweDQWQq8TzJvtzqND3oyHHr0jsPWvAdEjPCSAS+8fLgNbLHFX9cger8f4PsMPLKIsE7yU5J2xAOlPfI+topwfJHguURminnGbj0l+o27sW8j4rIY3k8wWG4EXEb9/Kw2gzP5i3slwcR1wi+DDvNnCNFAt8BGyEOiSxgiieZfi7wvHBaQy9tkfVBWZNfZE3+xL8atEmYMd6LOCuqU2yFlRVQEflZHhk8DZiBOfc8SWFdt4hewVO+5EW/Aj28zeB6W6EyDC2BftSFn/YST2Jp/r8haAy0O7Zp/4b4C0A7bruoqtIMAAAAAElFTkSuQmCC";
369
+ })(exports.Icon || (exports.Icon = {}));
370
+
371
+ function showErrorMessage(text, showRetryBtn, callback) {
372
+ return __awaiter(this, void 0, void 0, function* () {
373
+ const target = document.querySelector('.authme-container');
374
+ if (!target) {
375
+ return;
376
+ }
377
+ const errorMessagePanel = document.createElement('div');
378
+ errorMessagePanel.className = 'error-message-panel';
379
+ const icon = document.createElement('img');
380
+ icon.className = 'error-icon';
381
+ icon.src = 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABgAAAAYCAYAAADgdz34AAAACXBIWXMAAAsTAAALEwEAmpwYAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAAIoSURBVHgBrZY9TxRBGMdn5XwpOCRyJlZoI8HTShNfGkqNEs8GrO4z2HqFwQr9DpYWaGKuUKOJL5XxMxATTSBCAwcFHITjLcPvYf9HNhd2doF7kt/uZud5mdmZ+c9GLsW89xG3q/AURqAMJbD3DfgDX+EbTEdR5F1eI/kw1KHpY2vBAszCfz3vqM183sGVvMnHYUnBczAJt2EACnAaLsE9mJCPV9FqVvIabAkLLuboUFGdWFNcLc2xKodFGNUc5B11BE8UaznGOh0uq9F6UXHHNHVsE5bhWrL6e33HybSe875HEz8F51z6SF4qV30/F5cbWglzoW9OWz/MiP6AXx/MK+fQKd49gF54w1puuhMaOVa5vVXOcSvwEHbhh+uefYRNGLECw7AMM6579g9sJGUrcBFaKtItW4ENKFmB/BqS36I2BS5LYMvuvAuPYh1+wxk9h2xAORu2rL5LzO5kBLX3QuYOl06ZGP60T/QLzkIlI8iW3Wf4xPOFjBr3oQe+WOBQYqP1BQrc0g7dhpsBv+RGu97e3nUFTwSkoheewYuAj+V6rVxTB34mTD4+A0wJR90xTYq6prNhsLNxTEpoqlrxR5frxwm5rqY5PpfDOrwKzUkipigF3VIHa1kBVQ3Ra+JtXu76+JgsiJIta3ViXr4N33nQBIoM+vggbx/6OypqB/6snltqa2qRlA/LFQWKWJsFmZw/crEomm6ZtNhvy7SL99AH+Jv227IHljuhn5g7LqwAAAAASUVORK5CYII=';
382
+ const errorText = document.createElement('div');
383
+ errorText.className = 'error-text';
384
+ errorText.textContent = text;
385
+ errorMessagePanel.appendChild(icon);
386
+ errorMessagePanel.appendChild(errorText);
387
+ if (showRetryBtn) {
388
+ const retryText = document.createElement('div');
389
+ retryText.className = 'retry-text';
390
+ retryText.textContent = '重試';
391
+ errorMessagePanel.appendChild(retryText);
392
+ if (callback) {
393
+ retryText.addEventListener('click', e => {
394
+ target.removeChild(errorMessagePanel);
395
+ callback(e);
396
+ });
397
+ }
398
+ }
399
+ target === null || target === void 0 ? void 0 : target.appendChild(errorMessagePanel);
400
+ });
401
+ }
402
+ function hideErrorMessage() {
403
+ const body = document.querySelector('.authme-container');
404
+ const errorMessagePanel = document.querySelector('.error-message-panel');
405
+ if (body && errorMessagePanel) {
406
+ body === null || body === void 0 ? void 0 : body.removeChild(errorMessagePanel);
407
+ }
408
+ }
409
+ function asyncShowErrorMessage(text, showRetryBtn) {
410
+ return __awaiter(this, void 0, void 0, function* () {
411
+ return new Promise((res, rej) => {
412
+ const callback = () => {
413
+ res(true);
414
+ hideErrorMessage();
415
+ };
416
+ showErrorMessage(text, showRetryBtn, callback);
417
+ });
418
+ });
419
+ }
420
+ function asyncOnLineShowErrorMessage(text, showRetryBtn) {
421
+ return __awaiter(this, void 0, void 0, function* () {
422
+ return new Promise((res, rej) => {
423
+ const callback = () => {
424
+ if (window.navigator.onLine) {
425
+ res(true);
426
+ hideErrorMessage();
427
+ }
428
+ };
429
+ showErrorMessage(text, showRetryBtn, callback);
430
+ });
431
+ });
432
+ }
433
+ function checkOnlineStatus(msg) {
434
+ return __awaiter(this, void 0, void 0, function* () {
435
+ if (!window.navigator.onLine) {
436
+ yield asyncOnLineShowErrorMessage(msg, true);
437
+ }
438
+ });
439
+ }
440
+
441
+ function showPopup(title, content, showButton = true, button, callback) {
442
+ return __awaiter(this, void 0, void 0, function* () {
443
+ const target = document.querySelector('.authme-container');
444
+ const popupBackground = document.createElement('div');
445
+ popupBackground.className = 'popup-background';
446
+ const popupPanel = document.createElement('div');
447
+ popupPanel.className = 'popup-panel';
448
+ const popupTitle = document.createElement('div');
449
+ popupTitle.className = 'popup-title';
450
+ popupTitle.textContent = title;
451
+ const popupContent = document.createElement('div');
452
+ popupContent.className = 'popup-content';
453
+ popupContent.textContent = content;
454
+ const popupConfirmBtn = document.createElement('button');
455
+ popupConfirmBtn.className = 'popup-btn';
456
+ popupConfirmBtn.textContent = '確定';
457
+ popupPanel.appendChild(popupTitle);
458
+ popupPanel.appendChild(popupContent);
459
+ if (showButton) {
460
+ popupPanel.appendChild(popupConfirmBtn);
461
+ }
462
+ if (callback && showButton) {
463
+ popupConfirmBtn.addEventListener('click', callback);
464
+ }
465
+ target === null || target === void 0 ? void 0 : target.appendChild(popupPanel);
466
+ target === null || target === void 0 ? void 0 : target.appendChild(popupBackground);
467
+ });
468
+ }
469
+ function hidePopup() {
470
+ const popupPanel = document.querySelector('.popup-panel');
471
+ if (popupPanel) {
472
+ popupPanel.remove();
473
+ }
474
+ const popupBackground = document.querySelector('.popup-background');
475
+ if (popupBackground) {
476
+ popupBackground.remove();
477
+ }
478
+ }
479
+ function asyncShowPopup(title, content, showButton = true, button) {
480
+ return __awaiter(this, void 0, void 0, function* () {
481
+ return new Promise((res, rej) => {
482
+ const callback = () => {
483
+ res(true);
484
+ hidePopup();
485
+ };
486
+ showPopup(title, content, showButton, button, callback);
487
+ });
488
+ });
489
+ }
490
+
491
+ const videoConstraintsFactory = (isPC, facingMode) => {
492
+ return isPC ? {
493
+ video: {
494
+ width: {
495
+ min: 1280,
496
+ ideal: 1920,
497
+ max: 1920
498
+ },
499
+ height: {
500
+ min: 720,
501
+ ideal: 1080,
502
+ max: 1080
503
+ },
504
+ facingMode
505
+ }
506
+ } : {
507
+ video: {
508
+ width: {
509
+ ideal: 1920
510
+ },
511
+ height: {
512
+ ideal: 1080
513
+ },
514
+ facingMode
515
+ }
516
+ };
517
+ };
518
+ function inferFacingModeFromLabel(label) {
519
+ const pattern = /rear|back|rück|arrière|trasera|trás|traseira|posteriore|后|後|背|задней|الخلفية|후|arka|achterzijde|หลัง|baksidan|bagside|sau|bak|tylny|takakamera|belakang|אחורית|πίσω|spate|hátsó|zadní|darrere|zadná|задня|stražnja|belakang|बैक/i;
520
+ if (pattern.test(label !== null && label !== void 0 ? label : '')) {
521
+ return 'back';
522
+ } else {
523
+ return undefined;
524
+ }
525
+ }
526
+ function inferFacingModeFromCapabilities(capabilities) {
527
+ var _a, _b, _c, _d;
528
+ if (((_b = (_a = capabilities === null || capabilities === void 0 ? void 0 : capabilities.facingMode) === null || _a === void 0 ? void 0 : _a.indexOf('user')) !== null && _b !== void 0 ? _b : -1) >= 0) {
529
+ return 'front';
530
+ } else if (((_d = (_c = capabilities === null || capabilities === void 0 ? void 0 : capabilities.facingMode) === null || _c === void 0 ? void 0 : _c.indexOf('environment')) !== null && _d !== void 0 ? _d : -1) >= 0) {
531
+ return 'back';
532
+ } else {
533
+ return undefined;
534
+ }
535
+ }
536
+ function inferFacingModeFromMixedInfo(fromLabel, fromCapabilities) {
537
+ var _a;
538
+ return (_a = fromLabel !== null && fromLabel !== void 0 ? fromLabel : fromCapabilities) !== null && _a !== void 0 ? _a : 'front';
539
+ }
540
+ function asyncMap(mapping, items) {
541
+ return __asyncGenerator(this, arguments, function* asyncMap_1() {
542
+ for (const item of items) {
543
+ yield yield __await(yield __await(mapping(item)));
544
+ }
545
+ });
546
+ }
547
+ function arrayFromAsync(asyncIterable) {
548
+ var asyncIterable_1, asyncIterable_1_1;
549
+ var e_1, _a;
550
+ return __awaiter(this, void 0, void 0, function* () {
551
+ const result = [];
552
+ try {
553
+ for (asyncIterable_1 = __asyncValues(asyncIterable); asyncIterable_1_1 = yield asyncIterable_1.next(), !asyncIterable_1_1.done;) {
554
+ const item = asyncIterable_1_1.value;
555
+ result.push(item);
556
+ }
557
+ } catch (e_1_1) {
558
+ e_1 = {
559
+ error: e_1_1
560
+ };
561
+ } finally {
562
+ try {
563
+ if (asyncIterable_1_1 && !asyncIterable_1_1.done && (_a = asyncIterable_1.return)) yield _a.call(asyncIterable_1);
564
+ } finally {
565
+ if (e_1) throw e_1.error;
566
+ }
567
+ }
568
+ return result;
569
+ });
570
+ }
571
+ function _requestCamera(video, facingMode) {
572
+ var _a;
573
+ return __awaiter(this, void 0, void 0, function* () {
574
+ if (!('mediaDevices' in navigator)) {
575
+ throw 'NOT_SUPPORT';
576
+ }
577
+ let isSamsung = false;
578
+ if (navigator.userAgent.match(/SAMSUNG|Samsung|SGH-[I|N|T]|GT-[I|N]|SM-[A|G|N|P|T|Z|S]|SHV-E|SCH-[I|J|R|S]|SPH-L/i)) {
579
+ isSamsung = true;
580
+ }
581
+ // 必須先請求攝影機權限,才能透過 enumerateDevices 取得攝影機 Label 資訊
582
+ const media = yield navigator.mediaDevices.getUserMedia({
583
+ video: true
584
+ });
585
+ media.getTracks().forEach(function (track) {
586
+ track.stop(); // 取得後會啟用攝影機,所以要關閉
587
+ });
588
+ // 輪詢取得攝影機 解析度等資訊
589
+ const videoDevices = (yield navigator.mediaDevices.enumerateDevices()).filter(device => device.kind === 'videoinput');
590
+ const deviceMetas = yield arrayFromAsync(asyncMap(device => __awaiter(this, void 0, void 0, function* () {
591
+ var _b, _c, _d, _e;
592
+ const stream = yield navigator.mediaDevices.getUserMedia({
593
+ video: {
594
+ deviceId: {
595
+ exact: device.deviceId
596
+ }
597
+ }
598
+ });
599
+ const track = (_b = stream.getVideoTracks()) === null || _b === void 0 ? void 0 : _b[0];
600
+ const capabilities = ((_c = track === null || track === void 0 ? void 0 : track.getCapabilities) !== null && _c !== void 0 ? _c : () => undefined).bind(track)(); // firefox 沒有 getCapabilities 可以用。
601
+ const widthMax = (_d = capabilities === null || capabilities === void 0 ? void 0 : capabilities.width) === null || _d === void 0 ? void 0 : _d.max;
602
+ const heightMax = (_e = capabilities === null || capabilities === void 0 ? void 0 : capabilities.height) === null || _e === void 0 ? void 0 : _e.max;
603
+ const resolution = widthMax && heightMax ? widthMax * heightMax : 0;
604
+ const facingModeFromLabel = inferFacingModeFromLabel(device === null || device === void 0 ? void 0 : device.label);
605
+ const facingModeFromapabilities = inferFacingModeFromCapabilities(capabilities);
606
+ const facingMode = inferFacingModeFromMixedInfo(facingModeFromLabel, facingModeFromapabilities);
607
+ const meta = {
608
+ resolution,
609
+ facingMode,
610
+ facingModeFromLabel,
611
+ facingModeFromapabilities,
612
+ capabilities
613
+ };
614
+ track === null || track === void 0 ? void 0 : track.stop();
615
+ return {
616
+ device,
617
+ meta,
618
+ capabilities
619
+ };
620
+ }), videoDevices));
621
+ const firstDevice = (_a = deviceMetas.sort((a, b) => {
622
+ // 若是 Samsung 手機且模式為後鏡頭,則優先使用Label為 camera2 0 的鏡頭
623
+ let samsungCondition = 0;
624
+ if (isSamsung && facingMode === 'back') {
625
+ const samsungCamera = 'camera2 0';
626
+ const bScore = b.device.label.includes(samsungCamera) ? 1 : 0; // 特定鏡頭優先
627
+ const aScore = a.device.label.includes(samsungCamera) ? 1 : 0;
628
+ samsungCondition = bScore - aScore;
629
+ }
630
+ let cameraFacingCondition = 0;
631
+ {
632
+ const aFacingMode = a.meta.facingMode;
633
+ const bFacingMode = b.meta.facingMode;
634
+ const bScore = bFacingMode === facingMode ? 1 : 0; // 鏡頭符合 faceMode 優先。
635
+ const aScore = aFacingMode === facingMode ? 1 : 0;
636
+ cameraFacingCondition = bScore - aScore;
637
+ }
638
+ const resolutionCondition = b.meta.resolution - a.meta.resolution;
639
+ return samsungCondition || cameraFacingCondition || resolutionCondition;
640
+ })) === null || _a === void 0 ? void 0 : _a[0];
641
+ const deviceId = firstDevice.device.deviceId;
642
+ if (!deviceId) {
643
+ throw 'NO_CAMERA';
644
+ }
645
+ const constraints = {
646
+ video: {
647
+ // 推測依然需要使用 width & height 的限制條件,
648
+ // 否則即使是高解析度相機,也有可能拿到低解析度的圖片。(待驗證)
649
+ width: {
650
+ min: 1280,
651
+ ideal: 1920,
652
+ max: 1920
653
+ },
654
+ height: {
655
+ min: 720,
656
+ ideal: 1080,
657
+ max: 1080
658
+ },
659
+ focusMode: 'auto',
660
+ deviceId: {
661
+ exact: deviceId
662
+ }
663
+ }
664
+ };
665
+ debugLog('camera info', {
666
+ firstDevice,
667
+ deviceMetas
668
+ });
669
+ const stream = yield navigator.mediaDevices.getUserMedia(constraints);
670
+ video.srcObject = stream;
671
+ yield video.play();
672
+ // Note: Fix Safari 15 video not showing bug
673
+ video.srcObject = null;
674
+ setTimeout(() => {
675
+ video.srcObject = stream;
676
+ }, 10);
677
+ return firstDevice.meta.facingMode;
678
+ });
679
+ }
680
+ function isOverconstrainedError(error) {
681
+ if (error === null || typeof error === 'undefined') {
682
+ return false;
683
+ }
684
+ if (typeof error !== 'object') {
685
+ return false;
686
+ }
687
+ return 'constraint' in error;
688
+ }
689
+ function requestCamera({
690
+ video,
691
+ facingMode,
692
+ translate,
693
+ showMessage
694
+ }) {
695
+ return __awaiter(this, void 0, void 0, function* () {
696
+ try {
697
+ return yield _requestCamera(video, facingMode);
698
+ } catch (error) {
699
+ if (error === 'NOT_SUPPORT') {
700
+ showMessage(translate('camera.error.notFound'));
701
+ throw new AuthmeError(exports.ErrorCode.CAMERA_NOT_SUPPORT, 'Browser not support WebRTC, or https required.');
702
+ }
703
+ if (error === 'NO_CAMERA') {
704
+ showMessage(translate('camera.error.notFound'));
705
+ throw new AuthmeError(exports.ErrorCode.CAMERA_NOT_SUPPORT, 'camera not found');
706
+ }
707
+ if ((error === null || error === void 0 ? void 0 : error.name) === 'NotAllowedError') {
708
+ showMessage(translate('camera.error.notFound'));
709
+ throw new AuthmeError(exports.ErrorCode.CAMERA_NOT_SUPPORT, error);
710
+ }
711
+ if (isOverconstrainedError(error)) {
712
+ showMessage(translate('camera.error.lowResolution'));
713
+ throw new AuthmeError(exports.ErrorCode.CAMERA_NOT_SUPPORT, error);
714
+ }
715
+ throw error;
716
+ }
717
+ });
718
+ }
719
+
720
+ function showElement(element) {
721
+ element.classList.remove('hide');
722
+ element.classList.add('show');
723
+ }
724
+ function hideElement(element) {
725
+ element.classList.remove('show');
726
+ element.classList.add('hide');
727
+ }
728
+
729
+ const sdk_loading = () => ({
730
+ nm: 'Waiting',
731
+ mn: '',
732
+ layers: [{
733
+ ty: 4,
734
+ nm: '3',
735
+ mn: '',
736
+ sr: 1,
737
+ st: 38,
738
+ op: 938,
739
+ ip: -20,
740
+ hd: false,
741
+ cl: '',
742
+ ln: '',
743
+ ddd: 0,
744
+ bm: 0,
745
+ tt: 0,
746
+ hasMask: false,
747
+ td: 0,
748
+ ao: 0,
749
+ ks: {
750
+ a: {
751
+ a: 0,
752
+ k: [113, -41.653, 0],
753
+ ix: 1
754
+ },
755
+ s: {
756
+ a: 0,
757
+ k: [100, 100, 100],
758
+ ix: 6
759
+ },
760
+ sk: {
761
+ a: 0,
762
+ k: 0
763
+ },
764
+ p: {
765
+ a: 1,
766
+ k: [{
767
+ o: {
768
+ x: 0.167,
769
+ y: 0
770
+ },
771
+ i: {
772
+ x: 0.29,
773
+ y: 1
774
+ },
775
+ s: [250, 100.847, 0],
776
+ t: 20.251
777
+ }, {
778
+ o: {
779
+ x: 0.167,
780
+ y: 0
781
+ },
782
+ i: {
783
+ x: 0.29,
784
+ y: 1
785
+ },
786
+ s: [250, 53.847, 0],
787
+ t: 29.715
788
+ }, {
789
+ o: {
790
+ x: 0.167,
791
+ y: 0
792
+ },
793
+ i: {
794
+ x: 0.29,
795
+ y: 1
796
+ },
797
+ s: [250, 66.885, 0],
798
+ t: 41.702
799
+ }, {
800
+ o: {
801
+ x: 0.167,
802
+ y: 0.167
803
+ },
804
+ i: {
805
+ x: 0.833,
806
+ y: 0.833
807
+ },
808
+ s: [250, 100.847, 0],
809
+ t: 46.75
810
+ }],
811
+ ix: 2
812
+ },
813
+ sa: {
814
+ a: 0,
815
+ k: 0
816
+ },
817
+ o: {
818
+ a: 0,
819
+ k: 100,
820
+ ix: 11
821
+ },
822
+ r: {
823
+ a: 0,
824
+ k: 0,
825
+ ix: 10
826
+ }
827
+ },
828
+ ef: [],
829
+ shapes: [{
830
+ ty: 'gr',
831
+ bm: 0,
832
+ cl: '',
833
+ ln: '',
834
+ hd: false,
835
+ mn: 'ADBE Vector Group',
836
+ nm: 'Group 1',
837
+ ix: 1,
838
+ cix: 2,
839
+ np: 3,
840
+ it: [{
841
+ ty: 'sh',
842
+ bm: 0,
843
+ cl: '',
844
+ ln: '',
845
+ hd: false,
846
+ mn: 'ADBE Vector Shape - Group',
847
+ nm: 'Path 1',
848
+ ix: 1,
849
+ d: 1,
850
+ ks: {
851
+ a: 1,
852
+ k: [{
853
+ o: {
854
+ x: 0.167,
855
+ y: 0
856
+ },
857
+ i: {
858
+ x: 0.29,
859
+ y: 1
860
+ },
861
+ s: [{
862
+ c: true,
863
+ i: [[0.018, 0], [0, -0.018], [-0.018, 0], [0, 0.018]],
864
+ o: [[-0.018, 0], [0, 0.018], [0.018, 0], [0, -0.018]],
865
+ v: [[114.22, -40.406], [114.188, -40.373], [114.22, -40.34], [114.253, -40.373]]
866
+ }],
867
+ t: 27.2
868
+ }, {
869
+ o: {
870
+ x: 0.167,
871
+ y: 0
872
+ },
873
+ i: {
874
+ x: 0.29,
875
+ y: 1
876
+ },
877
+ s: [{
878
+ c: true,
879
+ i: [[12.339, 0], [0, -12.338], [-12.339, 0], [0, 12.339]],
880
+ o: [[-12.339, 0], [0, 12.339], [12.339, 0], [0, -12.338]],
881
+ v: [[113, -64.029], [90.623, -41.653], [113, -19.276], [135.377, -41.653]]
882
+ }],
883
+ t: 34
884
+ }, {
885
+ o: {
886
+ x: 0.167,
887
+ y: 0
888
+ },
889
+ i: {
890
+ x: 0.29,
891
+ y: 1
892
+ },
893
+ s: [{
894
+ c: true,
895
+ i: [[12.339, 0], [0, -12.338], [-12.339, 0], [0, 12.339]],
896
+ o: [[-12.339, 0], [0, 12.339], [12.339, 0], [0, -12.338]],
897
+ v: [[113, -64.029], [90.623, -41.653], [113, -19.276], [135.377, -41.653]]
898
+ }],
899
+ t: 46.75
900
+ }, {
901
+ o: {
902
+ x: 0.167,
903
+ y: 0.167
904
+ },
905
+ i: {
906
+ x: 0.833,
907
+ y: 0.833
908
+ },
909
+ s: [{
910
+ c: true,
911
+ i: [[0.018, 0], [0, -0.018], [-0.018, 0], [0, 0.018]],
912
+ o: [[-0.018, 0], [0, 0.018], [0.018, 0], [0, -0.018]],
913
+ v: [[114.22, -40.406], [114.188, -40.373], [114.22, -40.34], [114.253, -40.373]]
914
+ }],
915
+ t: 59.5
916
+ }],
917
+ ix: 2
918
+ }
919
+ }, {
920
+ ty: 'sh',
921
+ bm: 0,
922
+ cl: '',
923
+ ln: '',
924
+ hd: false,
925
+ mn: 'ADBE Vector Shape - Group',
926
+ nm: 'Path 2',
927
+ ix: 2,
928
+ d: 1,
929
+ ks: {
930
+ a: 0,
931
+ k: {
932
+ c: true,
933
+ i: [[18.404, 0], [0, 18.404], [-18.404, 0], [0, -18.404]],
934
+ o: [[-18.404, 0], [0, -18.404], [18.404, 0], [0, 18.404]],
935
+ v: [[113, -8.276], [79.623, -41.653], [113, -75.029], [146.377, -41.653]]
936
+ },
937
+ ix: 2
938
+ }
939
+ }, {
940
+ ty: 'fl',
941
+ bm: 0,
942
+ cl: '',
943
+ ln: '',
944
+ hd: false,
945
+ mn: 'ADBE Vector Graphic - Fill',
946
+ nm: 'Fill 1',
947
+ c: {
948
+ a: 0,
949
+ k: [0, 0.7569, 0.7137],
950
+ ix: 4
951
+ },
952
+ r: 1,
953
+ o: {
954
+ a: 0,
955
+ k: 100,
956
+ ix: 5
957
+ }
958
+ }, {
959
+ ty: 'tr',
960
+ a: {
961
+ a: 0,
962
+ k: [0, 0],
963
+ ix: 1
964
+ },
965
+ s: {
966
+ a: 0,
967
+ k: [100, 100],
968
+ ix: 3
969
+ },
970
+ sk: {
971
+ a: 0,
972
+ k: 0,
973
+ ix: 4
974
+ },
975
+ p: {
976
+ a: 0,
977
+ k: [0, 0],
978
+ ix: 2
979
+ },
980
+ r: {
981
+ a: 0,
982
+ k: 0,
983
+ ix: 6
984
+ },
985
+ sa: {
986
+ a: 0,
987
+ k: 0,
988
+ ix: 5
989
+ },
990
+ o: {
991
+ a: 0,
992
+ k: 100,
993
+ ix: 7
994
+ }
995
+ }]
996
+ }],
997
+ ind: 0
998
+ }, {
999
+ ty: 4,
1000
+ nm: '2',
1001
+ mn: '',
1002
+ sr: 1,
1003
+ st: 19,
1004
+ op: 919,
1005
+ ip: -9,
1006
+ hd: false,
1007
+ cl: '',
1008
+ ln: '',
1009
+ ddd: 0,
1010
+ bm: 0,
1011
+ tt: 0,
1012
+ hasMask: false,
1013
+ td: 0,
1014
+ ao: 0,
1015
+ ks: {
1016
+ a: {
1017
+ a: 0,
1018
+ k: [113, -41.653, 0],
1019
+ ix: 1
1020
+ },
1021
+ s: {
1022
+ a: 0,
1023
+ k: [100, 100, 100],
1024
+ ix: 6
1025
+ },
1026
+ sk: {
1027
+ a: 0,
1028
+ k: 0
1029
+ },
1030
+ p: {
1031
+ a: 1,
1032
+ k: [{
1033
+ o: {
1034
+ x: 0.167,
1035
+ y: 0
1036
+ },
1037
+ i: {
1038
+ x: 0.29,
1039
+ y: 1
1040
+ },
1041
+ s: [150, 100.847, 0],
1042
+ t: 10.673
1043
+ }, {
1044
+ o: {
1045
+ x: 0.167,
1046
+ y: 0
1047
+ },
1048
+ i: {
1049
+ x: 0.29,
1050
+ y: 1
1051
+ },
1052
+ s: [150, 53.847, 0],
1053
+ t: 20.137
1054
+ }, {
1055
+ o: {
1056
+ x: 0.167,
1057
+ y: 0
1058
+ },
1059
+ i: {
1060
+ x: 0.29,
1061
+ y: 1
1062
+ },
1063
+ s: [150, 66.885, 0],
1064
+ t: 32.125
1065
+ }, {
1066
+ o: {
1067
+ x: 0.167,
1068
+ y: 0.167
1069
+ },
1070
+ i: {
1071
+ x: 0.833,
1072
+ y: 0.833
1073
+ },
1074
+ s: [150, 100.847, 0],
1075
+ t: 37.1728515625
1076
+ }],
1077
+ ix: 2
1078
+ },
1079
+ sa: {
1080
+ a: 0,
1081
+ k: 0
1082
+ },
1083
+ o: {
1084
+ a: 0,
1085
+ k: 100,
1086
+ ix: 11
1087
+ },
1088
+ r: {
1089
+ a: 0,
1090
+ k: 0,
1091
+ ix: 10
1092
+ }
1093
+ },
1094
+ ef: [],
1095
+ shapes: [{
1096
+ ty: 'gr',
1097
+ bm: 0,
1098
+ cl: '',
1099
+ ln: '',
1100
+ hd: false,
1101
+ mn: 'ADBE Vector Group',
1102
+ nm: 'Group 1',
1103
+ ix: 1,
1104
+ cix: 2,
1105
+ np: 3,
1106
+ it: [{
1107
+ ty: 'sh',
1108
+ bm: 0,
1109
+ cl: '',
1110
+ ln: '',
1111
+ hd: false,
1112
+ mn: 'ADBE Vector Shape - Group',
1113
+ nm: 'Path 1',
1114
+ ix: 1,
1115
+ d: 1,
1116
+ ks: {
1117
+ a: 1,
1118
+ k: [{
1119
+ o: {
1120
+ x: 0.167,
1121
+ y: 0
1122
+ },
1123
+ i: {
1124
+ x: 0.29,
1125
+ y: 1
1126
+ },
1127
+ s: [{
1128
+ c: true,
1129
+ i: [[0.018, 0], [0, -0.018], [-0.018, 0], [0, 0.018]],
1130
+ o: [[-0.018, 0], [0, 0.018], [0.018, 0], [0, -0.018]],
1131
+ v: [[114.22, -40.406], [114.188, -40.373], [114.22, -40.34], [114.253, -40.373]]
1132
+ }],
1133
+ t: 17.85
1134
+ }, {
1135
+ o: {
1136
+ x: 0.167,
1137
+ y: 0
1138
+ },
1139
+ i: {
1140
+ x: 0.29,
1141
+ y: 1
1142
+ },
1143
+ s: [{
1144
+ c: true,
1145
+ i: [[12.339, 0], [0, -12.338], [-12.339, 0], [0, 12.339]],
1146
+ o: [[-12.339, 0], [0, 12.339], [12.339, 0], [0, -12.338]],
1147
+ v: [[113, -64.029], [90.623, -41.653], [113, -19.276], [135.377, -41.653]]
1148
+ }],
1149
+ t: 25.5
1150
+ }, {
1151
+ o: {
1152
+ x: 0.167,
1153
+ y: 0
1154
+ },
1155
+ i: {
1156
+ x: 0.29,
1157
+ y: 1
1158
+ },
1159
+ s: [{
1160
+ c: true,
1161
+ i: [[12.339, 0], [0, -12.338], [-12.339, 0], [0, 12.339]],
1162
+ o: [[-12.339, 0], [0, 12.339], [12.339, 0], [0, -12.338]],
1163
+ v: [[113, -64.029], [90.623, -41.653], [113, -19.276], [135.377, -41.653]]
1164
+ }],
1165
+ t: 28.949
1166
+ }, {
1167
+ o: {
1168
+ x: 0.167,
1169
+ y: 0
1170
+ },
1171
+ i: {
1172
+ x: 0.29,
1173
+ y: 1
1174
+ },
1175
+ s: [{
1176
+ c: true,
1177
+ i: [[0.018, 0], [0, -0.018], [-0.018, 0], [0, 0.018]],
1178
+ o: [[-0.018, 0], [0, 0.018], [0.018, 0], [0, -0.018]],
1179
+ v: [[111.72, -40.406], [111.688, -40.373], [111.72, -40.34], [111.753, -40.373]]
1180
+ }],
1181
+ t: 35.005
1182
+ }, {
1183
+ o: {
1184
+ x: 0.167,
1185
+ y: 0
1186
+ },
1187
+ i: {
1188
+ x: 0.29,
1189
+ y: 1
1190
+ },
1191
+ s: [{
1192
+ c: true,
1193
+ i: [[0.018, 0], [0, -0.018], [-0.018, 0], [0, 0.018]],
1194
+ o: [[-0.018, 0], [0, 0.018], [0.018, 0], [0, -0.018]],
1195
+ v: [[111.72, -40.406], [111.688, -40.373], [111.72, -40.34], [111.753, -40.373]]
1196
+ }],
1197
+ t: 46.75
1198
+ }, {
1199
+ o: {
1200
+ x: 0.167,
1201
+ y: 0
1202
+ },
1203
+ i: {
1204
+ x: 0.29,
1205
+ y: 1
1206
+ },
1207
+ s: [{
1208
+ c: true,
1209
+ i: [[12.339, 0], [0, -12.338], [-12.339, 0], [0, 12.339]],
1210
+ o: [[-12.339, 0], [0, 12.339], [12.339, 0], [0, -12.338]],
1211
+ v: [[113, -64.029], [90.623, -41.653], [113, -19.276], [135.377, -41.653]]
1212
+ }],
1213
+ t: 59.5
1214
+ }, {
1215
+ o: {
1216
+ x: 0.167,
1217
+ y: 0.167
1218
+ },
1219
+ i: {
1220
+ x: 0.833,
1221
+ y: 0.833
1222
+ },
1223
+ s: [{
1224
+ c: true,
1225
+ i: [[0.018, 0], [0, -0.018], [-0.018, 0], [0, 0.018]],
1226
+ o: [[-0.018, 0], [0, 0.018], [0.018, 0], [0, -0.018]],
1227
+ v: [[111.72, -40.406], [111.688, -40.373], [111.72, -40.34], [111.753, -40.373]]
1228
+ }],
1229
+ t: 72.25
1230
+ }],
1231
+ ix: 2
1232
+ }
1233
+ }, {
1234
+ ty: 'sh',
1235
+ bm: 0,
1236
+ cl: '',
1237
+ ln: '',
1238
+ hd: false,
1239
+ mn: 'ADBE Vector Shape - Group',
1240
+ nm: 'Path 2',
1241
+ ix: 2,
1242
+ d: 1,
1243
+ ks: {
1244
+ a: 0,
1245
+ k: {
1246
+ c: true,
1247
+ i: [[18.404, 0], [0, 18.404], [-18.404, 0], [0, -18.404]],
1248
+ o: [[-18.404, 0], [0, -18.404], [18.404, 0], [0, 18.404]],
1249
+ v: [[113, -8.276], [79.623, -41.653], [113, -75.029], [146.377, -41.653]]
1250
+ },
1251
+ ix: 2
1252
+ }
1253
+ }, {
1254
+ ty: 'fl',
1255
+ bm: 0,
1256
+ cl: '',
1257
+ ln: '',
1258
+ hd: false,
1259
+ mn: 'ADBE Vector Graphic - Fill',
1260
+ nm: 'Fill 1',
1261
+ c: {
1262
+ a: 0,
1263
+ k: [0, 0.7569, 0.7137],
1264
+ ix: 4
1265
+ },
1266
+ r: 1,
1267
+ o: {
1268
+ a: 0,
1269
+ k: 100,
1270
+ ix: 5
1271
+ }
1272
+ }, {
1273
+ ty: 'tr',
1274
+ a: {
1275
+ a: 0,
1276
+ k: [0, 0],
1277
+ ix: 1
1278
+ },
1279
+ s: {
1280
+ a: 0,
1281
+ k: [100, 100],
1282
+ ix: 3
1283
+ },
1284
+ sk: {
1285
+ a: 0,
1286
+ k: 0,
1287
+ ix: 4
1288
+ },
1289
+ p: {
1290
+ a: 0,
1291
+ k: [0, 0],
1292
+ ix: 2
1293
+ },
1294
+ r: {
1295
+ a: 0,
1296
+ k: 0,
1297
+ ix: 6
1298
+ },
1299
+ sa: {
1300
+ a: 0,
1301
+ k: 0,
1302
+ ix: 5
1303
+ },
1304
+ o: {
1305
+ a: 0,
1306
+ k: 100,
1307
+ ix: 7
1308
+ }
1309
+ }]
1310
+ }],
1311
+ ind: 1
1312
+ }, {
1313
+ ty: 4,
1314
+ nm: '1',
1315
+ mn: '',
1316
+ sr: 1,
1317
+ st: 0,
1318
+ op: 900,
1319
+ ip: 0,
1320
+ hd: false,
1321
+ cl: '',
1322
+ ln: '',
1323
+ ddd: 0,
1324
+ bm: 0,
1325
+ tt: 0,
1326
+ hasMask: false,
1327
+ td: 0,
1328
+ ao: 0,
1329
+ ks: {
1330
+ a: {
1331
+ a: 0,
1332
+ k: [113, -41.653, 0],
1333
+ ix: 1
1334
+ },
1335
+ s: {
1336
+ a: 0,
1337
+ k: [100, 100, 100],
1338
+ ix: 6
1339
+ },
1340
+ sk: {
1341
+ a: 0,
1342
+ k: 0
1343
+ },
1344
+ p: {
1345
+ a: 1,
1346
+ k: [{
1347
+ o: {
1348
+ x: 0.167,
1349
+ y: 0
1350
+ },
1351
+ i: {
1352
+ x: 0.29,
1353
+ y: 1
1354
+ },
1355
+ s: [46.5, 100.847, 0],
1356
+ t: 0
1357
+ }, {
1358
+ o: {
1359
+ x: 0.167,
1360
+ y: 0
1361
+ },
1362
+ i: {
1363
+ x: 0.29,
1364
+ y: 1
1365
+ },
1366
+ s: [46.5, 53.847, 0],
1367
+ t: 9.464
1368
+ }, {
1369
+ o: {
1370
+ x: 0.167,
1371
+ y: 0
1372
+ },
1373
+ i: {
1374
+ x: 0.29,
1375
+ y: 1
1376
+ },
1377
+ s: [46.5, 66.885, 0],
1378
+ t: 21.452
1379
+ }, {
1380
+ o: {
1381
+ x: 0.167,
1382
+ y: 0.167
1383
+ },
1384
+ i: {
1385
+ x: 0.833,
1386
+ y: 0.833
1387
+ },
1388
+ s: [46.5, 100.847, 0],
1389
+ t: 26.4990234375
1390
+ }],
1391
+ ix: 2
1392
+ },
1393
+ sa: {
1394
+ a: 0,
1395
+ k: 0
1396
+ },
1397
+ o: {
1398
+ a: 0,
1399
+ k: 100,
1400
+ ix: 11
1401
+ },
1402
+ r: {
1403
+ a: 0,
1404
+ k: 0,
1405
+ ix: 10
1406
+ }
1407
+ },
1408
+ ef: [],
1409
+ shapes: [{
1410
+ ty: 'gr',
1411
+ bm: 0,
1412
+ cl: '',
1413
+ ln: '',
1414
+ hd: false,
1415
+ mn: 'ADBE Vector Group',
1416
+ nm: 'Group 1',
1417
+ ix: 1,
1418
+ cix: 2,
1419
+ np: 3,
1420
+ it: [{
1421
+ ty: 'sh',
1422
+ bm: 0,
1423
+ cl: '',
1424
+ ln: '',
1425
+ hd: false,
1426
+ mn: 'ADBE Vector Shape - Group',
1427
+ nm: 'Path 1',
1428
+ ix: 1,
1429
+ d: 1,
1430
+ ks: {
1431
+ a: 1,
1432
+ k: [{
1433
+ o: {
1434
+ x: 0.167,
1435
+ y: 0
1436
+ },
1437
+ i: {
1438
+ x: 0.29,
1439
+ y: 1
1440
+ },
1441
+ s: [{
1442
+ c: true,
1443
+ i: [[0.018, 0], [0, -0.018], [-0.018, 0], [0, 0.018]],
1444
+ o: [[-0.018, 0], [0, 0.018], [0.018, 0], [0, -0.018]],
1445
+ v: [[114.22, -40.406], [114.188, -40.373], [114.22, -40.34], [114.253, -40.373]]
1446
+ }],
1447
+ t: 6.8
1448
+ }, {
1449
+ o: {
1450
+ x: 0.167,
1451
+ y: 0
1452
+ },
1453
+ i: {
1454
+ x: 0.29,
1455
+ y: 1
1456
+ },
1457
+ s: [{
1458
+ c: true,
1459
+ i: [[12.339, 0], [0, -12.338], [-12.339, 0], [0, 12.339]],
1460
+ o: [[-12.339, 0], [0, 12.339], [12.339, 0], [0, -12.338]],
1461
+ v: [[113, -64.029], [90.623, -41.653], [113, -19.276], [135.377, -41.653]]
1462
+ }],
1463
+ t: 13.6
1464
+ }, {
1465
+ o: {
1466
+ x: 0.167,
1467
+ y: 0
1468
+ },
1469
+ i: {
1470
+ x: 0.29,
1471
+ y: 1
1472
+ },
1473
+ s: [{
1474
+ c: true,
1475
+ i: [[12.339, 0], [0, -12.338], [-12.339, 0], [0, 12.339]],
1476
+ o: [[-12.339, 0], [0, 12.339], [12.339, 0], [0, -12.338]],
1477
+ v: [[113, -64.029], [90.623, -41.653], [113, -19.276], [135.377, -41.653]]
1478
+ }],
1479
+ t: 17.899
1480
+ }, {
1481
+ o: {
1482
+ x: 0.167,
1483
+ y: 0
1484
+ },
1485
+ i: {
1486
+ x: 0.29,
1487
+ y: 1
1488
+ },
1489
+ s: [{
1490
+ c: true,
1491
+ i: [[0.018, 0], [0, -0.018], [-0.018, 0], [0, 0.018]],
1492
+ o: [[-0.018, 0], [0, 0.018], [0.018, 0], [0, -0.018]],
1493
+ v: [[111.72, -40.406], [111.688, -40.373], [111.72, -40.34], [111.753, -40.373]]
1494
+ }],
1495
+ t: 23.954
1496
+ }, {
1497
+ o: {
1498
+ x: 0.167,
1499
+ y: 0
1500
+ },
1501
+ i: {
1502
+ x: 0.29,
1503
+ y: 1
1504
+ },
1505
+ s: [{
1506
+ c: true,
1507
+ i: [[0.018, 0], [0, -0.018], [-0.018, 0], [0, 0.018]],
1508
+ o: [[-0.018, 0], [0, 0.018], [0.018, 0], [0, -0.018]],
1509
+ v: [[111.72, -40.406], [111.688, -40.373], [111.72, -40.34], [111.753, -40.373]]
1510
+ }],
1511
+ t: 59.5
1512
+ }, {
1513
+ o: {
1514
+ x: 0.167,
1515
+ y: 0
1516
+ },
1517
+ i: {
1518
+ x: 0.29,
1519
+ y: 1
1520
+ },
1521
+ s: [{
1522
+ c: true,
1523
+ i: [[12.339, 0], [0, -12.338], [-12.339, 0], [0, 12.339]],
1524
+ o: [[-12.339, 0], [0, 12.339], [12.339, 0], [0, -12.338]],
1525
+ v: [[113, -64.029], [90.623, -41.653], [113, -19.276], [135.377, -41.653]]
1526
+ }],
1527
+ t: 72.25
1528
+ }, {
1529
+ o: {
1530
+ x: 0.167,
1531
+ y: 0.167
1532
+ },
1533
+ i: {
1534
+ x: 0.833,
1535
+ y: 0.833
1536
+ },
1537
+ s: [{
1538
+ c: true,
1539
+ i: [[0.018, 0], [0, -0.018], [-0.018, 0], [0, 0.018]],
1540
+ o: [[-0.018, 0], [0, 0.018], [0.018, 0], [0, -0.018]],
1541
+ v: [[111.72, -40.406], [111.688, -40.373], [111.72, -40.34], [111.753, -40.373]]
1542
+ }],
1543
+ t: 85
1544
+ }],
1545
+ ix: 2
1546
+ }
1547
+ }, {
1548
+ ty: 'sh',
1549
+ bm: 0,
1550
+ cl: '',
1551
+ ln: '',
1552
+ hd: false,
1553
+ mn: 'ADBE Vector Shape - Group',
1554
+ nm: 'Path 2',
1555
+ ix: 2,
1556
+ d: 1,
1557
+ ks: {
1558
+ a: 0,
1559
+ k: {
1560
+ c: true,
1561
+ i: [[18.404, 0], [0, 18.404], [-18.404, 0], [0, -18.404]],
1562
+ o: [[-18.404, 0], [0, -18.404], [18.404, 0], [0, 18.404]],
1563
+ v: [[113, -8.276], [79.623, -41.653], [113, -75.029], [146.377, -41.653]]
1564
+ },
1565
+ ix: 2
1566
+ }
1567
+ }, {
1568
+ ty: 'fl',
1569
+ bm: 0,
1570
+ cl: '',
1571
+ ln: '',
1572
+ hd: false,
1573
+ mn: 'ADBE Vector Graphic - Fill',
1574
+ nm: 'Fill 1',
1575
+ c: {
1576
+ a: 0,
1577
+ k: [0, 0.7569, 0.7137],
1578
+ ix: 4
1579
+ },
1580
+ r: 1,
1581
+ o: {
1582
+ a: 0,
1583
+ k: 100,
1584
+ ix: 5
1585
+ }
1586
+ }, {
1587
+ ty: 'tr',
1588
+ a: {
1589
+ a: 0,
1590
+ k: [0, 0],
1591
+ ix: 1
1592
+ },
1593
+ s: {
1594
+ a: 0,
1595
+ k: [100, 100],
1596
+ ix: 3
1597
+ },
1598
+ sk: {
1599
+ a: 0,
1600
+ k: 0,
1601
+ ix: 4
1602
+ },
1603
+ p: {
1604
+ a: 0,
1605
+ k: [0, 0],
1606
+ ix: 2
1607
+ },
1608
+ r: {
1609
+ a: 0,
1610
+ k: 0,
1611
+ ix: 6
1612
+ },
1613
+ sa: {
1614
+ a: 0,
1615
+ k: 0,
1616
+ ix: 5
1617
+ },
1618
+ o: {
1619
+ a: 0,
1620
+ k: 100,
1621
+ ix: 7
1622
+ }
1623
+ }]
1624
+ }],
1625
+ ind: 2
1626
+ }],
1627
+ ddd: 0,
1628
+ h: 200,
1629
+ w: 300,
1630
+ meta: {
1631
+ a: '',
1632
+ k: '',
1633
+ d: '',
1634
+ g: 'LottieFiles AE 1.0.0',
1635
+ tc: '#ffffff'
1636
+ },
1637
+ v: '4.8.0',
1638
+ fr: 30,
1639
+ op: 86,
1640
+ ip: 0,
1641
+ assets: []
1642
+ });
1643
+
1644
+ function startLoadingSDK(text) {
1645
+ const body = document.body;
1646
+ const loadingSDKOuter = document.createElement('div');
1647
+ const loadingSDKContent = document.createElement('div');
1648
+ loadingSDKOuter.classList.add('authme-loading-sdk-outer');
1649
+ loadingSDKContent.classList.add('authme-loading-sdk-content');
1650
+ loadingSDKOuter.appendChild(loadingSDKContent);
1651
+ lottie__default["default"].loadAnimation({
1652
+ container: loadingSDKContent,
1653
+ renderer: 'svg',
1654
+ loop: true,
1655
+ autoplay: true,
1656
+ name: 'tutorial',
1657
+ animationData: sdk_loading()
1658
+ });
1659
+ body === null || body === void 0 ? void 0 : body.appendChild(loadingSDKOuter);
1660
+ }
1661
+ function stopLoadingSDK() {
1662
+ const body = document.body;
1663
+ const loadingSDKOuter = document.querySelector('.authme-loading-sdk-outer');
1664
+ if (loadingSDKOuter) {
1665
+ body === null || body === void 0 ? void 0 : body.removeChild(loadingSDKOuter);
1666
+ }
1667
+ }
1668
+
1669
+ var name = "@authme/util";
1670
+ var version$1 = "2.2.1-rc.3";
1671
+ var peerDependencies = {
1672
+ "core-js": "^3.6.0"
1673
+ };
1674
+ var packageInfo = {
1675
+ name: name,
1676
+ version: version$1,
1677
+ peerDependencies: peerDependencies
1678
+ };
1679
+
1680
+ var _a;
1681
+ var _b, _c;
1682
+ const version = packageInfo.version;
1683
+ (_a = (_b = window)[_c = Symbol.for('authme-sdk')]) !== null && _a !== void 0 ? _a : _b[_c] = {};
1684
+ window[Symbol.for('authme-sdk')][packageInfo.name] = version;
1685
+
1686
+ exports.AuthmeError = AuthmeError;
1687
+ exports.Storage = Storage;
1688
+ exports.UintArrayToBlob = UintArrayToBlob;
1689
+ exports.asyncOnLineShowErrorMessage = asyncOnLineShowErrorMessage;
1690
+ exports.asyncShowErrorMessage = asyncShowErrorMessage;
1691
+ exports.asyncShowPopup = asyncShowPopup;
1692
+ exports.checkOnlineStatus = checkOnlineStatus;
1693
+ exports.clearCanvas = clearCanvas;
1694
+ exports.cropByRatio = cropByRatio;
1695
+ exports.dataURItoBlob = dataURItoBlob;
1696
+ exports.debugLog = debugLog;
1697
+ exports.getCanvasSize = getCanvasSize;
1698
+ exports.getImageData = getImageData;
1699
+ exports.getUserAgent = getUserAgent;
1700
+ exports.hideElement = hideElement;
1701
+ exports.hideErrorMessage = hideErrorMessage;
1702
+ exports.hidePopup = hidePopup;
1703
+ exports.isMobile = isMobile;
1704
+ exports.isMobileOrTablet = isMobileOrTablet;
1705
+ exports.requestCamera = requestCamera;
1706
+ exports.resize = resize;
1707
+ exports.retryPromiseWithCondition = retryPromiseWithCondition;
1708
+ exports.showElement = showElement;
1709
+ exports.showErrorMessage = showErrorMessage;
1710
+ exports.showPopup = showPopup;
1711
+ exports.startLoadingSDK = startLoadingSDK;
1712
+ exports.startSpinner = startSpinner;
1713
+ exports.stopLoadingSDK = stopLoadingSDK;
1714
+ exports.stopSpinner = stopSpinner;
1715
+ exports.version = version;
1716
+ exports.videoConstraintsFactory = videoConstraintsFactory;
1717
+ exports.waitTime = waitTime;