@auth0/auth0-spa-js 1.16.0 → 1.18.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +10 -12
- package/dist/auth0-spa-js.development.js +650 -477
- package/dist/auth0-spa-js.development.js.map +1 -1
- package/dist/auth0-spa-js.production.esm.js +1 -1
- package/dist/auth0-spa-js.production.esm.js.map +1 -1
- package/dist/auth0-spa-js.production.js +1 -1
- package/dist/auth0-spa-js.production.js.map +1 -1
- package/dist/lib/auth0-spa-js.cjs.js +650 -477
- package/dist/lib/auth0-spa-js.cjs.js.map +1 -1
- package/dist/typings/Auth0Client.d.ts +8 -2
- package/dist/typings/api.d.ts +1 -1
- package/dist/typings/cache/cache-localstorage.d.ts +4 -4
- package/dist/typings/cache/cache-manager.d.ts +8 -3
- package/dist/typings/cache/key-manifest.d.ts +3 -3
- package/dist/typings/cache/shared.d.ts +5 -4
- package/dist/typings/errors.d.ts +7 -0
- package/dist/typings/global.d.ts +9 -0
- package/dist/typings/http.d.ts +2 -2
- package/dist/typings/index.d.ts +1 -1
- package/dist/typings/transaction-manager.d.ts +3 -1
- package/dist/typings/version.d.ts +1 -1
- package/dist/typings/worker/worker.types.d.ts +1 -0
- package/package.json +26 -26
- package/src/Auth0Client.ts +136 -32
- package/src/api.ts +12 -3
- package/src/cache/cache-localstorage.ts +10 -14
- package/src/cache/cache-manager.ts +24 -13
- package/src/cache/cache-memory.ts +7 -9
- package/src/cache/key-manifest.ts +9 -4
- package/src/cache/shared.ts +6 -4
- package/src/errors.ts +20 -5
- package/src/global.ts +10 -0
- package/src/http.ts +17 -7
- package/src/index.cjs.ts +3 -1
- package/src/index.ts +2 -1
- package/src/storage.ts +22 -4
- package/src/transaction-manager.ts +7 -5
- package/src/utils.ts +7 -6
- package/src/version.ts +1 -1
- package/src/worker/token.worker.ts +24 -6
- package/src/worker/worker.types.ts +1 -0
- package/CHANGELOG.md +0 -494
package/README.md
CHANGED
|
@@ -31,7 +31,7 @@ Auth0 SDK for Single Page Applications using [Authorization Code Grant Flow with
|
|
|
31
31
|
From the CDN:
|
|
32
32
|
|
|
33
33
|
```html
|
|
34
|
-
<script src="https://cdn.auth0.com/js/auth0-spa-js/1.
|
|
34
|
+
<script src="https://cdn.auth0.com/js/auth0-spa-js/1.18/auth0-spa-js.production.js"></script>
|
|
35
35
|
```
|
|
36
36
|
|
|
37
37
|
Using [npm](https://npmjs.org):
|
|
@@ -216,36 +216,34 @@ The SDK can be configured to use a custom cache store that is implemented by you
|
|
|
216
216
|
|
|
217
217
|
To do this, provide an object to the `cache` property of the SDK configuration.
|
|
218
218
|
|
|
219
|
-
The object should implement the following functions
|
|
219
|
+
The object should implement the following functions. Note that all of these functions can optionally return a Promise or a static value.
|
|
220
220
|
|
|
221
|
-
| Signature
|
|
222
|
-
|
|
|
223
|
-
| `
|
|
224
|
-
| `
|
|
225
|
-
| `
|
|
226
|
-
| `
|
|
221
|
+
| Signature | Return type | Description |
|
|
222
|
+
| -------------------------------- | ------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
223
|
+
| `get(key)` | Promise<object> or object | Returns the item from the cache with the specified key, or `undefined` if it was not found |
|
|
224
|
+
| `set(key: string, object: any) ` | Promise<void> or void | Sets an item into the cache |
|
|
225
|
+
| `remove(key)` | Promise<void> or void | Removes a single item from the cache at the specified key, or no-op if the item was not found |
|
|
226
|
+
| `allKeys()` | Promise<string[]> or string [] | (optional) Implement this if your cache has the ability to return a list of all keys. Otherwise, the SDK internally records its own key manifest using your cache. **Note**: if you only want to ensure you only return keys used by this SDK, the keys we use are prefixed with `@@auth0spajs@@` |
|
|
227
227
|
|
|
228
228
|
Here's an example of a custom cache implementation that uses `sessionStorage` to store tokens and apply it to the Auth0 SPA SDK:
|
|
229
229
|
|
|
230
230
|
```js
|
|
231
231
|
const sessionStorageCache = {
|
|
232
232
|
get: function (key) {
|
|
233
|
-
return
|
|
233
|
+
return JSON.parse(sessionStorage.getItem(key));
|
|
234
234
|
},
|
|
235
235
|
|
|
236
236
|
set: function (key, value) {
|
|
237
237
|
sessionStorage.setItem(key, JSON.stringify(value));
|
|
238
|
-
return Promise.resolve();
|
|
239
238
|
},
|
|
240
239
|
|
|
241
240
|
remove: function (key) {
|
|
242
241
|
sessionStorage.removeItem(key);
|
|
243
|
-
return Promise.resolve();
|
|
244
242
|
},
|
|
245
243
|
|
|
246
244
|
// Optional
|
|
247
245
|
allKeys: function () {
|
|
248
|
-
return
|
|
246
|
+
return Object.keys(sessionStorage);
|
|
249
247
|
}
|
|
250
248
|
};
|
|
251
249
|
|
|
@@ -113,10 +113,14 @@
|
|
|
113
113
|
return ar;
|
|
114
114
|
}
|
|
115
115
|
|
|
116
|
-
function __spreadArray(to, from) {
|
|
117
|
-
for (var i = 0,
|
|
118
|
-
|
|
119
|
-
|
|
116
|
+
function __spreadArray(to, from, pack) {
|
|
117
|
+
if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {
|
|
118
|
+
if (ar || !(i in from)) {
|
|
119
|
+
if (!ar) ar = Array.prototype.slice.call(from, 0, i);
|
|
120
|
+
ar[i] = from[i];
|
|
121
|
+
}
|
|
122
|
+
}
|
|
123
|
+
return to.concat(ar || from);
|
|
120
124
|
}
|
|
121
125
|
|
|
122
126
|
var commonjsGlobal = typeof globalThis !== 'undefined' ? globalThis : typeof window !== 'undefined' ? window : typeof global !== 'undefined' ? global : typeof self !== 'undefined' ? self : {};
|
|
@@ -221,19 +225,97 @@
|
|
|
221
225
|
return typeof it === 'object' ? it !== null : typeof it === 'function';
|
|
222
226
|
};
|
|
223
227
|
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
var
|
|
229
|
-
|
|
228
|
+
var aFunction$1 = function (variable) {
|
|
229
|
+
return typeof variable == 'function' ? variable : undefined;
|
|
230
|
+
};
|
|
231
|
+
|
|
232
|
+
var getBuiltIn = function (namespace, method) {
|
|
233
|
+
return arguments.length < 2 ? aFunction$1(global_1[namespace]) : global_1[namespace] && global_1[namespace][method];
|
|
234
|
+
};
|
|
235
|
+
|
|
236
|
+
var engineUserAgent = getBuiltIn('navigator', 'userAgent') || '';
|
|
237
|
+
|
|
238
|
+
var process = global_1.process;
|
|
239
|
+
var Deno = global_1.Deno;
|
|
240
|
+
var versions = process && process.versions || Deno && Deno.version;
|
|
241
|
+
var v8 = versions && versions.v8;
|
|
242
|
+
var match, version$1;
|
|
243
|
+
|
|
244
|
+
if (v8) {
|
|
245
|
+
match = v8.split('.');
|
|
246
|
+
version$1 = match[0] < 4 ? 1 : match[0] + match[1];
|
|
247
|
+
} else if (engineUserAgent) {
|
|
248
|
+
match = engineUserAgent.match(/Edge\/(\d+)/);
|
|
249
|
+
if (!match || match[1] >= 74) {
|
|
250
|
+
match = engineUserAgent.match(/Chrome\/(\d+)/);
|
|
251
|
+
if (match) version$1 = match[1];
|
|
252
|
+
}
|
|
253
|
+
}
|
|
254
|
+
|
|
255
|
+
var engineV8Version = version$1 && +version$1;
|
|
256
|
+
|
|
257
|
+
/* eslint-disable es/no-symbol -- required for testing */
|
|
258
|
+
|
|
259
|
+
|
|
260
|
+
|
|
261
|
+
// eslint-disable-next-line es/no-object-getownpropertysymbols -- required for testing
|
|
262
|
+
var nativeSymbol = !!Object.getOwnPropertySymbols && !fails(function () {
|
|
263
|
+
var symbol = Symbol();
|
|
264
|
+
// Chrome 38 Symbol has incorrect toString conversion
|
|
265
|
+
// `get-own-property-symbols` polyfill symbols converted to object are not Symbol instances
|
|
266
|
+
return !String(symbol) || !(Object(symbol) instanceof Symbol) ||
|
|
267
|
+
// Chrome 38-40 symbols are not inherited from DOM collections prototypes to instances
|
|
268
|
+
!Symbol.sham && engineV8Version && engineV8Version < 41;
|
|
269
|
+
});
|
|
270
|
+
|
|
271
|
+
/* eslint-disable es/no-symbol -- required for testing */
|
|
272
|
+
|
|
273
|
+
|
|
274
|
+
var useSymbolAsUid = nativeSymbol
|
|
275
|
+
&& !Symbol.sham
|
|
276
|
+
&& typeof Symbol.iterator == 'symbol';
|
|
277
|
+
|
|
278
|
+
var isSymbol = useSymbolAsUid ? function (it) {
|
|
279
|
+
return typeof it == 'symbol';
|
|
280
|
+
} : function (it) {
|
|
281
|
+
var $Symbol = getBuiltIn('Symbol');
|
|
282
|
+
return typeof $Symbol == 'function' && Object(it) instanceof $Symbol;
|
|
283
|
+
};
|
|
284
|
+
|
|
285
|
+
// `OrdinaryToPrimitive` abstract operation
|
|
286
|
+
// https://tc39.es/ecma262/#sec-ordinarytoprimitive
|
|
287
|
+
var ordinaryToPrimitive = function (input, pref) {
|
|
230
288
|
var fn, val;
|
|
231
|
-
if (
|
|
289
|
+
if (pref === 'string' && typeof (fn = input.toString) == 'function' && !isObject(val = fn.call(input))) return val;
|
|
232
290
|
if (typeof (fn = input.valueOf) == 'function' && !isObject(val = fn.call(input))) return val;
|
|
233
|
-
if (
|
|
291
|
+
if (pref !== 'string' && typeof (fn = input.toString) == 'function' && !isObject(val = fn.call(input))) return val;
|
|
234
292
|
throw TypeError("Can't convert object to primitive value");
|
|
235
293
|
};
|
|
236
294
|
|
|
295
|
+
var setGlobal = function (key, value) {
|
|
296
|
+
try {
|
|
297
|
+
// eslint-disable-next-line es/no-object-defineproperty -- safe
|
|
298
|
+
Object.defineProperty(global_1, key, { value: value, configurable: true, writable: true });
|
|
299
|
+
} catch (error) {
|
|
300
|
+
global_1[key] = value;
|
|
301
|
+
} return value;
|
|
302
|
+
};
|
|
303
|
+
|
|
304
|
+
var SHARED = '__core-js_shared__';
|
|
305
|
+
var store$1 = global_1[SHARED] || setGlobal(SHARED, {});
|
|
306
|
+
|
|
307
|
+
var sharedStore = store$1;
|
|
308
|
+
|
|
309
|
+
var shared = createCommonjsModule(function (module) {
|
|
310
|
+
(module.exports = function (key, value) {
|
|
311
|
+
return sharedStore[key] || (sharedStore[key] = value !== undefined ? value : {});
|
|
312
|
+
})('versions', []).push({
|
|
313
|
+
version: '3.16.3',
|
|
314
|
+
mode: 'global',
|
|
315
|
+
copyright: '© 2021 Denis Pushkarev (zloirock.ru)'
|
|
316
|
+
});
|
|
317
|
+
});
|
|
318
|
+
|
|
237
319
|
// `ToObject` abstract operation
|
|
238
320
|
// https://tc39.es/ecma262/#sec-toobject
|
|
239
321
|
var toObject = function (argument) {
|
|
@@ -242,10 +324,56 @@
|
|
|
242
324
|
|
|
243
325
|
var hasOwnProperty = {}.hasOwnProperty;
|
|
244
326
|
|
|
245
|
-
var has$1 = function hasOwn(it, key) {
|
|
327
|
+
var has$1 = Object.hasOwn || function hasOwn(it, key) {
|
|
246
328
|
return hasOwnProperty.call(toObject(it), key);
|
|
247
329
|
};
|
|
248
330
|
|
|
331
|
+
var id = 0;
|
|
332
|
+
var postfix = Math.random();
|
|
333
|
+
|
|
334
|
+
var uid = function (key) {
|
|
335
|
+
return 'Symbol(' + String(key === undefined ? '' : key) + ')_' + (++id + postfix).toString(36);
|
|
336
|
+
};
|
|
337
|
+
|
|
338
|
+
var WellKnownSymbolsStore$1 = shared('wks');
|
|
339
|
+
var Symbol$1 = global_1.Symbol;
|
|
340
|
+
var createWellKnownSymbol = useSymbolAsUid ? Symbol$1 : Symbol$1 && Symbol$1.withoutSetter || uid;
|
|
341
|
+
|
|
342
|
+
var wellKnownSymbol = function (name) {
|
|
343
|
+
if (!has$1(WellKnownSymbolsStore$1, name) || !(nativeSymbol || typeof WellKnownSymbolsStore$1[name] == 'string')) {
|
|
344
|
+
if (nativeSymbol && has$1(Symbol$1, name)) {
|
|
345
|
+
WellKnownSymbolsStore$1[name] = Symbol$1[name];
|
|
346
|
+
} else {
|
|
347
|
+
WellKnownSymbolsStore$1[name] = createWellKnownSymbol('Symbol.' + name);
|
|
348
|
+
}
|
|
349
|
+
} return WellKnownSymbolsStore$1[name];
|
|
350
|
+
};
|
|
351
|
+
|
|
352
|
+
var TO_PRIMITIVE$1 = wellKnownSymbol('toPrimitive');
|
|
353
|
+
|
|
354
|
+
// `ToPrimitive` abstract operation
|
|
355
|
+
// https://tc39.es/ecma262/#sec-toprimitive
|
|
356
|
+
var toPrimitive = function (input, pref) {
|
|
357
|
+
if (!isObject(input) || isSymbol(input)) return input;
|
|
358
|
+
var exoticToPrim = input[TO_PRIMITIVE$1];
|
|
359
|
+
var result;
|
|
360
|
+
if (exoticToPrim !== undefined) {
|
|
361
|
+
if (pref === undefined) pref = 'default';
|
|
362
|
+
result = exoticToPrim.call(input, pref);
|
|
363
|
+
if (!isObject(result) || isSymbol(result)) return result;
|
|
364
|
+
throw TypeError("Can't convert object to primitive value");
|
|
365
|
+
}
|
|
366
|
+
if (pref === undefined) pref = 'number';
|
|
367
|
+
return ordinaryToPrimitive(input, pref);
|
|
368
|
+
};
|
|
369
|
+
|
|
370
|
+
// `ToPropertyKey` abstract operation
|
|
371
|
+
// https://tc39.es/ecma262/#sec-topropertykey
|
|
372
|
+
var toPropertyKey = function (argument) {
|
|
373
|
+
var key = toPrimitive(argument, 'string');
|
|
374
|
+
return isSymbol(key) ? key : String(key);
|
|
375
|
+
};
|
|
376
|
+
|
|
249
377
|
var document$1 = global_1.document;
|
|
250
378
|
// typeof document.createElement is 'object' in old IE
|
|
251
379
|
var EXISTS = isObject(document$1) && isObject(document$1.createElement);
|
|
@@ -269,7 +397,7 @@
|
|
|
269
397
|
// https://tc39.es/ecma262/#sec-object.getownpropertydescriptor
|
|
270
398
|
var f$5 = descriptors ? $getOwnPropertyDescriptor$1 : function getOwnPropertyDescriptor(O, P) {
|
|
271
399
|
O = toIndexedObject(O);
|
|
272
|
-
P =
|
|
400
|
+
P = toPropertyKey(P);
|
|
273
401
|
if (ie8DomDefine) try {
|
|
274
402
|
return $getOwnPropertyDescriptor$1(O, P);
|
|
275
403
|
} catch (error) { /* empty */ }
|
|
@@ -293,7 +421,7 @@
|
|
|
293
421
|
// https://tc39.es/ecma262/#sec-object.defineproperty
|
|
294
422
|
var f$4 = descriptors ? $defineProperty$1 : function defineProperty(O, P, Attributes) {
|
|
295
423
|
anObject(O);
|
|
296
|
-
P =
|
|
424
|
+
P = toPropertyKey(P);
|
|
297
425
|
anObject(Attributes);
|
|
298
426
|
if (ie8DomDefine) try {
|
|
299
427
|
return $defineProperty$1(O, P, Attributes);
|
|
@@ -314,22 +442,9 @@
|
|
|
314
442
|
return object;
|
|
315
443
|
};
|
|
316
444
|
|
|
317
|
-
var setGlobal = function (key, value) {
|
|
318
|
-
try {
|
|
319
|
-
createNonEnumerableProperty(global_1, key, value);
|
|
320
|
-
} catch (error) {
|
|
321
|
-
global_1[key] = value;
|
|
322
|
-
} return value;
|
|
323
|
-
};
|
|
324
|
-
|
|
325
|
-
var SHARED = '__core-js_shared__';
|
|
326
|
-
var store$1 = global_1[SHARED] || setGlobal(SHARED, {});
|
|
327
|
-
|
|
328
|
-
var sharedStore = store$1;
|
|
329
|
-
|
|
330
445
|
var functionToString = Function.toString;
|
|
331
446
|
|
|
332
|
-
// this helper broken in `3.4.1-3.4.4`, so we can't use `shared` helper
|
|
447
|
+
// this helper broken in `core-js@3.4.1-3.4.4`, so we can't use `shared` helper
|
|
333
448
|
if (typeof sharedStore.inspectSource != 'function') {
|
|
334
449
|
sharedStore.inspectSource = function (it) {
|
|
335
450
|
return functionToString.call(it);
|
|
@@ -342,23 +457,6 @@
|
|
|
342
457
|
|
|
343
458
|
var nativeWeakMap = typeof WeakMap$1 === 'function' && /native code/.test(inspectSource(WeakMap$1));
|
|
344
459
|
|
|
345
|
-
var shared = createCommonjsModule(function (module) {
|
|
346
|
-
(module.exports = function (key, value) {
|
|
347
|
-
return sharedStore[key] || (sharedStore[key] = value !== undefined ? value : {});
|
|
348
|
-
})('versions', []).push({
|
|
349
|
-
version: '3.11.0',
|
|
350
|
-
mode: 'global',
|
|
351
|
-
copyright: '© 2021 Denis Pushkarev (zloirock.ru)'
|
|
352
|
-
});
|
|
353
|
-
});
|
|
354
|
-
|
|
355
|
-
var id = 0;
|
|
356
|
-
var postfix = Math.random();
|
|
357
|
-
|
|
358
|
-
var uid = function (key) {
|
|
359
|
-
return 'Symbol(' + String(key === undefined ? '' : key) + ')_' + (++id + postfix).toString(36);
|
|
360
|
-
};
|
|
361
|
-
|
|
362
460
|
var keys = shared('keys');
|
|
363
461
|
|
|
364
462
|
var sharedKey = function (key) {
|
|
@@ -384,7 +482,7 @@
|
|
|
384
482
|
};
|
|
385
483
|
};
|
|
386
484
|
|
|
387
|
-
if (nativeWeakMap) {
|
|
485
|
+
if (nativeWeakMap || sharedStore.state) {
|
|
388
486
|
var store = sharedStore.state || (sharedStore.state = new WeakMap());
|
|
389
487
|
var wmget = store.get;
|
|
390
488
|
var wmhas = store.has;
|
|
@@ -462,17 +560,6 @@
|
|
|
462
560
|
});
|
|
463
561
|
});
|
|
464
562
|
|
|
465
|
-
var path = global_1;
|
|
466
|
-
|
|
467
|
-
var aFunction$1 = function (variable) {
|
|
468
|
-
return typeof variable == 'function' ? variable : undefined;
|
|
469
|
-
};
|
|
470
|
-
|
|
471
|
-
var getBuiltIn = function (namespace, method) {
|
|
472
|
-
return arguments.length < 2 ? aFunction$1(path[namespace]) || aFunction$1(global_1[namespace])
|
|
473
|
-
: path[namespace] && path[namespace][method] || global_1[namespace] && global_1[namespace][method];
|
|
474
|
-
};
|
|
475
|
-
|
|
476
563
|
var ceil = Math.ceil;
|
|
477
564
|
var floor = Math.floor;
|
|
478
565
|
|
|
@@ -668,56 +755,9 @@
|
|
|
668
755
|
}
|
|
669
756
|
};
|
|
670
757
|
|
|
671
|
-
var
|
|
672
|
-
|
|
673
|
-
|
|
674
|
-
|
|
675
|
-
var process = global_1.process;
|
|
676
|
-
var versions = process && process.versions;
|
|
677
|
-
var v8 = versions && versions.v8;
|
|
678
|
-
var match, version$1;
|
|
679
|
-
|
|
680
|
-
if (v8) {
|
|
681
|
-
match = v8.split('.');
|
|
682
|
-
version$1 = match[0] + match[1];
|
|
683
|
-
} else if (engineUserAgent) {
|
|
684
|
-
match = engineUserAgent.match(/Edge\/(\d+)/);
|
|
685
|
-
if (!match || match[1] >= 74) {
|
|
686
|
-
match = engineUserAgent.match(/Chrome\/(\d+)/);
|
|
687
|
-
if (match) version$1 = match[1];
|
|
688
|
-
}
|
|
689
|
-
}
|
|
690
|
-
|
|
691
|
-
var engineV8Version = version$1 && +version$1;
|
|
692
|
-
|
|
693
|
-
// eslint-disable-next-line es/no-object-getownpropertysymbols -- required for testing
|
|
694
|
-
var nativeSymbol = !!Object.getOwnPropertySymbols && !fails(function () {
|
|
695
|
-
// eslint-disable-next-line es/no-symbol -- required for testing
|
|
696
|
-
return !Symbol.sham &&
|
|
697
|
-
// Chrome 38 Symbol has incorrect toString conversion
|
|
698
|
-
// Chrome 38-40 symbols are not inherited from DOM collections prototypes to instances
|
|
699
|
-
(engineIsNode ? engineV8Version === 38 : engineV8Version > 37 && engineV8Version < 41);
|
|
700
|
-
});
|
|
701
|
-
|
|
702
|
-
/* eslint-disable es/no-symbol -- required for testing */
|
|
703
|
-
|
|
704
|
-
|
|
705
|
-
var useSymbolAsUid = nativeSymbol
|
|
706
|
-
&& !Symbol.sham
|
|
707
|
-
&& typeof Symbol.iterator == 'symbol';
|
|
708
|
-
|
|
709
|
-
var WellKnownSymbolsStore$1 = shared('wks');
|
|
710
|
-
var Symbol$1 = global_1.Symbol;
|
|
711
|
-
var createWellKnownSymbol = useSymbolAsUid ? Symbol$1 : Symbol$1 && Symbol$1.withoutSetter || uid;
|
|
712
|
-
|
|
713
|
-
var wellKnownSymbol = function (name) {
|
|
714
|
-
if (!has$1(WellKnownSymbolsStore$1, name) || !(nativeSymbol || typeof WellKnownSymbolsStore$1[name] == 'string')) {
|
|
715
|
-
if (nativeSymbol && has$1(Symbol$1, name)) {
|
|
716
|
-
WellKnownSymbolsStore$1[name] = Symbol$1[name];
|
|
717
|
-
} else {
|
|
718
|
-
WellKnownSymbolsStore$1[name] = createWellKnownSymbol('Symbol.' + name);
|
|
719
|
-
}
|
|
720
|
-
} return WellKnownSymbolsStore$1[name];
|
|
758
|
+
var toString_1 = function (argument) {
|
|
759
|
+
if (isSymbol(argument)) throw TypeError('Cannot convert a Symbol value to a string');
|
|
760
|
+
return String(argument);
|
|
721
761
|
};
|
|
722
762
|
|
|
723
763
|
var MATCH$1 = wellKnownSymbol('match');
|
|
@@ -756,6 +796,7 @@
|
|
|
756
796
|
|
|
757
797
|
|
|
758
798
|
|
|
799
|
+
|
|
759
800
|
// eslint-disable-next-line es/no-string-prototype-startswith -- safe
|
|
760
801
|
var $startsWith = ''.startsWith;
|
|
761
802
|
var min = Math.min;
|
|
@@ -771,10 +812,10 @@
|
|
|
771
812
|
// https://tc39.es/ecma262/#sec-string.prototype.startswith
|
|
772
813
|
_export({ target: 'String', proto: true, forced: !MDN_POLYFILL_BUG && !CORRECT_IS_REGEXP_LOGIC }, {
|
|
773
814
|
startsWith: function startsWith(searchString /* , position = 0 */) {
|
|
774
|
-
var that =
|
|
815
|
+
var that = toString_1(requireObjectCoercible(this));
|
|
775
816
|
notARegexp(searchString);
|
|
776
817
|
var index = toLength(min(arguments.length > 1 ? arguments[1] : undefined, that.length));
|
|
777
|
-
var search =
|
|
818
|
+
var search = toString_1(searchString);
|
|
778
819
|
return $startsWith
|
|
779
820
|
? $startsWith.call(that, search, index)
|
|
780
821
|
: that.slice(index, index + search.length) === search;
|
|
@@ -826,16 +867,16 @@
|
|
|
826
867
|
};
|
|
827
868
|
|
|
828
869
|
var createProperty = function (object, key, value) {
|
|
829
|
-
var propertyKey =
|
|
870
|
+
var propertyKey = toPropertyKey(key);
|
|
830
871
|
if (propertyKey in object) objectDefineProperty.f(object, propertyKey, createPropertyDescriptor(0, value));
|
|
831
872
|
else object[propertyKey] = value;
|
|
832
873
|
};
|
|
833
874
|
|
|
834
875
|
var SPECIES$3 = wellKnownSymbol('species');
|
|
835
876
|
|
|
836
|
-
// `ArraySpeciesCreate` abstract operation
|
|
877
|
+
// a part of `ArraySpeciesCreate` abstract operation
|
|
837
878
|
// https://tc39.es/ecma262/#sec-arrayspeciescreate
|
|
838
|
-
var
|
|
879
|
+
var arraySpeciesConstructor = function (originalArray) {
|
|
839
880
|
var C;
|
|
840
881
|
if (isArray$1(originalArray)) {
|
|
841
882
|
C = originalArray.constructor;
|
|
@@ -845,7 +886,13 @@
|
|
|
845
886
|
C = C[SPECIES$3];
|
|
846
887
|
if (C === null) C = undefined;
|
|
847
888
|
}
|
|
848
|
-
} return
|
|
889
|
+
} return C === undefined ? Array : C;
|
|
890
|
+
};
|
|
891
|
+
|
|
892
|
+
// `ArraySpeciesCreate` abstract operation
|
|
893
|
+
// https://tc39.es/ecma262/#sec-arrayspeciescreate
|
|
894
|
+
var arraySpeciesCreate = function (originalArray, length) {
|
|
895
|
+
return new (arraySpeciesConstructor(originalArray))(length === 0 ? 0 : length);
|
|
849
896
|
};
|
|
850
897
|
|
|
851
898
|
var SPECIES$2 = wellKnownSymbol('species');
|
|
@@ -913,14 +960,14 @@
|
|
|
913
960
|
}
|
|
914
961
|
});
|
|
915
962
|
|
|
916
|
-
var TO_STRING_TAG$
|
|
963
|
+
var TO_STRING_TAG$3 = wellKnownSymbol('toStringTag');
|
|
917
964
|
var test = {};
|
|
918
965
|
|
|
919
|
-
test[TO_STRING_TAG$
|
|
966
|
+
test[TO_STRING_TAG$3] = 'z';
|
|
920
967
|
|
|
921
968
|
var toStringTagSupport = String(test) === '[object z]';
|
|
922
969
|
|
|
923
|
-
var TO_STRING_TAG$
|
|
970
|
+
var TO_STRING_TAG$2 = wellKnownSymbol('toStringTag');
|
|
924
971
|
// ES3 wrong here
|
|
925
972
|
var CORRECT_ARGUMENTS = classofRaw(function () { return arguments; }()) == 'Arguments';
|
|
926
973
|
|
|
@@ -936,7 +983,7 @@
|
|
|
936
983
|
var O, tag, result;
|
|
937
984
|
return it === undefined ? 'Undefined' : it === null ? 'Null'
|
|
938
985
|
// @@toStringTag case
|
|
939
|
-
: typeof (tag = tryGet(O = Object(it), TO_STRING_TAG$
|
|
986
|
+
: typeof (tag = tryGet(O = Object(it), TO_STRING_TAG$2)) == 'string' ? tag
|
|
940
987
|
// builtinTag case
|
|
941
988
|
: CORRECT_ARGUMENTS ? classofRaw(O)
|
|
942
989
|
// ES3 arguments fallback
|
|
@@ -977,6 +1024,15 @@
|
|
|
977
1024
|
|
|
978
1025
|
var html = getBuiltIn('document', 'documentElement');
|
|
979
1026
|
|
|
1027
|
+
/* global ActiveXObject -- old IE, WSH */
|
|
1028
|
+
|
|
1029
|
+
|
|
1030
|
+
|
|
1031
|
+
|
|
1032
|
+
|
|
1033
|
+
|
|
1034
|
+
|
|
1035
|
+
|
|
980
1036
|
var GT = '>';
|
|
981
1037
|
var LT = '<';
|
|
982
1038
|
var PROTOTYPE$1 = 'prototype';
|
|
@@ -1023,10 +1079,13 @@
|
|
|
1023
1079
|
var activeXDocument;
|
|
1024
1080
|
var NullProtoObject = function () {
|
|
1025
1081
|
try {
|
|
1026
|
-
|
|
1027
|
-
activeXDocument = document.domain && new ActiveXObject('htmlfile');
|
|
1082
|
+
activeXDocument = new ActiveXObject('htmlfile');
|
|
1028
1083
|
} catch (error) { /* ignore */ }
|
|
1029
|
-
NullProtoObject =
|
|
1084
|
+
NullProtoObject = typeof document != 'undefined'
|
|
1085
|
+
? document.domain && activeXDocument
|
|
1086
|
+
? NullProtoObjectViaActiveX(activeXDocument) // old IE
|
|
1087
|
+
: NullProtoObjectViaIFrame()
|
|
1088
|
+
: NullProtoObjectViaActiveX(activeXDocument); // WSH
|
|
1030
1089
|
var length = enumBugKeys.length;
|
|
1031
1090
|
while (length--) delete NullProtoObject[PROTOTYPE$1][enumBugKeys[length]];
|
|
1032
1091
|
return NullProtoObject();
|
|
@@ -1082,6 +1141,8 @@
|
|
|
1082
1141
|
f: f
|
|
1083
1142
|
};
|
|
1084
1143
|
|
|
1144
|
+
var path = global_1;
|
|
1145
|
+
|
|
1085
1146
|
var defineProperty$4 = objectDefineProperty.f;
|
|
1086
1147
|
|
|
1087
1148
|
var defineWellKnownSymbol = function (NAME) {
|
|
@@ -1095,24 +1156,24 @@
|
|
|
1095
1156
|
|
|
1096
1157
|
|
|
1097
1158
|
|
|
1098
|
-
var TO_STRING_TAG$
|
|
1159
|
+
var TO_STRING_TAG$1 = wellKnownSymbol('toStringTag');
|
|
1099
1160
|
|
|
1100
1161
|
var setToStringTag = function (it, TAG, STATIC) {
|
|
1101
|
-
if (it && !has$1(it = STATIC ? it : it.prototype, TO_STRING_TAG$
|
|
1102
|
-
defineProperty$3(it, TO_STRING_TAG$
|
|
1162
|
+
if (it && !has$1(it = STATIC ? it : it.prototype, TO_STRING_TAG$1)) {
|
|
1163
|
+
defineProperty$3(it, TO_STRING_TAG$1, { configurable: true, value: TAG });
|
|
1103
1164
|
}
|
|
1104
1165
|
};
|
|
1105
1166
|
|
|
1106
1167
|
var push = [].push;
|
|
1107
1168
|
|
|
1108
|
-
// `Array.prototype.{ forEach, map, filter, some, every, find, findIndex,
|
|
1169
|
+
// `Array.prototype.{ forEach, map, filter, some, every, find, findIndex, filterReject }` methods implementation
|
|
1109
1170
|
var createMethod$1 = function (TYPE) {
|
|
1110
1171
|
var IS_MAP = TYPE == 1;
|
|
1111
1172
|
var IS_FILTER = TYPE == 2;
|
|
1112
1173
|
var IS_SOME = TYPE == 3;
|
|
1113
1174
|
var IS_EVERY = TYPE == 4;
|
|
1114
1175
|
var IS_FIND_INDEX = TYPE == 6;
|
|
1115
|
-
var
|
|
1176
|
+
var IS_FILTER_REJECT = TYPE == 7;
|
|
1116
1177
|
var NO_HOLES = TYPE == 5 || IS_FIND_INDEX;
|
|
1117
1178
|
return function ($this, callbackfn, that, specificCreate) {
|
|
1118
1179
|
var O = toObject($this);
|
|
@@ -1121,7 +1182,7 @@
|
|
|
1121
1182
|
var length = toLength(self.length);
|
|
1122
1183
|
var index = 0;
|
|
1123
1184
|
var create = specificCreate || arraySpeciesCreate;
|
|
1124
|
-
var target = IS_MAP ? create($this, length) : IS_FILTER ||
|
|
1185
|
+
var target = IS_MAP ? create($this, length) : IS_FILTER || IS_FILTER_REJECT ? create($this, 0) : undefined;
|
|
1125
1186
|
var value, result;
|
|
1126
1187
|
for (;length > index; index++) if (NO_HOLES || index in self) {
|
|
1127
1188
|
value = self[index];
|
|
@@ -1135,7 +1196,7 @@
|
|
|
1135
1196
|
case 2: push.call(target, value); // filter
|
|
1136
1197
|
} else switch (TYPE) {
|
|
1137
1198
|
case 4: return false; // every
|
|
1138
|
-
case 7: push.call(target, value); //
|
|
1199
|
+
case 7: push.call(target, value); // filterReject
|
|
1139
1200
|
}
|
|
1140
1201
|
}
|
|
1141
1202
|
}
|
|
@@ -1165,9 +1226,9 @@
|
|
|
1165
1226
|
// `Array.prototype.findIndex` method
|
|
1166
1227
|
// https://tc39.es/ecma262/#sec-array.prototype.findIndex
|
|
1167
1228
|
findIndex: createMethod$1(6),
|
|
1168
|
-
// `Array.prototype.
|
|
1229
|
+
// `Array.prototype.filterReject` method
|
|
1169
1230
|
// https://github.com/tc39/proposal-array-filtering
|
|
1170
|
-
|
|
1231
|
+
filterReject: createMethod$1(7)
|
|
1171
1232
|
};
|
|
1172
1233
|
|
|
1173
1234
|
var $forEach = arrayIteration.forEach;
|
|
@@ -1219,16 +1280,10 @@
|
|
|
1219
1280
|
return symbol;
|
|
1220
1281
|
};
|
|
1221
1282
|
|
|
1222
|
-
var isSymbol = useSymbolAsUid ? function (it) {
|
|
1223
|
-
return typeof it == 'symbol';
|
|
1224
|
-
} : function (it) {
|
|
1225
|
-
return Object(it) instanceof $Symbol;
|
|
1226
|
-
};
|
|
1227
|
-
|
|
1228
1283
|
var $defineProperty = function defineProperty(O, P, Attributes) {
|
|
1229
1284
|
if (O === ObjectPrototype$2) $defineProperty(ObjectPrototypeSymbols, P, Attributes);
|
|
1230
1285
|
anObject(O);
|
|
1231
|
-
var key =
|
|
1286
|
+
var key = toPropertyKey(P);
|
|
1232
1287
|
anObject(Attributes);
|
|
1233
1288
|
if (has$1(AllSymbols, key)) {
|
|
1234
1289
|
if (!Attributes.enumerable) {
|
|
@@ -1256,7 +1311,7 @@
|
|
|
1256
1311
|
};
|
|
1257
1312
|
|
|
1258
1313
|
var $propertyIsEnumerable = function propertyIsEnumerable(V) {
|
|
1259
|
-
var P =
|
|
1314
|
+
var P = toPropertyKey(V);
|
|
1260
1315
|
var enumerable = nativePropertyIsEnumerable.call(this, P);
|
|
1261
1316
|
if (this === ObjectPrototype$2 && has$1(AllSymbols, P) && !has$1(ObjectPrototypeSymbols, P)) return false;
|
|
1262
1317
|
return enumerable || !has$1(this, P) || !has$1(AllSymbols, P) || has$1(this, HIDDEN) && this[HIDDEN][P] ? enumerable : true;
|
|
@@ -1264,7 +1319,7 @@
|
|
|
1264
1319
|
|
|
1265
1320
|
var $getOwnPropertyDescriptor = function getOwnPropertyDescriptor(O, P) {
|
|
1266
1321
|
var it = toIndexedObject(O);
|
|
1267
|
-
var key =
|
|
1322
|
+
var key = toPropertyKey(P);
|
|
1268
1323
|
if (it === ObjectPrototype$2 && has$1(AllSymbols, key) && !has$1(ObjectPrototypeSymbols, key)) return;
|
|
1269
1324
|
var descriptor = nativeGetOwnPropertyDescriptor(it, key);
|
|
1270
1325
|
if (descriptor && has$1(AllSymbols, key) && !(has$1(it, HIDDEN) && it[HIDDEN][key])) {
|
|
@@ -1299,7 +1354,7 @@
|
|
|
1299
1354
|
if (!nativeSymbol) {
|
|
1300
1355
|
$Symbol = function Symbol() {
|
|
1301
1356
|
if (this instanceof $Symbol) throw TypeError('Symbol is not a constructor');
|
|
1302
|
-
var description = !arguments.length || arguments[0] === undefined ? undefined :
|
|
1357
|
+
var description = !arguments.length || arguments[0] === undefined ? undefined : toString_1(arguments[0]);
|
|
1303
1358
|
var tag = uid(description);
|
|
1304
1359
|
var setter = function (value) {
|
|
1305
1360
|
if (this === ObjectPrototype$2) setter.call(ObjectPrototypeSymbols, value);
|
|
@@ -1354,7 +1409,7 @@
|
|
|
1354
1409
|
// `Symbol.for` method
|
|
1355
1410
|
// https://tc39.es/ecma262/#sec-symbol.for
|
|
1356
1411
|
'for': function (key) {
|
|
1357
|
-
var string =
|
|
1412
|
+
var string = toString_1(key);
|
|
1358
1413
|
if (has$1(StringToSymbolRegistry, string)) return StringToSymbolRegistry[string];
|
|
1359
1414
|
var symbol = $Symbol(string);
|
|
1360
1415
|
StringToSymbolRegistry[string] = symbol;
|
|
@@ -1557,10 +1612,10 @@
|
|
|
1557
1612
|
|
|
1558
1613
|
path.Symbol;
|
|
1559
1614
|
|
|
1560
|
-
// `String.prototype.
|
|
1615
|
+
// `String.prototype.codePointAt` methods implementation
|
|
1561
1616
|
var createMethod = function (CONVERT_TO_STRING) {
|
|
1562
1617
|
return function ($this, pos) {
|
|
1563
|
-
var S =
|
|
1618
|
+
var S = toString_1(requireObjectCoercible($this));
|
|
1564
1619
|
var position = toInteger(pos);
|
|
1565
1620
|
var size = S.length;
|
|
1566
1621
|
var first, second;
|
|
@@ -1603,7 +1658,7 @@
|
|
|
1603
1658
|
} return O instanceof Object ? ObjectPrototype$1 : null;
|
|
1604
1659
|
};
|
|
1605
1660
|
|
|
1606
|
-
var ITERATOR$
|
|
1661
|
+
var ITERATOR$4 = wellKnownSymbol('iterator');
|
|
1607
1662
|
var BUGGY_SAFARI_ITERATORS$1 = false;
|
|
1608
1663
|
|
|
1609
1664
|
var returnThis$2 = function () { return this; };
|
|
@@ -1626,14 +1681,15 @@
|
|
|
1626
1681
|
var NEW_ITERATOR_PROTOTYPE = IteratorPrototype$2 == undefined || fails(function () {
|
|
1627
1682
|
var test = {};
|
|
1628
1683
|
// FF44- legacy iterators case
|
|
1629
|
-
return IteratorPrototype$2[ITERATOR$
|
|
1684
|
+
return IteratorPrototype$2[ITERATOR$4].call(test) !== test;
|
|
1630
1685
|
});
|
|
1631
1686
|
|
|
1632
1687
|
if (NEW_ITERATOR_PROTOTYPE) IteratorPrototype$2 = {};
|
|
1633
1688
|
|
|
1634
|
-
//
|
|
1635
|
-
|
|
1636
|
-
|
|
1689
|
+
// `%IteratorPrototype%[@@iterator]()` method
|
|
1690
|
+
// https://tc39.es/ecma262/#sec-%iteratorprototype%-@@iterator
|
|
1691
|
+
if (!has$1(IteratorPrototype$2, ITERATOR$4)) {
|
|
1692
|
+
createNonEnumerableProperty(IteratorPrototype$2, ITERATOR$4, returnThis$2);
|
|
1637
1693
|
}
|
|
1638
1694
|
|
|
1639
1695
|
var iteratorsCore = {
|
|
@@ -1694,7 +1750,7 @@
|
|
|
1694
1750
|
|
|
1695
1751
|
var IteratorPrototype = iteratorsCore.IteratorPrototype;
|
|
1696
1752
|
var BUGGY_SAFARI_ITERATORS = iteratorsCore.BUGGY_SAFARI_ITERATORS;
|
|
1697
|
-
var ITERATOR$
|
|
1753
|
+
var ITERATOR$3 = wellKnownSymbol('iterator');
|
|
1698
1754
|
var KEYS = 'keys';
|
|
1699
1755
|
var VALUES = 'values';
|
|
1700
1756
|
var ENTRIES = 'entries';
|
|
@@ -1717,7 +1773,7 @@
|
|
|
1717
1773
|
var TO_STRING_TAG = NAME + ' Iterator';
|
|
1718
1774
|
var INCORRECT_VALUES_NAME = false;
|
|
1719
1775
|
var IterablePrototype = Iterable.prototype;
|
|
1720
|
-
var nativeIterator = IterablePrototype[ITERATOR$
|
|
1776
|
+
var nativeIterator = IterablePrototype[ITERATOR$3]
|
|
1721
1777
|
|| IterablePrototype['@@iterator']
|
|
1722
1778
|
|| DEFAULT && IterablePrototype[DEFAULT];
|
|
1723
1779
|
var defaultIterator = !BUGGY_SAFARI_ITERATORS && nativeIterator || getIterationMethod(DEFAULT);
|
|
@@ -1731,8 +1787,8 @@
|
|
|
1731
1787
|
if (objectGetPrototypeOf(CurrentIteratorPrototype) !== IteratorPrototype) {
|
|
1732
1788
|
if (objectSetPrototypeOf) {
|
|
1733
1789
|
objectSetPrototypeOf(CurrentIteratorPrototype, IteratorPrototype);
|
|
1734
|
-
} else if (typeof CurrentIteratorPrototype[ITERATOR$
|
|
1735
|
-
createNonEnumerableProperty(CurrentIteratorPrototype, ITERATOR$
|
|
1790
|
+
} else if (typeof CurrentIteratorPrototype[ITERATOR$3] != 'function') {
|
|
1791
|
+
createNonEnumerableProperty(CurrentIteratorPrototype, ITERATOR$3, returnThis);
|
|
1736
1792
|
}
|
|
1737
1793
|
}
|
|
1738
1794
|
// Set @@toStringTag to native iterators
|
|
@@ -1740,15 +1796,15 @@
|
|
|
1740
1796
|
}
|
|
1741
1797
|
}
|
|
1742
1798
|
|
|
1743
|
-
// fix Array
|
|
1799
|
+
// fix Array.prototype.{ values, @@iterator }.name in V8 / FF
|
|
1744
1800
|
if (DEFAULT == VALUES && nativeIterator && nativeIterator.name !== VALUES) {
|
|
1745
1801
|
INCORRECT_VALUES_NAME = true;
|
|
1746
1802
|
defaultIterator = function values() { return nativeIterator.call(this); };
|
|
1747
1803
|
}
|
|
1748
1804
|
|
|
1749
1805
|
// define iterator
|
|
1750
|
-
if (IterablePrototype[ITERATOR$
|
|
1751
|
-
createNonEnumerableProperty(IterablePrototype, ITERATOR$
|
|
1806
|
+
if (IterablePrototype[ITERATOR$3] !== defaultIterator) {
|
|
1807
|
+
createNonEnumerableProperty(IterablePrototype, ITERATOR$3, defaultIterator);
|
|
1752
1808
|
}
|
|
1753
1809
|
iterators[NAME] = defaultIterator;
|
|
1754
1810
|
|
|
@@ -1773,6 +1829,7 @@
|
|
|
1773
1829
|
|
|
1774
1830
|
|
|
1775
1831
|
|
|
1832
|
+
|
|
1776
1833
|
var STRING_ITERATOR = 'String Iterator';
|
|
1777
1834
|
var setInternalState$2 = internalState.set;
|
|
1778
1835
|
var getInternalState$1 = internalState.getterFor(STRING_ITERATOR);
|
|
@@ -1782,7 +1839,7 @@
|
|
|
1782
1839
|
defineIterator(String, 'String', function (iterated) {
|
|
1783
1840
|
setInternalState$2(this, {
|
|
1784
1841
|
type: STRING_ITERATOR,
|
|
1785
|
-
string:
|
|
1842
|
+
string: toString_1(iterated),
|
|
1786
1843
|
index: 0
|
|
1787
1844
|
});
|
|
1788
1845
|
// `%StringIteratorPrototype%.next` method
|
|
@@ -1809,25 +1866,24 @@
|
|
|
1809
1866
|
var callWithSafeIterationClosing = function (iterator, fn, value, ENTRIES) {
|
|
1810
1867
|
try {
|
|
1811
1868
|
return ENTRIES ? fn(anObject(value)[0], value[1]) : fn(value);
|
|
1812
|
-
// 7.4.6 IteratorClose(iterator, completion)
|
|
1813
1869
|
} catch (error) {
|
|
1814
1870
|
iteratorClose(iterator);
|
|
1815
1871
|
throw error;
|
|
1816
1872
|
}
|
|
1817
1873
|
};
|
|
1818
1874
|
|
|
1819
|
-
var ITERATOR$
|
|
1875
|
+
var ITERATOR$2 = wellKnownSymbol('iterator');
|
|
1820
1876
|
var ArrayPrototype$1 = Array.prototype;
|
|
1821
1877
|
|
|
1822
1878
|
// check on default Array iterator
|
|
1823
1879
|
var isArrayIteratorMethod = function (it) {
|
|
1824
|
-
return it !== undefined && (iterators.Array === it || ArrayPrototype$1[ITERATOR$
|
|
1880
|
+
return it !== undefined && (iterators.Array === it || ArrayPrototype$1[ITERATOR$2] === it);
|
|
1825
1881
|
};
|
|
1826
1882
|
|
|
1827
|
-
var ITERATOR$
|
|
1883
|
+
var ITERATOR$1 = wellKnownSymbol('iterator');
|
|
1828
1884
|
|
|
1829
1885
|
var getIteratorMethod = function (it) {
|
|
1830
|
-
if (it != undefined) return it[ITERATOR$
|
|
1886
|
+
if (it != undefined) return it[ITERATOR$1]
|
|
1831
1887
|
|| it['@@iterator']
|
|
1832
1888
|
|| iterators[classof(it)];
|
|
1833
1889
|
};
|
|
@@ -1865,7 +1921,7 @@
|
|
|
1865
1921
|
return result;
|
|
1866
1922
|
};
|
|
1867
1923
|
|
|
1868
|
-
var ITERATOR
|
|
1924
|
+
var ITERATOR = wellKnownSymbol('iterator');
|
|
1869
1925
|
var SAFE_CLOSING = false;
|
|
1870
1926
|
|
|
1871
1927
|
try {
|
|
@@ -1878,7 +1934,7 @@
|
|
|
1878
1934
|
SAFE_CLOSING = true;
|
|
1879
1935
|
}
|
|
1880
1936
|
};
|
|
1881
|
-
iteratorWithReturn[ITERATOR
|
|
1937
|
+
iteratorWithReturn[ITERATOR] = function () {
|
|
1882
1938
|
return this;
|
|
1883
1939
|
};
|
|
1884
1940
|
// eslint-disable-next-line es/no-array-from, no-throw-literal -- required for testing
|
|
@@ -1890,7 +1946,7 @@
|
|
|
1890
1946
|
var ITERATION_SUPPORT = false;
|
|
1891
1947
|
try {
|
|
1892
1948
|
var object = {};
|
|
1893
|
-
object[ITERATOR
|
|
1949
|
+
object[ITERATOR] = function () {
|
|
1894
1950
|
return {
|
|
1895
1951
|
next: function () {
|
|
1896
1952
|
return { done: ITERATION_SUPPORT = true };
|
|
@@ -1933,12 +1989,13 @@
|
|
|
1933
1989
|
var ObjectPrototype = Object.prototype;
|
|
1934
1990
|
var isPrototypeOf = ObjectPrototype.isPrototypeOf;
|
|
1935
1991
|
|
|
1936
|
-
var TO_STRING_TAG
|
|
1992
|
+
var TO_STRING_TAG = wellKnownSymbol('toStringTag');
|
|
1937
1993
|
var TYPED_ARRAY_TAG = uid('TYPED_ARRAY_TAG');
|
|
1994
|
+
var TYPED_ARRAY_CONSTRUCTOR$1 = uid('TYPED_ARRAY_CONSTRUCTOR');
|
|
1938
1995
|
// Fixing native typed arrays in Opera Presto crashes the browser, see #595
|
|
1939
1996
|
var NATIVE_ARRAY_BUFFER_VIEWS = arrayBufferNative && !!objectSetPrototypeOf && classof(global_1.opera) !== 'Opera';
|
|
1940
1997
|
var TYPED_ARRAY_TAG_REQIRED = false;
|
|
1941
|
-
var NAME;
|
|
1998
|
+
var NAME, Constructor, Prototype;
|
|
1942
1999
|
|
|
1943
2000
|
var TypedArrayConstructorsList = {
|
|
1944
2001
|
Int8Array: 1,
|
|
@@ -1978,23 +2035,18 @@
|
|
|
1978
2035
|
};
|
|
1979
2036
|
|
|
1980
2037
|
var aTypedArrayConstructor$1 = function (C) {
|
|
1981
|
-
if (objectSetPrototypeOf) {
|
|
1982
|
-
|
|
1983
|
-
}
|
|
1984
|
-
var TypedArrayConstructor = global_1[ARRAY];
|
|
1985
|
-
if (TypedArrayConstructor && (C === TypedArrayConstructor || isPrototypeOf.call(TypedArrayConstructor, C))) {
|
|
1986
|
-
return C;
|
|
1987
|
-
}
|
|
1988
|
-
} throw TypeError('Target is not a typed array constructor');
|
|
2038
|
+
if (objectSetPrototypeOf && !isPrototypeOf.call(TypedArray, C)) {
|
|
2039
|
+
throw TypeError('Target is not a typed array constructor');
|
|
2040
|
+
} return C;
|
|
1989
2041
|
};
|
|
1990
2042
|
|
|
1991
2043
|
var exportTypedArrayMethod$1 = function (KEY, property, forced) {
|
|
1992
2044
|
if (!descriptors) return;
|
|
1993
2045
|
if (forced) for (var ARRAY in TypedArrayConstructorsList) {
|
|
1994
2046
|
var TypedArrayConstructor = global_1[ARRAY];
|
|
1995
|
-
if (TypedArrayConstructor && has$1(TypedArrayConstructor.prototype, KEY)) {
|
|
2047
|
+
if (TypedArrayConstructor && has$1(TypedArrayConstructor.prototype, KEY)) try {
|
|
1996
2048
|
delete TypedArrayConstructor.prototype[KEY];
|
|
1997
|
-
}
|
|
2049
|
+
} catch (error) { /* empty */ }
|
|
1998
2050
|
}
|
|
1999
2051
|
if (!TypedArrayPrototype[KEY] || forced) {
|
|
2000
2052
|
redefine(TypedArrayPrototype, KEY, forced ? property
|
|
@@ -2008,14 +2060,14 @@
|
|
|
2008
2060
|
if (objectSetPrototypeOf) {
|
|
2009
2061
|
if (forced) for (ARRAY in TypedArrayConstructorsList) {
|
|
2010
2062
|
TypedArrayConstructor = global_1[ARRAY];
|
|
2011
|
-
if (TypedArrayConstructor && has$1(TypedArrayConstructor, KEY)) {
|
|
2063
|
+
if (TypedArrayConstructor && has$1(TypedArrayConstructor, KEY)) try {
|
|
2012
2064
|
delete TypedArrayConstructor[KEY];
|
|
2013
|
-
}
|
|
2065
|
+
} catch (error) { /* empty */ }
|
|
2014
2066
|
}
|
|
2015
2067
|
if (!TypedArray[KEY] || forced) {
|
|
2016
2068
|
// V8 ~ Chrome 49-50 `%TypedArray%` methods are non-writable non-configurable
|
|
2017
2069
|
try {
|
|
2018
|
-
return redefine(TypedArray, KEY, forced ? property : NATIVE_ARRAY_BUFFER_VIEWS &&
|
|
2070
|
+
return redefine(TypedArray, KEY, forced ? property : NATIVE_ARRAY_BUFFER_VIEWS && TypedArray[KEY] || property);
|
|
2019
2071
|
} catch (error) { /* empty */ }
|
|
2020
2072
|
} else return;
|
|
2021
2073
|
}
|
|
@@ -2028,7 +2080,16 @@
|
|
|
2028
2080
|
};
|
|
2029
2081
|
|
|
2030
2082
|
for (NAME in TypedArrayConstructorsList) {
|
|
2031
|
-
|
|
2083
|
+
Constructor = global_1[NAME];
|
|
2084
|
+
Prototype = Constructor && Constructor.prototype;
|
|
2085
|
+
if (Prototype) createNonEnumerableProperty(Prototype, TYPED_ARRAY_CONSTRUCTOR$1, Constructor);
|
|
2086
|
+
else NATIVE_ARRAY_BUFFER_VIEWS = false;
|
|
2087
|
+
}
|
|
2088
|
+
|
|
2089
|
+
for (NAME in BigIntArrayConstructorsList) {
|
|
2090
|
+
Constructor = global_1[NAME];
|
|
2091
|
+
Prototype = Constructor && Constructor.prototype;
|
|
2092
|
+
if (Prototype) createNonEnumerableProperty(Prototype, TYPED_ARRAY_CONSTRUCTOR$1, Constructor);
|
|
2032
2093
|
}
|
|
2033
2094
|
|
|
2034
2095
|
// WebKit bug - typed arrays constructors prototype is Object.prototype
|
|
@@ -2054,9 +2115,9 @@
|
|
|
2054
2115
|
objectSetPrototypeOf(Uint8ClampedArrayPrototype, TypedArrayPrototype);
|
|
2055
2116
|
}
|
|
2056
2117
|
|
|
2057
|
-
if (descriptors && !has$1(TypedArrayPrototype, TO_STRING_TAG
|
|
2118
|
+
if (descriptors && !has$1(TypedArrayPrototype, TO_STRING_TAG)) {
|
|
2058
2119
|
TYPED_ARRAY_TAG_REQIRED = true;
|
|
2059
|
-
defineProperty$1(TypedArrayPrototype, TO_STRING_TAG
|
|
2120
|
+
defineProperty$1(TypedArrayPrototype, TO_STRING_TAG, { get: function () {
|
|
2060
2121
|
return isObject(this) ? this[TYPED_ARRAY_TAG] : undefined;
|
|
2061
2122
|
} });
|
|
2062
2123
|
for (NAME in TypedArrayConstructorsList) if (global_1[NAME]) {
|
|
@@ -2066,6 +2127,7 @@
|
|
|
2066
2127
|
|
|
2067
2128
|
var arrayBufferViewCore = {
|
|
2068
2129
|
NATIVE_ARRAY_BUFFER_VIEWS: NATIVE_ARRAY_BUFFER_VIEWS,
|
|
2130
|
+
TYPED_ARRAY_CONSTRUCTOR: TYPED_ARRAY_CONSTRUCTOR$1,
|
|
2069
2131
|
TYPED_ARRAY_TAG: TYPED_ARRAY_TAG_REQIRED && TYPED_ARRAY_TAG,
|
|
2070
2132
|
aTypedArray: aTypedArray$1,
|
|
2071
2133
|
aTypedArrayConstructor: aTypedArrayConstructor$1,
|
|
@@ -2087,8 +2149,16 @@
|
|
|
2087
2149
|
return C === undefined || (S = anObject(C)[SPECIES$1]) == undefined ? defaultConstructor : aFunction(S);
|
|
2088
2150
|
};
|
|
2089
2151
|
|
|
2090
|
-
var
|
|
2152
|
+
var TYPED_ARRAY_CONSTRUCTOR = arrayBufferViewCore.TYPED_ARRAY_CONSTRUCTOR;
|
|
2091
2153
|
var aTypedArrayConstructor = arrayBufferViewCore.aTypedArrayConstructor;
|
|
2154
|
+
|
|
2155
|
+
// a part of `TypedArraySpeciesCreate` abstract operation
|
|
2156
|
+
// https://tc39.es/ecma262/#typedarray-species-create
|
|
2157
|
+
var typedArraySpeciesConstructor = function (originalArray) {
|
|
2158
|
+
return aTypedArrayConstructor(speciesConstructor(originalArray, originalArray[TYPED_ARRAY_CONSTRUCTOR]));
|
|
2159
|
+
};
|
|
2160
|
+
|
|
2161
|
+
var aTypedArray = arrayBufferViewCore.aTypedArray;
|
|
2092
2162
|
var exportTypedArrayMethod = arrayBufferViewCore.exportTypedArrayMethod;
|
|
2093
2163
|
var $slice = [].slice;
|
|
2094
2164
|
|
|
@@ -2101,10 +2171,10 @@
|
|
|
2101
2171
|
// https://tc39.es/ecma262/#sec-%typedarray%.prototype.slice
|
|
2102
2172
|
exportTypedArrayMethod('slice', function slice(start, end) {
|
|
2103
2173
|
var list = $slice.call(aTypedArray(this), start, end);
|
|
2104
|
-
var C =
|
|
2174
|
+
var C = typedArraySpeciesConstructor(this);
|
|
2105
2175
|
var index = 0;
|
|
2106
2176
|
var length = list.length;
|
|
2107
|
-
var result = new
|
|
2177
|
+
var result = new C(length);
|
|
2108
2178
|
while (length > index) result[index] = list[index++];
|
|
2109
2179
|
return result;
|
|
2110
2180
|
}, FORCED);
|
|
@@ -2146,12 +2216,59 @@
|
|
|
2146
2216
|
// https://tc39.es/ecma262/#sec-string.prototype.includes
|
|
2147
2217
|
_export({ target: 'String', proto: true, forced: !correctIsRegexpLogic('includes') }, {
|
|
2148
2218
|
includes: function includes(searchString /* , position = 0 */) {
|
|
2149
|
-
return !!~
|
|
2150
|
-
.indexOf(notARegexp(searchString), arguments.length > 1 ? arguments[1] : undefined);
|
|
2219
|
+
return !!~toString_1(requireObjectCoercible(this))
|
|
2220
|
+
.indexOf(toString_1(notARegexp(searchString)), arguments.length > 1 ? arguments[1] : undefined);
|
|
2151
2221
|
}
|
|
2152
2222
|
});
|
|
2153
2223
|
|
|
2154
|
-
entryUnbind('String', 'includes');
|
|
2224
|
+
entryUnbind('String', 'includes');
|
|
2225
|
+
|
|
2226
|
+
var ARRAY_ITERATOR = 'Array Iterator';
|
|
2227
|
+
var setInternalState$1 = internalState.set;
|
|
2228
|
+
var getInternalState = internalState.getterFor(ARRAY_ITERATOR);
|
|
2229
|
+
|
|
2230
|
+
// `Array.prototype.entries` method
|
|
2231
|
+
// https://tc39.es/ecma262/#sec-array.prototype.entries
|
|
2232
|
+
// `Array.prototype.keys` method
|
|
2233
|
+
// https://tc39.es/ecma262/#sec-array.prototype.keys
|
|
2234
|
+
// `Array.prototype.values` method
|
|
2235
|
+
// https://tc39.es/ecma262/#sec-array.prototype.values
|
|
2236
|
+
// `Array.prototype[@@iterator]` method
|
|
2237
|
+
// https://tc39.es/ecma262/#sec-array.prototype-@@iterator
|
|
2238
|
+
// `CreateArrayIterator` internal method
|
|
2239
|
+
// https://tc39.es/ecma262/#sec-createarrayiterator
|
|
2240
|
+
defineIterator(Array, 'Array', function (iterated, kind) {
|
|
2241
|
+
setInternalState$1(this, {
|
|
2242
|
+
type: ARRAY_ITERATOR,
|
|
2243
|
+
target: toIndexedObject(iterated), // target
|
|
2244
|
+
index: 0, // next index
|
|
2245
|
+
kind: kind // kind
|
|
2246
|
+
});
|
|
2247
|
+
// `%ArrayIteratorPrototype%.next` method
|
|
2248
|
+
// https://tc39.es/ecma262/#sec-%arrayiteratorprototype%.next
|
|
2249
|
+
}, function () {
|
|
2250
|
+
var state = getInternalState(this);
|
|
2251
|
+
var target = state.target;
|
|
2252
|
+
var kind = state.kind;
|
|
2253
|
+
var index = state.index++;
|
|
2254
|
+
if (!target || index >= target.length) {
|
|
2255
|
+
state.target = undefined;
|
|
2256
|
+
return { value: undefined, done: true };
|
|
2257
|
+
}
|
|
2258
|
+
if (kind == 'keys') return { value: index, done: false };
|
|
2259
|
+
if (kind == 'values') return { value: target[index], done: false };
|
|
2260
|
+
return { value: [index, target[index]], done: false };
|
|
2261
|
+
}, 'values');
|
|
2262
|
+
|
|
2263
|
+
// argumentsList[@@iterator] is %ArrayProto_values%
|
|
2264
|
+
// https://tc39.es/ecma262/#sec-createunmappedargumentsobject
|
|
2265
|
+
// https://tc39.es/ecma262/#sec-createmappedargumentsobject
|
|
2266
|
+
iterators.Arguments = iterators.Array;
|
|
2267
|
+
|
|
2268
|
+
// https://tc39.es/ecma262/#sec-array.prototype-@@unscopables
|
|
2269
|
+
addToUnscopables('keys');
|
|
2270
|
+
addToUnscopables('values');
|
|
2271
|
+
addToUnscopables('entries');
|
|
2155
2272
|
|
|
2156
2273
|
var freezing = !fails(function () {
|
|
2157
2274
|
// eslint-disable-next-line es/no-object-isextensible, es/no-object-preventextensions -- required for testing
|
|
@@ -2163,6 +2280,9 @@
|
|
|
2163
2280
|
|
|
2164
2281
|
|
|
2165
2282
|
|
|
2283
|
+
|
|
2284
|
+
|
|
2285
|
+
var REQUIRED = false;
|
|
2166
2286
|
var METADATA = uid('meta');
|
|
2167
2287
|
var id = 0;
|
|
2168
2288
|
|
|
@@ -2173,7 +2293,7 @@
|
|
|
2173
2293
|
|
|
2174
2294
|
var setMetadata = function (it) {
|
|
2175
2295
|
defineProperty(it, METADATA, { value: {
|
|
2176
|
-
objectID: 'O' +
|
|
2296
|
+
objectID: 'O' + id++, // object ID
|
|
2177
2297
|
weakData: {} // weak collections IDs
|
|
2178
2298
|
} });
|
|
2179
2299
|
};
|
|
@@ -2206,12 +2326,38 @@
|
|
|
2206
2326
|
|
|
2207
2327
|
// add metadata on freeze-family methods calling
|
|
2208
2328
|
var onFreeze = function (it) {
|
|
2209
|
-
if (freezing &&
|
|
2329
|
+
if (freezing && REQUIRED && isExtensible(it) && !has$1(it, METADATA)) setMetadata(it);
|
|
2210
2330
|
return it;
|
|
2211
2331
|
};
|
|
2212
2332
|
|
|
2333
|
+
var enable = function () {
|
|
2334
|
+
meta.enable = function () { /* empty */ };
|
|
2335
|
+
REQUIRED = true;
|
|
2336
|
+
var getOwnPropertyNames = objectGetOwnPropertyNames.f;
|
|
2337
|
+
var splice = [].splice;
|
|
2338
|
+
var test = {};
|
|
2339
|
+
test[METADATA] = 1;
|
|
2340
|
+
|
|
2341
|
+
// prevent exposing of metadata key
|
|
2342
|
+
if (getOwnPropertyNames(test).length) {
|
|
2343
|
+
objectGetOwnPropertyNames.f = function (it) {
|
|
2344
|
+
var result = getOwnPropertyNames(it);
|
|
2345
|
+
for (var i = 0, length = result.length; i < length; i++) {
|
|
2346
|
+
if (result[i] === METADATA) {
|
|
2347
|
+
splice.call(result, i, 1);
|
|
2348
|
+
break;
|
|
2349
|
+
}
|
|
2350
|
+
} return result;
|
|
2351
|
+
};
|
|
2352
|
+
|
|
2353
|
+
_export({ target: 'Object', stat: true, forced: true }, {
|
|
2354
|
+
getOwnPropertyNames: objectGetOwnPropertyNamesExternal.f
|
|
2355
|
+
});
|
|
2356
|
+
}
|
|
2357
|
+
};
|
|
2358
|
+
|
|
2213
2359
|
var meta = module.exports = {
|
|
2214
|
-
|
|
2360
|
+
enable: enable,
|
|
2215
2361
|
fastKey: fastKey,
|
|
2216
2362
|
getWeakData: getWeakData,
|
|
2217
2363
|
onFreeze: onFreeze
|
|
@@ -2219,7 +2365,7 @@
|
|
|
2219
2365
|
|
|
2220
2366
|
hiddenKeys$1[METADATA] = true;
|
|
2221
2367
|
});
|
|
2222
|
-
internalMetadata.
|
|
2368
|
+
internalMetadata.enable;
|
|
2223
2369
|
internalMetadata.fastKey;
|
|
2224
2370
|
internalMetadata.getWeakData;
|
|
2225
2371
|
internalMetadata.onFreeze;
|
|
@@ -2335,7 +2481,7 @@
|
|
|
2335
2481
|
if (REPLACE) {
|
|
2336
2482
|
// create collection constructor
|
|
2337
2483
|
Constructor = common.getConstructor(wrapper, CONSTRUCTOR_NAME, IS_MAP, ADDER);
|
|
2338
|
-
internalMetadata.
|
|
2484
|
+
internalMetadata.enable();
|
|
2339
2485
|
} else if (isForced_1(CONSTRUCTOR_NAME, true)) {
|
|
2340
2486
|
var instance = new Constructor();
|
|
2341
2487
|
// early implementations not supports chaining
|
|
@@ -2418,14 +2564,14 @@
|
|
|
2418
2564
|
var fastKey = internalMetadata.fastKey;
|
|
2419
2565
|
|
|
2420
2566
|
|
|
2421
|
-
var setInternalState
|
|
2567
|
+
var setInternalState = internalState.set;
|
|
2422
2568
|
var internalStateGetterFor = internalState.getterFor;
|
|
2423
2569
|
|
|
2424
2570
|
var collectionStrong = {
|
|
2425
2571
|
getConstructor: function (wrapper, CONSTRUCTOR_NAME, IS_MAP, ADDER) {
|
|
2426
2572
|
var C = wrapper(function (that, iterable) {
|
|
2427
2573
|
anInstance(that, C, CONSTRUCTOR_NAME);
|
|
2428
|
-
setInternalState
|
|
2574
|
+
setInternalState(that, {
|
|
2429
2575
|
type: CONSTRUCTOR_NAME,
|
|
2430
2576
|
index: objectCreate(null),
|
|
2431
2577
|
first: undefined,
|
|
@@ -2477,8 +2623,9 @@
|
|
|
2477
2623
|
};
|
|
2478
2624
|
|
|
2479
2625
|
redefineAll(C.prototype, {
|
|
2480
|
-
//
|
|
2481
|
-
//
|
|
2626
|
+
// `{ Map, Set }.prototype.clear()` methods
|
|
2627
|
+
// https://tc39.es/ecma262/#sec-map.prototype.clear
|
|
2628
|
+
// https://tc39.es/ecma262/#sec-set.prototype.clear
|
|
2482
2629
|
clear: function clear() {
|
|
2483
2630
|
var that = this;
|
|
2484
2631
|
var state = getInternalState(that);
|
|
@@ -2494,8 +2641,9 @@
|
|
|
2494
2641
|
if (descriptors) state.size = 0;
|
|
2495
2642
|
else that.size = 0;
|
|
2496
2643
|
},
|
|
2497
|
-
//
|
|
2498
|
-
//
|
|
2644
|
+
// `{ Map, Set }.prototype.delete(key)` methods
|
|
2645
|
+
// https://tc39.es/ecma262/#sec-map.prototype.delete
|
|
2646
|
+
// https://tc39.es/ecma262/#sec-set.prototype.delete
|
|
2499
2647
|
'delete': function (key) {
|
|
2500
2648
|
var that = this;
|
|
2501
2649
|
var state = getInternalState(that);
|
|
@@ -2513,8 +2661,9 @@
|
|
|
2513
2661
|
else that.size--;
|
|
2514
2662
|
} return !!entry;
|
|
2515
2663
|
},
|
|
2516
|
-
//
|
|
2517
|
-
//
|
|
2664
|
+
// `{ Map, Set }.prototype.forEach(callbackfn, thisArg = undefined)` methods
|
|
2665
|
+
// https://tc39.es/ecma262/#sec-map.prototype.foreach
|
|
2666
|
+
// https://tc39.es/ecma262/#sec-set.prototype.foreach
|
|
2518
2667
|
forEach: function forEach(callbackfn /* , that = undefined */) {
|
|
2519
2668
|
var state = getInternalState(this);
|
|
2520
2669
|
var boundFunction = functionBindContext(callbackfn, arguments.length > 1 ? arguments[1] : undefined, 3);
|
|
@@ -2525,25 +2674,29 @@
|
|
|
2525
2674
|
while (entry && entry.removed) entry = entry.previous;
|
|
2526
2675
|
}
|
|
2527
2676
|
},
|
|
2528
|
-
//
|
|
2529
|
-
//
|
|
2677
|
+
// `{ Map, Set}.prototype.has(key)` methods
|
|
2678
|
+
// https://tc39.es/ecma262/#sec-map.prototype.has
|
|
2679
|
+
// https://tc39.es/ecma262/#sec-set.prototype.has
|
|
2530
2680
|
has: function has(key) {
|
|
2531
2681
|
return !!getEntry(this, key);
|
|
2532
2682
|
}
|
|
2533
2683
|
});
|
|
2534
2684
|
|
|
2535
2685
|
redefineAll(C.prototype, IS_MAP ? {
|
|
2536
|
-
//
|
|
2686
|
+
// `Map.prototype.get(key)` method
|
|
2687
|
+
// https://tc39.es/ecma262/#sec-map.prototype.get
|
|
2537
2688
|
get: function get(key) {
|
|
2538
2689
|
var entry = getEntry(this, key);
|
|
2539
2690
|
return entry && entry.value;
|
|
2540
2691
|
},
|
|
2541
|
-
//
|
|
2692
|
+
// `Map.prototype.set(key, value)` method
|
|
2693
|
+
// https://tc39.es/ecma262/#sec-map.prototype.set
|
|
2542
2694
|
set: function set(key, value) {
|
|
2543
2695
|
return define(this, key === 0 ? 0 : key, value);
|
|
2544
2696
|
}
|
|
2545
2697
|
} : {
|
|
2546
|
-
//
|
|
2698
|
+
// `Set.prototype.add(value)` method
|
|
2699
|
+
// https://tc39.es/ecma262/#sec-set.prototype.add
|
|
2547
2700
|
add: function add(value) {
|
|
2548
2701
|
return define(this, value = value === 0 ? 0 : value, value);
|
|
2549
2702
|
}
|
|
@@ -2559,10 +2712,17 @@
|
|
|
2559
2712
|
var ITERATOR_NAME = CONSTRUCTOR_NAME + ' Iterator';
|
|
2560
2713
|
var getInternalCollectionState = internalStateGetterFor(CONSTRUCTOR_NAME);
|
|
2561
2714
|
var getInternalIteratorState = internalStateGetterFor(ITERATOR_NAME);
|
|
2562
|
-
//
|
|
2563
|
-
//
|
|
2715
|
+
// `{ Map, Set }.prototype.{ keys, values, entries, @@iterator }()` methods
|
|
2716
|
+
// https://tc39.es/ecma262/#sec-map.prototype.entries
|
|
2717
|
+
// https://tc39.es/ecma262/#sec-map.prototype.keys
|
|
2718
|
+
// https://tc39.es/ecma262/#sec-map.prototype.values
|
|
2719
|
+
// https://tc39.es/ecma262/#sec-map.prototype-@@iterator
|
|
2720
|
+
// https://tc39.es/ecma262/#sec-set.prototype.entries
|
|
2721
|
+
// https://tc39.es/ecma262/#sec-set.prototype.keys
|
|
2722
|
+
// https://tc39.es/ecma262/#sec-set.prototype.values
|
|
2723
|
+
// https://tc39.es/ecma262/#sec-set.prototype-@@iterator
|
|
2564
2724
|
defineIterator(C, CONSTRUCTOR_NAME, function (iterated, kind) {
|
|
2565
|
-
setInternalState
|
|
2725
|
+
setInternalState(this, {
|
|
2566
2726
|
type: ITERATOR_NAME,
|
|
2567
2727
|
target: iterated,
|
|
2568
2728
|
state: getInternalCollectionState(iterated),
|
|
@@ -2587,10 +2747,14 @@
|
|
|
2587
2747
|
return { value: [entry.key, entry.value], done: false };
|
|
2588
2748
|
}, IS_MAP ? 'entries' : 'values', !IS_MAP, true);
|
|
2589
2749
|
|
|
2590
|
-
//
|
|
2750
|
+
// `{ Map, Set }.prototype[@@species]` accessors
|
|
2751
|
+
// https://tc39.es/ecma262/#sec-get-map-@@species
|
|
2752
|
+
// https://tc39.es/ecma262/#sec-get-set-@@species
|
|
2591
2753
|
setSpecies(CONSTRUCTOR_NAME);
|
|
2592
2754
|
}
|
|
2593
2755
|
};
|
|
2756
|
+
collectionStrong.getConstructor;
|
|
2757
|
+
collectionStrong.setStrong;
|
|
2594
2758
|
|
|
2595
2759
|
// `Set` constructor
|
|
2596
2760
|
// https://tc39.es/ecma262/#sec-set-objects
|
|
@@ -2598,117 +2762,6 @@
|
|
|
2598
2762
|
return function Set() { return init(this, arguments.length ? arguments[0] : undefined); };
|
|
2599
2763
|
}, collectionStrong);
|
|
2600
2764
|
|
|
2601
|
-
// iterable DOM collections
|
|
2602
|
-
// flag - `iterable` interface - 'entries', 'keys', 'values', 'forEach' methods
|
|
2603
|
-
var domIterables = {
|
|
2604
|
-
CSSRuleList: 0,
|
|
2605
|
-
CSSStyleDeclaration: 0,
|
|
2606
|
-
CSSValueList: 0,
|
|
2607
|
-
ClientRectList: 0,
|
|
2608
|
-
DOMRectList: 0,
|
|
2609
|
-
DOMStringList: 0,
|
|
2610
|
-
DOMTokenList: 1,
|
|
2611
|
-
DataTransferItemList: 0,
|
|
2612
|
-
FileList: 0,
|
|
2613
|
-
HTMLAllCollection: 0,
|
|
2614
|
-
HTMLCollection: 0,
|
|
2615
|
-
HTMLFormElement: 0,
|
|
2616
|
-
HTMLSelectElement: 0,
|
|
2617
|
-
MediaList: 0,
|
|
2618
|
-
MimeTypeArray: 0,
|
|
2619
|
-
NamedNodeMap: 0,
|
|
2620
|
-
NodeList: 1,
|
|
2621
|
-
PaintRequestList: 0,
|
|
2622
|
-
Plugin: 0,
|
|
2623
|
-
PluginArray: 0,
|
|
2624
|
-
SVGLengthList: 0,
|
|
2625
|
-
SVGNumberList: 0,
|
|
2626
|
-
SVGPathSegList: 0,
|
|
2627
|
-
SVGPointList: 0,
|
|
2628
|
-
SVGStringList: 0,
|
|
2629
|
-
SVGTransformList: 0,
|
|
2630
|
-
SourceBufferList: 0,
|
|
2631
|
-
StyleSheetList: 0,
|
|
2632
|
-
TextTrackCueList: 0,
|
|
2633
|
-
TextTrackList: 0,
|
|
2634
|
-
TouchList: 0
|
|
2635
|
-
};
|
|
2636
|
-
|
|
2637
|
-
var ARRAY_ITERATOR = 'Array Iterator';
|
|
2638
|
-
var setInternalState = internalState.set;
|
|
2639
|
-
var getInternalState = internalState.getterFor(ARRAY_ITERATOR);
|
|
2640
|
-
|
|
2641
|
-
// `Array.prototype.entries` method
|
|
2642
|
-
// https://tc39.es/ecma262/#sec-array.prototype.entries
|
|
2643
|
-
// `Array.prototype.keys` method
|
|
2644
|
-
// https://tc39.es/ecma262/#sec-array.prototype.keys
|
|
2645
|
-
// `Array.prototype.values` method
|
|
2646
|
-
// https://tc39.es/ecma262/#sec-array.prototype.values
|
|
2647
|
-
// `Array.prototype[@@iterator]` method
|
|
2648
|
-
// https://tc39.es/ecma262/#sec-array.prototype-@@iterator
|
|
2649
|
-
// `CreateArrayIterator` internal method
|
|
2650
|
-
// https://tc39.es/ecma262/#sec-createarrayiterator
|
|
2651
|
-
var es_array_iterator = defineIterator(Array, 'Array', function (iterated, kind) {
|
|
2652
|
-
setInternalState(this, {
|
|
2653
|
-
type: ARRAY_ITERATOR,
|
|
2654
|
-
target: toIndexedObject(iterated), // target
|
|
2655
|
-
index: 0, // next index
|
|
2656
|
-
kind: kind // kind
|
|
2657
|
-
});
|
|
2658
|
-
// `%ArrayIteratorPrototype%.next` method
|
|
2659
|
-
// https://tc39.es/ecma262/#sec-%arrayiteratorprototype%.next
|
|
2660
|
-
}, function () {
|
|
2661
|
-
var state = getInternalState(this);
|
|
2662
|
-
var target = state.target;
|
|
2663
|
-
var kind = state.kind;
|
|
2664
|
-
var index = state.index++;
|
|
2665
|
-
if (!target || index >= target.length) {
|
|
2666
|
-
state.target = undefined;
|
|
2667
|
-
return { value: undefined, done: true };
|
|
2668
|
-
}
|
|
2669
|
-
if (kind == 'keys') return { value: index, done: false };
|
|
2670
|
-
if (kind == 'values') return { value: target[index], done: false };
|
|
2671
|
-
return { value: [index, target[index]], done: false };
|
|
2672
|
-
}, 'values');
|
|
2673
|
-
|
|
2674
|
-
// argumentsList[@@iterator] is %ArrayProto_values%
|
|
2675
|
-
// https://tc39.es/ecma262/#sec-createunmappedargumentsobject
|
|
2676
|
-
// https://tc39.es/ecma262/#sec-createmappedargumentsobject
|
|
2677
|
-
iterators.Arguments = iterators.Array;
|
|
2678
|
-
|
|
2679
|
-
// https://tc39.es/ecma262/#sec-array.prototype-@@unscopables
|
|
2680
|
-
addToUnscopables('keys');
|
|
2681
|
-
addToUnscopables('values');
|
|
2682
|
-
addToUnscopables('entries');
|
|
2683
|
-
|
|
2684
|
-
var ITERATOR = wellKnownSymbol('iterator');
|
|
2685
|
-
var TO_STRING_TAG = wellKnownSymbol('toStringTag');
|
|
2686
|
-
var ArrayValues = es_array_iterator.values;
|
|
2687
|
-
|
|
2688
|
-
for (var COLLECTION_NAME in domIterables) {
|
|
2689
|
-
var Collection = global_1[COLLECTION_NAME];
|
|
2690
|
-
var CollectionPrototype = Collection && Collection.prototype;
|
|
2691
|
-
if (CollectionPrototype) {
|
|
2692
|
-
// some Chrome versions have non-configurable methods on DOMTokenList
|
|
2693
|
-
if (CollectionPrototype[ITERATOR] !== ArrayValues) try {
|
|
2694
|
-
createNonEnumerableProperty(CollectionPrototype, ITERATOR, ArrayValues);
|
|
2695
|
-
} catch (error) {
|
|
2696
|
-
CollectionPrototype[ITERATOR] = ArrayValues;
|
|
2697
|
-
}
|
|
2698
|
-
if (!CollectionPrototype[TO_STRING_TAG]) {
|
|
2699
|
-
createNonEnumerableProperty(CollectionPrototype, TO_STRING_TAG, COLLECTION_NAME);
|
|
2700
|
-
}
|
|
2701
|
-
if (domIterables[COLLECTION_NAME]) for (var METHOD_NAME in es_array_iterator) {
|
|
2702
|
-
// some Chrome versions have non-configurable methods on DOMTokenList
|
|
2703
|
-
if (CollectionPrototype[METHOD_NAME] !== es_array_iterator[METHOD_NAME]) try {
|
|
2704
|
-
createNonEnumerableProperty(CollectionPrototype, METHOD_NAME, es_array_iterator[METHOD_NAME]);
|
|
2705
|
-
} catch (error) {
|
|
2706
|
-
CollectionPrototype[METHOD_NAME] = es_array_iterator[METHOD_NAME];
|
|
2707
|
-
}
|
|
2708
|
-
}
|
|
2709
|
-
}
|
|
2710
|
-
}
|
|
2711
|
-
|
|
2712
2765
|
path.Set;
|
|
2713
2766
|
|
|
2714
2767
|
/**
|
|
@@ -3130,7 +3183,7 @@
|
|
|
3130
3183
|
if (typeof Proxy === "function") return true;
|
|
3131
3184
|
|
|
3132
3185
|
try {
|
|
3133
|
-
|
|
3186
|
+
Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {}));
|
|
3134
3187
|
return true;
|
|
3135
3188
|
} catch (e) {
|
|
3136
3189
|
return false;
|
|
@@ -3836,7 +3889,7 @@
|
|
|
3836
3889
|
|
|
3837
3890
|
var Lock = unwrapExports(browserTabsLock);
|
|
3838
3891
|
|
|
3839
|
-
var version = '1.
|
|
3892
|
+
var version = '1.18.0';
|
|
3840
3893
|
|
|
3841
3894
|
/**
|
|
3842
3895
|
* @ignore
|
|
@@ -3907,7 +3960,7 @@
|
|
|
3907
3960
|
var GenericError = /** @class */ (function (_super) {
|
|
3908
3961
|
__extends(GenericError, _super);
|
|
3909
3962
|
function GenericError(error, error_description) {
|
|
3910
|
-
var _this = _super.call(this, error_description) || this;
|
|
3963
|
+
var _this = _super.call(this, error_description) /* istanbul ignore next */ || this;
|
|
3911
3964
|
_this.error = error;
|
|
3912
3965
|
_this.error_description = error_description;
|
|
3913
3966
|
Object.setPrototypeOf(_this, GenericError.prototype);
|
|
@@ -3927,7 +3980,7 @@
|
|
|
3927
3980
|
__extends(AuthenticationError, _super);
|
|
3928
3981
|
function AuthenticationError(error, error_description, state, appState) {
|
|
3929
3982
|
if (appState === void 0) { appState = null; }
|
|
3930
|
-
var _this = _super.call(this, error, error_description) || this;
|
|
3983
|
+
var _this = _super.call(this, error, error_description) /* istanbul ignore next */ || this;
|
|
3931
3984
|
_this.state = state;
|
|
3932
3985
|
_this.appState = appState;
|
|
3933
3986
|
//https://github.com/Microsoft/TypeScript-wiki/blob/master/Breaking-Changes.md#extending-built-ins-like-error-array-and-map-may-no-longer-work
|
|
@@ -3943,7 +3996,7 @@
|
|
|
3943
3996
|
var TimeoutError = /** @class */ (function (_super) {
|
|
3944
3997
|
__extends(TimeoutError, _super);
|
|
3945
3998
|
function TimeoutError() {
|
|
3946
|
-
var _this = _super.call(this, 'timeout', 'Timeout') || this;
|
|
3999
|
+
var _this = _super.call(this, 'timeout', 'Timeout') /* istanbul ignore next */ || this;
|
|
3947
4000
|
//https://github.com/Microsoft/TypeScript-wiki/blob/master/Breaking-Changes.md#extending-built-ins-like-error-array-and-map-may-no-longer-work
|
|
3948
4001
|
Object.setPrototypeOf(_this, TimeoutError.prototype);
|
|
3949
4002
|
return _this;
|
|
@@ -3956,7 +4009,7 @@
|
|
|
3956
4009
|
var PopupTimeoutError = /** @class */ (function (_super) {
|
|
3957
4010
|
__extends(PopupTimeoutError, _super);
|
|
3958
4011
|
function PopupTimeoutError(popup) {
|
|
3959
|
-
var _this = _super.call(this) || this;
|
|
4012
|
+
var _this = _super.call(this) /* istanbul ignore next */ || this;
|
|
3960
4013
|
_this.popup = popup;
|
|
3961
4014
|
//https://github.com/Microsoft/TypeScript-wiki/blob/master/Breaking-Changes.md#extending-built-ins-like-error-array-and-map-may-no-longer-work
|
|
3962
4015
|
Object.setPrototypeOf(_this, PopupTimeoutError.prototype);
|
|
@@ -3967,13 +4020,27 @@
|
|
|
3967
4020
|
var PopupCancelledError = /** @class */ (function (_super) {
|
|
3968
4021
|
__extends(PopupCancelledError, _super);
|
|
3969
4022
|
function PopupCancelledError(popup) {
|
|
3970
|
-
var _this = _super.call(this, 'cancelled', 'Popup closed') || this;
|
|
4023
|
+
var _this = _super.call(this, 'cancelled', 'Popup closed') /* istanbul ignore next */ || this;
|
|
3971
4024
|
_this.popup = popup;
|
|
3972
4025
|
//https://github.com/Microsoft/TypeScript-wiki/blob/master/Breaking-Changes.md#extending-built-ins-like-error-array-and-map-may-no-longer-work
|
|
3973
4026
|
Object.setPrototypeOf(_this, PopupCancelledError.prototype);
|
|
3974
4027
|
return _this;
|
|
3975
4028
|
}
|
|
3976
4029
|
return PopupCancelledError;
|
|
4030
|
+
}(GenericError));
|
|
4031
|
+
/**
|
|
4032
|
+
* Error thrown when the token exchange results in a `mfa_required` error
|
|
4033
|
+
*/
|
|
4034
|
+
var MfaRequiredError = /** @class */ (function (_super) {
|
|
4035
|
+
__extends(MfaRequiredError, _super);
|
|
4036
|
+
function MfaRequiredError(error, error_description, mfa_token) {
|
|
4037
|
+
var _this = _super.call(this, error, error_description) /* istanbul ignore next */ || this;
|
|
4038
|
+
_this.mfa_token = mfa_token;
|
|
4039
|
+
//https://github.com/Microsoft/TypeScript-wiki/blob/master/Breaking-Changes.md#extending-built-ins-like-error-array-and-map-may-no-longer-work
|
|
4040
|
+
Object.setPrototypeOf(_this, MfaRequiredError.prototype);
|
|
4041
|
+
return _this;
|
|
4042
|
+
}
|
|
4043
|
+
return MfaRequiredError;
|
|
3977
4044
|
}(GenericError));
|
|
3978
4045
|
|
|
3979
4046
|
var parseQueryResult = function (queryString) {
|
|
@@ -3986,7 +4053,10 @@
|
|
|
3986
4053
|
var _a = __read(qp.split('='), 2), key = _a[0], val = _a[1];
|
|
3987
4054
|
parsedQuery[key] = decodeURIComponent(val);
|
|
3988
4055
|
});
|
|
3989
|
-
|
|
4056
|
+
if (parsedQuery.expires_in) {
|
|
4057
|
+
parsedQuery.expires_in = parseInt(parsedQuery.expires_in);
|
|
4058
|
+
}
|
|
4059
|
+
return parsedQuery;
|
|
3990
4060
|
};
|
|
3991
4061
|
var runIframe = function (authorizeUrl, eventOrigin, timeoutInSeconds) {
|
|
3992
4062
|
if (timeoutInSeconds === void 0) { timeoutInSeconds = DEFAULT_AUTHORIZE_TIMEOUT_IN_SECONDS; }
|
|
@@ -4212,7 +4282,7 @@
|
|
|
4212
4282
|
})];
|
|
4213
4283
|
});
|
|
4214
4284
|
}); };
|
|
4215
|
-
var fetchWithWorker = function (fetchUrl, audience, scope, fetchOptions, timeout, worker) { return __awaiter(void 0, void 0, void 0, function () {
|
|
4285
|
+
var fetchWithWorker = function (fetchUrl, audience, scope, fetchOptions, timeout, worker, useFormData) { return __awaiter(void 0, void 0, void 0, function () {
|
|
4216
4286
|
return __generator(this, function (_a) {
|
|
4217
4287
|
return [2 /*return*/, sendMessage({
|
|
4218
4288
|
auth: {
|
|
@@ -4221,16 +4291,17 @@
|
|
|
4221
4291
|
},
|
|
4222
4292
|
timeout: timeout,
|
|
4223
4293
|
fetchUrl: fetchUrl,
|
|
4224
|
-
fetchOptions: fetchOptions
|
|
4294
|
+
fetchOptions: fetchOptions,
|
|
4295
|
+
useFormData: useFormData
|
|
4225
4296
|
}, worker)];
|
|
4226
4297
|
});
|
|
4227
4298
|
}); };
|
|
4228
|
-
var switchFetch = function (fetchUrl, audience, scope, fetchOptions, worker, timeout) {
|
|
4299
|
+
var switchFetch = function (fetchUrl, audience, scope, fetchOptions, worker, useFormData, timeout) {
|
|
4229
4300
|
if (timeout === void 0) { timeout = DEFAULT_FETCH_TIMEOUT_MS; }
|
|
4230
4301
|
return __awaiter(void 0, void 0, void 0, function () {
|
|
4231
4302
|
return __generator(this, function (_a) {
|
|
4232
4303
|
if (worker) {
|
|
4233
|
-
return [2 /*return*/, fetchWithWorker(fetchUrl, audience, scope, fetchOptions, timeout, worker)];
|
|
4304
|
+
return [2 /*return*/, fetchWithWorker(fetchUrl, audience, scope, fetchOptions, timeout, worker, useFormData)];
|
|
4234
4305
|
}
|
|
4235
4306
|
else {
|
|
4236
4307
|
return [2 /*return*/, fetchWithoutWorker(fetchUrl, fetchOptions, timeout)];
|
|
@@ -4238,9 +4309,9 @@
|
|
|
4238
4309
|
});
|
|
4239
4310
|
});
|
|
4240
4311
|
};
|
|
4241
|
-
function getJSON(url, timeout, audience, scope, options, worker) {
|
|
4312
|
+
function getJSON(url, timeout, audience, scope, options, worker, useFormData) {
|
|
4242
4313
|
return __awaiter(this, void 0, void 0, function () {
|
|
4243
|
-
var fetchError, response, i, e_1, _a, error, error_description,
|
|
4314
|
+
var fetchError, response, i, e_1, _a, error, error_description, data, ok, errorMessage;
|
|
4244
4315
|
return __generator(this, function (_b) {
|
|
4245
4316
|
switch (_b.label) {
|
|
4246
4317
|
case 0:
|
|
@@ -4252,7 +4323,7 @@
|
|
|
4252
4323
|
_b.label = 2;
|
|
4253
4324
|
case 2:
|
|
4254
4325
|
_b.trys.push([2, 4, , 5]);
|
|
4255
|
-
return [4 /*yield*/, switchFetch(url, audience, scope, options, worker, timeout)];
|
|
4326
|
+
return [4 /*yield*/, switchFetch(url, audience, scope, options, worker, useFormData, timeout)];
|
|
4256
4327
|
case 3:
|
|
4257
4328
|
response = _b.sent();
|
|
4258
4329
|
fetchError = null;
|
|
@@ -4275,30 +4346,40 @@
|
|
|
4275
4346
|
fetchError.message = fetchError.message || 'Failed to fetch';
|
|
4276
4347
|
throw fetchError;
|
|
4277
4348
|
}
|
|
4278
|
-
_a = response.json, error = _a.error, error_description = _a.error_description,
|
|
4349
|
+
_a = response.json, error = _a.error, error_description = _a.error_description, data = __rest(_a, ["error", "error_description"]), ok = response.ok;
|
|
4279
4350
|
if (!ok) {
|
|
4280
4351
|
errorMessage = error_description || "HTTP error. Unable to fetch " + url;
|
|
4352
|
+
if (error === 'mfa_required') {
|
|
4353
|
+
throw new MfaRequiredError(error, errorMessage, data.mfa_token);
|
|
4354
|
+
}
|
|
4281
4355
|
throw new GenericError(error || 'request_error', errorMessage);
|
|
4282
4356
|
}
|
|
4283
|
-
return [2 /*return*/,
|
|
4357
|
+
return [2 /*return*/, data];
|
|
4284
4358
|
}
|
|
4285
4359
|
});
|
|
4286
4360
|
});
|
|
4287
4361
|
}
|
|
4288
4362
|
|
|
4289
4363
|
function oauthToken(_a, worker) {
|
|
4290
|
-
var baseUrl = _a.baseUrl, timeout = _a.timeout, audience = _a.audience, scope = _a.scope, auth0Client = _a.auth0Client, options = __rest(_a, ["baseUrl", "timeout", "audience", "scope", "auth0Client"]);
|
|
4364
|
+
var baseUrl = _a.baseUrl, timeout = _a.timeout, audience = _a.audience, scope = _a.scope, auth0Client = _a.auth0Client, useFormData = _a.useFormData, options = __rest(_a, ["baseUrl", "timeout", "audience", "scope", "auth0Client", "useFormData"]);
|
|
4291
4365
|
return __awaiter(this, void 0, void 0, function () {
|
|
4366
|
+
var body;
|
|
4292
4367
|
return __generator(this, function (_b) {
|
|
4293
4368
|
switch (_b.label) {
|
|
4294
|
-
case 0:
|
|
4295
|
-
|
|
4296
|
-
|
|
4297
|
-
|
|
4298
|
-
|
|
4299
|
-
'
|
|
4300
|
-
|
|
4301
|
-
|
|
4369
|
+
case 0:
|
|
4370
|
+
body = useFormData
|
|
4371
|
+
? createQueryParams(options)
|
|
4372
|
+
: JSON.stringify(options);
|
|
4373
|
+
return [4 /*yield*/, getJSON(baseUrl + "/oauth/token", timeout, audience || 'default', scope, {
|
|
4374
|
+
method: 'POST',
|
|
4375
|
+
body: body,
|
|
4376
|
+
headers: {
|
|
4377
|
+
'Content-Type': useFormData
|
|
4378
|
+
? 'application/x-www-form-urlencoded'
|
|
4379
|
+
: 'application/json',
|
|
4380
|
+
'Auth0-Client': btoa(JSON.stringify(auth0Client || DEFAULT_AUTH0_CLIENT))
|
|
4381
|
+
}
|
|
4382
|
+
}, worker, useFormData)];
|
|
4302
4383
|
case 1: return [2 /*return*/, _b.sent()];
|
|
4303
4384
|
}
|
|
4304
4385
|
});
|
|
@@ -4366,29 +4447,27 @@
|
|
|
4366
4447
|
}
|
|
4367
4448
|
LocalStorageCache.prototype.set = function (key, entry) {
|
|
4368
4449
|
localStorage.setItem(key, JSON.stringify(entry));
|
|
4369
|
-
return Promise.resolve();
|
|
4370
4450
|
};
|
|
4371
4451
|
LocalStorageCache.prototype.get = function (key) {
|
|
4372
4452
|
var json = window.localStorage.getItem(key);
|
|
4373
4453
|
if (!json)
|
|
4374
|
-
return
|
|
4454
|
+
return;
|
|
4375
4455
|
try {
|
|
4376
4456
|
var payload = JSON.parse(json);
|
|
4377
|
-
return
|
|
4457
|
+
return payload;
|
|
4378
4458
|
}
|
|
4379
4459
|
catch (e) {
|
|
4380
4460
|
/* istanbul ignore next */
|
|
4381
|
-
return
|
|
4461
|
+
return;
|
|
4382
4462
|
}
|
|
4383
4463
|
};
|
|
4384
4464
|
LocalStorageCache.prototype.remove = function (key) {
|
|
4385
4465
|
localStorage.removeItem(key);
|
|
4386
|
-
return Promise.resolve();
|
|
4387
4466
|
};
|
|
4388
4467
|
LocalStorageCache.prototype.allKeys = function () {
|
|
4389
|
-
return
|
|
4468
|
+
return Object.keys(window.localStorage).filter(function (key) {
|
|
4390
4469
|
return key.startsWith(CACHE_KEY_PREFIX);
|
|
4391
|
-
})
|
|
4470
|
+
});
|
|
4392
4471
|
};
|
|
4393
4472
|
return LocalStorageCache;
|
|
4394
4473
|
}());
|
|
@@ -4400,21 +4479,19 @@
|
|
|
4400
4479
|
return {
|
|
4401
4480
|
set: function (key, entry) {
|
|
4402
4481
|
cache[key] = entry;
|
|
4403
|
-
return Promise.resolve();
|
|
4404
4482
|
},
|
|
4405
4483
|
get: function (key) {
|
|
4406
4484
|
var cacheEntry = cache[key];
|
|
4407
4485
|
if (!cacheEntry) {
|
|
4408
|
-
return
|
|
4486
|
+
return;
|
|
4409
4487
|
}
|
|
4410
|
-
return
|
|
4488
|
+
return cacheEntry;
|
|
4411
4489
|
},
|
|
4412
4490
|
remove: function (key) {
|
|
4413
4491
|
delete cache[key];
|
|
4414
|
-
return Promise.resolve();
|
|
4415
4492
|
},
|
|
4416
4493
|
allKeys: function () {
|
|
4417
|
-
return
|
|
4494
|
+
return Object.keys(cache);
|
|
4418
4495
|
}
|
|
4419
4496
|
};
|
|
4420
4497
|
})();
|
|
@@ -4422,76 +4499,11 @@
|
|
|
4422
4499
|
return InMemoryCache;
|
|
4423
4500
|
}());
|
|
4424
4501
|
|
|
4425
|
-
var CacheKeyManifest = /** @class */ (function () {
|
|
4426
|
-
function CacheKeyManifest(cache, clientId) {
|
|
4427
|
-
this.cache = cache;
|
|
4428
|
-
this.clientId = clientId;
|
|
4429
|
-
this.manifestKey = this.createManifestKeyFrom(clientId);
|
|
4430
|
-
}
|
|
4431
|
-
CacheKeyManifest.prototype.add = function (key) {
|
|
4432
|
-
var _a;
|
|
4433
|
-
return __awaiter(this, void 0, void 0, function () {
|
|
4434
|
-
var keys, _b;
|
|
4435
|
-
return __generator(this, function (_c) {
|
|
4436
|
-
switch (_c.label) {
|
|
4437
|
-
case 0:
|
|
4438
|
-
_b = Set.bind;
|
|
4439
|
-
return [4 /*yield*/, this.cache.get(this.manifestKey)];
|
|
4440
|
-
case 1:
|
|
4441
|
-
keys = new (_b.apply(Set, [void 0, ((_a = (_c.sent())) === null || _a === void 0 ? void 0 : _a.keys) || []]))();
|
|
4442
|
-
keys.add(key);
|
|
4443
|
-
return [4 /*yield*/, this.cache.set(this.manifestKey, {
|
|
4444
|
-
keys: __spreadArray([], __read(keys))
|
|
4445
|
-
})];
|
|
4446
|
-
case 2:
|
|
4447
|
-
_c.sent();
|
|
4448
|
-
return [2 /*return*/];
|
|
4449
|
-
}
|
|
4450
|
-
});
|
|
4451
|
-
});
|
|
4452
|
-
};
|
|
4453
|
-
CacheKeyManifest.prototype.remove = function (key) {
|
|
4454
|
-
return __awaiter(this, void 0, void 0, function () {
|
|
4455
|
-
var entry, keys;
|
|
4456
|
-
return __generator(this, function (_a) {
|
|
4457
|
-
switch (_a.label) {
|
|
4458
|
-
case 0: return [4 /*yield*/, this.cache.get(this.manifestKey)];
|
|
4459
|
-
case 1:
|
|
4460
|
-
entry = _a.sent();
|
|
4461
|
-
if (!entry) return [3 /*break*/, 5];
|
|
4462
|
-
keys = new Set(entry.keys);
|
|
4463
|
-
keys.delete(key);
|
|
4464
|
-
if (!(keys.size > 0)) return [3 /*break*/, 3];
|
|
4465
|
-
return [4 /*yield*/, this.cache.set(this.manifestKey, { keys: __spreadArray([], __read(keys)) })];
|
|
4466
|
-
case 2: return [2 /*return*/, _a.sent()];
|
|
4467
|
-
case 3: return [4 /*yield*/, this.cache.remove(this.manifestKey)];
|
|
4468
|
-
case 4: return [2 /*return*/, _a.sent()];
|
|
4469
|
-
case 5: return [2 /*return*/];
|
|
4470
|
-
}
|
|
4471
|
-
});
|
|
4472
|
-
});
|
|
4473
|
-
};
|
|
4474
|
-
CacheKeyManifest.prototype.get = function () {
|
|
4475
|
-
return this.cache.get(this.manifestKey);
|
|
4476
|
-
};
|
|
4477
|
-
CacheKeyManifest.prototype.clear = function () {
|
|
4478
|
-
return this.cache.remove(this.manifestKey);
|
|
4479
|
-
};
|
|
4480
|
-
CacheKeyManifest.prototype.createManifestKeyFrom = function (clientId) {
|
|
4481
|
-
return CACHE_KEY_PREFIX + "::" + clientId;
|
|
4482
|
-
};
|
|
4483
|
-
return CacheKeyManifest;
|
|
4484
|
-
}());
|
|
4485
|
-
|
|
4486
4502
|
var DEFAULT_EXPIRY_ADJUSTMENT_SECONDS = 0;
|
|
4487
4503
|
var CacheManager = /** @class */ (function () {
|
|
4488
|
-
function CacheManager(cache,
|
|
4504
|
+
function CacheManager(cache, keyManifest) {
|
|
4489
4505
|
this.cache = cache;
|
|
4490
|
-
|
|
4491
|
-
// use a built-in key manifest.
|
|
4492
|
-
if (!cache.allKeys) {
|
|
4493
|
-
this.keyManifest = new CacheKeyManifest(this.cache, clientId);
|
|
4494
|
-
}
|
|
4506
|
+
this.keyManifest = keyManifest;
|
|
4495
4507
|
}
|
|
4496
4508
|
CacheManager.prototype.get = function (cacheKey, expiryAdjustmentSeconds) {
|
|
4497
4509
|
var _a;
|
|
@@ -4565,7 +4577,7 @@
|
|
|
4565
4577
|
});
|
|
4566
4578
|
});
|
|
4567
4579
|
};
|
|
4568
|
-
CacheManager.prototype.clear = function () {
|
|
4580
|
+
CacheManager.prototype.clear = function (clientId) {
|
|
4569
4581
|
var _a;
|
|
4570
4582
|
return __awaiter(this, void 0, void 0, function () {
|
|
4571
4583
|
var keys;
|
|
@@ -4578,24 +4590,46 @@
|
|
|
4578
4590
|
/* istanbul ignore next */
|
|
4579
4591
|
if (!keys)
|
|
4580
4592
|
return [2 /*return*/];
|
|
4581
|
-
|
|
4582
|
-
|
|
4583
|
-
|
|
4584
|
-
|
|
4585
|
-
|
|
4586
|
-
|
|
4587
|
-
|
|
4588
|
-
|
|
4589
|
-
|
|
4590
|
-
|
|
4591
|
-
|
|
4593
|
+
return [4 /*yield*/, keys
|
|
4594
|
+
.filter(function (key) { return (clientId ? key.includes(clientId) : true); })
|
|
4595
|
+
.reduce(function (memo, key) { return __awaiter(_this, void 0, void 0, function () {
|
|
4596
|
+
return __generator(this, function (_a) {
|
|
4597
|
+
switch (_a.label) {
|
|
4598
|
+
case 0: return [4 /*yield*/, memo];
|
|
4599
|
+
case 1:
|
|
4600
|
+
_a.sent();
|
|
4601
|
+
return [4 /*yield*/, this.cache.remove(key)];
|
|
4602
|
+
case 2:
|
|
4603
|
+
_a.sent();
|
|
4604
|
+
return [2 /*return*/];
|
|
4605
|
+
}
|
|
4606
|
+
});
|
|
4607
|
+
}); }, Promise.resolve())];
|
|
4592
4608
|
case 2:
|
|
4609
|
+
_b.sent();
|
|
4610
|
+
return [4 /*yield*/, ((_a = this.keyManifest) === null || _a === void 0 ? void 0 : _a.clear())];
|
|
4611
|
+
case 3:
|
|
4593
4612
|
_b.sent();
|
|
4594
4613
|
return [2 /*return*/];
|
|
4595
4614
|
}
|
|
4596
4615
|
});
|
|
4597
4616
|
});
|
|
4598
4617
|
};
|
|
4618
|
+
/**
|
|
4619
|
+
* Note: only call this if you're sure one of our internal (synchronous) caches are being used.
|
|
4620
|
+
*/
|
|
4621
|
+
CacheManager.prototype.clearSync = function (clientId) {
|
|
4622
|
+
var _this = this;
|
|
4623
|
+
var keys = this.cache.allKeys();
|
|
4624
|
+
/* istanbul ignore next */
|
|
4625
|
+
if (!keys)
|
|
4626
|
+
return;
|
|
4627
|
+
keys
|
|
4628
|
+
.filter(function (key) { return (clientId ? key.includes(clientId) : true); })
|
|
4629
|
+
.forEach(function (key) {
|
|
4630
|
+
_this.cache.remove(key);
|
|
4631
|
+
});
|
|
4632
|
+
};
|
|
4599
4633
|
CacheManager.prototype.wrapCacheEntry = function (entry) {
|
|
4600
4634
|
var expiresInTime = Math.floor(Date.now() / 1000) + entry.expires_in;
|
|
4601
4635
|
var expirySeconds = Math.min(expiresInTime, entry.decodedToken.claims.exp);
|
|
@@ -4653,15 +4687,17 @@
|
|
|
4653
4687
|
return CacheManager;
|
|
4654
4688
|
}());
|
|
4655
4689
|
|
|
4656
|
-
var
|
|
4690
|
+
var TRANSACTION_STORAGE_KEY_PREFIX = 'a0.spajs.txs';
|
|
4657
4691
|
var TransactionManager = /** @class */ (function () {
|
|
4658
|
-
function TransactionManager(storage) {
|
|
4692
|
+
function TransactionManager(storage, clientId) {
|
|
4659
4693
|
this.storage = storage;
|
|
4660
|
-
this.
|
|
4694
|
+
this.clientId = clientId;
|
|
4695
|
+
this.storageKey = TRANSACTION_STORAGE_KEY_PREFIX + "." + clientId;
|
|
4696
|
+
this.transaction = this.storage.get(this.storageKey);
|
|
4661
4697
|
}
|
|
4662
4698
|
TransactionManager.prototype.create = function (transaction) {
|
|
4663
4699
|
this.transaction = transaction;
|
|
4664
|
-
this.storage.save(
|
|
4700
|
+
this.storage.save(this.storageKey, transaction, {
|
|
4665
4701
|
daysUntilExpire: 1
|
|
4666
4702
|
});
|
|
4667
4703
|
};
|
|
@@ -4670,7 +4706,7 @@
|
|
|
4670
4706
|
};
|
|
4671
4707
|
TransactionManager.prototype.remove = function () {
|
|
4672
4708
|
delete this.transaction;
|
|
4673
|
-
this.storage.remove(
|
|
4709
|
+
this.storage.remove(this.storageKey);
|
|
4674
4710
|
};
|
|
4675
4711
|
return TransactionManager;
|
|
4676
4712
|
}());
|
|
@@ -4925,7 +4961,9 @@
|
|
|
4925
4961
|
sameSite: 'none'
|
|
4926
4962
|
};
|
|
4927
4963
|
}
|
|
4928
|
-
|
|
4964
|
+
if (options === null || options === void 0 ? void 0 : options.daysUntilExpire) {
|
|
4965
|
+
cookieAttributes.expires = options.daysUntilExpire;
|
|
4966
|
+
}
|
|
4929
4967
|
esCookie_5(key, JSON.stringify(value), cookieAttributes);
|
|
4930
4968
|
},
|
|
4931
4969
|
remove: function (key) {
|
|
@@ -4953,7 +4991,9 @@
|
|
|
4953
4991
|
if ('https:' === window.location.protocol) {
|
|
4954
4992
|
cookieAttributes = { secure: true };
|
|
4955
4993
|
}
|
|
4956
|
-
|
|
4994
|
+
if (options === null || options === void 0 ? void 0 : options.daysUntilExpire) {
|
|
4995
|
+
cookieAttributes.expires = options.daysUntilExpire;
|
|
4996
|
+
}
|
|
4957
4997
|
esCookie_5("" + LEGACY_PREFIX + key, JSON.stringify(value), cookieAttributes);
|
|
4958
4998
|
CookieStorage.save(key, value, options);
|
|
4959
4999
|
},
|
|
@@ -4967,6 +5007,7 @@
|
|
|
4967
5007
|
*/
|
|
4968
5008
|
var SessionStorage = {
|
|
4969
5009
|
get: function (key) {
|
|
5010
|
+
/* istanbul ignore next */
|
|
4970
5011
|
if (typeof sessionStorage === 'undefined') {
|
|
4971
5012
|
return;
|
|
4972
5013
|
}
|
|
@@ -5014,7 +5055,7 @@
|
|
|
5014
5055
|
};
|
|
5015
5056
|
}
|
|
5016
5057
|
|
|
5017
|
-
var WorkerFactory = createBase64WorkerFactory('Lyogcm9sbHVwLXBsdWdpbi13ZWItd29ya2VyLWxvYWRlciAqLwooZnVuY3Rpb24gKCkgewogICAgJ3VzZSBzdHJpY3QnOwoKICAgIC8qISAqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKg0KICAgIENvcHlyaWdodCAoYykgTWljcm9zb2Z0IENvcnBvcmF0aW9uLg0KDQogICAgUGVybWlzc2lvbiB0byB1c2UsIGNvcHksIG1vZGlmeSwgYW5kL29yIGRpc3RyaWJ1dGUgdGhpcyBzb2Z0d2FyZSBmb3IgYW55DQogICAgcHVycG9zZSB3aXRoIG9yIHdpdGhvdXQgZmVlIGlzIGhlcmVieSBncmFudGVkLg0KDQogICAgVEhFIFNPRlRXQVJFIElTIFBST1ZJREVEICJBUyBJUyIgQU5EIFRIRSBBVVRIT1IgRElTQ0xBSU1TIEFMTCBXQVJSQU5USUVTIFdJVEgNCiAgICBSRUdBUkQgVE8gVEhJUyBTT0ZUV0FSRSBJTkNMVURJTkcgQUxMIElNUExJRUQgV0FSUkFOVElFUyBPRiBNRVJDSEFOVEFCSUxJVFkNCiAgICBBTkQgRklUTkVTUy4gSU4gTk8gR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b3BbMV07IG9wID0gWzBdOyBjb250aW51ZTsNCiAgICAgICAgICAgICAgICAgICAgY2FzZSA3OiBvcCA9IF8ub3BzLnBvcCgpOyBfLnRyeXMucG9wKCk7IGNvbnRpbnVlOw0KICAgICAgICAgICAgICAgICAgICBkZWZhdWx0Og0KICAgICAgICAgICAgICAgICAgICAgICAgaWYgKCEodCA9IF8udHJ5cywgdCA9IHQubGVuZ3RoID4gMCAmJiB0W3QubGVuZ3RoIC0gMV0pICYmIChvcFswXSA9PT0gNiB8fCBvcFswXSA9PT0gMikpIHsgXyA9IDA7IGNvbnRpbnVlOyB9DQogICAgICAgICAgICAgICAgICAgICAgICBpZiAob3BbMF0gPT09IDMgJiYgKCF0IHx8IChvcFsxXSA+IHRbMF0gJiYgb3BbMV0gPCB0WzNdKSkpIHsgXy5sYWJlbCA9IG9wWzFdOyBicmVhazsgfQ0KICAgICAgICAgICAgICAgICAgICAgICAgaWYgKG9wWzBdID09PSA2ICYmIF8ubGFiZWwgPCB0WzFdKSB7IF8ubGFiZWwgPSB0WzFdOyB0ID0gb3A7IGJyZWFrOyB9DQogICAgICAgICAgICAgICAgICAgICAgICBpZiAodCAmJiBfLmxhYmVsIDwgdFsyXSkgeyBfLmxhYmVsID0gdFsyXTsgXy5vcHMucHVzaChvcCk7IGJyZWFrOyB9DQogICAgICAgICAgICAgICAgICAgICAgICBpZiAodFsyXSkgXy5vcHMucG9wKCk7DQogICAgICAgICAgICAgICAgICAgICAgICBfLnRyeXMucG9wKCk7IGNvbnRpbnVlOw0KICAgICAgICAgICAgICAgIH0NCiAgICAgICAgICAgICAgICBvcCA9IGJvZHkuY2FsbCh0aGlzQXJnLCBfKTsNCiAgICAgICAgICAgIH0gY2F0Y2ggKGUpIHsgb3AgPSBbNiwgZV07IHkgPSAwOyB9IGZpbmFsbHkgeyBmID0gdCA9IDA7IH0NCiAgICAgICAgICAgIGlmIChvcFswXSAmIDUpIHRocm93IG9wWzFdOyByZXR1cm4geyB2YWx1ZTogb3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GllbmNlLCBzY29wZSwgYm9keSwgcmVmcmVzaFRva2VuLCBhYm9ydENvbnRyb2xsZXIsIHJlc3BvbnNlLCBlcnJvcl8xLCBlcnJvcl8yOw0KICAgICAgICAgICAgcmV0dXJuIF9fZ2VuZXJhdG9yKHRoaXMsIGZ1bmN0aW9uIChfZSkgew0KICAgICAgICAgICAgICAgIHN3aXRjaCAoX2UubGFiZWwpIHsNCiAgICAgICAgICAgICAgICAgICAgY2FzZSAwOg0KICAgICAgICAgICAgICAgICAgICAgICAgX2QgPSBhdXRoIHx8IHt9LCBhdWRpZW5jZSA9IF9kLmF1ZGllbmNlLCBzY29wZSA9IF9kLnNjb3BlOw0KICAgICAgICAgICAgICAgICAgICAgICAgX2UubGFiZWwgPSAxOw0KICAgICAgICAgICAgICAgICAgICBjYXNlIDE6DQogICAgICAgICAgICAgICAgICAgICAgICBfZS50cnlzLnB1c2goWzEsIDcsICwgOF0pOw0KICAgICAgICAgICAgICAgICAgICAgICAgYm9keSA9IEpTT04ucGFyc2UoZmV0Y2hPcHRpb25zLmJvZHkpOw0KICAgICAgICAgICAgICAgICAgICAgICAgaWYgKCFib2R5LnJlZnJlc2hfdG9rZW4gJiYgYm9keS5ncmFudF90eXBlID09PSAncmVmcmVzaF90b2tlbicpIHsNCiAgICAgICAgICAgICAgICAgICAgICAgICAgICByZWZyZXNoVG9rZW4gPSBnZXRSZWZyZXNoVG9rZW4oYXVkaWVuY2UsIHNjb3BlKTsNCiAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAoIXJlZnJlc2hUb2tlbikgew0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0aHJvdyBuZXcgRXJyb3IoTUlTU0lOR19SRUZSRVNIX1RPS0VOX0VSUk9SX01FU1NBR0UpOw0KICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0NCiAgICAgICAgICAgICAgICAgICAgICAgICAgICBmZXRjaE9wdGlvbnMuYm9keSA9IEpTT04uc3RyaW5naWZ5KF9fYXNzaWduKF9fYXNzaWduKHt9LCBib2R5KSwgeyByZWZyZXNoX3Rva2VuOiByZWZyZXNoVG9rZW4gfSkpOw0KICAgICAgICAgICAgICAgICAgICAgICAgfQ0KICAgICAgICAgICAgICAgICAgICAgICAgYWJvcnRDb250cm9sbGVyID0gdm9pZCAwOw0KICAgICAgICAgICAgICAgICAgICAgICAgaWYgKHR5cGVvZiBBYm9ydENvbnRyb2xsZXIgPT09ICdmdW5jdGlvbicpIHsNCiAgICAgICAgICAgICAgICAgICAgICAgICAgICBhYm9ydENvbnRyb2xsZXIgPSBuZXcgQWJvcnRDb250cm9sbGVyKCk7DQogICAgICAgICAgICAgICAgICAgICAgICAgICAgZmV0Y2hPcHRpb25zLnNpZ25hbCA9IGFib3J0Q29udHJvbGxlci5zaWduYWw7DQogICAgICAgICAgICAgICAgICAgICAgICB9DQogICAgICAgICAgICAgICAgICAgICAgICByZXNwb25zZSA9IHZvaWQgMDsNCiAgICAgICAgICAgICAgICAgICAgICAgIF9lLmxhYmVsID0gMjsNCiAgICAgICAgICAgICAgICAgICAgY2FzZSAyOg0KICAgICAgICAgICAgICAgICAgICAgICAgX2UudHJ5cy5wdXNoKFsyLCA0LCAsIDVdKTsNCiAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBbNCAvKnlpZWxkKi8sIFByb21pc2UucmFjZShbDQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHdhaXQodGltZW91dCksDQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZldGNoKGZldGNoVXJsLCBfX2Fzc2lnbih7fSwgZmV0Y2hPcHRpb25zKSkNCiAgICAgICAgICAgICAgICAgICAgICAgICAgICBdKV07DQogICAgICAgICAgICAgICAgICAgIGNhc2UgMzoNCiAgICAgICAgICAgICAgICAgICAgICAgIHJlc3BvbnNlID0gX2Uuc2VudCgpOw0KICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIFszIC8qYnJlYWsqLywgNV07DQogICAgICAgICAgICAgICAgICAgIGNhc2UgNDoNCiAgICAgICAgICAgICAgICAgICAgICAgIGVycm9yXzEgPSBfZS5zZW50KCk7DQogICAgICAgICAgICAgICAgICAgICAgICAvLyBmZXRjaCBlcnJvciwgcmVqZWN0IGBzZW5kTWVzc2FnZWAgdXNpbmcgYGVycm9yYCBrZXkgc28gdGhhdCB3ZSByZXRyeS4NCiAgICAgICAgICAgICAgICAgICAgICAgIHBvcnQucG9zdE1lc3NhZ2Uoew0KICAgICAgICAgICAgICAgICAgICAgICAgICAgIGVycm9yOiBlcnJvcl8xLm1lc3NhZ2UNCiAgICAgICAgICAgICAgICAgICAgICAgIH0pOw0KICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIFsyIC8qcmV0dXJuKi9dOw0KICAgICAgICAgICAgICAgICAgICBjYXNlIDU6DQogICAgICAgICAgICAgICAgICAgICAgICBpZiAoIXJlc3BvbnNlKSB7DQogICAgICAgICAgICAgICAgICAgICAgICAgICAgLy8gSWYgdGhlIHJlcXVlc3QgdGltZXMgb3V0LCBhYm9ydCBpdCBhbmQgbGV0IGBzd2l0Y2hGZXRjaGAgcmFpc2UgdGhlIGVycm9yLg0KICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmIChhYm9ydENvbnRyb2xsZXIpDQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGFib3J0Q29udHJvbGxlci5hYm9ydCgpOw0KICAgICAgICAgICAgICAgICAgICAgICAgICAgIHBvcnQucG9zdE1lc3NhZ2Uoew0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBlcnJvcjogIlRpbWVvdXQgd2hlbiBleGVjdXRpbmcgJ2ZldGNoJyINCiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9KTsNCiAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gWzIgLypyZXR1cm4qL107DQogICAgICAgICAgICAgICAgICAgICAgICB9DQogICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gWzQgLyp5aWVsZCovLCByZXNwb25zZS5qc29uKCldOw0KICAgICAgICAgICAgICAgICAgICBjYXNlIDY6DQogICAgICAgICAgICAgICAgICAgICAgICBqc29uID0gX2Uuc2VudCgpOw0KICAgICAgICAgICAgICAgICAgICAgICAgaWYgKGpzb24ucmVmcmVzaF90b2tlbikgew0KICAgICAgICAgICAgICAgICAgICAgICAgICAgIHNldFJlZnJlc2hUb2tlbihqc29uLnJlZnJlc2hfdG9rZW4sIGF1ZGllbmNlLCBzY29wZSk7DQogICAgICAgICAgICAgICAgICAgICAgICAgICAgZGVsZXRlIGpzb24ucmVmcmVzaF90b2tlbjsNCiAgICAgICAgICAgICAgICAgICAgICAgIH0NCiAgICAgICAgICAgICAgICAgICAgICAgIGVsc2Ugew0KICAgICAgICAgICAgICAgICAgICAgICAgICAgIGRlbGV0ZVJlZnJlc2hUb2tlbihhdWRpZW5jZSwgc2NvcGUpOw0KICAgICAgICAgICAgICAgICAgICAgICAgfQ0KICAgICAgICAgICAgICAgICAgICAgICAgcG9ydC5wb3N0TWVzc2FnZSh7DQogICAgICAgICAgICAgICAgICAgICAgICAgICAgb2s6IHJlc3BvbnNlLm9rLA0KICAgICAgICAgICAgICAgICAgICAgICAgICAgIGpzb246IGpzb24NCiAgICAgICAgICAgICAgICAgICAgICAgIH0pOw0KICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIFszIC8qYnJlYWsqLywgOF07DQogICAgICAgICAgICAgICAgICAgIGNhc2UgNzoNCiAgICAgICAgICAgICAgICAgICAgICAgIGVycm9yXzIgPSBfZS5zZW50KCk7DQogICAgICAgICAgICAgICAgICAgICAgICBwb3J0LnBvc3RNZXNzYWdlKHsNCiAgICAgICAgICAgICAgICAgICAgICAgICAgICBvazogZmFsc2UsDQogICAgICAgICAgICAgICAgICAgICAgICAgICAganNvbjogew0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBlcnJvcl9kZXNjcmlwdGlvbjogZXJyb3JfMi5tZXNzYWdlDQogICAgICAgICAgICAgICAgICAgICAgICAgICAgfQ0KICAgICAgICAgICAgICAgICAgICAgICAgfSk7DQogICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gWzMgLypicmVhayovLCA4XTsNCiAgICAgICAgICAgICAgICAgICAgY2FzZSA4OiByZXR1cm4gWzIgLypyZXR1cm4qL107DQogICAgICAgICAgICAgICAgfQ0KICAgICAgICAgICAgfSk7DQogICAgICAgIH0pOw0KICAgIH07DQogICAgLy8gRG9uJ3QgcnVuIGBhZGRFdmVudExpc3RlbmVyYCBpbiBvdXIgdGVzdHMgKHRoaXMgaXMgcmVwbGFjZWQgaW4gcm9sbHVwKQ0KICAgIC8qIGlzdGFuYnVsIGlnbm9yZSBlbHNlICAqLw0KICAgIHsNCiAgICAgICAgLy8gQHRzLWlnbm9yZQ0KICAgICAgICBhZGRFdmVudExpc3RlbmVyKCdtZXNzYWdlJywgbWVzc2FnZUhhbmRsZXIpOw0KICAgIH0KCn0oKSk7Cgo=', null, false);
|
|
5058
|
+
var WorkerFactory = createBase64WorkerFactory('Lyogcm9sbHVwLXBsdWdpbi13ZWItd29ya2VyLWxvYWRlciAqLwooZnVuY3Rpb24gKCkgewogICAgJ3VzZSBzdHJpY3QnOwoKICAgIC8qISAqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKg0KICAgIENvcHlyaWdodCAoYykgTWljcm9zb2Z0IENvcnBvcmF0aW9uLg0KDQogICAgUGVybWlzc2lvbiB0byB1c2UsIGNvcHksIG1vZGlmeSwgYW5kL29yIGRpc3RyaWJ1dGUgdGhpcyBzb2Z0d2FyZSBmb3IgYW55DQogICAgcHVycG9zZSB3aXRoIG9yIHdpdGhvdXQgZmVlIGlzIGhlcmVieSBncmFudGVkLg0KDQogICAgVEhFIFNPRlRXQVJFIElTIFBST1ZJREVEICJBUyBJUyIgQU5EIFRIRSBBVVRIT1IgRElTQ0xBSU1TIEFMTCBXQVJSQU5USUVTIFdJV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AgICAgICAgICAgICAgIGNhc2UgNDogXy5sYWJlbCsrOyByZXR1cm4geyB2YWx1ZTogb3BbMV0sIGRvbmU6IGZhbHNlIH07DQogICAgICAgICAgICAgICAgICAgIGNhc2UgNTogXy5sYWJlbCsrOyB5ID0gb3BbMV07IG9wID0gWzBdOyBjb250aW51ZTsNCiAgICAgICAgICAgICAgICAgICAgY2FzZSA3OiBvcCA9IF8ub3BzLnBvcCgpOyBfLnRyeXMucG9wKCk7IGNvbnRpbnVlOw0KICAgICAgICAgICAgICAgICAgICBkZWZhdWx0Og0KICAgICAgICAgICAgICAgICAgICAgICAgaWYgKCEodCA9IF8udHJ5cywgdCA9IHQubGVuZ3RoID4gMCAmJiB0W3QubGVuZ3RoIC0gMV0pICYmIChvcFswXSA9PT0gNiB8fCBvcFswXSA9PT0gMikpIHsgXyA9IDA7IGNvbnRpbnVlOyB9DQogICAgICAgICAgICAgICAgICAgICAgICBpZiAob3BbMF0gPT09IDMgJiYgKCF0IHx8IChvcFsxXSA+IHRbMF0gJiYgb3BbMV0gPCB0WzNdKSkpIHsgXy5sYWJlbCA9IG9wWzFdOyBicmVhazsgfQ0KICAgICAgICAgICAgICAgICAgICAgICAgaWYgKG9wWzBdID09PSA2ICYmIF8ubGFiZWwgPCB0WzFdKSB7IF8ubGFiZWwgPSB0WzFdOyB0ID0gb3A7IGJyZWFrOyB9DQogICAgICAgICAgICAgICAgICAgICAgICBpZiAodCAmJiBfLmxhYmVsIDwgdFsyXSkgeyBfLmxhYmVsID0gdFsyXTsgXy5vcHMucHVzaChvcCk7IGJyZWFrOyB9DQogICAgICAgICAgICAgICAgICAgICAgICBpZiAodFsyXSkgXy5vcHMucG9wKCk7DQogICAgICAgICAgICAgICAgICAgICAgICBfLnRyeXMucG9wKCk7IGNvbnRpbnVlOw0KICAgICAgICAgICAgICAgIH0NCiAgICAgICAgICAgICAgICBvcCA9IGJvZHkuY2FsbCh0aGlzQXJnLCBfKTsNCiAgICAgICAgICAgIH0gY2F0Y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gIGJvZHkgPSB1c2VGb3JtRGF0YQ0KICAgICAgICAgICAgICAgICAgICAgICAgICAgID8gZm9ybURhdGFUb09iamVjdChmZXRjaE9wdGlvbnMuYm9keSkNCiAgICAgICAgICAgICAgICAgICAgICAgICAgICA6IEpTT04ucGFyc2UoZmV0Y2hPcHRpb25zLmJvZHkpOw0KICAgICAgICAgICAgICAgICAgICAgICAgaWYgKCFib2R5LnJlZnJlc2hfdG9rZW4gJiYgYm9keS5ncmFudF90eXBlID09PSAncmVmcmVzaF90b2tlbicpIHsNCiAgICAgICAgICAgICAgICAgICAgICAgICAgICByZWZyZXNoVG9rZW4gPSBnZXRSZWZyZXNoVG9rZW4oYXVkaWVuY2UsIHNjb3BlKTsNCiAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAoIXJlZnJlc2hUb2tlbikgew0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0aHJvdyBuZXcgRXJyb3IoTUlTU0lOR19SRUZSRVNIX1RPS0VOX0VSUk9SX01FU1NBR0UpOw0KICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0NCiAgICAgICAgICAgICAgICAgICAgICAgICAgICBmZXRjaE9wdGlvbnMuYm9keSA9IHVzZUZvcm1EYXRhDQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgID8gbmV3IFVSTFNlYXJjaFBhcmFtcyhfX2Fzc2lnbihfX2Fzc2lnbih7fSwgYm9keSksIHsgcmVmcmVzaF90b2tlbjogcmVmcmVzaFRva2VuIH0pKS50b1N0cmluZygpDQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIDogSlNPTi5zdHJpbmdpZnkoX19hc3NpZ24oX19hc3NpZ24oe30sIGJvZHkpLCB7IHJlZnJlc2hfdG9rZW46IHJlZnJlc2hUb2tlbiB9KSk7DQogICAgICAgICAgICAgICAgICAgICAgICB9DQogICAgICAgICAgICAgICAgICAgICAgICBhYm9ydENvbnRyb2xsZXIgPSB2b2lkIDA7DQogICAgICAgICAgICAgICAgICAgICAgICBpZiAodHlwZW9mIEFib3J0Q29udHJvbGxlciA9PT0gJ2Z1bmN0aW9uJykgew0KICAgICAgICAgICAgICAgICAgICAgICAgICAgIGFib3J0Q29udHJvbGxlciA9IG5ldyBBYm9ydENvbnRyb2xsZXIoKTsNCiAgICAgICAgICAgICAgICAgICAgICAgICAgICBmZXRjaE9wdGlvbnMuc2lnbmFsID0gYWJvcnRDb250cm9sbGVyLnNpZ25hbDsNCiAgICAgICAgICAgICAgICAgICAgICAgIH0NCiAgICAgICAgICAgICAgICAgICAgICAgIHJlc3BvbnNlID0gdm9pZCAwOw0KICAgICAgICAgICAgICAgICAgICAgICAgX2UubGFiZWwgPSAyOw0KICAgICAgICAgICAgICAgICAgICBjYXNlIDI6DQogICAgICAgICAgICAgICAgICAgICAgICBfZS50cnlzLnB1c2goWzIsIDQsICwgNV0pOw0KICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIFs0IC8qeWllbGQqLywgUHJvbWlzZS5yYWNlKFsNCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgd2FpdCh0aW1lb3V0KSwNCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZmV0Y2goZmV0Y2hVcmwsIF9fYXNzaWduKHt9LCBmZXRjaE9wdGlvbnMpKQ0KICAgICAgICAgICAgICAgICAgICAgICAgICAgIF0pXTsNCiAgICAgICAgICAgICAgICAgICAgY2FzZSAzOg0KICAgICAgICAgICAgICAgICAgICAgICAgcmVzcG9uc2UgPSBfZS5zZW50KCk7DQogICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gWzMgLypicmVhayovLCA1XTsNCiAgICAgICAgICAgICAgICAgICAgY2FzZSA0Og0KICAgICAgICAgICAgICAgICAgICAgICAgZXJyb3JfMSA9IF9lLnNlbnQoKTsNCiAgICAgICAgICAgICAgICAgICAgICAgIC8vIGZldGNoIGVycm9yLCByZWplY3QgYHNlbmRNZXNzYWdlYCB1c2luZyBgZXJyb3JgIGtleSBzbyB0aGF0IHdlIHJldHJ5Lg0KICAgICAgICAgICAgICAgICAgICAgICAgcG9ydC5wb3N0TWVzc2FnZSh7DQogICAgICAgICAgICAgICAgICAgICAgICAgICAgZXJyb3I6IGVycm9yXzEubWVzc2FnZQ0KICAgICAgICAgICAgICAgICAgICAgICAgfSk7DQogICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gWzIgLypyZXR1cm4qL107DQogICAgICAgICAgICAgICAgICAgIGNhc2UgNToNCiAgICAgICAgICAgICAgICAgICAgICAgIGlmICghcmVzcG9uc2UpIHsNCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAvLyBJZiB0aGUgcmVxdWVzdCB0aW1lcyBvdXQsIGFib3J0IGl0IGFuZCBsZXQgYHN3aXRjaEZldGNoYCByYWlzZSB0aGUgZXJyb3IuDQogICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKGFib3J0Q29udHJvbGxlcikNCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgYWJvcnRDb250cm9sbGVyLmFib3J0KCk7DQogICAgICAgICAgICAgICAgICAgICAgICAgICAgcG9ydC5wb3N0TWVzc2FnZSh7DQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGVycm9yOiAiVGltZW91dCB3aGVuIGV4ZWN1dGluZyAnZmV0Y2gnIg0KICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0pOw0KICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBbMiAvKnJldHVybiovXTsNCiAgICAgICAgICAgICAgICAgICAgICAgIH0NCiAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBbNCAvKnlpZWxkKi8sIHJlc3BvbnNlLmpzb24oKV07DQogICAgICAgICAgICAgICAgICAgIGNhc2UgNjoNCiAgICAgICAgICAgICAgICAgICAgICAgIGpzb24gPSBfZS5zZW50KCk7DQogICAgICAgICAgICAgICAgICAgICAgICBpZiAoanNvbi5yZWZyZXNoX3Rva2VuKSB7DQogICAgICAgICAgICAgICAgICAgICAgICAgICAgc2V0UmVmcmVzaFRva2VuKGpzb24ucmVmcmVzaF90b2tlbiwgYXVkaWVuY2UsIHNjb3BlKTsNCiAgICAgICAgICAgICAgICAgICAgICAgICAgICBkZWxldGUganNvbi5yZWZyZXNoX3Rva2VuOw0KICAgICAgICAgICAgICAgICAgICAgICAgfQ0KICAgICAgICAgICAgICAgICAgICAgICAgZWxzZSB7DQogICAgICAgICAgICAgICAgICAgICAgICAgICAgZGVsZXRlUmVmcmVzaFRva2VuKGF1ZGllbmNlLCBzY29wZSk7DQogICAgICAgICAgICAgICAgICAgICAgICB9DQogICAgICAgICAgICAgICAgICAgICAgICBwb3J0LnBvc3RNZXNzYWdlKHsNCiAgICAgICAgICAgICAgICAgICAgICAgICAgICBvazogcmVzcG9uc2Uub2ssDQogICAgICAgICAgICAgICAgICAgICAgICAgICAganNvbjoganNvbg0KICAgICAgICAgICAgICAgICAgICAgICAgfSk7DQogICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gWzMgLypicmVhayovLCA4XTsNCiAgICAgICAgICAgICAgICAgICAgY2FzZSA3Og0KICAgICAgICAgICAgICAgICAgICAgICAgZXJyb3JfMiA9IF9lLnNlbnQoKTsNCiAgICAgICAgICAgICAgICAgICAgICAgIHBvcnQucG9zdE1lc3NhZ2Uoew0KICAgICAgICAgICAgICAgICAgICAgICAgICAgIG9rOiBmYWxzZSwNCiAgICAgICAgICAgICAgICAgICAgICAgICAgICBqc29uOiB7DQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGVycm9yX2Rlc2NyaXB0aW9uOiBlcnJvcl8yLm1lc3NhZ2UNCiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9DQogICAgICAgICAgICAgICAgICAgICAgICB9KTsNCiAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBbMyAvKmJyZWFrKi8sIDhdOw0KICAgICAgICAgICAgICAgICAgICBjYXNlIDg6IHJldHVybiBbMiAvKnJldHVybiovXTsNCiAgICAgICAgICAgICAgICB9DQogICAgICAgICAgICB9KTsNCiAgICAgICAgfSk7DQogICAgfTsNCiAgICAvLyBEb24ndCBydW4gYGFkZEV2ZW50TGlzdGVuZXJgIGluIG91ciB0ZXN0cyAodGhpcyBpcyByZXBsYWNlZCBpbiByb2xsdXApDQogICAgLyogaXN0YW5idWwgaWdub3JlIGVsc2UgICovDQogICAgew0KICAgICAgICAvLyBAdHMtaWdub3JlDQogICAgICAgIGFkZEV2ZW50TGlzdGVuZXIoJ21lc3NhZ2UnLCBtZXNzYWdlSGFuZGxlcik7DQogICAgfQoKfSgpKTsKCg==', null, false);
|
|
5018
5059
|
/* eslint-enable */
|
|
5019
5060
|
|
|
5020
5061
|
var isIE11 = function () { return /Trident.*rv:11\.0/.test(navigator.userAgent); };
|
|
@@ -5057,6 +5098,67 @@
|
|
|
5057
5098
|
});
|
|
5058
5099
|
};
|
|
5059
5100
|
|
|
5101
|
+
var CacheKeyManifest = /** @class */ (function () {
|
|
5102
|
+
function CacheKeyManifest(cache, clientId) {
|
|
5103
|
+
this.cache = cache;
|
|
5104
|
+
this.clientId = clientId;
|
|
5105
|
+
this.manifestKey = this.createManifestKeyFrom(this.clientId);
|
|
5106
|
+
}
|
|
5107
|
+
CacheKeyManifest.prototype.add = function (key) {
|
|
5108
|
+
var _a;
|
|
5109
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
5110
|
+
var keys, _b;
|
|
5111
|
+
return __generator(this, function (_c) {
|
|
5112
|
+
switch (_c.label) {
|
|
5113
|
+
case 0:
|
|
5114
|
+
_b = Set.bind;
|
|
5115
|
+
return [4 /*yield*/, this.cache.get(this.manifestKey)];
|
|
5116
|
+
case 1:
|
|
5117
|
+
keys = new (_b.apply(Set, [void 0, ((_a = (_c.sent())) === null || _a === void 0 ? void 0 : _a.keys) || []]))();
|
|
5118
|
+
keys.add(key);
|
|
5119
|
+
return [4 /*yield*/, this.cache.set(this.manifestKey, {
|
|
5120
|
+
keys: __spreadArray([], __read(keys))
|
|
5121
|
+
})];
|
|
5122
|
+
case 2:
|
|
5123
|
+
_c.sent();
|
|
5124
|
+
return [2 /*return*/];
|
|
5125
|
+
}
|
|
5126
|
+
});
|
|
5127
|
+
});
|
|
5128
|
+
};
|
|
5129
|
+
CacheKeyManifest.prototype.remove = function (key) {
|
|
5130
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
5131
|
+
var entry, keys;
|
|
5132
|
+
return __generator(this, function (_a) {
|
|
5133
|
+
switch (_a.label) {
|
|
5134
|
+
case 0: return [4 /*yield*/, this.cache.get(this.manifestKey)];
|
|
5135
|
+
case 1:
|
|
5136
|
+
entry = _a.sent();
|
|
5137
|
+
if (!entry) return [3 /*break*/, 5];
|
|
5138
|
+
keys = new Set(entry.keys);
|
|
5139
|
+
keys.delete(key);
|
|
5140
|
+
if (!(keys.size > 0)) return [3 /*break*/, 3];
|
|
5141
|
+
return [4 /*yield*/, this.cache.set(this.manifestKey, { keys: __spreadArray([], __read(keys)) })];
|
|
5142
|
+
case 2: return [2 /*return*/, _a.sent()];
|
|
5143
|
+
case 3: return [4 /*yield*/, this.cache.remove(this.manifestKey)];
|
|
5144
|
+
case 4: return [2 /*return*/, _a.sent()];
|
|
5145
|
+
case 5: return [2 /*return*/];
|
|
5146
|
+
}
|
|
5147
|
+
});
|
|
5148
|
+
});
|
|
5149
|
+
};
|
|
5150
|
+
CacheKeyManifest.prototype.get = function () {
|
|
5151
|
+
return this.cache.get(this.manifestKey);
|
|
5152
|
+
};
|
|
5153
|
+
CacheKeyManifest.prototype.clear = function () {
|
|
5154
|
+
return this.cache.remove(this.manifestKey);
|
|
5155
|
+
};
|
|
5156
|
+
CacheKeyManifest.prototype.createManifestKeyFrom = function (clientId) {
|
|
5157
|
+
return CACHE_KEY_PREFIX + "::" + clientId;
|
|
5158
|
+
};
|
|
5159
|
+
return CacheKeyManifest;
|
|
5160
|
+
}());
|
|
5161
|
+
|
|
5060
5162
|
/**
|
|
5061
5163
|
* @ignore
|
|
5062
5164
|
*/
|
|
@@ -5065,6 +5167,22 @@
|
|
|
5065
5167
|
* @ignore
|
|
5066
5168
|
*/
|
|
5067
5169
|
var GET_TOKEN_SILENTLY_LOCK_KEY = 'auth0.lock.getTokenSilently';
|
|
5170
|
+
/**
|
|
5171
|
+
* @ignore
|
|
5172
|
+
*/
|
|
5173
|
+
var buildOrganizationHintCookieName = function (clientId) {
|
|
5174
|
+
return "auth0." + clientId + ".organization_hint";
|
|
5175
|
+
};
|
|
5176
|
+
/**
|
|
5177
|
+
* @ignore
|
|
5178
|
+
*/
|
|
5179
|
+
var OLD_IS_AUTHENTICATED_COOKIE_NAME = 'auth0.is.authenticated';
|
|
5180
|
+
/**
|
|
5181
|
+
* @ignore
|
|
5182
|
+
*/
|
|
5183
|
+
var buildIsAuthenticatedCookieName = function (clientId) {
|
|
5184
|
+
return "auth0." + clientId + ".is.authenticated";
|
|
5185
|
+
};
|
|
5068
5186
|
/**
|
|
5069
5187
|
* @ignore
|
|
5070
5188
|
*/
|
|
@@ -5091,11 +5209,20 @@
|
|
|
5091
5209
|
}
|
|
5092
5210
|
return domainUrl + "/";
|
|
5093
5211
|
};
|
|
5212
|
+
/**
|
|
5213
|
+
* @ignore
|
|
5214
|
+
*/
|
|
5215
|
+
var getDomain = function (domainUrl) {
|
|
5216
|
+
if (!/^https?:\/\//.test(domainUrl)) {
|
|
5217
|
+
return "https://" + domainUrl;
|
|
5218
|
+
}
|
|
5219
|
+
return domainUrl;
|
|
5220
|
+
};
|
|
5094
5221
|
/**
|
|
5095
5222
|
* @ignore
|
|
5096
5223
|
*/
|
|
5097
5224
|
var getCustomInitialOptions = function (options) {
|
|
5098
|
-
options.advancedOptions; options.audience; options.auth0Client; options.authorizeTimeoutInSeconds; options.cacheLocation; options.client_id; options.domain; options.issuer; options.leeway; options.max_age; options.redirect_uri; options.scope; options.useRefreshTokens; var customParams = __rest(options, ["advancedOptions", "audience", "auth0Client", "authorizeTimeoutInSeconds", "cacheLocation", "client_id", "domain", "issuer", "leeway", "max_age", "redirect_uri", "scope", "useRefreshTokens"]);
|
|
5225
|
+
options.advancedOptions; options.audience; options.auth0Client; options.authorizeTimeoutInSeconds; options.cacheLocation; options.client_id; options.domain; options.issuer; options.leeway; options.max_age; options.redirect_uri; options.scope; options.useRefreshTokens; options.useCookiesForTransactions; options.useFormData; var customParams = __rest(options, ["advancedOptions", "audience", "auth0Client", "authorizeTimeoutInSeconds", "cacheLocation", "client_id", "domain", "issuer", "leeway", "max_age", "redirect_uri", "scope", "useRefreshTokens", "useCookiesForTransactions", "useFormData"]);
|
|
5099
5226
|
return customParams;
|
|
5100
5227
|
};
|
|
5101
5228
|
/**
|
|
@@ -5124,15 +5251,19 @@
|
|
|
5124
5251
|
options.legacySameSiteCookie === false
|
|
5125
5252
|
? CookieStorage
|
|
5126
5253
|
: CookieStorageWithLegacySameSite;
|
|
5254
|
+
this.orgHintCookieName = buildOrganizationHintCookieName(this.options.client_id);
|
|
5255
|
+
this.isAuthenticatedCookieName = buildIsAuthenticatedCookieName(this.options.client_id);
|
|
5127
5256
|
this.sessionCheckExpiryDays =
|
|
5128
5257
|
options.sessionCheckExpiryDays || DEFAULT_SESSION_CHECK_EXPIRY_DAYS;
|
|
5129
5258
|
var transactionStorage = options.useCookiesForTransactions
|
|
5130
5259
|
? this.cookieStorage
|
|
5131
5260
|
: SessionStorage;
|
|
5132
5261
|
this.scope = this.options.scope;
|
|
5133
|
-
this.transactionManager = new TransactionManager(transactionStorage);
|
|
5134
|
-
this.cacheManager = new CacheManager(cache,
|
|
5135
|
-
|
|
5262
|
+
this.transactionManager = new TransactionManager(transactionStorage, this.options.client_id);
|
|
5263
|
+
this.cacheManager = new CacheManager(cache, !cache.allKeys
|
|
5264
|
+
? new CacheKeyManifest(cache, this.options.client_id)
|
|
5265
|
+
: null);
|
|
5266
|
+
this.domainUrl = getDomain(this.options.domain);
|
|
5136
5267
|
this.tokenIssuer = getTokenIssuer(this.options.issuer, this.domainUrl);
|
|
5137
5268
|
this.defaultScope = getUniqueScopes('openid', ((_b = (_a = this.options) === null || _a === void 0 ? void 0 : _a.advancedOptions) === null || _b === void 0 ? void 0 : _b.defaultScope) !== undefined
|
|
5138
5269
|
? this.options.advancedOptions.defaultScope
|
|
@@ -5158,9 +5289,8 @@
|
|
|
5158
5289
|
return "" + this.domainUrl + path + "&auth0Client=" + auth0Client;
|
|
5159
5290
|
};
|
|
5160
5291
|
Auth0Client.prototype._getParams = function (authorizeOptions, state, nonce, code_challenge, redirect_uri) {
|
|
5161
|
-
var _a = this.options; _a.domain; _a.leeway; _a.useRefreshTokens; _a.useCookiesForTransactions; _a.auth0Client; _a.cacheLocation; _a.advancedOptions; var
|
|
5162
|
-
return __assign(__assign(__assign({},
|
|
5163
|
-
nonce: nonce, redirect_uri: redirect_uri || this.options.redirect_uri, code_challenge: code_challenge, code_challenge_method: 'S256' });
|
|
5292
|
+
var _a = this.options; _a.domain; _a.leeway; _a.useRefreshTokens; _a.useCookiesForTransactions; _a.useFormData; _a.auth0Client; _a.cacheLocation; _a.advancedOptions; var withoutClientOptions = __rest(_a, ["domain", "leeway", "useRefreshTokens", "useCookiesForTransactions", "useFormData", "auth0Client", "cacheLocation", "advancedOptions"]);
|
|
5293
|
+
return __assign(__assign(__assign({}, withoutClientOptions), authorizeOptions), { scope: getUniqueScopes(this.defaultScope, this.scope, authorizeOptions.scope), response_type: 'code', response_mode: 'query', state: state, nonce: nonce, redirect_uri: redirect_uri || this.options.redirect_uri, code_challenge: code_challenge, code_challenge_method: 'S256' });
|
|
5164
5294
|
};
|
|
5165
5295
|
Auth0Client.prototype._authorizeUrl = function (authorizeOptions) {
|
|
5166
5296
|
return this._url("/authorize?" + createQueryParams(authorizeOptions));
|
|
@@ -5182,6 +5312,14 @@
|
|
|
5182
5312
|
}
|
|
5183
5313
|
return parseInt(value, 10) || undefined;
|
|
5184
5314
|
};
|
|
5315
|
+
Auth0Client.prototype._processOrgIdHint = function (organizationId) {
|
|
5316
|
+
if (organizationId) {
|
|
5317
|
+
this.cookieStorage.save(this.orgHintCookieName, organizationId);
|
|
5318
|
+
}
|
|
5319
|
+
else {
|
|
5320
|
+
this.cookieStorage.remove(this.orgHintCookieName);
|
|
5321
|
+
}
|
|
5322
|
+
};
|
|
5185
5323
|
/**
|
|
5186
5324
|
* ```js
|
|
5187
5325
|
* await auth0.buildAuthorizeUrl(options);
|
|
@@ -5212,8 +5350,7 @@
|
|
|
5212
5350
|
params = this._getParams(authorizeOptions, stateIn, nonceIn, code_challenge, redirect_uri);
|
|
5213
5351
|
url = this._authorizeUrl(params);
|
|
5214
5352
|
organizationId = options.organization || this.options.organization;
|
|
5215
|
-
this.transactionManager.create(__assign({ nonce: nonceIn, code_verifier: code_verifier,
|
|
5216
|
-
appState: appState, scope: params.scope, audience: params.audience || 'default', redirect_uri: params.redirect_uri }, (organizationId && { organizationId: organizationId })));
|
|
5353
|
+
this.transactionManager.create(__assign({ nonce: nonceIn, code_verifier: code_verifier, appState: appState, scope: params.scope, audience: params.audience || 'default', redirect_uri: params.redirect_uri }, (organizationId && { organizationId: organizationId })));
|
|
5217
5354
|
return [2 /*return*/, url + fragment];
|
|
5218
5355
|
}
|
|
5219
5356
|
});
|
|
@@ -5281,7 +5418,8 @@
|
|
|
5281
5418
|
code: codeResult.code,
|
|
5282
5419
|
grant_type: 'authorization_code',
|
|
5283
5420
|
redirect_uri: params.redirect_uri,
|
|
5284
|
-
auth0Client: this.options.auth0Client
|
|
5421
|
+
auth0Client: this.options.auth0Client,
|
|
5422
|
+
useFormData: this.options.useFormData
|
|
5285
5423
|
}, this.worker)];
|
|
5286
5424
|
case 3:
|
|
5287
5425
|
authResult = _a.sent();
|
|
@@ -5291,9 +5429,10 @@
|
|
|
5291
5429
|
return [4 /*yield*/, this.cacheManager.set(cacheEntry)];
|
|
5292
5430
|
case 4:
|
|
5293
5431
|
_a.sent();
|
|
5294
|
-
this.cookieStorage.save(
|
|
5432
|
+
this.cookieStorage.save(this.isAuthenticatedCookieName, true, {
|
|
5295
5433
|
daysUntilExpire: this.sessionCheckExpiryDays
|
|
5296
5434
|
});
|
|
5435
|
+
this._processOrgIdHint(decodedToken.claims.org_id);
|
|
5297
5436
|
return [2 /*return*/];
|
|
5298
5437
|
}
|
|
5299
5438
|
});
|
|
@@ -5432,7 +5571,8 @@
|
|
|
5432
5571
|
code_verifier: transaction.code_verifier,
|
|
5433
5572
|
grant_type: 'authorization_code',
|
|
5434
5573
|
code: code,
|
|
5435
|
-
auth0Client: this.options.auth0Client
|
|
5574
|
+
auth0Client: this.options.auth0Client,
|
|
5575
|
+
useFormData: this.options.useFormData
|
|
5436
5576
|
};
|
|
5437
5577
|
// some old versions of the SDK might not have added redirect_uri to the
|
|
5438
5578
|
// transaction, we dont want the key to be set to undefined.
|
|
@@ -5447,9 +5587,10 @@
|
|
|
5447
5587
|
return [4 /*yield*/, this.cacheManager.set(cacheEntry)];
|
|
5448
5588
|
case 2:
|
|
5449
5589
|
_b.sent();
|
|
5450
|
-
this.cookieStorage.save(
|
|
5590
|
+
this.cookieStorage.save(this.isAuthenticatedCookieName, true, {
|
|
5451
5591
|
daysUntilExpire: this.sessionCheckExpiryDays
|
|
5452
5592
|
});
|
|
5593
|
+
this._processOrgIdHint(decodedToken.claims.org_id);
|
|
5453
5594
|
return [2 /*return*/, {
|
|
5454
5595
|
appState: transaction.appState
|
|
5455
5596
|
}];
|
|
@@ -5466,7 +5607,7 @@
|
|
|
5466
5607
|
* with `getTokenSilently` is that this doesn't return a token, but it will
|
|
5467
5608
|
* pre-fill the token cache.
|
|
5468
5609
|
*
|
|
5469
|
-
* This method also heeds the `auth0.is.authenticated` cookie, as an optimization
|
|
5610
|
+
* This method also heeds the `auth0.{clientId}.is.authenticated` cookie, as an optimization
|
|
5470
5611
|
* to prevent calling Auth0 unnecessarily. If the cookie is not present because
|
|
5471
5612
|
* there was no previous login (or it has expired) then tokens will not be refreshed.
|
|
5472
5613
|
*
|
|
@@ -5482,8 +5623,17 @@
|
|
|
5482
5623
|
return __generator(this, function (_a) {
|
|
5483
5624
|
switch (_a.label) {
|
|
5484
5625
|
case 0:
|
|
5485
|
-
if (!this.cookieStorage.get(
|
|
5486
|
-
|
|
5626
|
+
if (!this.cookieStorage.get(this.isAuthenticatedCookieName)) {
|
|
5627
|
+
if (!this.cookieStorage.get(OLD_IS_AUTHENTICATED_COOKIE_NAME)) {
|
|
5628
|
+
return [2 /*return*/];
|
|
5629
|
+
}
|
|
5630
|
+
else {
|
|
5631
|
+
// Migrate the existing cookie to the new name scoped by client ID
|
|
5632
|
+
this.cookieStorage.save(this.isAuthenticatedCookieName, true, {
|
|
5633
|
+
daysUntilExpire: this.sessionCheckExpiryDays
|
|
5634
|
+
});
|
|
5635
|
+
this.cookieStorage.remove(OLD_IS_AUTHENTICATED_COOKIE_NAME);
|
|
5636
|
+
}
|
|
5487
5637
|
}
|
|
5488
5638
|
_a.label = 1;
|
|
5489
5639
|
case 1:
|
|
@@ -5604,7 +5754,7 @@
|
|
|
5604
5754
|
return [4 /*yield*/, this.cacheManager.set(__assign({ client_id: this.options.client_id }, authResult))];
|
|
5605
5755
|
case 11:
|
|
5606
5756
|
_b.sent();
|
|
5607
|
-
this.cookieStorage.save(
|
|
5757
|
+
this.cookieStorage.save(this.isAuthenticatedCookieName, true, {
|
|
5608
5758
|
daysUntilExpire: this.sessionCheckExpiryDays
|
|
5609
5759
|
});
|
|
5610
5760
|
return [2 /*return*/, authResult.access_token];
|
|
@@ -5707,6 +5857,9 @@
|
|
|
5707
5857
|
*
|
|
5708
5858
|
* Clears the application session and performs a redirect to `/v2/logout`, using
|
|
5709
5859
|
* the parameters provided as arguments, to clear the Auth0 session.
|
|
5860
|
+
*
|
|
5861
|
+
* **Note:** If you are using a custom cache, and specifying `localOnly: true`, and you want to perform actions or read state from the SDK immediately after logout, you should `await` the result of calling `logout`.
|
|
5862
|
+
*
|
|
5710
5863
|
* If the `federated` option is specified it also clears the Identity Provider session.
|
|
5711
5864
|
* If the `localOnly` option is specified, it only clears the application session.
|
|
5712
5865
|
* It is invalid to set both the `federated` and `localOnly` options to `true`,
|
|
@@ -5716,22 +5869,32 @@
|
|
|
5716
5869
|
* @param options
|
|
5717
5870
|
*/
|
|
5718
5871
|
Auth0Client.prototype.logout = function (options) {
|
|
5872
|
+
var _this = this;
|
|
5719
5873
|
if (options === void 0) { options = {}; }
|
|
5720
5874
|
var localOnly = options.localOnly, logoutOptions = __rest(options, ["localOnly"]);
|
|
5721
5875
|
if (localOnly && logoutOptions.federated) {
|
|
5722
5876
|
throw new Error('It is invalid to set both the `federated` and `localOnly` options to `true`');
|
|
5723
5877
|
}
|
|
5724
|
-
|
|
5725
|
-
|
|
5726
|
-
|
|
5727
|
-
|
|
5878
|
+
var postCacheClear = function () {
|
|
5879
|
+
_this.cookieStorage.remove(_this.orgHintCookieName);
|
|
5880
|
+
_this.cookieStorage.remove(_this.isAuthenticatedCookieName);
|
|
5881
|
+
if (localOnly) {
|
|
5882
|
+
return;
|
|
5883
|
+
}
|
|
5884
|
+
var url = _this.buildLogoutUrl(logoutOptions);
|
|
5885
|
+
window.location.assign(url);
|
|
5886
|
+
};
|
|
5887
|
+
if (this.options.cache) {
|
|
5888
|
+
return this.cacheManager.clear().then(function () { return postCacheClear(); });
|
|
5889
|
+
}
|
|
5890
|
+
else {
|
|
5891
|
+
this.cacheManager.clearSync();
|
|
5892
|
+
postCacheClear();
|
|
5728
5893
|
}
|
|
5729
|
-
var url = this.buildLogoutUrl(logoutOptions);
|
|
5730
|
-
window.location.assign(url);
|
|
5731
5894
|
};
|
|
5732
5895
|
Auth0Client.prototype._getTokenFromIFrame = function (options) {
|
|
5733
5896
|
return __awaiter(this, void 0, void 0, function () {
|
|
5734
|
-
var stateIn, nonceIn, code_verifier, code_challengeBuffer, code_challenge, params, url, timeout, codeResult, scope, audience, customOptions, tokenResult, decodedToken, e_1;
|
|
5897
|
+
var stateIn, nonceIn, code_verifier, code_challengeBuffer, code_challenge, params, orgIdHint, url, timeout, codeResult, scope, audience, customOptions, tokenResult, decodedToken, e_1;
|
|
5735
5898
|
return __generator(this, function (_a) {
|
|
5736
5899
|
switch (_a.label) {
|
|
5737
5900
|
case 0:
|
|
@@ -5745,23 +5908,33 @@
|
|
|
5745
5908
|
params = this._getParams(options, stateIn, nonceIn, code_challenge, options.redirect_uri ||
|
|
5746
5909
|
this.options.redirect_uri ||
|
|
5747
5910
|
window.location.origin);
|
|
5911
|
+
orgIdHint = this.cookieStorage.get(this.orgHintCookieName);
|
|
5912
|
+
if (orgIdHint && !params.organization) {
|
|
5913
|
+
params.organization = orgIdHint;
|
|
5914
|
+
}
|
|
5748
5915
|
url = this._authorizeUrl(__assign(__assign({}, params), { prompt: 'none', response_mode: 'web_message' }));
|
|
5749
5916
|
timeout = options.timeoutInSeconds || this.options.authorizeTimeoutInSeconds;
|
|
5750
5917
|
_a.label = 2;
|
|
5751
5918
|
case 2:
|
|
5752
5919
|
_a.trys.push([2, 5, , 6]);
|
|
5920
|
+
// When a browser is running in a Cross-Origin Isolated context, using iframes is not possible.
|
|
5921
|
+
// It doesn't throw an error but times out instead, so we should exit early and inform the user about the reason.
|
|
5922
|
+
// https://developer.mozilla.org/en-US/docs/Web/API/crossOriginIsolated
|
|
5923
|
+
if (window.crossOriginIsolated) {
|
|
5924
|
+
throw new GenericError('login_required', 'The application is running in a Cross-Origin Isolated context, silently retrieving a token without refresh token is not possible.');
|
|
5925
|
+
}
|
|
5753
5926
|
return [4 /*yield*/, runIframe(url, this.domainUrl, timeout)];
|
|
5754
5927
|
case 3:
|
|
5755
5928
|
codeResult = _a.sent();
|
|
5756
5929
|
if (stateIn !== codeResult.state) {
|
|
5757
5930
|
throw new Error('Invalid state');
|
|
5758
5931
|
}
|
|
5759
|
-
scope = options.scope, audience = options.audience,
|
|
5760
|
-
return [4 /*yield*/, oauthToken(__assign(__assign(__assign({}, this.customOptions), customOptions), { scope: scope,
|
|
5761
|
-
audience: audience, baseUrl: this.domainUrl, client_id: this.options.client_id, code_verifier: code_verifier, code: codeResult.code, grant_type: 'authorization_code', redirect_uri: params.redirect_uri, auth0Client: this.options.auth0Client }), this.worker)];
|
|
5932
|
+
scope = options.scope, audience = options.audience, customOptions = __rest(options, ["scope", "audience", "redirect_uri", "ignoreCache", "timeoutInSeconds"]);
|
|
5933
|
+
return [4 /*yield*/, oauthToken(__assign(__assign(__assign({}, this.customOptions), customOptions), { scope: scope, audience: audience, baseUrl: this.domainUrl, client_id: this.options.client_id, code_verifier: code_verifier, code: codeResult.code, grant_type: 'authorization_code', redirect_uri: params.redirect_uri, auth0Client: this.options.auth0Client, useFormData: this.options.useFormData }), this.worker)];
|
|
5762
5934
|
case 4:
|
|
5763
5935
|
tokenResult = _a.sent();
|
|
5764
5936
|
decodedToken = this._verifyIdToken(tokenResult.id_token, nonceIn);
|
|
5937
|
+
this._processOrgIdHint(decodedToken.claims.org_id);
|
|
5765
5938
|
return [2 /*return*/, __assign(__assign({}, tokenResult), { decodedToken: decodedToken, scope: params.scope, audience: params.audience || 'default' })];
|
|
5766
5939
|
case 5:
|
|
5767
5940
|
e_1 = _a.sent();
|
|
@@ -5797,15 +5970,14 @@
|
|
|
5797
5970
|
redirect_uri = options.redirect_uri ||
|
|
5798
5971
|
this.options.redirect_uri ||
|
|
5799
5972
|
window.location.origin;
|
|
5800
|
-
scope = options.scope, audience = options.audience,
|
|
5973
|
+
scope = options.scope, audience = options.audience, customOptions = __rest(options, ["scope", "audience", "ignoreCache", "timeoutInSeconds"]);
|
|
5801
5974
|
timeout = typeof options.timeoutInSeconds === 'number'
|
|
5802
5975
|
? options.timeoutInSeconds * 1000
|
|
5803
5976
|
: null;
|
|
5804
5977
|
_a.label = 4;
|
|
5805
5978
|
case 4:
|
|
5806
5979
|
_a.trys.push([4, 6, , 9]);
|
|
5807
|
-
return [4 /*yield*/, oauthToken(__assign(__assign(__assign(__assign(__assign({}, this.customOptions), customOptions), { audience: audience,
|
|
5808
|
-
scope: scope, baseUrl: this.domainUrl, client_id: this.options.client_id, grant_type: 'refresh_token', refresh_token: cache && cache.refresh_token, redirect_uri: redirect_uri }), (timeout && { timeout: timeout })), { auth0Client: this.options.auth0Client }), this.worker)];
|
|
5980
|
+
return [4 /*yield*/, oauthToken(__assign(__assign(__assign(__assign(__assign({}, this.customOptions), customOptions), { audience: audience, scope: scope, baseUrl: this.domainUrl, client_id: this.options.client_id, grant_type: 'refresh_token', refresh_token: cache && cache.refresh_token, redirect_uri: redirect_uri }), (timeout && { timeout: timeout })), { auth0Client: this.options.auth0Client, useFormData: this.options.useFormData }), this.worker)];
|
|
5809
5981
|
case 5:
|
|
5810
5982
|
tokenResult = _a.sent();
|
|
5811
5983
|
return [3 /*break*/, 9];
|
|
@@ -5860,7 +6032,8 @@
|
|
|
5860
6032
|
wrapper.GenericError = GenericError;
|
|
5861
6033
|
wrapper.AuthenticationError = AuthenticationError;
|
|
5862
6034
|
wrapper.TimeoutError = TimeoutError;
|
|
5863
|
-
wrapper.PopupTimeoutError = PopupTimeoutError;
|
|
6035
|
+
wrapper.PopupTimeoutError = PopupTimeoutError;
|
|
6036
|
+
wrapper.MfaRequiredError = MfaRequiredError;
|
|
5864
6037
|
|
|
5865
6038
|
return wrapper;
|
|
5866
6039
|
|