@aws-amplify/ui-react 1.2.26 → 1.2.54-legacy-ui.10
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/CHANGELOG.md +224 -0
- package/dist/0.js.map +1 -1
- package/dist/1.js +656 -2000
- package/dist/1.js.map +1 -1
- package/dist/10.js +23 -681
- package/dist/10.js.map +1 -1
- package/dist/11.js +1157 -20
- package/dist/11.js.map +1 -1
- package/dist/12.js +61 -1087
- package/dist/12.js.map +1 -1
- package/dist/13.js +1146 -64
- package/dist/13.js.map +1 -1
- package/dist/14.js +34 -1163
- package/dist/14.js.map +1 -1
- package/dist/15.js +17 -37
- package/dist/15.js.map +1 -1
- package/dist/16.js +109 -13
- package/dist/16.js.map +1 -1
- package/dist/17.js +32 -67
- package/dist/17.js.map +1 -1
- package/dist/18.js +236 -46
- package/dist/18.js.map +1 -1
- package/dist/19.js +35 -224
- package/dist/19.js.map +1 -1
- package/dist/2.js +2190 -159
- package/dist/2.js.map +1 -1
- package/dist/20.js +28 -48
- package/dist/20.js.map +1 -1
- package/dist/21.js +46 -25
- package/dist/21.js.map +1 -1
- package/dist/22.js +22 -25
- package/dist/22.js.map +1 -1
- package/dist/23.js +254 -25
- package/dist/23.js.map +1 -1
- package/dist/24.js +62 -230
- package/dist/24.js.map +1 -1
- package/dist/25.js +28 -62
- package/dist/25.js.map +1 -1
- package/dist/26.js +349 -30
- package/dist/26.js.map +1 -1
- package/dist/27.js +24 -352
- package/dist/27.js.map +1 -1
- package/dist/28.js +25 -22
- package/dist/28.js.map +1 -1
- package/dist/29.js +483 -26
- package/dist/29.js.map +1 -1
- package/dist/3.js +2710 -1818
- package/dist/3.js.map +1 -1
- package/dist/30.js +1 -502
- package/dist/30.js.map +1 -1
- package/dist/31.js +1 -1
- package/dist/31.js.map +1 -1
- package/dist/32.js +12 -1
- package/dist/32.js.map +1 -1
- package/dist/4.js +361 -3669
- package/dist/4.js.map +1 -1
- package/dist/5.js +48 -242
- package/dist/5.js.map +1 -1
- package/dist/6.js +118 -74
- package/dist/6.js.map +1 -1
- package/dist/7.js +55 -99
- package/dist/7.js.map +1 -1
- package/dist/8.js +98 -46
- package/dist/8.js.map +1 -1
- package/dist/9.js +474 -412
- package/dist/9.js.map +1 -1
- package/dist/@aws-amplify/ui-react.js +50 -44
- package/dist/@aws-amplify/ui-react.js.map +1 -1
- package/dist/aws-amplify-react.min.js +2 -2
- package/dist/aws-amplify-react.min.js.map +1 -1
- package/dist/polyfills-core-js.js +5 -11
- package/dist/polyfills-core-js.js.map +1 -1
- package/dist/polyfills-css-shim.js.map +1 -1
- package/dist/polyfills-dom.js.map +1 -1
- package/package.json +3 -3
- package/dist/33.js +0 -13
- package/dist/33.js.map +0 -1
package/dist/1.js
CHANGED
|
@@ -1,2108 +1,764 @@
|
|
|
1
1
|
(this["webpackJsonpaws_amplify_react"] = this["webpackJsonpaws_amplify_react"] || []).push([[1],{
|
|
2
2
|
|
|
3
|
-
/***/ "
|
|
4
|
-
|
|
5
|
-
!***
|
|
6
|
-
|
|
7
|
-
/*!
|
|
8
|
-
/***/ (function(module,
|
|
3
|
+
/***/ "../amplify-ui-components/dist/esm-es5/amplify-authenticator.entry.js":
|
|
4
|
+
/*!****************************************************************************!*\
|
|
5
|
+
!*** ../amplify-ui-components/dist/esm-es5/amplify-authenticator.entry.js ***!
|
|
6
|
+
\****************************************************************************/
|
|
7
|
+
/*! exports provided: amplify_authenticator */
|
|
8
|
+
/***/ (function(module, __webpack_exports__, __webpack_require__) {
|
|
9
9
|
|
|
10
10
|
"use strict";
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
var
|
|
18
|
-
var
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
var
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
}
|
|
38
|
-
|
|
39
|
-
// Trim off extra bytes after placeholder bytes are found
|
|
40
|
-
// See: https://github.com/beatgammit/base64-js/issues/42
|
|
41
|
-
var validLen = b64.indexOf('=')
|
|
42
|
-
if (validLen === -1) validLen = len
|
|
43
|
-
|
|
44
|
-
var placeHoldersLen = validLen === len
|
|
45
|
-
? 0
|
|
46
|
-
: 4 - (validLen % 4)
|
|
47
|
-
|
|
48
|
-
return [validLen, placeHoldersLen]
|
|
49
|
-
}
|
|
50
|
-
|
|
51
|
-
// base64 is 4/3 + up to two characters of the original data
|
|
52
|
-
function byteLength (b64) {
|
|
53
|
-
var lens = getLens(b64)
|
|
54
|
-
var validLen = lens[0]
|
|
55
|
-
var placeHoldersLen = lens[1]
|
|
56
|
-
return ((validLen + placeHoldersLen) * 3 / 4) - placeHoldersLen
|
|
57
|
-
}
|
|
58
|
-
|
|
59
|
-
function _byteLength (b64, validLen, placeHoldersLen) {
|
|
60
|
-
return ((validLen + placeHoldersLen) * 3 / 4) - placeHoldersLen
|
|
61
|
-
}
|
|
62
|
-
|
|
63
|
-
function toByteArray (b64) {
|
|
64
|
-
var tmp
|
|
65
|
-
var lens = getLens(b64)
|
|
66
|
-
var validLen = lens[0]
|
|
67
|
-
var placeHoldersLen = lens[1]
|
|
68
|
-
|
|
69
|
-
var arr = new Arr(_byteLength(b64, validLen, placeHoldersLen))
|
|
70
|
-
|
|
71
|
-
var curByte = 0
|
|
72
|
-
|
|
73
|
-
// if there are placeholders, only get up to the last complete 4 chars
|
|
74
|
-
var len = placeHoldersLen > 0
|
|
75
|
-
? validLen - 4
|
|
76
|
-
: validLen
|
|
77
|
-
|
|
78
|
-
var i
|
|
79
|
-
for (i = 0; i < len; i += 4) {
|
|
80
|
-
tmp =
|
|
81
|
-
(revLookup[b64.charCodeAt(i)] << 18) |
|
|
82
|
-
(revLookup[b64.charCodeAt(i + 1)] << 12) |
|
|
83
|
-
(revLookup[b64.charCodeAt(i + 2)] << 6) |
|
|
84
|
-
revLookup[b64.charCodeAt(i + 3)]
|
|
85
|
-
arr[curByte++] = (tmp >> 16) & 0xFF
|
|
86
|
-
arr[curByte++] = (tmp >> 8) & 0xFF
|
|
87
|
-
arr[curByte++] = tmp & 0xFF
|
|
88
|
-
}
|
|
89
|
-
|
|
90
|
-
if (placeHoldersLen === 2) {
|
|
91
|
-
tmp =
|
|
92
|
-
(revLookup[b64.charCodeAt(i)] << 2) |
|
|
93
|
-
(revLookup[b64.charCodeAt(i + 1)] >> 4)
|
|
94
|
-
arr[curByte++] = tmp & 0xFF
|
|
95
|
-
}
|
|
96
|
-
|
|
97
|
-
if (placeHoldersLen === 1) {
|
|
98
|
-
tmp =
|
|
99
|
-
(revLookup[b64.charCodeAt(i)] << 10) |
|
|
100
|
-
(revLookup[b64.charCodeAt(i + 1)] << 4) |
|
|
101
|
-
(revLookup[b64.charCodeAt(i + 2)] >> 2)
|
|
102
|
-
arr[curByte++] = (tmp >> 8) & 0xFF
|
|
103
|
-
arr[curByte++] = tmp & 0xFF
|
|
104
|
-
}
|
|
105
|
-
|
|
106
|
-
return arr
|
|
107
|
-
}
|
|
108
|
-
|
|
109
|
-
function tripletToBase64 (num) {
|
|
110
|
-
return lookup[num >> 18 & 0x3F] +
|
|
111
|
-
lookup[num >> 12 & 0x3F] +
|
|
112
|
-
lookup[num >> 6 & 0x3F] +
|
|
113
|
-
lookup[num & 0x3F]
|
|
114
|
-
}
|
|
115
|
-
|
|
116
|
-
function encodeChunk (uint8, start, end) {
|
|
117
|
-
var tmp
|
|
118
|
-
var output = []
|
|
119
|
-
for (var i = start; i < end; i += 3) {
|
|
120
|
-
tmp =
|
|
121
|
-
((uint8[i] << 16) & 0xFF0000) +
|
|
122
|
-
((uint8[i + 1] << 8) & 0xFF00) +
|
|
123
|
-
(uint8[i + 2] & 0xFF)
|
|
124
|
-
output.push(tripletToBase64(tmp))
|
|
125
|
-
}
|
|
126
|
-
return output.join('')
|
|
127
|
-
}
|
|
128
|
-
|
|
129
|
-
function fromByteArray (uint8) {
|
|
130
|
-
var tmp
|
|
131
|
-
var len = uint8.length
|
|
132
|
-
var extraBytes = len % 3 // if we have 1 byte left, pad 2 bytes
|
|
133
|
-
var parts = []
|
|
134
|
-
var maxChunkLength = 16383 // must be multiple of 3
|
|
135
|
-
|
|
136
|
-
// go through the array every three bytes, we'll deal with trailing stuff later
|
|
137
|
-
for (var i = 0, len2 = len - extraBytes; i < len2; i += maxChunkLength) {
|
|
138
|
-
parts.push(encodeChunk(uint8, i, (i + maxChunkLength) > len2 ? len2 : (i + maxChunkLength)))
|
|
139
|
-
}
|
|
140
|
-
|
|
141
|
-
// pad the end with zeros, but make sure to not forget the extra bytes
|
|
142
|
-
if (extraBytes === 1) {
|
|
143
|
-
tmp = uint8[len - 1]
|
|
144
|
-
parts.push(
|
|
145
|
-
lookup[tmp >> 2] +
|
|
146
|
-
lookup[(tmp << 4) & 0x3F] +
|
|
147
|
-
'=='
|
|
148
|
-
)
|
|
149
|
-
} else if (extraBytes === 2) {
|
|
150
|
-
tmp = (uint8[len - 2] << 8) + uint8[len - 1]
|
|
151
|
-
parts.push(
|
|
152
|
-
lookup[tmp >> 10] +
|
|
153
|
-
lookup[(tmp >> 4) & 0x3F] +
|
|
154
|
-
lookup[(tmp << 2) & 0x3F] +
|
|
155
|
-
'='
|
|
156
|
-
)
|
|
157
|
-
}
|
|
158
|
-
|
|
159
|
-
return parts.join('')
|
|
160
|
-
}
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
/***/ }),
|
|
164
|
-
|
|
165
|
-
/***/ "../../node_modules/buffer/index.js":
|
|
166
|
-
/*!*****************************************************!*\
|
|
167
|
-
!*** /root/amplify-js/node_modules/buffer/index.js ***!
|
|
168
|
-
\*****************************************************/
|
|
169
|
-
/*! no static exports found */
|
|
170
|
-
/***/ (function(module, exports, __webpack_require__) {
|
|
171
|
-
|
|
172
|
-
"use strict";
|
|
173
|
-
/* WEBPACK VAR INJECTION */(function(global) {/*!
|
|
174
|
-
* The buffer module from node.js, for the browser.
|
|
175
|
-
*
|
|
176
|
-
* @author Feross Aboukhadijeh <http://feross.org>
|
|
177
|
-
* @license MIT
|
|
178
|
-
*/
|
|
179
|
-
/* eslint-disable no-proto */
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
var base64 = __webpack_require__(/*! base64-js */ "../../node_modules/base64-js/index.js")
|
|
184
|
-
var ieee754 = __webpack_require__(/*! ieee754 */ "../../node_modules/ieee754/index.js")
|
|
185
|
-
var isArray = __webpack_require__(/*! isarray */ "../../node_modules/isarray/index.js")
|
|
186
|
-
|
|
187
|
-
exports.Buffer = Buffer
|
|
188
|
-
exports.SlowBuffer = SlowBuffer
|
|
189
|
-
exports.INSPECT_MAX_BYTES = 50
|
|
190
|
-
|
|
191
|
-
/**
|
|
192
|
-
* If `Buffer.TYPED_ARRAY_SUPPORT`:
|
|
193
|
-
* === true Use Uint8Array implementation (fastest)
|
|
194
|
-
* === false Use Object implementation (most compatible, even IE6)
|
|
195
|
-
*
|
|
196
|
-
* Browsers that support typed arrays are IE 10+, Firefox 4+, Chrome 7+, Safari 5.1+,
|
|
197
|
-
* Opera 11.6+, iOS 4.2+.
|
|
198
|
-
*
|
|
199
|
-
* Due to various browser bugs, sometimes the Object implementation will be used even
|
|
200
|
-
* when the browser supports typed arrays.
|
|
201
|
-
*
|
|
202
|
-
* Note:
|
|
203
|
-
*
|
|
204
|
-
* - Firefox 4-29 lacks support for adding new properties to `Uint8Array` instances,
|
|
205
|
-
* See: https://bugzilla.mozilla.org/show_bug.cgi?id=695438.
|
|
206
|
-
*
|
|
207
|
-
* - Chrome 9-10 is missing the `TypedArray.prototype.subarray` function.
|
|
208
|
-
*
|
|
209
|
-
* - IE10 has a broken `TypedArray.prototype.subarray` function which returns arrays of
|
|
210
|
-
* incorrect length in some situations.
|
|
211
|
-
|
|
212
|
-
* We detect these buggy browsers and set `Buffer.TYPED_ARRAY_SUPPORT` to `false` so they
|
|
213
|
-
* get the Object implementation, which is slower but behaves correctly.
|
|
214
|
-
*/
|
|
215
|
-
Buffer.TYPED_ARRAY_SUPPORT = global.TYPED_ARRAY_SUPPORT !== undefined
|
|
216
|
-
? global.TYPED_ARRAY_SUPPORT
|
|
217
|
-
: typedArraySupport()
|
|
218
|
-
|
|
219
|
-
/*
|
|
220
|
-
* Export kMaxLength after typed array support is determined.
|
|
221
|
-
*/
|
|
222
|
-
exports.kMaxLength = kMaxLength()
|
|
223
|
-
|
|
224
|
-
function typedArraySupport () {
|
|
225
|
-
try {
|
|
226
|
-
var arr = new Uint8Array(1)
|
|
227
|
-
arr.__proto__ = {__proto__: Uint8Array.prototype, foo: function () { return 42 }}
|
|
228
|
-
return arr.foo() === 42 && // typed array instances can be augmented
|
|
229
|
-
typeof arr.subarray === 'function' && // chrome 9-10 lack `subarray`
|
|
230
|
-
arr.subarray(1, 1).byteLength === 0 // ie10 has broken `subarray`
|
|
231
|
-
} catch (e) {
|
|
232
|
-
return false
|
|
233
|
-
}
|
|
234
|
-
}
|
|
235
|
-
|
|
236
|
-
function kMaxLength () {
|
|
237
|
-
return Buffer.TYPED_ARRAY_SUPPORT
|
|
238
|
-
? 0x7fffffff
|
|
239
|
-
: 0x3fffffff
|
|
240
|
-
}
|
|
241
|
-
|
|
242
|
-
function createBuffer (that, length) {
|
|
243
|
-
if (kMaxLength() < length) {
|
|
244
|
-
throw new RangeError('Invalid typed array length')
|
|
245
|
-
}
|
|
246
|
-
if (Buffer.TYPED_ARRAY_SUPPORT) {
|
|
247
|
-
// Return an augmented `Uint8Array` instance, for best performance
|
|
248
|
-
that = new Uint8Array(length)
|
|
249
|
-
that.__proto__ = Buffer.prototype
|
|
250
|
-
} else {
|
|
251
|
-
// Fallback: Return an object instance of the Buffer class
|
|
252
|
-
if (that === null) {
|
|
253
|
-
that = new Buffer(length)
|
|
254
|
-
}
|
|
255
|
-
that.length = length
|
|
256
|
-
}
|
|
257
|
-
|
|
258
|
-
return that
|
|
259
|
-
}
|
|
260
|
-
|
|
261
|
-
/**
|
|
262
|
-
* The Buffer constructor returns instances of `Uint8Array` that have their
|
|
263
|
-
* prototype changed to `Buffer.prototype`. Furthermore, `Buffer` is a subclass of
|
|
264
|
-
* `Uint8Array`, so the returned instances will have all the node `Buffer` methods
|
|
265
|
-
* and the `Uint8Array` methods. Square bracket notation works as expected -- it
|
|
266
|
-
* returns a single octet.
|
|
267
|
-
*
|
|
268
|
-
* The `Uint8Array` prototype remains unmodified.
|
|
269
|
-
*/
|
|
270
|
-
|
|
271
|
-
function Buffer (arg, encodingOrOffset, length) {
|
|
272
|
-
if (!Buffer.TYPED_ARRAY_SUPPORT && !(this instanceof Buffer)) {
|
|
273
|
-
return new Buffer(arg, encodingOrOffset, length)
|
|
274
|
-
}
|
|
275
|
-
|
|
276
|
-
// Common case.
|
|
277
|
-
if (typeof arg === 'number') {
|
|
278
|
-
if (typeof encodingOrOffset === 'string') {
|
|
279
|
-
throw new Error(
|
|
280
|
-
'If encoding is specified then the first argument must be a string'
|
|
281
|
-
)
|
|
282
|
-
}
|
|
283
|
-
return allocUnsafe(this, arg)
|
|
284
|
-
}
|
|
285
|
-
return from(this, arg, encodingOrOffset, length)
|
|
286
|
-
}
|
|
287
|
-
|
|
288
|
-
Buffer.poolSize = 8192 // not used by this implementation
|
|
289
|
-
|
|
290
|
-
// TODO: Legacy, not needed anymore. Remove in next major version.
|
|
291
|
-
Buffer._augment = function (arr) {
|
|
292
|
-
arr.__proto__ = Buffer.prototype
|
|
293
|
-
return arr
|
|
294
|
-
}
|
|
295
|
-
|
|
296
|
-
function from (that, value, encodingOrOffset, length) {
|
|
297
|
-
if (typeof value === 'number') {
|
|
298
|
-
throw new TypeError('"value" argument must not be a number')
|
|
299
|
-
}
|
|
300
|
-
|
|
301
|
-
if (typeof ArrayBuffer !== 'undefined' && value instanceof ArrayBuffer) {
|
|
302
|
-
return fromArrayBuffer(that, value, encodingOrOffset, length)
|
|
303
|
-
}
|
|
304
|
-
|
|
305
|
-
if (typeof value === 'string') {
|
|
306
|
-
return fromString(that, value, encodingOrOffset)
|
|
307
|
-
}
|
|
308
|
-
|
|
309
|
-
return fromObject(that, value)
|
|
310
|
-
}
|
|
311
|
-
|
|
312
|
-
/**
|
|
313
|
-
* Functionally equivalent to Buffer(arg, encoding) but throws a TypeError
|
|
314
|
-
* if value is a number.
|
|
315
|
-
* Buffer.from(str[, encoding])
|
|
316
|
-
* Buffer.from(array)
|
|
317
|
-
* Buffer.from(buffer)
|
|
318
|
-
* Buffer.from(arrayBuffer[, byteOffset[, length]])
|
|
319
|
-
**/
|
|
320
|
-
Buffer.from = function (value, encodingOrOffset, length) {
|
|
321
|
-
return from(null, value, encodingOrOffset, length)
|
|
322
|
-
}
|
|
323
|
-
|
|
324
|
-
if (Buffer.TYPED_ARRAY_SUPPORT) {
|
|
325
|
-
Buffer.prototype.__proto__ = Uint8Array.prototype
|
|
326
|
-
Buffer.__proto__ = Uint8Array
|
|
327
|
-
if (typeof Symbol !== 'undefined' && Symbol.species &&
|
|
328
|
-
Buffer[Symbol.species] === Buffer) {
|
|
329
|
-
// Fix subarray() in ES2016. See: https://github.com/feross/buffer/pull/97
|
|
330
|
-
Object.defineProperty(Buffer, Symbol.species, {
|
|
331
|
-
value: null,
|
|
332
|
-
configurable: true
|
|
333
|
-
})
|
|
334
|
-
}
|
|
335
|
-
}
|
|
336
|
-
|
|
337
|
-
function assertSize (size) {
|
|
338
|
-
if (typeof size !== 'number') {
|
|
339
|
-
throw new TypeError('"size" argument must be a number')
|
|
340
|
-
} else if (size < 0) {
|
|
341
|
-
throw new RangeError('"size" argument must not be negative')
|
|
342
|
-
}
|
|
343
|
-
}
|
|
344
|
-
|
|
345
|
-
function alloc (that, size, fill, encoding) {
|
|
346
|
-
assertSize(size)
|
|
347
|
-
if (size <= 0) {
|
|
348
|
-
return createBuffer(that, size)
|
|
349
|
-
}
|
|
350
|
-
if (fill !== undefined) {
|
|
351
|
-
// Only pay attention to encoding if it's a string. This
|
|
352
|
-
// prevents accidentally sending in a number that would
|
|
353
|
-
// be interpretted as a start offset.
|
|
354
|
-
return typeof encoding === 'string'
|
|
355
|
-
? createBuffer(that, size).fill(fill, encoding)
|
|
356
|
-
: createBuffer(that, size).fill(fill)
|
|
357
|
-
}
|
|
358
|
-
return createBuffer(that, size)
|
|
359
|
-
}
|
|
360
|
-
|
|
361
|
-
/**
|
|
362
|
-
* Creates a new filled Buffer instance.
|
|
363
|
-
* alloc(size[, fill[, encoding]])
|
|
364
|
-
**/
|
|
365
|
-
Buffer.alloc = function (size, fill, encoding) {
|
|
366
|
-
return alloc(null, size, fill, encoding)
|
|
367
|
-
}
|
|
368
|
-
|
|
369
|
-
function allocUnsafe (that, size) {
|
|
370
|
-
assertSize(size)
|
|
371
|
-
that = createBuffer(that, size < 0 ? 0 : checked(size) | 0)
|
|
372
|
-
if (!Buffer.TYPED_ARRAY_SUPPORT) {
|
|
373
|
-
for (var i = 0; i < size; ++i) {
|
|
374
|
-
that[i] = 0
|
|
375
|
-
}
|
|
376
|
-
}
|
|
377
|
-
return that
|
|
378
|
-
}
|
|
379
|
-
|
|
380
|
-
/**
|
|
381
|
-
* Equivalent to Buffer(num), by default creates a non-zero-filled Buffer instance.
|
|
382
|
-
* */
|
|
383
|
-
Buffer.allocUnsafe = function (size) {
|
|
384
|
-
return allocUnsafe(null, size)
|
|
385
|
-
}
|
|
386
|
-
/**
|
|
387
|
-
* Equivalent to SlowBuffer(num), by default creates a non-zero-filled Buffer instance.
|
|
388
|
-
*/
|
|
389
|
-
Buffer.allocUnsafeSlow = function (size) {
|
|
390
|
-
return allocUnsafe(null, size)
|
|
391
|
-
}
|
|
392
|
-
|
|
393
|
-
function fromString (that, string, encoding) {
|
|
394
|
-
if (typeof encoding !== 'string' || encoding === '') {
|
|
395
|
-
encoding = 'utf8'
|
|
396
|
-
}
|
|
397
|
-
|
|
398
|
-
if (!Buffer.isEncoding(encoding)) {
|
|
399
|
-
throw new TypeError('"encoding" must be a valid string encoding')
|
|
400
|
-
}
|
|
401
|
-
|
|
402
|
-
var length = byteLength(string, encoding) | 0
|
|
403
|
-
that = createBuffer(that, length)
|
|
404
|
-
|
|
405
|
-
var actual = that.write(string, encoding)
|
|
406
|
-
|
|
407
|
-
if (actual !== length) {
|
|
408
|
-
// Writing a hex string, for example, that contains invalid characters will
|
|
409
|
-
// cause everything after the first invalid character to be ignored. (e.g.
|
|
410
|
-
// 'abxxcd' will be treated as 'ab')
|
|
411
|
-
that = that.slice(0, actual)
|
|
412
|
-
}
|
|
413
|
-
|
|
414
|
-
return that
|
|
415
|
-
}
|
|
416
|
-
|
|
417
|
-
function fromArrayLike (that, array) {
|
|
418
|
-
var length = array.length < 0 ? 0 : checked(array.length) | 0
|
|
419
|
-
that = createBuffer(that, length)
|
|
420
|
-
for (var i = 0; i < length; i += 1) {
|
|
421
|
-
that[i] = array[i] & 255
|
|
422
|
-
}
|
|
423
|
-
return that
|
|
424
|
-
}
|
|
425
|
-
|
|
426
|
-
function fromArrayBuffer (that, array, byteOffset, length) {
|
|
427
|
-
array.byteLength // this throws if `array` is not a valid ArrayBuffer
|
|
428
|
-
|
|
429
|
-
if (byteOffset < 0 || array.byteLength < byteOffset) {
|
|
430
|
-
throw new RangeError('\'offset\' is out of bounds')
|
|
431
|
-
}
|
|
432
|
-
|
|
433
|
-
if (array.byteLength < byteOffset + (length || 0)) {
|
|
434
|
-
throw new RangeError('\'length\' is out of bounds')
|
|
435
|
-
}
|
|
436
|
-
|
|
437
|
-
if (byteOffset === undefined && length === undefined) {
|
|
438
|
-
array = new Uint8Array(array)
|
|
439
|
-
} else if (length === undefined) {
|
|
440
|
-
array = new Uint8Array(array, byteOffset)
|
|
441
|
-
} else {
|
|
442
|
-
array = new Uint8Array(array, byteOffset, length)
|
|
443
|
-
}
|
|
444
|
-
|
|
445
|
-
if (Buffer.TYPED_ARRAY_SUPPORT) {
|
|
446
|
-
// Return an augmented `Uint8Array` instance, for best performance
|
|
447
|
-
that = array
|
|
448
|
-
that.__proto__ = Buffer.prototype
|
|
449
|
-
} else {
|
|
450
|
-
// Fallback: Return an object instance of the Buffer class
|
|
451
|
-
that = fromArrayLike(that, array)
|
|
452
|
-
}
|
|
453
|
-
return that
|
|
454
|
-
}
|
|
455
|
-
|
|
456
|
-
function fromObject (that, obj) {
|
|
457
|
-
if (Buffer.isBuffer(obj)) {
|
|
458
|
-
var len = checked(obj.length) | 0
|
|
459
|
-
that = createBuffer(that, len)
|
|
460
|
-
|
|
461
|
-
if (that.length === 0) {
|
|
462
|
-
return that
|
|
463
|
-
}
|
|
464
|
-
|
|
465
|
-
obj.copy(that, 0, 0, len)
|
|
466
|
-
return that
|
|
467
|
-
}
|
|
468
|
-
|
|
469
|
-
if (obj) {
|
|
470
|
-
if ((typeof ArrayBuffer !== 'undefined' &&
|
|
471
|
-
obj.buffer instanceof ArrayBuffer) || 'length' in obj) {
|
|
472
|
-
if (typeof obj.length !== 'number' || isnan(obj.length)) {
|
|
473
|
-
return createBuffer(that, 0)
|
|
474
|
-
}
|
|
475
|
-
return fromArrayLike(that, obj)
|
|
476
|
-
}
|
|
477
|
-
|
|
478
|
-
if (obj.type === 'Buffer' && isArray(obj.data)) {
|
|
479
|
-
return fromArrayLike(that, obj.data)
|
|
480
|
-
}
|
|
481
|
-
}
|
|
482
|
-
|
|
483
|
-
throw new TypeError('First argument must be a string, Buffer, ArrayBuffer, Array, or array-like object.')
|
|
484
|
-
}
|
|
485
|
-
|
|
486
|
-
function checked (length) {
|
|
487
|
-
// Note: cannot use `length < kMaxLength()` here because that fails when
|
|
488
|
-
// length is NaN (which is otherwise coerced to zero.)
|
|
489
|
-
if (length >= kMaxLength()) {
|
|
490
|
-
throw new RangeError('Attempt to allocate Buffer larger than maximum ' +
|
|
491
|
-
'size: 0x' + kMaxLength().toString(16) + ' bytes')
|
|
492
|
-
}
|
|
493
|
-
return length | 0
|
|
494
|
-
}
|
|
495
|
-
|
|
496
|
-
function SlowBuffer (length) {
|
|
497
|
-
if (+length != length) { // eslint-disable-line eqeqeq
|
|
498
|
-
length = 0
|
|
499
|
-
}
|
|
500
|
-
return Buffer.alloc(+length)
|
|
501
|
-
}
|
|
502
|
-
|
|
503
|
-
Buffer.isBuffer = function isBuffer (b) {
|
|
504
|
-
return !!(b != null && b._isBuffer)
|
|
505
|
-
}
|
|
506
|
-
|
|
507
|
-
Buffer.compare = function compare (a, b) {
|
|
508
|
-
if (!Buffer.isBuffer(a) || !Buffer.isBuffer(b)) {
|
|
509
|
-
throw new TypeError('Arguments must be Buffers')
|
|
510
|
-
}
|
|
511
|
-
|
|
512
|
-
if (a === b) return 0
|
|
513
|
-
|
|
514
|
-
var x = a.length
|
|
515
|
-
var y = b.length
|
|
516
|
-
|
|
517
|
-
for (var i = 0, len = Math.min(x, y); i < len; ++i) {
|
|
518
|
-
if (a[i] !== b[i]) {
|
|
519
|
-
x = a[i]
|
|
520
|
-
y = b[i]
|
|
521
|
-
break
|
|
522
|
-
}
|
|
523
|
-
}
|
|
524
|
-
|
|
525
|
-
if (x < y) return -1
|
|
526
|
-
if (y < x) return 1
|
|
527
|
-
return 0
|
|
528
|
-
}
|
|
529
|
-
|
|
530
|
-
Buffer.isEncoding = function isEncoding (encoding) {
|
|
531
|
-
switch (String(encoding).toLowerCase()) {
|
|
532
|
-
case 'hex':
|
|
533
|
-
case 'utf8':
|
|
534
|
-
case 'utf-8':
|
|
535
|
-
case 'ascii':
|
|
536
|
-
case 'latin1':
|
|
537
|
-
case 'binary':
|
|
538
|
-
case 'base64':
|
|
539
|
-
case 'ucs2':
|
|
540
|
-
case 'ucs-2':
|
|
541
|
-
case 'utf16le':
|
|
542
|
-
case 'utf-16le':
|
|
543
|
-
return true
|
|
544
|
-
default:
|
|
545
|
-
return false
|
|
546
|
-
}
|
|
547
|
-
}
|
|
548
|
-
|
|
549
|
-
Buffer.concat = function concat (list, length) {
|
|
550
|
-
if (!isArray(list)) {
|
|
551
|
-
throw new TypeError('"list" argument must be an Array of Buffers')
|
|
552
|
-
}
|
|
553
|
-
|
|
554
|
-
if (list.length === 0) {
|
|
555
|
-
return Buffer.alloc(0)
|
|
556
|
-
}
|
|
557
|
-
|
|
558
|
-
var i
|
|
559
|
-
if (length === undefined) {
|
|
560
|
-
length = 0
|
|
561
|
-
for (i = 0; i < list.length; ++i) {
|
|
562
|
-
length += list[i].length
|
|
563
|
-
}
|
|
564
|
-
}
|
|
565
|
-
|
|
566
|
-
var buffer = Buffer.allocUnsafe(length)
|
|
567
|
-
var pos = 0
|
|
568
|
-
for (i = 0; i < list.length; ++i) {
|
|
569
|
-
var buf = list[i]
|
|
570
|
-
if (!Buffer.isBuffer(buf)) {
|
|
571
|
-
throw new TypeError('"list" argument must be an Array of Buffers')
|
|
572
|
-
}
|
|
573
|
-
buf.copy(buffer, pos)
|
|
574
|
-
pos += buf.length
|
|
575
|
-
}
|
|
576
|
-
return buffer
|
|
577
|
-
}
|
|
578
|
-
|
|
579
|
-
function byteLength (string, encoding) {
|
|
580
|
-
if (Buffer.isBuffer(string)) {
|
|
581
|
-
return string.length
|
|
582
|
-
}
|
|
583
|
-
if (typeof ArrayBuffer !== 'undefined' && typeof ArrayBuffer.isView === 'function' &&
|
|
584
|
-
(ArrayBuffer.isView(string) || string instanceof ArrayBuffer)) {
|
|
585
|
-
return string.byteLength
|
|
586
|
-
}
|
|
587
|
-
if (typeof string !== 'string') {
|
|
588
|
-
string = '' + string
|
|
589
|
-
}
|
|
590
|
-
|
|
591
|
-
var len = string.length
|
|
592
|
-
if (len === 0) return 0
|
|
593
|
-
|
|
594
|
-
// Use a for loop to avoid recursion
|
|
595
|
-
var loweredCase = false
|
|
596
|
-
for (;;) {
|
|
597
|
-
switch (encoding) {
|
|
598
|
-
case 'ascii':
|
|
599
|
-
case 'latin1':
|
|
600
|
-
case 'binary':
|
|
601
|
-
return len
|
|
602
|
-
case 'utf8':
|
|
603
|
-
case 'utf-8':
|
|
604
|
-
case undefined:
|
|
605
|
-
return utf8ToBytes(string).length
|
|
606
|
-
case 'ucs2':
|
|
607
|
-
case 'ucs-2':
|
|
608
|
-
case 'utf16le':
|
|
609
|
-
case 'utf-16le':
|
|
610
|
-
return len * 2
|
|
611
|
-
case 'hex':
|
|
612
|
-
return len >>> 1
|
|
613
|
-
case 'base64':
|
|
614
|
-
return base64ToBytes(string).length
|
|
615
|
-
default:
|
|
616
|
-
if (loweredCase) return utf8ToBytes(string).length // assume utf8
|
|
617
|
-
encoding = ('' + encoding).toLowerCase()
|
|
618
|
-
loweredCase = true
|
|
619
|
-
}
|
|
620
|
-
}
|
|
621
|
-
}
|
|
622
|
-
Buffer.byteLength = byteLength
|
|
623
|
-
|
|
624
|
-
function slowToString (encoding, start, end) {
|
|
625
|
-
var loweredCase = false
|
|
626
|
-
|
|
627
|
-
// No need to verify that "this.length <= MAX_UINT32" since it's a read-only
|
|
628
|
-
// property of a typed array.
|
|
629
|
-
|
|
630
|
-
// This behaves neither like String nor Uint8Array in that we set start/end
|
|
631
|
-
// to their upper/lower bounds if the value passed is out of range.
|
|
632
|
-
// undefined is handled specially as per ECMA-262 6th Edition,
|
|
633
|
-
// Section 13.3.3.7 Runtime Semantics: KeyedBindingInitialization.
|
|
634
|
-
if (start === undefined || start < 0) {
|
|
635
|
-
start = 0
|
|
636
|
-
}
|
|
637
|
-
// Return early if start > this.length. Done here to prevent potential uint32
|
|
638
|
-
// coercion fail below.
|
|
639
|
-
if (start > this.length) {
|
|
640
|
-
return ''
|
|
641
|
-
}
|
|
642
|
-
|
|
643
|
-
if (end === undefined || end > this.length) {
|
|
644
|
-
end = this.length
|
|
645
|
-
}
|
|
646
|
-
|
|
647
|
-
if (end <= 0) {
|
|
648
|
-
return ''
|
|
649
|
-
}
|
|
650
|
-
|
|
651
|
-
// Force coersion to uint32. This will also coerce falsey/NaN values to 0.
|
|
652
|
-
end >>>= 0
|
|
653
|
-
start >>>= 0
|
|
654
|
-
|
|
655
|
-
if (end <= start) {
|
|
656
|
-
return ''
|
|
657
|
-
}
|
|
658
|
-
|
|
659
|
-
if (!encoding) encoding = 'utf8'
|
|
660
|
-
|
|
661
|
-
while (true) {
|
|
662
|
-
switch (encoding) {
|
|
663
|
-
case 'hex':
|
|
664
|
-
return hexSlice(this, start, end)
|
|
665
|
-
|
|
666
|
-
case 'utf8':
|
|
667
|
-
case 'utf-8':
|
|
668
|
-
return utf8Slice(this, start, end)
|
|
669
|
-
|
|
670
|
-
case 'ascii':
|
|
671
|
-
return asciiSlice(this, start, end)
|
|
672
|
-
|
|
673
|
-
case 'latin1':
|
|
674
|
-
case 'binary':
|
|
675
|
-
return latin1Slice(this, start, end)
|
|
676
|
-
|
|
677
|
-
case 'base64':
|
|
678
|
-
return base64Slice(this, start, end)
|
|
679
|
-
|
|
680
|
-
case 'ucs2':
|
|
681
|
-
case 'ucs-2':
|
|
682
|
-
case 'utf16le':
|
|
683
|
-
case 'utf-16le':
|
|
684
|
-
return utf16leSlice(this, start, end)
|
|
685
|
-
|
|
686
|
-
default:
|
|
687
|
-
if (loweredCase) throw new TypeError('Unknown encoding: ' + encoding)
|
|
688
|
-
encoding = (encoding + '').toLowerCase()
|
|
689
|
-
loweredCase = true
|
|
690
|
-
}
|
|
691
|
-
}
|
|
692
|
-
}
|
|
693
|
-
|
|
694
|
-
// The property is used by `Buffer.isBuffer` and `is-buffer` (in Safari 5-7) to detect
|
|
695
|
-
// Buffer instances.
|
|
696
|
-
Buffer.prototype._isBuffer = true
|
|
697
|
-
|
|
698
|
-
function swap (b, n, m) {
|
|
699
|
-
var i = b[n]
|
|
700
|
-
b[n] = b[m]
|
|
701
|
-
b[m] = i
|
|
702
|
-
}
|
|
703
|
-
|
|
704
|
-
Buffer.prototype.swap16 = function swap16 () {
|
|
705
|
-
var len = this.length
|
|
706
|
-
if (len % 2 !== 0) {
|
|
707
|
-
throw new RangeError('Buffer size must be a multiple of 16-bits')
|
|
708
|
-
}
|
|
709
|
-
for (var i = 0; i < len; i += 2) {
|
|
710
|
-
swap(this, i, i + 1)
|
|
711
|
-
}
|
|
712
|
-
return this
|
|
713
|
-
}
|
|
714
|
-
|
|
715
|
-
Buffer.prototype.swap32 = function swap32 () {
|
|
716
|
-
var len = this.length
|
|
717
|
-
if (len % 4 !== 0) {
|
|
718
|
-
throw new RangeError('Buffer size must be a multiple of 32-bits')
|
|
719
|
-
}
|
|
720
|
-
for (var i = 0; i < len; i += 4) {
|
|
721
|
-
swap(this, i, i + 3)
|
|
722
|
-
swap(this, i + 1, i + 2)
|
|
723
|
-
}
|
|
724
|
-
return this
|
|
725
|
-
}
|
|
726
|
-
|
|
727
|
-
Buffer.prototype.swap64 = function swap64 () {
|
|
728
|
-
var len = this.length
|
|
729
|
-
if (len % 8 !== 0) {
|
|
730
|
-
throw new RangeError('Buffer size must be a multiple of 64-bits')
|
|
731
|
-
}
|
|
732
|
-
for (var i = 0; i < len; i += 8) {
|
|
733
|
-
swap(this, i, i + 7)
|
|
734
|
-
swap(this, i + 1, i + 6)
|
|
735
|
-
swap(this, i + 2, i + 5)
|
|
736
|
-
swap(this, i + 3, i + 4)
|
|
737
|
-
}
|
|
738
|
-
return this
|
|
739
|
-
}
|
|
740
|
-
|
|
741
|
-
Buffer.prototype.toString = function toString () {
|
|
742
|
-
var length = this.length | 0
|
|
743
|
-
if (length === 0) return ''
|
|
744
|
-
if (arguments.length === 0) return utf8Slice(this, 0, length)
|
|
745
|
-
return slowToString.apply(this, arguments)
|
|
746
|
-
}
|
|
747
|
-
|
|
748
|
-
Buffer.prototype.equals = function equals (b) {
|
|
749
|
-
if (!Buffer.isBuffer(b)) throw new TypeError('Argument must be a Buffer')
|
|
750
|
-
if (this === b) return true
|
|
751
|
-
return Buffer.compare(this, b) === 0
|
|
752
|
-
}
|
|
753
|
-
|
|
754
|
-
Buffer.prototype.inspect = function inspect () {
|
|
755
|
-
var str = ''
|
|
756
|
-
var max = exports.INSPECT_MAX_BYTES
|
|
757
|
-
if (this.length > 0) {
|
|
758
|
-
str = this.toString('hex', 0, max).match(/.{2}/g).join(' ')
|
|
759
|
-
if (this.length > max) str += ' ... '
|
|
760
|
-
}
|
|
761
|
-
return '<Buffer ' + str + '>'
|
|
762
|
-
}
|
|
763
|
-
|
|
764
|
-
Buffer.prototype.compare = function compare (target, start, end, thisStart, thisEnd) {
|
|
765
|
-
if (!Buffer.isBuffer(target)) {
|
|
766
|
-
throw new TypeError('Argument must be a Buffer')
|
|
767
|
-
}
|
|
768
|
-
|
|
769
|
-
if (start === undefined) {
|
|
770
|
-
start = 0
|
|
771
|
-
}
|
|
772
|
-
if (end === undefined) {
|
|
773
|
-
end = target ? target.length : 0
|
|
774
|
-
}
|
|
775
|
-
if (thisStart === undefined) {
|
|
776
|
-
thisStart = 0
|
|
777
|
-
}
|
|
778
|
-
if (thisEnd === undefined) {
|
|
779
|
-
thisEnd = this.length
|
|
780
|
-
}
|
|
781
|
-
|
|
782
|
-
if (start < 0 || end > target.length || thisStart < 0 || thisEnd > this.length) {
|
|
783
|
-
throw new RangeError('out of range index')
|
|
784
|
-
}
|
|
785
|
-
|
|
786
|
-
if (thisStart >= thisEnd && start >= end) {
|
|
787
|
-
return 0
|
|
788
|
-
}
|
|
789
|
-
if (thisStart >= thisEnd) {
|
|
790
|
-
return -1
|
|
791
|
-
}
|
|
792
|
-
if (start >= end) {
|
|
793
|
-
return 1
|
|
794
|
-
}
|
|
795
|
-
|
|
796
|
-
start >>>= 0
|
|
797
|
-
end >>>= 0
|
|
798
|
-
thisStart >>>= 0
|
|
799
|
-
thisEnd >>>= 0
|
|
800
|
-
|
|
801
|
-
if (this === target) return 0
|
|
802
|
-
|
|
803
|
-
var x = thisEnd - thisStart
|
|
804
|
-
var y = end - start
|
|
805
|
-
var len = Math.min(x, y)
|
|
806
|
-
|
|
807
|
-
var thisCopy = this.slice(thisStart, thisEnd)
|
|
808
|
-
var targetCopy = target.slice(start, end)
|
|
809
|
-
|
|
810
|
-
for (var i = 0; i < len; ++i) {
|
|
811
|
-
if (thisCopy[i] !== targetCopy[i]) {
|
|
812
|
-
x = thisCopy[i]
|
|
813
|
-
y = targetCopy[i]
|
|
814
|
-
break
|
|
815
|
-
}
|
|
816
|
-
}
|
|
817
|
-
|
|
818
|
-
if (x < y) return -1
|
|
819
|
-
if (y < x) return 1
|
|
820
|
-
return 0
|
|
821
|
-
}
|
|
822
|
-
|
|
823
|
-
// Finds either the first index of `val` in `buffer` at offset >= `byteOffset`,
|
|
824
|
-
// OR the last index of `val` in `buffer` at offset <= `byteOffset`.
|
|
825
|
-
//
|
|
826
|
-
// Arguments:
|
|
827
|
-
// - buffer - a Buffer to search
|
|
828
|
-
// - val - a string, Buffer, or number
|
|
829
|
-
// - byteOffset - an index into `buffer`; will be clamped to an int32
|
|
830
|
-
// - encoding - an optional encoding, relevant is val is a string
|
|
831
|
-
// - dir - true for indexOf, false for lastIndexOf
|
|
832
|
-
function bidirectionalIndexOf (buffer, val, byteOffset, encoding, dir) {
|
|
833
|
-
// Empty buffer means no match
|
|
834
|
-
if (buffer.length === 0) return -1
|
|
835
|
-
|
|
836
|
-
// Normalize byteOffset
|
|
837
|
-
if (typeof byteOffset === 'string') {
|
|
838
|
-
encoding = byteOffset
|
|
839
|
-
byteOffset = 0
|
|
840
|
-
} else if (byteOffset > 0x7fffffff) {
|
|
841
|
-
byteOffset = 0x7fffffff
|
|
842
|
-
} else if (byteOffset < -0x80000000) {
|
|
843
|
-
byteOffset = -0x80000000
|
|
844
|
-
}
|
|
845
|
-
byteOffset = +byteOffset // Coerce to Number.
|
|
846
|
-
if (isNaN(byteOffset)) {
|
|
847
|
-
// byteOffset: it it's undefined, null, NaN, "foo", etc, search whole buffer
|
|
848
|
-
byteOffset = dir ? 0 : (buffer.length - 1)
|
|
849
|
-
}
|
|
850
|
-
|
|
851
|
-
// Normalize byteOffset: negative offsets start from the end of the buffer
|
|
852
|
-
if (byteOffset < 0) byteOffset = buffer.length + byteOffset
|
|
853
|
-
if (byteOffset >= buffer.length) {
|
|
854
|
-
if (dir) return -1
|
|
855
|
-
else byteOffset = buffer.length - 1
|
|
856
|
-
} else if (byteOffset < 0) {
|
|
857
|
-
if (dir) byteOffset = 0
|
|
858
|
-
else return -1
|
|
859
|
-
}
|
|
860
|
-
|
|
861
|
-
// Normalize val
|
|
862
|
-
if (typeof val === 'string') {
|
|
863
|
-
val = Buffer.from(val, encoding)
|
|
864
|
-
}
|
|
865
|
-
|
|
866
|
-
// Finally, search either indexOf (if dir is true) or lastIndexOf
|
|
867
|
-
if (Buffer.isBuffer(val)) {
|
|
868
|
-
// Special case: looking for empty string/buffer always fails
|
|
869
|
-
if (val.length === 0) {
|
|
870
|
-
return -1
|
|
871
|
-
}
|
|
872
|
-
return arrayIndexOf(buffer, val, byteOffset, encoding, dir)
|
|
873
|
-
} else if (typeof val === 'number') {
|
|
874
|
-
val = val & 0xFF // Search for a byte value [0-255]
|
|
875
|
-
if (Buffer.TYPED_ARRAY_SUPPORT &&
|
|
876
|
-
typeof Uint8Array.prototype.indexOf === 'function') {
|
|
877
|
-
if (dir) {
|
|
878
|
-
return Uint8Array.prototype.indexOf.call(buffer, val, byteOffset)
|
|
879
|
-
} else {
|
|
880
|
-
return Uint8Array.prototype.lastIndexOf.call(buffer, val, byteOffset)
|
|
881
|
-
}
|
|
882
|
-
}
|
|
883
|
-
return arrayIndexOf(buffer, [ val ], byteOffset, encoding, dir)
|
|
884
|
-
}
|
|
885
|
-
|
|
886
|
-
throw new TypeError('val must be string, number or Buffer')
|
|
887
|
-
}
|
|
888
|
-
|
|
889
|
-
function arrayIndexOf (arr, val, byteOffset, encoding, dir) {
|
|
890
|
-
var indexSize = 1
|
|
891
|
-
var arrLength = arr.length
|
|
892
|
-
var valLength = val.length
|
|
893
|
-
|
|
894
|
-
if (encoding !== undefined) {
|
|
895
|
-
encoding = String(encoding).toLowerCase()
|
|
896
|
-
if (encoding === 'ucs2' || encoding === 'ucs-2' ||
|
|
897
|
-
encoding === 'utf16le' || encoding === 'utf-16le') {
|
|
898
|
-
if (arr.length < 2 || val.length < 2) {
|
|
899
|
-
return -1
|
|
900
|
-
}
|
|
901
|
-
indexSize = 2
|
|
902
|
-
arrLength /= 2
|
|
903
|
-
valLength /= 2
|
|
904
|
-
byteOffset /= 2
|
|
905
|
-
}
|
|
906
|
-
}
|
|
907
|
-
|
|
908
|
-
function read (buf, i) {
|
|
909
|
-
if (indexSize === 1) {
|
|
910
|
-
return buf[i]
|
|
911
|
-
} else {
|
|
912
|
-
return buf.readUInt16BE(i * indexSize)
|
|
913
|
-
}
|
|
914
|
-
}
|
|
915
|
-
|
|
916
|
-
var i
|
|
917
|
-
if (dir) {
|
|
918
|
-
var foundIndex = -1
|
|
919
|
-
for (i = byteOffset; i < arrLength; i++) {
|
|
920
|
-
if (read(arr, i) === read(val, foundIndex === -1 ? 0 : i - foundIndex)) {
|
|
921
|
-
if (foundIndex === -1) foundIndex = i
|
|
922
|
-
if (i - foundIndex + 1 === valLength) return foundIndex * indexSize
|
|
923
|
-
} else {
|
|
924
|
-
if (foundIndex !== -1) i -= i - foundIndex
|
|
925
|
-
foundIndex = -1
|
|
926
|
-
}
|
|
927
|
-
}
|
|
928
|
-
} else {
|
|
929
|
-
if (byteOffset + valLength > arrLength) byteOffset = arrLength - valLength
|
|
930
|
-
for (i = byteOffset; i >= 0; i--) {
|
|
931
|
-
var found = true
|
|
932
|
-
for (var j = 0; j < valLength; j++) {
|
|
933
|
-
if (read(arr, i + j) !== read(val, j)) {
|
|
934
|
-
found = false
|
|
935
|
-
break
|
|
936
|
-
}
|
|
937
|
-
}
|
|
938
|
-
if (found) return i
|
|
939
|
-
}
|
|
940
|
-
}
|
|
941
|
-
|
|
942
|
-
return -1
|
|
943
|
-
}
|
|
944
|
-
|
|
945
|
-
Buffer.prototype.includes = function includes (val, byteOffset, encoding) {
|
|
946
|
-
return this.indexOf(val, byteOffset, encoding) !== -1
|
|
947
|
-
}
|
|
948
|
-
|
|
949
|
-
Buffer.prototype.indexOf = function indexOf (val, byteOffset, encoding) {
|
|
950
|
-
return bidirectionalIndexOf(this, val, byteOffset, encoding, true)
|
|
951
|
-
}
|
|
952
|
-
|
|
953
|
-
Buffer.prototype.lastIndexOf = function lastIndexOf (val, byteOffset, encoding) {
|
|
954
|
-
return bidirectionalIndexOf(this, val, byteOffset, encoding, false)
|
|
955
|
-
}
|
|
956
|
-
|
|
957
|
-
function hexWrite (buf, string, offset, length) {
|
|
958
|
-
offset = Number(offset) || 0
|
|
959
|
-
var remaining = buf.length - offset
|
|
960
|
-
if (!length) {
|
|
961
|
-
length = remaining
|
|
962
|
-
} else {
|
|
963
|
-
length = Number(length)
|
|
964
|
-
if (length > remaining) {
|
|
965
|
-
length = remaining
|
|
966
|
-
}
|
|
967
|
-
}
|
|
968
|
-
|
|
969
|
-
// must be an even number of digits
|
|
970
|
-
var strLen = string.length
|
|
971
|
-
if (strLen % 2 !== 0) throw new TypeError('Invalid hex string')
|
|
972
|
-
|
|
973
|
-
if (length > strLen / 2) {
|
|
974
|
-
length = strLen / 2
|
|
975
|
-
}
|
|
976
|
-
for (var i = 0; i < length; ++i) {
|
|
977
|
-
var parsed = parseInt(string.substr(i * 2, 2), 16)
|
|
978
|
-
if (isNaN(parsed)) return i
|
|
979
|
-
buf[offset + i] = parsed
|
|
980
|
-
}
|
|
981
|
-
return i
|
|
982
|
-
}
|
|
983
|
-
|
|
984
|
-
function utf8Write (buf, string, offset, length) {
|
|
985
|
-
return blitBuffer(utf8ToBytes(string, buf.length - offset), buf, offset, length)
|
|
986
|
-
}
|
|
987
|
-
|
|
988
|
-
function asciiWrite (buf, string, offset, length) {
|
|
989
|
-
return blitBuffer(asciiToBytes(string), buf, offset, length)
|
|
990
|
-
}
|
|
991
|
-
|
|
992
|
-
function latin1Write (buf, string, offset, length) {
|
|
993
|
-
return asciiWrite(buf, string, offset, length)
|
|
994
|
-
}
|
|
995
|
-
|
|
996
|
-
function base64Write (buf, string, offset, length) {
|
|
997
|
-
return blitBuffer(base64ToBytes(string), buf, offset, length)
|
|
998
|
-
}
|
|
999
|
-
|
|
1000
|
-
function ucs2Write (buf, string, offset, length) {
|
|
1001
|
-
return blitBuffer(utf16leToBytes(string, buf.length - offset), buf, offset, length)
|
|
1002
|
-
}
|
|
1003
|
-
|
|
1004
|
-
Buffer.prototype.write = function write (string, offset, length, encoding) {
|
|
1005
|
-
// Buffer#write(string)
|
|
1006
|
-
if (offset === undefined) {
|
|
1007
|
-
encoding = 'utf8'
|
|
1008
|
-
length = this.length
|
|
1009
|
-
offset = 0
|
|
1010
|
-
// Buffer#write(string, encoding)
|
|
1011
|
-
} else if (length === undefined && typeof offset === 'string') {
|
|
1012
|
-
encoding = offset
|
|
1013
|
-
length = this.length
|
|
1014
|
-
offset = 0
|
|
1015
|
-
// Buffer#write(string, offset[, length][, encoding])
|
|
1016
|
-
} else if (isFinite(offset)) {
|
|
1017
|
-
offset = offset | 0
|
|
1018
|
-
if (isFinite(length)) {
|
|
1019
|
-
length = length | 0
|
|
1020
|
-
if (encoding === undefined) encoding = 'utf8'
|
|
1021
|
-
} else {
|
|
1022
|
-
encoding = length
|
|
1023
|
-
length = undefined
|
|
1024
|
-
}
|
|
1025
|
-
// legacy write(string, encoding, offset, length) - remove in v0.13
|
|
1026
|
-
} else {
|
|
1027
|
-
throw new Error(
|
|
1028
|
-
'Buffer.write(string, encoding, offset[, length]) is no longer supported'
|
|
1029
|
-
)
|
|
1030
|
-
}
|
|
1031
|
-
|
|
1032
|
-
var remaining = this.length - offset
|
|
1033
|
-
if (length === undefined || length > remaining) length = remaining
|
|
1034
|
-
|
|
1035
|
-
if ((string.length > 0 && (length < 0 || offset < 0)) || offset > this.length) {
|
|
1036
|
-
throw new RangeError('Attempt to write outside buffer bounds')
|
|
1037
|
-
}
|
|
1038
|
-
|
|
1039
|
-
if (!encoding) encoding = 'utf8'
|
|
1040
|
-
|
|
1041
|
-
var loweredCase = false
|
|
1042
|
-
for (;;) {
|
|
1043
|
-
switch (encoding) {
|
|
1044
|
-
case 'hex':
|
|
1045
|
-
return hexWrite(this, string, offset, length)
|
|
1046
|
-
|
|
1047
|
-
case 'utf8':
|
|
1048
|
-
case 'utf-8':
|
|
1049
|
-
return utf8Write(this, string, offset, length)
|
|
1050
|
-
|
|
1051
|
-
case 'ascii':
|
|
1052
|
-
return asciiWrite(this, string, offset, length)
|
|
1053
|
-
|
|
1054
|
-
case 'latin1':
|
|
1055
|
-
case 'binary':
|
|
1056
|
-
return latin1Write(this, string, offset, length)
|
|
1057
|
-
|
|
1058
|
-
case 'base64':
|
|
1059
|
-
// Warning: maxLength not taken into account in base64Write
|
|
1060
|
-
return base64Write(this, string, offset, length)
|
|
1061
|
-
|
|
1062
|
-
case 'ucs2':
|
|
1063
|
-
case 'ucs-2':
|
|
1064
|
-
case 'utf16le':
|
|
1065
|
-
case 'utf-16le':
|
|
1066
|
-
return ucs2Write(this, string, offset, length)
|
|
1067
|
-
|
|
1068
|
-
default:
|
|
1069
|
-
if (loweredCase) throw new TypeError('Unknown encoding: ' + encoding)
|
|
1070
|
-
encoding = ('' + encoding).toLowerCase()
|
|
1071
|
-
loweredCase = true
|
|
11
|
+
__webpack_require__.r(__webpack_exports__);
|
|
12
|
+
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "amplify_authenticator", function() { return AmplifyAuthenticator; });
|
|
13
|
+
/* harmony import */ var _index_83f2275b_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./index-83f2275b.js */ "../amplify-ui-components/dist/esm-es5/index-83f2275b.js");
|
|
14
|
+
/* harmony import */ var _aws_amplify_core__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @aws-amplify/core */ "@aws-amplify/core");
|
|
15
|
+
/* harmony import */ var _aws_amplify_core__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(_aws_amplify_core__WEBPACK_IMPORTED_MODULE_1__);
|
|
16
|
+
/* harmony import */ var _auth_types_78df304e_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./auth-types-78df304e.js */ "../amplify-ui-components/dist/esm-es5/auth-types-78df304e.js");
|
|
17
|
+
/* harmony import */ var _aws_amplify_auth__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! @aws-amplify/auth */ "@aws-amplify/auth");
|
|
18
|
+
/* harmony import */ var _aws_amplify_auth__WEBPACK_IMPORTED_MODULE_3___default = /*#__PURE__*/__webpack_require__.n(_aws_amplify_auth__WEBPACK_IMPORTED_MODULE_3__);
|
|
19
|
+
/* harmony import */ var _Translations_108d469f_js__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./Translations-108d469f.js */ "../amplify-ui-components/dist/esm-es5/Translations-108d469f.js");
|
|
20
|
+
/* harmony import */ var _constants_c8ecaa24_js__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ./constants-c8ecaa24.js */ "../amplify-ui-components/dist/esm-es5/constants-c8ecaa24.js");
|
|
21
|
+
/* harmony import */ var _helpers_14fcb50c_js__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ./helpers-14fcb50c.js */ "../amplify-ui-components/dist/esm-es5/helpers-14fcb50c.js");
|
|
22
|
+
/* harmony import */ var _auth_helpers_557b83fc_js__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ./auth-helpers-557b83fc.js */ "../amplify-ui-components/dist/esm-es5/auth-helpers-557b83fc.js");
|
|
23
|
+
var __awaiter = undefined && undefined.__awaiter || function (thisArg, _arguments, P, generator) {
|
|
24
|
+
function adopt(value) {
|
|
25
|
+
return value instanceof P ? value : new P(function (resolve) {
|
|
26
|
+
resolve(value);
|
|
27
|
+
});
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
31
|
+
function fulfilled(value) {
|
|
32
|
+
try {
|
|
33
|
+
step(generator.next(value));
|
|
34
|
+
} catch (e) {
|
|
35
|
+
reject(e);
|
|
36
|
+
}
|
|
1072
37
|
}
|
|
1073
|
-
}
|
|
1074
|
-
}
|
|
1075
38
|
|
|
1076
|
-
|
|
1077
|
-
|
|
1078
|
-
|
|
1079
|
-
|
|
1080
|
-
|
|
1081
|
-
}
|
|
1082
|
-
|
|
1083
|
-
function base64Slice (buf, start, end) {
|
|
1084
|
-
if (start === 0 && end === buf.length) {
|
|
1085
|
-
return base64.fromByteArray(buf)
|
|
1086
|
-
} else {
|
|
1087
|
-
return base64.fromByteArray(buf.slice(start, end))
|
|
1088
|
-
}
|
|
1089
|
-
}
|
|
1090
|
-
|
|
1091
|
-
function utf8Slice (buf, start, end) {
|
|
1092
|
-
end = Math.min(buf.length, end)
|
|
1093
|
-
var res = []
|
|
1094
|
-
|
|
1095
|
-
var i = start
|
|
1096
|
-
while (i < end) {
|
|
1097
|
-
var firstByte = buf[i]
|
|
1098
|
-
var codePoint = null
|
|
1099
|
-
var bytesPerSequence = (firstByte > 0xEF) ? 4
|
|
1100
|
-
: (firstByte > 0xDF) ? 3
|
|
1101
|
-
: (firstByte > 0xBF) ? 2
|
|
1102
|
-
: 1
|
|
1103
|
-
|
|
1104
|
-
if (i + bytesPerSequence <= end) {
|
|
1105
|
-
var secondByte, thirdByte, fourthByte, tempCodePoint
|
|
1106
|
-
|
|
1107
|
-
switch (bytesPerSequence) {
|
|
1108
|
-
case 1:
|
|
1109
|
-
if (firstByte < 0x80) {
|
|
1110
|
-
codePoint = firstByte
|
|
1111
|
-
}
|
|
1112
|
-
break
|
|
1113
|
-
case 2:
|
|
1114
|
-
secondByte = buf[i + 1]
|
|
1115
|
-
if ((secondByte & 0xC0) === 0x80) {
|
|
1116
|
-
tempCodePoint = (firstByte & 0x1F) << 0x6 | (secondByte & 0x3F)
|
|
1117
|
-
if (tempCodePoint > 0x7F) {
|
|
1118
|
-
codePoint = tempCodePoint
|
|
1119
|
-
}
|
|
1120
|
-
}
|
|
1121
|
-
break
|
|
1122
|
-
case 3:
|
|
1123
|
-
secondByte = buf[i + 1]
|
|
1124
|
-
thirdByte = buf[i + 2]
|
|
1125
|
-
if ((secondByte & 0xC0) === 0x80 && (thirdByte & 0xC0) === 0x80) {
|
|
1126
|
-
tempCodePoint = (firstByte & 0xF) << 0xC | (secondByte & 0x3F) << 0x6 | (thirdByte & 0x3F)
|
|
1127
|
-
if (tempCodePoint > 0x7FF && (tempCodePoint < 0xD800 || tempCodePoint > 0xDFFF)) {
|
|
1128
|
-
codePoint = tempCodePoint
|
|
1129
|
-
}
|
|
1130
|
-
}
|
|
1131
|
-
break
|
|
1132
|
-
case 4:
|
|
1133
|
-
secondByte = buf[i + 1]
|
|
1134
|
-
thirdByte = buf[i + 2]
|
|
1135
|
-
fourthByte = buf[i + 3]
|
|
1136
|
-
if ((secondByte & 0xC0) === 0x80 && (thirdByte & 0xC0) === 0x80 && (fourthByte & 0xC0) === 0x80) {
|
|
1137
|
-
tempCodePoint = (firstByte & 0xF) << 0x12 | (secondByte & 0x3F) << 0xC | (thirdByte & 0x3F) << 0x6 | (fourthByte & 0x3F)
|
|
1138
|
-
if (tempCodePoint > 0xFFFF && tempCodePoint < 0x110000) {
|
|
1139
|
-
codePoint = tempCodePoint
|
|
1140
|
-
}
|
|
1141
|
-
}
|
|
39
|
+
function rejected(value) {
|
|
40
|
+
try {
|
|
41
|
+
step(generator["throw"](value));
|
|
42
|
+
} catch (e) {
|
|
43
|
+
reject(e);
|
|
1142
44
|
}
|
|
1143
45
|
}
|
|
1144
46
|
|
|
1145
|
-
|
|
1146
|
-
|
|
1147
|
-
// replacement char (U+FFFD) and advance only 1 byte
|
|
1148
|
-
codePoint = 0xFFFD
|
|
1149
|
-
bytesPerSequence = 1
|
|
1150
|
-
} else if (codePoint > 0xFFFF) {
|
|
1151
|
-
// encode to utf16 (surrogate pair dance)
|
|
1152
|
-
codePoint -= 0x10000
|
|
1153
|
-
res.push(codePoint >>> 10 & 0x3FF | 0xD800)
|
|
1154
|
-
codePoint = 0xDC00 | codePoint & 0x3FF
|
|
47
|
+
function step(result) {
|
|
48
|
+
result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected);
|
|
1155
49
|
}
|
|
1156
50
|
|
|
1157
|
-
|
|
1158
|
-
|
|
1159
|
-
|
|
1160
|
-
|
|
1161
|
-
return decodeCodePointsArray(res)
|
|
1162
|
-
}
|
|
1163
|
-
|
|
1164
|
-
// Based on http://stackoverflow.com/a/22747272/680742, the browser with
|
|
1165
|
-
// the lowest limit is Chrome, with 0x10000 args.
|
|
1166
|
-
// We go 1 magnitude less, for safety
|
|
1167
|
-
var MAX_ARGUMENTS_LENGTH = 0x1000
|
|
1168
|
-
|
|
1169
|
-
function decodeCodePointsArray (codePoints) {
|
|
1170
|
-
var len = codePoints.length
|
|
1171
|
-
if (len <= MAX_ARGUMENTS_LENGTH) {
|
|
1172
|
-
return String.fromCharCode.apply(String, codePoints) // avoid extra slice()
|
|
1173
|
-
}
|
|
1174
|
-
|
|
1175
|
-
// Decode in chunks to avoid "call stack size exceeded".
|
|
1176
|
-
var res = ''
|
|
1177
|
-
var i = 0
|
|
1178
|
-
while (i < len) {
|
|
1179
|
-
res += String.fromCharCode.apply(
|
|
1180
|
-
String,
|
|
1181
|
-
codePoints.slice(i, i += MAX_ARGUMENTS_LENGTH)
|
|
1182
|
-
)
|
|
1183
|
-
}
|
|
1184
|
-
return res
|
|
1185
|
-
}
|
|
1186
|
-
|
|
1187
|
-
function asciiSlice (buf, start, end) {
|
|
1188
|
-
var ret = ''
|
|
1189
|
-
end = Math.min(buf.length, end)
|
|
1190
|
-
|
|
1191
|
-
for (var i = start; i < end; ++i) {
|
|
1192
|
-
ret += String.fromCharCode(buf[i] & 0x7F)
|
|
1193
|
-
}
|
|
1194
|
-
return ret
|
|
1195
|
-
}
|
|
51
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
52
|
+
});
|
|
53
|
+
};
|
|
1196
54
|
|
|
1197
|
-
function
|
|
1198
|
-
var
|
|
1199
|
-
|
|
55
|
+
var __generator = undefined && undefined.__generator || function (thisArg, body) {
|
|
56
|
+
var _ = {
|
|
57
|
+
label: 0,
|
|
58
|
+
sent: function sent() {
|
|
59
|
+
if (t[0] & 1) throw t[1];
|
|
60
|
+
return t[1];
|
|
61
|
+
},
|
|
62
|
+
trys: [],
|
|
63
|
+
ops: []
|
|
64
|
+
},
|
|
65
|
+
f,
|
|
66
|
+
y,
|
|
67
|
+
t,
|
|
68
|
+
g;
|
|
69
|
+
return g = {
|
|
70
|
+
next: verb(0),
|
|
71
|
+
"throw": verb(1),
|
|
72
|
+
"return": verb(2)
|
|
73
|
+
}, typeof Symbol === "function" && (g[Symbol.iterator] = function () {
|
|
74
|
+
return this;
|
|
75
|
+
}), g;
|
|
76
|
+
|
|
77
|
+
function verb(n) {
|
|
78
|
+
return function (v) {
|
|
79
|
+
return step([n, v]);
|
|
80
|
+
};
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
function step(op) {
|
|
84
|
+
if (f) throw new TypeError("Generator is already executing.");
|
|
85
|
+
|
|
86
|
+
while (_) {
|
|
87
|
+
try {
|
|
88
|
+
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
|
|
89
|
+
if (y = 0, t) op = [op[0] & 2, t.value];
|
|
90
|
+
|
|
91
|
+
switch (op[0]) {
|
|
92
|
+
case 0:
|
|
93
|
+
case 1:
|
|
94
|
+
t = op;
|
|
95
|
+
break;
|
|
96
|
+
|
|
97
|
+
case 4:
|
|
98
|
+
_.label++;
|
|
99
|
+
return {
|
|
100
|
+
value: op[1],
|
|
101
|
+
done: false
|
|
102
|
+
};
|
|
103
|
+
|
|
104
|
+
case 5:
|
|
105
|
+
_.label++;
|
|
106
|
+
y = op[1];
|
|
107
|
+
op = [0];
|
|
108
|
+
continue;
|
|
109
|
+
|
|
110
|
+
case 7:
|
|
111
|
+
op = _.ops.pop();
|
|
112
|
+
|
|
113
|
+
_.trys.pop();
|
|
114
|
+
|
|
115
|
+
continue;
|
|
116
|
+
|
|
117
|
+
default:
|
|
118
|
+
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) {
|
|
119
|
+
_ = 0;
|
|
120
|
+
continue;
|
|
121
|
+
}
|
|
1200
122
|
|
|
1201
|
-
|
|
1202
|
-
|
|
1203
|
-
|
|
1204
|
-
|
|
1205
|
-
}
|
|
123
|
+
if (op[0] === 3 && (!t || op[1] > t[0] && op[1] < t[3])) {
|
|
124
|
+
_.label = op[1];
|
|
125
|
+
break;
|
|
126
|
+
}
|
|
1206
127
|
|
|
1207
|
-
|
|
1208
|
-
|
|
128
|
+
if (op[0] === 6 && _.label < t[1]) {
|
|
129
|
+
_.label = t[1];
|
|
130
|
+
t = op;
|
|
131
|
+
break;
|
|
132
|
+
}
|
|
1209
133
|
|
|
1210
|
-
|
|
1211
|
-
|
|
134
|
+
if (t && _.label < t[2]) {
|
|
135
|
+
_.label = t[2];
|
|
1212
136
|
|
|
1213
|
-
|
|
1214
|
-
for (var i = start; i < end; ++i) {
|
|
1215
|
-
out += toHex(buf[i])
|
|
1216
|
-
}
|
|
1217
|
-
return out
|
|
1218
|
-
}
|
|
137
|
+
_.ops.push(op);
|
|
1219
138
|
|
|
1220
|
-
|
|
1221
|
-
|
|
1222
|
-
var res = ''
|
|
1223
|
-
for (var i = 0; i < bytes.length; i += 2) {
|
|
1224
|
-
res += String.fromCharCode(bytes[i] + bytes[i + 1] * 256)
|
|
1225
|
-
}
|
|
1226
|
-
return res
|
|
1227
|
-
}
|
|
139
|
+
break;
|
|
140
|
+
}
|
|
1228
141
|
|
|
1229
|
-
|
|
1230
|
-
var len = this.length
|
|
1231
|
-
start = ~~start
|
|
1232
|
-
end = end === undefined ? len : ~~end
|
|
142
|
+
if (t[2]) _.ops.pop();
|
|
1233
143
|
|
|
1234
|
-
|
|
1235
|
-
start += len
|
|
1236
|
-
if (start < 0) start = 0
|
|
1237
|
-
} else if (start > len) {
|
|
1238
|
-
start = len
|
|
1239
|
-
}
|
|
144
|
+
_.trys.pop();
|
|
1240
145
|
|
|
1241
|
-
|
|
1242
|
-
|
|
1243
|
-
if (end < 0) end = 0
|
|
1244
|
-
} else if (end > len) {
|
|
1245
|
-
end = len
|
|
1246
|
-
}
|
|
146
|
+
continue;
|
|
147
|
+
}
|
|
1247
148
|
|
|
1248
|
-
|
|
1249
|
-
|
|
1250
|
-
|
|
1251
|
-
|
|
1252
|
-
|
|
1253
|
-
|
|
1254
|
-
|
|
1255
|
-
var sliceLen = end - start
|
|
1256
|
-
newBuf = new Buffer(sliceLen, undefined)
|
|
1257
|
-
for (var i = 0; i < sliceLen; ++i) {
|
|
1258
|
-
newBuf[i] = this[i + start]
|
|
149
|
+
op = body.call(thisArg, _);
|
|
150
|
+
} catch (e) {
|
|
151
|
+
op = [6, e];
|
|
152
|
+
y = 0;
|
|
153
|
+
} finally {
|
|
154
|
+
f = t = 0;
|
|
155
|
+
}
|
|
1259
156
|
}
|
|
1260
|
-
}
|
|
1261
|
-
|
|
1262
|
-
return newBuf
|
|
1263
|
-
}
|
|
1264
|
-
|
|
1265
|
-
/*
|
|
1266
|
-
* Need to make sure that buffer isn't trying to write out of bounds.
|
|
1267
|
-
*/
|
|
1268
|
-
function checkOffset (offset, ext, length) {
|
|
1269
|
-
if ((offset % 1) !== 0 || offset < 0) throw new RangeError('offset is not uint')
|
|
1270
|
-
if (offset + ext > length) throw new RangeError('Trying to access beyond buffer length')
|
|
1271
|
-
}
|
|
1272
|
-
|
|
1273
|
-
Buffer.prototype.readUIntLE = function readUIntLE (offset, byteLength, noAssert) {
|
|
1274
|
-
offset = offset | 0
|
|
1275
|
-
byteLength = byteLength | 0
|
|
1276
|
-
if (!noAssert) checkOffset(offset, byteLength, this.length)
|
|
1277
|
-
|
|
1278
|
-
var val = this[offset]
|
|
1279
|
-
var mul = 1
|
|
1280
|
-
var i = 0
|
|
1281
|
-
while (++i < byteLength && (mul *= 0x100)) {
|
|
1282
|
-
val += this[offset + i] * mul
|
|
1283
|
-
}
|
|
1284
|
-
|
|
1285
|
-
return val
|
|
1286
|
-
}
|
|
1287
|
-
|
|
1288
|
-
Buffer.prototype.readUIntBE = function readUIntBE (offset, byteLength, noAssert) {
|
|
1289
|
-
offset = offset | 0
|
|
1290
|
-
byteLength = byteLength | 0
|
|
1291
|
-
if (!noAssert) {
|
|
1292
|
-
checkOffset(offset, byteLength, this.length)
|
|
1293
|
-
}
|
|
1294
|
-
|
|
1295
|
-
var val = this[offset + --byteLength]
|
|
1296
|
-
var mul = 1
|
|
1297
|
-
while (byteLength > 0 && (mul *= 0x100)) {
|
|
1298
|
-
val += this[offset + --byteLength] * mul
|
|
1299
|
-
}
|
|
1300
|
-
|
|
1301
|
-
return val
|
|
1302
|
-
}
|
|
1303
157
|
|
|
1304
|
-
|
|
1305
|
-
|
|
1306
|
-
|
|
1307
|
-
|
|
1308
|
-
|
|
1309
|
-
Buffer.prototype.readUInt16LE = function readUInt16LE (offset, noAssert) {
|
|
1310
|
-
if (!noAssert) checkOffset(offset, 2, this.length)
|
|
1311
|
-
return this[offset] | (this[offset + 1] << 8)
|
|
1312
|
-
}
|
|
1313
|
-
|
|
1314
|
-
Buffer.prototype.readUInt16BE = function readUInt16BE (offset, noAssert) {
|
|
1315
|
-
if (!noAssert) checkOffset(offset, 2, this.length)
|
|
1316
|
-
return (this[offset] << 8) | this[offset + 1]
|
|
1317
|
-
}
|
|
1318
|
-
|
|
1319
|
-
Buffer.prototype.readUInt32LE = function readUInt32LE (offset, noAssert) {
|
|
1320
|
-
if (!noAssert) checkOffset(offset, 4, this.length)
|
|
1321
|
-
|
|
1322
|
-
return ((this[offset]) |
|
|
1323
|
-
(this[offset + 1] << 8) |
|
|
1324
|
-
(this[offset + 2] << 16)) +
|
|
1325
|
-
(this[offset + 3] * 0x1000000)
|
|
1326
|
-
}
|
|
1327
|
-
|
|
1328
|
-
Buffer.prototype.readUInt32BE = function readUInt32BE (offset, noAssert) {
|
|
1329
|
-
if (!noAssert) checkOffset(offset, 4, this.length)
|
|
1330
|
-
|
|
1331
|
-
return (this[offset] * 0x1000000) +
|
|
1332
|
-
((this[offset + 1] << 16) |
|
|
1333
|
-
(this[offset + 2] << 8) |
|
|
1334
|
-
this[offset + 3])
|
|
1335
|
-
}
|
|
1336
|
-
|
|
1337
|
-
Buffer.prototype.readIntLE = function readIntLE (offset, byteLength, noAssert) {
|
|
1338
|
-
offset = offset | 0
|
|
1339
|
-
byteLength = byteLength | 0
|
|
1340
|
-
if (!noAssert) checkOffset(offset, byteLength, this.length)
|
|
1341
|
-
|
|
1342
|
-
var val = this[offset]
|
|
1343
|
-
var mul = 1
|
|
1344
|
-
var i = 0
|
|
1345
|
-
while (++i < byteLength && (mul *= 0x100)) {
|
|
1346
|
-
val += this[offset + i] * mul
|
|
158
|
+
if (op[0] & 5) throw op[1];
|
|
159
|
+
return {
|
|
160
|
+
value: op[0] ? op[1] : void 0,
|
|
161
|
+
done: true
|
|
162
|
+
};
|
|
1347
163
|
}
|
|
1348
|
-
|
|
1349
|
-
|
|
1350
|
-
if (val >= mul) val -= Math.pow(2, 8 * byteLength)
|
|
1351
|
-
|
|
1352
|
-
return val
|
|
1353
|
-
}
|
|
164
|
+
};
|
|
1354
165
|
|
|
1355
|
-
|
|
1356
|
-
offset = offset | 0
|
|
1357
|
-
byteLength = byteLength | 0
|
|
1358
|
-
if (!noAssert) checkOffset(offset, byteLength, this.length)
|
|
166
|
+
var _a;
|
|
1359
167
|
|
|
1360
|
-
var i = byteLength
|
|
1361
|
-
var mul = 1
|
|
1362
|
-
var val = this[offset + --i]
|
|
1363
|
-
while (i > 0 && (mul *= 0x100)) {
|
|
1364
|
-
val += this[offset + --i] * mul
|
|
1365
|
-
}
|
|
1366
|
-
mul *= 0x80
|
|
1367
168
|
|
|
1368
|
-
if (val >= mul) val -= Math.pow(2, 8 * byteLength)
|
|
1369
169
|
|
|
1370
|
-
return val
|
|
1371
|
-
}
|
|
1372
170
|
|
|
1373
|
-
Buffer.prototype.readInt8 = function readInt8 (offset, noAssert) {
|
|
1374
|
-
if (!noAssert) checkOffset(offset, 1, this.length)
|
|
1375
|
-
if (!(this[offset] & 0x80)) return (this[offset])
|
|
1376
|
-
return ((0xff - this[offset] + 1) * -1)
|
|
1377
|
-
}
|
|
1378
171
|
|
|
1379
|
-
Buffer.prototype.readInt16LE = function readInt16LE (offset, noAssert) {
|
|
1380
|
-
if (!noAssert) checkOffset(offset, 2, this.length)
|
|
1381
|
-
var val = this[offset] | (this[offset + 1] << 8)
|
|
1382
|
-
return (val & 0x8000) ? val | 0xFFFF0000 : val
|
|
1383
|
-
}
|
|
1384
172
|
|
|
1385
|
-
Buffer.prototype.readInt16BE = function readInt16BE (offset, noAssert) {
|
|
1386
|
-
if (!noAssert) checkOffset(offset, 2, this.length)
|
|
1387
|
-
var val = this[offset + 1] | (this[offset] << 8)
|
|
1388
|
-
return (val & 0x8000) ? val | 0xFFFF0000 : val
|
|
1389
|
-
}
|
|
1390
173
|
|
|
1391
|
-
Buffer.prototype.readInt32LE = function readInt32LE (offset, noAssert) {
|
|
1392
|
-
if (!noAssert) checkOffset(offset, 4, this.length)
|
|
1393
174
|
|
|
1394
|
-
return (this[offset]) |
|
|
1395
|
-
(this[offset + 1] << 8) |
|
|
1396
|
-
(this[offset + 2] << 16) |
|
|
1397
|
-
(this[offset + 3] << 24)
|
|
1398
|
-
}
|
|
1399
175
|
|
|
1400
|
-
|
|
1401
|
-
|
|
176
|
+
var authSlotNames = (_a = {}, _a[_auth_types_78df304e_js__WEBPACK_IMPORTED_MODULE_2__["A"].SignIn] = 'sign-in', _a[_auth_types_78df304e_js__WEBPACK_IMPORTED_MODULE_2__["A"].ConfirmSignIn] = 'confirm-sign-in', _a[_auth_types_78df304e_js__WEBPACK_IMPORTED_MODULE_2__["A"].SignUp] = 'sign-up', _a[_auth_types_78df304e_js__WEBPACK_IMPORTED_MODULE_2__["A"].ConfirmSignUp] = 'confirm-sign-up', _a[_auth_types_78df304e_js__WEBPACK_IMPORTED_MODULE_2__["A"].ForgotPassword] = 'forgot-password', _a[_auth_types_78df304e_js__WEBPACK_IMPORTED_MODULE_2__["A"].ResetPassword] = 'require-new-password', _a[_auth_types_78df304e_js__WEBPACK_IMPORTED_MODULE_2__["A"].VerifyContact] = 'verify-contact', _a[_auth_types_78df304e_js__WEBPACK_IMPORTED_MODULE_2__["A"].TOTPSetup] = 'totp-setup', _a[_auth_types_78df304e_js__WEBPACK_IMPORTED_MODULE_2__["A"].Loading] = 'loading', _a);
|
|
177
|
+
var amplifyAuthenticatorCss = ":host{--background-color:var(--amplify-background-color);--width:28.75rem;--min-width:20rem;-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale;--box-shadow:1px 1px 4px 0 rgba(0, 0, 0, 0.15);--border-radius:6px;--padding:35px 40px;--margin-bottom:20px;--container-height:100vh;--container-display:flex;--container-justify:center;--container-align:center}.auth-container{display:var(--container-display);-ms-flex-pack:var(--container-justify);justify-content:var(--container-justify);-ms-flex-align:var(--container-align);align-items:var(--container-align);min-height:var(--container-height)}";
|
|
178
|
+
var logger = new _aws_amplify_core__WEBPACK_IMPORTED_MODULE_1__["Logger"]('Authenticator');
|
|
1402
179
|
|
|
1403
|
-
|
|
1404
|
-
|
|
1405
|
-
|
|
1406
|
-
|
|
1407
|
-
|
|
180
|
+
var AmplifyAuthenticator =
|
|
181
|
+
/** @class */
|
|
182
|
+
function () {
|
|
183
|
+
function class_1(hostRef) {
|
|
184
|
+
var _this = this;
|
|
1408
185
|
|
|
1409
|
-
|
|
1410
|
-
|
|
1411
|
-
return ieee754.read(this, offset, true, 23, 4)
|
|
1412
|
-
}
|
|
186
|
+
Object(_index_83f2275b_js__WEBPACK_IMPORTED_MODULE_0__["r"])(this, hostRef);
|
|
187
|
+
/** Initial starting state of the Authenticator component. E.g. If `signup` is passed the default component is set to AmplifySignUp */
|
|
1413
188
|
|
|
1414
|
-
|
|
1415
|
-
|
|
1416
|
-
return ieee754.read(this, offset, false, 23, 4)
|
|
1417
|
-
}
|
|
189
|
+
this.initialAuthState = _auth_types_78df304e_js__WEBPACK_IMPORTED_MODULE_2__["A"].SignIn;
|
|
190
|
+
/** Callback for Authenticator state machine changes */
|
|
1418
191
|
|
|
1419
|
-
|
|
1420
|
-
|
|
1421
|
-
return ieee754.read(this, offset, true, 52, 8)
|
|
1422
|
-
}
|
|
192
|
+
this.handleAuthStateChange = function () {};
|
|
193
|
+
/** Hide amplify-toast for auth errors */
|
|
1423
194
|
|
|
1424
|
-
Buffer.prototype.readDoubleBE = function readDoubleBE (offset, noAssert) {
|
|
1425
|
-
if (!noAssert) checkOffset(offset, 8, this.length)
|
|
1426
|
-
return ieee754.read(this, offset, false, 52, 8)
|
|
1427
|
-
}
|
|
1428
195
|
|
|
1429
|
-
|
|
1430
|
-
|
|
1431
|
-
|
|
1432
|
-
if (offset + ext > buf.length) throw new RangeError('Index out of range')
|
|
1433
|
-
}
|
|
196
|
+
this.hideToast = false;
|
|
197
|
+
this.authState = _auth_types_78df304e_js__WEBPACK_IMPORTED_MODULE_2__["A"].Loading;
|
|
198
|
+
this.toastMessage = '';
|
|
1434
199
|
|
|
1435
|
-
|
|
1436
|
-
|
|
1437
|
-
offset = offset | 0
|
|
1438
|
-
byteLength = byteLength | 0
|
|
1439
|
-
if (!noAssert) {
|
|
1440
|
-
var maxBytes = Math.pow(2, 8 * byteLength) - 1
|
|
1441
|
-
checkInt(this, value, offset, byteLength, maxBytes, 0)
|
|
1442
|
-
}
|
|
200
|
+
this.handleExternalAuthEvent = function (_a) {
|
|
201
|
+
var payload = _a.payload;
|
|
1443
202
|
|
|
1444
|
-
|
|
1445
|
-
|
|
1446
|
-
|
|
1447
|
-
|
|
1448
|
-
|
|
1449
|
-
}
|
|
203
|
+
switch (payload.event) {
|
|
204
|
+
case 'cognitoHostedUI':
|
|
205
|
+
case 'signIn':
|
|
206
|
+
Object(_auth_helpers_557b83fc_js__WEBPACK_IMPORTED_MODULE_7__["c"])(payload.data, _helpers_14fcb50c_js__WEBPACK_IMPORTED_MODULE_6__["d"]);
|
|
207
|
+
break;
|
|
1450
208
|
|
|
1451
|
-
|
|
1452
|
-
|
|
209
|
+
case 'cognitoHostedUI_failure':
|
|
210
|
+
case 'parsingUrl_failure':
|
|
211
|
+
case 'signOut':
|
|
212
|
+
case 'customGreetingSignOut':
|
|
213
|
+
return Object(_helpers_14fcb50c_js__WEBPACK_IMPORTED_MODULE_6__["d"])(_this.initialAuthState);
|
|
214
|
+
}
|
|
215
|
+
};
|
|
1453
216
|
|
|
1454
|
-
|
|
1455
|
-
|
|
1456
|
-
offset = offset | 0
|
|
1457
|
-
byteLength = byteLength | 0
|
|
1458
|
-
if (!noAssert) {
|
|
1459
|
-
var maxBytes = Math.pow(2, 8 * byteLength) - 1
|
|
1460
|
-
checkInt(this, value, offset, byteLength, maxBytes, 0)
|
|
1461
|
-
}
|
|
217
|
+
this.handleToastEvent = function (_a) {
|
|
218
|
+
var payload = _a.payload;
|
|
1462
219
|
|
|
1463
|
-
|
|
1464
|
-
|
|
1465
|
-
|
|
1466
|
-
|
|
1467
|
-
|
|
1468
|
-
|
|
220
|
+
switch (payload.event) {
|
|
221
|
+
case _constants_c8ecaa24_js__WEBPACK_IMPORTED_MODULE_5__["T"]:
|
|
222
|
+
if (payload.message) _this.toastMessage = payload.message;
|
|
223
|
+
break;
|
|
224
|
+
}
|
|
225
|
+
};
|
|
226
|
+
}
|
|
227
|
+
|
|
228
|
+
class_1.prototype.componentWillLoad = function () {
|
|
229
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
230
|
+
var _this = this;
|
|
231
|
+
|
|
232
|
+
return __generator(this, function (_a) {
|
|
233
|
+
switch (_a.label) {
|
|
234
|
+
case 0:
|
|
235
|
+
console.warn('Version `1.x` of Amplify UI has been deprecated and will be removed in a future major version of `aws-amplify`. Please visit https://ui.docs.amplify.aws/ for the current version of Amplify UI.');
|
|
236
|
+
Object(_helpers_14fcb50c_js__WEBPACK_IMPORTED_MODULE_6__["o"])(function (authState, authData) {
|
|
237
|
+
_this.onAuthStateChange(authState, authData);
|
|
238
|
+
|
|
239
|
+
_this.toastMessage = '';
|
|
240
|
+
});
|
|
241
|
+
if (!this.hideToast) _aws_amplify_core__WEBPACK_IMPORTED_MODULE_1__["Hub"].listen(_constants_c8ecaa24_js__WEBPACK_IMPORTED_MODULE_5__["U"], this.handleToastEvent);
|
|
242
|
+
_aws_amplify_core__WEBPACK_IMPORTED_MODULE_1__["Hub"].listen(_constants_c8ecaa24_js__WEBPACK_IMPORTED_MODULE_5__["A"], this.handleExternalAuthEvent);
|
|
243
|
+
Object(_aws_amplify_auth__WEBPACK_IMPORTED_MODULE_3__["appendToCognitoUserAgent"])('amplify-authenticator');
|
|
244
|
+
return [4
|
|
245
|
+
/*yield*/
|
|
246
|
+
, this.checkUser()];
|
|
247
|
+
|
|
248
|
+
case 1:
|
|
249
|
+
_a.sent();
|
|
250
|
+
|
|
251
|
+
return [2
|
|
252
|
+
/*return*/
|
|
253
|
+
];
|
|
254
|
+
}
|
|
255
|
+
});
|
|
256
|
+
});
|
|
257
|
+
};
|
|
1469
258
|
|
|
1470
|
-
|
|
1471
|
-
|
|
259
|
+
class_1.prototype.checkUser = function () {
|
|
260
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
261
|
+
var _this = this;
|
|
1472
262
|
|
|
1473
|
-
|
|
1474
|
-
|
|
1475
|
-
|
|
1476
|
-
|
|
1477
|
-
if (!Buffer.TYPED_ARRAY_SUPPORT) value = Math.floor(value)
|
|
1478
|
-
this[offset] = (value & 0xff)
|
|
1479
|
-
return offset + 1
|
|
1480
|
-
}
|
|
263
|
+
return __generator(this, function (_a) {
|
|
264
|
+
if (!_aws_amplify_auth__WEBPACK_IMPORTED_MODULE_3__["Auth"] || typeof _aws_amplify_auth__WEBPACK_IMPORTED_MODULE_3__["Auth"].currentAuthenticatedUser !== 'function') {
|
|
265
|
+
throw new Error(_constants_c8ecaa24_js__WEBPACK_IMPORTED_MODULE_5__["N"]);
|
|
266
|
+
}
|
|
1481
267
|
|
|
1482
|
-
|
|
1483
|
-
|
|
1484
|
-
|
|
1485
|
-
|
|
1486
|
-
|
|
1487
|
-
|
|
1488
|
-
}
|
|
268
|
+
return [2
|
|
269
|
+
/*return*/
|
|
270
|
+
, _aws_amplify_auth__WEBPACK_IMPORTED_MODULE_3__["Auth"].currentAuthenticatedUser().then(function (user) {
|
|
271
|
+
Object(_helpers_14fcb50c_js__WEBPACK_IMPORTED_MODULE_6__["d"])(_auth_types_78df304e_js__WEBPACK_IMPORTED_MODULE_2__["A"].SignedIn, user);
|
|
272
|
+
})["catch"](function () {
|
|
273
|
+
Object(_helpers_14fcb50c_js__WEBPACK_IMPORTED_MODULE_6__["d"])(_this.initialAuthState);
|
|
274
|
+
})];
|
|
275
|
+
});
|
|
276
|
+
});
|
|
277
|
+
};
|
|
278
|
+
|
|
279
|
+
class_1.prototype.onAuthStateChange = function (nextAuthState, data) {
|
|
280
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
281
|
+
return __generator(this, function (_a) {
|
|
282
|
+
if (nextAuthState === undefined) return [2
|
|
283
|
+
/*return*/
|
|
284
|
+
, logger.error('nextAuthState cannot be undefined')];
|
|
285
|
+
logger.info('Inside onAuthStateChange Method current authState:', this.authState);
|
|
286
|
+
|
|
287
|
+
if (nextAuthState === _auth_types_78df304e_js__WEBPACK_IMPORTED_MODULE_2__["A"].SignedOut) {
|
|
288
|
+
this.authState = this.initialAuthState;
|
|
289
|
+
} else {
|
|
290
|
+
this.authState = nextAuthState;
|
|
291
|
+
}
|
|
1489
292
|
|
|
1490
|
-
|
|
1491
|
-
|
|
1492
|
-
offset = offset | 0
|
|
1493
|
-
if (!noAssert) checkInt(this, value, offset, 2, 0xffff, 0)
|
|
1494
|
-
if (Buffer.TYPED_ARRAY_SUPPORT) {
|
|
1495
|
-
this[offset] = (value & 0xff)
|
|
1496
|
-
this[offset + 1] = (value >>> 8)
|
|
1497
|
-
} else {
|
|
1498
|
-
objectWriteUInt16(this, value, offset, true)
|
|
1499
|
-
}
|
|
1500
|
-
return offset + 2
|
|
1501
|
-
}
|
|
293
|
+
this.authData = data;
|
|
294
|
+
if (this.authData) logger.log('Auth Data was set:', this.authData);
|
|
1502
295
|
|
|
1503
|
-
|
|
1504
|
-
|
|
1505
|
-
|
|
1506
|
-
|
|
1507
|
-
if (Buffer.TYPED_ARRAY_SUPPORT) {
|
|
1508
|
-
this[offset] = (value >>> 8)
|
|
1509
|
-
this[offset + 1] = (value & 0xff)
|
|
1510
|
-
} else {
|
|
1511
|
-
objectWriteUInt16(this, value, offset, false)
|
|
1512
|
-
}
|
|
1513
|
-
return offset + 2
|
|
1514
|
-
}
|
|
296
|
+
if (this.authState === nextAuthState) {
|
|
297
|
+
this.handleAuthStateChange(this.authState, this.authData);
|
|
298
|
+
logger.info("authState has been updated to " + this.authState);
|
|
299
|
+
}
|
|
1515
300
|
|
|
1516
|
-
|
|
1517
|
-
|
|
1518
|
-
|
|
1519
|
-
|
|
1520
|
-
|
|
1521
|
-
}
|
|
301
|
+
return [2
|
|
302
|
+
/*return*/
|
|
303
|
+
];
|
|
304
|
+
});
|
|
305
|
+
});
|
|
306
|
+
}; // Returns the auth component corresponding to the given authState.
|
|
307
|
+
|
|
308
|
+
|
|
309
|
+
class_1.prototype.getAuthComponent = function (authState) {
|
|
310
|
+
switch (authState) {
|
|
311
|
+
case _auth_types_78df304e_js__WEBPACK_IMPORTED_MODULE_2__["A"].SignIn:
|
|
312
|
+
return Object(_index_83f2275b_js__WEBPACK_IMPORTED_MODULE_0__["h"])("amplify-sign-in", {
|
|
313
|
+
federated: this.federated,
|
|
314
|
+
usernameAlias: this.usernameAlias
|
|
315
|
+
});
|
|
316
|
+
|
|
317
|
+
case _auth_types_78df304e_js__WEBPACK_IMPORTED_MODULE_2__["A"].ConfirmSignIn:
|
|
318
|
+
return Object(_index_83f2275b_js__WEBPACK_IMPORTED_MODULE_0__["h"])("amplify-confirm-sign-in", {
|
|
319
|
+
user: this.authData
|
|
320
|
+
});
|
|
321
|
+
|
|
322
|
+
case _auth_types_78df304e_js__WEBPACK_IMPORTED_MODULE_2__["A"].SignUp:
|
|
323
|
+
return Object(_index_83f2275b_js__WEBPACK_IMPORTED_MODULE_0__["h"])("amplify-sign-up", {
|
|
324
|
+
usernameAlias: this.usernameAlias
|
|
325
|
+
});
|
|
326
|
+
|
|
327
|
+
case _auth_types_78df304e_js__WEBPACK_IMPORTED_MODULE_2__["A"].ConfirmSignUp:
|
|
328
|
+
return Object(_index_83f2275b_js__WEBPACK_IMPORTED_MODULE_0__["h"])("amplify-confirm-sign-up", {
|
|
329
|
+
user: this.authData,
|
|
330
|
+
usernameAlias: this.usernameAlias
|
|
331
|
+
});
|
|
332
|
+
|
|
333
|
+
case _auth_types_78df304e_js__WEBPACK_IMPORTED_MODULE_2__["A"].ForgotPassword:
|
|
334
|
+
return Object(_index_83f2275b_js__WEBPACK_IMPORTED_MODULE_0__["h"])("amplify-forgot-password", {
|
|
335
|
+
usernameAlias: this.usernameAlias
|
|
336
|
+
});
|
|
337
|
+
|
|
338
|
+
case _auth_types_78df304e_js__WEBPACK_IMPORTED_MODULE_2__["A"].ResetPassword:
|
|
339
|
+
return Object(_index_83f2275b_js__WEBPACK_IMPORTED_MODULE_0__["h"])("amplify-require-new-password", {
|
|
340
|
+
user: this.authData
|
|
341
|
+
});
|
|
342
|
+
|
|
343
|
+
case _auth_types_78df304e_js__WEBPACK_IMPORTED_MODULE_2__["A"].VerifyContact:
|
|
344
|
+
return Object(_index_83f2275b_js__WEBPACK_IMPORTED_MODULE_0__["h"])("amplify-verify-contact", {
|
|
345
|
+
user: this.authData
|
|
346
|
+
});
|
|
347
|
+
|
|
348
|
+
case _auth_types_78df304e_js__WEBPACK_IMPORTED_MODULE_2__["A"].TOTPSetup:
|
|
349
|
+
return Object(_index_83f2275b_js__WEBPACK_IMPORTED_MODULE_0__["h"])("amplify-totp-setup", {
|
|
350
|
+
user: this.authData
|
|
351
|
+
});
|
|
352
|
+
|
|
353
|
+
case _auth_types_78df304e_js__WEBPACK_IMPORTED_MODULE_2__["A"].Loading:
|
|
354
|
+
return Object(_index_83f2275b_js__WEBPACK_IMPORTED_MODULE_0__["h"])("div", null, "Loading...");
|
|
1522
355
|
|
|
1523
|
-
|
|
1524
|
-
|
|
1525
|
-
|
|
1526
|
-
|
|
1527
|
-
|
|
1528
|
-
|
|
1529
|
-
|
|
1530
|
-
|
|
1531
|
-
|
|
1532
|
-
|
|
1533
|
-
|
|
1534
|
-
|
|
1535
|
-
|
|
1536
|
-
|
|
356
|
+
default:
|
|
357
|
+
throw new Error("Unhandled auth state: " + authState);
|
|
358
|
+
}
|
|
359
|
+
}; // Returns a slot containing the Auth component corresponding to the given authState
|
|
360
|
+
|
|
361
|
+
|
|
362
|
+
class_1.prototype.getSlotWithAuthComponent = function (authState) {
|
|
363
|
+
var authComponent = this.getAuthComponent(authState);
|
|
364
|
+
var slotName = authSlotNames[authState];
|
|
365
|
+
var slotIsEmpty = this.el.querySelector("[slot=\"" + slotName + "\"]") === null; // true if no element has been inserted to the slot
|
|
366
|
+
|
|
367
|
+
/**
|
|
368
|
+
* Connect the inner auth component to DOM only if the slot hasn't been overwritten. This prevents
|
|
369
|
+
* the overwritten component from calling its lifecycle methods.
|
|
370
|
+
*/
|
|
371
|
+
|
|
372
|
+
return Object(_index_83f2275b_js__WEBPACK_IMPORTED_MODULE_0__["h"])("slot", {
|
|
373
|
+
name: slotName
|
|
374
|
+
}, slotIsEmpty && authComponent);
|
|
375
|
+
};
|
|
376
|
+
|
|
377
|
+
class_1.prototype.disconnectedCallback = function () {
|
|
378
|
+
_aws_amplify_core__WEBPACK_IMPORTED_MODULE_1__["Hub"].remove(_constants_c8ecaa24_js__WEBPACK_IMPORTED_MODULE_5__["A"], this.handleExternalAuthEvent);
|
|
379
|
+
if (!this.hideToast) _aws_amplify_core__WEBPACK_IMPORTED_MODULE_1__["Hub"].remove(_constants_c8ecaa24_js__WEBPACK_IMPORTED_MODULE_5__["U"], this.handleToastEvent);
|
|
380
|
+
return _helpers_14fcb50c_js__WEBPACK_IMPORTED_MODULE_6__["o"];
|
|
381
|
+
};
|
|
382
|
+
|
|
383
|
+
class_1.prototype.render = function () {
|
|
384
|
+
var _this = this;
|
|
385
|
+
|
|
386
|
+
return Object(_index_83f2275b_js__WEBPACK_IMPORTED_MODULE_0__["h"])(_index_83f2275b_js__WEBPACK_IMPORTED_MODULE_0__["H"], null, !this.hideToast && this.toastMessage && Object(_index_83f2275b_js__WEBPACK_IMPORTED_MODULE_0__["h"])("amplify-toast", {
|
|
387
|
+
message: this.toastMessage,
|
|
388
|
+
handleClose: function handleClose() {
|
|
389
|
+
_this.toastMessage = '';
|
|
390
|
+
},
|
|
391
|
+
"data-test": "authenticator-error"
|
|
392
|
+
}), this.authState === _auth_types_78df304e_js__WEBPACK_IMPORTED_MODULE_2__["A"].SignedIn ? [Object(_index_83f2275b_js__WEBPACK_IMPORTED_MODULE_0__["h"])("slot", {
|
|
393
|
+
name: "greetings"
|
|
394
|
+
}), Object(_index_83f2275b_js__WEBPACK_IMPORTED_MODULE_0__["h"])("slot", null)] : Object(_index_83f2275b_js__WEBPACK_IMPORTED_MODULE_0__["h"])("div", {
|
|
395
|
+
"class": "auth-container"
|
|
396
|
+
}, this.getSlotWithAuthComponent(this.authState)));
|
|
397
|
+
};
|
|
398
|
+
|
|
399
|
+
Object.defineProperty(class_1.prototype, "el", {
|
|
400
|
+
get: function get() {
|
|
401
|
+
return Object(_index_83f2275b_js__WEBPACK_IMPORTED_MODULE_0__["g"])(this);
|
|
402
|
+
},
|
|
403
|
+
enumerable: false,
|
|
404
|
+
configurable: true
|
|
405
|
+
});
|
|
406
|
+
return class_1;
|
|
407
|
+
}();
|
|
408
|
+
|
|
409
|
+
AmplifyAuthenticator.style = amplifyAuthenticatorCss;
|
|
1537
410
|
|
|
1538
|
-
Buffer.prototype.writeUInt32BE = function writeUInt32BE (value, offset, noAssert) {
|
|
1539
|
-
value = +value
|
|
1540
|
-
offset = offset | 0
|
|
1541
|
-
if (!noAssert) checkInt(this, value, offset, 4, 0xffffffff, 0)
|
|
1542
|
-
if (Buffer.TYPED_ARRAY_SUPPORT) {
|
|
1543
|
-
this[offset] = (value >>> 24)
|
|
1544
|
-
this[offset + 1] = (value >>> 16)
|
|
1545
|
-
this[offset + 2] = (value >>> 8)
|
|
1546
|
-
this[offset + 3] = (value & 0xff)
|
|
1547
|
-
} else {
|
|
1548
|
-
objectWriteUInt32(this, value, offset, false)
|
|
1549
|
-
}
|
|
1550
|
-
return offset + 4
|
|
1551
|
-
}
|
|
1552
411
|
|
|
1553
|
-
|
|
1554
|
-
value = +value
|
|
1555
|
-
offset = offset | 0
|
|
1556
|
-
if (!noAssert) {
|
|
1557
|
-
var limit = Math.pow(2, 8 * byteLength - 1)
|
|
412
|
+
/***/ }),
|
|
1558
413
|
|
|
1559
|
-
|
|
1560
|
-
|
|
414
|
+
/***/ "../amplify-ui-components/dist/esm-es5/auth-helpers-557b83fc.js":
|
|
415
|
+
/*!**********************************************************************!*\
|
|
416
|
+
!*** ../amplify-ui-components/dist/esm-es5/auth-helpers-557b83fc.js ***!
|
|
417
|
+
\**********************************************************************/
|
|
418
|
+
/*! exports provided: c, h */
|
|
419
|
+
/***/ (function(module, __webpack_exports__, __webpack_require__) {
|
|
1561
420
|
|
|
1562
|
-
|
|
1563
|
-
|
|
1564
|
-
|
|
1565
|
-
|
|
1566
|
-
|
|
1567
|
-
|
|
1568
|
-
|
|
421
|
+
"use strict";
|
|
422
|
+
__webpack_require__.r(__webpack_exports__);
|
|
423
|
+
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "c", function() { return checkContact; });
|
|
424
|
+
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "h", function() { return handleSignIn; });
|
|
425
|
+
/* harmony import */ var _aws_amplify_core__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @aws-amplify/core */ "@aws-amplify/core");
|
|
426
|
+
/* harmony import */ var _aws_amplify_core__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_aws_amplify_core__WEBPACK_IMPORTED_MODULE_0__);
|
|
427
|
+
/* harmony import */ var _auth_types_78df304e_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./auth-types-78df304e.js */ "../amplify-ui-components/dist/esm-es5/auth-types-78df304e.js");
|
|
428
|
+
/* harmony import */ var _aws_amplify_auth__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! @aws-amplify/auth */ "@aws-amplify/auth");
|
|
429
|
+
/* harmony import */ var _aws_amplify_auth__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(_aws_amplify_auth__WEBPACK_IMPORTED_MODULE_2__);
|
|
430
|
+
/* harmony import */ var _Translations_108d469f_js__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./Translations-108d469f.js */ "../amplify-ui-components/dist/esm-es5/Translations-108d469f.js");
|
|
431
|
+
/* harmony import */ var _constants_c8ecaa24_js__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./constants-c8ecaa24.js */ "../amplify-ui-components/dist/esm-es5/constants-c8ecaa24.js");
|
|
432
|
+
/* harmony import */ var _helpers_14fcb50c_js__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ./helpers-14fcb50c.js */ "../amplify-ui-components/dist/esm-es5/helpers-14fcb50c.js");
|
|
433
|
+
var __awaiter = undefined && undefined.__awaiter || function (thisArg, _arguments, P, generator) {
|
|
434
|
+
function adopt(value) {
|
|
435
|
+
return value instanceof P ? value : new P(function (resolve) {
|
|
436
|
+
resolve(value);
|
|
437
|
+
});
|
|
438
|
+
}
|
|
439
|
+
|
|
440
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
441
|
+
function fulfilled(value) {
|
|
442
|
+
try {
|
|
443
|
+
step(generator.next(value));
|
|
444
|
+
} catch (e) {
|
|
445
|
+
reject(e);
|
|
446
|
+
}
|
|
1569
447
|
}
|
|
1570
|
-
this[offset + i] = ((value / mul) >> 0) - sub & 0xFF
|
|
1571
|
-
}
|
|
1572
|
-
|
|
1573
|
-
return offset + byteLength
|
|
1574
|
-
}
|
|
1575
|
-
|
|
1576
|
-
Buffer.prototype.writeIntBE = function writeIntBE (value, offset, byteLength, noAssert) {
|
|
1577
|
-
value = +value
|
|
1578
|
-
offset = offset | 0
|
|
1579
|
-
if (!noAssert) {
|
|
1580
|
-
var limit = Math.pow(2, 8 * byteLength - 1)
|
|
1581
|
-
|
|
1582
|
-
checkInt(this, value, offset, byteLength, limit - 1, -limit)
|
|
1583
|
-
}
|
|
1584
448
|
|
|
1585
|
-
|
|
1586
|
-
|
|
1587
|
-
|
|
1588
|
-
|
|
1589
|
-
|
|
1590
|
-
|
|
1591
|
-
sub = 1
|
|
449
|
+
function rejected(value) {
|
|
450
|
+
try {
|
|
451
|
+
step(generator["throw"](value));
|
|
452
|
+
} catch (e) {
|
|
453
|
+
reject(e);
|
|
454
|
+
}
|
|
1592
455
|
}
|
|
1593
|
-
this[offset + i] = ((value / mul) >> 0) - sub & 0xFF
|
|
1594
|
-
}
|
|
1595
|
-
|
|
1596
|
-
return offset + byteLength
|
|
1597
|
-
}
|
|
1598
|
-
|
|
1599
|
-
Buffer.prototype.writeInt8 = function writeInt8 (value, offset, noAssert) {
|
|
1600
|
-
value = +value
|
|
1601
|
-
offset = offset | 0
|
|
1602
|
-
if (!noAssert) checkInt(this, value, offset, 1, 0x7f, -0x80)
|
|
1603
|
-
if (!Buffer.TYPED_ARRAY_SUPPORT) value = Math.floor(value)
|
|
1604
|
-
if (value < 0) value = 0xff + value + 1
|
|
1605
|
-
this[offset] = (value & 0xff)
|
|
1606
|
-
return offset + 1
|
|
1607
|
-
}
|
|
1608
|
-
|
|
1609
|
-
Buffer.prototype.writeInt16LE = function writeInt16LE (value, offset, noAssert) {
|
|
1610
|
-
value = +value
|
|
1611
|
-
offset = offset | 0
|
|
1612
|
-
if (!noAssert) checkInt(this, value, offset, 2, 0x7fff, -0x8000)
|
|
1613
|
-
if (Buffer.TYPED_ARRAY_SUPPORT) {
|
|
1614
|
-
this[offset] = (value & 0xff)
|
|
1615
|
-
this[offset + 1] = (value >>> 8)
|
|
1616
|
-
} else {
|
|
1617
|
-
objectWriteUInt16(this, value, offset, true)
|
|
1618
|
-
}
|
|
1619
|
-
return offset + 2
|
|
1620
|
-
}
|
|
1621
|
-
|
|
1622
|
-
Buffer.prototype.writeInt16BE = function writeInt16BE (value, offset, noAssert) {
|
|
1623
|
-
value = +value
|
|
1624
|
-
offset = offset | 0
|
|
1625
|
-
if (!noAssert) checkInt(this, value, offset, 2, 0x7fff, -0x8000)
|
|
1626
|
-
if (Buffer.TYPED_ARRAY_SUPPORT) {
|
|
1627
|
-
this[offset] = (value >>> 8)
|
|
1628
|
-
this[offset + 1] = (value & 0xff)
|
|
1629
|
-
} else {
|
|
1630
|
-
objectWriteUInt16(this, value, offset, false)
|
|
1631
|
-
}
|
|
1632
|
-
return offset + 2
|
|
1633
|
-
}
|
|
1634
|
-
|
|
1635
|
-
Buffer.prototype.writeInt32LE = function writeInt32LE (value, offset, noAssert) {
|
|
1636
|
-
value = +value
|
|
1637
|
-
offset = offset | 0
|
|
1638
|
-
if (!noAssert) checkInt(this, value, offset, 4, 0x7fffffff, -0x80000000)
|
|
1639
|
-
if (Buffer.TYPED_ARRAY_SUPPORT) {
|
|
1640
|
-
this[offset] = (value & 0xff)
|
|
1641
|
-
this[offset + 1] = (value >>> 8)
|
|
1642
|
-
this[offset + 2] = (value >>> 16)
|
|
1643
|
-
this[offset + 3] = (value >>> 24)
|
|
1644
|
-
} else {
|
|
1645
|
-
objectWriteUInt32(this, value, offset, true)
|
|
1646
|
-
}
|
|
1647
|
-
return offset + 4
|
|
1648
|
-
}
|
|
1649
456
|
|
|
1650
|
-
|
|
1651
|
-
|
|
1652
|
-
|
|
1653
|
-
if (!noAssert) checkInt(this, value, offset, 4, 0x7fffffff, -0x80000000)
|
|
1654
|
-
if (value < 0) value = 0xffffffff + value + 1
|
|
1655
|
-
if (Buffer.TYPED_ARRAY_SUPPORT) {
|
|
1656
|
-
this[offset] = (value >>> 24)
|
|
1657
|
-
this[offset + 1] = (value >>> 16)
|
|
1658
|
-
this[offset + 2] = (value >>> 8)
|
|
1659
|
-
this[offset + 3] = (value & 0xff)
|
|
1660
|
-
} else {
|
|
1661
|
-
objectWriteUInt32(this, value, offset, false)
|
|
1662
|
-
}
|
|
1663
|
-
return offset + 4
|
|
1664
|
-
}
|
|
1665
|
-
|
|
1666
|
-
function checkIEEE754 (buf, value, offset, ext, max, min) {
|
|
1667
|
-
if (offset + ext > buf.length) throw new RangeError('Index out of range')
|
|
1668
|
-
if (offset < 0) throw new RangeError('Index out of range')
|
|
1669
|
-
}
|
|
1670
|
-
|
|
1671
|
-
function writeFloat (buf, value, offset, littleEndian, noAssert) {
|
|
1672
|
-
if (!noAssert) {
|
|
1673
|
-
checkIEEE754(buf, value, offset, 4, 3.4028234663852886e+38, -3.4028234663852886e+38)
|
|
1674
|
-
}
|
|
1675
|
-
ieee754.write(buf, value, offset, littleEndian, 23, 4)
|
|
1676
|
-
return offset + 4
|
|
1677
|
-
}
|
|
457
|
+
function step(result) {
|
|
458
|
+
result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected);
|
|
459
|
+
}
|
|
1678
460
|
|
|
1679
|
-
|
|
1680
|
-
|
|
1681
|
-
}
|
|
461
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
462
|
+
});
|
|
463
|
+
};
|
|
1682
464
|
|
|
1683
|
-
|
|
1684
|
-
|
|
1685
|
-
|
|
465
|
+
var __generator = undefined && undefined.__generator || function (thisArg, body) {
|
|
466
|
+
var _ = {
|
|
467
|
+
label: 0,
|
|
468
|
+
sent: function sent() {
|
|
469
|
+
if (t[0] & 1) throw t[1];
|
|
470
|
+
return t[1];
|
|
471
|
+
},
|
|
472
|
+
trys: [],
|
|
473
|
+
ops: []
|
|
474
|
+
},
|
|
475
|
+
f,
|
|
476
|
+
y,
|
|
477
|
+
t,
|
|
478
|
+
g;
|
|
479
|
+
return g = {
|
|
480
|
+
next: verb(0),
|
|
481
|
+
"throw": verb(1),
|
|
482
|
+
"return": verb(2)
|
|
483
|
+
}, typeof Symbol === "function" && (g[Symbol.iterator] = function () {
|
|
484
|
+
return this;
|
|
485
|
+
}), g;
|
|
486
|
+
|
|
487
|
+
function verb(n) {
|
|
488
|
+
return function (v) {
|
|
489
|
+
return step([n, v]);
|
|
490
|
+
};
|
|
491
|
+
}
|
|
492
|
+
|
|
493
|
+
function step(op) {
|
|
494
|
+
if (f) throw new TypeError("Generator is already executing.");
|
|
495
|
+
|
|
496
|
+
while (_) {
|
|
497
|
+
try {
|
|
498
|
+
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
|
|
499
|
+
if (y = 0, t) op = [op[0] & 2, t.value];
|
|
500
|
+
|
|
501
|
+
switch (op[0]) {
|
|
502
|
+
case 0:
|
|
503
|
+
case 1:
|
|
504
|
+
t = op;
|
|
505
|
+
break;
|
|
506
|
+
|
|
507
|
+
case 4:
|
|
508
|
+
_.label++;
|
|
509
|
+
return {
|
|
510
|
+
value: op[1],
|
|
511
|
+
done: false
|
|
512
|
+
};
|
|
513
|
+
|
|
514
|
+
case 5:
|
|
515
|
+
_.label++;
|
|
516
|
+
y = op[1];
|
|
517
|
+
op = [0];
|
|
518
|
+
continue;
|
|
519
|
+
|
|
520
|
+
case 7:
|
|
521
|
+
op = _.ops.pop();
|
|
522
|
+
|
|
523
|
+
_.trys.pop();
|
|
524
|
+
|
|
525
|
+
continue;
|
|
526
|
+
|
|
527
|
+
default:
|
|
528
|
+
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) {
|
|
529
|
+
_ = 0;
|
|
530
|
+
continue;
|
|
531
|
+
}
|
|
1686
532
|
|
|
1687
|
-
|
|
1688
|
-
|
|
1689
|
-
|
|
1690
|
-
|
|
1691
|
-
ieee754.write(buf, value, offset, littleEndian, 52, 8)
|
|
1692
|
-
return offset + 8
|
|
1693
|
-
}
|
|
533
|
+
if (op[0] === 3 && (!t || op[1] > t[0] && op[1] < t[3])) {
|
|
534
|
+
_.label = op[1];
|
|
535
|
+
break;
|
|
536
|
+
}
|
|
1694
537
|
|
|
1695
|
-
|
|
1696
|
-
|
|
1697
|
-
|
|
538
|
+
if (op[0] === 6 && _.label < t[1]) {
|
|
539
|
+
_.label = t[1];
|
|
540
|
+
t = op;
|
|
541
|
+
break;
|
|
542
|
+
}
|
|
1698
543
|
|
|
1699
|
-
|
|
1700
|
-
|
|
1701
|
-
}
|
|
544
|
+
if (t && _.label < t[2]) {
|
|
545
|
+
_.label = t[2];
|
|
1702
546
|
|
|
1703
|
-
|
|
1704
|
-
Buffer.prototype.copy = function copy (target, targetStart, start, end) {
|
|
1705
|
-
if (!start) start = 0
|
|
1706
|
-
if (!end && end !== 0) end = this.length
|
|
1707
|
-
if (targetStart >= target.length) targetStart = target.length
|
|
1708
|
-
if (!targetStart) targetStart = 0
|
|
1709
|
-
if (end > 0 && end < start) end = start
|
|
1710
|
-
|
|
1711
|
-
// Copy 0 bytes; we're done
|
|
1712
|
-
if (end === start) return 0
|
|
1713
|
-
if (target.length === 0 || this.length === 0) return 0
|
|
1714
|
-
|
|
1715
|
-
// Fatal error conditions
|
|
1716
|
-
if (targetStart < 0) {
|
|
1717
|
-
throw new RangeError('targetStart out of bounds')
|
|
1718
|
-
}
|
|
1719
|
-
if (start < 0 || start >= this.length) throw new RangeError('sourceStart out of bounds')
|
|
1720
|
-
if (end < 0) throw new RangeError('sourceEnd out of bounds')
|
|
547
|
+
_.ops.push(op);
|
|
1721
548
|
|
|
1722
|
-
|
|
1723
|
-
|
|
1724
|
-
if (target.length - targetStart < end - start) {
|
|
1725
|
-
end = target.length - targetStart + start
|
|
1726
|
-
}
|
|
549
|
+
break;
|
|
550
|
+
}
|
|
1727
551
|
|
|
1728
|
-
|
|
1729
|
-
var i
|
|
552
|
+
if (t[2]) _.ops.pop();
|
|
1730
553
|
|
|
1731
|
-
|
|
1732
|
-
// descending copy from end
|
|
1733
|
-
for (i = len - 1; i >= 0; --i) {
|
|
1734
|
-
target[i + targetStart] = this[i + start]
|
|
1735
|
-
}
|
|
1736
|
-
} else if (len < 1000 || !Buffer.TYPED_ARRAY_SUPPORT) {
|
|
1737
|
-
// ascending copy from start
|
|
1738
|
-
for (i = 0; i < len; ++i) {
|
|
1739
|
-
target[i + targetStart] = this[i + start]
|
|
1740
|
-
}
|
|
1741
|
-
} else {
|
|
1742
|
-
Uint8Array.prototype.set.call(
|
|
1743
|
-
target,
|
|
1744
|
-
this.subarray(start, start + len),
|
|
1745
|
-
targetStart
|
|
1746
|
-
)
|
|
1747
|
-
}
|
|
554
|
+
_.trys.pop();
|
|
1748
555
|
|
|
1749
|
-
|
|
1750
|
-
}
|
|
556
|
+
continue;
|
|
557
|
+
}
|
|
1751
558
|
|
|
1752
|
-
|
|
1753
|
-
|
|
1754
|
-
|
|
1755
|
-
|
|
1756
|
-
|
|
1757
|
-
|
|
1758
|
-
if (typeof val === 'string') {
|
|
1759
|
-
if (typeof start === 'string') {
|
|
1760
|
-
encoding = start
|
|
1761
|
-
start = 0
|
|
1762
|
-
end = this.length
|
|
1763
|
-
} else if (typeof end === 'string') {
|
|
1764
|
-
encoding = end
|
|
1765
|
-
end = this.length
|
|
1766
|
-
}
|
|
1767
|
-
if (val.length === 1) {
|
|
1768
|
-
var code = val.charCodeAt(0)
|
|
1769
|
-
if (code < 256) {
|
|
1770
|
-
val = code
|
|
559
|
+
op = body.call(thisArg, _);
|
|
560
|
+
} catch (e) {
|
|
561
|
+
op = [6, e];
|
|
562
|
+
y = 0;
|
|
563
|
+
} finally {
|
|
564
|
+
f = t = 0;
|
|
1771
565
|
}
|
|
1772
566
|
}
|
|
1773
|
-
if (encoding !== undefined && typeof encoding !== 'string') {
|
|
1774
|
-
throw new TypeError('encoding must be a string')
|
|
1775
|
-
}
|
|
1776
|
-
if (typeof encoding === 'string' && !Buffer.isEncoding(encoding)) {
|
|
1777
|
-
throw new TypeError('Unknown encoding: ' + encoding)
|
|
1778
|
-
}
|
|
1779
|
-
} else if (typeof val === 'number') {
|
|
1780
|
-
val = val & 255
|
|
1781
|
-
}
|
|
1782
|
-
|
|
1783
|
-
// Invalid ranges are not set to a default, so can range check early.
|
|
1784
|
-
if (start < 0 || this.length < start || this.length < end) {
|
|
1785
|
-
throw new RangeError('Out of range index')
|
|
1786
|
-
}
|
|
1787
|
-
|
|
1788
|
-
if (end <= start) {
|
|
1789
|
-
return this
|
|
1790
|
-
}
|
|
1791
|
-
|
|
1792
|
-
start = start >>> 0
|
|
1793
|
-
end = end === undefined ? this.length : end >>> 0
|
|
1794
|
-
|
|
1795
|
-
if (!val) val = 0
|
|
1796
|
-
|
|
1797
|
-
var i
|
|
1798
|
-
if (typeof val === 'number') {
|
|
1799
|
-
for (i = start; i < end; ++i) {
|
|
1800
|
-
this[i] = val
|
|
1801
|
-
}
|
|
1802
|
-
} else {
|
|
1803
|
-
var bytes = Buffer.isBuffer(val)
|
|
1804
|
-
? val
|
|
1805
|
-
: utf8ToBytes(new Buffer(val, encoding).toString())
|
|
1806
|
-
var len = bytes.length
|
|
1807
|
-
for (i = 0; i < end - start; ++i) {
|
|
1808
|
-
this[i + start] = bytes[i % len]
|
|
1809
|
-
}
|
|
1810
|
-
}
|
|
1811
567
|
|
|
1812
|
-
|
|
1813
|
-
|
|
1814
|
-
|
|
1815
|
-
|
|
1816
|
-
|
|
1817
|
-
|
|
1818
|
-
var INVALID_BASE64_RE = /[^+\/0-9A-Za-z-_]/g
|
|
1819
|
-
|
|
1820
|
-
function base64clean (str) {
|
|
1821
|
-
// Node strips out invalid characters like \n and \t from the string, base64-js does not
|
|
1822
|
-
str = stringtrim(str).replace(INVALID_BASE64_RE, '')
|
|
1823
|
-
// Node converts strings with length < 2 to ''
|
|
1824
|
-
if (str.length < 2) return ''
|
|
1825
|
-
// Node allows for non-padded base64 strings (missing trailing ===), base64-js does not
|
|
1826
|
-
while (str.length % 4 !== 0) {
|
|
1827
|
-
str = str + '='
|
|
568
|
+
if (op[0] & 5) throw op[1];
|
|
569
|
+
return {
|
|
570
|
+
value: op[0] ? op[1] : void 0,
|
|
571
|
+
done: true
|
|
572
|
+
};
|
|
1828
573
|
}
|
|
1829
|
-
|
|
1830
|
-
}
|
|
1831
|
-
|
|
1832
|
-
function stringtrim (str) {
|
|
1833
|
-
if (str.trim) return str.trim()
|
|
1834
|
-
return str.replace(/^\s+|\s+$/g, '')
|
|
1835
|
-
}
|
|
574
|
+
};
|
|
1836
575
|
|
|
1837
|
-
function toHex (n) {
|
|
1838
|
-
if (n < 16) return '0' + n.toString(16)
|
|
1839
|
-
return n.toString(16)
|
|
1840
|
-
}
|
|
1841
576
|
|
|
1842
|
-
function utf8ToBytes (string, units) {
|
|
1843
|
-
units = units || Infinity
|
|
1844
|
-
var codePoint
|
|
1845
|
-
var length = string.length
|
|
1846
|
-
var leadSurrogate = null
|
|
1847
|
-
var bytes = []
|
|
1848
|
-
|
|
1849
|
-
for (var i = 0; i < length; ++i) {
|
|
1850
|
-
codePoint = string.charCodeAt(i)
|
|
1851
|
-
|
|
1852
|
-
// is surrogate component
|
|
1853
|
-
if (codePoint > 0xD7FF && codePoint < 0xE000) {
|
|
1854
|
-
// last char was a lead
|
|
1855
|
-
if (!leadSurrogate) {
|
|
1856
|
-
// no lead yet
|
|
1857
|
-
if (codePoint > 0xDBFF) {
|
|
1858
|
-
// unexpected trail
|
|
1859
|
-
if ((units -= 3) > -1) bytes.push(0xEF, 0xBF, 0xBD)
|
|
1860
|
-
continue
|
|
1861
|
-
} else if (i + 1 === length) {
|
|
1862
|
-
// unpaired lead
|
|
1863
|
-
if ((units -= 3) > -1) bytes.push(0xEF, 0xBF, 0xBD)
|
|
1864
|
-
continue
|
|
1865
|
-
}
|
|
1866
577
|
|
|
1867
|
-
// valid lead
|
|
1868
|
-
leadSurrogate = codePoint
|
|
1869
578
|
|
|
1870
|
-
continue
|
|
1871
|
-
}
|
|
1872
579
|
|
|
1873
|
-
// 2 leads in a row
|
|
1874
|
-
if (codePoint < 0xDC00) {
|
|
1875
|
-
if ((units -= 3) > -1) bytes.push(0xEF, 0xBF, 0xBD)
|
|
1876
|
-
leadSurrogate = codePoint
|
|
1877
|
-
continue
|
|
1878
|
-
}
|
|
1879
580
|
|
|
1880
|
-
// valid surrogate pair
|
|
1881
|
-
codePoint = (leadSurrogate - 0xD800 << 10 | codePoint - 0xDC00) + 0x10000
|
|
1882
|
-
} else if (leadSurrogate) {
|
|
1883
|
-
// valid bmp char, but last char was a lead
|
|
1884
|
-
if ((units -= 3) > -1) bytes.push(0xEF, 0xBF, 0xBD)
|
|
1885
|
-
}
|
|
1886
581
|
|
|
1887
|
-
|
|
1888
|
-
|
|
1889
|
-
// encode utf8
|
|
1890
|
-
if (codePoint < 0x80) {
|
|
1891
|
-
if ((units -= 1) < 0) break
|
|
1892
|
-
bytes.push(codePoint)
|
|
1893
|
-
} else if (codePoint < 0x800) {
|
|
1894
|
-
if ((units -= 2) < 0) break
|
|
1895
|
-
bytes.push(
|
|
1896
|
-
codePoint >> 0x6 | 0xC0,
|
|
1897
|
-
codePoint & 0x3F | 0x80
|
|
1898
|
-
)
|
|
1899
|
-
} else if (codePoint < 0x10000) {
|
|
1900
|
-
if ((units -= 3) < 0) break
|
|
1901
|
-
bytes.push(
|
|
1902
|
-
codePoint >> 0xC | 0xE0,
|
|
1903
|
-
codePoint >> 0x6 & 0x3F | 0x80,
|
|
1904
|
-
codePoint & 0x3F | 0x80
|
|
1905
|
-
)
|
|
1906
|
-
} else if (codePoint < 0x110000) {
|
|
1907
|
-
if ((units -= 4) < 0) break
|
|
1908
|
-
bytes.push(
|
|
1909
|
-
codePoint >> 0x12 | 0xF0,
|
|
1910
|
-
codePoint >> 0xC & 0x3F | 0x80,
|
|
1911
|
-
codePoint >> 0x6 & 0x3F | 0x80,
|
|
1912
|
-
codePoint & 0x3F | 0x80
|
|
1913
|
-
)
|
|
1914
|
-
} else {
|
|
1915
|
-
throw new Error('Invalid code point')
|
|
1916
|
-
}
|
|
1917
|
-
}
|
|
582
|
+
var logger = new _aws_amplify_core__WEBPACK_IMPORTED_MODULE_0__["Logger"]('auth-helpers');
|
|
1918
583
|
|
|
1919
|
-
|
|
1920
|
-
|
|
584
|
+
function checkContact(user, handleAuthStateChange) {
|
|
585
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
586
|
+
var data, newUser, error_1;
|
|
587
|
+
return __generator(this, function (_a) {
|
|
588
|
+
switch (_a.label) {
|
|
589
|
+
case 0:
|
|
590
|
+
if (!_aws_amplify_auth__WEBPACK_IMPORTED_MODULE_2__["Auth"] || typeof _aws_amplify_auth__WEBPACK_IMPORTED_MODULE_2__["Auth"].verifiedContact !== 'function') {
|
|
591
|
+
throw new Error(_constants_c8ecaa24_js__WEBPACK_IMPORTED_MODULE_4__["N"]);
|
|
592
|
+
} // If `user` is a federated user, we shouldn't call `verifiedContact`
|
|
593
|
+
// since `user` isn't `CognitoUser`
|
|
1921
594
|
|
|
1922
|
-
function asciiToBytes (str) {
|
|
1923
|
-
var byteArray = []
|
|
1924
|
-
for (var i = 0; i < str.length; ++i) {
|
|
1925
|
-
// Node's code seems to be doing this and not & 0x7F..
|
|
1926
|
-
byteArray.push(str.charCodeAt(i) & 0xFF)
|
|
1927
|
-
}
|
|
1928
|
-
return byteArray
|
|
1929
|
-
}
|
|
1930
595
|
|
|
1931
|
-
|
|
1932
|
-
|
|
1933
|
-
|
|
1934
|
-
|
|
1935
|
-
|
|
1936
|
-
|
|
1937
|
-
c = str.charCodeAt(i)
|
|
1938
|
-
hi = c >> 8
|
|
1939
|
-
lo = c % 256
|
|
1940
|
-
byteArray.push(lo)
|
|
1941
|
-
byteArray.push(hi)
|
|
1942
|
-
}
|
|
596
|
+
if (!isCognitoUser(user)) {
|
|
597
|
+
handleAuthStateChange(_auth_types_78df304e_js__WEBPACK_IMPORTED_MODULE_1__["A"].SignedIn, user);
|
|
598
|
+
return [2
|
|
599
|
+
/*return*/
|
|
600
|
+
];
|
|
601
|
+
}
|
|
1943
602
|
|
|
1944
|
-
|
|
1945
|
-
}
|
|
603
|
+
_a.label = 1;
|
|
1946
604
|
|
|
1947
|
-
|
|
1948
|
-
|
|
1949
|
-
}
|
|
605
|
+
case 1:
|
|
606
|
+
_a.trys.push([1, 3,, 4]);
|
|
1950
607
|
|
|
1951
|
-
|
|
1952
|
-
|
|
1953
|
-
|
|
1954
|
-
dst[i + offset] = src[i]
|
|
1955
|
-
}
|
|
1956
|
-
return i
|
|
1957
|
-
}
|
|
608
|
+
return [4
|
|
609
|
+
/*yield*/
|
|
610
|
+
, _aws_amplify_auth__WEBPACK_IMPORTED_MODULE_2__["Auth"].verifiedContact(user)];
|
|
1958
611
|
|
|
1959
|
-
|
|
1960
|
-
|
|
1961
|
-
}
|
|
612
|
+
case 2:
|
|
613
|
+
data = _a.sent();
|
|
1962
614
|
|
|
1963
|
-
|
|
615
|
+
if (!Object(_aws_amplify_core__WEBPACK_IMPORTED_MODULE_0__["isEmpty"])(data.verified) || Object(_aws_amplify_core__WEBPACK_IMPORTED_MODULE_0__["isEmpty"])(data.unverified)) {
|
|
616
|
+
handleAuthStateChange(_auth_types_78df304e_js__WEBPACK_IMPORTED_MODULE_1__["A"].SignedIn, user);
|
|
617
|
+
} else {
|
|
618
|
+
newUser = Object.assign(user, data);
|
|
619
|
+
handleAuthStateChange(_auth_types_78df304e_js__WEBPACK_IMPORTED_MODULE_1__["A"].VerifyContact, newUser);
|
|
620
|
+
}
|
|
1964
621
|
|
|
1965
|
-
|
|
622
|
+
return [3
|
|
623
|
+
/*break*/
|
|
624
|
+
, 4];
|
|
1966
625
|
|
|
1967
|
-
|
|
1968
|
-
|
|
1969
|
-
|
|
1970
|
-
|
|
1971
|
-
|
|
1972
|
-
|
|
1973
|
-
|
|
1974
|
-
/*! ieee754. BSD-3-Clause License. Feross Aboukhadijeh <https://feross.org/opensource> */
|
|
1975
|
-
exports.read = function (buffer, offset, isLE, mLen, nBytes) {
|
|
1976
|
-
var e, m
|
|
1977
|
-
var eLen = (nBytes * 8) - mLen - 1
|
|
1978
|
-
var eMax = (1 << eLen) - 1
|
|
1979
|
-
var eBias = eMax >> 1
|
|
1980
|
-
var nBits = -7
|
|
1981
|
-
var i = isLE ? (nBytes - 1) : 0
|
|
1982
|
-
var d = isLE ? -1 : 1
|
|
1983
|
-
var s = buffer[offset + i]
|
|
1984
|
-
|
|
1985
|
-
i += d
|
|
1986
|
-
|
|
1987
|
-
e = s & ((1 << (-nBits)) - 1)
|
|
1988
|
-
s >>= (-nBits)
|
|
1989
|
-
nBits += eLen
|
|
1990
|
-
for (; nBits > 0; e = (e * 256) + buffer[offset + i], i += d, nBits -= 8) {}
|
|
1991
|
-
|
|
1992
|
-
m = e & ((1 << (-nBits)) - 1)
|
|
1993
|
-
e >>= (-nBits)
|
|
1994
|
-
nBits += mLen
|
|
1995
|
-
for (; nBits > 0; m = (m * 256) + buffer[offset + i], i += d, nBits -= 8) {}
|
|
1996
|
-
|
|
1997
|
-
if (e === 0) {
|
|
1998
|
-
e = 1 - eBias
|
|
1999
|
-
} else if (e === eMax) {
|
|
2000
|
-
return m ? NaN : ((s ? -1 : 1) * Infinity)
|
|
2001
|
-
} else {
|
|
2002
|
-
m = m + Math.pow(2, mLen)
|
|
2003
|
-
e = e - eBias
|
|
2004
|
-
}
|
|
2005
|
-
return (s ? -1 : 1) * m * Math.pow(2, e - mLen)
|
|
2006
|
-
}
|
|
626
|
+
case 3:
|
|
627
|
+
error_1 = _a.sent();
|
|
628
|
+
Object(_helpers_14fcb50c_js__WEBPACK_IMPORTED_MODULE_5__["a"])(error_1);
|
|
629
|
+
return [3
|
|
630
|
+
/*break*/
|
|
631
|
+
, 4];
|
|
2007
632
|
|
|
2008
|
-
|
|
2009
|
-
|
|
2010
|
-
|
|
2011
|
-
|
|
2012
|
-
|
|
2013
|
-
|
|
2014
|
-
|
|
2015
|
-
|
|
2016
|
-
|
|
2017
|
-
|
|
2018
|
-
|
|
2019
|
-
|
|
2020
|
-
|
|
2021
|
-
|
|
2022
|
-
|
|
2023
|
-
|
|
2024
|
-
|
|
2025
|
-
|
|
2026
|
-
e--
|
|
2027
|
-
c *= 2
|
|
2028
|
-
}
|
|
2029
|
-
if (e + eBias >= 1) {
|
|
2030
|
-
value += rt / c
|
|
2031
|
-
} else {
|
|
2032
|
-
value += rt * Math.pow(2, 1 - eBias)
|
|
2033
|
-
}
|
|
2034
|
-
if (value * c >= 2) {
|
|
2035
|
-
e++
|
|
2036
|
-
c /= 2
|
|
2037
|
-
}
|
|
633
|
+
case 4:
|
|
634
|
+
return [2
|
|
635
|
+
/*return*/
|
|
636
|
+
];
|
|
637
|
+
}
|
|
638
|
+
});
|
|
639
|
+
});
|
|
640
|
+
}
|
|
641
|
+
|
|
642
|
+
var handleSignIn = function handleSignIn(username, password, handleAuthStateChange, usernameAlias) {
|
|
643
|
+
return __awaiter(void 0, void 0, void 0, function () {
|
|
644
|
+
var user, error_2;
|
|
645
|
+
return __generator(this, function (_a) {
|
|
646
|
+
switch (_a.label) {
|
|
647
|
+
case 0:
|
|
648
|
+
if (!_aws_amplify_auth__WEBPACK_IMPORTED_MODULE_2__["Auth"] || typeof _aws_amplify_auth__WEBPACK_IMPORTED_MODULE_2__["Auth"].signIn !== 'function') {
|
|
649
|
+
throw new Error(_constants_c8ecaa24_js__WEBPACK_IMPORTED_MODULE_4__["N"]);
|
|
650
|
+
}
|
|
2038
651
|
|
|
2039
|
-
|
|
2040
|
-
m = 0
|
|
2041
|
-
e = eMax
|
|
2042
|
-
} else if (e + eBias >= 1) {
|
|
2043
|
-
m = ((value * c) - 1) * Math.pow(2, mLen)
|
|
2044
|
-
e = e + eBias
|
|
2045
|
-
} else {
|
|
2046
|
-
m = value * Math.pow(2, eBias - 1) * Math.pow(2, mLen)
|
|
2047
|
-
e = 0
|
|
2048
|
-
}
|
|
2049
|
-
}
|
|
652
|
+
_a.label = 1;
|
|
2050
653
|
|
|
2051
|
-
|
|
654
|
+
case 1:
|
|
655
|
+
_a.trys.push([1, 9,, 10]);
|
|
2052
656
|
|
|
2053
|
-
|
|
2054
|
-
|
|
2055
|
-
|
|
657
|
+
return [4
|
|
658
|
+
/*yield*/
|
|
659
|
+
, _aws_amplify_auth__WEBPACK_IMPORTED_MODULE_2__["Auth"].signIn(username, password)];
|
|
2056
660
|
|
|
2057
|
-
|
|
2058
|
-
|
|
661
|
+
case 2:
|
|
662
|
+
user = _a.sent();
|
|
663
|
+
logger.debug(user);
|
|
664
|
+
if (!(user.challengeName === _auth_types_78df304e_js__WEBPACK_IMPORTED_MODULE_1__["C"].SMSMFA || user.challengeName === _auth_types_78df304e_js__WEBPACK_IMPORTED_MODULE_1__["C"].SoftwareTokenMFA)) return [3
|
|
665
|
+
/*break*/
|
|
666
|
+
, 3];
|
|
667
|
+
logger.debug('confirm user with ' + user.challengeName);
|
|
668
|
+
handleAuthStateChange(_auth_types_78df304e_js__WEBPACK_IMPORTED_MODULE_1__["A"].ConfirmSignIn, user);
|
|
669
|
+
return [3
|
|
670
|
+
/*break*/
|
|
671
|
+
, 8];
|
|
2059
672
|
|
|
673
|
+
case 3:
|
|
674
|
+
if (!(user.challengeName === _auth_types_78df304e_js__WEBPACK_IMPORTED_MODULE_1__["C"].NewPasswordRequired)) return [3
|
|
675
|
+
/*break*/
|
|
676
|
+
, 4];
|
|
677
|
+
logger.debug('require new password', user.challengeParam);
|
|
678
|
+
handleAuthStateChange(_auth_types_78df304e_js__WEBPACK_IMPORTED_MODULE_1__["A"].ResetPassword, user);
|
|
679
|
+
return [3
|
|
680
|
+
/*break*/
|
|
681
|
+
, 8];
|
|
2060
682
|
|
|
2061
|
-
|
|
683
|
+
case 4:
|
|
684
|
+
if (!(user.challengeName === _auth_types_78df304e_js__WEBPACK_IMPORTED_MODULE_1__["C"].MFASetup)) return [3
|
|
685
|
+
/*break*/
|
|
686
|
+
, 5];
|
|
687
|
+
logger.debug('TOTP setup', user.challengeParam);
|
|
688
|
+
handleAuthStateChange(_auth_types_78df304e_js__WEBPACK_IMPORTED_MODULE_1__["A"].TOTPSetup, user);
|
|
689
|
+
return [3
|
|
690
|
+
/*break*/
|
|
691
|
+
, 8];
|
|
692
|
+
|
|
693
|
+
case 5:
|
|
694
|
+
if (!(user.challengeName === _auth_types_78df304e_js__WEBPACK_IMPORTED_MODULE_1__["C"].CustomChallenge && user.challengeParam && user.challengeParam.trigger === 'true')) return [3
|
|
695
|
+
/*break*/
|
|
696
|
+
, 6];
|
|
697
|
+
logger.debug('custom challenge', user.challengeParam);
|
|
698
|
+
handleAuthStateChange(_auth_types_78df304e_js__WEBPACK_IMPORTED_MODULE_1__["A"].CustomConfirmSignIn, user);
|
|
699
|
+
return [3
|
|
700
|
+
/*break*/
|
|
701
|
+
, 8];
|
|
702
|
+
|
|
703
|
+
case 6:
|
|
704
|
+
return [4
|
|
705
|
+
/*yield*/
|
|
706
|
+
, checkContact(user, handleAuthStateChange)];
|
|
707
|
+
|
|
708
|
+
case 7:
|
|
709
|
+
_a.sent();
|
|
710
|
+
|
|
711
|
+
_a.label = 8;
|
|
712
|
+
|
|
713
|
+
case 8:
|
|
714
|
+
return [3
|
|
715
|
+
/*break*/
|
|
716
|
+
, 10];
|
|
717
|
+
|
|
718
|
+
case 9:
|
|
719
|
+
error_2 = _a.sent();
|
|
720
|
+
|
|
721
|
+
if (error_2.code === 'UserNotConfirmedException') {
|
|
722
|
+
logger.debug('the user is not confirmed');
|
|
723
|
+
handleAuthStateChange(_auth_types_78df304e_js__WEBPACK_IMPORTED_MODULE_1__["A"].ConfirmSignUp, {
|
|
724
|
+
username: username
|
|
725
|
+
});
|
|
726
|
+
} else if (error_2.code === 'PasswordResetRequiredException') {
|
|
727
|
+
logger.debug('the user requires a new password');
|
|
728
|
+
handleAuthStateChange(_auth_types_78df304e_js__WEBPACK_IMPORTED_MODULE_1__["A"].ForgotPassword, {
|
|
729
|
+
username: username
|
|
730
|
+
});
|
|
731
|
+
} else if (error_2.code === 'InvalidParameterException' && password === '') {
|
|
732
|
+
logger.debug('Password cannot be empty');
|
|
733
|
+
error_2.message = _Translations_108d469f_js__WEBPACK_IMPORTED_MODULE_3__["T"].EMPTY_PASSWORD;
|
|
734
|
+
} else if (error_2.message === _Translations_108d469f_js__WEBPACK_IMPORTED_MODULE_3__["T"].EMPTY_USERNAME) {
|
|
735
|
+
if (usernameAlias === _auth_types_78df304e_js__WEBPACK_IMPORTED_MODULE_1__["U"].email) {
|
|
736
|
+
error_2.message = _Translations_108d469f_js__WEBPACK_IMPORTED_MODULE_3__["T"].EMPTY_EMAIL;
|
|
737
|
+
}
|
|
2062
738
|
|
|
2063
|
-
|
|
2064
|
-
|
|
2065
|
-
|
|
2066
|
-
|
|
2067
|
-
/*! no static exports found */
|
|
2068
|
-
/***/ (function(module, exports) {
|
|
739
|
+
if (usernameAlias === _auth_types_78df304e_js__WEBPACK_IMPORTED_MODULE_1__["U"].phone_number) {
|
|
740
|
+
error_2.message = _Translations_108d469f_js__WEBPACK_IMPORTED_MODULE_3__["T"].EMPTY_PHONE;
|
|
741
|
+
}
|
|
742
|
+
}
|
|
2069
743
|
|
|
2070
|
-
|
|
744
|
+
Object(_helpers_14fcb50c_js__WEBPACK_IMPORTED_MODULE_5__["a"])(error_2);
|
|
745
|
+
return [3
|
|
746
|
+
/*break*/
|
|
747
|
+
, 10];
|
|
2071
748
|
|
|
2072
|
-
|
|
2073
|
-
|
|
749
|
+
case 10:
|
|
750
|
+
return [2
|
|
751
|
+
/*return*/
|
|
752
|
+
];
|
|
753
|
+
}
|
|
754
|
+
});
|
|
755
|
+
});
|
|
2074
756
|
};
|
|
2075
757
|
|
|
758
|
+
var isCognitoUser = function isCognitoUser(user) {
|
|
759
|
+
return user instanceof _aws_amplify_auth__WEBPACK_IMPORTED_MODULE_2__["CognitoUser"];
|
|
760
|
+
};
|
|
2076
761
|
|
|
2077
|
-
/***/ }),
|
|
2078
|
-
|
|
2079
|
-
/***/ "../../node_modules/webpack/buildin/global.js":
|
|
2080
|
-
/*!***********************************!*\
|
|
2081
|
-
!*** (webpack)/buildin/global.js ***!
|
|
2082
|
-
\***********************************/
|
|
2083
|
-
/*! no static exports found */
|
|
2084
|
-
/***/ (function(module, exports) {
|
|
2085
|
-
|
|
2086
|
-
var g;
|
|
2087
|
-
|
|
2088
|
-
// This works in non-strict mode
|
|
2089
|
-
g = (function() {
|
|
2090
|
-
return this;
|
|
2091
|
-
})();
|
|
2092
|
-
|
|
2093
|
-
try {
|
|
2094
|
-
// This works if eval is allowed (see CSP)
|
|
2095
|
-
g = g || new Function("return this")();
|
|
2096
|
-
} catch (e) {
|
|
2097
|
-
// This works if the window reference is available
|
|
2098
|
-
if (typeof window === "object") g = window;
|
|
2099
|
-
}
|
|
2100
|
-
|
|
2101
|
-
// g can still be undefined, but nothing to do about it...
|
|
2102
|
-
// We return undefined, instead of nothing here, so it's
|
|
2103
|
-
// easier to handle this case. if(!global) { ...}
|
|
2104
|
-
|
|
2105
|
-
module.exports = g;
|
|
2106
762
|
|
|
2107
763
|
|
|
2108
764
|
/***/ })
|