Updated bower dependencies for client.

This commit is contained in:
baldo 2022-08-02 15:24:19 +02:00
commit fe5b68e1c4
136 changed files with 7596 additions and 9284 deletions

View file

@ -1,20 +1,20 @@
/*!
* https://github.com/es-shims/es5-shim
* @license es5-shim Copyright 2009-2015 by contributors, MIT License
* @license es5-shim Copyright 2009-2020 by contributors, MIT License
* see https://github.com/es-shims/es5-shim/blob/master/LICENSE
*/
// vim: ts=4 sts=4 sw=4 expandtab
// Add semicolon to prevent IIFE from being passed as argument to concatenated code.
;
; // eslint-disable-line no-extra-semi
// UMD (Universal Module Definition)
// see https://github.com/umdjs/umd/blob/master/templates/returnExports.js
(function (root, factory) {
'use strict';
/* global define, exports, module */
/* global define */
if (typeof define === 'function' && define.amd) {
// AMD. Register as an anonymous module.
define(factory);
@ -25,16 +25,16 @@
module.exports = factory();
} else {
// Browser globals (root is window)
root.returnExports = factory();
root.returnExports = factory(); // eslint-disable-line no-param-reassign
}
}(this, function () {
/**
* Brings an environment as close to ECMAScript 5 compliance
* as is possible with the facilities of erstwhile engines.
*
* Annotated ES5: http://es5.github.com/ (specific links below)
* ES5 Spec: http://www.ecma-international.org/publications/files/ECMA-ST/Ecma-262.pdf
* Required reading: http://javascriptweblog.wordpress.com/2011/12/05/extending-javascript-natives/
* Annotated ES5: https://es5.github.io/ (specific links below)
* ES5 Spec: https://www.ecma-international.org/wp-content/uploads/ECMA-262_5.1_edition_june_2011.pdf
* Required reading: https://javascriptweblog.wordpress.com/2011/12/05/extending-javascript-natives/
*/
// Shortcut to an often accessed properties, in order to avoid multiple
@ -60,11 +60,19 @@
var apply = FunctionPrototype.apply;
var max = Math.max;
var min = Math.min;
var floor = Math.floor;
var abs = Math.abs;
var pow = Math.pow;
var round = Math.round;
var log = Math.log;
var LOG10E = Math.LOG10E;
var log10 = Math.log10 || function log10(value) {
return log(value) * LOG10E;
};
// Having a toString local variable name breaks in Opera so use to_string.
var to_string = ObjectPrototype.toString;
/* global Symbol */
/* eslint-disable one-var-declaration-per-line, no-redeclare, max-statements-per-line */
var hasToStringTag = typeof Symbol === 'function' && typeof Symbol.toStringTag === 'symbol';
var isCallable; /* inlined from https://npmjs.com/is-callable */ var fnToStr = Function.prototype.toString, constructorRegex = /^\s*class /, isES6ClassFn = function isES6ClassFn(value) { try { var fnStr = fnToStr.call(value); var singleStripped = fnStr.replace(/\/\/.*\n/g, ''); var multiStripped = singleStripped.replace(/\/\*[.\s\S]*\*\//g, ''); var spaceStripped = multiStripped.replace(/\n/mg, ' ').replace(/ {2}/g, ' '); return constructorRegex.test(spaceStripped); } catch (e) { return false; /* not a function */ } }, tryFunctionObject = function tryFunctionObject(value) { try { if (isES6ClassFn(value)) { return false; } fnToStr.call(value); return true; } catch (e) { return false; } }, fnClass = '[object Function]', genClass = '[object GeneratorFunction]', isCallable = function isCallable(value) { if (!value) { return false; } if (typeof value !== 'function' && typeof value !== 'object') { return false; } if (hasToStringTag) { return tryFunctionObject(value); } if (isES6ClassFn(value)) { return false; } var strClass = to_string.call(value); return strClass === fnClass || strClass === genClass; };
@ -73,14 +81,13 @@
var isString; /* inlined from https://npmjs.com/is-string */ var strValue = String.prototype.valueOf, tryStringObject = function tryStringObject(value) { try { strValue.call(value); return true; } catch (e) { return false; } }, stringClass = '[object String]'; isString = function isString(value) { if (typeof value === 'string') { return true; } if (typeof value !== 'object') { return false; } return hasToStringTag ? tryStringObject(value) : to_string.call(value) === stringClass; };
/* eslint-enable one-var-declaration-per-line, no-redeclare, max-statements-per-line */
/* inlined from http://npmjs.com/define-properties */
/* inlined from https://npmjs.com/define-properties */
var supportsDescriptors = $Object.defineProperty && (function () {
try {
var obj = {};
$Object.defineProperty(obj, 'x', { enumerable: false, value: obj });
for (var _ in obj) { // jscs:ignore disallowUnusedVariables
return false;
}
// eslint-disable-next-line no-unreachable-loop, max-statements-per-line
for (var _ in obj) { return false; } // jscs:ignore disallowUnusedVariables
return obj.x === obj;
} catch (e) { /* this is ES3 */
return false;
@ -107,7 +114,7 @@
if (!forceAssign && (name in object)) {
return;
}
object[name] = method;
object[name] = method; // eslint-disable-line no-param-reassign
};
}
return function defineProperties(object, map, forceAssign) {
@ -119,6 +126,38 @@
};
}(ObjectPrototype.hasOwnProperty));
// this is needed in Chrome 15 (probably earlier) - 36
// https://bugs.chromium.org/p/v8/issues/detail?id=3334
if ($Object.defineProperty && supportsDescriptors) {
var F = function () {};
var toStringSentinel = {};
var sentinel = { toString: toStringSentinel };
$Object.defineProperty(F, 'prototype', { value: sentinel, writable: false });
if ((new F()).toString !== toStringSentinel) {
var $dP = $Object.defineProperty;
var $gOPD = $Object.getOwnPropertyDescriptor;
defineProperties($Object, {
defineProperty: function defineProperty(o, k, d) {
var key = $String(k);
if (typeof o === 'function' && key === 'prototype') {
var desc = $gOPD(o, key);
if (desc.writable && !d.writable && 'value' in d) {
try {
o[key] = d.value; // eslint-disable-line no-param-reassign
} catch (e) { /**/ }
}
return $dP(o, key, {
configurable: 'configurable' in d ? d.configurable : desc.configurable,
enumerable: 'enumerable' in d ? d.enumerable : desc.enumerable,
writable: d.writable
});
}
return $dP(o, key, d);
}
}, true);
}
}
//
// Util
// ======
@ -136,7 +175,7 @@
var ES = {
// ES5 9.4
// http://es5.github.com/#x9.4
// https://es5.github.io/#x9.4
// http://jsperf.com/to-integer
/* replaceable with https://npmjs.com/package/es-abstract ES5.ToInteger */
ToInteger: function ToInteger(num) {
@ -144,7 +183,7 @@
if (isActualNaN(n)) {
n = 0;
} else if (n !== 0 && n !== (1 / 0) && n !== -(1 / 0)) {
n = (n > 0 || -1) * Math.floor(Math.abs(n));
n = (n > 0 || -1) * floor(abs(n));
}
return n;
},
@ -173,7 +212,7 @@
},
// ES5 9.9
// http://es5.github.com/#x9.9
// https://es5.github.io/#x9.9
/* replaceable with https://npmjs.com/package/es-abstract ES5.ToObject */
ToObject: function (o) {
if (o == null) { // this matches both null and undefined
@ -194,7 +233,7 @@
//
// ES-5 15.3.4.5
// http://es5.github.com/#x15.3.4.5
// https://es5.github.io/#x15.3.4.5
var Empty = function Empty() {};
@ -249,33 +288,31 @@
}
return this;
} else {
// 15.3.4.5.1 [[Call]]
// When the [[Call]] internal method of a function object, F,
// which was created using the bind function is called with a
// this value and a list of arguments ExtraArgs, the following
// steps are taken:
// 1. Let boundArgs be the value of F's [[BoundArgs]] internal
// property.
// 2. Let boundThis be the value of F's [[BoundThis]] internal
// property.
// 3. Let target be the value of F's [[TargetFunction]] internal
// property.
// 4. Let args be a new list containing the same values as the
// list boundArgs in the same order followed by the same
// values as the list ExtraArgs in the same order.
// 5. Return the result of calling the [[Call]] internal method
// of target providing boundThis as the this value and
// providing args as the arguments.
// equiv: target.call(this, ...boundArgs, ...args)
return apply.call(
target,
that,
array_concat.call(args, array_slice.call(arguments))
);
}
// 15.3.4.5.1 [[Call]]
// When the [[Call]] internal method of a function object, F,
// which was created using the bind function is called with a
// this value and a list of arguments ExtraArgs, the following
// steps are taken:
// 1. Let boundArgs be the value of F's [[BoundArgs]] internal
// property.
// 2. Let boundThis be the value of F's [[BoundThis]] internal
// property.
// 3. Let target be the value of F's [[TargetFunction]] internal
// property.
// 4. Let args be a new list containing the same values as the
// list boundArgs in the same order followed by the same
// values as the list ExtraArgs in the same order.
// 5. Return the result of calling the [[Call]] internal method
// of target providing boundThis as the this value and
// providing args as the arguments.
// equiv: target.call(this, ...boundArgs, ...args)
return apply.call(
target,
that,
array_concat.call(args, array_slice.call(arguments))
);
};
@ -377,7 +414,7 @@
};
// ES5 15.4.4.12
// http://es5.github.com/#x15.4.4.13
// https://es5.github.io/#x15.4.4.13
// Return len+argCount.
// [bugfix, ielt8]
// IE < 8 bug: [].unshift(0) === undefined but should be "1"
@ -390,7 +427,7 @@
}, hasUnshiftReturnValueBug);
// ES5 15.4.3.2
// http://es5.github.com/#x15.4.3.2
// https://es5.github.io/#x15.4.3.2
// https://developer.mozilla.org/en/JavaScript/Reference/Global_Objects/Array/isArray
defineProperties($Array, { isArray: isArray });
@ -407,7 +444,7 @@
// expressions.
// ES5 15.4.4.18
// http://es5.github.com/#x15.4.4.18
// https://es5.github.io/#x15.4.4.18
// https://developer.mozilla.org/en/JavaScript/Reference/Global_Objects/array/forEach
// Check failure of by-index access of string characters (IE < 9)
@ -471,7 +508,7 @@
}, !properlyBoxesContext(ArrayPrototype.forEach));
// ES5 15.4.4.19
// http://es5.github.com/#x15.4.4.19
// https://es5.github.io/#x15.4.4.19
// https://developer.mozilla.org/en/Core_JavaScript_1.5_Reference/Objects/Array/map
defineProperties(ArrayPrototype, {
map: function map(callbackfn/*, thisArg*/) {
@ -503,7 +540,7 @@
}, !properlyBoxesContext(ArrayPrototype.map));
// ES5 15.4.4.20
// http://es5.github.com/#x15.4.4.20
// https://es5.github.io/#x15.4.4.20
// https://developer.mozilla.org/en/Core_JavaScript_1.5_Reference/Objects/Array/filter
defineProperties(ArrayPrototype, {
filter: function filter(callbackfn/*, thisArg*/) {
@ -535,7 +572,7 @@
}, !properlyBoxesContext(ArrayPrototype.filter));
// ES5 15.4.4.16
// http://es5.github.com/#x15.4.4.16
// https://es5.github.io/#x15.4.4.16
// https://developer.mozilla.org/en/JavaScript/Reference/Global_Objects/Array/every
defineProperties(ArrayPrototype, {
every: function every(callbackfn/*, thisArg*/) {
@ -562,7 +599,7 @@
}, !properlyBoxesContext(ArrayPrototype.every));
// ES5 15.4.4.17
// http://es5.github.com/#x15.4.4.17
// https://es5.github.io/#x15.4.4.17
// https://developer.mozilla.org/en/JavaScript/Reference/Global_Objects/Array/some
defineProperties(ArrayPrototype, {
some: function some(callbackfn/*, thisArg */) {
@ -589,7 +626,7 @@
}, !properlyBoxesContext(ArrayPrototype.some));
// ES5 15.4.4.21
// http://es5.github.com/#x15.4.4.21
// https://es5.github.io/#x15.4.4.21
// https://developer.mozilla.org/en/Core_JavaScript_1.5_Reference/Objects/Array/reduce
var reduceCoercesToObject = false;
if (ArrayPrototype.reduce) {
@ -642,7 +679,7 @@
}, !reduceCoercesToObject);
// ES5 15.4.4.22
// http://es5.github.com/#x15.4.4.22
// https://es5.github.io/#x15.4.4.22
// https://developer.mozilla.org/en/Core_JavaScript_1.5_Reference/Objects/Array/reduceRight
var reduceRightCoercesToObject = false;
if (ArrayPrototype.reduceRight) {
@ -699,7 +736,7 @@
}, !reduceRightCoercesToObject);
// ES5 15.4.4.14
// http://es5.github.com/#x15.4.4.14
// https://es5.github.io/#x15.4.4.14
// https://developer.mozilla.org/en/JavaScript/Reference/Global_Objects/Array/indexOf
var hasFirefox2IndexOfBug = ArrayPrototype.indexOf && [0, 1].indexOf(1, 2) !== -1;
defineProperties(ArrayPrototype, {
@ -728,7 +765,7 @@
}, hasFirefox2IndexOfBug);
// ES5 15.4.4.15
// http://es5.github.com/#x15.4.4.15
// https://es5.github.io/#x15.4.4.15
// https://developer.mozilla.org/en/JavaScript/Reference/Global_Objects/Array/lastIndexOf
var hasFirefox2LastIndexOfBug = ArrayPrototype.lastIndexOf && [0, 1].lastIndexOf(0, -3) !== -1;
defineProperties(ArrayPrototype, {
@ -744,7 +781,7 @@
i = min(i, ES.ToInteger(arguments[1]));
}
// handle negative indices
i = i >= 0 ? i : length - Math.abs(i);
i = i >= 0 ? i : length - abs(i);
for (; i >= 0; i--) {
if (i in self && searchElement === self[i]) {
return i;
@ -755,7 +792,7 @@
}, hasFirefox2LastIndexOfBug);
// ES5 15.4.4.12
// http://es5.github.com/#x15.4.4.12
// https://es5.github.io/#x15.4.4.12
var spliceNoopReturnsEmptyArray = (function () {
var a = [1, 2];
var result = a.splice();
@ -766,9 +803,9 @@
splice: function splice(start, deleteCount) {
if (arguments.length === 0) {
return [];
} else {
return array_splice.apply(this, arguments);
}
return array_splice.apply(this, arguments);
}
}, !spliceNoopReturnsEmptyArray);
@ -777,6 +814,7 @@
ArrayPrototype.splice.call(obj, 0, 0, 1);
return obj.length === 1;
}());
var hasES6Defaults = [0, 1, 2].splice(0).length === 3;
defineProperties(ArrayPrototype, {
splice: function splice(start, deleteCount) {
if (arguments.length === 0) {
@ -794,7 +832,7 @@
}
return array_splice.apply(this, args);
}
}, !spliceWorksWithEmptyObject);
}, !spliceWorksWithEmptyObject || !hasES6Defaults);
var spliceWorksWithLargeSparseArrays = (function () {
// Per https://github.com/es-shims/es5-shim/issues/295
// Safari 7/8 breaks with sparse arrays of size 1e5 or greater
@ -822,7 +860,11 @@
var len = ES.ToUint32(O.length);
var relativeStart = ES.ToInteger(start);
var actualStart = relativeStart < 0 ? max((len + relativeStart), 0) : min(relativeStart, len);
var actualDeleteCount = min(max(ES.ToInteger(deleteCount), 0), len - actualStart);
var actualDeleteCount = arguments.length === 0
? 0
: arguments.length === 1
? len - actualStart
: min(max(ES.ToInteger(deleteCount), 0), len - actualStart);
var k = 0;
var from;
@ -941,7 +983,7 @@
defineProperties(ArrayPrototype, { push: pushShim }, pushUndefinedIsWeird);
// ES5 15.2.3.14
// http://es5.github.io/#x15.4.4.10
// https://es5.github.io/#x15.4.4.10
// Fix boxed string bug
defineProperties(ArrayPrototype, {
slice: function (start, end) {
@ -996,9 +1038,10 @@
//
// ES5 15.2.3.14
// http://es5.github.com/#x15.2.3.14
// https://es5.github.io/#x15.2.3.14
// http://whattheheadsaid.com/2010/10/a-safer-object-keys-compatibility-implementation
// https://web.archive.org/web/20140727042234/http://whattheheadsaid.com/2010/10/a-safer-object-keys-compatibility-implementation
// eslint-disable-next-line quote-props
var hasDontEnumBug = !isEnum({ 'toString': null }, 'toString'); // jscs:ignore disallowQuotedKeysInObjects
var hasProtoEnumBug = isEnum(function () {}, 'prototype');
var hasStringEnumBug = !owns('x', '0');
@ -1141,9 +1184,9 @@
keys: function keys(object) {
if (isArguments(object)) {
return originalKeys(arraySlice(object));
} else {
return originalKeys(object);
}
return originalKeys(object);
}
}, !keysWorksWithArguments || keysHasArgumentsLengthBug);
@ -1314,8 +1357,8 @@
var minute = this.getMinutes();
var second = this.getSeconds();
var timezoneOffset = this.getTimezoneOffset();
var hoursOffset = Math.floor(Math.abs(timezoneOffset) / 60);
var minutesOffset = Math.floor(Math.abs(timezoneOffset) % 60);
var hoursOffset = floor(abs(timezoneOffset) / 60);
var minutesOffset = floor(abs(timezoneOffset) % 60);
return dayName[day] + ' '
+ monthName[month] + ' '
+ (date < 10 ? '0' + date : date) + ' '
@ -1337,7 +1380,7 @@
}
// ES5 15.9.5.43
// http://es5.github.com/#x15.9.5.43
// https://es5.github.io/#x15.9.5.43
// This function returns a String value represent the instance in time
// represented by this Date object. The format of the String is the Date Time
// string format defined in 15.9.1.15. All fields are present in the String.
@ -1361,7 +1404,7 @@
var month = originalGetUTCMonth(this);
// see https://github.com/es-shims/es5-shim/issues/111
year += Math.floor(month / 12);
year += floor(month / 12);
month = ((month % 12) + 12) % 12;
// the date time string format is specified in 15.9.1.15.
@ -1374,7 +1417,7 @@
];
year = (
(year < 0 ? '-' : (year > 9999 ? '+' : ''))
+ strSlice('00000' + Math.abs(year), (0 <= year && year <= 9999) ? -4 : -6)
+ strSlice('00000' + abs(year), (0 <= year && year <= 9999) ? -4 : -6)
);
for (var i = 0; i < result.length; ++i) {
@ -1391,7 +1434,7 @@
}, hasNegativeDateBug || hasSafari51DateBug);
// ES5 15.9.5.44
// http://es5.github.com/#x15.9.5.44
// https://es5.github.io/#x15.9.5.44
// This function provides a String representation of a Date object for use by
// JSON.stringify (15.12.3).
var dateToJSONIsSupported = (function () {
@ -1443,17 +1486,16 @@
}
// ES5 15.9.4.2
// http://es5.github.com/#x15.9.4.2
// https://es5.github.io/#x15.9.4.2
// based on work shared by Daniel Friesen (dantman)
// http://gist.github.com/303249
// https://gist.github.com/303249
var supportsExtendedYears = Date.parse('+033658-09-27T01:46:40.000Z') === 1e15;
var acceptsInvalidDates = !isNaN(Date.parse('2012-04-04T24:00:00.500Z')) || !isNaN(Date.parse('2012-11-31T23:59:59.000Z')) || !isNaN(Date.parse('2012-12-31T23:59:60.000Z'));
var doesNotParseY2KNewYear = isNaN(Date.parse('2000-01-01T00:00:00.000Z'));
if (doesNotParseY2KNewYear || acceptsInvalidDates || !supportsExtendedYears) {
// XXX global assignment won't work in embeddings that use
// an alternate object for the context.
/* global Date: true */
var maxSafeUnsigned32Bit = Math.pow(2, 31) - 1;
var maxSafeUnsigned32Bit = pow(2, 31) - 1;
var hasSafariSignedIntBug = isActualNaN(new Date(1970, 0, 1, 0, 0, 0, maxSafeUnsigned32Bit + 1).getTime());
// eslint-disable-next-line no-implicit-globals, no-global-assign
Date = (function (NativeDate) {
@ -1466,14 +1508,16 @@
var millis = ms;
if (hasSafariSignedIntBug && length >= 7 && ms > maxSafeUnsigned32Bit) {
// work around a Safari 8/9 bug where it treats the seconds as signed
var msToShift = Math.floor(ms / maxSafeUnsigned32Bit) * maxSafeUnsigned32Bit;
var sToShift = Math.floor(msToShift / 1e3);
var msToShift = floor(ms / maxSafeUnsigned32Bit) * maxSafeUnsigned32Bit;
var sToShift = floor(msToShift / 1e3);
seconds += sToShift;
millis -= sToShift * 1e3;
}
date = length === 1 && $String(Y) === Y // isString(Y)
var parsed = DateShim.parse(Y);
var hasNegTimestampParseBug = isNaN(parsed);
date = length === 1 && $String(Y) === Y && !hasNegTimestampParseBug // isString(Y)
// We explicitly pass it through parse:
? new NativeDate(DateShim.parse(Y))
? new NativeDate(parsed)
// We have to manually make calls depending on argument
// length here
: length >= 7 ? new NativeDate(Y, M, D, h, m, seconds, millis)
@ -1522,10 +1566,10 @@
var t = month > 1 ? 1 : 0;
return (
months[month]
+ Math.floor((year - 1969 + t) / 4)
- Math.floor((year - 1901 + t) / 100)
+ Math.floor((year - 1601 + t) / 400)
+ (365 * (year - 1970))
+ floor((year - 1969 + t) / 4)
- floor((year - 1901 + t) / 100)
+ floor((year - 1601 + t) / 400)
+ (365 * (year - 1970))
);
};
@ -1534,8 +1578,8 @@
var ms = t;
if (hasSafariSignedIntBug && ms > maxSafeUnsigned32Bit) {
// work around a Safari 8/9 bug where it treats the seconds as signed
var msToShift = Math.floor(ms / maxSafeUnsigned32Bit) * maxSafeUnsigned32Bit;
var sToShift = Math.floor(msToShift / 1e3);
var msToShift = floor(ms / maxSafeUnsigned32Bit) * maxSafeUnsigned32Bit;
var sToShift = floor(msToShift / 1e3);
s += sToShift;
ms -= sToShift * 1e3;
}
@ -1570,7 +1614,7 @@
hour = $Number(match[4] || 0),
minute = $Number(match[5] || 0),
second = $Number(match[6] || 0),
millisecond = Math.floor($Number(match[7] || 0) * 1000),
millisecond = floor($Number(match[7] || 0) * 1000),
// When time zone is missed, local offset should be used
// (ES 5.1 bug)
// see https://bugs.ecmascript.org/show_bug.cgi?id=112
@ -1612,11 +1656,10 @@
return DateShim;
}(Date));
/* global Date: false */
}
// ES5 15.9.4.4
// http://es5.github.com/#x15.9.4.4
// https://es5.github.io/#x15.9.4.4
if (!Date.now) {
Date.now = function now() {
return new Date().getTime();
@ -1629,7 +1672,7 @@
//
// ES5.1 15.7.4.5
// http://es5.github.com/#x15.7.4.5
// https://es5.github.io/#x15.7.4.5
var hasToFixedBugs = NumberPrototype.toFixed && (
(0.00008).toFixed(3) !== '0.000'
|| (0.9).toFixed(0) !== '1'
@ -1647,7 +1690,7 @@
while (++i < toFixedHelpers.size) {
c2 += n * toFixedHelpers.data[i];
toFixedHelpers.data[i] = c2 % toFixedHelpers.base;
c2 = Math.floor(c2 / toFixedHelpers.base);
c2 = floor(c2 / toFixedHelpers.base);
}
},
divide: function divide(n) {
@ -1655,7 +1698,7 @@
var c = 0;
while (--i >= 0) {
c += toFixedHelpers.data[i];
toFixedHelpers.data[i] = Math.floor(c / n);
toFixedHelpers.data[i] = floor(c / n);
c = (c % n) * toFixedHelpers.base;
}
},
@ -1697,7 +1740,7 @@
// Test for NaN and round fractionDigits down
f = $Number(fractionDigits);
f = isActualNaN(f) ? 0 : Math.floor(f);
f = isActualNaN(f) ? 0 : floor(f);
if (f < 0 || f > 20) {
throw new RangeError('Number.toFixed called with invalid number of decimals');
@ -1728,7 +1771,7 @@
// -70 < log2(x) < 70
e = toFixedHelpers.log(x * toFixedHelpers.pow(2, 69, 1)) - 69;
z = (e < 0 ? x * toFixedHelpers.pow(2, -e, 1) : x / toFixedHelpers.pow(2, e, 1));
z *= 0x10000000000000; // Math.pow(2, 52);
z *= 0x10000000000000; // pow(2, 52);
e = 52 - e;
// -18 < e < 122
@ -1777,6 +1820,140 @@
};
defineProperties(NumberPrototype, { toFixed: toFixedShim }, hasToFixedBugs);
var hasToExponentialRoundingBug = (function () {
try {
return (-6.9e-11).toExponential(4) !== '-6.9000e-11';
} catch (e) {
return false;
}
}());
var toExponentialAllowsInfiniteDigits = (function () {
try {
(1).toExponential(Infinity);
(1).toExponential(-Infinity);
return true;
} catch (e) {
return false;
}
}());
var originalToExponential = call.bind(NumberPrototype.toExponential);
var numberToString = call.bind(NumberPrototype.toString);
var numberValueOf = call.bind(NumberPrototype.valueOf);
defineProperties(NumberPrototype, {
toExponential: function toExponential(fractionDigits) {
// 1: Let x be this Number value.
var x = numberValueOf(this);
if (typeof fractionDigits === 'undefined') {
return originalToExponential(x);
}
var f = ES.ToInteger(fractionDigits);
if (isActualNaN(x)) {
return 'NaN';
}
if (f < 0 || f > 20) {
if (!isFinite(f)) {
// IE 6 doesn't throw in the native one
throw new RangeError('toExponential() argument must be between 0 and 20');
}
// this will probably have thrown already
return originalToExponential(x, f);
}
// only cases left are a finite receiver + in-range fractionDigits
// implementation adapted from https://gist.github.com/SheetJSDev/1100ad56b9f856c95299ed0e068eea08
// 4: Let s be the empty string
var s = '';
// 5: If x < 0
if (x < 0) {
s = '-';
x = -x;
}
// 6: If x = +Infinity
if (x === Infinity) {
return s + 'Infinity';
}
// 7: If fractionDigits is not undefined and (f < 0 or f > 20), throw a RangeError exception.
if (typeof fractionDigits !== 'undefined' && (f < 0 || f > 20)) {
throw new RangeError('Fraction digits ' + fractionDigits + ' out of range');
}
var m = '';
var e = 0;
var c = '';
var d = '';
// 8: If x = 0 then
if (x === 0) {
e = 0;
f = 0;
m = '0';
} else { // 9: Else, x != 0
var L = log10(x);
e = floor(L); // 10 ** e <= x and x < 10 ** (e+1)
var n = 0;
if (typeof fractionDigits !== 'undefined') { // eslint-disable-line no-negated-condition
var w = pow(10, e - f); // x / 10 ** (f+1) < w and w <= x / 10 ** f
n = round(x / w); // 10 ** f <= n and n < 10 ** (f+1)
if (2 * x >= (((2 * n) + 1) * w)) {
n += 1; // pick larger value
}
if (n >= pow(10, f + 1)) { // 10e-1 = 1e0
n /= 10;
e += 1;
}
} else {
f = 16; // start from Math.ceil(Math.log10(Number.MAX_SAFE_INTEGER)) and loop down
var guess_n = round(pow(10, L - e + f));
var target_f = f;
while (f-- > 0) {
guess_n = round(pow(10, L - e + f));
if (
abs((guess_n * pow(10, e - f)) - x)
<= abs((n * pow(10, e - target_f)) - x)
) {
target_f = f;
n = guess_n;
}
}
}
m = numberToString(n, 10);
if (typeof fractionDigits === 'undefined') {
while (strSlice(m, -1) === '0') {
m = strSlice(m, 0, -1);
d += 1;
}
}
}
// 10: If f != 0, then
if (f !== 0) {
m = strSlice(m, 0, 1) + '.' + strSlice(m, 1);
}
// 11: If e = 0, then
if (e === 0) {
c = '+';
d = '0';
} else { // 12: Else
c = e > 0 ? '+' : '-';
d = numberToString(abs(e), 10);
}
// 13: Let m be the concatenation of the four Strings m, "e", c, and d.
m += 'e' + c + d;
// 14: Return the concatenation of the Strings s and m.
return s + m;
}
}, hasToExponentialRoundingBug || toExponentialAllowsInfiniteDigits);
var hasToPrecisionUndefinedBug = (function () {
try {
return 1.0.toPrecision(undefined) === '1';
@ -1784,10 +1961,10 @@
return true;
}
}());
var originalToPrecision = NumberPrototype.toPrecision;
var originalToPrecision = call.bind(NumberPrototype.toPrecision);
defineProperties(NumberPrototype, {
toPrecision: function toPrecision(precision) {
return typeof precision === 'undefined' ? originalToPrecision.call(this) : originalToPrecision.call(this, precision);
return typeof precision === 'undefined' ? originalToPrecision(this) : originalToPrecision(this, precision);
}
}, hasToPrecisionUndefinedBug);
@ -1797,12 +1974,12 @@
//
// ES5 15.5.4.14
// http://es5.github.com/#x15.5.4.14
// https://es5.github.io/#x15.5.4.14
// [bugfix, IE lt 9, firefox 4, Konqueror, Opera, obscure browsers]
// Many browsers do not split properly with regular expressions or they
// do not perform the split correctly under obscure conditions.
// See http://blog.stevenlevithan.com/archives/cross-browser-split
// See https://blog.stevenlevithan.com/archives/cross-browser-split
// I've tested in many browsers and this seems to cover the deviant ones:
// 'ab'.split(/(?:ab)*/) should be ["", ""], not [""]
// '.'.split(/(.?)(.?)/) should be ["", ".", "", ""], not ["", ""]
@ -1821,9 +1998,9 @@
) {
(function () {
var compliantExecNpcg = typeof (/()??/).exec('')[1] === 'undefined'; // NPCG: nonparticipating capturing group
var maxSafe32BitInt = Math.pow(2, 32) - 1;
var maxSafe32BitInt = pow(2, 32) - 1;
StringPrototype.split = function (separator, limit) {
StringPrototype.split = function split(separator, limit) {
var string = String(this);
if (typeof separator === 'undefined' && limit === 0) {
return [];
@ -1850,8 +2027,8 @@
/* Values for `limit`, per the spec:
* If undefined: 4294967295 // maxSafe32BitInt
* If 0, Infinity, or NaN: 0
* If positive number: limit = Math.floor(limit); if (limit > 4294967295) limit -= 4294967296;
* If negative number: 4294967296 - Math.floor(Math.abs(limit))
* If positive number: limit = floor(limit); if (limit > 4294967295) limit -= 4294967296;
* If negative number: 4294967296 - floor(abs(limit))
* If other: Type-convert, then use the above rules
*/
var splitLimit = typeof limit === 'undefined' ? maxSafe32BitInt : ES.ToUint32(limit);
@ -1929,18 +2106,18 @@
var hasCapturingGroups = isRegex(searchValue) && (/\)[*?]/).test(searchValue.source);
if (!isFn || !hasCapturingGroups) {
return str_replace.call(this, searchValue, replaceValue);
} else {
var wrappedReplaceValue = function (match) {
var length = arguments.length;
var originalLastIndex = searchValue.lastIndex;
searchValue.lastIndex = 0;
var args = searchValue.exec(match) || [];
searchValue.lastIndex = originalLastIndex;
pushCall(args, arguments[length - 2], arguments[length - 1]);
return replaceValue.apply(this, args);
};
return str_replace.call(this, searchValue, wrappedReplaceValue);
}
var wrappedReplaceValue = function (match) {
var length = arguments.length;
var originalLastIndex = searchValue.lastIndex;
searchValue.lastIndex = 0; // eslint-disable-line no-param-reassign
var args = searchValue.exec(match) || [];
searchValue.lastIndex = originalLastIndex; // eslint-disable-line no-param-reassign
pushCall(args, arguments[length - 2], arguments[length - 1]);
return replaceValue.apply(this, args);
};
return str_replace.call(this, searchValue, wrappedReplaceValue);
};
}
@ -1949,32 +2126,39 @@
// non-normative section suggesting uniform semantics and it should be
// normalized across all browsers
// [bugfix, IE lt 9] IE < 9 substr() with negative value not working in IE
var string_substr = StringPrototype.substr;
var hasNegativeSubstrBug = ''.substr && '0b'.substr(-1) !== 'b';
var string_substr = hasNegativeSubstrBug && call.bind(StringPrototype.substr);
defineProperties(StringPrototype, {
substr: function substr(start, length) {
var normalizedStart = start;
if (start < 0) {
normalizedStart = max(this.length + start, 0);
}
return string_substr.call(this, normalizedStart, length);
return string_substr(this, normalizedStart, length);
}
}, hasNegativeSubstrBug);
// ES5 15.5.4.20
// whitespace from: http://es5.github.io/#x15.5.4.20
var ws = '\x09\x0A\x0B\x0C\x0D\x20\xA0\u1680\u180E\u2000\u2001\u2002\u2003'
+ '\u2004\u2005\u2006\u2007\u2008\u2009\u200A\u202F\u205F\u3000\u2028'
+ '\u2029\uFEFF';
// whitespace from: https://es5.github.io/#x15.5.4.20
var mvs = '\u180E';
var mvsIsWS = (/\s/).test(mvs);
var ws = '\x09\x0A\x0B\x0C\x0D\x20\xA0\u1680\u180E\u2000\u2001\u2002\u2003\u2004\u2005\u2006\u2007\u2008\u2009\u200A\u202F\u205F\u3000\u2028\u2029\uFEFF'
.replace(/\S/g, ''); // remove the mongolian vowel separator (\u180E) in modern engines
var zeroWidth = '\u200b';
var wsRegexChars = '[' + ws + ']';
var trimBeginRegexp = new RegExp('^' + wsRegexChars + wsRegexChars + '*');
var trimEndRegexp = new RegExp(wsRegexChars + wsRegexChars + '*$');
var hasTrimWhitespaceBug = StringPrototype.trim && (ws.trim() || !zeroWidth.trim());
var hasTrimWhitespaceBug = StringPrototype.trim && (
ws.trim() !== '' // if ws is not considered whitespace
|| zeroWidth.trim() === '' // if zero-width IS considered whitespace
|| mvs.trim() !== (mvsIsWS ? '' : mvs) // if MVS is either wrongly considered whitespace, or, wrongly considered NOT whitespace
);
defineProperties(StringPrototype, {
// http://blog.stevenlevithan.com/archives/faster-trim-javascript
// https://blog.stevenlevithan.com/archives/faster-trim-javascript
// http://perfectionkills.com/whitespace-deviations/
trim: function trim() {
'use strict';
if (typeof this === 'undefined' || this === null) {
throw new TypeError("can't convert " + this + ' to object');
}
@ -2014,19 +2198,61 @@
}
}, StringPrototype.lastIndexOf.length !== 1);
var hexRegex = /^[-+]?0[xX]/;
// ES-5 15.1.2.2
// eslint-disable-next-line radix
if (parseInt(ws + '08') !== 8 || parseInt(ws + '0x16') !== 22) {
/* global parseInt: true */
if (
parseInt(ws + '08') !== 8 // eslint-disable-line radix
|| parseInt(ws + '0x16') !== 22 // eslint-disable-line radix
|| (mvsIsWS ? parseInt(mvs + 1) !== 1 : !isNaN(parseInt(mvs + 1))) // eslint-disable-line radix
) {
// eslint-disable-next-line no-global-assign, no-implicit-globals
parseInt = (function (origParseInt) {
var hexRegex = /^[-+]?0[xX]/;
return function parseInt(str, radix) {
if (typeof str === 'symbol') {
if (this instanceof parseInt) { new origParseInt(); } // eslint-disable-line new-cap, no-new, max-statements-per-line
var string = trim(String(str));
var defaultedRadix = $Number(radix) || (hexRegex.test(string) ? 16 : 10);
return origParseInt(string, defaultedRadix);
};
}(parseInt));
}
// Edge 15-18
var parseIntFailsToThrowOnBoxedSymbols = (function () {
if (typeof Symbol !== 'function') {
return false;
}
try {
// eslint-disable-next-line radix
parseInt(Object(Symbol.iterator));
return true;
} catch (e) { /**/ }
try {
// eslint-disable-next-line radix
parseInt(Symbol.iterator);
return true;
} catch (e) { /**/ }
return false;
}());
if (parseIntFailsToThrowOnBoxedSymbols) {
var symbolValueOf = Symbol.prototype.valueOf;
// eslint-disable-next-line no-global-assign, no-implicit-globals
parseInt = (function (origParseInt) {
return function parseInt(str, radix) {
if (this instanceof parseInt) { new origParseInt(); } // eslint-disable-line new-cap, no-new, max-statements-per-line
var isSym = typeof str === 'symbol';
if (!isSym && str && typeof str === 'object') {
try {
symbolValueOf.call(str);
isSym = true;
} catch (e) { /**/ }
}
if (isSym) {
// handle Symbols in node 8.3/8.4
// eslint-disable-next-line no-implicit-coercion, no-unused-expressions
'' + str; // jscs:ignore disallowImplicitTypeConversion
}
var string = trim(String(str));
var defaultedRadix = $Number(radix) || (hexRegex.test(string) ? 16 : 10);
return origParseInt(string, defaultedRadix);
@ -2036,7 +2262,7 @@
// https://es5.github.io/#x15.1.2.3
if (1 / parseFloat('-0') !== -Infinity) {
/* global parseFloat: true */
// eslint-disable-next-line no-global-assign, no-implicit-globals, no-native-reassign
parseFloat = (function (origParseFloat) {
return function parseFloat(string) {
var inputString = trim(String(string));