|
1 | 1 | /**
|
2 | 2 | * auth0-js v9.25.0
|
3 | 3 | * Author: Auth0
|
4 |
| - * Date: 2024-04-25 |
| 4 | + * Date: 2024-04-29 |
5 | 5 | * License: MIT
|
6 | 6 | */
|
7 | 7 |
|
|
504 | 504 | return shams();
|
505 | 505 | };
|
506 | 506 |
|
| 507 | + var test = { |
| 508 | + foo: {} |
| 509 | + }; |
| 510 | + |
| 511 | + var $Object = Object; |
| 512 | + |
| 513 | + var hasProto = function hasProto() { |
| 514 | + return { __proto__: test }.foo === test.foo && !({ __proto__: null } instanceof $Object); |
| 515 | + }; |
| 516 | + |
507 | 517 | /* eslint no-invalid-this: 1 */
|
508 | 518 |
|
509 | 519 | var ERROR_MESSAGE = 'Function.prototype.bind called on incompatible ';
|
510 |
| - var slice = Array.prototype.slice; |
511 | 520 | var toStr = Object.prototype.toString;
|
| 521 | + var max = Math.max; |
512 | 522 | var funcType = '[object Function]';
|
513 | 523 |
|
| 524 | + var concatty = function concatty(a, b) { |
| 525 | + var arr = []; |
| 526 | + |
| 527 | + for (var i = 0; i < a.length; i += 1) { |
| 528 | + arr[i] = a[i]; |
| 529 | + } |
| 530 | + for (var j = 0; j < b.length; j += 1) { |
| 531 | + arr[j + a.length] = b[j]; |
| 532 | + } |
| 533 | + |
| 534 | + return arr; |
| 535 | + }; |
| 536 | + |
| 537 | + var slicy = function slicy(arrLike, offset) { |
| 538 | + var arr = []; |
| 539 | + for (var i = offset || 0, j = 0; i < arrLike.length; i += 1, j += 1) { |
| 540 | + arr[j] = arrLike[i]; |
| 541 | + } |
| 542 | + return arr; |
| 543 | + }; |
| 544 | + |
| 545 | + var joiny = function (arr, joiner) { |
| 546 | + var str = ''; |
| 547 | + for (var i = 0; i < arr.length; i += 1) { |
| 548 | + str += arr[i]; |
| 549 | + if (i + 1 < arr.length) { |
| 550 | + str += joiner; |
| 551 | + } |
| 552 | + } |
| 553 | + return str; |
| 554 | + }; |
| 555 | + |
514 | 556 | var implementation = function bind(that) {
|
515 | 557 | var target = this;
|
516 |
| - if (typeof target !== 'function' || toStr.call(target) !== funcType) { |
| 558 | + if (typeof target !== 'function' || toStr.apply(target) !== funcType) { |
517 | 559 | throw new TypeError(ERROR_MESSAGE + target);
|
518 | 560 | }
|
519 |
| - var args = slice.call(arguments, 1); |
| 561 | + var args = slicy(arguments, 1); |
520 | 562 |
|
521 | 563 | var bound;
|
522 | 564 | var binder = function () {
|
523 | 565 | if (this instanceof bound) {
|
524 | 566 | var result = target.apply(
|
525 | 567 | this,
|
526 |
| - args.concat(slice.call(arguments)) |
| 568 | + concatty(args, arguments) |
527 | 569 | );
|
528 | 570 | if (Object(result) === result) {
|
529 | 571 | return result;
|
530 | 572 | }
|
531 | 573 | return this;
|
532 |
| - } else { |
533 |
| - return target.apply( |
534 |
| - that, |
535 |
| - args.concat(slice.call(arguments)) |
536 |
| - ); |
537 | 574 | }
|
| 575 | + return target.apply( |
| 576 | + that, |
| 577 | + concatty(args, arguments) |
| 578 | + ); |
| 579 | + |
538 | 580 | };
|
539 | 581 |
|
540 |
| - var boundLength = Math.max(0, target.length - args.length); |
| 582 | + var boundLength = max(0, target.length - args.length); |
541 | 583 | var boundArgs = [];
|
542 | 584 | for (var i = 0; i < boundLength; i++) {
|
543 |
| - boundArgs.push('$' + i); |
| 585 | + boundArgs[i] = '$' + i; |
544 | 586 | }
|
545 | 587 |
|
546 |
| - bound = Function('binder', 'return function (' + boundArgs.join(',') + '){ return binder.apply(this,arguments); }')(binder); |
| 588 | + bound = Function('binder', 'return function (' + joiny(boundArgs, ',') + '){ return binder.apply(this,arguments); }')(binder); |
547 | 589 |
|
548 | 590 | if (target.prototype) {
|
549 | 591 | var Empty = function Empty() {};
|
|
602 | 644 | : throwTypeError;
|
603 | 645 |
|
604 | 646 | var hasSymbols$1 = hasSymbols();
|
| 647 | + var hasProto$1 = hasProto(); |
605 | 648 |
|
606 |
| - var getProto = Object.getPrototypeOf || function (x) { return x.__proto__; }; // eslint-disable-line no-proto |
| 649 | + var getProto = Object.getPrototypeOf || ( |
| 650 | + hasProto$1 |
| 651 | + ? function (x) { return x.__proto__; } // eslint-disable-line no-proto |
| 652 | + : null |
| 653 | + ); |
607 | 654 |
|
608 | 655 | var needsEval = {};
|
609 | 656 |
|
610 |
| - var TypedArray = typeof Uint8Array === 'undefined' ? undefined$1 : getProto(Uint8Array); |
| 657 | + var TypedArray = typeof Uint8Array === 'undefined' || !getProto ? undefined$1 : getProto(Uint8Array); |
611 | 658 |
|
612 | 659 | var INTRINSICS = {
|
613 | 660 | '%AggregateError%': typeof AggregateError === 'undefined' ? undefined$1 : AggregateError,
|
614 | 661 | '%Array%': Array,
|
615 | 662 | '%ArrayBuffer%': typeof ArrayBuffer === 'undefined' ? undefined$1 : ArrayBuffer,
|
616 |
| - '%ArrayIteratorPrototype%': hasSymbols$1 ? getProto([][Symbol.iterator]()) : undefined$1, |
| 663 | + '%ArrayIteratorPrototype%': hasSymbols$1 && getProto ? getProto([][Symbol.iterator]()) : undefined$1, |
617 | 664 | '%AsyncFromSyncIteratorPrototype%': undefined$1,
|
618 | 665 | '%AsyncFunction%': needsEval,
|
619 | 666 | '%AsyncGenerator%': needsEval,
|
|
643 | 690 | '%Int32Array%': typeof Int32Array === 'undefined' ? undefined$1 : Int32Array,
|
644 | 691 | '%isFinite%': isFinite,
|
645 | 692 | '%isNaN%': isNaN,
|
646 |
| - '%IteratorPrototype%': hasSymbols$1 ? getProto(getProto([][Symbol.iterator]())) : undefined$1, |
| 693 | + '%IteratorPrototype%': hasSymbols$1 && getProto ? getProto(getProto([][Symbol.iterator]())) : undefined$1, |
647 | 694 | '%JSON%': typeof JSON === 'object' ? JSON : undefined$1,
|
648 | 695 | '%Map%': typeof Map === 'undefined' ? undefined$1 : Map,
|
649 |
| - '%MapIteratorPrototype%': typeof Map === 'undefined' || !hasSymbols$1 ? undefined$1 : getProto(new Map()[Symbol.iterator]()), |
| 696 | + '%MapIteratorPrototype%': typeof Map === 'undefined' || !hasSymbols$1 || !getProto ? undefined$1 : getProto(new Map()[Symbol.iterator]()), |
650 | 697 | '%Math%': Math,
|
651 | 698 | '%Number%': Number,
|
652 | 699 | '%Object%': Object,
|
|
659 | 706 | '%Reflect%': typeof Reflect === 'undefined' ? undefined$1 : Reflect,
|
660 | 707 | '%RegExp%': RegExp,
|
661 | 708 | '%Set%': typeof Set === 'undefined' ? undefined$1 : Set,
|
662 |
| - '%SetIteratorPrototype%': typeof Set === 'undefined' || !hasSymbols$1 ? undefined$1 : getProto(new Set()[Symbol.iterator]()), |
| 709 | + '%SetIteratorPrototype%': typeof Set === 'undefined' || !hasSymbols$1 || !getProto ? undefined$1 : getProto(new Set()[Symbol.iterator]()), |
663 | 710 | '%SharedArrayBuffer%': typeof SharedArrayBuffer === 'undefined' ? undefined$1 : SharedArrayBuffer,
|
664 | 711 | '%String%': String,
|
665 |
| - '%StringIteratorPrototype%': hasSymbols$1 ? getProto(''[Symbol.iterator]()) : undefined$1, |
| 712 | + '%StringIteratorPrototype%': hasSymbols$1 && getProto ? getProto(''[Symbol.iterator]()) : undefined$1, |
666 | 713 | '%Symbol%': hasSymbols$1 ? Symbol : undefined$1,
|
667 | 714 | '%SyntaxError%': $SyntaxError,
|
668 | 715 | '%ThrowTypeError%': ThrowTypeError,
|
|
678 | 725 | '%WeakSet%': typeof WeakSet === 'undefined' ? undefined$1 : WeakSet
|
679 | 726 | };
|
680 | 727 |
|
681 |
| - try { |
682 |
| - null.error; // eslint-disable-line no-unused-expressions |
683 |
| - } catch (e) { |
684 |
| - // https://github.com/tc39/proposal-shadowrealm/pull/384#issuecomment-1364264229 |
685 |
| - var errorProto = getProto(getProto(e)); |
686 |
| - INTRINSICS['%Error.prototype%'] = errorProto; |
| 728 | + if (getProto) { |
| 729 | + try { |
| 730 | + null.error; // eslint-disable-line no-unused-expressions |
| 731 | + } catch (e) { |
| 732 | + // https://github.com/tc39/proposal-shadowrealm/pull/384#issuecomment-1364264229 |
| 733 | + var errorProto = getProto(getProto(e)); |
| 734 | + INTRINSICS['%Error.prototype%'] = errorProto; |
| 735 | + } |
687 | 736 | }
|
688 | 737 |
|
689 | 738 | var doEval = function doEval(name) {
|
|
701 | 750 | }
|
702 | 751 | } else if (name === '%AsyncIteratorPrototype%') {
|
703 | 752 | var gen = doEval('%AsyncGenerator%');
|
704 |
| - if (gen) { |
| 753 | + if (gen && getProto) { |
705 | 754 | value = getProto(gen.prototype);
|
706 | 755 | }
|
707 | 756 | }
|
|
1894 | 1943 | };
|
1895 | 1944 |
|
1896 | 1945 | var isArray$3 = Array.isArray;
|
1897 |
| - var split = String.prototype.split; |
1898 | 1946 | var push = Array.prototype.push;
|
1899 | 1947 | var pushToArray = function (arr, valueOrArray) {
|
1900 | 1948 | push.apply(arr, isArray$3(valueOrArray) ? valueOrArray : [valueOrArray]);
|
|
1996 | 2044 | if (isNonNullishPrimitive(obj) || utils.isBuffer(obj)) {
|
1997 | 2045 | if (encoder) {
|
1998 | 2046 | var keyValue = encodeValuesOnly ? prefix : encoder(prefix, defaults.encoder, charset, 'key', format);
|
1999 |
| - if (generateArrayPrefix === 'comma' && encodeValuesOnly) { |
2000 |
| - var valuesArray = split.call(String(obj), ','); |
2001 |
| - var valuesJoined = ''; |
2002 |
| - for (var i = 0; i < valuesArray.length; ++i) { |
2003 |
| - valuesJoined += (i === 0 ? '' : ',') + formatter(encoder(valuesArray[i], defaults.encoder, charset, 'value', format)); |
2004 |
| - } |
2005 |
| - return [formatter(keyValue) + (commaRoundTrip && isArray$3(obj) && valuesArray.length === 1 ? '[]' : '') + '=' + valuesJoined]; |
2006 |
| - } |
2007 | 2047 | return [formatter(keyValue) + '=' + formatter(encoder(obj, defaults.encoder, charset, 'value', format))];
|
2008 | 2048 | }
|
2009 | 2049 | return [formatter(prefix) + '=' + formatter(String(obj))];
|
|
2018 | 2058 | var objKeys;
|
2019 | 2059 | if (generateArrayPrefix === 'comma' && isArray$3(obj)) {
|
2020 | 2060 | // we need to join elements in
|
| 2061 | + if (encodeValuesOnly && encoder) { |
| 2062 | + obj = utils.maybeMap(obj, encoder); |
| 2063 | + } |
2021 | 2064 | objKeys = [{ value: obj.length > 0 ? obj.join(',') || null : void undefined }];
|
2022 | 2065 | } else if (isArray$3(filter)) {
|
2023 | 2066 | objKeys = filter;
|
|
2050 | 2093 | commaRoundTrip,
|
2051 | 2094 | strictNullHandling,
|
2052 | 2095 | skipNulls,
|
2053 |
| - encoder, |
| 2096 | + generateArrayPrefix === 'comma' && encodeValuesOnly && isArray$3(obj) ? null : encoder, |
2054 | 2097 | filter,
|
2055 | 2098 | sort,
|
2056 | 2099 | allowDots,
|
|
2247 | 2290 | var charsetSentinel = 'utf8=%E2%9C%93'; // encodeURIComponent('✓')
|
2248 | 2291 |
|
2249 | 2292 | var parseValues = function parseQueryStringValues(str, options) {
|
2250 |
| - var obj = {}; |
| 2293 | + var obj = { __proto__: null }; |
| 2294 | + |
2251 | 2295 | var cleanStr = options.ignoreQueryPrefix ? str.replace(/^\?/, '') : str;
|
2252 | 2296 | var limit = options.parameterLimit === Infinity ? undefined : options.parameterLimit;
|
2253 | 2297 | var parts = cleanStr.split(options.delimiter, limit);
|
|
0 commit comments