browser.js 30 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944
  1. (function(){function r(e,n,t){function o(i,f){if(!n[i]){if(!e[i]){var c="function"==typeof require&&require;if(!f&&c)return c(i,!0);if(u)return u(i,!0);var a=new Error("Cannot find module '"+i+"'");throw a.code="MODULE_NOT_FOUND",a}var p=n[i]={exports:{}};e[i][0].call(p.exports,function(r){var n=e[i][1][r];return o(n||r)},p,p.exports,r,e,n,t)}return n[i].exports}for(var u="function"==typeof require&&require,i=0;i<t.length;i++)o(t[i]);return o}return r})()({1:[function(require,module,exports){
  2. 'use strict';
  3. var keys = require('object-keys').shim();
  4. delete keys.shim;
  5. var assign = require('./');
  6. module.exports = assign.shim();
  7. delete assign.shim;
  8. },{"./":3,"object-keys":15}],2:[function(require,module,exports){
  9. 'use strict';
  10. // modified from https://github.com/es-shims/es6-shim
  11. var objectKeys = require('object-keys');
  12. var hasSymbols = require('has-symbols/shams')();
  13. var callBound = require('call-bind/callBound');
  14. var toObject = Object;
  15. var $push = callBound('Array.prototype.push');
  16. var $propIsEnumerable = callBound('Object.prototype.propertyIsEnumerable');
  17. var originalGetSymbols = hasSymbols ? Object.getOwnPropertySymbols : null;
  18. // eslint-disable-next-line no-unused-vars
  19. module.exports = function assign(target, source1) {
  20. if (target == null) { throw new TypeError('target must be an object'); }
  21. var to = toObject(target); // step 1
  22. if (arguments.length === 1) {
  23. return to; // step 2
  24. }
  25. for (var s = 1; s < arguments.length; ++s) {
  26. var from = toObject(arguments[s]); // step 3.a.i
  27. // step 3.a.ii:
  28. var keys = objectKeys(from);
  29. var getSymbols = hasSymbols && (Object.getOwnPropertySymbols || originalGetSymbols);
  30. if (getSymbols) {
  31. var syms = getSymbols(from);
  32. for (var j = 0; j < syms.length; ++j) {
  33. var key = syms[j];
  34. if ($propIsEnumerable(from, key)) {
  35. $push(keys, key);
  36. }
  37. }
  38. }
  39. // step 3.a.iii:
  40. for (var i = 0; i < keys.length; ++i) {
  41. var nextKey = keys[i];
  42. if ($propIsEnumerable(from, nextKey)) { // step 3.a.iii.2
  43. var propValue = from[nextKey]; // step 3.a.iii.2.a
  44. to[nextKey] = propValue; // step 3.a.iii.2.b
  45. }
  46. }
  47. }
  48. return to; // step 4
  49. };
  50. },{"call-bind/callBound":4,"has-symbols/shams":12,"object-keys":15}],3:[function(require,module,exports){
  51. 'use strict';
  52. var defineProperties = require('define-properties');
  53. var callBind = require('call-bind');
  54. var implementation = require('./implementation');
  55. var getPolyfill = require('./polyfill');
  56. var shim = require('./shim');
  57. var polyfill = callBind.apply(getPolyfill());
  58. // eslint-disable-next-line no-unused-vars
  59. var bound = function assign(target, source1) {
  60. return polyfill(Object, arguments);
  61. };
  62. defineProperties(bound, {
  63. getPolyfill: getPolyfill,
  64. implementation: implementation,
  65. shim: shim
  66. });
  67. module.exports = bound;
  68. },{"./implementation":2,"./polyfill":17,"./shim":18,"call-bind":5,"define-properties":6}],4:[function(require,module,exports){
  69. 'use strict';
  70. var GetIntrinsic = require('get-intrinsic');
  71. var callBind = require('./');
  72. var $indexOf = callBind(GetIntrinsic('String.prototype.indexOf'));
  73. module.exports = function callBoundIntrinsic(name, allowMissing) {
  74. var intrinsic = GetIntrinsic(name, !!allowMissing);
  75. if (typeof intrinsic === 'function' && $indexOf(name, '.prototype.') > -1) {
  76. return callBind(intrinsic);
  77. }
  78. return intrinsic;
  79. };
  80. },{"./":5,"get-intrinsic":9}],5:[function(require,module,exports){
  81. 'use strict';
  82. var bind = require('function-bind');
  83. var GetIntrinsic = require('get-intrinsic');
  84. var $apply = GetIntrinsic('%Function.prototype.apply%');
  85. var $call = GetIntrinsic('%Function.prototype.call%');
  86. var $reflectApply = GetIntrinsic('%Reflect.apply%', true) || bind.call($call, $apply);
  87. var $gOPD = GetIntrinsic('%Object.getOwnPropertyDescriptor%', true);
  88. var $defineProperty = GetIntrinsic('%Object.defineProperty%', true);
  89. var $max = GetIntrinsic('%Math.max%');
  90. if ($defineProperty) {
  91. try {
  92. $defineProperty({}, 'a', { value: 1 });
  93. } catch (e) {
  94. // IE 8 has a broken defineProperty
  95. $defineProperty = null;
  96. }
  97. }
  98. module.exports = function callBind(originalFunction) {
  99. var func = $reflectApply(bind, $call, arguments);
  100. if ($gOPD && $defineProperty) {
  101. var desc = $gOPD(func, 'length');
  102. if (desc.configurable) {
  103. // original length, plus the receiver, minus any additional arguments (after the receiver)
  104. $defineProperty(
  105. func,
  106. 'length',
  107. { value: 1 + $max(0, originalFunction.length - (arguments.length - 1)) }
  108. );
  109. }
  110. }
  111. return func;
  112. };
  113. var applyBind = function applyBind() {
  114. return $reflectApply(bind, $apply, arguments);
  115. };
  116. if ($defineProperty) {
  117. $defineProperty(module.exports, 'apply', { value: applyBind });
  118. } else {
  119. module.exports.apply = applyBind;
  120. }
  121. },{"function-bind":8,"get-intrinsic":9}],6:[function(require,module,exports){
  122. 'use strict';
  123. var keys = require('object-keys');
  124. var hasSymbols = typeof Symbol === 'function' && typeof Symbol('foo') === 'symbol';
  125. var toStr = Object.prototype.toString;
  126. var concat = Array.prototype.concat;
  127. var origDefineProperty = Object.defineProperty;
  128. var isFunction = function (fn) {
  129. return typeof fn === 'function' && toStr.call(fn) === '[object Function]';
  130. };
  131. var hasPropertyDescriptors = require('has-property-descriptors')();
  132. var supportsDescriptors = origDefineProperty && hasPropertyDescriptors;
  133. var defineProperty = function (object, name, value, predicate) {
  134. if (name in object && (!isFunction(predicate) || !predicate())) {
  135. return;
  136. }
  137. if (supportsDescriptors) {
  138. origDefineProperty(object, name, {
  139. configurable: true,
  140. enumerable: false,
  141. value: value,
  142. writable: true
  143. });
  144. } else {
  145. object[name] = value; // eslint-disable-line no-param-reassign
  146. }
  147. };
  148. var defineProperties = function (object, map) {
  149. var predicates = arguments.length > 2 ? arguments[2] : {};
  150. var props = keys(map);
  151. if (hasSymbols) {
  152. props = concat.call(props, Object.getOwnPropertySymbols(map));
  153. }
  154. for (var i = 0; i < props.length; i += 1) {
  155. defineProperty(object, props[i], map[props[i]], predicates[props[i]]);
  156. }
  157. };
  158. defineProperties.supportsDescriptors = !!supportsDescriptors;
  159. module.exports = defineProperties;
  160. },{"has-property-descriptors":10,"object-keys":15}],7:[function(require,module,exports){
  161. 'use strict';
  162. /* eslint no-invalid-this: 1 */
  163. var ERROR_MESSAGE = 'Function.prototype.bind called on incompatible ';
  164. var slice = Array.prototype.slice;
  165. var toStr = Object.prototype.toString;
  166. var funcType = '[object Function]';
  167. module.exports = function bind(that) {
  168. var target = this;
  169. if (typeof target !== 'function' || toStr.call(target) !== funcType) {
  170. throw new TypeError(ERROR_MESSAGE + target);
  171. }
  172. var args = slice.call(arguments, 1);
  173. var bound;
  174. var binder = function () {
  175. if (this instanceof bound) {
  176. var result = target.apply(
  177. this,
  178. args.concat(slice.call(arguments))
  179. );
  180. if (Object(result) === result) {
  181. return result;
  182. }
  183. return this;
  184. } else {
  185. return target.apply(
  186. that,
  187. args.concat(slice.call(arguments))
  188. );
  189. }
  190. };
  191. var boundLength = Math.max(0, target.length - args.length);
  192. var boundArgs = [];
  193. for (var i = 0; i < boundLength; i++) {
  194. boundArgs.push('$' + i);
  195. }
  196. bound = Function('binder', 'return function (' + boundArgs.join(',') + '){ return binder.apply(this,arguments); }')(binder);
  197. if (target.prototype) {
  198. var Empty = function Empty() {};
  199. Empty.prototype = target.prototype;
  200. bound.prototype = new Empty();
  201. Empty.prototype = null;
  202. }
  203. return bound;
  204. };
  205. },{}],8:[function(require,module,exports){
  206. 'use strict';
  207. var implementation = require('./implementation');
  208. module.exports = Function.prototype.bind || implementation;
  209. },{"./implementation":7}],9:[function(require,module,exports){
  210. 'use strict';
  211. var undefined;
  212. var $SyntaxError = SyntaxError;
  213. var $Function = Function;
  214. var $TypeError = TypeError;
  215. // eslint-disable-next-line consistent-return
  216. var getEvalledConstructor = function (expressionSyntax) {
  217. try {
  218. return $Function('"use strict"; return (' + expressionSyntax + ').constructor;')();
  219. } catch (e) {}
  220. };
  221. var $gOPD = Object.getOwnPropertyDescriptor;
  222. if ($gOPD) {
  223. try {
  224. $gOPD({}, '');
  225. } catch (e) {
  226. $gOPD = null; // this is IE 8, which has a broken gOPD
  227. }
  228. }
  229. var throwTypeError = function () {
  230. throw new $TypeError();
  231. };
  232. var ThrowTypeError = $gOPD
  233. ? (function () {
  234. try {
  235. // eslint-disable-next-line no-unused-expressions, no-caller, no-restricted-properties
  236. arguments.callee; // IE 8 does not throw here
  237. return throwTypeError;
  238. } catch (calleeThrows) {
  239. try {
  240. // IE 8 throws on Object.getOwnPropertyDescriptor(arguments, '')
  241. return $gOPD(arguments, 'callee').get;
  242. } catch (gOPDthrows) {
  243. return throwTypeError;
  244. }
  245. }
  246. }())
  247. : throwTypeError;
  248. var hasSymbols = require('has-symbols')();
  249. var getProto = Object.getPrototypeOf || function (x) { return x.__proto__; }; // eslint-disable-line no-proto
  250. var needsEval = {};
  251. var TypedArray = typeof Uint8Array === 'undefined' ? undefined : getProto(Uint8Array);
  252. var INTRINSICS = {
  253. '%AggregateError%': typeof AggregateError === 'undefined' ? undefined : AggregateError,
  254. '%Array%': Array,
  255. '%ArrayBuffer%': typeof ArrayBuffer === 'undefined' ? undefined : ArrayBuffer,
  256. '%ArrayIteratorPrototype%': hasSymbols ? getProto([][Symbol.iterator]()) : undefined,
  257. '%AsyncFromSyncIteratorPrototype%': undefined,
  258. '%AsyncFunction%': needsEval,
  259. '%AsyncGenerator%': needsEval,
  260. '%AsyncGeneratorFunction%': needsEval,
  261. '%AsyncIteratorPrototype%': needsEval,
  262. '%Atomics%': typeof Atomics === 'undefined' ? undefined : Atomics,
  263. '%BigInt%': typeof BigInt === 'undefined' ? undefined : BigInt,
  264. '%Boolean%': Boolean,
  265. '%DataView%': typeof DataView === 'undefined' ? undefined : DataView,
  266. '%Date%': Date,
  267. '%decodeURI%': decodeURI,
  268. '%decodeURIComponent%': decodeURIComponent,
  269. '%encodeURI%': encodeURI,
  270. '%encodeURIComponent%': encodeURIComponent,
  271. '%Error%': Error,
  272. '%eval%': eval, // eslint-disable-line no-eval
  273. '%EvalError%': EvalError,
  274. '%Float32Array%': typeof Float32Array === 'undefined' ? undefined : Float32Array,
  275. '%Float64Array%': typeof Float64Array === 'undefined' ? undefined : Float64Array,
  276. '%FinalizationRegistry%': typeof FinalizationRegistry === 'undefined' ? undefined : FinalizationRegistry,
  277. '%Function%': $Function,
  278. '%GeneratorFunction%': needsEval,
  279. '%Int8Array%': typeof Int8Array === 'undefined' ? undefined : Int8Array,
  280. '%Int16Array%': typeof Int16Array === 'undefined' ? undefined : Int16Array,
  281. '%Int32Array%': typeof Int32Array === 'undefined' ? undefined : Int32Array,
  282. '%isFinite%': isFinite,
  283. '%isNaN%': isNaN,
  284. '%IteratorPrototype%': hasSymbols ? getProto(getProto([][Symbol.iterator]())) : undefined,
  285. '%JSON%': typeof JSON === 'object' ? JSON : undefined,
  286. '%Map%': typeof Map === 'undefined' ? undefined : Map,
  287. '%MapIteratorPrototype%': typeof Map === 'undefined' || !hasSymbols ? undefined : getProto(new Map()[Symbol.iterator]()),
  288. '%Math%': Math,
  289. '%Number%': Number,
  290. '%Object%': Object,
  291. '%parseFloat%': parseFloat,
  292. '%parseInt%': parseInt,
  293. '%Promise%': typeof Promise === 'undefined' ? undefined : Promise,
  294. '%Proxy%': typeof Proxy === 'undefined' ? undefined : Proxy,
  295. '%RangeError%': RangeError,
  296. '%ReferenceError%': ReferenceError,
  297. '%Reflect%': typeof Reflect === 'undefined' ? undefined : Reflect,
  298. '%RegExp%': RegExp,
  299. '%Set%': typeof Set === 'undefined' ? undefined : Set,
  300. '%SetIteratorPrototype%': typeof Set === 'undefined' || !hasSymbols ? undefined : getProto(new Set()[Symbol.iterator]()),
  301. '%SharedArrayBuffer%': typeof SharedArrayBuffer === 'undefined' ? undefined : SharedArrayBuffer,
  302. '%String%': String,
  303. '%StringIteratorPrototype%': hasSymbols ? getProto(''[Symbol.iterator]()) : undefined,
  304. '%Symbol%': hasSymbols ? Symbol : undefined,
  305. '%SyntaxError%': $SyntaxError,
  306. '%ThrowTypeError%': ThrowTypeError,
  307. '%TypedArray%': TypedArray,
  308. '%TypeError%': $TypeError,
  309. '%Uint8Array%': typeof Uint8Array === 'undefined' ? undefined : Uint8Array,
  310. '%Uint8ClampedArray%': typeof Uint8ClampedArray === 'undefined' ? undefined : Uint8ClampedArray,
  311. '%Uint16Array%': typeof Uint16Array === 'undefined' ? undefined : Uint16Array,
  312. '%Uint32Array%': typeof Uint32Array === 'undefined' ? undefined : Uint32Array,
  313. '%URIError%': URIError,
  314. '%WeakMap%': typeof WeakMap === 'undefined' ? undefined : WeakMap,
  315. '%WeakRef%': typeof WeakRef === 'undefined' ? undefined : WeakRef,
  316. '%WeakSet%': typeof WeakSet === 'undefined' ? undefined : WeakSet
  317. };
  318. var doEval = function doEval(name) {
  319. var value;
  320. if (name === '%AsyncFunction%') {
  321. value = getEvalledConstructor('async function () {}');
  322. } else if (name === '%GeneratorFunction%') {
  323. value = getEvalledConstructor('function* () {}');
  324. } else if (name === '%AsyncGeneratorFunction%') {
  325. value = getEvalledConstructor('async function* () {}');
  326. } else if (name === '%AsyncGenerator%') {
  327. var fn = doEval('%AsyncGeneratorFunction%');
  328. if (fn) {
  329. value = fn.prototype;
  330. }
  331. } else if (name === '%AsyncIteratorPrototype%') {
  332. var gen = doEval('%AsyncGenerator%');
  333. if (gen) {
  334. value = getProto(gen.prototype);
  335. }
  336. }
  337. INTRINSICS[name] = value;
  338. return value;
  339. };
  340. var LEGACY_ALIASES = {
  341. '%ArrayBufferPrototype%': ['ArrayBuffer', 'prototype'],
  342. '%ArrayPrototype%': ['Array', 'prototype'],
  343. '%ArrayProto_entries%': ['Array', 'prototype', 'entries'],
  344. '%ArrayProto_forEach%': ['Array', 'prototype', 'forEach'],
  345. '%ArrayProto_keys%': ['Array', 'prototype', 'keys'],
  346. '%ArrayProto_values%': ['Array', 'prototype', 'values'],
  347. '%AsyncFunctionPrototype%': ['AsyncFunction', 'prototype'],
  348. '%AsyncGenerator%': ['AsyncGeneratorFunction', 'prototype'],
  349. '%AsyncGeneratorPrototype%': ['AsyncGeneratorFunction', 'prototype', 'prototype'],
  350. '%BooleanPrototype%': ['Boolean', 'prototype'],
  351. '%DataViewPrototype%': ['DataView', 'prototype'],
  352. '%DatePrototype%': ['Date', 'prototype'],
  353. '%ErrorPrototype%': ['Error', 'prototype'],
  354. '%EvalErrorPrototype%': ['EvalError', 'prototype'],
  355. '%Float32ArrayPrototype%': ['Float32Array', 'prototype'],
  356. '%Float64ArrayPrototype%': ['Float64Array', 'prototype'],
  357. '%FunctionPrototype%': ['Function', 'prototype'],
  358. '%Generator%': ['GeneratorFunction', 'prototype'],
  359. '%GeneratorPrototype%': ['GeneratorFunction', 'prototype', 'prototype'],
  360. '%Int8ArrayPrototype%': ['Int8Array', 'prototype'],
  361. '%Int16ArrayPrototype%': ['Int16Array', 'prototype'],
  362. '%Int32ArrayPrototype%': ['Int32Array', 'prototype'],
  363. '%JSONParse%': ['JSON', 'parse'],
  364. '%JSONStringify%': ['JSON', 'stringify'],
  365. '%MapPrototype%': ['Map', 'prototype'],
  366. '%NumberPrototype%': ['Number', 'prototype'],
  367. '%ObjectPrototype%': ['Object', 'prototype'],
  368. '%ObjProto_toString%': ['Object', 'prototype', 'toString'],
  369. '%ObjProto_valueOf%': ['Object', 'prototype', 'valueOf'],
  370. '%PromisePrototype%': ['Promise', 'prototype'],
  371. '%PromiseProto_then%': ['Promise', 'prototype', 'then'],
  372. '%Promise_all%': ['Promise', 'all'],
  373. '%Promise_reject%': ['Promise', 'reject'],
  374. '%Promise_resolve%': ['Promise', 'resolve'],
  375. '%RangeErrorPrototype%': ['RangeError', 'prototype'],
  376. '%ReferenceErrorPrototype%': ['ReferenceError', 'prototype'],
  377. '%RegExpPrototype%': ['RegExp', 'prototype'],
  378. '%SetPrototype%': ['Set', 'prototype'],
  379. '%SharedArrayBufferPrototype%': ['SharedArrayBuffer', 'prototype'],
  380. '%StringPrototype%': ['String', 'prototype'],
  381. '%SymbolPrototype%': ['Symbol', 'prototype'],
  382. '%SyntaxErrorPrototype%': ['SyntaxError', 'prototype'],
  383. '%TypedArrayPrototype%': ['TypedArray', 'prototype'],
  384. '%TypeErrorPrototype%': ['TypeError', 'prototype'],
  385. '%Uint8ArrayPrototype%': ['Uint8Array', 'prototype'],
  386. '%Uint8ClampedArrayPrototype%': ['Uint8ClampedArray', 'prototype'],
  387. '%Uint16ArrayPrototype%': ['Uint16Array', 'prototype'],
  388. '%Uint32ArrayPrototype%': ['Uint32Array', 'prototype'],
  389. '%URIErrorPrototype%': ['URIError', 'prototype'],
  390. '%WeakMapPrototype%': ['WeakMap', 'prototype'],
  391. '%WeakSetPrototype%': ['WeakSet', 'prototype']
  392. };
  393. var bind = require('function-bind');
  394. var hasOwn = require('has');
  395. var $concat = bind.call(Function.call, Array.prototype.concat);
  396. var $spliceApply = bind.call(Function.apply, Array.prototype.splice);
  397. var $replace = bind.call(Function.call, String.prototype.replace);
  398. var $strSlice = bind.call(Function.call, String.prototype.slice);
  399. /* adapted from https://github.com/lodash/lodash/blob/4.17.15/dist/lodash.js#L6735-L6744 */
  400. var rePropName = /[^%.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|%$))/g;
  401. var reEscapeChar = /\\(\\)?/g; /** Used to match backslashes in property paths. */
  402. var stringToPath = function stringToPath(string) {
  403. var first = $strSlice(string, 0, 1);
  404. var last = $strSlice(string, -1);
  405. if (first === '%' && last !== '%') {
  406. throw new $SyntaxError('invalid intrinsic syntax, expected closing `%`');
  407. } else if (last === '%' && first !== '%') {
  408. throw new $SyntaxError('invalid intrinsic syntax, expected opening `%`');
  409. }
  410. var result = [];
  411. $replace(string, rePropName, function (match, number, quote, subString) {
  412. result[result.length] = quote ? $replace(subString, reEscapeChar, '$1') : number || match;
  413. });
  414. return result;
  415. };
  416. /* end adaptation */
  417. var getBaseIntrinsic = function getBaseIntrinsic(name, allowMissing) {
  418. var intrinsicName = name;
  419. var alias;
  420. if (hasOwn(LEGACY_ALIASES, intrinsicName)) {
  421. alias = LEGACY_ALIASES[intrinsicName];
  422. intrinsicName = '%' + alias[0] + '%';
  423. }
  424. if (hasOwn(INTRINSICS, intrinsicName)) {
  425. var value = INTRINSICS[intrinsicName];
  426. if (value === needsEval) {
  427. value = doEval(intrinsicName);
  428. }
  429. if (typeof value === 'undefined' && !allowMissing) {
  430. throw new $TypeError('intrinsic ' + name + ' exists, but is not available. Please file an issue!');
  431. }
  432. return {
  433. alias: alias,
  434. name: intrinsicName,
  435. value: value
  436. };
  437. }
  438. throw new $SyntaxError('intrinsic ' + name + ' does not exist!');
  439. };
  440. module.exports = function GetIntrinsic(name, allowMissing) {
  441. if (typeof name !== 'string' || name.length === 0) {
  442. throw new $TypeError('intrinsic name must be a non-empty string');
  443. }
  444. if (arguments.length > 1 && typeof allowMissing !== 'boolean') {
  445. throw new $TypeError('"allowMissing" argument must be a boolean');
  446. }
  447. var parts = stringToPath(name);
  448. var intrinsicBaseName = parts.length > 0 ? parts[0] : '';
  449. var intrinsic = getBaseIntrinsic('%' + intrinsicBaseName + '%', allowMissing);
  450. var intrinsicRealName = intrinsic.name;
  451. var value = intrinsic.value;
  452. var skipFurtherCaching = false;
  453. var alias = intrinsic.alias;
  454. if (alias) {
  455. intrinsicBaseName = alias[0];
  456. $spliceApply(parts, $concat([0, 1], alias));
  457. }
  458. for (var i = 1, isOwn = true; i < parts.length; i += 1) {
  459. var part = parts[i];
  460. var first = $strSlice(part, 0, 1);
  461. var last = $strSlice(part, -1);
  462. if (
  463. (
  464. (first === '"' || first === "'" || first === '`')
  465. || (last === '"' || last === "'" || last === '`')
  466. )
  467. && first !== last
  468. ) {
  469. throw new $SyntaxError('property names with quotes must have matching quotes');
  470. }
  471. if (part === 'constructor' || !isOwn) {
  472. skipFurtherCaching = true;
  473. }
  474. intrinsicBaseName += '.' + part;
  475. intrinsicRealName = '%' + intrinsicBaseName + '%';
  476. if (hasOwn(INTRINSICS, intrinsicRealName)) {
  477. value = INTRINSICS[intrinsicRealName];
  478. } else if (value != null) {
  479. if (!(part in value)) {
  480. if (!allowMissing) {
  481. throw new $TypeError('base intrinsic for ' + name + ' exists, but the property is not available.');
  482. }
  483. return void undefined;
  484. }
  485. if ($gOPD && (i + 1) >= parts.length) {
  486. var desc = $gOPD(value, part);
  487. isOwn = !!desc;
  488. // By convention, when a data property is converted to an accessor
  489. // property to emulate a data property that does not suffer from
  490. // the override mistake, that accessor's getter is marked with
  491. // an `originalValue` property. Here, when we detect this, we
  492. // uphold the illusion by pretending to see that original data
  493. // property, i.e., returning the value rather than the getter
  494. // itself.
  495. if (isOwn && 'get' in desc && !('originalValue' in desc.get)) {
  496. value = desc.get;
  497. } else {
  498. value = value[part];
  499. }
  500. } else {
  501. isOwn = hasOwn(value, part);
  502. value = value[part];
  503. }
  504. if (isOwn && !skipFurtherCaching) {
  505. INTRINSICS[intrinsicRealName] = value;
  506. }
  507. }
  508. }
  509. return value;
  510. };
  511. },{"function-bind":8,"has":13,"has-symbols":11}],10:[function(require,module,exports){
  512. 'use strict';
  513. var GetIntrinsic = require('get-intrinsic');
  514. var $defineProperty = GetIntrinsic('%Object.defineProperty%', true);
  515. var hasPropertyDescriptors = function hasPropertyDescriptors() {
  516. if ($defineProperty) {
  517. try {
  518. $defineProperty({}, 'a', { value: 1 });
  519. return true;
  520. } catch (e) {
  521. // IE 8 has a broken defineProperty
  522. return false;
  523. }
  524. }
  525. return false;
  526. };
  527. hasPropertyDescriptors.hasArrayLengthDefineBug = function hasArrayLengthDefineBug() {
  528. // node v0.6 has a bug where array lengths can be Set but not Defined
  529. if (!hasPropertyDescriptors()) {
  530. return null;
  531. }
  532. try {
  533. return $defineProperty([], 'length', { value: 1 }).length !== 1;
  534. } catch (e) {
  535. // In Firefox 4-22, defining length on an array throws an exception.
  536. return true;
  537. }
  538. };
  539. module.exports = hasPropertyDescriptors;
  540. },{"get-intrinsic":9}],11:[function(require,module,exports){
  541. 'use strict';
  542. var origSymbol = typeof Symbol !== 'undefined' && Symbol;
  543. var hasSymbolSham = require('./shams');
  544. module.exports = function hasNativeSymbols() {
  545. if (typeof origSymbol !== 'function') { return false; }
  546. if (typeof Symbol !== 'function') { return false; }
  547. if (typeof origSymbol('foo') !== 'symbol') { return false; }
  548. if (typeof Symbol('bar') !== 'symbol') { return false; }
  549. return hasSymbolSham();
  550. };
  551. },{"./shams":12}],12:[function(require,module,exports){
  552. 'use strict';
  553. /* eslint complexity: [2, 18], max-statements: [2, 33] */
  554. module.exports = function hasSymbols() {
  555. if (typeof Symbol !== 'function' || typeof Object.getOwnPropertySymbols !== 'function') { return false; }
  556. if (typeof Symbol.iterator === 'symbol') { return true; }
  557. var obj = {};
  558. var sym = Symbol('test');
  559. var symObj = Object(sym);
  560. if (typeof sym === 'string') { return false; }
  561. if (Object.prototype.toString.call(sym) !== '[object Symbol]') { return false; }
  562. if (Object.prototype.toString.call(symObj) !== '[object Symbol]') { return false; }
  563. // temp disabled per https://github.com/ljharb/object.assign/issues/17
  564. // if (sym instanceof Symbol) { return false; }
  565. // temp disabled per https://github.com/WebReflection/get-own-property-symbols/issues/4
  566. // if (!(symObj instanceof Symbol)) { return false; }
  567. // if (typeof Symbol.prototype.toString !== 'function') { return false; }
  568. // if (String(sym) !== Symbol.prototype.toString.call(sym)) { return false; }
  569. var symVal = 42;
  570. obj[sym] = symVal;
  571. for (sym in obj) { return false; } // eslint-disable-line no-restricted-syntax, no-unreachable-loop
  572. if (typeof Object.keys === 'function' && Object.keys(obj).length !== 0) { return false; }
  573. if (typeof Object.getOwnPropertyNames === 'function' && Object.getOwnPropertyNames(obj).length !== 0) { return false; }
  574. var syms = Object.getOwnPropertySymbols(obj);
  575. if (syms.length !== 1 || syms[0] !== sym) { return false; }
  576. if (!Object.prototype.propertyIsEnumerable.call(obj, sym)) { return false; }
  577. if (typeof Object.getOwnPropertyDescriptor === 'function') {
  578. var descriptor = Object.getOwnPropertyDescriptor(obj, sym);
  579. if (descriptor.value !== symVal || descriptor.enumerable !== true) { return false; }
  580. }
  581. return true;
  582. };
  583. },{}],13:[function(require,module,exports){
  584. 'use strict';
  585. var bind = require('function-bind');
  586. module.exports = bind.call(Function.call, Object.prototype.hasOwnProperty);
  587. },{"function-bind":8}],14:[function(require,module,exports){
  588. 'use strict';
  589. var keysShim;
  590. if (!Object.keys) {
  591. // modified from https://github.com/es-shims/es5-shim
  592. var has = Object.prototype.hasOwnProperty;
  593. var toStr = Object.prototype.toString;
  594. var isArgs = require('./isArguments'); // eslint-disable-line global-require
  595. var isEnumerable = Object.prototype.propertyIsEnumerable;
  596. var hasDontEnumBug = !isEnumerable.call({ toString: null }, 'toString');
  597. var hasProtoEnumBug = isEnumerable.call(function () {}, 'prototype');
  598. var dontEnums = [
  599. 'toString',
  600. 'toLocaleString',
  601. 'valueOf',
  602. 'hasOwnProperty',
  603. 'isPrototypeOf',
  604. 'propertyIsEnumerable',
  605. 'constructor'
  606. ];
  607. var equalsConstructorPrototype = function (o) {
  608. var ctor = o.constructor;
  609. return ctor && ctor.prototype === o;
  610. };
  611. var excludedKeys = {
  612. $applicationCache: true,
  613. $console: true,
  614. $external: true,
  615. $frame: true,
  616. $frameElement: true,
  617. $frames: true,
  618. $innerHeight: true,
  619. $innerWidth: true,
  620. $onmozfullscreenchange: true,
  621. $onmozfullscreenerror: true,
  622. $outerHeight: true,
  623. $outerWidth: true,
  624. $pageXOffset: true,
  625. $pageYOffset: true,
  626. $parent: true,
  627. $scrollLeft: true,
  628. $scrollTop: true,
  629. $scrollX: true,
  630. $scrollY: true,
  631. $self: true,
  632. $webkitIndexedDB: true,
  633. $webkitStorageInfo: true,
  634. $window: true
  635. };
  636. var hasAutomationEqualityBug = (function () {
  637. /* global window */
  638. if (typeof window === 'undefined') { return false; }
  639. for (var k in window) {
  640. try {
  641. if (!excludedKeys['$' + k] && has.call(window, k) && window[k] !== null && typeof window[k] === 'object') {
  642. try {
  643. equalsConstructorPrototype(window[k]);
  644. } catch (e) {
  645. return true;
  646. }
  647. }
  648. } catch (e) {
  649. return true;
  650. }
  651. }
  652. return false;
  653. }());
  654. var equalsConstructorPrototypeIfNotBuggy = function (o) {
  655. /* global window */
  656. if (typeof window === 'undefined' || !hasAutomationEqualityBug) {
  657. return equalsConstructorPrototype(o);
  658. }
  659. try {
  660. return equalsConstructorPrototype(o);
  661. } catch (e) {
  662. return false;
  663. }
  664. };
  665. keysShim = function keys(object) {
  666. var isObject = object !== null && typeof object === 'object';
  667. var isFunction = toStr.call(object) === '[object Function]';
  668. var isArguments = isArgs(object);
  669. var isString = isObject && toStr.call(object) === '[object String]';
  670. var theKeys = [];
  671. if (!isObject && !isFunction && !isArguments) {
  672. throw new TypeError('Object.keys called on a non-object');
  673. }
  674. var skipProto = hasProtoEnumBug && isFunction;
  675. if (isString && object.length > 0 && !has.call(object, 0)) {
  676. for (var i = 0; i < object.length; ++i) {
  677. theKeys.push(String(i));
  678. }
  679. }
  680. if (isArguments && object.length > 0) {
  681. for (var j = 0; j < object.length; ++j) {
  682. theKeys.push(String(j));
  683. }
  684. } else {
  685. for (var name in object) {
  686. if (!(skipProto && name === 'prototype') && has.call(object, name)) {
  687. theKeys.push(String(name));
  688. }
  689. }
  690. }
  691. if (hasDontEnumBug) {
  692. var skipConstructor = equalsConstructorPrototypeIfNotBuggy(object);
  693. for (var k = 0; k < dontEnums.length; ++k) {
  694. if (!(skipConstructor && dontEnums[k] === 'constructor') && has.call(object, dontEnums[k])) {
  695. theKeys.push(dontEnums[k]);
  696. }
  697. }
  698. }
  699. return theKeys;
  700. };
  701. }
  702. module.exports = keysShim;
  703. },{"./isArguments":16}],15:[function(require,module,exports){
  704. 'use strict';
  705. var slice = Array.prototype.slice;
  706. var isArgs = require('./isArguments');
  707. var origKeys = Object.keys;
  708. var keysShim = origKeys ? function keys(o) { return origKeys(o); } : require('./implementation');
  709. var originalKeys = Object.keys;
  710. keysShim.shim = function shimObjectKeys() {
  711. if (Object.keys) {
  712. var keysWorksWithArguments = (function () {
  713. // Safari 5.0 bug
  714. var args = Object.keys(arguments);
  715. return args && args.length === arguments.length;
  716. }(1, 2));
  717. if (!keysWorksWithArguments) {
  718. Object.keys = function keys(object) { // eslint-disable-line func-name-matching
  719. if (isArgs(object)) {
  720. return originalKeys(slice.call(object));
  721. }
  722. return originalKeys(object);
  723. };
  724. }
  725. } else {
  726. Object.keys = keysShim;
  727. }
  728. return Object.keys || keysShim;
  729. };
  730. module.exports = keysShim;
  731. },{"./implementation":14,"./isArguments":16}],16:[function(require,module,exports){
  732. 'use strict';
  733. var toStr = Object.prototype.toString;
  734. module.exports = function isArguments(value) {
  735. var str = toStr.call(value);
  736. var isArgs = str === '[object Arguments]';
  737. if (!isArgs) {
  738. isArgs = str !== '[object Array]' &&
  739. value !== null &&
  740. typeof value === 'object' &&
  741. typeof value.length === 'number' &&
  742. value.length >= 0 &&
  743. toStr.call(value.callee) === '[object Function]';
  744. }
  745. return isArgs;
  746. };
  747. },{}],17:[function(require,module,exports){
  748. 'use strict';
  749. var implementation = require('./implementation');
  750. var lacksProperEnumerationOrder = function () {
  751. if (!Object.assign) {
  752. return false;
  753. }
  754. /*
  755. * v8, specifically in node 4.x, has a bug with incorrect property enumeration order
  756. * note: this does not detect the bug unless there's 20 characters
  757. */
  758. var str = 'abcdefghijklmnopqrst';
  759. var letters = str.split('');
  760. var map = {};
  761. for (var i = 0; i < letters.length; ++i) {
  762. map[letters[i]] = letters[i];
  763. }
  764. var obj = Object.assign({}, map);
  765. var actual = '';
  766. for (var k in obj) {
  767. actual += k;
  768. }
  769. return str !== actual;
  770. };
  771. var assignHasPendingExceptions = function () {
  772. if (!Object.assign || !Object.preventExtensions) {
  773. return false;
  774. }
  775. /*
  776. * Firefox 37 still has "pending exception" logic in its Object.assign implementation,
  777. * which is 72% slower than our shim, and Firefox 40's native implementation.
  778. */
  779. var thrower = Object.preventExtensions({ 1: 2 });
  780. try {
  781. Object.assign(thrower, 'xy');
  782. } catch (e) {
  783. return thrower[1] === 'y';
  784. }
  785. return false;
  786. };
  787. module.exports = function getPolyfill() {
  788. if (!Object.assign) {
  789. return implementation;
  790. }
  791. if (lacksProperEnumerationOrder()) {
  792. return implementation;
  793. }
  794. if (assignHasPendingExceptions()) {
  795. return implementation;
  796. }
  797. return Object.assign;
  798. };
  799. },{"./implementation":2}],18:[function(require,module,exports){
  800. 'use strict';
  801. var define = require('define-properties');
  802. var getPolyfill = require('./polyfill');
  803. module.exports = function shimAssign() {
  804. var polyfill = getPolyfill();
  805. define(
  806. Object,
  807. { assign: polyfill },
  808. { assign: function () { return Object.assign !== polyfill; } }
  809. );
  810. return polyfill;
  811. };
  812. },{"./polyfill":17,"define-properties":6}]},{},[1]);