1 /* Polyfill service v3.38.0
2 * For detailed credits and licence information see https://github.com/financial-times/polyfill-service.
4 * Features requested: es6
6 * - _ESAbstract.ArrayCreate, License: CC0 (required by "Array.from", "es6", "Array.of", "_ESAbstract.ArraySpeciesCreate", "Array.prototype.filter", "Symbol", "Map", "Set", "Symbol.hasInstance", "Symbol.isConcatSpreadable", "Symbol.iterator", "Array.prototype.@@iterator", "String.prototype.@@iterator", "Symbol.match", "Symbol.replace", "Symbol.search", "Symbol.species", "Symbol.split", "Symbol.toPrimitive", "Symbol.toStringTag", "Symbol.unscopables", "Array.prototype.map")
7 * - _ESAbstract.Call, License: CC0 (required by "Array.from", "es6", "Array.prototype.find", "Array.prototype.findIndex", "WeakMap", "WeakSet", "_ESAbstract.GetIterator", "Map", "Set", "_ESAbstract.IteratorClose", "_ESAbstract.IteratorNext", "_ESAbstract.IteratorStep", "Array.prototype.forEach", "Object.setPrototypeOf", "Symbol", "Symbol.hasInstance", "Symbol.isConcatSpreadable", "Symbol.iterator", "Array.prototype.@@iterator", "String.prototype.@@iterator", "Symbol.match", "Symbol.replace", "Symbol.search", "Symbol.species", "Symbol.split", "Symbol.toPrimitive", "Symbol.toStringTag", "Symbol.unscopables", "Array.prototype.filter", "Array.prototype.map", "_ESAbstract.ToPrimitive", "_ESAbstract.ToString", "Array.of", "Array.prototype.fill", "String.prototype.codePointAt", "String.prototype.endsWith", "String.prototype.includes", "String.prototype.repeat", "String.prototype.startsWith", "_ESAbstract.OrdinaryToPrimitive")
8 * - _ESAbstract.Get, License: CC0 (required by "Array.from", "es6", "Array.prototype.fill", "Array.prototype.find", "Array.prototype.findIndex", "Object.assign", "RegExp.prototype.flags", "WeakMap", "WeakSet", "_ESAbstract.IteratorValue", "Map", "Set", "_ESAbstract.IteratorComplete", "_ESAbstract.IteratorStep", "Array.prototype.forEach", "Object.setPrototypeOf", "Symbol", "Symbol.hasInstance", "Symbol.isConcatSpreadable", "Symbol.iterator", "Array.prototype.@@iterator", "String.prototype.@@iterator", "Symbol.match", "Symbol.replace", "Symbol.search", "Symbol.species", "Symbol.split", "Symbol.toPrimitive", "Symbol.toStringTag", "Symbol.unscopables", "_ESAbstract.IsRegExp", "String.prototype.endsWith", "String.prototype.includes", "String.prototype.startsWith", "Array.prototype.filter", "Array.prototype.map", "_ESAbstract.GetPrototypeFromConstructor", "_ESAbstract.OrdinaryCreateFromConstructor", "_ESAbstract.Construct", "Array.of", "Object.defineProperties", "Object.create", "_ESAbstract.GetIterator", "_ArrayIterator", "Array.prototype.entries", "Array.prototype.keys", "Array.prototype.values", "_Iterator", "_StringIterator", "_ESAbstract.ArraySpeciesCreate", "_ESAbstract.OrdinaryToPrimitive", "_ESAbstract.ToPrimitive", "_ESAbstract.ToString", "String.prototype.codePointAt", "String.prototype.repeat")
9 * - _ESAbstract.HasProperty, License: CC0 (required by "Array.prototype.copyWithin", "es6", "Array.prototype.forEach", "Object.setPrototypeOf", "Symbol", "Map", "Array.from", "Set", "Symbol.hasInstance", "Symbol.isConcatSpreadable", "Symbol.iterator", "Array.prototype.@@iterator", "String.prototype.@@iterator", "Symbol.match", "Symbol.replace", "Symbol.search", "Symbol.species", "Symbol.split", "Symbol.toPrimitive", "Symbol.toStringTag", "Symbol.unscopables", "Array.prototype.filter", "Array.prototype.map")
10 * - _ESAbstract.IsArray, License: CC0 (required by "String.fromCodePoint", "es6", "WeakMap", "WeakSet", "Array.isArray", "Map", "Array.from", "Set", "_ESAbstract.ArraySpeciesCreate", "Array.prototype.filter", "Symbol", "Symbol.hasInstance", "Symbol.isConcatSpreadable", "Symbol.iterator", "Array.prototype.@@iterator", "String.prototype.@@iterator", "Symbol.match", "Symbol.replace", "Symbol.search", "Symbol.species", "Symbol.split", "Symbol.toPrimitive", "Symbol.toStringTag", "Symbol.unscopables", "Array.prototype.map")
11 * - _ESAbstract.IsCallable, License: CC0 (required by "Array.from", "es6", "Array.prototype.find", "Array.prototype.findIndex", "Map", "Set", "WeakMap", "WeakSet", "_ESAbstract.GetMethod", "Array.prototype.forEach", "Object.setPrototypeOf", "Symbol", "Symbol.hasInstance", "Symbol.isConcatSpreadable", "Symbol.iterator", "Array.prototype.@@iterator", "String.prototype.@@iterator", "Symbol.match", "Symbol.replace", "Symbol.search", "Symbol.species", "Symbol.split", "Symbol.toPrimitive", "Symbol.toStringTag", "Symbol.unscopables", "Array.prototype.filter", "Array.prototype.map", "Function.prototype.bind", "_ESAbstract.Construct", "Array.of", "Object.getOwnPropertyDescriptor", "Object.assign", "_ESAbstract.OrdinaryToPrimitive", "_ESAbstract.ToPrimitive", "_ESAbstract.ToString", "Array.prototype.fill", "String.prototype.codePointAt", "String.prototype.endsWith", "String.prototype.includes", "String.prototype.repeat", "String.prototype.startsWith")
12 * - _ESAbstract.RequireObjectCoercible, License: CC0 (required by "String.prototype.@@iterator", "es6", "String.prototype.codePointAt", "String.prototype.endsWith", "String.prototype.includes", "String.prototype.repeat", "String.prototype.startsWith")
13 * - _ESAbstract.SameValueNonNumber, License: CC0 (required by "_ESAbstract.SameValueZero", "Map", "es6", "Array.from", "Set", "WeakSet", "_ESAbstract.SameValue", "Object.is", "String.fromCodePoint", "WeakMap")
14 * - _ESAbstract.ToBoolean, License: CC0 (required by "Array.prototype.find", "es6", "Array.prototype.findIndex", "RegExp.prototype.flags", "_ESAbstract.IteratorComplete", "Map", "Array.from", "Set", "_ESAbstract.IteratorStep", "WeakMap", "WeakSet", "_ESAbstract.IsRegExp", "String.prototype.endsWith", "String.prototype.includes", "String.prototype.startsWith", "Array.prototype.filter", "Symbol", "Symbol.hasInstance", "Symbol.isConcatSpreadable", "Symbol.iterator", "Array.prototype.@@iterator", "String.prototype.@@iterator", "Symbol.match", "Symbol.replace", "Symbol.search", "Symbol.species", "Symbol.split", "Symbol.toPrimitive", "Symbol.toStringTag", "Symbol.unscopables")
15 * - _ESAbstract.ToInteger, License: CC0 (required by "Array.prototype.copyWithin", "es6", "Array.prototype.fill", "Number.isInteger", "Number.isSafeInteger", "String.fromCodePoint", "String.prototype.codePointAt", "String.prototype.endsWith", "String.prototype.includes", "String.prototype.repeat", "String.prototype.startsWith", "_ESAbstract.ToLength", "Array.from", "Array.prototype.find", "Array.prototype.findIndex")
16 * - _ESAbstract.ToLength, License: CC0 (required by "Array.from", "es6", "Array.prototype.fill", "Array.prototype.find", "Array.prototype.findIndex", "Array.prototype.forEach", "Object.setPrototypeOf", "Symbol", "Map", "Set", "Symbol.hasInstance", "Symbol.isConcatSpreadable", "Symbol.iterator", "Array.prototype.@@iterator", "String.prototype.@@iterator", "Symbol.match", "Symbol.replace", "Symbol.search", "Symbol.species", "Symbol.split", "Symbol.toPrimitive", "Symbol.toStringTag", "Symbol.unscopables", "Array.prototype.filter", "Array.prototype.map")
17 * - _ESAbstract.ToNumber, License: CC0 (required by "String.fromCodePoint", "es6")
18 * - _ESAbstract.ToObject, License: CC0 (required by "Array.from", "es6", "Array.prototype.entries", "Array.prototype.fill", "Array.prototype.find", "Array.prototype.findIndex", "Array.prototype.keys", "Array.prototype.values", "Array.prototype.@@iterator", "Object.assign", "Array.prototype.forEach", "Object.setPrototypeOf", "Symbol", "Map", "Set", "Symbol.hasInstance", "Symbol.isConcatSpreadable", "Symbol.iterator", "String.prototype.@@iterator", "Symbol.match", "Symbol.replace", "Symbol.search", "Symbol.species", "Symbol.split", "Symbol.toPrimitive", "Symbol.toStringTag", "Symbol.unscopables", "Array.prototype.filter", "Array.prototype.map", "_ESAbstract.GetV", "_ESAbstract.GetMethod", "_ESAbstract.GetIterator", "WeakMap", "WeakSet", "Object.defineProperties", "Object.create", "_ArrayIterator", "_ESAbstract.OrdinaryCreateFromConstructor", "_ESAbstract.Construct", "Array.of", "_Iterator", "_StringIterator")
19 * - _ESAbstract.GetV, License: CC0 (required by "_ESAbstract.GetMethod", "Array.from", "es6", "Map", "Set", "_ESAbstract.GetIterator", "WeakMap", "WeakSet")
20 * - _ESAbstract.GetMethod, License: CC0 (required by "Array.from", "es6", "Map", "Set", "_ESAbstract.IsConstructor", "Array.of", "_ESAbstract.GetIterator", "WeakMap", "WeakSet", "_ESAbstract.IteratorClose", "_ESAbstract.ToPrimitive", "_ESAbstract.ToString", "Array.prototype.fill", "Array.prototype.find", "Array.prototype.findIndex", "String.prototype.@@iterator", "String.prototype.codePointAt", "String.prototype.endsWith", "String.prototype.includes", "String.prototype.repeat", "String.prototype.startsWith")
21 * - _ESAbstract.ToUint32, License: CC0 (required by "Math.clz32", "es6", "Math.imul")
22 * - _ESAbstract.Type, License: CC0 (required by "Map", "es6", "Array.from", "Number.isFinite", "Number.isInteger", "Number.isNaN", "Number.isSafeInteger", "Object.seal", "RegExp.prototype.flags", "WeakMap", "WeakSet", "_ESAbstract.IsConstructor", "Array.of", "_ESAbstract.GetIterator", "Set", "_ESAbstract.IteratorClose", "_ESAbstract.ToString", "Array.prototype.fill", "Array.prototype.find", "Array.prototype.findIndex", "String.prototype.@@iterator", "String.prototype.codePointAt", "String.prototype.endsWith", "String.prototype.includes", "String.prototype.repeat", "String.prototype.startsWith", "_ESAbstract.IteratorValue", "_ESAbstract.CreateIterResultObject", "_ESAbstract.IteratorComplete", "_ESAbstract.IteratorStep", "_ESAbstract.IteratorNext", "_ESAbstract.SameValueZero", "Object.create", "Object.setPrototypeOf", "Symbol", "Symbol.hasInstance", "Symbol.isConcatSpreadable", "Symbol.iterator", "Array.prototype.@@iterator", "Symbol.match", "Symbol.replace", "Symbol.search", "Symbol.species", "Symbol.split", "Symbol.toPrimitive", "Symbol.toStringTag", "Symbol.unscopables", "_ArrayIterator", "Array.prototype.entries", "Array.prototype.keys", "Array.prototype.values", "_ESAbstract.OrdinaryCreateFromConstructor", "_ESAbstract.Construct", "_ESAbstract.SameValue", "Object.is", "String.fromCodePoint", "_ESAbstract.IsRegExp", "_ESAbstract.ToPrimitive", "_ESAbstract.GetPrototypeFromConstructor", "Object.defineProperties", "_Iterator", "_StringIterator", "_ESAbstract.ArraySpeciesCreate", "Array.prototype.filter", "Array.prototype.map", "_ESAbstract.OrdinaryToPrimitive")
23 * - _ESAbstract.GetPrototypeFromConstructor, License: CC0 (required by "_ESAbstract.OrdinaryCreateFromConstructor", "Map", "es6", "Array.from", "Set", "WeakMap", "WeakSet", "_ESAbstract.Construct", "Array.of")
24 * - _ESAbstract.IsConstructor, License: CC0 (required by "Array.from", "es6", "Array.of", "_ESAbstract.Construct", "_ESAbstract.ArraySpeciesCreate", "Array.prototype.filter", "Symbol", "Map", "Set", "Symbol.hasInstance", "Symbol.isConcatSpreadable", "Symbol.iterator", "Array.prototype.@@iterator", "String.prototype.@@iterator", "Symbol.match", "Symbol.replace", "Symbol.search", "Symbol.species", "Symbol.split", "Symbol.toPrimitive", "Symbol.toStringTag", "Symbol.unscopables", "Array.prototype.map")
25 * - _ESAbstract.IsRegExp, License: CC0 (required by "String.prototype.endsWith", "es6", "String.prototype.includes", "String.prototype.startsWith")
26 * - _ESAbstract.IteratorClose, License: CC0 (required by "Array.from", "es6", "Map", "Set", "WeakMap", "WeakSet")
27 * - _ESAbstract.IteratorComplete, License: CC0 (required by "Map", "es6", "Array.from", "Set", "_ESAbstract.IteratorStep", "WeakMap", "WeakSet")
28 * - _ESAbstract.IteratorNext, License: CC0 (required by "Map", "es6", "Array.from", "Set", "_ESAbstract.IteratorStep", "WeakMap", "WeakSet")
29 * - _ESAbstract.IteratorStep, License: CC0 (required by "Array.from", "es6", "Map", "Set", "WeakMap", "WeakSet")
30 * - _ESAbstract.IteratorValue, License: CC0 (required by "Array.from", "es6", "Map", "Set", "WeakMap", "WeakSet")
31 * - _ESAbstract.OrdinaryToPrimitive, License: CC0 (required by "_ESAbstract.ToPrimitive", "_ESAbstract.ToString", "Array.from", "es6", "Array.of", "Array.prototype.fill", "Array.prototype.find", "Array.prototype.findIndex", "String.prototype.@@iterator", "String.prototype.codePointAt", "String.prototype.endsWith", "String.prototype.includes", "String.prototype.repeat", "String.prototype.startsWith")
32 * - _ESAbstract.SameValue, License: CC0 (required by "Object.is", "es6", "String.fromCodePoint", "WeakMap")
33 * - _ESAbstract.SameValueZero, License: CC0 (required by "Map", "es6", "Array.from", "Set", "WeakSet")
34 * - _ESAbstract.ToPrimitive, License: CC0 (required by "_ESAbstract.ToString", "Array.from", "es6", "Array.of", "Array.prototype.fill", "Array.prototype.find", "Array.prototype.findIndex", "String.prototype.@@iterator", "String.prototype.codePointAt", "String.prototype.endsWith", "String.prototype.includes", "String.prototype.repeat", "String.prototype.startsWith")
35 * - _ESAbstract.ToString, License: CC0 (required by "Array.from", "es6", "Array.of", "Array.prototype.fill", "Array.prototype.find", "Array.prototype.findIndex", "String.prototype.@@iterator", "String.prototype.codePointAt", "String.prototype.endsWith", "String.prototype.includes", "String.prototype.repeat", "String.prototype.startsWith", "Array.prototype.forEach", "Object.setPrototypeOf", "Symbol", "Map", "Set", "Symbol.hasInstance", "Symbol.isConcatSpreadable", "Symbol.iterator", "Array.prototype.@@iterator", "Symbol.match", "Symbol.replace", "Symbol.search", "Symbol.species", "Symbol.split", "Symbol.toPrimitive", "Symbol.toStringTag", "Symbol.unscopables", "Array.prototype.filter", "Array.prototype.map")
36 * - _ESAbstract.UTF16Decode, License: CC0 (required by "String.prototype.codePointAt", "es6")
37 * - _ESAbstract.UTF16Encoding, License: CC0 (required by "String.fromCodePoint", "es6")
38 * - _TypedArray, License: MIT (required by "Math.fround", "es6")
39 * - Object.defineProperty, License: CC0 (required by "Function.prototype.name", "es6", "Map", "Array.from", "Number.Epsilon", "Number.MAX_SAFE_INTEGER", "Number.MIN_SAFE_INTEGER", "Object.setPrototypeOf", "RegExp.prototype.flags", "Set", "Symbol.hasInstance", "Symbol.isConcatSpreadable", "Symbol.iterator", "Array.prototype.@@iterator", "String.prototype.@@iterator", "Symbol.match", "Symbol.replace", "Symbol.search", "Symbol.species", "Symbol.split", "Symbol.toPrimitive", "Symbol.toStringTag", "Symbol.unscopables", "Symbol", "WeakMap", "WeakSet", "_ESAbstract.CreateMethodProperty", "Array.of", "Array.prototype.copyWithin", "Array.prototype.entries", "Array.prototype.fill", "Array.prototype.find", "Array.prototype.findIndex", "Array.prototype.keys", "Array.prototype.values", "Math.acosh", "Math.asinh", "Math.atanh", "Math.cbrt", "Math.clz32", "Math.cosh", "Math.expm1", "Math.fround", "Math.hypot", "Math.imul", "Math.log10", "Math.log1p", "Math.log2", "Math.sign", "Math.sinh", "Math.tanh", "Math.trunc", "Number.isFinite", "Number.isInteger", "Number.isNaN", "Number.isSafeInteger", "Number.parseFloat", "Number.parseInt", "Object.assign", "Object.is", "Object.seal", "String.fromCodePoint", "String.prototype.codePointAt", "String.prototype.endsWith", "String.prototype.includes", "String.prototype.repeat", "String.prototype.startsWith", "_ArrayIterator", "_ESAbstract.OrdinaryCreateFromConstructor", "_ESAbstract.Construct", "_StringIterator", "_ESAbstract.CreateDataProperty", "_ESAbstract.CreateDataPropertyOrThrow", "_ESAbstract.CreateIterResultObject", "_Iterator", "Object.defineProperties", "Object.create", "_ESAbstract.GetIterator")
40 * - _ESAbstract.CreateDataProperty, License: CC0 (required by "_ESAbstract.CreateDataPropertyOrThrow", "Array.from", "es6", "Array.of", "_ESAbstract.CreateIterResultObject", "Map", "Set")
41 * - _ESAbstract.CreateDataPropertyOrThrow, License: CC0 (required by "Array.from", "es6", "Array.of", "Array.prototype.filter", "Symbol", "Map", "Set", "Symbol.hasInstance", "Symbol.isConcatSpreadable", "Symbol.iterator", "Array.prototype.@@iterator", "String.prototype.@@iterator", "Symbol.match", "Symbol.replace", "Symbol.search", "Symbol.species", "Symbol.split", "Symbol.toPrimitive", "Symbol.toStringTag", "Symbol.unscopables", "Array.prototype.map")
42 * - _ESAbstract.CreateIterResultObject, License: CC0 (required by "Map", "es6", "Array.from", "Set")
43 * - _ESAbstract.CreateMethodProperty, License: CC0 (required by "Array.from", "es6", "Array.of", "Array.prototype.@@iterator", "Array.prototype.copyWithin", "Array.prototype.entries", "Array.prototype.fill", "Array.prototype.find", "Array.prototype.findIndex", "Array.prototype.keys", "Array.prototype.values", "Map", "Math.acosh", "Math.asinh", "Math.atanh", "Math.cbrt", "Math.clz32", "Math.cosh", "Math.expm1", "Math.fround", "Math.hypot", "Math.imul", "Math.log10", "Math.log1p", "Math.log2", "Math.sign", "Math.sinh", "Math.tanh", "Math.trunc", "Number.isFinite", "Number.isInteger", "Number.isNaN", "Number.isSafeInteger", "Number.parseFloat", "Number.parseInt", "Object.assign", "Object.is", "Object.seal", "Object.setPrototypeOf", "Set", "String.fromCodePoint", "String.prototype.@@iterator", "String.prototype.codePointAt", "String.prototype.endsWith", "String.prototype.includes", "String.prototype.repeat", "String.prototype.startsWith", "WeakMap", "WeakSet", "Array.isArray", "Object.create", "Symbol", "Symbol.hasInstance", "Symbol.isConcatSpreadable", "Symbol.iterator", "Symbol.match", "Symbol.replace", "Symbol.search", "Symbol.species", "Symbol.split", "Symbol.toPrimitive", "Symbol.toStringTag", "Symbol.unscopables", "_ESAbstract.GetIterator", "_ArrayIterator", "_ESAbstract.OrdinaryCreateFromConstructor", "_ESAbstract.Construct", "Object.getOwnPropertyDescriptor", "Object.keys", "Array.prototype.forEach", "Object.getPrototypeOf", "Object.getOwnPropertyNames", "Array.prototype.filter", "Array.prototype.map", "Object.freeze", "Function.prototype.bind", "Object.defineProperties", "_Iterator", "_StringIterator")
44 * - Array.isArray, License: CC0 (required by "Map", "es6", "Array.from", "Set", "WeakMap")
45 * - Array.prototype.copyWithin, License: MIT (required by "es6")
46 * - Array.prototype.fill, License: CC0 (required by "es6")
47 * - Array.prototype.find, License: CC0 (required by "es6")
48 * - Array.prototype.findIndex, License: CC0 (required by "es6")
49 * - Array.prototype.forEach, License: CC0 (required by "Object.setPrototypeOf", "es6", "Symbol", "Map", "Array.from", "Set", "Symbol.hasInstance", "Symbol.isConcatSpreadable", "Symbol.iterator", "Array.prototype.@@iterator", "String.prototype.@@iterator", "Symbol.match", "Symbol.replace", "Symbol.search", "Symbol.species", "Symbol.split", "Symbol.toPrimitive", "Symbol.toStringTag", "Symbol.unscopables")
50 * - Function.prototype.bind, License: MIT (required by "_ESAbstract.Construct", "Array.from", "es6", "Array.of", "Object.getOwnPropertyDescriptor", "Object.assign", "Object.setPrototypeOf", "Symbol", "Map", "Set", "Symbol.hasInstance", "Symbol.isConcatSpreadable", "Symbol.iterator", "Array.prototype.@@iterator", "String.prototype.@@iterator", "Symbol.match", "Symbol.replace", "Symbol.search", "Symbol.species", "Symbol.split", "Symbol.toPrimitive", "Symbol.toStringTag", "Symbol.unscopables", "_Iterator", "_ArrayIterator", "Array.prototype.entries", "Array.prototype.keys", "Array.prototype.values", "_StringIterator")
51 * - Math.acosh, License: CC0 (required by "es6")
52 * - Math.asinh, License: CC0 (required by "es6")
53 * - Math.atanh, License: CC0 (required by "es6")
54 * - Math.cbrt, License: CC0 (required by "es6")
55 * - Math.clz32, License: CC0 (required by "es6")
56 * - Math.cosh, License: CC0 (required by "es6")
57 * - Math.expm1, License: CC0 (required by "es6")
58 * - Math.fround, License: CC0 (required by "es6")
59 * - Math.hypot, License: CC0 (required by "es6")
60 * - Math.imul, License: CC0 (required by "es6")
61 * - Math.log10, License: CC0 (required by "es6")
62 * - Math.log1p, License: CC0 (required by "es6")
63 * - Math.log2, License: CC0 (required by "es6")
64 * - Math.sign, License: CC0 (required by "es6")
65 * - Math.sinh, License: CC0 (required by "es6")
66 * - Math.tanh, License: CC0 (required by "es6")
67 * - Math.trunc, License: CC0 (required by "es6")
68 * - Number.isFinite, License: MIT (required by "es6")
69 * - Number.isInteger, License: MIT (required by "es6")
70 * - Number.isNaN, License: MIT (required by "es6")
71 * - Number.isSafeInteger, License: MIT (required by "es6")
72 * - Number.parseFloat, License: MIT (required by "es6")
73 * - Number.parseInt, License: MIT (required by "es6")
74 * - Function.prototype.name, License: MIT (required by "es6")
75 * - Number.Epsilon, License: MIT (required by "es6")
76 * - Number.MAX_SAFE_INTEGER, License: MIT (required by "es6")
77 * - Number.MIN_SAFE_INTEGER, License: MIT (required by "es6")
78 * - Object.freeze, License: CC0 (required by "Symbol", "es6", "Map", "Array.from", "Set", "Symbol.hasInstance", "Symbol.isConcatSpreadable", "Symbol.iterator", "Array.prototype.@@iterator", "String.prototype.@@iterator", "Symbol.match", "Symbol.replace", "Symbol.search", "Symbol.species", "Symbol.split", "Symbol.toPrimitive", "Symbol.toStringTag", "Symbol.unscopables")
79 * - Object.getOwnPropertyDescriptor, License: CC0 (required by "Object.assign", "es6", "Object.setPrototypeOf", "Symbol", "Map", "Array.from", "Set", "Symbol.hasInstance", "Symbol.isConcatSpreadable", "Symbol.iterator", "Array.prototype.@@iterator", "String.prototype.@@iterator", "Symbol.match", "Symbol.replace", "Symbol.search", "Symbol.species", "Symbol.split", "Symbol.toPrimitive", "Symbol.toStringTag", "Symbol.unscopables", "Object.defineProperties", "Object.create", "_ESAbstract.GetIterator", "WeakMap", "WeakSet", "_ArrayIterator", "Array.prototype.entries", "Array.prototype.keys", "Array.prototype.values", "_ESAbstract.OrdinaryCreateFromConstructor", "_ESAbstract.Construct", "Array.of", "_Iterator", "_StringIterator")
80 * - Object.getOwnPropertyNames, License: CC0 (required by "Object.setPrototypeOf", "es6", "Symbol", "Map", "Array.from", "Set", "Symbol.hasInstance", "Symbol.isConcatSpreadable", "Symbol.iterator", "Array.prototype.@@iterator", "String.prototype.@@iterator", "Symbol.match", "Symbol.replace", "Symbol.search", "Symbol.species", "Symbol.split", "Symbol.toPrimitive", "Symbol.toStringTag", "Symbol.unscopables")
81 * - Object.getPrototypeOf, License: CC0 (required by "Object.setPrototypeOf", "es6", "_ESAbstract.OrdinaryCreateFromConstructor", "Map", "Array.from", "Set", "WeakMap", "WeakSet", "_ESAbstract.Construct", "Array.of")
82 * - Object.is, License: CC0 (required by "es6")
83 * - Object.keys, License: MIT (required by "Object.assign", "es6", "Symbol", "Map", "Array.from", "Set", "Symbol.hasInstance", "Symbol.isConcatSpreadable", "Symbol.iterator", "Array.prototype.@@iterator", "String.prototype.@@iterator", "Symbol.match", "Symbol.replace", "Symbol.search", "Symbol.species", "Symbol.split", "Symbol.toPrimitive", "Symbol.toStringTag", "Symbol.unscopables", "Object.defineProperties", "Object.create", "Object.setPrototypeOf", "_ESAbstract.GetIterator", "WeakMap", "WeakSet", "_ArrayIterator", "Array.prototype.entries", "Array.prototype.keys", "Array.prototype.values", "_ESAbstract.OrdinaryCreateFromConstructor", "_ESAbstract.Construct", "Array.of", "_Iterator", "_StringIterator")
84 * - Object.assign, License: CC0 (required by "es6", "_Iterator", "_ArrayIterator", "Array.prototype.entries", "Array.prototype.keys", "Array.prototype.values", "Array.prototype.@@iterator", "_StringIterator", "String.prototype.@@iterator")
85 * - Object.defineProperties, License: CC0 (required by "Object.create", "Map", "es6", "Array.from", "Object.setPrototypeOf", "Set", "Symbol", "Symbol.hasInstance", "Symbol.isConcatSpreadable", "Symbol.iterator", "Array.prototype.@@iterator", "String.prototype.@@iterator", "Symbol.match", "Symbol.replace", "Symbol.search", "Symbol.species", "Symbol.split", "Symbol.toPrimitive", "Symbol.toStringTag", "Symbol.unscopables", "_ESAbstract.GetIterator", "WeakMap", "WeakSet", "_ArrayIterator", "Array.prototype.entries", "Array.prototype.keys", "Array.prototype.values", "_ESAbstract.OrdinaryCreateFromConstructor", "_ESAbstract.Construct", "Array.of", "_Iterator", "_StringIterator")
86 * - Object.create, License: CC0 (required by "Map", "es6", "Array.from", "Object.setPrototypeOf", "Set", "Symbol", "Symbol.hasInstance", "Symbol.isConcatSpreadable", "Symbol.iterator", "Array.prototype.@@iterator", "String.prototype.@@iterator", "Symbol.match", "Symbol.replace", "Symbol.search", "Symbol.species", "Symbol.split", "Symbol.toPrimitive", "Symbol.toStringTag", "Symbol.unscopables", "_ESAbstract.GetIterator", "WeakMap", "WeakSet", "_ArrayIterator", "Array.prototype.entries", "Array.prototype.keys", "Array.prototype.values", "_ESAbstract.OrdinaryCreateFromConstructor", "_ESAbstract.Construct", "Array.of", "_StringIterator")
87 * - _ESAbstract.OrdinaryCreateFromConstructor, License: CC0 (required by "Map", "es6", "Array.from", "Set", "WeakMap", "WeakSet", "_ESAbstract.Construct", "Array.of")
88 * - _ESAbstract.Construct, License: CC0 (required by "Array.from", "es6", "Array.of", "_ESAbstract.ArraySpeciesCreate", "Array.prototype.filter", "Symbol", "Map", "Set", "Symbol.hasInstance", "Symbol.isConcatSpreadable", "Symbol.iterator", "Array.prototype.@@iterator", "String.prototype.@@iterator", "Symbol.match", "Symbol.replace", "Symbol.search", "Symbol.species", "Symbol.split", "Symbol.toPrimitive", "Symbol.toStringTag", "Symbol.unscopables", "Array.prototype.map")
89 * - _ESAbstract.ArraySpeciesCreate, License: CC0 (required by "Array.prototype.filter", "Symbol", "es6", "Map", "Array.from", "Set", "Symbol.hasInstance", "Symbol.isConcatSpreadable", "Symbol.iterator", "Array.prototype.@@iterator", "String.prototype.@@iterator", "Symbol.match", "Symbol.replace", "Symbol.search", "Symbol.species", "Symbol.split", "Symbol.toPrimitive", "Symbol.toStringTag", "Symbol.unscopables", "Array.prototype.map")
90 * - Array.prototype.filter, License: CC0 (required by "Symbol", "es6", "Map", "Array.from", "Set", "Symbol.hasInstance", "Symbol.isConcatSpreadable", "Symbol.iterator", "Array.prototype.@@iterator", "String.prototype.@@iterator", "Symbol.match", "Symbol.replace", "Symbol.search", "Symbol.species", "Symbol.split", "Symbol.toPrimitive", "Symbol.toStringTag", "Symbol.unscopables")
91 * - Array.prototype.map, License: CC0 (required by "Symbol", "es6", "Map", "Array.from", "Set", "Symbol.hasInstance", "Symbol.isConcatSpreadable", "Symbol.iterator", "Array.prototype.@@iterator", "String.prototype.@@iterator", "Symbol.match", "Symbol.replace", "Symbol.search", "Symbol.species", "Symbol.split", "Symbol.toPrimitive", "Symbol.toStringTag", "Symbol.unscopables")
92 * - Array.of, License: CC0 (required by "es6")
93 * - Object.seal, License: MIT (required by "es6")
94 * - Object.setPrototypeOf, License: MIT (required by "es6", "_ArrayIterator", "Array.prototype.entries", "Array.prototype.keys", "Array.prototype.values", "Array.prototype.@@iterator", "_StringIterator", "String.prototype.@@iterator")
95 * - Promise, License: MIT (required by "es6")
96 * - RegExp.prototype.flags, License: MIT (required by "es6")
97 * - String.fromCodePoint, License: MIT (required by "es6")
98 * - String.prototype.codePointAt, License: MIT (required by "es6")
99 * - String.prototype.endsWith, License: CC0 (required by "es6")
100 * - String.prototype.includes, License: CC0 (required by "es6", "_ArrayIterator", "Array.prototype.entries", "Array.prototype.keys", "Array.prototype.values", "Array.prototype.@@iterator")
101 * - String.prototype.repeat, License: CC0 (required by "es6")
102 * - String.prototype.startsWith, License: CC0 (required by "es6")
103 * - Symbol, License: MIT (required by "es6", "Map", "Array.from", "Set", "Symbol.hasInstance", "Symbol.isConcatSpreadable", "Symbol.iterator", "Array.prototype.@@iterator", "String.prototype.@@iterator", "Symbol.match", "Symbol.replace", "Symbol.search", "Symbol.species", "Symbol.split", "Symbol.toPrimitive", "Symbol.toStringTag", "Symbol.unscopables", "WeakMap", "WeakSet", "_Iterator", "_ArrayIterator", "Array.prototype.entries", "Array.prototype.keys", "Array.prototype.values", "_StringIterator")
104 * - Symbol.hasInstance, License: MIT (required by "es6")
105 * - Symbol.isConcatSpreadable, License: MIT (required by "es6")
106 * - Symbol.iterator, License: MIT (required by "es6", "Array.from", "Array.prototype.@@iterator", "Map", "Set", "String.prototype.@@iterator", "_ESAbstract.GetIterator", "WeakMap", "WeakSet", "_Iterator", "_ArrayIterator", "Array.prototype.entries", "Array.prototype.keys", "Array.prototype.values", "_StringIterator")
107 * - _ESAbstract.GetIterator, License: CC0 (required by "Array.from", "es6", "Map", "Set", "WeakMap", "WeakSet")
108 * - Symbol.match, License: MIT (required by "es6")
109 * - Symbol.replace, License: MIT (required by "es6")
110 * - Symbol.search, License: MIT (required by "es6")
111 * - Symbol.species, License: MIT (required by "es6", "Map", "Array.from", "Set")
112 * - Map, License: CC0 (required by "es6", "Array.from")
113 * - Set, License: CC0 (required by "es6", "Array.from")
114 * - Array.from, License: CC0 (required by "es6")
115 * - Symbol.split, License: MIT (required by "es6")
116 * - Symbol.toPrimitive, License: MIT (required by "es6")
117 * - Symbol.toStringTag, License: MIT (required by "es6", "_Iterator", "_ArrayIterator", "Array.prototype.entries", "Array.prototype.keys", "Array.prototype.values", "Array.prototype.@@iterator", "_StringIterator", "String.prototype.@@iterator")
118 * - _Iterator, License: MIT (required by "_ArrayIterator", "Array.prototype.entries", "es6", "Array.prototype.keys", "Array.prototype.values", "Array.prototype.@@iterator", "_StringIterator", "String.prototype.@@iterator")
119 * - _ArrayIterator, License: MIT (required by "Array.prototype.entries", "es6", "Array.prototype.keys", "Array.prototype.values", "Array.prototype.@@iterator")
120 * - Array.prototype.entries, License: CC0 (required by "es6")
121 * - Array.prototype.keys, License: CC0 (required by "es6")
122 * - Array.prototype.values, License: MIT (required by "es6", "Array.prototype.@@iterator")
123 * - Array.prototype.@@iterator, License: CC0 (required by "es6")
124 * - _StringIterator, License: MIT (required by "String.prototype.@@iterator", "es6")
125 * - String.prototype.@@iterator, License: CC0 (required by "es6")
126 * - Symbol.unscopables, License: MIT (required by "es6")
127 * - WeakMap, License: MIT (required by "es6")
128 * - WeakSet, License: MIT (required by "es6") */
130 (function(undefined) {
132 // _ESAbstract.ArrayCreate
133 // 9.4.2.2. ArrayCreate ( length [ , proto ] )
134 function ArrayCreate(length /* [, proto] */) { // eslint-disable-line no-unused-vars
135 // 1. Assert: length is an integer Number ≥ 0.
136 // 2. If length is -0, set length to +0.
137 if (1 / length === -Infinity) {
140 // 3. If length>2^32-1, throw a RangeError exception.
141 if (length > (Math.pow(2, 32) - 1)) {
142 throw new RangeError('Invalid array length');
144 // 4. If proto is not present, set proto to the intrinsic object %ArrayPrototype%.
145 // 5. Let A be a newly created Array exotic object.
147 // 6. Set A's essential internal methods except for [[DefineOwnProperty]] to the default ordinary object definitions specified in 9.1.
148 // 7. Set A.[[DefineOwnProperty]] as specified in 9.4.2.1.
149 // 8. Set A.[[Prototype]] to proto.
150 // 9. Set A.[[Extensible]] to true.
151 // 10. Perform ! OrdinaryDefineOwnProperty(A, "length", PropertyDescriptor{[[Value]]: length, [[Writable]]: true, [[Enumerable]]: false, [[Configurable]]: false}).
158 /* global IsCallable */
159 // 7.3.12. Call ( F, V [ , argumentsList ] )
160 function Call(F, V /* [, argumentsList] */) { // eslint-disable-line no-unused-vars
161 // 1. If argumentsList is not present, set argumentsList to a new empty List.
162 var argumentsList = arguments.length > 2 ? arguments[2] : [];
163 // 2. If IsCallable(F) is false, throw a TypeError exception.
164 if (IsCallable(F) === false) {
165 throw new TypeError(Object.prototype.toString.call(F) + 'is not a function.');
167 // 3. Return ? F.[[Call]](V, argumentsList).
168 return F.apply(V, argumentsList);
172 // 7.3.1. Get ( O, P )
173 function Get(O, P) { // eslint-disable-line no-unused-vars
174 // 1. Assert: Type(O) is Object.
175 // 2. Assert: IsPropertyKey(P) is true.
176 // 3. Return ? O.[[Get]](P, O).
180 // _ESAbstract.HasProperty
181 // 7.3.10. HasProperty ( O, P )
182 function HasProperty(O, P) { // eslint-disable-line no-unused-vars
183 // Assert: Type(O) is Object.
184 // Assert: IsPropertyKey(P) is true.
185 // Return ? O.[[HasProperty]](P).
189 // _ESAbstract.IsArray
190 // 7.2.2. IsArray ( argument )
191 function IsArray(argument) { // eslint-disable-line no-unused-vars
192 // 1. If Type(argument) is not Object, return false.
193 // 2. If argument is an Array exotic object, return true.
194 // 3. If argument is a Proxy exotic object, then
195 // a. If argument.[[ProxyHandler]] is null, throw a TypeError exception.
196 // b. Let target be argument.[[ProxyTarget]].
197 // c. Return ? IsArray(target).
200 // Polyfill.io - We can skip all the above steps and check the string returned from Object.prototype.toString().
201 return Object.prototype.toString.call(argument) === '[object Array]';
204 // _ESAbstract.IsCallable
205 // 7.2.3. IsCallable ( argument )
206 function IsCallable(argument) { // eslint-disable-line no-unused-vars
207 // 1. If Type(argument) is not Object, return false.
208 // 2. If argument has a [[Call]] internal method, return true.
211 // Polyfill.io - Only function objects have a [[Call]] internal method. This means we can simplify this function to check that the argument has a type of function.
212 return typeof argument === 'function';
215 // _ESAbstract.RequireObjectCoercible
216 // 7.2.1. RequireObjectCoercible ( argument )
217 // The abstract operation ToObject converts argument to a value of type Object according to Table 12:
218 // Table 12: ToObject Conversions
220 |----------------------------------------------------------------------------------------------------------------------------------------------------|
221 | Argument Type | Result |
222 |----------------------------------------------------------------------------------------------------------------------------------------------------|
223 | Undefined | Throw a TypeError exception. |
224 | Null | Throw a TypeError exception. |
225 | Boolean | Return argument. |
226 | Number | Return argument. |
227 | String | Return argument. |
228 | Symbol | Return argument. |
229 | Object | Return argument. |
230 |----------------------------------------------------------------------------------------------------------------------------------------------------|
232 function RequireObjectCoercible(argument) { // eslint-disable-line no-unused-vars
233 if (argument === null || argument === undefined) {
239 // _ESAbstract.SameValueNonNumber
240 // 7.2.12. SameValueNonNumber ( x, y )
241 function SameValueNonNumber(x, y) { // eslint-disable-line no-unused-vars
242 // 1. Assert: Type(x) is not Number.
243 // 2. Assert: Type(x) is the same as Type(y).
244 // 3. If Type(x) is Undefined, return true.
245 // 4. If Type(x) is Null, return true.
246 // 5. If Type(x) is String, then
247 // a. If x and y are exactly the same sequence of code units (same length and same code units at corresponding indices), return true; otherwise, return false.
248 // 6. If Type(x) is Boolean, then
249 // a. If x and y are both true or both false, return true; otherwise, return false.
250 // 7. If Type(x) is Symbol, then
251 // a. If x and y are both the same Symbol value, return true; otherwise, return false.
252 // 8. If x and y are the same Object value, return true. Otherwise, return false.
254 // Polyfill.io - We can skip all above steps because the === operator does it all for us.
258 // _ESAbstract.ToBoolean
259 // 7.1.2. ToBoolean ( argument )
260 // The abstract operation ToBoolean converts argument to a value of type Boolean according to Table 9:
262 --------------------------------------------------------------------------------------------------------------
263 | Argument Type | Result |
264 --------------------------------------------------------------------------------------------------------------
265 | Undefined | Return false. |
266 | Null | Return false. |
267 | Boolean | Return argument. |
268 | Number | If argument is +0, -0, or NaN, return false; otherwise return true. |
269 | String | If argument is the empty String (its length is zero), return false; otherwise return true. |
270 | Symbol | Return true. |
271 | Object | Return true. |
272 --------------------------------------------------------------------------------------------------------------
274 function ToBoolean(argument) { // eslint-disable-line no-unused-vars
275 return Boolean(argument);
278 // _ESAbstract.ToInteger
279 // 7.1.4. ToInteger ( argument )
280 function ToInteger(argument) { // eslint-disable-line no-unused-vars
281 // 1. Let number be ? ToNumber(argument).
282 var number = Number(argument);
283 // 2. If number is NaN, return +0.
287 // 3. If number is +0, -0, +∞, or -∞, return number.
288 if (1/number === Infinity || 1/number === -Infinity || number === Infinity || number === -Infinity) {
291 // 4. Return the number value that is the same sign as number and whose magnitude is floor(abs(number)).
292 return ((number < 0) ? -1 : 1) * Math.floor(Math.abs(number));
295 // _ESAbstract.ToLength
296 /* global ToInteger */
297 // 7.1.15. ToLength ( argument )
298 function ToLength(argument) { // eslint-disable-line no-unused-vars
299 // 1. Let len be ? ToInteger(argument).
300 var len = ToInteger(argument);
301 // 2. If len ≤ +0, return +0.
305 // 3. Return min(len, 253-1).
306 return Math.min(len, Math.pow(2, 53) -1);
309 // _ESAbstract.ToNumber
310 // 7.1.3. ToNumber ( argument )
311 function ToNumber(argument) { // eslint-disable-line no-unused-vars
312 return Number(argument);
315 // _ESAbstract.ToObject
316 // 7.1.13 ToObject ( argument )
317 // The abstract operation ToObject converts argument to a value of type Object according to Table 12:
318 // Table 12: ToObject Conversions
320 |----------------------------------------------------------------------------------------------------------------------------------------------------|
321 | Argument Type | Result |
322 |----------------------------------------------------------------------------------------------------------------------------------------------------|
323 | Undefined | Throw a TypeError exception. |
324 | Null | Throw a TypeError exception. |
325 | Boolean | Return a new Boolean object whose [[BooleanData]] internal slot is set to argument. See 19.3 for a description of Boolean objects. |
326 | Number | Return a new Number object whose [[NumberData]] internal slot is set to argument. See 20.1 for a description of Number objects. |
327 | String | Return a new String object whose [[StringData]] internal slot is set to argument. See 21.1 for a description of String objects. |
328 | Symbol | Return a new Symbol object whose [[SymbolData]] internal slot is set to argument. See 19.4 for a description of Symbol objects. |
329 | Object | Return argument. |
330 |----------------------------------------------------------------------------------------------------------------------------------------------------|
332 function ToObject(argument) { // eslint-disable-line no-unused-vars
333 if (argument === null || argument === undefined) {
336 return Object(argument);
340 /* global ToObject */
342 function GetV(v, p) { // eslint-disable-line no-unused-vars
343 // 1. Assert: IsPropertyKey(P) is true.
344 // 2. Let O be ? ToObject(V).
346 // 3. Return ? O.[[Get]](P, V).
350 // _ESAbstract.GetMethod
351 /* global GetV, IsCallable */
352 // 7.3.9. GetMethod ( V, P )
353 function GetMethod(V, P) { // eslint-disable-line no-unused-vars
354 // 1. Assert: IsPropertyKey(P) is true.
355 // 2. Let func be ? GetV(V, P).
356 var func = GetV(V, P);
357 // 3. If func is either undefined or null, return undefined.
358 if (func === null || func === undefined) {
361 // 4. If IsCallable(func) is false, throw a TypeError exception.
362 if (IsCallable(func) === false) {
363 throw new TypeError('Method not callable: ' + P);
369 // _ESAbstract.ToUint32
370 // 7.1.6. ToUint32 ( argument )
371 function ToUint32(argument) { // eslint-disable-line no-unused-vars
372 // 1. Let number be ? ToNumber(argument).
373 var number = Number(argument);
374 // 2. If number is NaN, +0, -0, +∞, or -∞, return +0.
375 if (isNaN(number) || 1/number === Infinity || 1/number === -Infinity || number === Infinity || number === -Infinity) {
378 // 3. Let int be the mathematical value that is the same sign as number and whose magnitude is floor(abs(number)).
379 var int = ((number < 0) ? -1 : 1) * Math.floor(Math.abs(number));
380 // 4. Let int32bit be int modulo 2^32.
381 var int32bit = int >>> 0;
382 // 5. Return int32bit.
387 // "Type(x)" is used as shorthand for "the type of x"...
388 function Type(x) { // eslint-disable-line no-unused-vars
401 // typeof null is 'object'
402 if (x === null) return 'null';
403 // Polyfill.io - This is here because a Symbol polyfill will have a typeof `object`.
404 if ('Symbol' in this && x instanceof this.Symbol) return 'symbol';
409 // _ESAbstract.GetPrototypeFromConstructor
410 /* global Get, Type */
411 // 9.1.14. GetPrototypeFromConstructor ( constructor, intrinsicDefaultProto )
412 function GetPrototypeFromConstructor(constructor, intrinsicDefaultProto) { // eslint-disable-line no-unused-vars
413 // 1. Assert: intrinsicDefaultProto is a String value that is this specification's name of an intrinsic object. The corresponding object must be an intrinsic that is intended to be used as the [[Prototype]] value of an object.
414 // 2. Assert: IsCallable(constructor) is true.
415 // 3. Let proto be ? Get(constructor, "prototype").
416 var proto = Get(constructor, "prototype");
417 // 4. If Type(proto) is not Object, then
418 if (Type(proto) !== 'object') {
419 // a. Let realm be ? GetFunctionRealm(constructor).
420 // b. Set proto to realm's intrinsic object named intrinsicDefaultProto.
421 proto = intrinsicDefaultProto;
427 // _ESAbstract.IsConstructor
429 // 7.2.4. IsConstructor ( argument )
430 function IsConstructor(argument) { // eslint-disable-line no-unused-vars
431 // 1. If Type(argument) is not Object, return false.
432 if (Type(argument) !== 'object') {
435 // 2. If argument has a [[Construct]] internal method, return true.
438 // Polyfill.io - `new argument` is the only way to truly test if a function is a constructor.
439 // We choose to not use`new argument` because the argument could have side effects when called.
440 // Instead we check to see if the argument is a function and if it has a prototype.
441 // Arrow functions do not have a [[Construct]] internal method, nor do they have a prototype.
442 return typeof argument === 'function' && !!argument.prototype;
445 // _ESAbstract.IsRegExp
446 /* global Type, Get, ToBoolean */
447 // 7.2.8. IsRegExp ( argument )
448 function IsRegExp(argument) { // eslint-disable-line no-unused-vars
449 // 1. If Type(argument) is not Object, return false.
450 if (Type(argument) !== 'object') {
453 // 2. Let matcher be ? Get(argument, @@match).
454 var matcher = 'Symbol' in this && 'match' in this.Symbol ? Get(argument, this.Symbol.match) : undefined;
455 // 3. If matcher is not undefined, return ToBoolean(matcher).
456 if (matcher !== undefined) {
457 return ToBoolean(matcher);
459 // 4. If argument has a [[RegExpMatcher]] internal slot, return true.
461 var lastIndex = argument.lastIndex;
462 argument.lastIndex = 0;
463 RegExp.prototype.exec.call(argument);
465 } catch (e) {} finally {
466 argument.lastIndex = lastIndex;
472 // _ESAbstract.IteratorClose
473 /* global GetMethod, Type, Call */
474 // 7.4.6. IteratorClose ( iteratorRecord, completion )
475 function IteratorClose(iteratorRecord, completion) { // eslint-disable-line no-unused-vars
476 // 1. Assert: Type(iteratorRecord.[[Iterator]]) is Object.
477 if (Type(iteratorRecord['[[Iterator]]']) !== 'object') {
478 throw new Error(Object.prototype.toString.call(iteratorRecord['[[Iterator]]']) + 'is not an Object.');
480 // 2. Assert: completion is a Completion Record.
481 // Polyfill.io - Ignoring this step as there is no way to check if something is a Completion Record in userland JavaScript.
483 // 3. Let iterator be iteratorRecord.[[Iterator]].
484 var iterator = iteratorRecord['[[Iterator]]'];
485 // 4. Let return be ? GetMethod(iterator, "return").
486 // Polyfill.io - We name it returnMethod because return is a keyword and can not be used as an identifier (E.G. variable name, function name etc).
487 var returnMethod = GetMethod(iterator, "return");
488 // 5. If return is undefined, return Completion(completion).
489 if (returnMethod === undefined) {
492 // 6. Let innerResult be Call(return, iterator, « »).
494 var innerResult = Call(returnMethod, iterator);
496 var innerException = error;
498 // 7. If completion.[[Type]] is throw, return Completion(completion).
502 // 8. If innerResult.[[Type]] is throw, return Completion(innerResult).
503 if (innerException) {
504 throw innerException;
506 // 9. If Type(innerResult.[[Value]]) is not Object, throw a TypeError exception.
507 if (Type(innerResult) !== 'object') {
508 throw new TypeError("Iterator's return method returned a non-object.");
510 // 10. Return Completion(completion).
514 // _ESAbstract.IteratorComplete
515 /* global Type, ToBoolean, Get */
516 // 7.4.3 IteratorComplete ( iterResult )
517 function IteratorComplete(iterResult) { // eslint-disable-line no-unused-vars
518 // 1. Assert: Type(iterResult) is Object.
519 if (Type(iterResult) !== 'object') {
520 throw new Error(Object.prototype.toString.call(iterResult) + 'is not an Object.');
522 // 2. Return ToBoolean(? Get(iterResult, "done")).
523 return ToBoolean(Get(iterResult, "done"));
526 // _ESAbstract.IteratorNext
527 /* global Call, Type */
528 // 7.4.2. IteratorNext ( iteratorRecord [ , value ] )
529 function IteratorNext(iteratorRecord /* [, value] */) { // eslint-disable-line no-unused-vars
530 // 1. If value is not present, then
531 if (arguments.length < 2) {
532 // a. Let result be ? Call(iteratorRecord.[[NextMethod]], iteratorRecord.[[Iterator]], « »).
533 var result = Call(iteratorRecord['[[NextMethod]]'], iteratorRecord['[[Iterator]]']);
536 // a. Let result be ? Call(iteratorRecord.[[NextMethod]], iteratorRecord.[[Iterator]], « value »).
537 result = Call(iteratorRecord['[[NextMethod]]'], iteratorRecord['[[Iterator]]'], [arguments[1]]);
539 // 3. If Type(result) is not Object, throw a TypeError exception.
540 if (Type(result) !== 'object') {
541 throw new TypeError('bad iterator');
547 // _ESAbstract.IteratorStep
548 /* global IteratorNext, IteratorComplete */
549 // 7.4.5. IteratorStep ( iteratorRecord )
550 function IteratorStep(iteratorRecord) { // eslint-disable-line no-unused-vars
551 // 1. Let result be ? IteratorNext(iteratorRecord).
552 var result = IteratorNext(iteratorRecord);
553 // 2. Let done be ? IteratorComplete(result).
554 var done = IteratorComplete(result);
555 // 3. If done is true, return false.
563 // _ESAbstract.IteratorValue
564 /* global Type, Get */
565 // 7.4.4 IteratorValue ( iterResult )
566 function IteratorValue(iterResult) { // eslint-disable-line no-unused-vars
567 // Assert: Type(iterResult) is Object.
568 if (Type(iterResult) !== 'object') {
569 throw new Error(Object.prototype.toString.call(iterResult) + 'is not an Object.');
571 // Return ? Get(iterResult, "value").
572 return Get(iterResult, "value");
575 // _ESAbstract.OrdinaryToPrimitive
576 /* global Get, IsCallable, Call, Type */
577 // 7.1.1.1. OrdinaryToPrimitive ( O, hint )
578 function OrdinaryToPrimitive(O, hint) { // eslint-disable-line no-unused-vars
579 // 1. Assert: Type(O) is Object.
580 // 2. Assert: Type(hint) is String and its value is either "string" or "number".
581 // 3. If hint is "string", then
582 if (hint === 'string') {
583 // a. Let methodNames be « "toString", "valueOf" ».
584 var methodNames = ['toString', 'valueOf'];
587 // a. Let methodNames be « "valueOf", "toString" ».
588 methodNames = ['valueOf', 'toString'];
590 // 5. For each name in methodNames in List order, do
591 for (var i = 0; i < methodNames.length; ++i) {
592 var name = methodNames[i];
593 // a. Let method be ? Get(O, name).
594 var method = Get(O, name);
595 // b. If IsCallable(method) is true, then
596 if (IsCallable(method)) {
597 // i. Let result be ? Call(method, O).
598 var result = Call(method, O);
599 // ii. If Type(result) is not Object, return result.
600 if (Type(result) !== 'object') {
605 // 6. Throw a TypeError exception.
606 throw new TypeError('Cannot convert to primitive.');
609 // _ESAbstract.SameValue
610 /* global Type, SameValueNonNumber */
611 // 7.2.10. SameValue ( x, y )
612 function SameValue(x, y) { // eslint-disable-line no-unused-vars
613 // 1. If Type(x) is different from Type(y), return false.
614 if (Type(x) !== Type(y)) {
617 // 2. If Type(x) is Number, then
618 if (Type(x) === 'number') {
619 // a. If x is NaN and y is NaN, return true.
620 if (isNaN(x) && isNaN(y)) {
623 // Polyfill.io - 0 === -0 is true, but they are not the same value.
624 // b. If x is +0 and y is -0, return false.
625 // c. If x is -0 and y is +0, return false.
626 if (x === 0 && y === 0 && 1/x !== 1/y) {
629 // d. If x is the same Number value as y, return true.
636 // 3. Return SameValueNonNumber(x, y).
637 return SameValueNonNumber(x, y);
640 // _ESAbstract.SameValueZero
641 /* global Type, SameValueNonNumber */
642 // 7.2.11. SameValueZero ( x, y )
643 function SameValueZero (x, y) { // eslint-disable-line no-unused-vars
644 // 1. If Type(x) is different from Type(y), return false.
645 if (Type(x) !== Type(y)) {
648 // 2. If Type(x) is Number, then
649 if (Type(x) === 'number') {
650 // a. If x is NaN and y is NaN, return true.
651 if (isNaN(x) && isNaN(y)) {
654 // b. If x is +0 and y is -0, return true.
655 if (1/x === Infinity && 1/y === -Infinity) {
658 // c. If x is -0 and y is +0, return true.
659 if (1/x === -Infinity && 1/y === Infinity) {
662 // d. If x is the same Number value as y, return true.
669 // 3. Return SameValueNonNumber(x, y).
670 return SameValueNonNumber(x, y);
673 // _ESAbstract.ToPrimitive
674 /* global Type, GetMethod, Call, OrdinaryToPrimitive */
675 // 7.1.1. ToPrimitive ( input [ , PreferredType ] )
676 function ToPrimitive(input /* [, PreferredType] */) { // eslint-disable-line no-unused-vars
677 var PreferredType = arguments.length > 1 ? arguments[1] : undefined;
678 // 1. Assert: input is an ECMAScript language value.
679 // 2. If Type(input) is Object, then
680 if (Type(input) === 'object') {
681 // a. If PreferredType is not present, let hint be "default".
682 if (arguments.length < 2) {
683 var hint = 'default';
684 // b. Else if PreferredType is hint String, let hint be "string".
685 } else if (PreferredType === String) {
687 // c. Else PreferredType is hint Number, let hint be "number".
688 } else if (PreferredType === Number) {
691 // d. Let exoticToPrim be ? GetMethod(input, @@toPrimitive).
692 var exoticToPrim = typeof this.Symbol === 'function' && typeof this.Symbol.toPrimitive === 'symbol' ? GetMethod(input, this.Symbol.toPrimitive) : undefined;
693 // e. If exoticToPrim is not undefined, then
694 if (exoticToPrim !== undefined) {
695 // i. Let result be ? Call(exoticToPrim, input, « hint »).
696 var result = Call(exoticToPrim, input, [hint]);
697 // ii. If Type(result) is not Object, return result.
698 if (Type(result) !== 'object') {
701 // iii. Throw a TypeError exception.
702 throw new TypeError('Cannot convert exotic object to primitive.');
704 // f. If hint is "default", set hint to "number".
705 if (hint === 'default') {
708 // g. Return ? OrdinaryToPrimitive(input, hint).
709 return OrdinaryToPrimitive(input, hint);
715 // _ESAbstract.ToString
716 /* global Type, ToPrimitive */
717 // 7.1.12. ToString ( argument )
718 // The abstract operation ToString converts argument to a value of type String according to Table 11:
719 // Table 11: ToString Conversions
721 |---------------|--------------------------------------------------------|
722 | Argument Type | Result |
723 |---------------|--------------------------------------------------------|
724 | Undefined | Return "undefined". |
725 |---------------|--------------------------------------------------------|
726 | Null | Return "null". |
727 |---------------|--------------------------------------------------------|
728 | Boolean | If argument is true, return "true". |
729 | | If argument is false, return "false". |
730 |---------------|--------------------------------------------------------|
731 | Number | Return NumberToString(argument). |
732 |---------------|--------------------------------------------------------|
733 | String | Return argument. |
734 |---------------|--------------------------------------------------------|
735 | Symbol | Throw a TypeError exception. |
736 |---------------|--------------------------------------------------------|
737 | Object | Apply the following steps: |
738 | | Let primValue be ? ToPrimitive(argument, hint String). |
739 | | Return ? ToString(primValue). |
740 |---------------|--------------------------------------------------------|
742 function ToString(argument) { // eslint-disable-line no-unused-vars
743 switch(Type(argument)) {
745 throw new TypeError('Cannot convert a Symbol value to a string');
748 var primValue = ToPrimitive(argument, 'string');
749 return ToString(primValue);
751 return String(argument);
755 // _ESAbstract.UTF16Decode
756 // 10.1.2. Static Semantics: UTF16Decode( lead, trail )
757 function UTF16Decode(lead, trail) { // eslint-disable-line no-unused-vars
758 // 1. Assert: 0xD800 ≤ lead ≤ 0xDBFF and 0xDC00 ≤ trail ≤ 0xDFFF.
759 // 2. Let cp be (lead - 0xD800) × 0x400 + (trail - 0xDC00) + 0x10000.
760 var cp = (lead - 0xD800) * 0x400 + (trail - 0xDC00) + 0x10000;
761 // 3. Return the code point cp.
765 // _ESAbstract.UTF16Encoding
766 // 10.1.1. Static Semantics: UTF16Encoding ( cp )
767 function UTF16Encoding(cp) { // eslint-disable-line no-unused-vars
768 // 1. Assert: 0 ≤ cp ≤ 0x10FFFF.
769 // 2. If cp ≤ 0xFFFF, return cp.
773 // 3. Let cu1 be floor((cp - 0x10000) / 0x400) + 0xD800.
774 var cu1 = Math.floor((cp - 0x10000) / 0x400) + 0xD800;
775 // 4. Let cu2 be ((cp - 0x10000) modulo 0x400) + 0xDC00.
776 var cu2 = ((cp - 0x10000) % 0x400) + 0xDC00;
777 // 5. Return the code unit sequence consisting of cu1 followed by cu2.
784 Copyright (c) 2010, Linden Research, Inc.
785 Copyright (c) 2014, Joshua Bell
787 Permission is hereby granted, free of charge, to any person obtaining a copy
788 of this software and associated documentation files (the "Software"), to deal
789 in the Software without restriction, including without limitation the rights
790 to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
791 copies of the Software, and to permit persons to whom the Software is
792 furnished to do so, subject to the following conditions:
794 The above copyright notice and this permission notice shall be included in
795 all copies or substantial portions of the Software.
797 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
798 IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
799 FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
800 AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
801 LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
802 OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
807 // Original can be found at:
808 // https://bitbucket.org/lindenlab/llsd
809 // Modifications by Joshua Bell inexorabletash@gmail.com
810 // https://github.com/inexorabletash/polyfill
812 // ES3/ES5 implementation of the Krhonos Typed Array Specification
813 // Ref: http://www.khronos.org/registry/typedarray/specs/latest/
817 // * Allows typed_array.get/set() as alias for subscripts (typed_array[])
818 // * Gradually migrating structure from Khronos spec to ES2015 spec
821 // * Beyond 10000 or so entries, polyfilled array accessors (ta[0],
822 // etc) become memory-prohibitive, so array creation will fail. Set
823 // self.TYPED_ARRAY_POLYFILL_NO_ARRAY_ACCESSORS=true to disable
824 // creation of accessors. Your code will need to use the
825 // non-standard get()/set() instead, and will need to add those to
826 // native arrays for interop.
829 var undefined = (void 0); // Paranoia
831 // Beyond this value, index getters/setters (i.e. array[0], array[1]) are so slow to
832 // create, and consume so much memory, that the browser appears frozen.
833 var MAX_ARRAY_LENGTH = 1e5;
835 // Approximations of internal ECMAScript conversion functions
838 case 'undefined': return 'undefined';
839 case 'boolean': return 'boolean';
840 case 'number': return 'number';
841 case 'string': return 'string';
842 default: return v === null ? 'null' : 'object';
846 // Class returns internal [[Class]] property, used to avoid cross-frame instanceof issues:
847 function Class(v) { return Object.prototype.toString.call(v).replace(/^\[object *|\]$/g, ''); }
848 function IsCallable(o) { return typeof o === 'function'; }
849 function ToObject(v) {
850 if (v === null || v === undefined) throw TypeError();
853 function ToInt32(v) { return v >> 0; }
854 function ToUint32(v) { return v >>> 0; }
856 // Snapshot intrinsics
866 // emulate ES5 getter/setter API using legacy APIs
867 // http://blogs.msdn.com/b/ie/archive/2010/09/07/transitioning-existing-code-to-the-es5-getter-setter-apis.aspx
868 // (second clause tests for Object.defineProperty() in IE<9 that only supports extending DOM prototypes, but
869 // note that IE<9 does not support __defineGetter__ or __defineSetter__ so it just renders the method harmless)
872 var orig = Object.defineProperty;
873 var dom_only = !(function(){try{return Object.defineProperty({},'x',{});}catch(_){return false;}}());
875 if (!orig || dom_only) {
876 Object.defineProperty = function (o, prop, desc) {
877 // In IE8 try built-in implementation for defining properties on DOM prototypes.
879 try { return orig(o, prop, desc); } catch (_) {}
881 throw TypeError('Object.defineProperty called on non-object');
882 if (Object.prototype.__defineGetter__ && ('get' in desc))
883 Object.prototype.__defineGetter__.call(o, prop, desc.get);
884 if (Object.prototype.__defineSetter__ && ('set' in desc))
885 Object.prototype.__defineSetter__.call(o, prop, desc.set);
887 o[prop] = desc.value;
893 // ES5: Make obj[index] an alias for obj._getter(index)/obj._setter(index, value)
894 // for index in 0 ... obj.length
895 function makeArrayAccessors(obj) {
896 if ('TYPED_ARRAY_POLYFILL_NO_ARRAY_ACCESSORS' in global)
899 if (obj.length > MAX_ARRAY_LENGTH) throw RangeError('Array too large for polyfill');
901 function makeArrayAccessor(index) {
902 Object.defineProperty(obj, index, {
903 'get': function() { return obj._getter(index); },
904 'set': function(v) { obj._setter(index, v); },
911 for (i = 0; i < obj.length; i += 1) {
912 makeArrayAccessor(i);
916 // Internal conversion functions:
917 // pack<Type>() - take a number (interpreted as Type), output a byte array
918 // unpack<Type>() - take a byte array, output a Type-like number
920 function as_signed(value, bits) { var s = 32 - bits; return (value << s) >> s; }
921 function as_unsigned(value, bits) { var s = 32 - bits; return (value << s) >>> s; }
923 function packI8(n) { return [n & 0xff]; }
924 function unpackI8(bytes) { return as_signed(bytes[0], 8); }
926 function packU8(n) { return [n & 0xff]; }
927 function unpackU8(bytes) { return as_unsigned(bytes[0], 8); }
929 function packU8Clamped(n) { n = round(Number(n)); return [n < 0 ? 0 : n > 0xff ? 0xff : n & 0xff]; }
931 function packI16(n) { return [n & 0xff, (n >> 8) & 0xff]; }
932 function unpackI16(bytes) { return as_signed(bytes[1] << 8 | bytes[0], 16); }
934 function packU16(n) { return [n & 0xff, (n >> 8) & 0xff]; }
935 function unpackU16(bytes) { return as_unsigned(bytes[1] << 8 | bytes[0], 16); }
937 function packI32(n) { return [n & 0xff, (n >> 8) & 0xff, (n >> 16) & 0xff, (n >> 24) & 0xff]; }
938 function unpackI32(bytes) { return as_signed(bytes[3] << 24 | bytes[2] << 16 | bytes[1] << 8 | bytes[0], 32); }
940 function packU32(n) { return [n & 0xff, (n >> 8) & 0xff, (n >> 16) & 0xff, (n >> 24) & 0xff]; }
941 function unpackU32(bytes) { return as_unsigned(bytes[3] << 24 | bytes[2] << 16 | bytes[1] << 8 | bytes[0], 32); }
943 function packIEEE754(v, ebits, fbits) {
945 var bias = (1 << (ebits - 1)) - 1;
947 function roundToEven(n) {
948 var w = floor(n), f = n - w;
953 return w % 2 ? w + 1 : w;
956 // Compute sign, exponent, fraction
960 // http://dev.w3.org/2006/webapi/WebIDL/#es-type-mapping
961 e = (1 << ebits) - 1; f = pow(2, fbits - 1); s = 0;
962 } else if (v === Infinity || v === -Infinity) {
963 e = (1 << ebits) - 1; f = 0; s = (v < 0) ? 1 : 0;
964 } else if (v === 0) {
965 e = 0; f = 0; s = (1 / v === -Infinity) ? 1 : 0;
970 if (v >= pow(2, 1 - bias)) {
972 e = min(floor(log(v) / LN2), 1023);
973 var significand = v / pow(2, e);
974 if (significand < 1) {
978 if (significand >= 2) {
982 var d = pow(2, fbits);
983 f = roundToEven(significand * d) - d;
991 e = (1 << ebits) - 1;
997 f = roundToEven(v / pow(2, 1 - bias - fbits));
1001 // Pack sign, exponent, fraction
1003 for (i = fbits; i; i -= 1) { bits.push(f % 2 ? 1 : 0); f = floor(f / 2); }
1004 for (i = ebits; i; i -= 1) { bits.push(e % 2 ? 1 : 0); e = floor(e / 2); }
1005 bits.push(s ? 1 : 0);
1007 var str = bits.join('');
1011 while (str.length) {
1012 bytes.unshift(parseInt(str.substring(0, 8), 2));
1013 str = str.substring(8);
1018 function unpackIEEE754(bytes, ebits, fbits) {
1020 var bits = [], i, j, b, str,
1023 for (i = 0; i < bytes.length; ++i) {
1025 for (j = 8; j; j -= 1) {
1026 bits.push(b % 2 ? 1 : 0); b = b >> 1;
1030 str = bits.join('');
1032 // Unpack sign, exponent, fraction
1033 bias = (1 << (ebits - 1)) - 1;
1034 s = parseInt(str.substring(0, 1), 2) ? -1 : 1;
1035 e = parseInt(str.substring(1, 1 + ebits), 2);
1036 f = parseInt(str.substring(1 + ebits), 2);
1039 if (e === (1 << ebits) - 1) {
1040 return f !== 0 ? NaN : s * Infinity;
1043 return s * pow(2, e - bias) * (1 + f / pow(2, fbits));
1044 } else if (f !== 0) {
1046 return s * pow(2, -(bias - 1)) * (f / pow(2, fbits));
1048 return s < 0 ? -0 : 0;
1052 function unpackF64(b) { return unpackIEEE754(b, 11, 52); }
1053 function packF64(v) { return packIEEE754(v, 11, 52); }
1054 function unpackF32(b) { return unpackIEEE754(b, 8, 23); }
1055 function packF32(v) { return packIEEE754(v, 8, 23); }
1058 // 3 The ArrayBuffer Type
1063 function ArrayBuffer(length) {
1064 length = ToInt32(length);
1065 if (length < 0) throw RangeError('ArrayBuffer size is not a small enough positive integer.');
1066 Object.defineProperty(this, 'byteLength', {value: length});
1067 Object.defineProperty(this, '_bytes', {value: Array(length)});
1069 for (var i = 0; i < length; i += 1)
1073 global.ArrayBuffer = global.ArrayBuffer || ArrayBuffer;
1076 // 5 The Typed Array View Types
1079 function $TypedArray$() {
1081 // %TypedArray% ( length )
1082 if (!arguments.length || typeof arguments[0] !== 'object') {
1083 return (function(length) {
1084 length = ToInt32(length);
1085 if (length < 0) throw RangeError('length is not a small enough positive integer.');
1086 Object.defineProperty(this, 'length', {value: length});
1087 Object.defineProperty(this, 'byteLength', {value: length * this.BYTES_PER_ELEMENT});
1088 Object.defineProperty(this, 'buffer', {value: new ArrayBuffer(this.byteLength)});
1089 Object.defineProperty(this, 'byteOffset', {value: 0});
1091 }).apply(this, arguments);
1094 // %TypedArray% ( typedArray )
1095 if (arguments.length >= 1 &&
1096 Type(arguments[0]) === 'object' &&
1097 arguments[0] instanceof $TypedArray$) {
1098 return (function(typedArray){
1099 if (this.constructor !== typedArray.constructor) throw TypeError();
1101 var byteLength = typedArray.length * this.BYTES_PER_ELEMENT;
1102 Object.defineProperty(this, 'buffer', {value: new ArrayBuffer(byteLength)});
1103 Object.defineProperty(this, 'byteLength', {value: byteLength});
1104 Object.defineProperty(this, 'byteOffset', {value: 0});
1105 Object.defineProperty(this, 'length', {value: typedArray.length});
1107 for (var i = 0; i < this.length; i += 1)
1108 this._setter(i, typedArray._getter(i));
1110 }).apply(this, arguments);
1113 // %TypedArray% ( array )
1114 if (arguments.length >= 1 &&
1115 Type(arguments[0]) === 'object' &&
1116 !(arguments[0] instanceof $TypedArray$) &&
1117 !(arguments[0] instanceof ArrayBuffer || Class(arguments[0]) === 'ArrayBuffer')) {
1118 return (function(array) {
1120 var byteLength = array.length * this.BYTES_PER_ELEMENT;
1121 Object.defineProperty(this, 'buffer', {value: new ArrayBuffer(byteLength)});
1122 Object.defineProperty(this, 'byteLength', {value: byteLength});
1123 Object.defineProperty(this, 'byteOffset', {value: 0});
1124 Object.defineProperty(this, 'length', {value: array.length});
1126 for (var i = 0; i < this.length; i += 1) {
1128 this._setter(i, Number(s));
1130 }).apply(this, arguments);
1133 // %TypedArray% ( buffer, byteOffset=0, length=undefined )
1134 if (arguments.length >= 1 &&
1135 Type(arguments[0]) === 'object' &&
1136 (arguments[0] instanceof ArrayBuffer || Class(arguments[0]) === 'ArrayBuffer')) {
1137 return (function(buffer, byteOffset, length) {
1139 byteOffset = ToUint32(byteOffset);
1140 if (byteOffset > buffer.byteLength)
1141 throw RangeError('byteOffset out of range');
1143 // The given byteOffset must be a multiple of the element
1144 // size of the specific type, otherwise an exception is raised.
1145 if (byteOffset % this.BYTES_PER_ELEMENT)
1146 throw RangeError('buffer length minus the byteOffset is not a multiple of the element size.');
1148 if (length === undefined) {
1149 var byteLength = buffer.byteLength - byteOffset;
1150 if (byteLength % this.BYTES_PER_ELEMENT)
1151 throw RangeError('length of buffer minus byteOffset not a multiple of the element size');
1152 length = byteLength / this.BYTES_PER_ELEMENT;
1155 length = ToUint32(length);
1156 byteLength = length * this.BYTES_PER_ELEMENT;
1159 if ((byteOffset + byteLength) > buffer.byteLength)
1160 throw RangeError('byteOffset and length reference an area beyond the end of the buffer');
1162 Object.defineProperty(this, 'buffer', {value: buffer});
1163 Object.defineProperty(this, 'byteLength', {value: byteLength});
1164 Object.defineProperty(this, 'byteOffset', {value: byteOffset});
1165 Object.defineProperty(this, 'length', {value: length});
1167 }).apply(this, arguments);
1170 // %TypedArray% ( all other argument combinations )
1174 // Properties of the %TypedArray Instrinsic Object
1176 // %TypedArray%.from ( source , mapfn=undefined, thisArg=undefined )
1177 Object.defineProperty($TypedArray$, 'from', {value: function(iterable) {
1178 return new this(iterable);
1181 // %TypedArray%.of ( ...items )
1182 Object.defineProperty($TypedArray$, 'of', {value: function(/*...items*/) {
1183 return new this(arguments);
1186 // %TypedArray%.prototype
1187 var $TypedArrayPrototype$ = {};
1188 $TypedArray$.prototype = $TypedArrayPrototype$;
1190 // WebIDL: getter type (unsigned long index);
1191 Object.defineProperty($TypedArray$.prototype, '_getter', {value: function(index) {
1192 if (arguments.length < 1) throw SyntaxError('Not enough arguments');
1194 index = ToUint32(index);
1195 if (index >= this.length)
1198 var bytes = [], i, o;
1199 for (i = 0, o = this.byteOffset + index * this.BYTES_PER_ELEMENT;
1200 i < this.BYTES_PER_ELEMENT;
1202 bytes.push(this.buffer._bytes[o]);
1204 return this._unpack(bytes);
1207 // NONSTANDARD: convenience alias for getter: type get(unsigned long index);
1208 Object.defineProperty($TypedArray$.prototype, 'get', {value: $TypedArray$.prototype._getter});
1210 // WebIDL: setter void (unsigned long index, type value);
1211 Object.defineProperty($TypedArray$.prototype, '_setter', {value: function(index, value) {
1212 if (arguments.length < 2) throw SyntaxError('Not enough arguments');
1214 index = ToUint32(index);
1215 if (index >= this.length)
1218 var bytes = this._pack(value), i, o;
1219 for (i = 0, o = this.byteOffset + index * this.BYTES_PER_ELEMENT;
1220 i < this.BYTES_PER_ELEMENT;
1222 this.buffer._bytes[o] = bytes[i];
1226 // get %TypedArray%.prototype.buffer
1227 // get %TypedArray%.prototype.byteLength
1228 // get %TypedArray%.prototype.byteOffset
1229 // -- applied directly to the object in the constructor
1231 // %TypedArray%.prototype.constructor
1232 Object.defineProperty($TypedArray$.prototype, 'constructor', {value: $TypedArray$});
1234 // %TypedArray%.prototype.copyWithin (target, start, end = this.length )
1235 Object.defineProperty($TypedArray$.prototype, 'copyWithin', {value: function(target, start) {
1236 var end = arguments[2];
1238 var o = ToObject(this);
1239 var lenVal = o.length;
1240 var len = ToUint32(lenVal);
1242 var relativeTarget = ToInt32(target);
1244 if (relativeTarget < 0)
1245 to = max(len + relativeTarget, 0);
1247 to = min(relativeTarget, len);
1248 var relativeStart = ToInt32(start);
1250 if (relativeStart < 0)
1251 from = max(len + relativeStart, 0);
1253 from = min(relativeStart, len);
1255 if (end === undefined)
1258 relativeEnd = ToInt32(end);
1260 if (relativeEnd < 0)
1261 final = max(len + relativeEnd, 0);
1263 final = min(relativeEnd, len);
1264 var count = min(final - from, len - to);
1266 if (from < to && to < from + count) {
1268 from = from + count - 1;
1269 to = to + count - 1;
1274 o._setter(to, o._getter(from));
1275 from = from + direction;
1276 to = to + direction;
1282 // %TypedArray%.prototype.entries ( )
1283 // -- defined in es6.js to shim browsers w/ native TypedArrays
1285 // %TypedArray%.prototype.every ( callbackfn, thisArg = undefined )
1286 Object.defineProperty($TypedArray$.prototype, 'every', {value: function(callbackfn) {
1287 if (this === undefined || this === null) throw TypeError();
1288 var t = Object(this);
1289 var len = ToUint32(t.length);
1290 if (!IsCallable(callbackfn)) throw TypeError();
1291 var thisArg = arguments[1];
1292 for (var i = 0; i < len; i++) {
1293 if (!callbackfn.call(thisArg, t._getter(i), i, t))
1299 // %TypedArray%.prototype.fill (value, start = 0, end = this.length )
1300 Object.defineProperty($TypedArray$.prototype, 'fill', {value: function(value) {
1301 var start = arguments[1],
1304 var o = ToObject(this);
1305 var lenVal = o.length;
1306 var len = ToUint32(lenVal);
1308 var relativeStart = ToInt32(start);
1310 if (relativeStart < 0)
1311 k = max((len + relativeStart), 0);
1313 k = min(relativeStart, len);
1315 if (end === undefined)
1318 relativeEnd = ToInt32(end);
1320 if (relativeEnd < 0)
1321 final = max((len + relativeEnd), 0);
1323 final = min(relativeEnd, len);
1325 o._setter(k, value);
1331 // %TypedArray%.prototype.filter ( callbackfn, thisArg = undefined )
1332 Object.defineProperty($TypedArray$.prototype, 'filter', {value: function(callbackfn) {
1333 if (this === undefined || this === null) throw TypeError();
1334 var t = Object(this);
1335 var len = ToUint32(t.length);
1336 if (!IsCallable(callbackfn)) throw TypeError();
1338 var thisp = arguments[1];
1339 for (var i = 0; i < len; i++) {
1340 var val = t._getter(i); // in case fun mutates this
1341 if (callbackfn.call(thisp, val, i, t))
1344 return new this.constructor(res);
1347 // %TypedArray%.prototype.find (predicate, thisArg = undefined)
1348 Object.defineProperty($TypedArray$.prototype, 'find', {value: function(predicate) {
1349 var o = ToObject(this);
1350 var lenValue = o.length;
1351 var len = ToUint32(lenValue);
1352 if (!IsCallable(predicate)) throw TypeError();
1353 var t = arguments.length > 1 ? arguments[1] : undefined;
1356 var kValue = o._getter(k);
1357 var testResult = predicate.call(t, kValue, k, o);
1358 if (Boolean(testResult))
1365 // %TypedArray%.prototype.findIndex ( predicate, thisArg = undefined )
1366 Object.defineProperty($TypedArray$.prototype, 'findIndex', {value: function(predicate) {
1367 var o = ToObject(this);
1368 var lenValue = o.length;
1369 var len = ToUint32(lenValue);
1370 if (!IsCallable(predicate)) throw TypeError();
1371 var t = arguments.length > 1 ? arguments[1] : undefined;
1374 var kValue = o._getter(k);
1375 var testResult = predicate.call(t, kValue, k, o);
1376 if (Boolean(testResult))
1383 // %TypedArray%.prototype.forEach ( callbackfn, thisArg = undefined )
1384 Object.defineProperty($TypedArray$.prototype, 'forEach', {value: function(callbackfn) {
1385 if (this === undefined || this === null) throw TypeError();
1386 var t = Object(this);
1387 var len = ToUint32(t.length);
1388 if (!IsCallable(callbackfn)) throw TypeError();
1389 var thisp = arguments[1];
1390 for (var i = 0; i < len; i++)
1391 callbackfn.call(thisp, t._getter(i), i, t);
1394 // %TypedArray%.prototype.indexOf (searchElement, fromIndex = 0 )
1395 Object.defineProperty($TypedArray$.prototype, 'indexOf', {value: function(searchElement) {
1396 if (this === undefined || this === null) throw TypeError();
1397 var t = Object(this);
1398 var len = ToUint32(t.length);
1399 if (len === 0) return -1;
1401 if (arguments.length > 0) {
1402 n = Number(arguments[1]);
1405 } else if (n !== 0 && n !== (1 / 0) && n !== -(1 / 0)) {
1406 n = (n > 0 || -1) * floor(abs(n));
1409 if (n >= len) return -1;
1410 var k = n >= 0 ? n : max(len - abs(n), 0);
1411 for (; k < len; k++) {
1412 if (t._getter(k) === searchElement) {
1419 // %TypedArray%.prototype.join ( separator )
1420 Object.defineProperty($TypedArray$.prototype, 'join', {value: function(separator) {
1421 if (this === undefined || this === null) throw TypeError();
1422 var t = Object(this);
1423 var len = ToUint32(t.length);
1424 var tmp = Array(len);
1425 for (var i = 0; i < len; ++i)
1426 tmp[i] = t._getter(i);
1427 return tmp.join(separator === undefined ? ',' : separator); // Hack for IE7
1430 // %TypedArray%.prototype.keys ( )
1431 // -- defined in es6.js to shim browsers w/ native TypedArrays
1433 // %TypedArray%.prototype.lastIndexOf ( searchElement, fromIndex = this.length-1 )
1434 Object.defineProperty($TypedArray$.prototype, 'lastIndexOf', {value: function(searchElement) {
1435 if (this === undefined || this === null) throw TypeError();
1436 var t = Object(this);
1437 var len = ToUint32(t.length);
1438 if (len === 0) return -1;
1440 if (arguments.length > 1) {
1441 n = Number(arguments[1]);
1444 } else if (n !== 0 && n !== (1 / 0) && n !== -(1 / 0)) {
1445 n = (n > 0 || -1) * floor(abs(n));
1448 var k = n >= 0 ? min(n, len - 1) : len - abs(n);
1449 for (; k >= 0; k--) {
1450 if (t._getter(k) === searchElement)
1456 // get %TypedArray%.prototype.length
1457 // -- applied directly to the object in the constructor
1459 // %TypedArray%.prototype.map ( callbackfn, thisArg = undefined )
1460 Object.defineProperty($TypedArray$.prototype, 'map', {value: function(callbackfn) {
1461 if (this === undefined || this === null) throw TypeError();
1462 var t = Object(this);
1463 var len = ToUint32(t.length);
1464 if (!IsCallable(callbackfn)) throw TypeError();
1465 var res = []; res.length = len;
1466 var thisp = arguments[1];
1467 for (var i = 0; i < len; i++)
1468 res[i] = callbackfn.call(thisp, t._getter(i), i, t);
1469 return new this.constructor(res);
1472 // %TypedArray%.prototype.reduce ( callbackfn [, initialValue] )
1473 Object.defineProperty($TypedArray$.prototype, 'reduce', {value: function(callbackfn) {
1474 if (this === undefined || this === null) throw TypeError();
1475 var t = Object(this);
1476 var len = ToUint32(t.length);
1477 if (!IsCallable(callbackfn)) throw TypeError();
1478 // no value to return if no initial value and an empty array
1479 if (len === 0 && arguments.length === 1) throw TypeError();
1482 if (arguments.length >= 2) {
1483 accumulator = arguments[1];
1485 accumulator = t._getter(k++);
1488 accumulator = callbackfn.call(undefined, accumulator, t._getter(k), k, t);
1494 // %TypedArray%.prototype.reduceRight ( callbackfn [, initialValue] )
1495 Object.defineProperty($TypedArray$.prototype, 'reduceRight', {value: function(callbackfn) {
1496 if (this === undefined || this === null) throw TypeError();
1497 var t = Object(this);
1498 var len = ToUint32(t.length);
1499 if (!IsCallable(callbackfn)) throw TypeError();
1500 // no value to return if no initial value, empty array
1501 if (len === 0 && arguments.length === 1) throw TypeError();
1504 if (arguments.length >= 2) {
1505 accumulator = arguments[1];
1507 accumulator = t._getter(k--);
1510 accumulator = callbackfn.call(undefined, accumulator, t._getter(k), k, t);
1516 // %TypedArray%.prototype.reverse ( )
1517 Object.defineProperty($TypedArray$.prototype, 'reverse', {value: function() {
1518 if (this === undefined || this === null) throw TypeError();
1519 var t = Object(this);
1520 var len = ToUint32(t.length);
1521 var half = floor(len / 2);
1522 for (var i = 0, j = len - 1; i < half; ++i, --j) {
1523 var tmp = t._getter(i);
1524 t._setter(i, t._getter(j));
1530 // %TypedArray%.prototype.set(array, offset = 0 )
1531 // %TypedArray%.prototype.set(typedArray, offset = 0 )
1532 // WebIDL: void set(TypedArray array, optional unsigned long offset);
1533 // WebIDL: void set(sequence<type> array, optional unsigned long offset);
1534 Object.defineProperty($TypedArray$.prototype, 'set', {value: function(index, value) {
1535 if (arguments.length < 1) throw SyntaxError('Not enough arguments');
1536 var array, sequence, offset, len,
1538 byteOffset, byteLength, tmp;
1540 if (typeof arguments[0] === 'object' && arguments[0].constructor === this.constructor) {
1541 // void set(TypedArray array, optional unsigned long offset);
1542 array = arguments[0];
1543 offset = ToUint32(arguments[1]);
1545 if (offset + array.length > this.length) {
1546 throw RangeError('Offset plus length of array is out of range');
1549 byteOffset = this.byteOffset + offset * this.BYTES_PER_ELEMENT;
1550 byteLength = array.length * this.BYTES_PER_ELEMENT;
1552 if (array.buffer === this.buffer) {
1554 for (i = 0, s = array.byteOffset; i < byteLength; i += 1, s += 1) {
1555 tmp[i] = array.buffer._bytes[s];
1557 for (i = 0, d = byteOffset; i < byteLength; i += 1, d += 1) {
1558 this.buffer._bytes[d] = tmp[i];
1561 for (i = 0, s = array.byteOffset, d = byteOffset;
1562 i < byteLength; i += 1, s += 1, d += 1) {
1563 this.buffer._bytes[d] = array.buffer._bytes[s];
1566 } else if (typeof arguments[0] === 'object' && typeof arguments[0].length !== 'undefined') {
1567 // void set(sequence<type> array, optional unsigned long offset);
1568 sequence = arguments[0];
1569 len = ToUint32(sequence.length);
1570 offset = ToUint32(arguments[1]);
1572 if (offset + len > this.length) {
1573 throw RangeError('Offset plus length of array is out of range');
1576 for (i = 0; i < len; i += 1) {
1578 this._setter(offset + i, Number(s));
1581 throw TypeError('Unexpected argument type(s)');
1585 // %TypedArray%.prototype.slice ( start, end )
1586 Object.defineProperty($TypedArray$.prototype, 'slice', {value: function(start, end) {
1587 var o = ToObject(this);
1588 var lenVal = o.length;
1589 var len = ToUint32(lenVal);
1590 var relativeStart = ToInt32(start);
1591 var k = (relativeStart < 0) ? max(len + relativeStart, 0) : min(relativeStart, len);
1592 var relativeEnd = (end === undefined) ? len : ToInt32(end);
1593 var final = (relativeEnd < 0) ? max(len + relativeEnd, 0) : min(relativeEnd, len);
1594 var count = final - k;
1595 var c = o.constructor;
1596 var a = new c(count);
1599 var kValue = o._getter(k);
1600 a._setter(n, kValue);
1607 // %TypedArray%.prototype.some ( callbackfn, thisArg = undefined )
1608 Object.defineProperty($TypedArray$.prototype, 'some', {value: function(callbackfn) {
1609 if (this === undefined || this === null) throw TypeError();
1610 var t = Object(this);
1611 var len = ToUint32(t.length);
1612 if (!IsCallable(callbackfn)) throw TypeError();
1613 var thisp = arguments[1];
1614 for (var i = 0; i < len; i++) {
1615 if (callbackfn.call(thisp, t._getter(i), i, t)) {
1622 // %TypedArray%.prototype.sort ( comparefn )
1623 Object.defineProperty($TypedArray$.prototype, 'sort', {value: function(comparefn) {
1624 if (this === undefined || this === null) throw TypeError();
1625 var t = Object(this);
1626 var len = ToUint32(t.length);
1627 var tmp = Array(len);
1628 for (var i = 0; i < len; ++i)
1629 tmp[i] = t._getter(i);
1630 function sortCompare(x, y) {
1631 if (x !== x && y !== y) return +0;
1632 if (x !== x) return 1;
1633 if (y !== y) return -1;
1634 if (comparefn !== undefined) {
1635 return comparefn(x, y);
1637 if (x < y) return -1;
1638 if (x > y) return 1;
1641 tmp.sort(sortCompare);
1642 for (i = 0; i < len; ++i)
1643 t._setter(i, tmp[i]);
1647 // %TypedArray%.prototype.subarray(begin = 0, end = this.length )
1648 // WebIDL: TypedArray subarray(long begin, optional long end);
1649 Object.defineProperty($TypedArray$.prototype, 'subarray', {value: function(start, end) {
1650 function clamp(v, min, max) { return v < min ? min : v > max ? max : v; }
1652 start = ToInt32(start);
1655 if (arguments.length < 1) { start = 0; }
1656 if (arguments.length < 2) { end = this.length; }
1658 if (start < 0) { start = this.length + start; }
1659 if (end < 0) { end = this.length + end; }
1661 start = clamp(start, 0, this.length);
1662 end = clamp(end, 0, this.length);
1664 var len = end - start;
1669 return new this.constructor(
1670 this.buffer, this.byteOffset + start * this.BYTES_PER_ELEMENT, len);
1673 // %TypedArray%.prototype.toLocaleString ( )
1674 // %TypedArray%.prototype.toString ( )
1675 // %TypedArray%.prototype.values ( )
1676 // %TypedArray%.prototype [ @@iterator ] ( )
1677 // get %TypedArray%.prototype [ @@toStringTag ]
1678 // -- defined in es6.js to shim browsers w/ native TypedArrays
1680 function makeTypedArray(elementSize, pack, unpack) {
1681 // Each TypedArray type requires a distinct constructor instance with
1682 // identical logic, which this produces.
1683 var TypedArray = function() {
1684 Object.defineProperty(this, 'constructor', {value: TypedArray});
1685 $TypedArray$.apply(this, arguments);
1686 makeArrayAccessors(this);
1688 if ('__proto__' in TypedArray) {
1689 TypedArray.__proto__ = $TypedArray$;
1691 TypedArray.from = $TypedArray$.from;
1692 TypedArray.of = $TypedArray$.of;
1695 TypedArray.BYTES_PER_ELEMENT = elementSize;
1697 var TypedArrayPrototype = function() {};
1698 TypedArrayPrototype.prototype = $TypedArrayPrototype$;
1700 TypedArray.prototype = new TypedArrayPrototype();
1702 Object.defineProperty(TypedArray.prototype, 'BYTES_PER_ELEMENT', {value: elementSize});
1703 Object.defineProperty(TypedArray.prototype, '_pack', {value: pack});
1704 Object.defineProperty(TypedArray.prototype, '_unpack', {value: unpack});
1709 var Int8Array = makeTypedArray(1, packI8, unpackI8);
1710 var Uint8Array = makeTypedArray(1, packU8, unpackU8);
1711 var Uint8ClampedArray = makeTypedArray(1, packU8Clamped, unpackU8);
1712 var Int16Array = makeTypedArray(2, packI16, unpackI16);
1713 var Uint16Array = makeTypedArray(2, packU16, unpackU16);
1714 var Int32Array = makeTypedArray(4, packI32, unpackI32);
1715 var Uint32Array = makeTypedArray(4, packU32, unpackU32);
1716 var Float32Array = makeTypedArray(4, packF32, unpackF32);
1717 var Float64Array = makeTypedArray(8, packF64, unpackF64);
1719 global.Int8Array = global.Int8Array || Int8Array;
1720 global.Uint8Array = global.Uint8Array || Uint8Array;
1721 global.Uint8ClampedArray = global.Uint8ClampedArray || Uint8ClampedArray;
1722 global.Int16Array = global.Int16Array || Int16Array;
1723 global.Uint16Array = global.Uint16Array || Uint16Array;
1724 global.Int32Array = global.Int32Array || Int32Array;
1725 global.Uint32Array = global.Uint32Array || Uint32Array;
1726 global.Float32Array = global.Float32Array || Float32Array;
1727 global.Float64Array = global.Float64Array || Float64Array;
1731 // 6 The DataView View Type
1735 function r(array, index) {
1736 return IsCallable(array.get) ? array.get(index) : array[index];
1739 var IS_BIG_ENDIAN = (function() {
1740 var u16array = new Uint16Array([0x1234]),
1741 u8array = new Uint8Array(u16array.buffer);
1742 return r(u8array, 0) === 0x12;
1745 // DataView(buffer, byteOffset=0, byteLength=undefined)
1746 // WebIDL: Constructor(ArrayBuffer buffer,
1747 // optional unsigned long byteOffset,
1748 // optional unsigned long byteLength)
1749 function DataView(buffer, byteOffset, byteLength) {
1750 if (!(buffer instanceof ArrayBuffer || Class(buffer) === 'ArrayBuffer')) throw TypeError();
1752 byteOffset = ToUint32(byteOffset);
1753 if (byteOffset > buffer.byteLength)
1754 throw RangeError('byteOffset out of range');
1756 if (byteLength === undefined)
1757 byteLength = buffer.byteLength - byteOffset;
1759 byteLength = ToUint32(byteLength);
1761 if ((byteOffset + byteLength) > buffer.byteLength)
1762 throw RangeError('byteOffset and length reference an area beyond the end of the buffer');
1764 Object.defineProperty(this, 'buffer', {value: buffer});
1765 Object.defineProperty(this, 'byteLength', {value: byteLength});
1766 Object.defineProperty(this, 'byteOffset', {value: byteOffset});
1769 // get DataView.prototype.buffer
1770 // get DataView.prototype.byteLength
1771 // get DataView.prototype.byteOffset
1772 // -- applied directly to instances by the constructor
1774 function makeGetter(arrayType) {
1775 return function GetViewValue(byteOffset, littleEndian) {
1776 byteOffset = ToUint32(byteOffset);
1778 if (byteOffset + arrayType.BYTES_PER_ELEMENT > this.byteLength)
1779 throw RangeError('Array index out of range');
1781 byteOffset += this.byteOffset;
1783 var uint8Array = new Uint8Array(this.buffer, byteOffset, arrayType.BYTES_PER_ELEMENT),
1785 for (var i = 0; i < arrayType.BYTES_PER_ELEMENT; i += 1)
1786 bytes.push(r(uint8Array, i));
1788 if (Boolean(littleEndian) === Boolean(IS_BIG_ENDIAN))
1791 return r(new arrayType(new Uint8Array(bytes).buffer), 0);
1795 Object.defineProperty(DataView.prototype, 'getUint8', {value: makeGetter(Uint8Array)});
1796 Object.defineProperty(DataView.prototype, 'getInt8', {value: makeGetter(Int8Array)});
1797 Object.defineProperty(DataView.prototype, 'getUint16', {value: makeGetter(Uint16Array)});
1798 Object.defineProperty(DataView.prototype, 'getInt16', {value: makeGetter(Int16Array)});
1799 Object.defineProperty(DataView.prototype, 'getUint32', {value: makeGetter(Uint32Array)});
1800 Object.defineProperty(DataView.prototype, 'getInt32', {value: makeGetter(Int32Array)});
1801 Object.defineProperty(DataView.prototype, 'getFloat32', {value: makeGetter(Float32Array)});
1802 Object.defineProperty(DataView.prototype, 'getFloat64', {value: makeGetter(Float64Array)});
1804 function makeSetter(arrayType) {
1805 return function SetViewValue(byteOffset, value, littleEndian) {
1806 byteOffset = ToUint32(byteOffset);
1807 if (byteOffset + arrayType.BYTES_PER_ELEMENT > this.byteLength)
1808 throw RangeError('Array index out of range');
1811 var typeArray = new arrayType([value]),
1812 byteArray = new Uint8Array(typeArray.buffer),
1813 bytes = [], i, byteView;
1815 for (i = 0; i < arrayType.BYTES_PER_ELEMENT; i += 1)
1816 bytes.push(r(byteArray, i));
1818 // Flip if necessary
1819 if (Boolean(littleEndian) === Boolean(IS_BIG_ENDIAN))
1823 byteView = new Uint8Array(this.buffer, byteOffset, arrayType.BYTES_PER_ELEMENT);
1824 byteView.set(bytes);
1828 Object.defineProperty(DataView.prototype, 'setUint8', {value: makeSetter(Uint8Array)});
1829 Object.defineProperty(DataView.prototype, 'setInt8', {value: makeSetter(Int8Array)});
1830 Object.defineProperty(DataView.prototype, 'setUint16', {value: makeSetter(Uint16Array)});
1831 Object.defineProperty(DataView.prototype, 'setInt16', {value: makeSetter(Int16Array)});
1832 Object.defineProperty(DataView.prototype, 'setUint32', {value: makeSetter(Uint32Array)});
1833 Object.defineProperty(DataView.prototype, 'setInt32', {value: makeSetter(Int32Array)});
1834 Object.defineProperty(DataView.prototype, 'setFloat32', {value: makeSetter(Float32Array)});
1835 Object.defineProperty(DataView.prototype, 'setFloat64', {value: makeSetter(Float64Array)});
1837 global.DataView = global.DataView || DataView;
1842 if (!("defineProperty"in Object&&function(){try{var e={}
1843 return Object.defineProperty(e,"test",{value:42}),!0}catch(t){return!1}}()
1846 // Object.defineProperty
1847 (function (nativeDefineProperty) {
1849 var supportsAccessors = Object.prototype.hasOwnProperty('__defineGetter__');
1850 var ERR_ACCESSORS_NOT_SUPPORTED = 'Getters & setters cannot be defined on this javascript engine';
1851 var ERR_VALUE_ACCESSORS = 'A property cannot both have accessors and be writable or have a value';
1853 // Polyfill.io - This does not use CreateMethodProperty because our CreateMethodProperty function uses Object.defineProperty.
1854 Object['defineProperty'] = function defineProperty(object, property, descriptor) {
1856 // Where native support exists, assume it
1857 if (nativeDefineProperty && (object === window || object === document || object === Element.prototype || object instanceof Element)) {
1858 return nativeDefineProperty(object, property, descriptor);
1861 if (object === null || !(object instanceof Object || typeof object === 'object')) {
1862 throw new TypeError('Object.defineProperty called on non-object');
1865 if (!(descriptor instanceof Object)) {
1866 throw new TypeError('Property description must be an object');
1869 var propertyString = String(property);
1870 var hasValueOrWritable = 'value' in descriptor || 'writable' in descriptor;
1871 var getterType = 'get' in descriptor && typeof descriptor.get;
1872 var setterType = 'set' in descriptor && typeof descriptor.set;
1874 // handle descriptor.get
1876 if (getterType !== 'function') {
1877 throw new TypeError('Getter must be a function');
1879 if (!supportsAccessors) {
1880 throw new TypeError(ERR_ACCESSORS_NOT_SUPPORTED);
1882 if (hasValueOrWritable) {
1883 throw new TypeError(ERR_VALUE_ACCESSORS);
1885 Object.__defineGetter__.call(object, propertyString, descriptor.get);
1887 object[propertyString] = descriptor.value;
1890 // handle descriptor.set
1892 if (setterType !== 'function') {
1893 throw new TypeError('Setter must be a function');
1895 if (!supportsAccessors) {
1896 throw new TypeError(ERR_ACCESSORS_NOT_SUPPORTED);
1898 if (hasValueOrWritable) {
1899 throw new TypeError(ERR_VALUE_ACCESSORS);
1901 Object.__defineSetter__.call(object, propertyString, descriptor.set);
1904 // OK to define value unconditionally - if a getter has been specified as well, an error would be thrown above
1905 if ('value' in descriptor) {
1906 object[propertyString] = descriptor.value;
1911 }(Object.defineProperty));
1916 // _ESAbstract.CreateDataProperty
1917 // 7.3.4. CreateDataProperty ( O, P, V )
1919 // This abstract operation creates a property whose attributes are set to the same defaults used for properties created by the ECMAScript language assignment operator.
1920 // Normally, the property will not already exist. If it does exist and is not configurable or if O is not extensible, [[DefineOwnProperty]] will return false.
1921 function CreateDataProperty(O, P, V) { // eslint-disable-line no-unused-vars
1922 // 1. Assert: Type(O) is Object.
1923 // 2. Assert: IsPropertyKey(P) is true.
1924 // 3. Let newDesc be the PropertyDescriptor{ [[Value]]: V, [[Writable]]: true, [[Enumerable]]: true, [[Configurable]]: true }.
1931 // 4. Return ? O.[[DefineOwnProperty]](P, newDesc).
1933 Object.defineProperty(O, P, newDesc);
1940 // _ESAbstract.CreateDataPropertyOrThrow
1941 /* global CreateDataProperty */
1942 // 7.3.6. CreateDataPropertyOrThrow ( O, P, V )
1943 function CreateDataPropertyOrThrow(O, P, V) { // eslint-disable-line no-unused-vars
1944 // 1. Assert: Type(O) is Object.
1945 // 2. Assert: IsPropertyKey(P) is true.
1946 // 3. Let success be ? CreateDataProperty(O, P, V).
1947 var success = CreateDataProperty(O, P, V);
1948 // 4. If success is false, throw a TypeError exception.
1950 throw new TypeError('Cannot assign value `' + Object.prototype.toString.call(V) + '` to property `' + Object.prototype.toString.call(P) + '` on object `' + Object.prototype.toString.call(O) + '`');
1952 // 5. Return success.
1956 // _ESAbstract.CreateIterResultObject
1957 /* global Type, CreateDataProperty */
1958 // 7.4.7. CreateIterResultObject ( value, done )
1959 function CreateIterResultObject(value, done) { // eslint-disable-line no-unused-vars
1960 // 1. Assert: Type(done) is Boolean.
1961 if (Type(done) !== 'boolean') {
1964 // 2. Let obj be ObjectCreate(%ObjectPrototype%).
1966 // 3. Perform CreateDataProperty(obj, "value", value).
1967 CreateDataProperty(obj, "value", value);
1968 // 4. Perform CreateDataProperty(obj, "done", done).
1969 CreateDataProperty(obj, "done", done);
1974 // _ESAbstract.CreateMethodProperty
1975 // 7.3.5. CreateMethodProperty ( O, P, V )
1976 function CreateMethodProperty(O, P, V) { // eslint-disable-line no-unused-vars
1977 // 1. Assert: Type(O) is Object.
1978 // 2. Assert: IsPropertyKey(P) is true.
1979 // 3. Let newDesc be the PropertyDescriptor{[[Value]]: V, [[Writable]]: true, [[Enumerable]]: false, [[Configurable]]: true}.
1986 // 4. Return ? O.[[DefineOwnProperty]](P, newDesc).
1987 Object.defineProperty(O, P, newDesc);
1989 if (!("isArray"in Array
1993 /* global CreateMethodProperty, IsArray */
1994 // 22.1.2.2. Array.isArray ( arg )
1995 CreateMethodProperty(Array, 'isArray', function isArray(arg) {
1996 // 1. Return ? IsArray(arg).
1997 return IsArray(arg);
2002 if (!("copyWithin"in Array.prototype&&function(){try{var t=function n(){}
2003 t.prototype[0]="foo"
2005 o[1]=1,o[2]=2,o.length=3
2006 var r=Array.prototype.copyWithin.call(o,1,0)
2007 return!(!r[0]||Object.prototype.hasOwnProperty.call(r,"0")||!Object.prototype.hasOwnProperty.call(r,"1")||"foo"!==r[0]||"foo"!==r[1]||1!==r[2]||3!==r.length)}catch(e){return!1}}()
2010 // Array.prototype.copyWithin
2011 /* global CreateMethodProperty, HasProperty, ToInteger */
2012 // 22.1.3.3 Array.prototype.copyWithin ( target, start [ , end ] )
2013 CreateMethodProperty(Array.prototype, 'copyWithin', function copyWithin(target, start /* [ , end ] */ ) {
2015 var end = arguments[2];
2017 // 22.1.3.3.1 Let O be ? ToObject(this value).
2018 if (this === null || this === undefined) {
2019 throw new TypeError('Cannot call method on ' + this);
2022 var o = Object(this);
2024 // 22.1.3.3.2 Let len be ? ToLength(? Get(O, "length")).
2025 var len = ToInteger(o.length);
2029 if (len === Infinity) {
2030 len = Math.pow(2, 53) - 1;
2032 len = Math.min(len, Math.pow(2, 53) - 1);
2034 len = Math.max(len, 0);
2036 // 22.1.3.3.3 Let relativeTarget be ? ToInteger(target).
2037 var relativeTarget = ToInteger(target);
2039 // 22.1.3.3.4 If relativeTarget < 0, let to be max((len + relativeTarget), 0); else let to be min(relativeTarget, len).
2041 if (relativeTarget < 0) {
2042 to = Math.max(len + relativeTarget, 0);
2044 to = Math.min(relativeTarget, len);
2047 // 22.1.3.3.5 Let relativeStart be ? ToInteger(start).
2048 var relativeStart = ToInteger(start);
2050 // 22.1.3.3.6 If relativeStart < 0, let from be max((len + relativeStart), 0); else let from be min(relativeStart, len).
2052 if (relativeStart < 0) {
2053 from = Math.max(len + relativeStart, 0);
2055 from = Math.min(relativeStart, len);
2058 // 22.1.3.3.7 If end is undefined, let relativeEnd be len; else let relativeEnd be ? ToInteger(end).
2060 if (end === undefined) {
2063 relativeEnd = ToInteger(end);
2066 // 22.1.3.3.8 If relativeEnd < 0, let final be max((len + relativeEnd), 0); else let final be min(relativeEnd, len).
2068 if (relativeEnd < 0) {
2069 final = Math.max(len + relativeEnd, 0);
2071 final = Math.min(relativeEnd, len);
2074 // 22.1.3.3.9 Let count be min(final-from, len-to).
2075 var count = Math.min(final - from, len - to);
2077 // 22.1.3.3.10 If from<to and to<from+count, then
2079 if (from < to && to < from + count) {
2080 // 22.1.3.3.10.a Let direction be -1.
2083 // 22.1.3.3.10.b Let from be from + count - 1.
2084 from = from + count - 1;
2086 // 22.1.3.3.10.c Let to be to + count - 1.
2087 to = to + count - 1;
2089 // 22.1.3.3.11 Else,
2090 // 22.1.3.3.11.a Let direction be 1.
2094 // 22.1.3.3.12 Repeat, while count > 0
2096 // 22.1.3.3.12.a Let fromKey be ! ToString(from).
2097 var fromKey = String(from);
2098 // 22.1.3.3.12.b Let toKey be ! ToString(to).
2099 var toKey = String(to);
2100 // 22.1.3.3.12.c Let fromPresent be ? HasProperty(O, fromKey).
2101 var fromPresent = HasProperty(o, fromKey);
2102 // 22.1.3.3.12.d If fromPresent is true, then
2104 // 22.1.3.3.12.d.i Let fromVal be ? Get(O, fromKey).
2105 var fromVal = o[fromKey];
2106 // 22.1.3.3.12.d.ii Perform ? Set(O, toKey, fromVal, true).
2109 // 22.1.3.3.12.e Else fromPresent is false,
2110 // 22.1.3.3.12.e.i Perform ? DeletePropertyOrThrow(O, toKey).
2113 // 22.1.3.3.12.f Let from be from + direction.
2114 from = from + direction;
2115 // 22.1.3.3.12.g Let to be to + direction.
2116 to = to + direction;
2117 // 22.1.3.3.12.h Let count be count - 1.
2120 // 22.1.3.3.13 Return O.
2126 if (!("fill"in Array.prototype
2129 // Array.prototype.fill
2130 /* global CreateMethodProperty, Get, ToInteger, ToLength, ToObject, ToString */
2131 // 22.1.3.6. Array.prototype.fill ( value [ , start [ , end ] ] )
2132 CreateMethodProperty(Array.prototype, 'fill', function fill(value /* [ , start [ , end ] ] */) {
2133 var start = arguments[1];
2134 var end = arguments[2];
2135 // 1. Let O be ? ToObject(this value).
2136 var O = ToObject(this);
2137 // 2. Let len be ? ToLength(? Get(O, "length")).
2138 var len = ToLength(Get(O, "length"));
2139 // 3. Let relativeStart be ? ToInteger(start).
2140 var relativeStart = ToInteger(start);
2141 // 4. If relativeStart < 0, let k be max((len + relativeStart), 0); else let k be min(relativeStart, len)
2142 var k = relativeStart < 0 ? Math.max((len + relativeStart), 0) : Math.min(relativeStart, len);
2143 // 5. If end is undefined, let relativeEnd be len; else let relativeEnd be ? ToInteger(end).
2144 var relativeEnd = end === undefined ? len : ToInteger(end);
2145 // 6. If relativeEnd < 0, let final be max((len + relativeEnd), 0); else let final be min(relativeEnd, len).
2146 var final = relativeEnd < 0 ? Math.max((len + relativeEnd), 0) : Math.min(relativeEnd, len);
2147 // 7. Repeat, while k < final
2149 // a. Let Pk be ! ToString(k).
2150 var Pk = ToString(k);
2151 // b. Perform ? Set(O, Pk, value, true).
2153 // c. Increase k by 1.
2162 if (!("find"in Array.prototype
2165 // Array.prototype.find
2166 /* global Call, CreateMethodProperty, Get, IsCallable, ToBoolean, ToLength, ToObject, ToString */
2167 // 22.1.3.8 Array.prototype.find ( predicate [ , thisArg ] )
2168 CreateMethodProperty(Array.prototype, 'find', function find( predicate /* [ , thisArg ] */) {
2169 // 1. Let O be ? ToObject(this value).
2170 var O = ToObject(this);
2171 // 2. Let len be ? ToLength(? Get(O, "length")).
2172 var len = ToLength(Get(O, "length"));
2173 // 3. If IsCallable(predicate) is false, throw a TypeError exception.
2174 if (IsCallable(predicate) === false) {
2175 throw new TypeError(predicate + ' is not a function');
2177 // 4. If thisArg is present, let T be thisArg; else let T be undefined.
2178 var T = arguments.length > 1 ? arguments[1] : undefined;
2181 // 6. Repeat, while k < len
2183 // a. Let Pk be ! ToString(k).
2184 var Pk = ToString(k);
2185 // b. Let kValue be ? Get(O, Pk).
2186 var kValue = Get(O, Pk);
2187 // c. Let testResult be ToBoolean(? Call(predicate, T, « kValue, k, O »)).
2188 var testResult = ToBoolean(Call(predicate, T, [kValue, k, O ]));
2189 // d. If testResult is true, return kValue.
2193 // e. Increase k by 1.
2196 // 7. Return undefined.
2202 if (!("findIndex"in Array.prototype
2205 // Array.prototype.findIndex
2206 /* global Call, CreateMethodProperty, Get, IsCallable, ToBoolean, ToLength, ToObject, ToString */
2207 // 22.1.3.9. Array.prototype.findIndex ( predicate [ , thisArg ] )
2208 CreateMethodProperty(Array.prototype, 'findIndex', function findIndex(predicate /* [ , thisArg ] */) {
2209 // 1. Let O be ? ToObject(this value).
2210 var O = ToObject(this);
2211 // 2. Let len be ? ToLength(? Get(O, "length")).
2212 var len = ToLength(Get(O, "length"));
2213 // 3. If IsCallable(predicate) is false, throw a TypeError exception.
2214 if (IsCallable(predicate) === false) {
2215 throw new TypeError(predicate + ' is not a function');
2217 // 4. If thisArg is present, let T be thisArg; else let T be undefined.
2218 var T = arguments.length > 1 ? arguments[1] : undefined;
2221 // 6. Repeat, while k < len
2223 // a. Let Pk be ! ToString(k).
2224 var Pk = ToString(k);
2225 // b. Let kValue be ? Get(O, Pk).
2226 var kValue = Get(O, Pk);
2227 // c. Let testResult be ToBoolean(? Call(predicate, T, « kValue, k, O »)).
2228 var testResult = ToBoolean(Call(predicate, T, [kValue, k, O]));
2229 // d. If testResult is true, return k.
2233 // e. Increase k by 1.
2242 if (!("forEach"in Array.prototype
2245 // Array.prototype.forEach
2246 /* global Call, CreateMethodProperty, Get, HasProperty, IsCallable, ToLength, ToObject, ToString */
2247 // 22.1.3.10. Array.prototype.forEach ( callbackfn [ , thisArg ] )
2248 CreateMethodProperty(Array.prototype, 'forEach', function forEach(callbackfn /* [ , thisArg ] */) {
2249 // 1. Let O be ? ToObject(this value).
2250 var O = ToObject(this);
2251 // Polyfill.io - If O is a String object, split it into an array in order to iterate correctly.
2252 // We will use arrayLike in place of O when we are iterating through the list.
2253 var arraylike = O instanceof String ? O.split('') : O;
2254 // 2. Let len be ? ToLength(? Get(O, "length")).
2255 var len = ToLength(Get(O, "length"));
2256 // 3. If IsCallable(callbackfn) is false, throw a TypeError exception.
2257 if (IsCallable(callbackfn) === false) {
2258 throw new TypeError(callbackfn + ' is not a function');
2260 // 4. If thisArg is present, let T be thisArg; else let T be undefined.
2261 var T = arguments.length > 1 ? arguments[1] : undefined;
2264 // 6. Repeat, while k < len
2266 // a. Let Pk be ! ToString(k).
2267 var Pk = ToString(k);
2268 // b. Let kPresent be ? HasProperty(O, Pk).
2269 var kPresent = HasProperty(arraylike, Pk);
2270 // c. If kPresent is true, then
2272 // i. Let kValue be ? Get(O, Pk).
2273 var kValue = Get(arraylike, Pk);
2274 // ii. Perform ? Call(callbackfn, T, « kValue, k, O »).
2275 Call(callbackfn, T, [kValue, k, O]);
2277 // d. Increase k by 1.
2280 // 7. Return undefined.
2286 if (!("bind"in Function.prototype
2289 // Function.prototype.bind
2290 /* global CreateMethodProperty, IsCallable */
2291 // 19.2.3.2. Function.prototype.bind ( thisArg, ...args )
2292 // https://github.com/es-shims/es5-shim/blob/d6d7ff1b131c7ba14c798cafc598bb6780d37d3b/es5-shim.js#L182
2293 CreateMethodProperty(Function.prototype, 'bind', function bind(that) { // .length is 1
2294 // add necessary es5-shim utilities
2296 var $Object = Object;
2297 var ArrayPrototype = $Array.prototype;
2298 var Empty = function Empty() { };
2299 var array_slice = ArrayPrototype.slice;
2300 var array_concat = ArrayPrototype.concat;
2301 var array_push = ArrayPrototype.push;
2303 // /add necessary es5-shim utilities
2305 // 1. Let Target be the this value.
2307 // 2. If IsCallable(Target) is false, throw a TypeError exception.
2308 if (!IsCallable(target)) {
2309 throw new TypeError('Function.prototype.bind called on incompatible ' + target);
2311 // 3. Let A be a new (possibly empty) internal list of all of the
2312 // argument values provided after thisArg (arg1, arg2 etc), in order.
2313 // XXX slicedArgs will stand in for "A" if used
2314 var args = array_slice.call(arguments, 1); // for normal call
2315 // 4. Let F be a new native ECMAScript object.
2316 // 11. Set the [[Prototype]] internal property of F to the standard
2317 // built-in Function prototype object as specified in 15.3.3.1.
2318 // 12. Set the [[Call]] internal property of F as described in
2320 // 13. Set the [[Construct]] internal property of F as described in
2322 // 14. Set the [[HasInstance]] internal property of F as described in
2325 var binder = function () {
2327 if (this instanceof bound) {
2328 // 15.3.4.5.2 [[Construct]]
2329 // When the [[Construct]] internal method of a function object,
2330 // F that was created using the bind function is called with a
2331 // list of arguments ExtraArgs, the following steps are taken:
2332 // 1. Let target be the value of F's [[TargetFunction]]
2333 // internal property.
2334 // 2. If target has no [[Construct]] internal method, a
2335 // TypeError exception is thrown.
2336 // 3. Let boundArgs be the value of F's [[BoundArgs]] internal
2338 // 4. Let args be a new list containing the same values as the
2339 // list boundArgs in the same order followed by the same
2340 // values as the list ExtraArgs in the same order.
2341 // 5. Return the result of calling the [[Construct]] internal
2342 // method of target providing args as the arguments.
2344 var result = target.apply(
2346 array_concat.call(args, array_slice.call(arguments))
2348 if ($Object(result) === result) {
2354 // 15.3.4.5.1 [[Call]]
2355 // When the [[Call]] internal method of a function object, F,
2356 // which was created using the bind function is called with a
2357 // this value and a list of arguments ExtraArgs, the following
2359 // 1. Let boundArgs be the value of F's [[BoundArgs]] internal
2361 // 2. Let boundThis be the value of F's [[BoundThis]] internal
2363 // 3. Let target be the value of F's [[TargetFunction]] internal
2365 // 4. Let args be a new list containing the same values as the
2366 // list boundArgs in the same order followed by the same
2367 // values as the list ExtraArgs in the same order.
2368 // 5. Return the result of calling the [[Call]] internal method
2369 // of target providing boundThis as the this value and
2370 // providing args as the arguments.
2372 // equiv: target.call(this, ...boundArgs, ...args)
2373 return target.apply(
2375 array_concat.call(args, array_slice.call(arguments))
2382 // 15. If the [[Class]] internal property of Target is "Function", then
2383 // a. Let L be the length property of Target minus the length of A.
2384 // b. Set the length own property of F to either 0 or L, whichever is
2386 // 16. Else set the length own property of F to 0.
2388 var boundLength = max(0, target.length - args.length);
2390 // 17. Set the attributes of the length own property of F to the values
2391 // specified in 15.3.5.1.
2393 for (var i = 0; i < boundLength; i++) {
2394 array_push.call(boundArgs, '$' + i);
2397 // XXX Build a dynamic function with desired amount of arguments is the only
2398 // way to set the length property of a function.
2399 // In environments where Content Security Policies enabled (Chrome extensions,
2400 // for ex.) all use of eval or Function costructor throws an exception.
2401 // However in all of these environments Function.prototype.bind exists
2402 // and so this code will never be executed.
2403 bound = Function('binder', 'return function (' + boundArgs.join(',') + '){ return binder.apply(this, arguments); }')(binder);
2405 if (target.prototype) {
2406 Empty.prototype = target.prototype;
2407 bound.prototype = new Empty();
2408 // Clean up dangling references.
2409 Empty.prototype = null;
2413 // 18. Set the [[Extensible]] internal property of F to true.
2416 // 19. Let thrower be the [[ThrowTypeError]] function Object (13.2.3).
2417 // 20. Call the [[DefineOwnProperty]] internal method of F with
2418 // arguments "caller", PropertyDescriptor {[[Get]]: thrower, [[Set]]:
2419 // thrower, [[Enumerable]]: false, [[Configurable]]: false}, and
2421 // 21. Call the [[DefineOwnProperty]] internal method of F with
2422 // arguments "arguments", PropertyDescriptor {[[Get]]: thrower,
2423 // [[Set]]: thrower, [[Enumerable]]: false, [[Configurable]]: false},
2427 // NOTE Function objects created using Function.prototype.bind do not
2428 // have a prototype property or the [[Code]], [[FormalParameters]], and
2429 // [[Scope]] internal properties.
2430 // XXX can't delete prototype in pure-js.
2438 if (!("acosh"in Math
2442 /* global CreateMethodProperty */
2443 // 20.2.2.3. Math.acosh ( x )
2444 CreateMethodProperty(Math, 'acosh', function acosh(x) {
2445 // If x is NaN, the result is NaN.
2449 // If x is less than 1, the result is NaN.
2453 // If x is 1, the result is +0.
2457 // If x is +∞, the result is +∞.
2458 if (x === Infinity) {
2461 return Math.log(x + Math.sqrt(x * x - 1));
2466 if (!("asinh"in Math
2470 /* global CreateMethodProperty */
2471 // 20.2.2.5. Math.asinh ( x )
2472 CreateMethodProperty(Math, 'asinh', function asinh(x) {
2473 // If x is NaN, the result is NaN.
2477 // If x is +0, the result is +0.
2478 if (x === 0 && 1/x === Infinity) {
2481 // If x is -0, the result is -0.
2482 if (x === 0 && 1/x === -Infinity) {
2485 // If x is +∞, the result is +∞.
2486 if (x === Infinity) {
2489 // If x is -∞, the result is -∞.
2490 if (x === -Infinity) {
2493 return Math.log(x + Math.sqrt(x * x + 1));
2498 if (!("atanh"in Math
2502 /* global CreateMethodProperty */
2503 // 20.2.2.7. Math.atanh ( x )
2504 CreateMethodProperty(Math, 'atanh', function atanh(x) {
2505 // If x is NaN, the result is NaN.
2509 // If x is less than -1, the result is NaN.
2513 // If x is greater than 1, the result is NaN.
2517 // If x is -1, the result is -∞.
2521 // If x is +1, the result is +∞.
2525 // If x is +0, the result is +0.
2526 if (x === 0 && 1/x === Infinity) {
2529 // If x is -0, the result is -0.
2530 if (x === 0 && 1/x === -Infinity) {
2533 return Math.log((1 + x) / (1 - x)) / 2;
2542 /* global CreateMethodProperty */
2543 // 20.2.2.9. Math.cbrt ( x )
2544 CreateMethodProperty(Math, 'cbrt', function cbrt(x) {
2545 // If x is NaN, the result is NaN.
2549 // If x is +0, the result is +0.
2550 if (x === 0 && 1/x === Infinity) {
2553 // If x is -0, the result is -0.
2554 if (x === 0 && 1/x === -Infinity) {
2557 // If x is +∞, the result is +∞.
2558 if (x === Infinity) {
2561 // If x is -∞, the result is -∞.
2562 if (x === -Infinity) {
2565 var y = Math.pow(Math.abs(x), 1 / 3);
2566 return x < 0 ? -y : y;
2571 if (!("clz32"in Math
2575 /* global CreateMethodProperty, ToUint32 */
2576 // 20.2.2.11. Math.clz32 ( x )
2577 CreateMethodProperty(Math, 'clz32', function clz32(x) {
2578 // 1. Let n be ToUint32(x).
2579 var n = ToUint32(x);
2580 // 2. Let p be the number of leading zero bits in the 32-bit binary representation of n.
2581 var p = n ? 32 - n.toString(2).length : 32;
2592 /* global CreateMethodProperty */
2593 // 20.2.2.1. 3Math.cosh ( x )
2594 CreateMethodProperty(Math, 'cosh', function cosh(x) {
2595 // If x is NaN, the result is NaN.
2599 // If x is +0, the result is 1.
2600 if (x === 0 && 1/x === Infinity) {
2603 // If x is -0, the result is 1.
2604 if (x === 0 && 1/x === -Infinity) {
2607 // If x is +∞, the result is +∞.
2608 if (x === Infinity) {
2611 // If x is -∞, the result is +∞.
2612 if (x === -Infinity) {
2617 var y = Math.exp(0.5 * x);
2620 var y = Math.exp(x);
2621 return (y + 1 / y) / 2;
2626 if (!("expm1"in Math
2630 /* global CreateMethodProperty */
2631 // 20.2.2.15. Math.expm1 ( x )
2632 CreateMethodProperty(Math, 'expm1', function expm1(x) {
2633 // If x is NaN, the result is NaN.
2637 // If x is +0, the result is +0.
2638 if (x === 0 && 1/x === Infinity) {
2641 // If x is -0, the result is -0.
2642 if (x === 0 && 1/x === -Infinity) {
2645 // If x is +∞, the result is +∞.
2646 if (x === Infinity) {
2649 // If x is -∞, the result is -1.
2650 if (x === -Infinity) {
2654 if (x > -1e-6 && x < 1e-6) {
2655 return x + x * x / 2;
2657 return Math.exp(x) - 1;
2663 if (!("fround"in Math
2667 /* global Float32Array, CreateMethodProperty */
2668 // 20.2.2.17 Math.fround ( x )
2669 CreateMethodProperty(Math, 'fround', function (x) {
2670 // 1. If x is NaN, return NaN.
2674 // 2. If x is one of +0, -0, +∞, -∞, return x.
2675 if (1 / x === +Infinity || 1 / x === -Infinity || x === +Infinity || x === -Infinity) {
2678 // 3. Let x32 be the result of converting x to a value in IEEE 754-2008 binary32 format using roundTiesToEven.
2679 // 4. Let x64 be the result of converting x32 to a value in IEEE 754-2008 binary64 format.
2680 // 5. Return the ECMAScript Number value corresponding to x64.
2681 return (new Float32Array([x]))[0];
2686 if (!("hypot"in Math
2690 /* global CreateMethodProperty */
2691 // 20.2.2.18. Math.hypot ( value1, value2, ...values )
2692 CreateMethodProperty(Math, 'hypot', function hypot(value1, value2) { // eslint-disable-line no-unused-vars
2693 // If no arguments are passed, the result is +0.
2694 if (arguments.length === 0) {
2699 for (var i = 0; i < arguments.length; ++i) {
2700 // If any argument is +∞, the result is +∞.
2701 if (arguments[i] === Infinity) {
2705 // If any argument is -∞, the result is +∞.
2706 if (arguments[i] === -Infinity) {
2710 // If no argument is +∞ or -∞, and any argument is NaN, the result is NaN.
2711 // If all arguments are either +0 or -0, the result is +0.
2712 // Polyfill.io - The two conditions above are handled in the math.
2714 var arg = Math.abs(Number(arguments[i]));
2716 y = y * Math.pow(max / arg, 2);
2719 if (arg !== 0 || max !== 0) {
2720 y = y + Math.pow(arg / max, 2);
2724 return max * Math.sqrt(y);
2733 /* global CreateMethodProperty, ToUint32 */
2734 // 20.2.2.19. Math.imul ( x, y )
2735 CreateMethodProperty(Math, 'imul', function imul(x, y) {
2736 // 1. Let a be ToUint32(x).
2737 var a = ToUint32(x);
2738 // 2. Let b be ToUint32(y).
2739 var b = ToUint32(y);
2740 var UINT16 = 0xffff;
2741 var aHigh = a >>> 16 & UINT16;
2742 var aLow = UINT16 & a;
2743 var bHigh = b >>> 16 & UINT16;
2744 var bLow = UINT16 & b;
2745 // the shift by 0 fixes the sign on the high part
2746 // the final |0 converts the unsigned value into a signed value
2747 return aLow * bLow + (aHigh * bLow + aLow * bHigh << 16 >>> 0) | 0;
2751 if (!("log10"in Math
2755 /* global CreateMethodProperty */
2756 // 20.2.2.22. Math.log10 ( x )
2757 CreateMethodProperty(Math, 'log10', function log10(x) {
2758 return Math.log(x) / Math.LN10;
2763 if (!("log1p"in Math
2767 /* global CreateMethodProperty */
2768 // 20.2.2.21. Math.log1p ( x )
2769 CreateMethodProperty(Math, 'log1p', function log1p(x) {
2771 if (-1 < x && x < 1) {
2772 // Polyfill.io - For numbers in the range −1 < x < 1
2773 // Because we are using log, the precision of the result will be identical to log(1).
2774 // To fix this we avoid using log and use the Taylor Series expansion of log.
2775 // This series converges when |x| < 1. As we can not sum to infinity,
2776 // we instead sum the first 300 parts of the series to give a close approximation.
2777 // |x|<1, log(1+x) = x - x^2/2 + x^3/3 - ... + (-1)^(n-1)*x^n/n + ...
2779 for (var i = 2; i <= 300; i++) {
2780 y += Math.pow((-1), (i - 1)) * Math.pow(x, i) / i;
2785 return Math.log(1 + x);
2793 /* global CreateMethodProperty */
2794 // 20.2.2.23. Math.log2 ( x )
2795 CreateMethodProperty(Math, 'log2', function log2(x) {
2796 return Math.log(x) / Math.LN2;
2805 /* global CreateMethodProperty */
2806 // 20.2.2.29. Math.sign ( x )
2807 CreateMethodProperty(Math, 'sign', function sign(x) {
2809 // If x is NaN, the result is NaN.
2813 // If x is -0, the result is -0.
2814 if (1 / x === -Infinity) {
2817 // If x is +0, the result is +0.
2818 if (1 / x === Infinity) {
2821 // If x is negative and not -0, the result is -1.
2825 // If x is positive and not +0, the result is +1.
2837 /* global CreateMethodProperty */
2838 // 20.2.2.31. Math.sinh ( x )
2839 CreateMethodProperty(Math, 'sinh', function sinh(x) {
2840 var s = (x < 0) ? -1 : 1;
2841 var absx = Math.abs(x);
2843 if (absx < Math.pow(2, -28)) {
2846 var t = Math.exp(absx) - 1;
2848 return (s * (2 * t - t * t / (t + 1)))/2;
2850 return (s * (t + t / (t + 1)))/2;
2852 if (absx < 709.7822265625) {
2853 return (s * Math.exp(absx))/2;
2855 var w = Math.exp(0.5 * absx);
2866 /* global CreateMethodProperty */
2867 // 20.2.2.34. Math.tanh ( x )
2868 CreateMethodProperty(Math, 'tanh', function tanh(x) {
2871 return x === Infinity ? 1 : x === -Infinity ? -1 : (y = Math.exp(2 * x), (y - 1) / (y + 1));
2876 if (!("trunc"in Math
2880 /* global CreateMethodProperty */
2881 CreateMethodProperty(Math, 'trunc', function trunc(x) {
2882 return x < 0 ? Math.ceil(x) : Math.floor(x);
2887 if (!("isFinite"in Number
2891 /* global CreateMethodProperty, Type */
2894 // 20.1.2.2. Number.isFinite ( number )
2895 CreateMethodProperty(Number, 'isFinite', function isFinite(number) {
2896 // 1. If Type(number) is not Number, return false.
2897 if (Type(number) !== 'number') {
2900 // 2. If number is NaN, +∞, or -∞, return false.
2901 // 3. Otherwise, return true.
2902 // Polyfill.io - We use isFinite as it implements steps 2 and 3.
2903 return that.isFinite(number);
2909 if (!("isInteger"in Number
2913 /* global CreateMethodProperty, ToInteger, Type */
2914 // 20.1.2.3. Number.isInteger ( number )
2915 CreateMethodProperty(Number, 'isInteger', function isInteger(number) {
2916 // 1. If Type(number) is not Number, return false.
2917 if (Type(number) !== 'number') {
2920 // 2. If number is NaN, +∞, or -∞, return false.
2921 if (isNaN(number) || number === Infinity || number === -Infinity) {
2924 // 3. Let integer be ToInteger(number).
2925 var integer = ToInteger(number);
2926 // 4. If integer is not equal to number, return false.
2927 if (integer !== number) {
2930 // 5. Otherwise, return true.
2936 if (!("isNaN"in Number
2940 /* global CreateMethodProperty, Type */
2943 // 20.1.2.4. Number.isNaN ( number )
2944 CreateMethodProperty(Number, 'isNaN', function isNaN(number) {
2945 // 1. If Type(number) is not Number, return false.
2946 if (Type(number) !== 'number') {
2949 // 2. If number is NaN, return true.
2950 if (that.isNaN(number)) {
2953 // 3. Otherwise, return false.
2960 if (!("isSafeInteger"in Number
2963 // Number.isSafeInteger
2964 /* global CreateMethodProperty, Type, ToInteger */
2965 // 20.1.2.5. Number.isSafeInteger ( number )
2966 CreateMethodProperty(Number, 'isSafeInteger', function isSafeInteger(number) {
2967 // 1. If Type(number) is not Number, return false.
2968 if (Type(number) !== 'number') {
2971 // 2. If number is NaN, +∞, or -∞, return false.
2972 if (isNaN(number) || number === Infinity || number === -Infinity) {
2975 // 3. Let integer be ToInteger(number).
2976 var integer = ToInteger(number);
2977 // 4. If integer is not equal to number, return false.
2978 if (integer !== number) {
2981 // 5. If abs(integer) ≤ 2^53-1, return true.
2982 if (Math.abs(integer) <= (Math.pow(2, 53) - 1)) {
2985 // 6. Otherwise, return false.
2991 if (!("parseFloat"in Number
2994 // Number.parseFloat
2995 /* global CreateMethodProperty */
2996 // 20.1.2.12. Number.parseFloat ( string )
2997 // The value of the Number.parseFloat data property is the same built-in function object that is the value of the parseFloat property of the global object defined in 18.2.4.
2998 CreateMethodProperty(Number, 'parseFloat', parseFloat);
3002 if (!("parseInt"in Number
3006 /* global CreateMethodProperty */
3007 // 20.1.2.13. Number.parseInt ( string, radix )
3008 // The value of the Number.parseInt data property is the same built-in function object that is the value of the parseInt property of the global object defined in 18.2.5.
3009 CreateMethodProperty(Number, 'parseInt', parseInt);
3013 if (!("name"in Function.prototype&&"x"===function x(){}.name
3016 // Function.prototype.name
3020 accessorName = 'name',
3021 fnNameMatchRegex = /^\s*function\s+([^\(\s]*)\s*/,
3022 $Function = Function,
3023 FunctionName = 'Function',
3024 FunctionProto = $Function.prototype,
3025 FunctionProtoCtor = FunctionProto.constructor,
3027 getFunctionName = function(fn) {
3030 if (fn === $Function || fn === FunctionProtoCtor) {
3031 name = FunctionName;
3033 else if (fn !== FunctionProto) {
3034 match = ('' + fn).match(fnNameMatchRegex);
3035 name = match && match[1];
3041 Object.defineProperty(FunctionProto, accessorName, {
3042 get: function Function$name() {
3045 fnName = getFunctionName(fn);
3047 // Since named function definitions have immutable names, also memoize the
3048 // output by defining the `name` property directly on this Function
3049 // instance so the accessor function will not need to be invoked again.
3050 if (fn !== FunctionProto) {
3051 Object.defineProperty(fn, accessorName, {
3066 if (!("EPSILON"in Number
3070 // 20.1.2.1. Number.EPSILON
3071 // The value of Number.EPSILON is the difference between 1 and the smallest value greater than 1 that is representable as a Number value, which is approximately 2.2204460492503130808472633361816 x 10-16.
3072 // This property has the attributes { [[Writable]]: false, [[Enumerable]]: false, [[Configurable]]: false }.
3073 Object.defineProperty(Number, 'EPSILON', {
3075 configurable: false,
3077 value: Math.pow(2, -52)
3082 if (!("MAX_SAFE_INTEGER"in Number
3085 // Number.MAX_SAFE_INTEGER
3086 // 20.1.2.6. Number.MAX_SAFE_INTEGER
3087 // The value of Number.MAX_SAFE_INTEGER is 9007199254740991 (2^53-1).
3088 // This property has the attributes { [[Writable]]: false, [[Enumerable]]: false, [[Configurable]]: false }.
3089 Object.defineProperty(Number, 'MAX_SAFE_INTEGER', {
3091 configurable: false,
3093 value: Math.pow(2, 53) - 1
3098 if (!("MIN_SAFE_INTEGER"in Number
3101 // Number.MIN_SAFE_INTEGER
3102 // 20.1.2.8. Number.MIN_SAFE_INTEGER
3103 // The value of Number.MIN_SAFE_INTEGER is -9007199254740991 (-(253-1)).
3104 // This property has the attributes { [[Writable]]: false, [[Enumerable]]: false, [[Configurable]]: false }.
3105 Object.defineProperty(Number, 'MIN_SAFE_INTEGER', {
3107 configurable: false,
3109 value: -(Math.pow(2, 53) - 1)
3114 if (!("freeze"in Object
3118 /* global CreateMethodProperty */
3119 // 19.1.2.6. Object.freeze ( O )
3120 CreateMethodProperty(Object, 'freeze', function freeze(O) {
3121 // This feature cannot be implemented fully as a polyfill.
3122 // We choose to silently fail which allows "securable" code
3123 // to "gracefully" degrade to working but insecure code.
3129 if (!("getOwnPropertyDescriptor"in Object&&"function"==typeof Object.getOwnPropertyDescriptor&&function(){try{var t={}
3130 return t.test=0,0===Object.getOwnPropertyDescriptor(t,"test").value}catch(e){return!1}}()
3133 // Object.getOwnPropertyDescriptor
3134 /* global CreateMethodProperty */
3136 var call = Function.prototype.call;
3137 var prototypeOfObject = Object.prototype;
3138 var owns = call.bind(prototypeOfObject.hasOwnProperty);
3142 var supportsAccessors;
3143 if ((supportsAccessors = owns(prototypeOfObject, "__defineGetter__"))) {
3144 lookupGetter = call.bind(prototypeOfObject.__lookupGetter__);
3145 lookupSetter = call.bind(prototypeOfObject.__lookupSetter__);
3147 function doesGetOwnPropertyDescriptorWork(object) {
3149 object.sentinel = 0;
3150 return Object.getOwnPropertyDescriptor(
3154 } catch (exception) {
3158 // check whether getOwnPropertyDescriptor works if it's given. Otherwise,
3160 if (Object.defineProperty) {
3161 var getOwnPropertyDescriptorWorksOnObject =
3162 doesGetOwnPropertyDescriptorWork({});
3163 var getOwnPropertyDescriptorWorksOnDom = typeof document == "undefined" ||
3164 doesGetOwnPropertyDescriptorWork(document.createElement("div"));
3165 if (!getOwnPropertyDescriptorWorksOnDom ||
3166 !getOwnPropertyDescriptorWorksOnObject
3168 var getOwnPropertyDescriptorFallback = Object.getOwnPropertyDescriptor;
3172 if (!Object.getOwnPropertyDescriptor || getOwnPropertyDescriptorFallback) {
3173 var ERR_NON_OBJECT = "Object.getOwnPropertyDescriptor called on a non-object: ";
3175 CreateMethodProperty(Object, 'getOwnPropertyDescriptor', function getOwnPropertyDescriptor(object, property) {
3176 if ((typeof object != "object" && typeof object != "function") || object === null) {
3177 throw new TypeError(ERR_NON_OBJECT + object);
3180 // make a valiant attempt to use the real getOwnPropertyDescriptor
3181 // for I8's DOM elements.
3182 if (getOwnPropertyDescriptorFallback) {
3184 return getOwnPropertyDescriptorFallback.call(Object, object, property);
3185 } catch (exception) {
3186 // try the shim if the real one doesn't work
3190 // If object does not owns property return undefined immediately.
3191 if (!owns(object, property)) {
3195 // If object has a property then it's for sure both `enumerable` and
3197 var descriptor = { enumerable: true, configurable: true };
3199 // If JS engine supports accessor properties then property may be a
3200 // getter or setter.
3201 if (supportsAccessors) {
3202 // Unfortunately `__lookupGetter__` will return a getter even
3203 // if object has own non getter property along with a same named
3204 // inherited getter. To avoid misbehavior we temporary remove
3205 // `__proto__` so that `__lookupGetter__` will return getter only
3206 // if it's owned by an object.
3207 var prototype = object.__proto__;
3208 object.__proto__ = prototypeOfObject;
3210 var getter = lookupGetter(object, property);
3211 var setter = lookupSetter(object, property);
3213 // Once we have getter and setter we can put values back.
3214 object.__proto__ = prototype;
3216 if (getter || setter) {
3218 descriptor.get = getter;
3221 descriptor.set = setter;
3223 // If it was accessor property we're done and return here
3224 // in order to avoid adding `value` to the descriptor.
3229 // If we got this far we know that object has an own property that is
3230 // not an accessor so we set it as a value and return descriptor.
3231 descriptor.value = object[property];
3232 descriptor.writable = true;
3240 if (!("getOwnPropertyNames"in Object
3243 // Object.getOwnPropertyNames
3244 /* global CreateMethodProperty */
3246 var toString = ({}).toString;
3247 var split = ''.split;
3249 CreateMethodProperty(Object, 'getOwnPropertyNames', function getOwnPropertyNames(object) {
3253 // Non-enumerable properties cannot be discovered but can be checked for by name.
3254 // Define those used internally by JS to allow an incomplete solution
3255 var commonProps = ['length', "name", "arguments", "caller", "prototype", "observe", "unobserve"];
3257 if (typeof object === 'undefined' || object === null) {
3258 throw new TypeError('Cannot convert undefined or null to object');
3261 // Polyfill.io fallback for non-array-like strings which exist in some ES3 user-agents (IE 8)
3262 object = toString.call(object) == '[object String]' ? split.call(object, '') : Object(object);
3264 // Enumerable properties only
3265 for (key in object) {
3266 if (Object.prototype.hasOwnProperty.call(object, key)) {
3271 // Check for and add the common non-enumerable properties
3272 for (var i=0, s=commonProps.length; i<s; i++) {
3273 if (commonProps[i] in object) buffer.push(commonProps[i]);
3281 if (!("getPrototypeOf"in Object
3284 // Object.getPrototypeOf
3285 /* global CreateMethodProperty */
3286 // Based on: https://github.com/es-shims/es5-shim/blob/master/es5-sham.js
3288 // https://github.com/es-shims/es5-shim/issues#issue/2
3289 // http://ejohn.org/blog/objectgetprototypeof/
3290 // recommended by fschaefer on github
3292 // sure, and webreflection says ^_^
3293 // ... this will nerever possibly return null
3294 // ... Opera Mini breaks here with infinite loops
3295 CreateMethodProperty(Object, 'getPrototypeOf', function getPrototypeOf(object) {
3296 if (object !== Object(object)) {
3297 throw new TypeError('Object.getPrototypeOf called on non-object');
3299 var proto = object.__proto__;
3300 if (proto || proto === null) {
3302 } else if (typeof object.constructor == 'function' && object instanceof object.constructor) {
3303 return object.constructor.prototype;
3304 } else if (object instanceof Object) {
3305 return Object.prototype;
3307 // Correctly return null for Objects created with `Object.create(null)`
3308 // (shammed or native) or `{ __proto__: null}`. Also returns null for
3309 // cross-realm objects on browsers that lack `__proto__` support (like
3310 // IE <11), but that's the best we can do.
3321 /* global CreateMethodProperty, SameValue */
3322 // 19.1.2.12. Object.is ( value1, value2 )
3323 CreateMethodProperty(Object, 'is', function is(value1, value2) {
3324 // 1. Return SameValue(value1, value2).
3325 return SameValue(value1, value2);
3330 if (!("keys"in Object&&function(){return 2===Object.keys(arguments).length}(1,2)&&function(){try{return Object.keys(""),!0}catch(t){return!1}}()
3334 /* global CreateMethodProperty */
3335 CreateMethodProperty(Object, "keys", (function() {
3338 // modified from https://github.com/es-shims/object-keys
3340 var has = Object.prototype.hasOwnProperty;
3341 var toStr = Object.prototype.toString;
3342 var isEnumerable = Object.prototype.propertyIsEnumerable;
3343 var hasDontEnumBug = !isEnumerable.call({ toString: null }, 'toString');
3344 var hasProtoEnumBug = isEnumerable.call(function () {}, 'prototype');
3351 'propertyIsEnumerable',
3354 var equalsConstructorPrototype = function (o) {
3355 var ctor = o.constructor;
3356 return ctor && ctor.prototype === o;
3358 var excludedKeys = {
3362 $frameElement: true,
3376 $webkitIndexedDB: true,
3377 $webkitStorageInfo: true,
3380 var hasAutomationEqualityBug = (function () {
3382 if (typeof window === 'undefined') { return false; }
3383 for (var k in window) {
3385 if (!excludedKeys['$' + k] && has.call(window, k) && window[k] !== null && typeof window[k] === 'object') {
3387 equalsConstructorPrototype(window[k]);
3398 var equalsConstructorPrototypeIfNotBuggy = function (o) {
3400 if (typeof window === 'undefined' || !hasAutomationEqualityBug) {
3401 return equalsConstructorPrototype(o);
3404 return equalsConstructorPrototype(o);
3410 function isArgumentsObject(value) {
3411 var str = toStr.call(value);
3412 var isArgs = str === '[object Arguments]';
3414 isArgs = str !== '[object Array]' &&
3416 typeof value === 'object' &&
3417 typeof value.length === 'number' &&
3418 value.length >= 0 &&
3419 toStr.call(value.callee) === '[object Function]';
3424 return function keys(object) {
3425 var isFunction = toStr.call(object) === '[object Function]';
3426 var isArguments = isArgumentsObject(object);
3427 var isString = toStr.call(object) === '[object String]';
3430 if (object === undefined || object === null) {
3431 throw new TypeError('Cannot convert undefined or null to object');
3434 var skipProto = hasProtoEnumBug && isFunction;
3435 if (isString && object.length > 0 && !has.call(object, 0)) {
3436 for (var i = 0; i < object.length; ++i) {
3437 theKeys.push(String(i));
3441 if (isArguments && object.length > 0) {
3442 for (var j = 0; j < object.length; ++j) {
3443 theKeys.push(String(j));
3446 for (var name in object) {
3447 if (!(skipProto && name === 'prototype') && has.call(object, name)) {
3448 theKeys.push(String(name));
3453 if (hasDontEnumBug) {
3454 var skipConstructor = equalsConstructorPrototypeIfNotBuggy(object);
3456 for (var k = 0; k < dontEnums.length; ++k) {
3457 if (!(skipConstructor && dontEnums[k] === 'constructor') && has.call(object, dontEnums[k])) {
3458 theKeys.push(dontEnums[k]);
3468 if (!("assign"in Object
3472 /* global CreateMethodProperty, Get, ToObject */
3473 // 19.1.2.1 Object.assign ( target, ...sources )
3474 CreateMethodProperty(Object, 'assign', function assign(target, source) { // eslint-disable-line no-unused-vars
3475 // 1. Let to be ? ToObject(target).
3476 var to = ToObject(target);
3478 // 2. If only one argument was passed, return to.
3479 if (arguments.length === 1) {
3483 // 3. Let sources be the List of argument values starting with the second argument
3484 var sources = Array.prototype.slice.call(arguments, 1);
3486 // 4. For each element nextSource of sources, in ascending index order, do
3491 for (index1 = 0; index1 < sources.length; index1++) {
3492 var nextSource = sources[index1];
3493 // a. If nextSource is undefined or null, let keys be a new empty List.
3494 if (nextSource === undefined || nextSource === null) {
3498 // i. Let from be ! ToObject(nextSource).
3499 from = ToObject(nextSource);
3500 // ii. Let keys be ? from.[[OwnPropertyKeys]]().
3502 This step in our polyfill is not complying with the specification.
3503 [[OwnPropertyKeys]] is meant to return ALL keys, including non-enumerable and symbols.
3504 TODO: When we have Reflect.ownKeys, use that instead as it is the userland equivalent of [[OwnPropertyKeys]].
3506 keys = Object.keys(from);
3509 // c. For each element nextKey of keys in List order, do
3510 for (index2 = 0; index2 < keys.length; index2++) {
3511 var nextKey = keys[index2];
3514 // i. Let desc be ? from.[[GetOwnProperty]](nextKey).
3515 var desc = Object.getOwnPropertyDescriptor(from, nextKey);
3516 // ii. If desc is not undefined and desc.[[Enumerable]] is true, then
3517 enumerable = desc !== undefined && desc.enumerable === true;
3519 // Polyfill.io - We use Object.prototype.propertyIsEnumerable as a fallback
3520 // because `Object.getOwnPropertyDescriptor(window.location, 'hash')` causes Internet Explorer 11 to crash.
3521 enumerable = Object.prototype.propertyIsEnumerable.call(from, nextKey);
3524 // 1. Let propValue be ? Get(from, nextKey).
3525 var propValue = Get(from, nextKey);
3526 // 2. Perform ? Set(to, nextKey, propValue, true).
3527 to[nextKey] = propValue;
3537 if (!("defineProperties"in Object
3540 // Object.defineProperties
3541 /* global CreateMethodProperty, Get, ToObject, Type */
3542 // 19.1.2.3. Object.defineProperties ( O, Properties )
3543 CreateMethodProperty(Object, 'defineProperties', function defineProperties(O, Properties) {
3544 // 1. If Type(O) is not Object, throw a TypeError exception.
3545 if (Type(O) !== 'object') {
3546 throw new TypeError('Object.defineProperties called on non-object');
3548 // 2. Let props be ? ToObject(Properties).
3549 var props = ToObject(Properties);
3550 // 3. Let keys be ? props.[[OwnPropertyKeys]]().
3552 Polyfill.io - This step in our polyfill is not complying with the specification.
3553 [[OwnPropertyKeys]] is meant to return ALL keys, including non-enumerable and symbols.
3554 TODO: When we have Reflect.ownKeys, use that instead as it is the userland equivalent of [[OwnPropertyKeys]].
3556 var keys = Object.keys(props);
3557 // 4. Let descriptors be a new empty List.
3558 var descriptors = [];
3559 // 5. For each element nextKey of keys in List order, do
3560 for (var i = 0; i < keys.length; i++) {
3561 var nextKey = keys[i];
3562 // a. Let propDesc be ? props.[[GetOwnProperty]](nextKey).
3563 var propDesc = Object.getOwnPropertyDescriptor(props, nextKey);
3564 // b. If propDesc is not undefined and propDesc.[[Enumerable]] is true, then
3565 if (propDesc !== undefined && propDesc.enumerable) {
3566 // i. Let descObj be ? Get(props, nextKey).
3567 var descObj = Get(props, nextKey);
3568 // ii. Let desc be ? ToPropertyDescriptor(descObj).
3569 // Polyfill.io - We skip this step because Object.defineProperty deals with it.
3570 // TODO: Implement this step?
3572 // iii. Append the pair (a two element List) consisting of nextKey and desc to the end of descriptors.
3573 descriptors.push([nextKey, desc]);
3576 // 6. For each pair from descriptors in list order, do
3577 for (var i = 0; i < descriptors.length; i++){
3578 // a. Let P be the first element of pair.
3579 var P = descriptors[i][0];
3580 // b. Let desc be the second element of pair.
3581 var desc = descriptors[i][1];
3582 // c. Perform ? DefinePropertyOrThrow(O, P, desc).
3583 Object.defineProperty(O, P, desc);
3591 if (!("create"in Object
3595 /* global CreateMethodProperty, Type */
3596 CreateMethodProperty(Object, 'create', function create(O, properties) {
3597 // 1. If Type(O) is neither Object nor Null, throw a TypeError exception.
3598 if (Type(O) !== 'object' && Type(O) !== 'null') {
3599 throw new TypeError('Object prototype may only be an Object or null');
3601 // 2. Let obj be ObjectCreate(O).
3602 var obj = new Function('e', 'function Object() {}Object.prototype=e;return new Object')(O);
3604 obj.constructor.prototype = O;
3606 // 3. If Properties is not undefined, then
3607 if (1 in arguments) {
3608 // a. Return ? ObjectDefineProperties(obj, Properties).
3609 return Object.defineProperties(obj, properties);
3618 // _ESAbstract.OrdinaryCreateFromConstructor
3619 /* global GetPrototypeFromConstructor */
3620 // 9.1.13. OrdinaryCreateFromConstructor ( constructor, intrinsicDefaultProto [ , internalSlotsList ] )
3621 function OrdinaryCreateFromConstructor(constructor, intrinsicDefaultProto) { // eslint-disable-line no-unused-vars
3622 var internalSlotsList = arguments[2] || {};
3623 // 1. Assert: intrinsicDefaultProto is a String value that is this specification's name of an intrinsic object.
3624 // The corresponding object must be an intrinsic that is intended to be used as the[[Prototype]] value of an object.
3626 // 2. Let proto be ? GetPrototypeFromConstructor(constructor, intrinsicDefaultProto).
3627 var proto = GetPrototypeFromConstructor(constructor, intrinsicDefaultProto);
3629 // 3. Return ObjectCreate(proto, internalSlotsList).
3630 // Polyfill.io - We do not pass internalSlotsList to Object.create because Object.create does not use the default ordinary object definitions specified in 9.1.
3631 var obj = Object.create(proto);
3632 for (var name in internalSlotsList) {
3633 if (Object.prototype.hasOwnProperty.call(internalSlotsList, name)) {
3634 Object.defineProperty(obj, name, {
3638 value: internalSlotsList[name]
3645 // _ESAbstract.Construct
3646 /* global IsConstructor, OrdinaryCreateFromConstructor, Call */
3647 // 7.3.13. Construct ( F [ , argumentsList [ , newTarget ]] )
3648 function Construct(F /* [ , argumentsList [ , newTarget ]] */) { // eslint-disable-line no-unused-vars
3649 // 1. If newTarget is not present, set newTarget to F.
3650 var newTarget = arguments.length > 2 ? arguments[2] : F;
3652 // 2. If argumentsList is not present, set argumentsList to a new empty List.
3653 var argumentsList = arguments.length > 1 ? arguments[1] : [];
3655 // 3. Assert: IsConstructor(F) is true.
3656 if (!IsConstructor(F)) {
3657 throw new TypeError('F must be a constructor.');
3660 // 4. Assert: IsConstructor(newTarget) is true.
3661 if (!IsConstructor(newTarget)) {
3662 throw new TypeError('newTarget must be a constructor.');
3665 // 5. Return ? F.[[Construct]](argumentsList, newTarget).
3666 // Polyfill.io - If newTarget is the same as F, it is equivalent to new F(...argumentsList).
3667 if (newTarget === F) {
3668 return new (Function.prototype.bind.apply(F, [null].concat(argumentsList)))();
3670 // Polyfill.io - This is mimicking section 9.2.2 step 5.a.
3671 var obj = OrdinaryCreateFromConstructor(newTarget, Object.prototype);
3672 return Call(F, obj, argumentsList);
3676 // _ESAbstract.ArraySpeciesCreate
3677 /* global IsArray, ArrayCreate, Get, Type, IsConstructor, Construct */
3678 // 9.4.2.3. ArraySpeciesCreate ( originalArray, length )
3679 function ArraySpeciesCreate(originalArray, length) { // eslint-disable-line no-unused-vars
3680 // 1. Assert: length is an integer Number ≥ 0.
3681 // 2. If length is -0, set length to +0.
3682 if (1/length === -Infinity) {
3686 // 3. Let isArray be ? IsArray(originalArray).
3687 var isArray = IsArray(originalArray);
3689 // 4. If isArray is false, return ? ArrayCreate(length).
3690 if (isArray === false) {
3691 return ArrayCreate(length);
3694 // 5. Let C be ? Get(originalArray, "constructor").
3695 var C = Get(originalArray, 'constructor');
3697 // Polyfill.io - We skip this section as not sure how to make a cross-realm normal Array, a same-realm Array.
3698 // 6. If IsConstructor(C) is true, then
3699 // if (IsConstructor(C)) {
3700 // a. Let thisRealm be the current Realm Record.
3701 // b. Let realmC be ? GetFunctionRealm(C).
3702 // c. If thisRealm and realmC are not the same Realm Record, then
3703 // i. If SameValue(C, realmC.[[Intrinsics]].[[%Array%]]) is true, set C to undefined.
3705 // 7. If Type(C) is Object, then
3706 if (Type(C) === 'object') {
3707 // a. Set C to ? Get(C, @@species).
3708 C = 'Symbol' in this && 'species' in this.Symbol ? Get(C, this.Symbol.species) : undefined;
3709 // b. If C is null, set C to undefined.
3714 // 8. If C is undefined, return ? ArrayCreate(length).
3715 if (C === undefined) {
3716 return ArrayCreate(length);
3718 // 9. If IsConstructor(C) is false, throw a TypeError exception.
3719 if (!IsConstructor(C)) {
3720 throw new TypeError('C must be a constructor');
3722 // 10. Return ? Construct(C, « length »).
3723 return Construct(C, [length]);
3725 if (!("filter"in Array.prototype
3728 // Array.prototype.filter
3729 /* global CreateMethodProperty, ToObject, ToLength, Get, IsCallable, ArraySpeciesCreate, ToString, HasProperty, ToBoolean, Call, CreateDataPropertyOrThrow */
3730 // 22.1.3.7. Array.prototype.filter ( callbackfn [ , thisArg ] )
3731 CreateMethodProperty(Array.prototype, 'filter', function filter(callbackfn /* [ , thisArg ] */) {
3732 // 1. Let O be ? ToObject(this value).
3733 var O = ToObject(this);
3734 // 2. Let len be ? ToLength(? Get(O, "length")).
3735 var len = ToLength(Get(O, "length"));
3736 // 3. If IsCallable(callbackfn) is false, throw a TypeError exception.
3737 if (IsCallable(callbackfn) === false) {
3738 throw new TypeError(callbackfn + ' is not a function');
3740 // 4. If thisArg is present, let T be thisArg; else let T be undefined.
3741 var T = arguments.length > 1 ? arguments[1] : undefined;
3742 // 5. Let A be ? ArraySpeciesCreate(O, 0).
3743 var A = ArraySpeciesCreate(O, 0);
3748 // 8. Repeat, while k < len
3750 // a. Let Pk be ! ToString(k).
3751 var Pk = ToString(k);
3752 // b. Let kPresent be ? HasProperty(O, Pk).
3753 var kPresent = HasProperty(O, Pk);
3754 // c. If kPresent is true, then
3756 // i. Let kValue be ? Get(O, Pk).
3757 var kValue = Get(O, Pk);
3758 // ii. Let selected be ToBoolean(? Call(callbackfn, T, « kValue, k, O »)).
3759 var selected = ToBoolean(Call(callbackfn, T, [kValue, k, O]));
3760 // iii. If selected is true, then
3762 // 1. Perform ? CreateDataPropertyOrThrow(A, ! ToString(to), kValue)
3763 CreateDataPropertyOrThrow(A, ToString(to), kValue);
3764 // 2. Increase to by 1.
3769 // d. Increase k by 1.
3778 if (!("map"in Array.prototype
3781 // Array.prototype.map
3782 /* global ArraySpeciesCreate, Call, CreateDataPropertyOrThrow, CreateMethodProperty, Get, HasProperty, IsCallable, ToLength, ToObject, ToString */
3783 /* global CreateMethodProperty, ToObject, ToLength, Get, ArraySpeciesCreate, ToString, HasProperty, Call, CreateDataPropertyOrThrow */
3784 // 22.1.3.16. Array.prototype.map ( callbackfn [ , thisArg ] )
3785 CreateMethodProperty(Array.prototype, 'map', function map(callbackfn /* [ , thisArg ] */) {
3786 // 1. Let O be ? ToObject(this value).
3787 var O = ToObject(this);
3788 // 2. Let len be ? ToLength(? Get(O, "length")).
3789 var len = ToLength(Get(O, "length"));
3790 // 3. If IsCallable(callbackfn) is false, throw a TypeError exception.
3791 if (IsCallable(callbackfn) === false) {
3792 throw new TypeError(callbackfn + ' is not a function');
3794 // 4. If thisArg is present, let T be thisArg; else let T be undefined.
3795 var T = arguments.length > 1 ? arguments[1] : undefined;
3796 // 5. Let A be ? ArraySpeciesCreate(O, len).
3797 var A = ArraySpeciesCreate(O, len);
3800 // 7. Repeat, while k < len
3802 // a. Let Pk be ! ToString(k).
3803 var Pk = ToString(k);
3804 // b. Let kPresent be ? HasProperty(O, Pk).
3805 var kPresent = HasProperty(O, Pk);
3806 // c. If kPresent is true, then
3808 // i. Let kValue be ? Get(O, Pk).
3809 var kValue = Get(O, Pk);
3810 // ii. Let mappedValue be ? Call(callbackfn, T, « kValue, k, O »).
3811 var mappedValue = Call(callbackfn, T, [kValue, k, O]);
3812 // iii. Perform ? CreateDataPropertyOrThrow(A, Pk, mappedValue).
3813 CreateDataPropertyOrThrow(A, Pk, mappedValue);
3815 // d. Increase k by 1.
3828 /* global ArrayCreate, Construct, CreateDataPropertyOrThrow, CreateMethodProperty, IsConstructor, ToString */
3829 // 22.1.2.3. Array.of ( ...items )
3830 CreateMethodProperty(Array, 'of', function of() {
3831 // 1. Let len be the actual number of arguments passed to this function.
3832 var len = arguments.length;
3833 // 2. Let items be the List of arguments passed to this function.
3834 var items = arguments;
3835 // 3. Let C be the this value.
3837 // 4. If IsConstructor(C) is true, then
3838 if (IsConstructor(C)) {
3839 // a. Let A be ? Construct(C, « len »).
3840 var A = Construct(C, [len]);
3843 // a. Let A be ? ArrayCreate(len).
3844 var A = ArrayCreate(len);
3848 // 7. Repeat, while k < len
3850 // a. Let kValue be items[k].
3851 var kValue = items[k];
3852 // b. Let Pk be ! ToString(k).
3853 var Pk = ToString(k);
3854 // c. Perform ? CreateDataPropertyOrThrow(A, Pk, kValue).
3855 CreateDataPropertyOrThrow(A, Pk, kValue);
3856 // d. Increase k by 1.
3860 // 8. Perform ? Set(A, "length", len, true)
3868 if (!("seal"in Object&&function(){try{return Object.seal("1"),!0}catch(t){return!1}}
3872 /* global CreateMethodProperty, Type */
3873 // 19.1.2.19 Object.seal ( O )
3874 (function(originalObjectSeal) {
3875 CreateMethodProperty(Object, 'seal', function seal(O) {
3876 // 1. If Type(O) is not Object, return O.
3877 if (Type(O) === 'object') {
3880 // 2. Let status be ? SetIntegrityLevel(O, "sealed").
3881 // 3. If status is false, throw a TypeError exception.
3883 return originalObjectSeal ? originalObjectSeal(O) : O;
3891 // Object.setPrototypeOf
3892 /* global CreateMethodProperty */
3893 // ES6-shim 0.16.0 (c) 2013-2014 Paul Miller (http://paulmillr.com)
3894 // ES6-shim may be freely distributed under the MIT license.
3895 // For more details and documentation:
3896 // https://github.com/paulmillr/es6-shim/
3898 // NOTE: This versions needs object ownership
3899 // because every promoted object needs to be reassigned
3900 // otherwise uncompatible browsers cannot work as expected
3902 // NOTE: This might need es5-shim or polyfills upfront
3903 // because it's based on ES5 API.
3904 // (probably just an IE <= 8 problem)
3906 // NOTE: nodejs is fine in version 0.8, 0.10, and future versions.
3908 if (Object.setPrototypeOf) { return; }
3910 /*jshint proto: true */
3911 // @author Andrea Giammarchi - @WebReflection
3913 var getOwnPropertyNames = Object.getOwnPropertyNames;
3914 var getOwnPropertyDescriptor = Object.getOwnPropertyDescriptor;
3915 var create = Object.create;
3916 var defineProperty = Object.defineProperty;
3917 var getPrototypeOf = Object.getPrototypeOf;
3918 var objProto = Object.prototype;
3920 var copyDescriptors = function (target, source) {
3921 // define into target descriptors from source
3922 getOwnPropertyNames(source).forEach(function (key) {
3926 getOwnPropertyDescriptor(source, key)
3931 // used as fallback when no promotion is possible
3932 var createAndCopy = function setPrototypeOf(origin, proto) {
3933 return copyDescriptors(create(proto), origin);
3937 // this might fail for various reasons
3938 // ignore if Chrome cought it at runtime
3939 set = getOwnPropertyDescriptor(objProto, '__proto__').set;
3941 // setter not poisoned, it can promote
3943 sPOf = function setPrototypeOf(origin, proto) {
3944 set.call(origin, proto);
3948 // do one or more feature detections
3949 set = { __proto__: null };
3950 // if proto does not work, needs to fallback
3951 // some Opera, Rhino, ducktape
3952 if (set instanceof Object) {
3953 sPOf = createAndCopy;
3955 // verify if null objects are buggy
3956 /* eslint-disable no-proto */
3957 set.__proto__ = objProto;
3958 /* eslint-enable no-proto */
3959 // if null objects are buggy
3960 // nodejs 0.8 to 0.10
3961 if (set instanceof Object) {
3962 sPOf = function setPrototypeOf(origin, proto) {
3963 // use such bug to promote
3964 /* eslint-disable no-proto */
3965 origin.__proto__ = proto;
3966 /* eslint-enable no-proto */
3970 // try to use proto or fallback
3971 // Safari, old Firefox, many others
3972 sPOf = function setPrototypeOf(origin, proto) {
3973 // if proto is not null
3974 if (getPrototypeOf(origin)) {
3975 // use __proto__ to promote
3976 /* eslint-disable no-proto */
3977 origin.__proto__ = proto;
3978 /* eslint-enable no-proto */
3981 // otherwise unable to promote: fallback
3982 return createAndCopy(origin, proto);
3988 CreateMethodProperty(Object, 'setPrototypeOf', sPOf);
3990 if (!("Promise"in this
3994 !function(n){function t(r){if(e[r])return e[r].exports;var o=e[r]={i:r,l:!1,exports:{}};return n[r].call(o.exports,o,o.exports,t),o.l=!0,o.exports}var e={};t.m=n,t.c=e,t.i=function(n){return n},t.d=function(n,e,r){t.o(n,e)||Object.defineProperty(n,e,{configurable:!1,enumerable:!0,get:r})},t.n=function(n){var e=n&&n.__esModule?function(){return n["default"]}:function(){return n};return t.d(e,"a",e),e},t.o=function(n,t){return Object.prototype.hasOwnProperty.call(n,t)},t.p="",t(t.s=100)}({100:/*!***********************!*\
3995 !*** ./src/global.js ***!
3996 \***********************/
3997 function(n,t,e){(function(n){var t=e(/*! ./yaku */5);try{n.Promise=t,window.Promise=t}catch(r){}}).call(t,e(/*! ./../~/webpack/buildin/global.js */2))},2:/*!***********************************!*\
3998 !*** (webpack)/buildin/global.js ***!
3999 \***********************************/
4000 function(n,t){var e;e=function(){return this}();try{e=e||Function("return this")()||(0,eval)("this")}catch(r){"object"==typeof window&&(e=window)}n.exports=e},5:/*!*********************!*\
4001 !*** ./src/yaku.js ***!
4002 \*********************/
4003 function(n,t,e){(function(t){!function(){"use strict";function e(){return rn[q][B]||D}function r(n){return n&&"object"==typeof n}function o(n){return"function"==typeof n}function i(n,t){return n instanceof t}function u(n){return i(n,M)}function c(n,t,e){if(!t(n))throw h(e)}function f(){try{return R.apply(S,arguments)}catch(n){return nn.e=n,nn}}function s(n,t){return R=n,S=t,f}function a(n,t){function e(){for(var e=0;e<o;)t(r[e],r[e+1]),r[e++]=P,r[e++]=P;o=0,r.length>n&&(r.length=n)}var r=A(n),o=0;return function(n,t){r[o++]=n,r[o++]=t,2===o&&rn.nextTick(e)}}function l(n,t){var e,r,u,c,f=0;if(!n)throw h(Q);var a=n[rn[q][z]];if(o(a))r=a.call(n);else{if(!o(n.next)){if(i(n,A)){for(e=n.length;f<e;)t(n[f],f++);return f}throw h(Q)}r=n}for(;!(u=r.next()).done;)if((c=s(t)(u.value,f++))===nn)throw o(r[G])&&r[G](),c.e;return f}function h(n){return new TypeError(n)}function v(n){return(n?"":V)+(new M).stack}function _(n,t){var e="on"+n.toLowerCase(),r=O[e];H&&H.listeners(n).length?n===Z?H.emit(n,t._v,t):H.emit(n,t):r?r({reason:t._v,promise:t}):rn[n](t._v,t)}function p(n){return n&&n._s}function d(n){if(p(n))return new n(tn);var t,e,r;return t=new n(function(n,o){if(t)throw h();e=n,r=o}),c(e,o),c(r,o),t}function w(n,t){var e=!1;return function(r){e||(e=!0,L&&(n[N]=v(!0)),t===Y?k(n,r):x(n,t,r))}}function y(n,t,e,r){return o(e)&&(t._onFulfilled=e),o(r)&&(n[J]&&_(X,n),t._onRejected=r),L&&(t._p=n),n[n._c++]=t,n._s!==$&&on(n,t),t}function m(n){if(n._umark)return!0;n._umark=!0;for(var t,e=0,r=n._c;e<r;)if(t=n[e++],t._onRejected||m(t))return!0}function j(n,t){function e(n){return r.push(n.replace(/^\s+|\s+$/g,""))}var r=[];return L&&(t[N]&&e(t[N]),function o(n){n&&K in n&&(o(n._next),e(n[K]+""),o(n._p))}(t)),(n&&n.stack?n.stack:n)+("\n"+r.join("\n")).replace(en,"")}function g(n,t){return n(t)}function x(n,t,e){var r=0,o=n._c;if(n._s===$)for(n._s=t,n._v=e,t===U&&(L&&u(e)&&(e.longStack=j(e,n)),un(n));r<o;)on(n,n[r++]);return n}function k(n,t){if(t===n&&t)return x(n,U,h(W)),n;if(t!==C&&(o(t)||r(t))){var e=s(b)(t);if(e===nn)return x(n,U,e.e),n;o(e)?(L&&p(t)&&(n._next=t),p(t)?T(n,t,e):rn.nextTick(function(){T(n,t,e)})):x(n,Y,t)}else x(n,Y,t);return n}function b(n){return n.then}function T(n,t,e){var r=s(e,t)(function(e){t&&(t=C,k(n,e))},function(e){t&&(t=C,x(n,U,e))});r===nn&&t&&(x(n,U,r.e),t=C)}var P,R,S,C=null,F="object"==typeof self,O=F?self:t,E=O.Promise,H=O.process,I=O.console,L=!1,A=Array,M=Error,U=1,Y=2,$=3,q="Symbol",z="iterator",B="species",D=q+"("+B+")",G="return",J="_uh",K="_pt",N="_st",Q="Invalid argument",V="\nFrom previous ",W="Chaining cycle detected for promise",X="rejectionHandled",Z="unhandledRejection",nn={e:C},tn=function(){},en=/^.+\/node_modules\/yaku\/.+\n?/gm,rn=function(n){var t,e=this;if(!r(e)||e._s!==P)throw h("Invalid this");if(e._s=$,L&&(e[K]=v()),n!==tn){if(!o(n))throw h(Q);t=s(n)(w(e,Y),w(e,U)),t===nn&&x(e,U,t.e)}};rn["default"]=rn,function(n,t){for(var e in t)n[e]=t[e]}(rn.prototype,{then:function(n,t){if(this._s===undefined)throw h();return y(this,d(rn.speciesConstructor(this,rn)),n,t)},"catch":function(n){return this.then(P,n)},"finally":function(n){return this.then(function(t){return rn.resolve(n()).then(function(){return t})},function(t){return rn.resolve(n()).then(function(){throw t})})},_c:0,_p:C}),rn.resolve=function(n){return p(n)?n:k(d(this),n)},rn.reject=function(n){return x(d(this),U,n)},rn.race=function(n){var t=this,e=d(t),r=function(n){x(e,Y,n)},o=function(n){x(e,U,n)},i=s(l)(n,function(n){t.resolve(n).then(r,o)});return i===nn?t.reject(i.e):e},rn.all=function(n){function t(n){x(o,U,n)}var e,r=this,o=d(r),i=[];return(e=s(l)(n,function(n,u){r.resolve(n).then(function(n){i[u]=n,--e||x(o,Y,i)},t)}))===nn?r.reject(e.e):(e||x(o,Y,[]),o)},rn.Symbol=O[q]||{},s(function(){Object.defineProperty(rn,e(),{get:function(){return this}})})(),rn.speciesConstructor=function(n,t){var r=n.constructor;return r?r[e()]||t:t},rn.unhandledRejection=function(n,t){I&&I.error("Uncaught (in promise)",L?t.longStack:j(n,t))},rn.rejectionHandled=tn,rn.enableLongStackTrace=function(){L=!0},rn.nextTick=F?function(n){E?new E(function(n){n()}).then(n):setTimeout(n)}:H.nextTick,rn._s=1;var on=a(999,function(n,t){var e,r;return(r=n._s!==U?t._onFulfilled:t._onRejected)===P?void x(t,n._s,n._v):(e=s(g)(r,n._v))===nn?void x(t,U,e.e):void k(t,e)}),un=a(9,function(n){m(n)||(n[J]=1,_(Z,n))});try{n.exports=rn}catch(cn){O.Yaku=rn}}()}).call(t,e(/*! ./../~/webpack/buildin/global.js */2))}});
4006 if (!("flags"in RegExp.prototype
4009 // RegExp.prototype.flags
4010 /* global Get, ToBoolean, Type */
4011 Object.defineProperty(RegExp.prototype, 'flags', {
4015 // 21.2.5.3.1 Let R be the this value.
4018 // 21.2.5.3.2 If Type(R) is not Object, throw a TypeError exception.
4019 if (Type(R) !== 'object') {
4020 throw new TypeError('Method called on incompatible type: must be an object.');
4022 // 21.2.5.3.3 Let result be the empty String.
4025 // 21.2.5.3.4 Let global be ToBoolean(? Get(R, "global")).
4026 var global = ToBoolean(Get(R, 'global'));
4028 // 21.2.5.3.5 If global is true, append the code unit 0x0067 (LATIN SMALL LETTER G) as the last code unit of result.
4033 // 21.2.5.3.6 Let ignoreCase be ToBoolean(? Get(R, "ignoreCase")).
4034 var ignoreCase = ToBoolean(Get(R, 'ignoreCase'));
4036 // 21.2.5.3.7 If ignoreCase is true, append the code unit 0x0069 (LATIN SMALL LETTER I) as the last code unit of result.
4041 // 21.2.5.3.8 Let multiline be ToBoolean(? Get(R, "multiline")).
4042 var multiline = ToBoolean(Get(R, 'multiline'));
4044 // 21.2.5.3.9 If multiline is true, append the code unit 0x006D (LATIN SMALL LETTER M) as the last code unit of result.
4049 // 21.2.5.3.10 Let unicode be ToBoolean(? Get(R, "unicode")).
4050 var unicode = ToBoolean(Get(R, 'unicode'));
4052 // 21.2.5.3.11 If unicode is true, append the code unit 0x0075 (LATIN SMALL LETTER U) as the last code unit of result.
4057 // 21.2.5.3.12 Let sticky be ToBoolean(? Get(R, "sticky")).
4058 var sticky = ToBoolean(Get(R, 'sticky'));
4060 // 21.2.5.3.13 If sticky is true, append the code unit 0x0079 (LATIN SMALL LETTER Y) as the last code unit of result.
4065 // 21.2.5.3.14 Return result.
4072 if (!("fromCodePoint"in String&&1===String.fromCodePoint.length
4075 // String.fromCodePoint
4076 /* global CreateMethodProperty, IsArray, SameValue, ToInteger, ToNumber, UTF16Encoding */
4078 // 21.1.2.2. String.fromCodePoint ( ...codePoints )
4079 CreateMethodProperty(String, 'fromCodePoint', function fromCodePoint(_) { // eslint-disable-line no-unused-vars
4080 // Polyfill.io - List to store the characters whilst iterating over the code points.
4082 // 1. Let codePoints be a List containing the arguments passed to this function.
4083 var codePoints = arguments;
4084 // 2. Let length be the number of elements in codePoints.
4085 var length = arguments.length;
4086 // 3. Let elements be a new empty List.
4088 // 4. Let nextIndex be 0.
4090 // 5. Repeat, while nextIndex < length
4091 while (nextIndex < length) {
4092 // Polyfill.io - We reset the elements List as we store the partial results in the result List.
4094 // a. Let next be codePoints[nextIndex].
4095 var next = codePoints[nextIndex];
4096 // b. Let nextCP be ? ToNumber(next).
4097 var nextCP = ToNumber(next);
4098 // c. If SameValue(nextCP, ToInteger(nextCP)) is false, throw a RangeError exception.
4099 if (SameValue(nextCP, ToInteger(nextCP)) === false) {
4100 throw new RangeError('Invalid code point ' + Object.prototype.toString.call(nextCP));
4102 // d. If nextCP < 0 or nextCP > 0x10FFFF, throw a RangeError exception.
4103 if (nextCP < 0 || nextCP > 0x10FFFF) {
4104 throw new RangeError('Invalid code point ' + Object.prototype.toString.call(nextCP));
4106 // e. Append the elements of the UTF16Encoding of nextCP to the end of elements.
4107 // Polyfill.io - UTF16Encoding can return a single codepoint or a list of multiple codepoints.
4108 var cp = UTF16Encoding(nextCP);
4110 elements = elements.concat(cp);
4114 // f. Let nextIndex be nextIndex + 1.
4115 nextIndex = nextIndex + 1;
4117 // Polyfill.io - Retrieving the characters whilst iterating enables the function to work in a memory efficient and performant way.
4118 result.push(String.fromCharCode.apply(null, elements));
4120 // 6. Return the String value whose elements are, in order, the elements in the List elements. If length is 0, the empty string is returned.
4121 return length === 0 ? '' : result.join('');
4126 if (!("codePointAt"in String.prototype
4129 // String.prototype.codePointAt
4130 /* global CreateMethodProperty, RequireObjectCoercible, ToInteger, ToString, UTF16Decode */
4131 // 21.1.3.3. String.prototype.codePointAt ( pos )
4132 CreateMethodProperty(String.prototype, 'codePointAt', function codePointAt(pos) {
4133 // 1. Let O be ? RequireObjectCoercible(this value).
4134 var O = RequireObjectCoercible(this);
4135 // 2. Let S be ? ToString(O).
4136 var S = ToString(O);
4137 // 3. Let position be ? ToInteger(pos).
4138 var position = ToInteger(pos);
4139 // 4. Let size be the length of S.
4140 var size = S.length;
4141 // 5. If position < 0 or position ≥ size, return undefined.
4142 if (position < 0 || position >= size) {
4145 // 6. Let first be the numeric value of the code unit at index position within the String S.
4146 var first = String.prototype.charCodeAt.call(S, position);
4147 // 7. If first < 0xD800 or first > 0xDBFF or position+1 = size, return first.
4148 if (first < 0xD800 || first > 0xDBFF || position + 1 === size) {
4151 // 8. Let second be the numeric value of the code unit at index position+1 within the String S.
4152 var second = String.prototype.charCodeAt.call(S, position + 1);
4153 // 9. If second < 0xDC00 or second > 0xDFFF, return first.
4154 if (second < 0xDC00 || second > 0xDFFF) {
4157 // 10. Return UTF16Decode(first, second).
4158 // 21.1.3.3.10 Return UTF16Decode(first, second).
4159 return UTF16Decode(first, second);
4164 if (!("endsWith"in String.prototype
4167 // String.prototype.endsWith
4168 /* global CreateMethodProperty, IsRegExp, RequireObjectCoercible, ToInteger, ToString */
4169 // 21.1.3.6. String.prototype.endsWith ( searchString [ , endPosition ] )
4170 CreateMethodProperty(String.prototype, 'endsWith', function endsWith(searchString /* [ , endPosition ] */) {
4172 var endPosition = arguments.length > 1 ? arguments[1] : undefined;
4173 // 1. Let O be ? RequireObjectCoercible(this value).
4174 var O = RequireObjectCoercible(this);
4175 // 2. Let S be ? ToString(O).
4176 var S = ToString(O);
4177 // 3. Let isRegExp be ? IsRegExp(searchString).
4178 var isRegExp = IsRegExp(searchString);
4179 // 4. If isRegExp is true, throw a TypeError exception.
4181 throw new TypeError('First argument to String.prototype.endsWith must not be a regular expression');
4183 // 5. Let searchStr be ? ToString(searchString).
4184 var searchStr = ToString(searchString);
4185 // 6. Let len be the length of S.
4187 // 7. If endPosition is undefined, let pos be len, else let pos be ? ToInteger(endPosition).
4188 var pos = endPosition === undefined ? len : ToInteger(endPosition);
4189 // 8. Let end be min(max(pos, 0), len).
4190 var end = Math.min(Math.max(pos, 0), len);
4191 // 9. Let searchLength be the length of searchStr.
4192 var searchLength = searchStr.length;
4193 // 10. Let start be end - searchLength.
4194 var start = end - searchLength;
4195 // 11. If start is less than 0, return false.
4199 // 12. If the sequence of elements of S starting at start of length searchLength is the same as the full element sequence of searchStr, return true.
4200 if (S.substr(start, searchLength) === searchStr) {
4203 // 13. Otherwise, return false.
4209 if (!("includes"in String.prototype
4212 // String.prototype.includes
4213 /* global CreateMethodProperty, IsRegExp, RequireObjectCoercible, ToInteger, ToString */
4214 // 21.1.3.7. String.prototype.includes ( searchString [ , position ] )
4215 CreateMethodProperty(String.prototype, 'includes', function includes(searchString /* [ , position ] */) {
4217 var position = arguments.length > 1 ? arguments[1] : undefined;
4218 // 1. Let O be ? RequireObjectCoercible(this value).
4219 var O = RequireObjectCoercible(this);
4220 // 2. Let S be ? ToString(O).
4221 var S = ToString(O);
4222 // 3. Let isRegExp be ? IsRegExp(searchString).
4223 var isRegExp = IsRegExp(searchString);
4224 // 4. If isRegExp is true, throw a TypeError exception.
4226 throw new TypeError('First argument to String.prototype.includes must not be a regular expression');
4228 // 5. Let searchStr be ? ToString(searchString).
4229 var searchStr = ToString(searchString);
4230 // 6. Let pos be ? ToInteger(position). (If position is undefined, this step produces the value 0.)
4231 var pos = ToInteger(position);
4232 // 7. Let len be the length of S.
4234 // 8. Let start be min(max(pos, 0), len).
4235 var start = Math.min(Math.max(pos, 0), len);
4236 // 9. Let searchLen be the length of searchStr.
4237 // var searchLength = searchStr.length;
4238 // 10. If there exists any integer k not smaller than start such that k + searchLen is not greater than len, and for all nonnegative integers j less than searchLen, the code unit at index k+j within S is the same as the code unit at index j within searchStr, return true; but if there is no such integer k, return false.
4239 return String.prototype.indexOf.call(S, searchStr, start) !== -1;
4244 if (!("repeat"in String.prototype
4247 // String.prototype.repeat
4248 /* global CreateMethodProperty, RequireObjectCoercible, ToInteger, ToString */
4249 // 21.1.3.15String.prototype.repeat ( count )
4250 CreateMethodProperty(String.prototype, 'repeat', function repeat(count) {
4252 // 1. Let O be ? RequireObjectCoercible(this value).
4253 var O = RequireObjectCoercible(this);
4254 // 2. Let S be ? ToString(O).
4255 var S = ToString(O);
4256 // 3. Let n be ? ToInteger(count).
4257 var n = ToInteger(count);
4258 // 4. If n < 0, throw a RangeError exception.
4260 throw new RangeError('Invalid count value');
4262 // 5. If n is +∞, throw a RangeError exception.
4263 if (n === Infinity) {
4264 throw new RangeError('Invalid count value');
4266 // 6. Let T be the String value that is made from n copies of S appended together. If n is 0, T is the empty String.
4267 var T = n === 0 ? '' : new Array(n + 1).join(S);
4274 if (!("startsWith"in String.prototype
4277 // String.prototype.startsWith
4278 /* global CreateMethodProperty, IsRegExp, RequireObjectCoercible, ToInteger, ToString */
4279 // 21.1.3.20. String.prototype.startsWith ( searchString [ , position ] )
4280 CreateMethodProperty(String.prototype, 'startsWith', function startsWith(searchString /* [ , position ] */) {
4282 var position = arguments.length > 1 ? arguments[1] : undefined;
4283 // 1. Let O be ? RequireObjectCoercible(this value).
4284 var O = RequireObjectCoercible(this);
4285 // 2. Let S be ? ToString(O).
4286 var S = ToString(O);
4287 // 3. Let isRegExp be ? IsRegExp(searchString).
4288 var isRegExp = IsRegExp(searchString);
4289 // 4. If isRegExp is true, throw a TypeError exception.
4291 throw new TypeError('First argument to String.prototype.startsWith must not be a regular expression');
4293 // 5. Let searchStr be ? ToString(searchString).
4294 var searchStr = ToString(searchString);
4295 // 6. Let pos be ? ToInteger(position). (If position is undefined, this step produces the value 0.)
4296 var pos = ToInteger(position);
4297 // 7. Let len be the length of S.
4299 // 8. Let start be min(max(pos, 0), len).
4300 var start = Math.min(Math.max(pos, 0), len);
4301 // 9. Let searchLength be the length of searchStr.
4302 var searchLength = searchStr.length;
4303 // 10. If searchLength+start is greater than len, return false.
4304 if (searchLength + start > len) {
4307 // 11. If the sequence of elements of S starting at start of length searchLength is the same as the full element sequence of searchStr, return true.
4308 if (S.substr(start).indexOf(searchString) === 0) {
4311 // 12. Otherwise, return false.
4317 if (!("Symbol"in this&&0===this.Symbol.length
4321 // A modification of https://github.com/WebReflection/get-own-property-symbols
4322 // (C) Andrea Giammarchi - MIT Licensed
4324 (function (Object, GOPS, global) {
4325 'use strict'; //so that ({}).toString.call(null) returns the correct [object Null] rather than [object Window]
4329 var random = '' + Math.random();
4330 var prefix = '__\x01symbol:';
4331 var prefixLength = prefix.length;
4332 var internalSymbol = '__\x01symbol@@' + random;
4333 var DP = 'defineProperty';
4334 var DPies = 'defineProperties';
4335 var GOPN = 'getOwnPropertyNames';
4336 var GOPD = 'getOwnPropertyDescriptor';
4337 var PIE = 'propertyIsEnumerable';
4338 var ObjectProto = Object.prototype;
4339 var hOP = ObjectProto.hasOwnProperty;
4340 var pIE = ObjectProto[PIE];
4341 var toString = ObjectProto.toString;
4342 var concat = Array.prototype.concat;
4343 var cachedWindowNames = Object.getOwnPropertyNames ? Object.getOwnPropertyNames(window) : [];
4344 var nGOPN = Object[GOPN];
4345 var gOPN = function getOwnPropertyNames (obj) {
4346 if (toString.call(obj) === '[object Window]') {
4350 // IE bug where layout engine calls userland gOPN for cross-domain `window` objects
4351 return concat.call([], cachedWindowNames);
4356 var gOPD = Object[GOPD];
4357 var create = Object.create;
4358 var keys = Object.keys;
4359 var freeze = Object.freeze || Object;
4360 var defineProperty = Object[DP];
4361 var $defineProperties = Object[DPies];
4362 var descriptor = gOPD(Object, GOPN);
4363 var addInternalIfNeeded = function (o, uid, enumerable) {
4364 if (!hOP.call(o, internalSymbol)) {
4366 defineProperty(o, internalSymbol, {
4368 configurable: false,
4373 o[internalSymbol] = {};
4376 o[internalSymbol]['@@' + uid] = enumerable;
4378 var createWithSymbols = function (proto, descriptors) {
4379 var self = create(proto);
4380 gOPN(descriptors).forEach(function (key) {
4381 if (propertyIsEnumerable.call(descriptors, key)) {
4382 $defineProperty(self, key, descriptors[key]);
4387 var copyAsNonEnumerable = function (descriptor) {
4388 var newDescriptor = create(descriptor);
4389 newDescriptor.enumerable = false;
4390 return newDescriptor;
4392 var get = function get(){};
4393 var onlyNonSymbols = function (name) {
4394 return name != internalSymbol &&
4395 !hOP.call(source, name);
4397 var onlySymbols = function (name) {
4398 return name != internalSymbol &&
4399 hOP.call(source, name);
4401 var propertyIsEnumerable = function propertyIsEnumerable(key) {
4403 return onlySymbols(uid) ? (
4404 hOP.call(this, uid) &&
4405 this[internalSymbol]['@@' + uid]
4406 ) : pIE.call(this, key);
4408 var setAndGetSymbol = function (uid) {
4413 set: function (value) {
4414 setDescriptor(this, uid, {
4420 addInternalIfNeeded(this, uid, true);
4424 defineProperty(ObjectProto, uid, descriptor);
4426 ObjectProto[uid] = descriptor.value;
4428 return freeze(source[uid] = defineProperty(
4434 var Symbol = function Symbol() {
4435 var description = arguments[0];
4436 if (this instanceof Symbol) {
4437 throw new TypeError('Symbol is not a constructor');
4439 return setAndGetSymbol(
4440 prefix.concat(description || '', random, ++id)
4443 var source = create(null);
4444 var sourceConstructor = {value: Symbol};
4445 var sourceMap = function (uid) {
4448 var $defineProperty = function defineProp(o, key, descriptor) {
4450 if (onlySymbols(uid)) {
4451 setDescriptor(o, uid, descriptor.enumerable ?
4452 copyAsNonEnumerable(descriptor) : descriptor);
4453 addInternalIfNeeded(o, uid, !!descriptor.enumerable);
4455 defineProperty(o, key, descriptor);
4460 var onlyInternalSymbols = function (obj) {
4461 return function (name) {
4462 return hOP.call(obj, internalSymbol) && hOP.call(obj[internalSymbol], '@@' + name);
4465 var $getOwnPropertySymbols = function getOwnPropertySymbols(o) {
4466 return gOPN(o).filter(o === ObjectProto ? onlyInternalSymbols(o) : onlySymbols).map(sourceMap);
4470 descriptor.value = $defineProperty;
4471 defineProperty(Object, DP, descriptor);
4473 descriptor.value = $getOwnPropertySymbols;
4474 defineProperty(Object, GOPS, descriptor);
4476 descriptor.value = function getOwnPropertyNames(o) {
4477 return gOPN(o).filter(onlyNonSymbols);
4479 defineProperty(Object, GOPN, descriptor);
4481 descriptor.value = function defineProperties(o, descriptors) {
4482 var symbols = $getOwnPropertySymbols(descriptors);
4483 if (symbols.length) {
4484 keys(descriptors).concat(symbols).forEach(function (uid) {
4485 if (propertyIsEnumerable.call(descriptors, uid)) {
4486 $defineProperty(o, uid, descriptors[uid]);
4490 $defineProperties(o, descriptors);
4494 defineProperty(Object, DPies, descriptor);
4496 descriptor.value = propertyIsEnumerable;
4497 defineProperty(ObjectProto, PIE, descriptor);
4499 descriptor.value = Symbol;
4500 defineProperty(global, 'Symbol', descriptor);
4502 // defining `Symbol.for(key)`
4503 descriptor.value = function (key) {
4504 var uid = prefix.concat(prefix, key, random);
4505 return uid in ObjectProto ? source[uid] : setAndGetSymbol(uid);
4507 defineProperty(Symbol, 'for', descriptor);
4509 // defining `Symbol.keyFor(symbol)`
4510 descriptor.value = function (symbol) {
4511 if (onlyNonSymbols(symbol))
4512 throw new TypeError(symbol + ' is not a symbol');
4513 return hOP.call(source, symbol) ?
4514 symbol.slice(prefixLength * 2, -random.length) :
4518 defineProperty(Symbol, 'keyFor', descriptor);
4520 descriptor.value = function getOwnPropertyDescriptor(o, key) {
4521 var descriptor = gOPD(o, key);
4522 if (descriptor && onlySymbols(key)) {
4523 descriptor.enumerable = propertyIsEnumerable.call(o, key);
4527 defineProperty(Object, GOPD, descriptor);
4529 descriptor.value = function (proto, descriptors) {
4530 return arguments.length === 1 || typeof descriptors === "undefined" ?
4532 createWithSymbols(proto, descriptors);
4534 defineProperty(Object, 'create', descriptor);
4536 var strictModeSupported = (function(){ 'use strict'; return this; }).call(null) === null;
4537 if (strictModeSupported) {
4538 descriptor.value = function () {
4539 var str = toString.call(this);
4540 return (str === '[object String]' && onlySymbols(this)) ? '[object Symbol]' : str;
4543 descriptor.value = function () {
4544 // https://github.com/Financial-Times/polyfill-library/issues/164#issuecomment-486965300
4545 // Polyfill.io this code is here for the situation where a browser does not
4546 // support strict mode and is executing `Object.prototype.toString.call(null)`.
4547 // This code ensures that we return the correct result in that situation however,
4548 // this code also introduces a bug where it will return the incorrect result for
4549 // `Object.prototype.toString.call(window)`. We can't have the correct result for
4550 // both `window` and `null`, so we have opted for `null` as we believe this is the more
4551 // common situation.
4552 if (this === window) {
4553 return '[object Null]';
4556 var str = toString.call(this);
4557 return (str === '[object String]' && onlySymbols(this)) ? '[object Symbol]' : str;
4560 defineProperty(ObjectProto, 'toString', descriptor);
4562 setDescriptor = function (o, key, descriptor) {
4563 var protoDescriptor = gOPD(ObjectProto, key);
4564 delete ObjectProto[key];
4565 defineProperty(o, key, descriptor);
4566 if (o !== ObjectProto) {
4567 defineProperty(ObjectProto, key, protoDescriptor);
4571 }(Object, 'getOwnPropertySymbols', this));
4575 if (!("Symbol"in this&&"hasInstance"in this.Symbol
4578 // Symbol.hasInstance
4580 Object.defineProperty(Symbol, 'hasInstance', { value: Symbol('hasInstance') });
4584 if (!("Symbol"in this&&"isConcatSpreadable"in this.Symbol
4587 // Symbol.isConcatSpreadable
4589 Object.defineProperty(Symbol, 'isConcatSpreadable', { value: Symbol('isConcatSpreadable') });
4593 if (!("Symbol"in this&&"iterator"in this.Symbol
4598 Object.defineProperty(Symbol, 'iterator', { value: Symbol('iterator') });
4603 // _ESAbstract.GetIterator
4604 /* global GetMethod, Symbol, Call, Type, GetV */
4605 // 7.4.1. GetIterator ( obj [ , method ] )
4606 // The abstract operation GetIterator with argument obj and optional argument method performs the following steps:
4607 function GetIterator(obj /*, method */) { // eslint-disable-line no-unused-vars
4608 // 1. If method is not present, then
4609 // a. Set method to ? GetMethod(obj, @@iterator).
4610 var method = arguments.length > 1 ? arguments[1] : GetMethod(obj, Symbol.iterator);
4611 // 2. Let iterator be ? Call(method, obj).
4612 var iterator = Call(method, obj);
4613 // 3. If Type(iterator) is not Object, throw a TypeError exception.
4614 if (Type(iterator) !== 'object') {
4615 throw new TypeError('bad iterator');
4617 // 4. Let nextMethod be ? GetV(iterator, "next").
4618 var nextMethod = GetV(iterator, "next");
4619 // 5. Let iteratorRecord be Record {[[Iterator]]: iterator, [[NextMethod]]: nextMethod, [[Done]]: false}.
4620 var iteratorRecord = Object.create(null);
4621 iteratorRecord['[[Iterator]]'] = iterator;
4622 iteratorRecord['[[NextMethod]]'] = nextMethod;
4623 iteratorRecord['[[Done]]'] = false;
4624 // 6. Return iteratorRecord.
4625 return iteratorRecord;
4627 if (!("Symbol"in this&&"match"in this.Symbol
4632 Object.defineProperty(Symbol, 'match', { value: Symbol('match') });
4636 if (!("Symbol"in this&&"replace"in this.Symbol
4641 Object.defineProperty(Symbol, 'replace', { value: Symbol('replace') });
4645 if (!("Symbol"in this&&"search"in this.Symbol
4650 Object.defineProperty(Symbol, 'search', { value: Symbol('search') });
4654 if (!("Symbol"in this&&"species"in this.Symbol
4659 Object.defineProperty(Symbol, 'species', { value: Symbol('species') });
4663 if (!("Map"in this&&function(t){try{var n=new Map([[1,1],[2,2]])
4664 return 0===Map.length&&2===n.size&&"Symbol"in t&&"iterator"in Symbol&&"function"==typeof n[Symbol.iterator]}catch(i){return!1}}(this)
4668 /* global CreateIterResultObject, CreateMethodProperty, GetIterator, IsCallable, IteratorClose, IteratorStep, IteratorValue, OrdinaryCreateFromConstructor, SameValueZero, Type, Symbol */
4669 (function (global) {
4670 var supportsGetters = (function () {
4673 Object.defineProperty(a, 't', {
4687 // Deleted map items mess with iterator pointers, so rather than removing them mark them as deleted. Can't use undefined or null since those both valid keys so use a private symbol.
4688 var undefMarker = Symbol('undef');
4689 // 23.1.1.1 Map ( [ iterable ] )
4690 var Map = function Map(/* iterable */) {
4691 // 1. If NewTarget is undefined, throw a TypeError exception.
4692 if (!(this instanceof Map)) {
4693 throw new TypeError('Constructor Map requires "new"');
4695 // 2. Let map be ? OrdinaryCreateFromConstructor(NewTarget, "%MapPrototype%", « [[MapData]] »).
4696 var map = OrdinaryCreateFromConstructor(this, Map.prototype, {
4703 // 3. Set map.[[MapData]] to a new empty List.
4704 // Polyfill.io - This step was done as part of step two.
4706 // Some old engines do not support ES5 getters/setters. Since Map only requires these for the size property, we can fall back to setting the size property statically each time the size of the map changes.
4707 if (!supportsGetters) {
4708 Object.defineProperty(map, 'size', {
4716 // 4. If iterable is not present, let iterable be undefined.
4717 var iterable = arguments.length > 0 ? arguments[0] : undefined;
4719 // 5. If iterable is either undefined or null, return map.
4720 if (iterable === null || iterable === undefined) {
4724 // 6. Let adder be ? Get(map, "set").
4725 var adder = map.set;
4727 // 7. If IsCallable(adder) is false, throw a TypeError exception.
4728 if (!IsCallable(adder)) {
4729 throw new TypeError("Map.prototype.set is not a function");
4732 // 8. Let iteratorRecord be ? GetIterator(iterable).
4734 var iteratorRecord = GetIterator(iterable);
4737 // a. Let next be ? IteratorStep(iteratorRecord).
4738 var next = IteratorStep(iteratorRecord);
4739 // b. If next is false, return map.
4740 if (next === false) {
4743 // c. Let nextItem be ? IteratorValue(next).
4744 var nextItem = IteratorValue(next);
4745 // d. If Type(nextItem) is not Object, then
4746 if (Type(nextItem) !== 'object') {
4747 // i. Let error be Completion{[[Type]]: throw, [[Value]]: a newly created TypeError object, [[Target]]: empty}.
4749 throw new TypeError('Iterator value ' + nextItem + ' is not an entry object');
4751 // ii. Return ? IteratorClose(iteratorRecord, error).
4752 return IteratorClose(iteratorRecord, error);
4756 // Polyfill.io - The try catch accounts for steps: f, h, and j.
4758 // e. Let k be Get(nextItem, "0").
4759 var k = nextItem[0];
4760 // f. If k is an abrupt completion, return ? IteratorClose(iteratorRecord, k).
4761 // g. Let v be Get(nextItem, "1").
4762 var v = nextItem[1];
4763 // h. If v is an abrupt completion, return ? IteratorClose(iteratorRecord, v).
4764 // i. Let status be Call(adder, map, « k.[[Value]], v.[[Value]] »).
4765 adder.call(map, k, v);
4767 // j. If status is an abrupt completion, return ? IteratorClose(iteratorRecord, status).
4768 return IteratorClose(iteratorRecord, e);
4772 // Polyfill.io - For user agents which do not have iteration methods on argument objects or arrays, we can special case those.
4773 if (Array.isArray(iterable) ||
4774 Object.prototype.toString.call(iterable) === '[object Arguments]' ||
4775 // IE 7 & IE 8 return '[object Object]' for the arguments object, we can detect by checking for the existence of the callee property
4776 (!!iterable.callee)) {
4778 var length = iterable.length;
4779 for (index = 0; index < length; index++) {
4780 adder.call(map, iterable[index][0], iterable[index][1]);
4787 // 23.1.2.1. Map.prototype
4788 // The initial value of Map.prototype is the intrinsic object %MapPrototype%.
4789 // This property has the attributes { [[Writable]]: false, [[Enumerable]]: false, [[Configurable]]: false }.
4790 Object.defineProperty(Map, 'prototype', {
4791 configurable: false,
4797 // 23.1.2.2 get Map [ @@species ]
4798 if (supportsGetters) {
4799 Object.defineProperty(Map, Symbol.species, {
4803 // 1. Return the this value.
4809 CreateMethodProperty(Map, Symbol.species, Map);
4812 // 23.1.3.1 Map.prototype.clear ( )
4813 CreateMethodProperty(Map.prototype, 'clear', function clear() {
4814 // 1. Let M be the this value.
4816 // 2. If Type(M) is not Object, throw a TypeError exception.
4817 if (Type(M) !== 'object') {
4818 throw new TypeError('Method Map.prototype.clear called on incompatible receiver ' + Object.prototype.toString.call(M));
4820 // 3. If M does not have a [[MapData]] internal slot, throw a TypeError exception.
4821 if (M._es6Map !== true) {
4822 throw new TypeError('Method Map.prototype.clear called on incompatible receiver ' + Object.prototype.toString.call(M));
4824 // 4. Let entries be the List that is M.[[MapData]].
4825 var entries = M._keys;
4826 // 5. For each Record {[[Key]], [[Value]]} p that is an element of entries, do
4827 for (var i = 0; i < entries.length; i++) {
4828 // 5.a. Set p.[[Key]] to empty.
4829 M._keys[i] = undefMarker;
4830 // 5.b. Set p.[[Value]] to empty.
4831 M._values[i] = undefMarker;
4834 if (!supportsGetters) {
4835 this.size = this._size;
4837 // 6. Return undefined.
4842 // 23.1.3.2. Map.prototype.constructor
4843 CreateMethodProperty(Map.prototype, 'constructor', Map);
4845 // 23.1.3.3. Map.prototype.delete ( key )
4846 CreateMethodProperty(Map.prototype, 'delete', function (key) {
4847 // 1. Let M be the this value.
4849 // 2. If Type(M) is not Object, throw a TypeError exception.
4850 if (Type(M) !== 'object') {
4851 throw new TypeError('Method Map.prototype.clear called on incompatible receiver ' + Object.prototype.toString.call(M));
4853 // 3. If M does not have a [[MapData]] internal slot, throw a TypeError exception.
4854 if (M._es6Map !== true) {
4855 throw new TypeError('Method Map.prototype.clear called on incompatible receiver ' + Object.prototype.toString.call(M));
4857 // 4. Let entries be the List that is M.[[MapData]].
4858 var entries = M._keys;
4859 // 5. For each Record {[[Key]], [[Value]]} p that is an element of entries, do
4860 for (var i = 0; i < entries.length; i++) {
4861 // a. If p.[[Key]] is not empty and SameValueZero(p.[[Key]], key) is true, then
4862 if (M._keys[i] !== undefMarker && SameValueZero(M._keys[i], key)) {
4863 // i. Set p.[[Key]] to empty.
4864 this._keys[i] = undefMarker;
4865 // ii. Set p.[[Value]] to empty.
4866 this._values[i] = undefMarker;
4867 this._size = --this._size;
4868 if (!supportsGetters) {
4869 this.size = this._size;
4871 // iii. Return true.
4880 // 23.1.3.4. Map.prototype.entries ( )
4881 CreateMethodProperty(Map.prototype, 'entries', function entries () {
4882 // 1. Let M be the this value.
4884 // 2. Return ? CreateMapIterator(M, "key+value").
4885 return CreateMapIterator(M, 'key+value');
4889 // 23.1.3.5. Map.prototype.forEach ( callbackfn [ , thisArg ] )
4890 CreateMethodProperty(Map.prototype, 'forEach', function (callbackFn) {
4891 // 1. Let M be the this value.
4893 // 2. If Type(M) is not Object, throw a TypeError exception.
4894 if (Type(M) !== 'object') {
4895 throw new TypeError('Method Map.prototype.forEach called on incompatible receiver ' + Object.prototype.toString.call(M));
4897 // 3. If M does not have a [[MapData]] internal slot, throw a TypeError exception.
4898 if (M._es6Map !== true) {
4899 throw new TypeError('Method Map.prototype.forEach called on incompatible receiver ' + Object.prototype.toString.call(M));
4901 // 4. If IsCallable(callbackfn) is false, throw a TypeError exception.
4902 if (!IsCallable(callbackFn)) {
4903 throw new TypeError(Object.prototype.toString.call(callbackFn) + ' is not a function.');
4905 // 5. If thisArg is present, let T be thisArg; else let T be undefined.
4907 var T = arguments[1];
4909 // 6. Let entries be the List that is M.[[MapData]].
4910 var entries = M._keys;
4911 // 7. For each Record {[[Key]], [[Value]]} e that is an element of entries, in original key insertion order, do
4912 for (var i = 0; i < entries.length; i++) {
4913 // a. If e.[[Key]] is not empty, then
4914 if (M._keys[i] !== undefMarker && M._values[i] !== undefMarker ) {
4915 // i. Perform ? Call(callbackfn, T, « e.[[Value]], e.[[Key]], M »).
4916 callbackFn.call(T, M._values[i], M._keys[i], M);
4919 // 8. Return undefined.
4924 // 23.1.3.6. Map.prototype.get ( key )
4925 CreateMethodProperty(Map.prototype, 'get', function get(key) {
4926 // 1. Let M be the this value.
4928 // 2. If Type(M) is not Object, throw a TypeError exception.
4929 if (Type(M) !== 'object') {
4930 throw new TypeError('Method Map.prototype.get called on incompatible receiver ' + Object.prototype.toString.call(M));
4932 // 3. If M does not have a [[MapData]] internal slot, throw a TypeError exception.
4933 if (M._es6Map !== true) {
4934 throw new TypeError('Method Map.prototype.get called on incompatible receiver ' + Object.prototype.toString.call(M));
4936 // 4. Let entries be the List that is M.[[MapData]].
4937 var entries = M._keys;
4938 // 5. For each Record {[[Key]], [[Value]]} p that is an element of entries, do
4939 for (var i = 0; i < entries.length; i++) {
4940 // a. If p.[[Key]] is not empty and SameValueZero(p.[[Key]], key) is true, return p.[[Value]].
4941 if (M._keys[i] !== undefMarker && SameValueZero(M._keys[i], key)) {
4942 return M._values[i];
4945 // 6. Return undefined.
4949 // 23.1.3.7. Map.prototype.has ( key )
4950 CreateMethodProperty(Map.prototype, 'has', function has (key) {
4951 // 1. Let M be the this value.
4953 // 2. If Type(M) is not Object, throw a TypeError exception.
4954 if (typeof M !== 'object') {
4955 throw new TypeError('Method Map.prototype.has called on incompatible receiver ' + Object.prototype.toString.call(M));
4957 // 3. If M does not have a [[MapData]] internal slot, throw a TypeError exception.
4958 if (M._es6Map !== true) {
4959 throw new TypeError('Method Map.prototype.has called on incompatible receiver ' + Object.prototype.toString.call(M));
4961 // 4. Let entries be the List that is M.[[MapData]].
4962 var entries = M._keys;
4963 // 5. For each Record {[[Key]], [[Value]]} p that is an element of entries, do
4964 for (var i = 0; i < entries.length; i++) {
4965 // a. If p.[[Key]] is not empty and SameValueZero(p.[[Key]], key) is true, return true.
4966 if (M._keys[i] !== undefMarker && SameValueZero(M._keys[i], key)) {
4974 // 23.1.3.8. Map.prototype.keys ( )
4975 CreateMethodProperty(Map.prototype, 'keys', function keys () {
4976 // 1. Let M be the this value.
4978 // 2. Return ? CreateMapIterator(M, "key").
4979 return CreateMapIterator(M, "key");
4982 // 23.1.3.9. Map.prototype.set ( key, value )
4983 CreateMethodProperty(Map.prototype, 'set', function set(key, value) {
4984 // 1. Let M be the this value.
4986 // 2. If Type(M) is not Object, throw a TypeError exception.
4987 if (Type(M) !== 'object') {
4988 throw new TypeError('Method Map.prototype.set called on incompatible receiver ' + Object.prototype.toString.call(M));
4990 // 3. If M does not have a [[MapData]] internal slot, throw a TypeError exception.
4991 if (M._es6Map !== true) {
4992 throw new TypeError('Method Map.prototype.set called on incompatible receiver ' + Object.prototype.toString.call(M));
4994 // 4. Let entries be the List that is M.[[MapData]].
4995 var entries = M._keys;
4996 // 5. For each Record {[[Key]], [[Value]]} p that is an element of entries, do
4997 for (var i = 0; i < entries.length; i++) {
4998 // a. If p.[[Key]] is not empty and SameValueZero(p.[[Key]], key) is true, then
4999 if (M._keys[i] !== undefMarker && SameValueZero(M._keys[i], key)) {
5000 // i. Set p.[[Value]] to value.
5001 M._values[i] = value;
5006 // 6. If key is -0, let key be +0.
5010 // 7. Let p be the Record {[[Key]]: key, [[Value]]: value}.
5013 p['[[Value]]'] = value;
5014 // 8. Append p as the last element of entries.
5015 M._keys.push(p['[[Key]]']);
5016 M._values.push(p['[[Value]]']);
5018 if (!supportsGetters) {
5025 // 23.1.3.10. get Map.prototype.size
5026 if (supportsGetters) {
5027 Object.defineProperty(Map.prototype, 'size', {
5031 // 1. Let M be the this value.
5033 // 2. If Type(M) is not Object, throw a TypeError exception.
5034 if (Type(M) !== 'object') {
5035 throw new TypeError('Method Map.prototype.size called on incompatible receiver ' + Object.prototype.toString.call(M));
5037 // 3. If M does not have a [[MapData]] internal slot, throw a TypeError exception.
5038 if (M._es6Map !== true) {
5039 throw new TypeError('Method Map.prototype.size called on incompatible receiver ' + Object.prototype.toString.call(M));
5041 // 4. Let entries be the List that is M.[[MapData]].
5042 var entries = M._keys;
5043 // 5. Let count be 0.
5045 // 6. For each Record {[[Key]], [[Value]]} p that is an element of entries, do
5046 for (var i = 0; i < entries.length; i++) {
5047 // a. If p.[[Key]] is not empty, set count to count+1.
5048 if (M._keys[i] !== undefMarker) {
5059 // 23.1.3.11. Map.prototype.values ( )
5060 CreateMethodProperty(Map.prototype, 'values', function values () {
5061 // 1. Let M be the this value.
5063 // 2. Return ? CreateMapIterator(M, "value").
5064 return CreateMapIterator(M, 'value');
5068 // 23.1.3.12. Map.prototype [ @@iterator ] ( )
5069 // The initial value of the @@iterator property is the same function object as the initial value of the entries property.
5070 CreateMethodProperty(Map.prototype, Symbol.iterator, Map.prototype.entries);
5072 // 23.1.3.13. Map.prototype [ @@toStringTag ]
5073 // The initial value of the @@toStringTag property is the String value "Map".
5074 // This property has the attributes { [[Writable]]: false, [[Enumerable]]: false, [[Configurable]]: true }.
5076 // Polyfill.io - Safari 8 implements Map.name but as a non-configurable property, which means it would throw an error if we try and configure it here.
5077 if (!('name' in Map)) {
5079 Object.defineProperty(Map, 'name', {
5087 // 23.1.5.1. CreateMapIterator ( map, kind )
5088 function CreateMapIterator(map, kind) {
5089 // 1. If Type(map) is not Object, throw a TypeError exception.
5090 if (Type(map) !== 'object') {
5091 throw new TypeError('createMapIterator called on incompatible receiver ' + Object.prototype.toString.call(map));
5093 // 2. If map does not have a [[MapData]] internal slot, throw a TypeError exception.
5094 if (map._es6Map !== true) {
5095 throw new TypeError('createMapIterator called on incompatible receiver ' + Object.prototype.toString.call(map));
5097 // 3. Let iterator be ObjectCreate(%MapIteratorPrototype%, « [[Map]], [[MapNextIndex]], [[MapIterationKind]] »).
5098 var iterator = Object.create(MapIteratorPrototype);
5099 // 4. Set iterator.[[Map]] to map.
5100 Object.defineProperty(iterator, '[[Map]]', {
5106 // 5. Set iterator.[[MapNextIndex]] to 0.
5107 Object.defineProperty(iterator, '[[MapNextIndex]]', {
5113 // 6. Set iterator.[[MapIterationKind]] to kind.
5114 Object.defineProperty(iterator, '[[MapIterationKind]]', {
5120 // 7. Return iterator.
5124 // 23.1.5.2. The %MapIteratorPrototype% Object
5125 var MapIteratorPrototype = {};
5126 // Polyfill.io - We use this as a quick way to check if an object is a Map Iterator instance.
5127 Object.defineProperty(MapIteratorPrototype, 'isMapIterator', {
5128 configurable: false,
5134 // 23.1.5.2.1. %MapIteratorPrototype%.next ( )
5135 CreateMethodProperty(MapIteratorPrototype, 'next', function next() {
5136 // 1. Let O be the this value.
5138 // 2. If Type(O) is not Object, throw a TypeError exception.
5139 if (Type(O) !== 'object') {
5140 throw new TypeError('Method %MapIteratorPrototype%.next called on incompatible receiver ' + Object.prototype.toString.call(O));
5142 // 3. If O does not have all of the internal slots of a Map Iterator Instance (23.1.5.3), throw a TypeError exception.
5143 if (!O.isMapIterator) {
5144 throw new TypeError('Method %MapIteratorPrototype%.next called on incompatible receiver ' + Object.prototype.toString.call(O));
5146 // 4. Let m be O.[[Map]].
5147 var m = O['[[Map]]'];
5148 // 5. Let index be O.[[MapNextIndex]].
5149 var index = O['[[MapNextIndex]]'];
5150 // 6. Let itemKind be O.[[MapIterationKind]].
5151 var itemKind = O['[[MapIterationKind]]'];
5152 // 7. If m is undefined, return CreateIterResultObject(undefined, true).
5153 if (m === undefined) {
5154 return CreateIterResultObject(undefined, true);
5156 // 8. Assert: m has a [[MapData]] internal slot.
5158 throw new Error(Object.prototype.toString.call(m) + ' has a [[MapData]] internal slot.');
5160 // 9. Let entries be the List that is m.[[MapData]].
5161 var entries = m._keys;
5162 // 10. Let numEntries be the number of elements of entries.
5163 var numEntries = entries.length;
5164 // 11. NOTE: numEntries must be redetermined each time this method is evaluated.
5165 // 12. Repeat, while index is less than numEntries,
5166 while (index < numEntries) {
5167 // a. Let e be the Record {[[Key]], [[Value]]} that is the value of entries[index].
5168 var e = Object.create(null);
5169 e['[[Key]]'] = m._keys[index];
5170 e['[[Value]]'] = m._values[index];
5171 // b. Set index to index+1.
5173 // c. Set O.[[MapNextIndex]] to index.
5174 O['[[MapNextIndex]]'] = index;
5175 // d. If e.[[Key]] is not empty, then
5176 if (e['[[Key]]'] !== undefMarker) {
5177 // i. If itemKind is "key", let result be e.[[Key]].
5178 if (itemKind === 'key') {
5179 var result = e['[[Key]]'];
5180 // ii. Else if itemKind is "value", let result be e.[[Value]].
5181 } else if (itemKind === 'value') {
5182 result = e['[[Value]]'];
5185 // 1. Assert: itemKind is "key+value".
5186 if (itemKind !== 'key+value') {
5189 // 2. Let result be CreateArrayFromList(« e.[[Key]], e.[[Value]] »).
5195 // iv. Return CreateIterResultObject(result, false).
5196 return CreateIterResultObject(result, false);
5199 // 13. Set O.[[Map]] to undefined.
5200 O['[[Map]]'] = undefined;
5201 // 14. Return CreateIterResultObject(undefined, true).
5202 return CreateIterResultObject(undefined, true);
5206 // 23.1.5.2.2 %MapIteratorPrototype% [ @@toStringTag ]
5207 // The initial value of the @@toStringTag property is the String value "Map Iterator".
5208 // This property has the attributes { [[Writable]]: false, [[Enumerable]]: false, [[Configurable]]: true }.
5210 CreateMethodProperty(MapIteratorPrototype, Symbol.iterator, function iterator() {
5215 // Export the object
5217 CreateMethodProperty(global, 'Map', Map);
5219 // IE8 throws an error here if we set enumerable to false.
5220 // More info on table 2: https://msdn.microsoft.com/en-us/library/dd229916(v=vs.85).aspx
5221 global['Map'] = Map;
5227 if (!("Set"in this&&function(){try{var t=new Set([1,2])
5228 return 0===Set.length&&2===t.size&&"Symbol"in this&&"iterator"in Symbol&&"function"==typeof t[Symbol.iterator]}catch(e){return!1}}()
5232 /* global CreateIterResultObject, CreateMethodProperty, GetIterator, IsCallable, IteratorClose, IteratorStep, IteratorValue, OrdinaryCreateFromConstructor, SameValueZero, Symbol */
5233 (function (global) {
5234 var supportsGetters = (function () {
5237 Object.defineProperty(a, 't', {
5251 // Deleted set items mess with iterator pointers, so rather than removing them mark them as deleted. Can't use undefined or null since those both valid keys so use a private symbol.
5252 var undefMarker = Symbol('undef');
5253 // 23.2.1.1. Set ( [ iterable ] )
5254 var Set = function Set(/* iterable */) {
5255 // 1. If NewTarget is undefined, throw a TypeError exception.
5256 if (!(this instanceof Set)) {
5257 throw new TypeError('Constructor Set requires "new"');
5259 // 2. Let set be ? OrdinaryCreateFromConstructor(NewTarget, "%SetPrototype%", « [[SetData]] »).
5260 var set = OrdinaryCreateFromConstructor(this, Set.prototype, {
5266 // 3. Set set.[[SetData]] to a new empty List.
5267 // Polyfill.io - This step was done as part of step two.
5269 // Some old engines do not support ES5 getters/setters. Since Set only requires these for the size property, we can fall back to setting the size property statically each time the size of the set changes.
5270 if (!supportsGetters) {
5271 Object.defineProperty(set, 'size', {
5279 // 4. If iterable is not present, let iterable be undefined.
5280 var iterable = arguments.length > 0 ? arguments[0] : undefined;
5282 // 5. If iterable is either undefined or null, return set.
5283 if (iterable === null || iterable === undefined) {
5287 // 6. Let adder be ? Get(set, "add").
5288 var adder = set.add;
5289 // 7. If IsCallable(adder) is false, throw a TypeError exception.
5290 if (!IsCallable(adder)) {
5291 throw new TypeError("Set.prototype.add is not a function");
5295 // 8. Let iteratorRecord be ? GetIterator(iterable).
5296 var iteratorRecord = GetIterator(iterable);
5299 // a. Let next be ? IteratorStep(iteratorRecord).
5300 var next = IteratorStep(iteratorRecord);
5301 // b. If next is false, return set.
5302 if (next === false) {
5305 // c. Let nextValue be ? IteratorValue(next).
5306 var nextValue = IteratorValue(next);
5307 // d. Let status be Call(adder, set, « nextValue.[[Value]] »).
5309 adder.call(set, nextValue);
5311 // e. If status is an abrupt completion, return ? IteratorClose(iteratorRecord, status).
5312 return IteratorClose(iteratorRecord, e);
5316 // Polyfill.io - For user agents which do not have iteration methods on argument objects or arrays, we can special case those.
5317 if (Array.isArray(iterable) ||
5318 Object.prototype.toString.call(iterable) === '[object Arguments]' ||
5319 // IE 7 & IE 8 return '[object Object]' for the arguments object, we can detect by checking for the existence of the callee property
5320 (!!iterable.callee)) {
5322 var length = iterable.length;
5323 for (index = 0; index < length; index++) {
5324 adder.call(set, iterable[index]);
5333 // 23.2.2.1. Set.prototype
5334 // The initial value of Set.prototype is the intrinsic %SetPrototype% object.
5335 // This property has the attributes { [[Writable]]: false, [[Enumerable]]: false, [[Configurable]]: false }.
5336 Object.defineProperty(Set, 'prototype', {
5337 configurable: false,
5343 // 23.2.2.2 get Set [ @@species ]
5344 if (supportsGetters) {
5345 Object.defineProperty(Set, Symbol.species, {
5349 // 1. Return the this value.
5355 CreateMethodProperty(Set, Symbol.species, Set);
5358 // 23.2.3.1. Set.prototype.add ( value )
5359 CreateMethodProperty(Set.prototype, 'add', function add(value) {
5360 // 1. Let S be the this value.
5362 // 2. If Type(S) is not Object, throw a TypeError exception.
5363 if (typeof S !== 'object') {
5364 throw new TypeError('Method Set.prototype.add called on incompatible receiver ' + Object.prototype.toString.call(S));
5366 // 3. If S does not have a [[SetData]] internal slot, throw a TypeError exception.
5367 if (S._es6Set !== true) {
5368 throw new TypeError('Method Set.prototype.add called on incompatible receiver ' + Object.prototype.toString.call(S));
5370 // 4. Let entries be the List that is S.[[SetData]].
5371 var entries = S._values;
5372 // 5. For each e that is an element of entries, do
5373 for (var i = 0; i < entries.length; i++) {
5375 // a. If e is not empty and SameValueZero(e, value) is true, then
5376 if (e !== undefMarker && SameValueZero(e, value)) {
5381 // 6. If value is -0, let value be +0.
5382 if (1/value === -Infinity) {
5385 // 7. Append value as the last element of entries.
5386 S._values.push(value);
5388 this._size = ++this._size;
5389 if (!supportsGetters) {
5390 this.size = this._size;
5396 // 23.2.3.2. Set.prototype.clear ( )
5397 CreateMethodProperty(Set.prototype, 'clear', function clear() {
5398 // 1. Let S be the this value.
5400 // 2. If Type(S) is not Object, throw a TypeError exception.
5401 if (typeof S !== 'object') {
5402 throw new TypeError('Method Set.prototype.clear called on incompatible receiver ' + Object.prototype.toString.call(S));
5404 // 3. If S does not have a [[SetData]] internal slot, throw a TypeError exception.
5405 if (S._es6Set !== true) {
5406 throw new TypeError('Method Set.prototype.clear called on incompatible receiver ' + Object.prototype.toString.call(S));
5408 // 4. Let entries be the List that is S.[[SetData]].
5409 var entries = S._values;
5410 // 5. For each e that is an element of entries, do
5411 for (var i = 0; i < entries.length; i++) {
5412 // a. Replace the element of entries whose value is e with an element whose value is empty.
5413 entries[i] = undefMarker;
5416 if (!supportsGetters) {
5417 this.size = this._size;
5419 // 6. Return undefined.
5423 // 23.2.3.3. Set.prototype.constructor
5424 CreateMethodProperty(Set.prototype, 'constructor', Set);
5426 // 23.2.3.4. Set.prototype.delete ( value )
5427 CreateMethodProperty(Set.prototype, 'delete', function (value) {
5428 // 1. Let S be the this value.
5430 // 2. If Type(S) is not Object, throw a TypeError exception.
5431 if (typeof S !== 'object') {
5432 throw new TypeError('Method Set.prototype.delete called on incompatible receiver ' + Object.prototype.toString.call(S));
5434 // 3. If S does not have a [[SetData]] internal slot, throw a TypeError exception.
5435 if (S._es6Set !== true) {
5436 throw new TypeError('Method Set.prototype.delete called on incompatible receiver ' + Object.prototype.toString.call(S));
5438 // 4. Let entries be the List that is S.[[SetData]].
5439 var entries = S._values;
5440 // 5. For each e that is an element of entries, do
5441 for (var i = 0; i < entries.length; i++) {
5443 // a. If e is not empty and SameValueZero(e, value) is true, then
5444 if (e !== undefMarker && SameValueZero(e, value)) {
5445 // i. Replace the element of entries whose value is e with an element whose value is empty.
5446 entries[i] = undefMarker;
5448 this._size = --this._size;
5449 if (!supportsGetters) {
5450 this.size = this._size;
5461 // 23.2.3.5. Set.prototype.entries ( )
5462 CreateMethodProperty(Set.prototype, 'entries', function entries() {
5463 // 1. Let S be the this value.
5465 // 2. Return ? CreateSetIterator(S, "key+value").
5466 return CreateSetIterator(S, 'key+value');
5470 // 23.2.3.6. Set.prototype.forEach ( callbackfn [ , thisArg ] )
5471 CreateMethodProperty(Set.prototype, 'forEach', function forEach(callbackFn /*[ , thisArg ]*/) {
5472 // 1. Let S be the this value.
5474 // 2. If Type(S) is not Object, throw a TypeError exception.
5475 if (typeof S !== 'object') {
5476 throw new TypeError('Method Set.prototype.forEach called on incompatible receiver ' + Object.prototype.toString.call(S));
5478 // 3. If S does not have a [[SetData]] internal slot, throw a TypeError exception.
5479 if (S._es6Set !== true) {
5480 throw new TypeError('Method Set.prototype.forEach called on incompatible receiver ' + Object.prototype.toString.call(S));
5482 // 4. If IsCallable(callbackfn) is false, throw a TypeError exception.
5483 if (!IsCallable(callbackFn)) {
5484 throw new TypeError(Object.prototype.toString.call(callbackFn) + ' is not a function.');
5486 // 5. If thisArg is present, let T be thisArg; else let T be undefined.
5488 var T = arguments[1];
5490 // 6. Let entries be the List that is S.[[SetData]].
5491 var entries = S._values;
5492 // 7. For each e that is an element of entries, in original insertion order, do
5493 for (var i = 0; i < entries.length; i++) {
5495 // a. If e is not empty, then
5496 if (e !== undefMarker) {
5497 // i. Perform ? Call(callbackfn, T, « e, e, S »).
5498 callbackFn.call(T, e, e, S);
5501 // 8. Return undefined.
5506 // 23.2.3.7. Set.prototype.has ( value )
5507 CreateMethodProperty(Set.prototype, 'has', function has(value) {
5508 // 1. Let S be the this value.
5510 // 2. If Type(S) is not Object, throw a TypeError exception.
5511 if (typeof S !== 'object') {
5512 throw new TypeError('Method Set.prototype.forEach called on incompatible receiver ' + Object.prototype.toString.call(S));
5514 // 3. If S does not have a [[SetData]] internal slot, throw a TypeError exception.
5515 if (S._es6Set !== true) {
5516 throw new TypeError('Method Set.prototype.forEach called on incompatible receiver ' + Object.prototype.toString.call(S));
5518 // 4. Let entries be the List that is S.[[SetData]].
5519 var entries = S._values;
5520 // 5. For each e that is an element of entries, do
5521 for (var i = 0; i < entries.length; i++) {
5523 // a. If e is not empty and SameValueZero(e, value) is true, return true.
5524 if (e !== undefMarker && SameValueZero(e, value)) {
5533 // Polyfill.io - We need to define Set.prototype.values before Set.prototype.keys because keys is a reference to values.
5534 // 23.2.3.10. Set.prototype.values()
5535 var values = function values() {
5536 // 1. Let S be the this value.
5538 // 2. Return ? CreateSetIterator(S, "value").
5539 return CreateSetIterator(S, "value");
5541 CreateMethodProperty(Set.prototype, 'values', values);
5543 // 23.2.3.8 Set.prototype.keys ( )
5544 // The initial value of the keys property is the same function object as the initial value of the values property.
5545 CreateMethodProperty(Set.prototype, 'keys', values);
5547 // 23.2.3.9. get Set.prototype.size
5548 if (supportsGetters) {
5549 Object.defineProperty(Set.prototype, 'size', {
5553 // 1. Let S be the this value.
5555 // 2. If Type(S) is not Object, throw a TypeError exception.
5556 if (typeof S !== 'object') {
5557 throw new TypeError('Method Set.prototype.size called on incompatible receiver ' + Object.prototype.toString.call(S));
5559 // 3. If S does not have a [[SetData]] internal slot, throw a TypeError exception.
5560 if (S._es6Set !== true) {
5561 throw new TypeError('Method Set.prototype.size called on incompatible receiver ' + Object.prototype.toString.call(S));
5563 // 4. Let entries be the List that is S.[[SetData]].
5564 var entries = S._values;
5565 // 5. Let count be 0.
5567 // 6. For each e that is an element of entries, do
5568 for (var i = 0; i < entries.length; i++) {
5570 // a. If e is not empty, set count to count+1.
5571 if (e !== undefMarker) {
5582 // 23.2.3.11. Set.prototype [ @@iterator ] ( )
5583 // The initial value of the @@iterator property is the same function object as the initial value of the values property.
5584 CreateMethodProperty(Set.prototype, Symbol.iterator, values);
5586 // 23.2.3.12. Set.prototype [ @@toStringTag ]
5587 // The initial value of the @@toStringTag property is the String value "Set".
5588 // This property has the attributes { [[Writable]]: false, [[Enumerable]]: false, [[Configurable]]: true }.
5590 // Polyfill.io - Safari 8 implements Set.name but as a non-configurable property, which means it would throw an error if we try and configure it here.
5591 if (!('name' in Set)) {
5593 Object.defineProperty(Set, 'name', {
5601 // 23.2.5.1. CreateSetIterator ( set, kind )
5602 function CreateSetIterator(set, kind) {
5603 // 1. If Type(set) is not Object, throw a TypeError exception.
5604 if (typeof set !== 'object') {
5605 throw new TypeError('createSetIterator called on incompatible receiver ' + Object.prototype.toString.call(set));
5607 // 2. If set does not have a [[SetData]] internal slot, throw a TypeError exception.
5608 if (set._es6Set !== true) {
5609 throw new TypeError('createSetIterator called on incompatible receiver ' + Object.prototype.toString.call(set));
5611 // 3. Let iterator be ObjectCreate(%SetIteratorPrototype%, « [[IteratedSet]], [[SetNextIndex]], [[SetIterationKind]] »).
5612 var iterator = Object.create(SetIteratorPrototype);
5613 // 4. Set iterator.[[IteratedSet]] to set.
5614 Object.defineProperty(iterator, '[[IteratedSet]]', {
5620 // 5. Set iterator.[[SetNextIndex]] to 0.
5621 Object.defineProperty(iterator, '[[SetNextIndex]]', {
5627 // 6. Set iterator.[[SetIterationKind]] to kind.
5628 Object.defineProperty(iterator, '[[SetIterationKind]]', {
5634 // 7. Return iterator.
5638 // 23.2.5.2. The %SetIteratorPrototype% Object
5639 var SetIteratorPrototype = {};
5640 //Polyfill.io - We add this property to help us identify what is a set iterator.
5641 Object.defineProperty(SetIteratorPrototype, 'isSetIterator', {
5642 configurable: false,
5648 // 23.2.5.2.1. %SetIteratorPrototype%.next ( )
5649 CreateMethodProperty(SetIteratorPrototype, 'next', function next() {
5650 // 1. Let O be the this value.
5652 // 2. If Type(O) is not Object, throw a TypeError exception.
5653 if (typeof O !== 'object') {
5654 throw new TypeError('Method %SetIteratorPrototype%.next called on incompatible receiver ' + Object.prototype.toString.call(O));
5656 // 3. If O does not have all of the internal slots of a Set Iterator Instance (23.2.5.3), throw a TypeError exception.
5657 if (!O.isSetIterator) {
5658 throw new TypeError('Method %SetIteratorPrototype%.next called on incompatible receiver ' + Object.prototype.toString.call(O));
5660 // 4. Let s be O.[[IteratedSet]].
5661 var s = O['[[IteratedSet]]'];
5662 // 5. Let index be O.[[SetNextIndex]].
5663 var index = O['[[SetNextIndex]]'];
5664 // 6. Let itemKind be O.[[SetIterationKind]].
5665 var itemKind = O['[[SetIterationKind]]'];
5666 // 7. If s is undefined, return CreateIterResultObject(undefined, true).
5667 if (s === undefined) {
5668 return CreateIterResultObject(undefined, true);
5670 // 8. Assert: s has a [[SetData]] internal slot.
5672 throw new Error(Object.prototype.toString.call(s) + ' does not have [[SetData]] internal slot.');
5674 // 9. Let entries be the List that is s.[[SetData]].
5675 var entries = s._values;
5676 // 10. Let numEntries be the number of elements of entries.
5677 var numEntries = entries.length;
5678 // 11. NOTE: numEntries must be redetermined each time this method is evaluated.
5679 // 12. Repeat, while index is less than numEntries,
5680 while (index < numEntries) {
5681 // a. Let e be entries[index].
5682 var e = entries[index];
5683 // b. Set index to index+1.
5685 // c. Set O.[[SetNextIndex]] to index.
5686 O['[[SetNextIndex]]'] = index;
5687 // d. If e is not empty, then
5688 if (e !== undefMarker) {
5689 // i. If itemKind is "key+value", then
5690 if (itemKind === 'key+value') {
5691 // 1. Return CreateIterResultObject(CreateArrayFromList(« e, e »), false).
5692 return CreateIterResultObject([e, e], false);
5694 // ii. Return CreateIterResultObject(e, false).
5695 return CreateIterResultObject(e, false);
5698 // 13. Set O.[[IteratedSet]] to undefined.
5699 O['[[IteratedSet]]'] = undefined;
5700 // 14. Return CreateIterResultObject(undefined, true).
5701 return CreateIterResultObject(undefined, true);
5704 // 23.2.5.2.2. %SetIteratorPrototype% [ @@toStringTag ]
5705 // The initial value of the @@toStringTag property is the String value "Set Iterator".
5706 // This property has the attributes { [[Writable]]: false, [[Enumerable]]: false, [[Configurable]]: true }.
5708 CreateMethodProperty(SetIteratorPrototype, Symbol.iterator, function iterator() {
5713 // Export the object
5715 CreateMethodProperty(global, 'Set', Set);
5717 // IE8 throws an error here if we set enumerable to false.
5718 // More info on table 2: https://msdn.microsoft.com/en-us/library/dd229916(v=vs.85).aspx
5719 global['Set'] = Set;
5726 if (!("from"in Array&&function(){try{return Array.from({length:-Infinity}),!0}catch(r){return!1}}()
5731 IsCallable, GetMethod, Symbol, IsConstructor, Construct, ArrayCreate, GetIterator, IteratorClose,
5732 ToString, IteratorStep, IteratorValue, Call, CreateDataPropertyOrThrow, ToObject, ToLength, Get, CreateMethodProperty
5735 var toString = Object.prototype.toString;
5736 var stringMatch = String.prototype.match;
5737 // A cross-realm friendly way to detect if a value is a String object or literal.
5738 function isString(value) {
5739 if (typeof value === 'string') { return true; }
5740 if (typeof value !== 'object') { return false; }
5741 return toString.call(value) === '[object String]';
5744 // 22.1.2.1. Array.from ( items [ , mapfn [ , thisArg ] ] )
5745 CreateMethodProperty(Array, 'from', function from(items /* [ , mapfn [ , thisArg ] ] */) { // eslint-disable-line no-undef
5746 // 1. Let C be the this value.
5748 // 2. If mapfn is undefined, let mapping be false.
5749 var mapfn = arguments.length > 1 ? arguments[1] : undefined;
5750 if (mapfn === undefined) {
5751 var mapping = false;
5754 // a. If IsCallable(mapfn) is false, throw a TypeError exception.
5755 if (IsCallable(mapfn) === false) {
5756 throw new TypeError(Object.prototype.toString.call(mapfn) + ' is not a function.');
5758 // b. If thisArg is present, let T be thisArg; else let T be undefined.
5759 var thisArg = arguments.length > 2 ? arguments[2] : undefined;
5760 if (thisArg !== undefined) {
5765 // c. Let mapping be true.
5769 // 4. Let usingIterator be ? GetMethod(items, @@iterator).
5770 var usingIterator = GetMethod(items, Symbol.iterator);
5771 // 5. If usingIterator is not undefined, then
5772 if (usingIterator !== undefined) {
5773 // a. If IsConstructor(C) is true, then
5774 if (IsConstructor(C)) {
5775 // i. Let A be ? Construct(C).
5776 var A = Construct(C);
5779 // i. Let A be ! ArrayCreate(0).
5782 // c. Let iteratorRecord be ? GetIterator(items, usingIterator).
5783 var iteratorRecord = GetIterator(items, usingIterator);
5788 // i. If k ≥ 2^53-1, then
5789 if (k >= (Math.pow(2, 53) - 1)) {
5790 // 1. Let error be Completion{[[Type]]: throw, [[Value]]: a newly created TypeError object, [[Target]]: empty}.
5791 var error = new TypeError('Iteration count can not be greater than or equal 9007199254740991.');
5792 // 2. Return ? IteratorClose(iteratorRecord, error).
5793 return IteratorClose(iteratorRecord, error);
5795 // ii. Let Pk be ! ToString(k).
5796 var Pk = ToString(k);
5797 // iii. Let next be ? IteratorStep(iteratorRecord).
5798 var next = IteratorStep(iteratorRecord);
5799 // iv. If next is false, then
5800 if (next === false) {
5801 // 1. Perform ? Set(A, "length", k, true).
5806 // v. Let nextValue be ? IteratorValue(next).
5807 var nextValue = IteratorValue(next);
5808 // vi. If mapping is true, then
5811 // Polyfill.io - The try catch accounts for step 2.
5812 // 1. Let mappedValue be Call(mapfn, T, « nextValue, k »).
5813 var mappedValue = Call(mapfn, T, [nextValue, k]);
5814 // 2. If mappedValue is an abrupt completion, return ? IteratorClose(iteratorRecord, mappedValue).
5815 // 3. Let mappedValue be mappedValue.[[Value]].
5817 return IteratorClose(iteratorRecord, e);
5820 // vii. Else, let mappedValue be nextValue.
5822 mappedValue = nextValue;
5825 // Polyfill.io - The try catch accounts for step ix.
5826 // viii. Let defineStatus be CreateDataPropertyOrThrow(A, Pk, mappedValue).
5827 CreateDataPropertyOrThrow(A, Pk, mappedValue);
5828 // ix. If defineStatus is an abrupt completion, return ? IteratorClose(iteratorRecord, defineStatus).
5830 return IteratorClose(iteratorRecord, e);
5832 // x. Increase k by 1.
5836 // 6. NOTE: items is not an Iterable so assume it is an array-like object.
5837 // 7. Let arrayLike be ! ToObject(items).
5838 // Polyfill.io - For Strings we need to split astral symbols into surrogate pairs.
5839 if (isString(items)) {
5840 var arrayLike = stringMatch.call(items, /[\uD800-\uDBFF][\uDC00-\uDFFF]?|[^\uD800-\uDFFF]|./g) || [];
5842 arrayLike = ToObject(items);
5844 // 8. Let len be ? ToLength(? Get(arrayLike, "length")).
5845 var len = ToLength(Get(arrayLike, "length"));
5846 // 9. If IsConstructor(C) is true, then
5847 if (IsConstructor(C)) {
5848 // a. Let A be ? Construct(C, « len »).
5849 A = Construct(C, [len]);
5852 // a. Let A be ? ArrayCreate(len).
5853 A = ArrayCreate(len);
5857 // 12. Repeat, while k < len
5859 // a. Let Pk be ! ToString(k).
5861 // b. Let kValue be ? Get(arrayLike, Pk).
5862 var kValue = Get(arrayLike, Pk);
5863 // c. If mapping is true, then
5864 if (mapping === true) {
5865 // i. Let mappedValue be ? Call(mapfn, T, « kValue, k »).
5866 mappedValue = Call(mapfn, T, [kValue, k]);
5867 // d. Else, let mappedValue be kValue.
5869 mappedValue = kValue;
5871 // e. Perform ? CreateDataPropertyOrThrow(A, Pk, mappedValue).
5872 CreateDataPropertyOrThrow(A, Pk, mappedValue);
5873 // f. Increase k by 1.
5876 // 13. Perform ? Set(A, "length", len, true).
5885 if (!("Symbol"in this&&"split"in this.Symbol
5890 Object.defineProperty(Symbol, 'split', { value: Symbol('split') });
5894 if (!("Symbol"in this&&"toPrimitive"in this.Symbol
5897 // Symbol.toPrimitive
5899 Object.defineProperty(Symbol, 'toPrimitive', { value: Symbol('toPrimitive') });
5903 if (!("Symbol"in this&&"toStringTag"in this.Symbol
5906 // Symbol.toStringTag
5908 Object.defineProperty(Symbol, 'toStringTag', {
5909 value: Symbol('toStringTag')
5917 // A modification of https://github.com/medikoo/es6-iterator
5918 // Copyright (C) 2013-2015 Mariusz Nowak (www.medikoo.com)
5920 var Iterator = (function () { // eslint-disable-line no-unused-vars
5921 var clear = function () {
5925 var callable = function (fn) {
5926 if (typeof fn !== 'function') throw new TypeError(fn + " is not a function");
5930 var Iterator = function (list, context) {
5931 if (!(this instanceof Iterator)) {
5932 return new Iterator(list, context);
5934 Object.defineProperties(this, {
5948 if (!context) return;
5949 callable(context.on);
5950 context.on('_add', this._onAdd.bind(this));
5951 context.on('_delete', this._onDelete.bind(this));
5952 context.on('_clear', this._onClear.bind(this));
5955 Object.defineProperties(Iterator.prototype, Object.assign({
5963 value: function () {
5965 if (!this.__list__) return;
5966 if (this.__redo__) {
5967 i = this.__redo__.shift();
5968 if (i !== undefined) return i;
5970 if (this.__nextIndex__ < this.__list__.length) return this.__nextIndex__++;
5978 value: function () {
5979 return this._createResult(this._next());
5986 value: function (i) {
5987 if (i === undefined) return {
5993 value: this._resolve(i)
6001 value: function (i) {
6002 return this.__list__[i];
6009 value: function () {
6010 this.__list__ = null;
6011 delete this.__redo__;
6012 if (!this.__context__) return;
6013 this.__context__.off('_add', this._onAdd.bind(this));
6014 this.__context__.off('_delete', this._onDelete.bind(this));
6015 this.__context__.off('_clear', this._onClear.bind(this));
6016 this.__context__ = null;
6023 value: function () {
6024 return '[object Iterator]';
6032 value: function (index) {
6033 if (index >= this.__nextIndex__) return;
6034 ++this.__nextIndex__;
6035 if (!this.__redo__) {
6036 Object.defineProperty(this, '__redo__', {
6044 this.__redo__.forEach(function (redo, i) {
6045 if (redo >= index) this.__redo__[i] = ++redo;
6047 this.__redo__.push(index);
6054 value: function (index) {
6056 if (index >= this.__nextIndex__) return;
6057 --this.__nextIndex__;
6058 if (!this.__redo__) return;
6059 i = this.__redo__.indexOf(index);
6060 if (i !== -1) this.__redo__.splice(i, 1);
6061 this.__redo__.forEach(function (redo, i) {
6062 if (redo > index) this.__redo__[i] = --redo;
6070 value: function () {
6071 if (this.__redo__) clear.call(this.__redo__);
6072 this.__nextIndex__ = 0;
6080 Object.defineProperty(Iterator.prototype, Symbol.iterator, {
6081 value: function () {
6088 Object.defineProperty(Iterator.prototype, Symbol.toStringTag, {
6090 configurable: false,
6099 /* global Iterator */
6100 // A modification of https://github.com/medikoo/es6-iterator
6101 // Copyright (C) 2013-2015 Mariusz Nowak (www.medikoo.com)
6103 var ArrayIterator = (function() { // eslint-disable-line no-unused-vars
6105 var ArrayIterator = function(arr, kind) {
6106 if (!(this instanceof ArrayIterator)) return new ArrayIterator(arr, kind);
6107 Iterator.call(this, arr);
6108 if (!kind) kind = 'value';
6109 else if (String.prototype.includes.call(kind, 'key+value')) kind = 'key+value';
6110 else if (String.prototype.includes.call(kind, 'key')) kind = 'key';
6111 else kind = 'value';
6112 Object.defineProperty(this, '__kind__', {
6114 configurable: false,
6119 if (Object.setPrototypeOf) Object.setPrototypeOf(ArrayIterator, Iterator.prototype);
6121 ArrayIterator.prototype = Object.create(Iterator.prototype, {
6123 value: ArrayIterator,
6129 value: function(i) {
6130 if (this.__kind__ === 'value') return this.__list__[i];
6131 if (this.__kind__ === 'key+value') return [i, this.__list__[i]];
6140 return '[object Array Iterator]';
6148 return ArrayIterator;
6150 if (!("Symbol"in this&&"iterator"in this.Symbol&&!!Array.prototype.entries
6153 // Array.prototype.entries
6154 /* global CreateMethodProperty, ToObject */
6155 // 22.1.3.4. Array.prototype.entries ( )
6156 CreateMethodProperty(Array.prototype, 'entries', function entries() {
6157 // 1. Let O be ? ToObject(this value).
6158 var O = ToObject(this);
6159 // 2. Return CreateArrayIterator(O, "key+value").
6160 // TODO: Add CreateArrayIterator
6161 return new ArrayIterator(O, 'key+value');
6166 if (!("Symbol"in this&&"iterator"in this.Symbol&&!!Array.prototype.keys
6169 // Array.prototype.keys
6170 /* global CreateMethodProperty, ToObject */
6171 // 22.1.3.14. Array.prototype.keys ( )
6172 CreateMethodProperty(Array.prototype, 'keys', function keys() {
6173 // 1. Let O be ? ToObject(this value).
6174 var O = ToObject(this);
6175 // 2. Return CreateArrayIterator(O, "key").
6176 // TODO: Add CreateArrayIterator.
6177 return new ArrayIterator(O, 'key');
6182 if (!("values"in Array.prototype
6185 // Array.prototype.values
6186 /* global CreateMethodProperty, Symbol, ToObject */
6187 // 22.1.3.30/ Array.prototype.values ( )
6188 // Polyfill.io - Firefox, Chrome and Opera have Array.prototype[Symbol.iterator], which is the exact same function as Array.prototype.values.
6189 if ('Symbol' in this && 'iterator' in Symbol && typeof Array.prototype[Symbol.iterator] === 'function') {
6190 CreateMethodProperty(Array.prototype, 'values', Array.prototype[Symbol.iterator]);
6192 CreateMethodProperty(Array.prototype, 'values', function values () {
6193 // 1. Let O be ? ToObject(this value).
6194 var O = ToObject(this);
6195 // 2. Return CreateArrayIterator(O, "value").
6196 // TODO: Add CreateArrayIterator
6197 return new ArrayIterator(O, 'value');
6203 if (!("Symbol"in this&&"iterator"in this.Symbol&&!!Array.prototype[Symbol.iterator]
6206 // Array.prototype.@@iterator
6207 /* global Symbol, CreateMethodProperty */
6208 // 22.1.3.31. Array.prototype [ @@iterator ] ( )
6209 // The initial value of the @@iterator property is the same function object as the initial value of the Array.prototype.values property.
6210 CreateMethodProperty(Array.prototype, Symbol.iterator, Array.prototype.values);
6216 // A modification of https://github.com/medikoo/es6-iterator
6217 // Copyright (C) 2013-2015 Mariusz Nowak (www.medikoo.com)
6219 /* global Iterator */
6221 var StringIterator = (function() { // eslint-disable-line no-unused-vars
6223 var StringIterator = function (str) {
6224 if (!(this instanceof StringIterator)) return new StringIterator(str);
6226 Iterator.call(this, str);
6227 Object.defineProperty(this, '__length__', {
6229 configurable: false,
6234 if (Object.setPrototypeOf) Object.setPrototypeOf(StringIterator, Iterator);
6236 StringIterator.prototype = Object.create(Iterator.prototype, {
6238 value: StringIterator,
6245 if (!this.__list__) return;
6246 if (this.__nextIndex__ < this.__length__) return this.__nextIndex__++;
6254 value: function (i) {
6255 var char = this.__list__[i], code;
6256 if (this.__nextIndex__ === this.__length__) return char;
6257 code = char.charCodeAt(0);
6258 if ((code >= 0xD800) && (code <= 0xDBFF)) return char + this.__list__[this.__nextIndex__++];
6267 return '[object String Iterator]';
6275 return StringIterator;
6277 if (!("Symbol"in this&&"iterator"in this.Symbol&&!!String.prototype[Symbol.iterator]
6280 // String.prototype.@@iterator
6281 /* global CreateMethodProperty, RequireObjectCoercible, ToString, StringIterator, Symbol */
6282 // 21.1.3.29. String.prototype [ @@iterator ] ( )
6283 CreateMethodProperty(String.prototype, Symbol.iterator, function () {
6284 // 1. Let O be ? RequireObjectCoercible(this value).
6285 var O = RequireObjectCoercible(this);
6286 // 2. Let S be ? ToString(O).
6287 var S = ToString(O);
6288 // 3. Return CreateStringIterator(S).
6289 // TODO: Add CreateStringIterator.
6290 return new StringIterator(S);
6295 if (!("Symbol"in this&&"unscopables"in this.Symbol
6298 // Symbol.unscopables
6300 Object.defineProperty(Symbol, 'unscopables', { value: Symbol('unscopables') });
6304 if (!((function(e){try{if("WeakMap"in e&&0===WeakMap.length){var t={},a=new WeakMap([[t,"test"]])
6305 return"test"===a.get(t)&&!1===a["delete"](0)}return!1}catch(n){return!1}})(this)
6309 /* globals Symbol, OrdinaryCreateFromConstructor, IsCallable, GetIterator, IteratorStep, IteratorValue, IteratorClose, Get, Call, CreateMethodProperty, Type, SameValue */
6310 (function (global) {
6311 // Deleted map items mess with iterator pointers, so rather than removing them mark them as deleted. Can't use undefined or null since those both valid keys so use a private symbol.
6312 var undefMarker = Symbol('undef');
6313 // 23.3.1.1 WeakMap ( [ iterable ] )
6314 var WeakMap = function WeakMap(/* iterable */) {
6315 // 1. If NewTarget is undefined, throw a TypeError exception.
6316 if (!(this instanceof WeakMap)) {
6317 throw new TypeError('Constructor WeakMap requires "new"');
6319 // 2. Let map be ? OrdinaryCreateFromConstructor(NewTarget, "%WeakMapPrototype%", « [[WeakMapData]] »).
6320 var map = OrdinaryCreateFromConstructor(this, WeakMap.prototype, {
6326 // 3. Set map.[[WeakMapData]] to a new empty List.
6327 // Polyfill.io - This step was done as part of step two.
6329 // 4. If iterable is not present, let iterable be undefined.
6330 var iterable = arguments.length > 0 ? arguments[0] : undefined;
6332 // 5. If iterable is either undefined or null, return map.
6333 if (iterable === null || iterable === undefined) {
6337 // 6. Let adder be ? Get(map, "set").
6338 var adder = Get(map, "set");
6340 // 7. If IsCallable(adder) is false, throw a TypeError exception.
6341 if (!IsCallable(adder)) {
6342 throw new TypeError("WeakMap.prototype.set is not a function");
6345 // 8. Let iteratorRecord be ? GetIterator(iterable).
6347 var iteratorRecord = GetIterator(iterable);
6350 // a. Let next be ? IteratorStep(iteratorRecord).
6351 var next = IteratorStep(iteratorRecord);
6352 // b. If next is false, return map.
6353 if (next === false) {
6356 // c. Let nextItem be ? IteratorValue(next).
6357 var nextItem = IteratorValue(next);
6358 // d. If Type(nextItem) is not Object, then
6359 if (Type(nextItem) !== 'object') {
6360 // i. Let error be Completion{[[Type]]: throw, [[Value]]: a newly created TypeError object, [[Target]]: empty}.
6362 throw new TypeError('Iterator value ' + nextItem + ' is not an entry object');
6364 // ii. Return ? IteratorClose(iteratorRecord, error).
6365 return IteratorClose(iteratorRecord, error);
6369 // Polyfill.io - The try catch accounts for steps: f, h, and j.
6371 // e. Let k be Get(nextItem, "0").
6372 var k = Get(nextItem, "0");
6373 // f. If k is an abrupt completion, return ? IteratorClose(iteratorRecord, k).
6374 // g. Let v be Get(nextItem, "1").
6375 var v = Get(nextItem, "1");
6376 // h. If v is an abrupt completion, return ? IteratorClose(iteratorRecord, v).
6377 // i. Let status be Call(adder, map, « k.[[Value]], v.[[Value]] »).
6378 Call(adder, map, [k, v]);
6380 // j. If status is an abrupt completion, return ? IteratorClose(iteratorRecord, status).
6381 return IteratorClose(iteratorRecord, e);
6385 // Polyfill.io - For user agents which do not have iteration methods on argument objects or arrays, we can special case those.
6386 if (Array.isArray(iterable) ||
6387 Object.prototype.toString.call(iterable) === '[object Arguments]' ||
6388 // IE 7 & IE 8 return '[object Object]' for the arguments object, we can detect by checking for the existence of the callee property
6389 (!!iterable.callee)) {
6391 var length = iterable.length;
6392 for (index = 0; index < length; index++) {
6393 var k = iterable[index][0];
6394 var v = iterable[index][1];
6395 Call(adder, map, [k, v]);
6402 // 23.3.2.1 WeakMap.prototype
6403 // The initial value of WeakMap.prototype is the intrinsic object %WeakMapPrototype%.
6404 // This property has the attributes { [[Writable]]: false, [[Enumerable]]: false, [[Configurable]]: false }.
6405 Object.defineProperty(WeakMap, 'prototype', {
6406 configurable: false,
6412 // 23.3.3.1 WeakMap.prototype.constructor
6413 CreateMethodProperty(WeakMap.prototype, 'constructor', WeakMap);
6415 // 23.3.3.2 WeakMap.prototype.delete ( key )
6416 CreateMethodProperty(WeakMap.prototype, 'delete', function (key) {
6417 // 1. Let M be the this value.
6419 // 2. If Type(M) is not Object, throw a TypeError exception.
6420 if (Type(M) !== 'object') {
6421 throw new TypeError('Method WeakMap.prototype.clear called on incompatible receiver ' + Object.prototype.toString.call(M));
6423 // 3. If M does not have a [[WeakMapData]] internal slot, throw a TypeError exception.
6424 if (M._es6WeakMap !== true) {
6425 throw new TypeError('Method WeakMap.prototype.clear called on incompatible receiver ' + Object.prototype.toString.call(M));
6427 // 4. Let entries be the List that is M.[[WeakMapData]].
6428 var entries = M._keys;
6429 // 5. If Type(key) is not Object, return false.
6430 if (Type(key) !== 'object') {
6433 // 6. For each Record {[[Key]], [[Value]]} p that is an element of entries, do
6434 for (var i = 0; i < entries.length; i++) {
6435 // a. If p.[[Key]] is not empty and SameValue(p.[[Key]], key) is true, then
6436 if (M._keys[i] !== undefMarker && SameValue(M._keys[i], key)) {
6437 // i. Set p.[[Key]] to empty.
6438 this._keys[i] = undefMarker;
6439 // ii. Set p.[[Value]] to empty.
6440 this._values[i] = undefMarker;
6441 this._size = --this._size;
6442 // iii. Return true.
6450 // 23.3.3.3 WeakMap.prototype.get ( key )
6451 CreateMethodProperty(WeakMap.prototype, 'get', function get(key) {
6452 // 1. Let M be the this value.
6454 // 2. If Type(M) is not Object, throw a TypeError exception.
6455 if (Type(M) !== 'object') {
6456 throw new TypeError('Method WeakMap.prototype.get called on incompatible receiver ' + Object.prototype.toString.call(M));
6458 // 3. If M does not have a [[WeakMapData]] internal slot, throw a TypeError exception.
6459 if (M._es6WeakMap !== true) {
6460 throw new TypeError('Method WeakMap.prototype.get called on incompatible receiver ' + Object.prototype.toString.call(M));
6462 // 4. Let entries be the List that is M.[[WeakMapData]].
6463 var entries = M._keys;
6464 // 5. If Type(key) is not Object, return undefined.
6465 if (Type(key) !== 'object') {
6468 // 6. For each Record {[[Key]], [[Value]]} p that is an element of entries, do
6469 for (var i = 0; i < entries.length; i++) {
6470 // a. If p.[[Key]] is not empty and SameValue(p.[[Key]], key) is true, return p.[[Value]].
6471 if (M._keys[i] !== undefMarker && SameValue(M._keys[i], key)) {
6472 return M._values[i];
6475 // 7. Return undefined.
6479 // 23.3.3.4 WeakMap.prototype.has ( key )
6480 CreateMethodProperty(WeakMap.prototype, 'has', function has(key) {
6481 // 1. Let M be the this value.
6483 // 2. If Type(M) is not Object, throw a TypeError exception.
6484 if (typeof M !== 'object') {
6485 throw new TypeError('Method WeakMap.prototype.has called on incompatible receiver ' + Object.prototype.toString.call(M));
6487 // 3. If M does not have a [[WeakMapData]] internal slot, throw a TypeError exception.
6488 if (M._es6WeakMap !== true) {
6489 throw new TypeError('Method WeakMap.prototype.has called on incompatible receiver ' + Object.prototype.toString.call(M));
6491 // 4. Let entries be the List that is M.[[WeakMapData]].
6492 var entries = M._keys;
6493 // 5. If Type(key) is not Object, return false.
6494 if (Type(key) !== 'object') {
6497 // 6. For each Record {[[Key]], [[Value]]} p that is an element of entries, do
6498 for (var i = 0; i < entries.length; i++) {
6499 // a. If p.[[Key]] is not empty and SameValue(p.[[Key]], key) is true, return true.
6500 if (M._keys[i] !== undefMarker && SameValue(M._keys[i], key)) {
6508 // 23.3.3.5 WeakMap.prototype.set ( key, value )
6509 CreateMethodProperty(WeakMap.prototype, 'set', function set(key, value) {
6510 // 1. Let M be the this value.
6512 // 2. If Type(M) is not Object, throw a TypeError exception.
6513 if (Type(M) !== 'object') {
6514 throw new TypeError('Method WeakMap.prototype.set called on incompatible receiver ' + Object.prototype.toString.call(M));
6516 // 3. If M does not have a [[WeakMapData]] internal slot, throw a TypeError exception.
6517 if (M._es6WeakMap !== true) {
6518 throw new TypeError('Method WeakMap.prototype.set called on incompatible receiver ' + Object.prototype.toString.call(M));
6520 // 4. Let entries be the List that is M.[[WeakMapData]].
6521 var entries = M._keys;
6522 // 5. If Type(key) is not Object, throw a TypeError exception.
6523 if (Type(key) !== 'object') {
6524 throw new TypeError("Invalid value used as weak map key");
6526 // 6. For each Record {[[Key]], [[Value]]} p that is an element of entries, do
6527 for (var i = 0; i < entries.length; i++) {
6528 // a. If p.[[Key]] is not empty and SameValue(p.[[Key]], key) is true, then
6529 if (M._keys[i] !== undefMarker && SameValue(M._keys[i], key)) {
6530 // i. Set p.[[Value]] to value.
6531 M._values[i] = value;
6536 // 7. Let p be the Record {[[Key]]: key, [[Value]]: value}.
6541 // 8. Append p as the last element of entries.
6542 M._keys.push(p['[[Key]]']);
6543 M._values.push(p['[[Value]]']);
6548 // 23.3.3.6 WeakMap.prototype [ @@toStringTag ]
6549 // The initial value of the @@toStringTag property is the String value "WeakMap".
6550 // This property has the attributes { [[Writable]]: false, [[Enumerable]]: false, [[Configurable]]: true }.
6552 // Polyfill.io - Safari 8 implements WeakMap.name but as a non-writable property, which means it would throw an error if we try and write to it here.
6553 if (!('name' in WeakMap)) {
6555 Object.defineProperty(WeakMap, 'name', {
6563 // Export the object
6565 CreateMethodProperty(global, 'WeakMap', WeakMap);
6567 // IE8 throws an error here if we set enumerable to false.
6568 // More info on table 2: https://msdn.microsoft.com/en-us/library/dd229916(v=vs.85).aspx
6569 global['WeakMap'] = WeakMap;
6575 if (!((function(e){try{if("WeakSet"in e&&0===WeakSet.length){var t={},n=new WeakSet([t])
6576 return n.has(t)&&!1===n["delete"](0)}return!1}catch(r){return!1}})(this)
6580 /* global Call, CreateMethodProperty, Get, GetIterator, IsArray, IsCallable, IteratorClose, IteratorStep, IteratorValue, OrdinaryCreateFromConstructor, SameValueZero, Type, Symbol */
6581 (function (global) {
6582 // Deleted set items mess with iterator pointers, so rather than removing them mark them as deleted. Can't use undefined or null since those both valid keys so use a private symbol.
6583 var undefMarker = Symbol('undef');
6584 // 23.4.1.1. WeakSet ( [ iterable ] )
6585 var WeakSet = function WeakSet() {
6586 // 1. If NewTarget is undefined, throw a TypeError exception.
6587 if (!(this instanceof WeakSet)) {
6588 throw new TypeError('Constructor WeakSet requires "new"');
6590 // 2. Let set be ? OrdinaryCreateFromConstructor(NewTarget, "%WeakSetPrototype%", « [[WeakSetData]] »).
6591 var set = OrdinaryCreateFromConstructor(this, WeakSet.prototype, {
6597 // 3. Set set.[[WeakSetData]] to a new empty List.
6598 // Polyfill.io - This step was done as part of step two.
6600 // 4. If iterable is not present, let iterable be undefined.
6601 var iterable = arguments.length > 0 ? arguments[0] : undefined;
6602 // 5. If iterable is either undefined or null, return set.
6603 if (iterable === null || iterable === undefined) {
6606 // 6. Let adder be ? Get(set, "add").
6607 var adder = Get(set, 'add');
6608 // 7. If IsCallable(adder) is false, throw a TypeError exception.
6609 if (!IsCallable(adder)) {
6610 throw new TypeError("WeakSet.prototype.add is not a function");
6613 // 8. Let iteratorRecord be ? GetIterator(iterable).
6614 var iteratorRecord = GetIterator(iterable);
6617 // a. Let next be ? IteratorStep(iteratorRecord).
6618 var next = IteratorStep(iteratorRecord);
6619 // b. If next is false, return set.
6620 if (next === false) {
6623 // c. Let nextValue be ? IteratorValue(next).
6624 var nextValue = IteratorValue(next);
6625 // d. Let status be Call(adder, set, « nextValue »).
6627 Call(adder, set, [nextValue]);
6629 // e. If status is an abrupt completion, return ? IteratorClose(iteratorRecord, status).
6630 return IteratorClose(iteratorRecord, e);
6634 // Polyfill.io - For user agents which do not have iteration methods on argument objects or arrays, we can special case those.
6635 if (IsArray(iterable) ||
6636 Object.prototype.toString.call(iterable) === '[object Arguments]' ||
6637 // IE 7 & IE 8 return '[object Object]' for the arguments object, we can detect by checking for the existence of the callee property
6638 (!!iterable.callee)) {
6640 var length = iterable.length;
6641 for (index = 0; index < length; index++) {
6642 Call(adder, set, [iterable[index]]);
6649 // 23.4.2.1. WeakSet.prototype
6650 // The initial value of WeakSet.prototype is the intrinsic %WeakSetPrototype% object.
6651 // This property has the attributes { [[Writable]]: false, [[Enumerable]]: false, [[Configurable]]: false }.
6652 Object.defineProperty(WeakSet, 'prototype', {
6653 configurable: false,
6659 // 23.4.3.1. WeakSet.prototype.add ( value )
6660 CreateMethodProperty(WeakSet.prototype, 'add', function add(value) {
6661 // 1. Let S be the this value.
6663 // 2. If Type(S) is not Object, throw a TypeError exception.
6664 if (Type(S) !== 'object') {
6665 throw new TypeError('Method WeakSet.prototype.add called on incompatible receiver ' + Object.prototype.toString.call(S));
6667 // 3. If S does not have a [[WeakSetData]] internal slot, throw a TypeError exception.
6668 if (S._es6WeakSet !== true) {
6669 throw new TypeError('Method WeakSet.prototype.add called on incompatible receiver ' + Object.prototype.toString.call(S));
6671 // 4. If Type(value) is not Object, throw a TypeError exception.
6672 if (Type(value) !== 'object') {
6673 throw new TypeError('Invalid value used in weak set');
6675 // 5. Let entries be the List that is S.[[WeakSetData]].
6676 var entries = S._values;
6677 // 6. For each e that is an element of entries, do
6678 for (var i = 0; i < entries.length; i++) {
6680 // a. If e is not empty and SameValue(e, value) is true, then
6681 if (e !== undefMarker && SameValueZero(e, value)) {
6686 // 7. Append value as the last element of entries.
6687 S._values.push(value);
6692 // 23.4.3.2. WeakSet.prototype.constructor
6693 CreateMethodProperty(WeakSet.prototype, 'constructor', WeakSet);
6695 // 23.4.3.3. WeakSet.prototype.delete ( value )
6696 CreateMethodProperty(WeakSet.prototype, 'delete', function (value) {
6697 // 1. Let S be the this value.
6699 // 2. If Type(S) is not Object, throw a TypeError exception.
6700 if (Type(S) !== 'object') {
6701 throw new TypeError('Method WeakSet.prototype.delete called on incompatible receiver ' + Object.prototype.toString.call(S));
6703 // 3. If S does not have a [[WeakSetData]] internal slot, throw a TypeError exception.
6704 if (S._es6WeakSet !== true) {
6705 throw new TypeError('Method WeakSet.prototype.delete called on incompatible receiver ' + Object.prototype.toString.call(S));
6707 // 4. If Type(value) is not Object, return false.
6708 if (Type(value) !== 'object') {
6711 // 5. Let entries be the List that is S.[[WeakSetData]].
6712 var entries = S._values;
6713 // 6. For each e that is an element of entries, do
6714 for (var i = 0; i < entries.length; i++) {
6716 // a. If e is not empty and SameValue(e, value) is true, then
6717 if (e !== undefMarker && SameValueZero(e, value)) {
6718 // i. Replace the element of entries whose value is e with an element whose value is empty.
6719 entries[i] = undefMarker;
6728 // 23.4.3.4. WeakSet.prototype.has ( value )
6729 CreateMethodProperty(WeakSet.prototype, 'has', function has(value) {
6730 // 1. Let S be the this value.
6732 // 2. If Type(S) is not Object, throw a TypeError exception.
6733 if (Type(S) !== 'object') {
6734 throw new TypeError('Method WeakSet.prototype.has called on incompatible receiver ' + Object.prototype.toString.call(S));
6736 // 3. If S does not have a [[WeakSetData]] internal slot, throw a TypeError exception.
6737 if (S._es6WeakSet !== true) {
6738 throw new TypeError('Method WeakSet.prototype.has called on incompatible receiver ' + Object.prototype.toString.call(S));
6740 // 4. Let entries be the List that is S.[[WeakSetData]].
6741 var entries = S._values;
6742 // 5. If Type(value) is not Object, return false.
6743 if (Type(value) !== 'object') {
6746 // 6. For each e that is an element of entries, do
6747 for (var i = 0; i < entries.length; i++) {
6749 // a. If e is not empty and SameValue(e, value) is true, return true.
6750 if (e !== undefMarker && SameValueZero(e, value)) {
6758 // 23.4.3.5. WeakSet.prototype [ @@toStringTag ]
6759 // The initial value of the @@toStringTag property is the String value "WeakSet".
6760 // This property has the attributes { [[Writable]]: false, [[Enumerable]]: false, [[Configurable]]: true }.
6762 // Polyfill.io - Safari 8 implements Set.name but as a non-configurable property, which means it would throw an error if we try and configure it here.
6763 if (!('name' in WeakSet)) {
6765 Object.defineProperty(WeakSet, 'name', {
6773 // Export the object
6775 CreateMethodProperty(global, 'WeakSet', WeakSet);
6777 // IE8 throws an error here if we set enumerable to false.
6778 // More info on table 2: https://msdn.microsoft.com/en-us/library/dd229916(v=vs.85).aspx
6779 global['WeakSet'] = WeakSet;
6787 .call('object' === typeof window && window || 'object' === typeof self && self || 'object' === typeof global && global || {});