From 1e7637a1dc7ec03fabd9e701625d55789e42d214 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=8E=8B=E5=8A=B2=E9=B9=8F?= Date: Fri, 17 Jun 2022 15:43:51 +0800 Subject: [PATCH] js: list add canDrag, onDraging & onDraged --- doric-js/bundle/doric-lib.es5.js | 74 +- doric-js/bundle/doric-lib.js | 12 + doric-js/bundle/doric-sandbox.es5.js | 7180 +++++++++++++++--------- doric-js/bundle/doric-vm.js | 12 + doric-js/index.d.ts | 27 +- doric-js/lib/src/native/navigator.d.ts | 10 +- doric-js/lib/src/native/network.d.ts | 8 +- doric-js/lib/src/native/storage.d.ts | 6 +- doric-js/lib/src/widget/list.d.ts | 3 + doric-js/lib/src/widget/list.js | 12 + doric-js/src/widget/list.ts | 9 + 11 files changed, 4683 insertions(+), 2670 deletions(-) diff --git a/doric-js/bundle/doric-lib.es5.js b/doric-js/bundle/doric-lib.es5.js index ea19fc67..a8a470fc 100644 --- a/doric-js/bundle/doric-lib.es5.js +++ b/doric-js/bundle/doric-lib.es5.js @@ -68,7 +68,7 @@ var Mutable = /** @class */ (function () { */ var __uniqueId__ = 0; function uniqueId(prefix) { - return "__" + prefix + "_" + __uniqueId__++ + "__"; + return "__".concat(prefix, "_").concat(__uniqueId__++, "__"); } function toString(message) { @@ -92,11 +92,6 @@ function toString(message) { } function log() { var arguments$1 = arguments; - - var args = []; - for (var _i = 0; _i < arguments.length; _i++) { - args[_i] = arguments$1[_i]; - } var out = ""; for (var i = 0; i < arguments.length; i++) { if (i > 0) { @@ -108,11 +103,6 @@ function log() { } function loge() { var arguments$1 = arguments; - - var message = []; - for (var _i = 0; _i < arguments.length; _i++) { - message[_i] = arguments$1[_i]; - } var out = ""; for (var i = 0; i < arguments.length; i++) { if (i > 0) { @@ -124,11 +114,6 @@ function loge() { } function logw() { var arguments$1 = arguments; - - var message = []; - for (var _i = 0; _i < arguments.length; _i++) { - message[_i] = arguments$1[_i]; - } var out = ""; for (var i = 0; i < arguments.length; i++) { if (i > 0) { @@ -177,11 +162,11 @@ var __values$5 = (undefined && undefined.__values) || function(o) { function Property(target, propKey) { Object.defineProperty(target, propKey, { get: function () { - return Reflect.get(this, "__prop__" + propKey, this); + return Reflect.get(this, "__prop__".concat(propKey), this); }, set: function (v) { - var oldV = Reflect.get(this, "__prop__" + propKey, this); - Reflect.set(this, "__prop__" + propKey, v, this); + var oldV = Reflect.get(this, "__prop__".concat(propKey), this); + Reflect.set(this, "__prop__".concat(propKey), v, this); if (oldV !== v) { Reflect.apply(this.onPropertyChanged, this, [propKey, oldV, v]); } @@ -191,11 +176,11 @@ function Property(target, propKey) { function InconsistProperty(target, propKey) { Object.defineProperty(target, propKey, { get: function () { - return Reflect.get(this, "__prop__" + propKey, this); + return Reflect.get(this, "__prop__".concat(propKey), this); }, set: function (v) { - var oldV = Reflect.get(this, "__prop__" + propKey, this); - Reflect.set(this, "__prop__" + propKey, v, this); + var oldV = Reflect.get(this, "__prop__".concat(propKey), this); + Reflect.set(this, "__prop__".concat(propKey), v, this); Reflect.apply(this.onPropertyChanged, this, [propKey, oldV, v]); }, }); @@ -359,11 +344,6 @@ var View = /** @class */ (function () { }; View.prototype.responseCallback = function (id) { var arguments$1 = arguments; - - var args = []; - for (var _i = 1; _i < arguments.length; _i++) { - args[_i - 1] = arguments$1[_i]; - } var f = this.id2Callback(id); if (f instanceof Function) { var argumentsList = []; @@ -373,7 +353,7 @@ var View = /** @class */ (function () { return Reflect.apply(f, this, argumentsList); } else { - loge("Cannot find callback:" + id + " for " + JSON.stringify(this.toModel())); + loge("Cannot find callback:".concat(id, " for ").concat(JSON.stringify(this.toModel()))); } }; View.prototype.toModel = function () { @@ -714,7 +694,7 @@ var Group = /** @class */ (function (_super) { this.addChild(e); } else { - loge("Not allowed to add " + typeof e); + loge("Not allowed to add ".concat(typeof e)); } }; Object.defineProperty(Group.prototype, "innerElement", { @@ -1229,7 +1209,7 @@ var Panel = /** @class */ (function () { var v = this.retrospectView(viewIds); if (v === undefined) { - loge("Cannot find view for " + viewIds); + loge("Cannot find view for ".concat(viewIds)); } else { var argumentsList = [callbackId]; @@ -1431,7 +1411,7 @@ var Color = /** @class */ (function () { } Color.parse = function (str) { if (!str.startsWith("#")) { - throw new Error("Parse color error with " + str); + throw new Error("Parse color error with ".concat(str)); } var val = parseInt(str.substr(1), 16); if (str.length === 7) { @@ -1441,7 +1421,7 @@ var Color = /** @class */ (function () { return new Color(val); } else { - throw new Error("Parse color error with " + str); + throw new Error("Parse color error with ".concat(str)); } }; Color.safeParse = function (str, defVal) { @@ -2244,7 +2224,7 @@ var MainBundleResource = /** @class */ (function (_super) { var BundleResource = /** @class */ (function (_super) { __extends$f(BundleResource, _super); function BundleResource(bundleName, fileName) { - return _super.call(this, "bundle", bundleName + "://" + fileName) || this; + return _super.call(this, "bundle", "".concat(bundleName, "://").concat(fileName)) || this; } return BundleResource; }(iOSResource)); @@ -2527,7 +2507,7 @@ var List = /** @class */ (function (_super) { List.prototype.getItem = function (itemIdx) { var view = this.renderItem(itemIdx); view.superview = this; - this.cachedViews.set("" + itemIdx, view); + this.cachedViews.set("".concat(itemIdx), view); return view; }; List.prototype.renderBunchedItems = function (start, length) { @@ -2587,6 +2567,18 @@ var List = /** @class */ (function (_super) { Property, __metadata$a("design:type", Boolean) ], List.prototype, "bounces", void 0); + __decorate$a([ + Property, + __metadata$a("design:type", Boolean) + ], List.prototype, "canDrag", void 0); + __decorate$a([ + Property, + __metadata$a("design:type", Function) + ], List.prototype, "onDragging", void 0); + __decorate$a([ + Property, + __metadata$a("design:type", Function) + ], List.prototype, "onDragged", void 0); return List; }(Superview)); function list(config) { @@ -2661,7 +2653,7 @@ var Slider = /** @class */ (function (_super) { Slider.prototype.getItem = function (itemIdx) { var view = this.renderPage(itemIdx); view.superview = this; - this.cachedViews.set("" + itemIdx, view); + this.cachedViews.set("".concat(itemIdx), view); return view; }; Slider.prototype.renderBunchedItems = function (start, length) { @@ -3025,7 +3017,7 @@ exports.jsx = void 0; Reflect.set(e, "innerElement", children, e); } else { - throw new Error("Do not support " + constructor.name + " for " + children); + throw new Error("Do not support ".concat(constructor.name, " for ").concat(children)); } } return e; @@ -3143,7 +3135,7 @@ var FlowLayout = /** @class */ (function (_super) { FlowLayout.prototype.getItem = function (itemIdx) { var view = this.renderItem(itemIdx); view.superview = this; - this.cachedViews.set("" + itemIdx, view); + this.cachedViews.set("".concat(itemIdx), view); return view; }; FlowLayout.prototype.renderBunchedItems = function (start, length) { @@ -3824,7 +3816,7 @@ function navbar(context) { } function internalScheme(context, panelClass) { - return "_internal_://export?class=" + encodeURIComponent(panelClass.name) + "&context=" + context.id; + return "_internal_://export?class=".concat(encodeURIComponent(panelClass.name), "&context=").concat(context.id); } function navigator(context) { var moduleName = "navigator"; @@ -3864,9 +3856,9 @@ function transformRequest(request) { if (request.params !== undefined) { var queryStrings = []; for (var key in request.params) { - queryStrings.push(key + "=" + encodeURIComponent(request.params[key])); + queryStrings.push("".concat(key, "=").concat(encodeURIComponent(request.params[key]))); } - request.url = "" + request.url + (url.indexOf('?') >= 0 ? '&' : '?') + queryStrings.join('&'); + request.url = "".concat(request.url).concat(url.indexOf('?') >= 0 ? '&' : '?').concat(queryStrings.join('&')); } if (typeof request.data === 'object') { request.data = JSON.stringify(request.data); @@ -4142,7 +4134,7 @@ function animate(context) { } else { return function (args) { - return Promise.reject("Cannot find panel in Context:" + context.id); + return Promise.reject("Cannot find panel in Context:".concat(context.id)); }; } } diff --git a/doric-js/bundle/doric-lib.js b/doric-js/bundle/doric-lib.js index ec5f0f79..cb248bad 100644 --- a/doric-js/bundle/doric-lib.js +++ b/doric-js/bundle/doric-lib.js @@ -1953,6 +1953,18 @@ __decorate$a([ Property, __metadata$a("design:type", Boolean) ], List.prototype, "bounces", void 0); +__decorate$a([ + Property, + __metadata$a("design:type", Boolean) +], List.prototype, "canDrag", void 0); +__decorate$a([ + Property, + __metadata$a("design:type", Function) +], List.prototype, "onDragging", void 0); +__decorate$a([ + Property, + __metadata$a("design:type", Function) +], List.prototype, "onDragged", void 0); function list(config) { const ret = new List; ret.apply(config); diff --git a/doric-js/bundle/doric-sandbox.es5.js b/doric-js/bundle/doric-sandbox.es5.js index a910f970..1e1df100 100644 --- a/doric-js/bundle/doric-sandbox.es5.js +++ b/doric-js/bundle/doric-sandbox.es5.js @@ -18,7 +18,7 @@ var doric = (function (exports) { */ var __uniqueId__ = 0; function uniqueId(prefix) { - return "__" + prefix + "_" + __uniqueId__++ + "__"; + return "__".concat(prefix, "_").concat(__uniqueId__++, "__"); } function toString$2(message) { @@ -42,11 +42,6 @@ var doric = (function (exports) { } function log$9() { var arguments$1 = arguments; - - var args = []; - for (var _i = 0; _i < arguments.length; _i++) { - args[_i] = arguments$1[_i]; - } var out = ""; for (var i = 0; i < arguments.length; i++) { if (i > 0) { @@ -58,11 +53,6 @@ var doric = (function (exports) { } function loge() { var arguments$1 = arguments; - - var message = []; - for (var _i = 0; _i < arguments.length; _i++) { - message[_i] = arguments$1[_i]; - } var out = ""; for (var i = 0; i < arguments.length; i++) { if (i > 0) { @@ -74,11 +64,6 @@ var doric = (function (exports) { } function logw() { var arguments$1 = arguments; - - var message = []; - for (var _i = 0; _i < arguments.length; _i++) { - message[_i] = arguments$1[_i]; - } var out = ""; for (var i = 0; i < arguments.length; i++) { if (i > 0) { @@ -1269,12 +1254,12 @@ var doric = (function (exports) { var context = gContexts.get(contextId); if (context === undefined) { - loge("Cannot find context for context id:" + contextId); + loge("Cannot find context for context id:".concat(contextId)); return; } var callback = context.callbacks.get(callbackId); if (callback === undefined) { - loge("Cannot find call for context id:" + contextId + ",callback id:" + callbackId); + loge("Cannot find call for context id:".concat(contextId, ",callback id:").concat(callbackId)); return; } var argumentsList = []; @@ -1289,12 +1274,12 @@ var doric = (function (exports) { var context = gContexts.get(contextId); if (context === undefined) { - loge("Cannot find context for context id:" + contextId); + loge("Cannot find context for context id:".concat(contextId)); return; } var callback = context.callbacks.get(callbackId); if (callback === undefined) { - loge("Cannot find call for context id:" + contextId + ",callback id:" + callbackId); + loge("Cannot find call for context id:".concat(contextId, ",callback id:").concat(callbackId)); return; } var argumentsList = []; @@ -1402,11 +1387,11 @@ var doric = (function (exports) { var context = gContexts.get(contextId); if (context === undefined) { - loge("Cannot find context for context id:" + contextId); + loge("Cannot find context for context id:".concat(contextId)); return; } if (context.entity === undefined) { - loge("Cannot find holder for context id:" + contextId); + loge("Cannot find holder for context id:".concat(contextId)); return; } if (Reflect.has(context.entity, methodName)) { @@ -1419,7 +1404,7 @@ var doric = (function (exports) { return ret; } else { - loge("Cannot find method for context id:" + contextId + ",method name is:" + methodName); + loge("Cannot find method for context id:".concat(contextId, ",method name is:").concat(methodName)); } } function pureCallEntityMethod(contextId, methodName, args) { @@ -1427,11 +1412,11 @@ var doric = (function (exports) { var context = gContexts.get(contextId); if (context === undefined) { - loge("Cannot find context for context id:" + contextId); + loge("Cannot find context for context id:".concat(contextId)); return; } if (context.entity === undefined) { - loge("Cannot find holder for context id:" + contextId); + loge("Cannot find holder for context id:".concat(contextId)); return; } if (Reflect.has(context.entity, methodName)) { @@ -1442,7 +1427,7 @@ var doric = (function (exports) { return Reflect.apply(Reflect.get(context.entity, methodName), context.entity, argumentsList); } else { - loge("Cannot find method for context id:" + contextId + ",method name is:" + methodName); + loge("Cannot find method for context id:".concat(contextId, ",method name is:").concat(methodName)); } } function jsObtainEntry(contextId) { @@ -1481,15 +1466,15 @@ var doric = (function (exports) { return exportFunc(clz); } else { - throw new Error("Cannot find class:" + className + " in context:" + srcContextId); + throw new Error("Cannot find class:".concat(className, " in context:").concat(srcContextId)); } } else { - throw new Error("Cannot find context for " + srcContextId); + throw new Error("Cannot find context for ".concat(srcContextId)); } } else { - throw new Error("Entry arguments error:" + arguments); + throw new Error("Entry arguments error:".concat(arguments)); } }; } @@ -1608,7 +1593,7 @@ var doric = (function (exports) { // https://github.com/zloirock/core-js/issues/86#issuecomment-115759028 var global_1 = - // eslint-disable-next-line es/no-global-this -- safe + // eslint-disable-next-line es-x/no-global-this -- safe check(typeof globalThis == 'object' && globalThis) || check(typeof window == 'object' && window) || // eslint-disable-next-line no-restricted-globals -- safe @@ -1627,32 +1612,39 @@ var doric = (function (exports) { // Detect IE8's incomplete defineProperty implementation var descriptors = !fails(function () { - // eslint-disable-next-line es/no-object-defineproperty -- required for testing + // eslint-disable-next-line es-x/no-object-defineproperty -- required for testing return Object.defineProperty({}, 1, { get: function () { return 7; } })[1] != 7; }); + var functionBindNative = !fails(function () { + // eslint-disable-next-line es-x/no-function-prototype-bind -- safe + var test = (function () { /* empty */ }).bind(); + // eslint-disable-next-line no-prototype-builtins -- safe + return typeof test != 'function' || test.hasOwnProperty('prototype'); + }); + var call$2 = Function.prototype.call; - var functionCall = call$2.bind ? call$2.bind(call$2) : function () { + var functionCall = functionBindNative ? call$2.bind(call$2) : function () { return call$2.apply(call$2, arguments); }; var $propertyIsEnumerable$2 = {}.propertyIsEnumerable; - // eslint-disable-next-line es/no-object-getownpropertydescriptor -- safe - var getOwnPropertyDescriptor$8 = Object.getOwnPropertyDescriptor; + // eslint-disable-next-line es-x/no-object-getownpropertydescriptor -- safe + var getOwnPropertyDescriptor$a = Object.getOwnPropertyDescriptor; // Nashorn ~ JDK8 bug - var NASHORN_BUG = getOwnPropertyDescriptor$8 && !$propertyIsEnumerable$2.call({ 1: 2 }, 1); + var NASHORN_BUG = getOwnPropertyDescriptor$a && !$propertyIsEnumerable$2.call({ 1: 2 }, 1); // `Object.prototype.propertyIsEnumerable` method implementation // https://tc39.es/ecma262/#sec-object.prototype.propertyisenumerable - var f$7 = NASHORN_BUG ? function propertyIsEnumerable(V) { - var descriptor = getOwnPropertyDescriptor$8(this, V); + var f$8 = NASHORN_BUG ? function propertyIsEnumerable(V) { + var descriptor = getOwnPropertyDescriptor$a(this, V); return !!descriptor && descriptor.enumerable; } : $propertyIsEnumerable$2; var objectPropertyIsEnumerable = { - f: f$7 + f: f$8 }; var createPropertyDescriptor = function (bitmap, value) { @@ -1665,12 +1657,12 @@ var doric = (function (exports) { }; var FunctionPrototype$4 = Function.prototype; - var bind$3 = FunctionPrototype$4.bind; + var bind$2 = FunctionPrototype$4.bind; var call$1 = FunctionPrototype$4.call; - var callBind = bind$3 && bind$3.bind(call$1); + var uncurryThis = functionBindNative && bind$2.bind(call$1, call$1); - var functionUncurryThis = bind$3 ? function (fn) { - return fn && callBind(call$1, fn); + var functionUncurryThis = functionBindNative ? function (fn) { + return fn && uncurryThis(fn); } : function (fn) { return fn && function () { return call$1.apply(fn, arguments); @@ -1678,30 +1670,30 @@ var doric = (function (exports) { }; var toString$1 = functionUncurryThis({}.toString); - var stringSlice$g = functionUncurryThis(''.slice); + var stringSlice$h = functionUncurryThis(''.slice); var classofRaw = function (it) { - return stringSlice$g(toString$1(it), 8, -1); + return stringSlice$h(toString$1(it), 8, -1); }; - var Object$7 = global_1.Object; - var split$4 = functionUncurryThis(''.split); + var $Object$6 = Object; + var split$3 = functionUncurryThis(''.split); // fallback for non-array-like ES3 and non-enumerable old V8 strings var indexedObject = fails(function () { // throws an error in rhino, see https://github.com/mozilla/rhino/issues/346 // eslint-disable-next-line no-prototype-builtins -- safe - return !Object$7('z').propertyIsEnumerable(0); + return !$Object$6('z').propertyIsEnumerable(0); }) ? function (it) { - return classofRaw(it) == 'String' ? split$4(it, '') : Object$7(it); - } : Object$7; + return classofRaw(it) == 'String' ? split$3(it, '') : $Object$6(it); + } : $Object$6; - var TypeError$F = global_1.TypeError; + var $TypeError$z = TypeError; // `RequireObjectCoercible` abstract operation // https://tc39.es/ecma262/#sec-requireobjectcoercible var requireObjectCoercible = function (it) { - if (it == undefined) { throw TypeError$F("Can't call method on " + it); } + if (it == undefined) { throw $TypeError$z("Can't call method on " + it); } return it; }; @@ -1736,8 +1728,8 @@ var doric = (function (exports) { var engineUserAgent = getBuiltIn('navigator', 'userAgent') || ''; var process$5 = global_1.process; - var Deno = global_1.Deno; - var versions = process$5 && process$5.versions || Deno && Deno.version; + var Deno$1 = global_1.Deno; + var versions = process$5 && process$5.versions || Deno$1 && Deno$1.version; var v8 = versions && versions.v8; var match, version; @@ -1760,11 +1752,11 @@ var doric = (function (exports) { var engineV8Version = version; - /* eslint-disable es/no-symbol -- required for testing */ + /* eslint-disable es-x/no-symbol -- required for testing */ - // eslint-disable-next-line es/no-object-getownpropertysymbols -- required for testing + // eslint-disable-next-line es-x/no-object-getownpropertysymbols -- required for testing var nativeSymbol = !!Object.getOwnPropertySymbols && !fails(function () { var symbol = Symbol(); // Chrome 38 Symbol has incorrect toString conversion @@ -1774,38 +1766,38 @@ var doric = (function (exports) { !Symbol.sham && engineV8Version && engineV8Version < 41; }); - /* eslint-disable es/no-symbol -- required for testing */ + /* eslint-disable es-x/no-symbol -- required for testing */ var useSymbolAsUid = nativeSymbol && !Symbol.sham && typeof Symbol.iterator == 'symbol'; - var Object$6 = global_1.Object; + var $Object$5 = Object; var isSymbol = useSymbolAsUid ? function (it) { return typeof it == 'symbol'; } : function (it) { var $Symbol = getBuiltIn('Symbol'); - return isCallable($Symbol) && objectIsPrototypeOf($Symbol.prototype, Object$6(it)); + return isCallable($Symbol) && objectIsPrototypeOf($Symbol.prototype, $Object$5(it)); }; - var String$6 = global_1.String; + var $String$5 = String; var tryToString = function (argument) { try { - return String$6(argument); + return $String$5(argument); } catch (error) { return 'Object'; } }; - var TypeError$E = global_1.TypeError; + var $TypeError$y = TypeError; // `Assert: IsCallable(argument) is true` var aCallable = function (argument) { if (isCallable(argument)) { return argument; } - throw TypeError$E(tryToString(argument) + ' is not a function'); + throw $TypeError$y(tryToString(argument) + ' is not a function'); }; // `GetMethod` abstract operation @@ -1815,7 +1807,7 @@ var doric = (function (exports) { return func == null ? undefined : aCallable(func); }; - var TypeError$D = global_1.TypeError; + var $TypeError$x = TypeError; // `OrdinaryToPrimitive` abstract operation // https://tc39.es/ecma262/#sec-ordinarytoprimitive @@ -1824,15 +1816,15 @@ var doric = (function (exports) { if (pref === 'string' && isCallable(fn = input.toString) && !isObject(val = functionCall(fn, input))) { return val; } if (isCallable(fn = input.valueOf) && !isObject(val = functionCall(fn, input))) { return val; } if (pref !== 'string' && isCallable(fn = input.toString) && !isObject(val = functionCall(fn, input))) { return val; } - throw TypeError$D("Can't convert object to primitive value"); + throw $TypeError$x("Can't convert object to primitive value"); }; var isPure = false; - // eslint-disable-next-line es/no-object-defineproperty -- safe + // eslint-disable-next-line es-x/no-object-defineproperty -- safe var defineProperty$f = Object.defineProperty; - var setGlobal = function (key, value) { + var defineGlobalProperty = function (key, value) { try { defineProperty$f(global_1, key, { value: value, configurable: true, writable: true }); } catch (error) { @@ -1841,7 +1833,7 @@ var doric = (function (exports) { }; var SHARED = '__core-js_shared__'; - var store$3 = global_1[SHARED] || setGlobal(SHARED, {}); + var store$3 = global_1[SHARED] || defineGlobalProperty(SHARED, {}); var sharedStore = store$3; @@ -1849,24 +1841,27 @@ var doric = (function (exports) { (module.exports = function (key, value) { return sharedStore[key] || (sharedStore[key] = value !== undefined ? value : {}); })('versions', []).push({ - version: '3.19.0', + version: '3.23.1', mode: 'global', - copyright: '© 2021 Denis Pushkarev (zloirock.ru)' + copyright: '© 2014-2022 Denis Pushkarev (zloirock.ru)', + license: 'https://github.com/zloirock/core-js/blob/v3.23.1/LICENSE', + source: 'https://github.com/zloirock/core-js' }); }); - var Object$5 = global_1.Object; + var $Object$4 = Object; // `ToObject` abstract operation // https://tc39.es/ecma262/#sec-toobject var toObject = function (argument) { - return Object$5(requireObjectCoercible(argument)); + return $Object$4(requireObjectCoercible(argument)); }; var hasOwnProperty = functionUncurryThis({}.hasOwnProperty); // `HasOwnProperty` abstract operation // https://tc39.es/ecma262/#sec-hasownproperty + // eslint-disable-next-line es-x/no-object-hasown -- safe var hasOwnProperty_1 = Object.hasOwn || function hasOwn(it, key) { return hasOwnProperty(toObject(it), key); }; @@ -1897,20 +1892,20 @@ var doric = (function (exports) { } return WellKnownSymbolsStore$1[name]; }; - var TypeError$C = global_1.TypeError; - var TO_PRIMITIVE$2 = wellKnownSymbol('toPrimitive'); + var $TypeError$w = TypeError; + var TO_PRIMITIVE$1 = wellKnownSymbol('toPrimitive'); // `ToPrimitive` abstract operation // https://tc39.es/ecma262/#sec-toprimitive var toPrimitive = function (input, pref) { if (!isObject(input) || isSymbol(input)) { return input; } - var exoticToPrim = getMethod(input, TO_PRIMITIVE$2); + var exoticToPrim = getMethod(input, TO_PRIMITIVE$1); var result; if (exoticToPrim) { if (pref === undefined) { pref = 'default'; } result = functionCall(exoticToPrim, input, pref); if (!isObject(result) || isSymbol(result)) { return result; } - throw TypeError$C("Can't convert object to primitive value"); + throw $TypeError$w("Can't convert object to primitive value"); } if (pref === undefined) { pref = 'number'; } return ordinaryToPrimitive(input, pref); @@ -1931,61 +1926,91 @@ var doric = (function (exports) { return EXISTS$1 ? document$3.createElement(it) : {}; }; - // Thank's IE8 for his funny defineProperty + // Thanks to IE8 for its funny defineProperty var ie8DomDefine = !descriptors && !fails(function () { - // eslint-disable-next-line es/no-object-defineproperty -- requied for testing + // eslint-disable-next-line es-x/no-object-defineproperty -- required for testing return Object.defineProperty(documentCreateElement('div'), 'a', { get: function () { return 7; } }).a != 7; }); - // eslint-disable-next-line es/no-object-getownpropertydescriptor -- safe - var $getOwnPropertyDescriptor$1 = Object.getOwnPropertyDescriptor; + // eslint-disable-next-line es-x/no-object-getownpropertydescriptor -- safe + var $getOwnPropertyDescriptor$2 = Object.getOwnPropertyDescriptor; // `Object.getOwnPropertyDescriptor` method // https://tc39.es/ecma262/#sec-object.getownpropertydescriptor - var f$6 = descriptors ? $getOwnPropertyDescriptor$1 : function getOwnPropertyDescriptor(O, P) { + var f$7 = descriptors ? $getOwnPropertyDescriptor$2 : function getOwnPropertyDescriptor(O, P) { O = toIndexedObject(O); P = toPropertyKey(P); if (ie8DomDefine) { try { - return $getOwnPropertyDescriptor$1(O, P); + return $getOwnPropertyDescriptor$2(O, P); } catch (error) { /* empty */ } } if (hasOwnProperty_1(O, P)) { return createPropertyDescriptor(!functionCall(objectPropertyIsEnumerable.f, O, P), O[P]); } }; var objectGetOwnPropertyDescriptor = { - f: f$6 + f: f$7 }; - var String$5 = global_1.String; - var TypeError$B = global_1.TypeError; + // V8 ~ Chrome 36- + // https://bugs.chromium.org/p/v8/issues/detail?id=3334 + var v8PrototypeDefineBug = descriptors && fails(function () { + // eslint-disable-next-line es-x/no-object-defineproperty -- required for testing + return Object.defineProperty(function () { /* empty */ }, 'prototype', { + value: 42, + writable: false + }).prototype != 42; + }); + + var $String$4 = String; + var $TypeError$v = TypeError; // `Assert: Type(argument) is Object` var anObject = function (argument) { if (isObject(argument)) { return argument; } - throw TypeError$B(String$5(argument) + ' is not an object'); + throw $TypeError$v($String$4(argument) + ' is not an object'); }; - var TypeError$A = global_1.TypeError; - // eslint-disable-next-line es/no-object-defineproperty -- safe + var $TypeError$u = TypeError; + // eslint-disable-next-line es-x/no-object-defineproperty -- safe var $defineProperty$1 = Object.defineProperty; + // eslint-disable-next-line es-x/no-object-getownpropertydescriptor -- safe + var $getOwnPropertyDescriptor$1 = Object.getOwnPropertyDescriptor; + var ENUMERABLE = 'enumerable'; + var CONFIGURABLE$1 = 'configurable'; + var WRITABLE = 'writable'; // `Object.defineProperty` method // https://tc39.es/ecma262/#sec-object.defineproperty - var f$5 = descriptors ? $defineProperty$1 : function defineProperty(O, P, Attributes) { + var f$6 = descriptors ? v8PrototypeDefineBug ? function defineProperty(O, P, Attributes) { + anObject(O); + P = toPropertyKey(P); + anObject(Attributes); + if (typeof O === 'function' && P === 'prototype' && 'value' in Attributes && WRITABLE in Attributes && !Attributes[WRITABLE]) { + var current = $getOwnPropertyDescriptor$1(O, P); + if (current && current[WRITABLE]) { + O[P] = Attributes.value; + Attributes = { + configurable: CONFIGURABLE$1 in Attributes ? Attributes[CONFIGURABLE$1] : current[CONFIGURABLE$1], + enumerable: ENUMERABLE in Attributes ? Attributes[ENUMERABLE] : current[ENUMERABLE], + writable: false + }; + } + } return $defineProperty$1(O, P, Attributes); + } : $defineProperty$1 : function defineProperty(O, P, Attributes) { anObject(O); P = toPropertyKey(P); anObject(Attributes); if (ie8DomDefine) { try { return $defineProperty$1(O, P, Attributes); } catch (error) { /* empty */ } } - if ('get' in Attributes || 'set' in Attributes) { throw TypeError$A('Accessors not supported'); } + if ('get' in Attributes || 'set' in Attributes) { throw $TypeError$u('Accessors not supported'); } if ('value' in Attributes) { O[P] = Attributes.value; } return O; }; var objectDefineProperty = { - f: f$5 + f: f$6 }; var createNonEnumerableProperty = descriptors ? function (object, key, value) { @@ -1995,6 +2020,21 @@ var doric = (function (exports) { return object; }; + var FunctionPrototype$3 = Function.prototype; + // eslint-disable-next-line es-x/no-object-getownpropertydescriptor -- safe + var getDescriptor = descriptors && Object.getOwnPropertyDescriptor; + + var EXISTS = hasOwnProperty_1(FunctionPrototype$3, 'name'); + // additional protection from minified / mangled / dropped function names + var PROPER = EXISTS && (function something() { /* empty */ }).name === 'something'; + var CONFIGURABLE = EXISTS && (!descriptors || (descriptors && getDescriptor(FunctionPrototype$3, 'name').configurable)); + + var functionName = { + EXISTS: EXISTS, + PROPER: PROPER, + CONFIGURABLE: CONFIGURABLE + }; + var functionToString$1 = functionUncurryThis(Function.toString); // this helper broken in `core-js@3.4.1-3.4.4`, so we can't use `shared` helper @@ -2019,7 +2059,7 @@ var doric = (function (exports) { var hiddenKeys$1 = {}; var OBJECT_ALREADY_INITIALIZED = 'Object already initialized'; - var TypeError$z = global_1.TypeError; + var TypeError$8 = global_1.TypeError; var WeakMap$3 = global_1.WeakMap; var set$3, get$2, has; @@ -2027,11 +2067,11 @@ var doric = (function (exports) { return has(it) ? get$2(it) : set$3(it, {}); }; - var getterFor = function (TYPE) { + var getterFor$2 = function (TYPE) { return function (it) { var state; if (!isObject(it) || (state = get$2(it)).type !== TYPE) { - throw TypeError$z('Incompatible receiver, ' + TYPE + ' required'); + throw TypeError$8('Incompatible receiver, ' + TYPE + ' required'); } return state; }; }; @@ -2042,7 +2082,7 @@ var doric = (function (exports) { var wmhas = functionUncurryThis(store$2.has); var wmset = functionUncurryThis(store$2.set); set$3 = function (it, metadata) { - if (wmhas(store$2, it)) { throw new TypeError$z(OBJECT_ALREADY_INITIALIZED); } + if (wmhas(store$2, it)) { throw new TypeError$8(OBJECT_ALREADY_INITIALIZED); } metadata.facade = it; wmset(store$2, it, metadata); return metadata; @@ -2057,7 +2097,7 @@ var doric = (function (exports) { var STATE = sharedKey('state'); hiddenKeys$1[STATE] = true; set$3 = function (it, metadata) { - if (hasOwnProperty_1(it, STATE)) { throw new TypeError$z(OBJECT_ALREADY_INITIALIZED); } + if (hasOwnProperty_1(it, STATE)) { throw new TypeError$8(OBJECT_ALREADY_INITIALIZED); } metadata.facade = it; createNonEnumerableProperty(it, STATE, metadata); return metadata; @@ -2075,94 +2115,113 @@ var doric = (function (exports) { get: get$2, has: has, enforce: enforce, - getterFor: getterFor + getterFor: getterFor$2 }; - var FunctionPrototype$3 = Function.prototype; - // eslint-disable-next-line es/no-object-getownpropertydescriptor -- safe - var getDescriptor = descriptors && Object.getOwnPropertyDescriptor; - - var EXISTS = hasOwnProperty_1(FunctionPrototype$3, 'name'); - // additional protection from minified / mangled / dropped function names - var PROPER = EXISTS && (function something() { /* empty */ }).name === 'something'; - var CONFIGURABLE = EXISTS && (!descriptors || (descriptors && getDescriptor(FunctionPrototype$3, 'name').configurable)); - - var functionName = { - EXISTS: EXISTS, - PROPER: PROPER, - CONFIGURABLE: CONFIGURABLE - }; - - var redefine = createCommonjsModule(function (module) { + var makeBuiltIn_1 = createCommonjsModule(function (module) { var CONFIGURABLE_FUNCTION_NAME = functionName.CONFIGURABLE; - var getInternalState = internalState.get; + + var enforceInternalState = internalState.enforce; + var getInternalState = internalState.get; + // eslint-disable-next-line es-x/no-object-defineproperty -- safe + var defineProperty = Object.defineProperty; + + var CONFIGURABLE_LENGTH = descriptors && !fails(function () { + return defineProperty(function () { /* empty */ }, 'length', { value: 8 }).length !== 8; + }); + var TEMPLATE = String(String).split('String'); - (module.exports = function (O, key, value, options) { - var unsafe = options ? !!options.unsafe : false; - var simple = options ? !!options.enumerable : false; - var noTargetGet = options ? !!options.noTargetGet : false; - var name = options && options.name !== undefined ? options.name : key; - var state; - if (isCallable(value)) { - if (String(name).slice(0, 7) === 'Symbol(') { - name = '[' + String(name).replace(/^Symbol\(([^)]*)\)/, '$1') + ']'; - } - if (!hasOwnProperty_1(value, 'name') || (CONFIGURABLE_FUNCTION_NAME && value.name !== name)) { - createNonEnumerableProperty(value, 'name', name); - } - state = enforceInternalState(value); - if (!state.source) { - state.source = TEMPLATE.join(typeof name == 'string' ? name : ''); - } + var makeBuiltIn = module.exports = function (value, name, options) { + if (String(name).slice(0, 7) === 'Symbol(') { + name = '[' + String(name).replace(/^Symbol\(([^)]*)\)/, '$1') + ']'; } - if (O === global_1) { - if (simple) { O[key] = value; } - else { setGlobal(key, value); } - return; - } else if (!unsafe) { - delete O[key]; - } else if (!noTargetGet && O[key]) { - simple = true; + if (options && options.getter) { name = 'get ' + name; } + if (options && options.setter) { name = 'set ' + name; } + if (!hasOwnProperty_1(value, 'name') || (CONFIGURABLE_FUNCTION_NAME && value.name !== name)) { + defineProperty(value, 'name', { value: name, configurable: true }); } - if (simple) { O[key] = value; } - else { createNonEnumerableProperty(O, key, value); } + if (CONFIGURABLE_LENGTH && options && hasOwnProperty_1(options, 'arity') && value.length !== options.arity) { + defineProperty(value, 'length', { value: options.arity }); + } + try { + if (options && hasOwnProperty_1(options, 'constructor') && options.constructor) { + if (descriptors) { defineProperty(value, 'prototype', { writable: false }); } + // in V8 ~ Chrome 53, prototypes of some methods, like `Array.prototype.values`, are non-writable + } else if (value.prototype) { value.prototype = undefined; } + } catch (error) { /* empty */ } + var state = enforceInternalState(value); + if (!hasOwnProperty_1(state, 'source')) { + state.source = TEMPLATE.join(typeof name == 'string' ? name : ''); + } return value; + }; + // add fake Function#toString for correct work wrapped methods / constructors with methods like LoDash isNative - })(Function.prototype, 'toString', function toString() { + // eslint-disable-next-line no-extend-native -- required + Function.prototype.toString = makeBuiltIn(function toString() { return isCallable(this) && getInternalState(this).source || inspectSource(this); - }); + }, 'toString'); }); - var ceil$2 = Math.ceil; + var defineBuiltIn = function (O, key, value, options) { + if (!options) { options = {}; } + var simple = options.enumerable; + var name = options.name !== undefined ? options.name : key; + if (isCallable(value)) { makeBuiltIn_1(value, name, options); } + if (options.global) { + if (simple) { O[key] = value; } + else { defineGlobalProperty(key, value); } + } else { + if (!options.unsafe) { delete O[key]; } + else if (O[key]) { simple = true; } + if (simple) { O[key] = value; } + else { objectDefineProperty.f(O, key, { + value: value, + enumerable: false, + configurable: !options.nonConfigurable, + writable: !options.nonWritable + }); } + } return O; + }; + + var ceil$1 = Math.ceil; var floor$a = Math.floor; + // `Math.trunc` method + // https://tc39.es/ecma262/#sec-math.trunc + // eslint-disable-next-line es-x/no-math-trunc -- safe + var mathTrunc = Math.trunc || function trunc(x) { + var n = +x; + return (n > 0 ? floor$a : ceil$1)(n); + }; + // `ToIntegerOrInfinity` abstract operation // https://tc39.es/ecma262/#sec-tointegerorinfinity var toIntegerOrInfinity = function (argument) { var number = +argument; - // eslint-disable-next-line no-self-compare -- safe - return number !== number || number === 0 ? 0 : (number > 0 ? floor$a : ceil$2)(number); + // eslint-disable-next-line no-self-compare -- NaN check + return number !== number || number === 0 ? 0 : mathTrunc(number); }; - var max$6 = Math.max; - var min$a = Math.min; + var max$8 = Math.max; + var min$b = Math.min; // Helper for a popular repeating case of the spec: // Let integer be ? ToInteger(index). // If integer < 0, let result be max((length + integer), 0); else let result be min(integer, length). var toAbsoluteIndex = function (index, length) { var integer = toIntegerOrInfinity(index); - return integer < 0 ? max$6(integer + length, 0) : min$a(integer, length); + return integer < 0 ? max$8(integer + length, 0) : min$b(integer, length); }; - var min$9 = Math.min; + var min$a = Math.min; // `ToLength` abstract operation // https://tc39.es/ecma262/#sec-tolength var toLength = function (argument) { - return argument > 0 ? min$9(toIntegerOrInfinity(argument), 0x1FFFFFFFFFFFFF) : 0; // 2 ** 53 - 1 == 9007199254740991 + return argument > 0 ? min$a(toIntegerOrInfinity(argument), 0x1FFFFFFFFFFFFF) : 0; // 2 ** 53 - 1 == 9007199254740991 }; // `LengthOfArrayLike` abstract operation @@ -2203,17 +2262,17 @@ var doric = (function (exports) { var indexOf$2 = arrayIncludes.indexOf; - var push$j = functionUncurryThis([].push); + var push$m = functionUncurryThis([].push); var objectKeysInternal = function (object, names) { var O = toIndexedObject(object); var i = 0; var result = []; var key; - for (key in O) { !hasOwnProperty_1(hiddenKeys$1, key) && hasOwnProperty_1(O, key) && push$j(result, key); } + for (key in O) { !hasOwnProperty_1(hiddenKeys$1, key) && hasOwnProperty_1(O, key) && push$m(result, key); } // Don't enum bug & hidden keys while (names.length > i) { if (hasOwnProperty_1(O, key = names[i++])) { - ~indexOf$2(result, key) || push$j(result, key); + ~indexOf$2(result, key) || push$m(result, key); } } return result; }; @@ -2233,20 +2292,20 @@ var doric = (function (exports) { // `Object.getOwnPropertyNames` method // https://tc39.es/ecma262/#sec-object.getownpropertynames - // eslint-disable-next-line es/no-object-getownpropertynames -- safe - var f$4 = Object.getOwnPropertyNames || function getOwnPropertyNames(O) { + // eslint-disable-next-line es-x/no-object-getownpropertynames -- safe + var f$5 = Object.getOwnPropertyNames || function getOwnPropertyNames(O) { return objectKeysInternal(O, hiddenKeys); }; var objectGetOwnPropertyNames = { - f: f$4 + f: f$5 }; - // eslint-disable-next-line es/no-object-getownpropertysymbols -- safe - var f$3 = Object.getOwnPropertySymbols; + // eslint-disable-next-line es-x/no-object-getownpropertysymbols -- safe + var f$4 = Object.getOwnPropertySymbols; var objectGetOwnPropertySymbols = { - f: f$3 + f: f$4 }; var concat$4 = functionUncurryThis([].concat); @@ -2258,13 +2317,15 @@ var doric = (function (exports) { return getOwnPropertySymbols ? concat$4(keys, getOwnPropertySymbols(it)) : keys; }; - var copyConstructorProperties = function (target, source) { + var copyConstructorProperties = function (target, source, exceptions) { var keys = ownKeys(source); var defineProperty = objectDefineProperty.f; var getOwnPropertyDescriptor = objectGetOwnPropertyDescriptor.f; for (var i = 0; i < keys.length; i++) { var key = keys[i]; - if (!hasOwnProperty_1(target, key)) { defineProperty(target, key, getOwnPropertyDescriptor(source, key)); } + if (!hasOwnProperty_1(target, key) && !(exceptions && hasOwnProperty_1(exceptions, key))) { + defineProperty(target, key, getOwnPropertyDescriptor(source, key)); + } } }; @@ -2288,7 +2349,7 @@ var doric = (function (exports) { var isForced_1 = isForced; - var getOwnPropertyDescriptor$7 = objectGetOwnPropertyDescriptor.f; + var getOwnPropertyDescriptor$9 = objectGetOwnPropertyDescriptor.f; @@ -2296,19 +2357,19 @@ var doric = (function (exports) { /* - options.target - name of the target object - options.global - target is the global object - options.stat - export as static methods of target - options.proto - export as prototype methods of target - options.real - real prototype method for the `pure` version - options.forced - export even if the native feature is available - options.bind - bind methods to the target, required for the `pure` version - options.wrap - wrap constructors to preventing global pollution, required for the `pure` version - options.unsafe - use the simple assignment of property instead of delete + defineProperty - options.sham - add a flag to not completely full polyfills - options.enumerable - export as enumerable property - options.noTargetGet - prevent calling a getter on target - options.name - the .name of the function if it does not match the key + options.target - name of the target object + options.global - target is the global object + options.stat - export as static methods of target + options.proto - export as prototype methods of target + options.real - real prototype method for the `pure` version + options.forced - export even if the native feature is available + options.bind - bind methods to the target, required for the `pure` version + options.wrap - wrap constructors to preventing global pollution, required for the `pure` version + options.unsafe - use the simple assignment of property instead of delete + defineProperty + options.sham - add a flag to not completely full polyfills + options.enumerable - export as enumerable property + options.dontCallGetSet - prevent calling a getter on target + options.name - the .name of the function if it does not match the key */ var _export = function (options, source) { var TARGET = options.target; @@ -2318,14 +2379,14 @@ var doric = (function (exports) { if (GLOBAL) { target = global_1; } else if (STATIC) { - target = global_1[TARGET] || setGlobal(TARGET, {}); + target = global_1[TARGET] || defineGlobalProperty(TARGET, {}); } else { target = (global_1[TARGET] || {}).prototype; } if (target) { for (key in source) { sourceProperty = source[key]; - if (options.noTargetGet) { - descriptor = getOwnPropertyDescriptor$7(target, key); + if (options.dontCallGetSet) { + descriptor = getOwnPropertyDescriptor$9(target, key); targetProperty = descriptor && descriptor.value; } else { targetProperty = target[key]; } FORCED = isForced_1(GLOBAL ? key : TARGET + (STATIC ? '.' : '#') + key, options.forced); @@ -2338,37 +2399,19 @@ var doric = (function (exports) { if (options.sham || (targetProperty && targetProperty.sham)) { createNonEnumerableProperty(sourceProperty, 'sham', true); } - // extend global - redefine(target, key, sourceProperty, options); + defineBuiltIn(target, key, sourceProperty, options); } } }; - var FunctionPrototype$2 = Function.prototype; - var apply = FunctionPrototype$2.apply; - var bind$2 = FunctionPrototype$2.bind; - var call = FunctionPrototype$2.call; - - // eslint-disable-next-line es/no-reflect -- safe - var functionApply = typeof Reflect == 'object' && Reflect.apply || (bind$2 ? call.bind(apply) : function () { - return call.apply(apply, arguments); - }); - - // `IsArray` abstract operation - // https://tc39.es/ecma262/#sec-isarray - // eslint-disable-next-line es/no-array-isarray -- safe - var isArray = Array.isArray || function isArray(argument) { - return classofRaw(argument) == 'Array'; - }; - - var TO_STRING_TAG$8 = wellKnownSymbol('toStringTag'); + var TO_STRING_TAG$9 = wellKnownSymbol('toStringTag'); var test$2 = {}; - test$2[TO_STRING_TAG$8] = 'z'; + test$2[TO_STRING_TAG$9] = 'z'; var toStringTagSupport = String(test$2) === '[object z]'; - var TO_STRING_TAG$7 = wellKnownSymbol('toStringTag'); - var Object$4 = global_1.Object; + var TO_STRING_TAG$8 = wellKnownSymbol('toStringTag'); + var $Object$3 = Object; // ES3 wrong here var CORRECT_ARGUMENTS = classofRaw(function () { return arguments; }()) == 'Arguments'; @@ -2385,34 +2428,34 @@ var doric = (function (exports) { var O, tag, result; return it === undefined ? 'Undefined' : it === null ? 'Null' // @@toStringTag case - : typeof (tag = tryGet(O = Object$4(it), TO_STRING_TAG$7)) == 'string' ? tag + : typeof (tag = tryGet(O = $Object$3(it), TO_STRING_TAG$8)) == 'string' ? tag // builtinTag case : CORRECT_ARGUMENTS ? classofRaw(O) // ES3 arguments fallback : (result = classofRaw(O)) == 'Object' && isCallable(O.callee) ? 'Arguments' : result; }; - var String$4 = global_1.String; + var $String$3 = String; var toString_1 = function (argument) { if (classof(argument) === 'Symbol') { throw TypeError('Cannot convert a Symbol value to a string'); } - return String$4(argument); + return $String$3(argument); }; // `Object.keys` method // https://tc39.es/ecma262/#sec-object.keys - // eslint-disable-next-line es/no-object-keys -- safe - var objectKeys = Object.keys || function keys(O) { + // eslint-disable-next-line es-x/no-object-keys -- safe + var objectKeys$1 = Object.keys || function keys(O) { return objectKeysInternal(O, enumBugKeys); }; // `Object.defineProperties` method // https://tc39.es/ecma262/#sec-object.defineproperties - // eslint-disable-next-line es/no-object-defineproperties -- safe - var objectDefineProperties = descriptors ? Object.defineProperties : function defineProperties(O, Properties) { + // eslint-disable-next-line es-x/no-object-defineproperties -- safe + var f$3 = descriptors && !v8PrototypeDefineBug ? Object.defineProperties : function defineProperties(O, Properties) { anObject(O); var props = toIndexedObject(Properties); - var keys = objectKeys(Properties); + var keys = objectKeys$1(Properties); var length = keys.length; var index = 0; var key; @@ -2420,6 +2463,10 @@ var doric = (function (exports) { return O; }; + var objectDefineProperties = { + f: f$3 + }; + var html = getBuiltIn('document', 'documentElement'); /* global ActiveXObject -- old IE, WSH */ @@ -2493,6 +2540,7 @@ var doric = (function (exports) { // `Object.create` method // https://tc39.es/ecma262/#sec-object.create + // eslint-disable-next-line es-x/no-object-create -- safe var objectCreate = Object.create || function create(O, Properties) { var result; if (O !== null) { @@ -2502,12 +2550,29 @@ var doric = (function (exports) { // add "__proto__" for Object.getPrototypeOf polyfill result[IE_PROTO$1] = O; } else { result = NullProtoObject(); } - return Properties === undefined ? result : objectDefineProperties(result, Properties); + return Properties === undefined ? result : objectDefineProperties.f(result, Properties); }; - var arraySlice$1 = functionUncurryThis([].slice); + var createProperty = function (object, key, value) { + var propertyKey = toPropertyKey(key); + if (propertyKey in object) { objectDefineProperty.f(object, propertyKey, createPropertyDescriptor(0, value)); } + else { object[propertyKey] = value; } + }; - /* eslint-disable es/no-object-getownpropertynames -- safe */ + var $Array$a = Array; + var max$7 = Math.max; + + var arraySliceSimple = function (O, start, end) { + var length = lengthOfArrayLike(O); + var k = toAbsoluteIndex(start, length); + var fin = toAbsoluteIndex(end === undefined ? length : end, length); + var result = $Array$a(max$7(fin - k, 0)); + for (var n = 0; k < fin; k++, n++) { createProperty(result, n, O[k]); } + result.length = n; + return result; + }; + + /* eslint-disable es-x/no-object-getownpropertynames -- safe */ var $getOwnPropertyNames$1 = objectGetOwnPropertyNames.f; @@ -2520,7 +2585,7 @@ var doric = (function (exports) { try { return $getOwnPropertyNames$1(it); } catch (error) { - return arraySlice$1(windowNames); + return arraySliceSimple(windowNames); } }; @@ -2552,15 +2617,32 @@ var doric = (function (exports) { }); } }; + var symbolDefineToPrimitive = function () { + var Symbol = getBuiltIn('Symbol'); + var SymbolPrototype = Symbol && Symbol.prototype; + var valueOf = SymbolPrototype && SymbolPrototype.valueOf; + var TO_PRIMITIVE = wellKnownSymbol('toPrimitive'); + + if (SymbolPrototype && !SymbolPrototype[TO_PRIMITIVE]) { + // `Symbol.prototype[@@toPrimitive]` method + // https://tc39.es/ecma262/#sec-symbol.prototype-@@toprimitive + // eslint-disable-next-line no-unused-vars -- required for .length + defineBuiltIn(SymbolPrototype, TO_PRIMITIVE, function (hint) { + return functionCall(valueOf, this); + }, { arity: 1 }); + } + }; + var defineProperty$d = objectDefineProperty.f; - var TO_STRING_TAG$6 = wellKnownSymbol('toStringTag'); + var TO_STRING_TAG$7 = wellKnownSymbol('toStringTag'); - var setToStringTag = function (it, TAG, STATIC) { - if (it && !hasOwnProperty_1(it = STATIC ? it : it.prototype, TO_STRING_TAG$6)) { - defineProperty$d(it, TO_STRING_TAG$6, { configurable: true, value: TAG }); + var setToStringTag = function (target, TAG, STATIC) { + if (target && !STATIC) { target = target.prototype; } + if (target && !hasOwnProperty_1(target, TO_STRING_TAG$7)) { + defineProperty$d(target, TO_STRING_TAG$7, { configurable: true, value: TAG }); } }; @@ -2569,19 +2651,26 @@ var doric = (function (exports) { // optional / simple context binding var functionBindContext = function (fn, that) { aCallable(fn); - return that === undefined ? fn : bind$1 ? bind$1(fn, that) : function (/* ...args */) { + return that === undefined ? fn : functionBindNative ? bind$1(fn, that) : function (/* ...args */) { return fn.apply(that, arguments); }; }; + // `IsArray` abstract operation + // https://tc39.es/ecma262/#sec-isarray + // eslint-disable-next-line es-x/no-array-isarray -- safe + var isArray = Array.isArray || function isArray(argument) { + return classofRaw(argument) == 'Array'; + }; + var noop = function () { /* empty */ }; var empty = []; var construct$1 = getBuiltIn('Reflect', 'construct'); var constructorRegExp = /^\s*(?:class|function)\b/; - var exec$9 = functionUncurryThis(constructorRegExp.exec); - var INCORRECT_TO_STRING = !constructorRegExp.exec(noop); + var exec$b = functionUncurryThis(constructorRegExp.exec); + var INCORRECT_TO_STRING$2 = !constructorRegExp.exec(noop); - var isConstructorModern = function (argument) { + var isConstructorModern = function isConstructor(argument) { if (!isCallable(argument)) { return false; } try { construct$1(noop, empty, argument); @@ -2591,16 +2680,25 @@ var doric = (function (exports) { } }; - var isConstructorLegacy = function (argument) { + var isConstructorLegacy = function isConstructor(argument) { if (!isCallable(argument)) { return false; } switch (classof(argument)) { case 'AsyncFunction': case 'GeneratorFunction': case 'AsyncGeneratorFunction': return false; + } + try { // we can't check .prototype since constructors produced by .bind haven't it - } return INCORRECT_TO_STRING || !!exec$9(constructorRegExp, inspectSource(argument)); + // `Function#toString` throws on some built-it function in some legacy engines + // (for example, `DOMQuad` and similar in FF41-) + return INCORRECT_TO_STRING$2 || !!exec$b(constructorRegExp, inspectSource(argument)); + } catch (error) { + return true; + } }; + isConstructorLegacy.sham = true; + // `IsConstructor` abstract operation // https://tc39.es/ecma262/#sec-isconstructor var isConstructor = !construct$1 || fails(function () { @@ -2612,7 +2710,7 @@ var doric = (function (exports) { }) ? isConstructorLegacy : isConstructorModern; var SPECIES$6 = wellKnownSymbol('species'); - var Array$a = global_1.Array; + var $Array$9 = Array; // a part of `ArraySpeciesCreate` abstract operation // https://tc39.es/ecma262/#sec-arrayspeciescreate @@ -2621,12 +2719,12 @@ var doric = (function (exports) { if (isArray(originalArray)) { C = originalArray.constructor; // cross-realm fallback - if (isConstructor(C) && (C === Array$a || isArray(C.prototype))) { C = undefined; } + if (isConstructor(C) && (C === $Array$9 || isArray(C.prototype))) { C = undefined; } else if (isObject(C)) { C = C[SPECIES$6]; if (C === null) { C = undefined; } } - } return C === undefined ? Array$a : C; + } return C === undefined ? $Array$9 : C; }; // `ArraySpeciesCreate` abstract operation @@ -2635,7 +2733,7 @@ var doric = (function (exports) { return new (arraySpeciesConstructor(originalArray))(length === 0 ? 0 : length); }; - var push$i = functionUncurryThis([].push); + var push$l = functionUncurryThis([].push); // `Array.prototype.{ forEach, map, filter, some, every, find, findIndex, filterReject }` methods implementation var createMethod$7 = function (TYPE) { @@ -2664,10 +2762,10 @@ var doric = (function (exports) { case 3: return true; // some case 5: return value; // find case 6: return index; // findIndex - case 2: push$i(target, value); // filter + case 2: push$l(target, value); // filter } } else { switch (TYPE) { case 4: return false; // every - case 7: push$i(target, value); // filterReject + case 7: push$l(target, value); // filterReject } } } } } @@ -2707,27 +2805,23 @@ var doric = (function (exports) { var HIDDEN = sharedKey('hidden'); var SYMBOL = 'Symbol'; var PROTOTYPE$1 = 'prototype'; - var TO_PRIMITIVE$1 = wellKnownSymbol('toPrimitive'); - var setInternalState$h = internalState.set; - var getInternalState$g = internalState.getterFor(SYMBOL); + var setInternalState$i = internalState.set; + var getInternalState$f = internalState.getterFor(SYMBOL); var ObjectPrototype$4 = Object[PROTOTYPE$1]; var $Symbol = global_1.Symbol; var SymbolPrototype$1 = $Symbol && $Symbol[PROTOTYPE$1]; - var TypeError$y = global_1.TypeError; + var TypeError$7 = global_1.TypeError; var QObject = global_1.QObject; - var $stringify$1 = getBuiltIn('JSON', 'stringify'); var nativeGetOwnPropertyDescriptor$1 = objectGetOwnPropertyDescriptor.f; var nativeDefineProperty = objectDefineProperty.f; var nativeGetOwnPropertyNames = objectGetOwnPropertyNamesExternal.f; var nativePropertyIsEnumerable = objectPropertyIsEnumerable.f; - var push$h = functionUncurryThis([].push); + var push$k = functionUncurryThis([].push); var AllSymbols = shared('symbols'); var ObjectPrototypeSymbols = shared('op-symbols'); - var StringToSymbolRegistry = shared('string-to-symbol-registry'); - var SymbolToStringRegistry = shared('symbol-to-string-registry'); var WellKnownSymbolsStore = shared('wks'); // Don't use setters in Qt Script, https://github.com/zloirock/core-js/issues/173 @@ -2749,7 +2843,7 @@ var doric = (function (exports) { var wrap$1 = function (tag, description) { var symbol = AllSymbols[tag] = objectCreate(SymbolPrototype$1); - setInternalState$h(symbol, { + setInternalState$i(symbol, { type: SYMBOL, tag: tag, description: description @@ -2777,7 +2871,7 @@ var doric = (function (exports) { var $defineProperties = function defineProperties(O, Properties) { anObject(O); var properties = toIndexedObject(Properties); - var keys = objectKeys(properties).concat($getOwnPropertySymbols(properties)); + var keys = objectKeys$1(properties).concat($getOwnPropertySymbols(properties)); $forEach$3(keys, function (key) { if (!descriptors || functionCall($propertyIsEnumerable$1, properties, key)) { $defineProperty(O, key, properties[key]); } }); @@ -2811,18 +2905,18 @@ var doric = (function (exports) { var names = nativeGetOwnPropertyNames(toIndexedObject(O)); var result = []; $forEach$3(names, function (key) { - if (!hasOwnProperty_1(AllSymbols, key) && !hasOwnProperty_1(hiddenKeys$1, key)) { push$h(result, key); } + if (!hasOwnProperty_1(AllSymbols, key) && !hasOwnProperty_1(hiddenKeys$1, key)) { push$k(result, key); } }); return result; }; - var $getOwnPropertySymbols = function getOwnPropertySymbols(O) { + var $getOwnPropertySymbols = function (O) { var IS_OBJECT_PROTOTYPE = O === ObjectPrototype$4; var names = nativeGetOwnPropertyNames(IS_OBJECT_PROTOTYPE ? ObjectPrototypeSymbols : toIndexedObject(O)); var result = []; $forEach$3(names, function (key) { if (hasOwnProperty_1(AllSymbols, key) && (!IS_OBJECT_PROTOTYPE || hasOwnProperty_1(ObjectPrototype$4, key))) { - push$h(result, AllSymbols[key]); + push$k(result, AllSymbols[key]); } }); return result; @@ -2832,7 +2926,7 @@ var doric = (function (exports) { // https://tc39.es/ecma262/#sec-symbol-constructor if (!nativeSymbol) { $Symbol = function Symbol() { - if (objectIsPrototypeOf(SymbolPrototype$1, this)) { throw TypeError$y('Symbol is not a constructor'); } + if (objectIsPrototypeOf(SymbolPrototype$1, this)) { throw TypeError$7('Symbol is not a constructor'); } var description = !arguments.length || arguments[0] === undefined ? undefined : toString_1(arguments[0]); var tag = uid(description); var setter = function (value) { @@ -2846,16 +2940,17 @@ var doric = (function (exports) { SymbolPrototype$1 = $Symbol[PROTOTYPE$1]; - redefine(SymbolPrototype$1, 'toString', function toString() { - return getInternalState$g(this).tag; + defineBuiltIn(SymbolPrototype$1, 'toString', function toString() { + return getInternalState$f(this).tag; }); - redefine($Symbol, 'withoutSetter', function (description) { + defineBuiltIn($Symbol, 'withoutSetter', function (description) { return wrap$1(uid(description), description); }); objectPropertyIsEnumerable.f = $propertyIsEnumerable$1; objectDefineProperty.f = $defineProperty; + objectDefineProperties.f = $defineProperties; objectGetOwnPropertyDescriptor.f = $getOwnPropertyDescriptor; objectGetOwnPropertyNames.f = objectGetOwnPropertyNamesExternal.f = $getOwnPropertyNames; objectGetOwnPropertySymbols.f = $getOwnPropertySymbols; @@ -2869,40 +2964,24 @@ var doric = (function (exports) { nativeDefineProperty(SymbolPrototype$1, 'description', { configurable: true, get: function description() { - return getInternalState$g(this).description; + return getInternalState$f(this).description; } }); { - redefine(ObjectPrototype$4, 'propertyIsEnumerable', $propertyIsEnumerable$1, { unsafe: true }); + defineBuiltIn(ObjectPrototype$4, 'propertyIsEnumerable', $propertyIsEnumerable$1, { unsafe: true }); } } } - _export({ global: true, wrap: true, forced: !nativeSymbol, sham: !nativeSymbol }, { + _export({ global: true, constructor: true, wrap: true, forced: !nativeSymbol, sham: !nativeSymbol }, { Symbol: $Symbol }); - $forEach$3(objectKeys(WellKnownSymbolsStore), function (name) { + $forEach$3(objectKeys$1(WellKnownSymbolsStore), function (name) { defineWellKnownSymbol(name); }); _export({ target: SYMBOL, stat: true, forced: !nativeSymbol }, { - // `Symbol.for` method - // https://tc39.es/ecma262/#sec-symbol.for - 'for': function (key) { - var string = toString_1(key); - if (hasOwnProperty_1(StringToSymbolRegistry, string)) { return StringToSymbolRegistry[string]; } - var symbol = $Symbol(string); - StringToSymbolRegistry[string] = symbol; - SymbolToStringRegistry[symbol] = string; - return symbol; - }, - // `Symbol.keyFor` method - // https://tc39.es/ecma262/#sec-symbol.keyfor - keyFor: function keyFor(sym) { - if (!isSymbol(sym)) { throw TypeError$y(sym + ' is not a symbol'); } - if (hasOwnProperty_1(SymbolToStringRegistry, sym)) { return SymbolToStringRegistry[sym]; } - }, useSetter: function () { USE_SETTER = true; }, useSimple: function () { USE_SETTER = false; } }); @@ -2925,65 +3004,133 @@ var doric = (function (exports) { _export({ target: 'Object', stat: true, forced: !nativeSymbol }, { // `Object.getOwnPropertyNames` method // https://tc39.es/ecma262/#sec-object.getownpropertynames - getOwnPropertyNames: $getOwnPropertyNames, - // `Object.getOwnPropertySymbols` method - // https://tc39.es/ecma262/#sec-object.getownpropertysymbols - getOwnPropertySymbols: $getOwnPropertySymbols + getOwnPropertyNames: $getOwnPropertyNames }); - // Chrome 38 and 39 `Object.getOwnPropertySymbols` fails on primitives - // https://bugs.chromium.org/p/v8/issues/detail?id=3443 - _export({ target: 'Object', stat: true, forced: fails(function () { objectGetOwnPropertySymbols.f(1); }) }, { - getOwnPropertySymbols: function getOwnPropertySymbols(it) { - return objectGetOwnPropertySymbols.f(toObject(it)); - } - }); - - // `JSON.stringify` method behavior with symbols - // https://tc39.es/ecma262/#sec-json.stringify - if ($stringify$1) { - var FORCED_JSON_STRINGIFY = !nativeSymbol || fails(function () { - var symbol = $Symbol(); - // MS Edge converts symbol values to JSON as {} - return $stringify$1([symbol]) != '[null]' - // WebKit converts symbol values to JSON as null - || $stringify$1({ a: symbol }) != '{}' - // V8 throws on boxed symbols - || $stringify$1(Object(symbol)) != '{}'; - }); - - _export({ target: 'JSON', stat: true, forced: FORCED_JSON_STRINGIFY }, { - // eslint-disable-next-line no-unused-vars -- required for `.length` - stringify: function stringify(it, replacer, space) { - var args = arraySlice$1(arguments); - var $replacer = replacer; - if (!isObject(replacer) && it === undefined || isSymbol(it)) { return; } // IE8 returns string on undefined - if (!isArray(replacer)) { replacer = function (key, value) { - if (isCallable($replacer)) { value = functionCall($replacer, this, key, value); } - if (!isSymbol(value)) { return value; } - }; } - args[1] = replacer; - return functionApply($stringify$1, null, args); - } - }); - } - // `Symbol.prototype[@@toPrimitive]` method // https://tc39.es/ecma262/#sec-symbol.prototype-@@toprimitive - if (!SymbolPrototype$1[TO_PRIMITIVE$1]) { - var valueOf = SymbolPrototype$1.valueOf; - // eslint-disable-next-line no-unused-vars -- required for .length - redefine(SymbolPrototype$1, TO_PRIMITIVE$1, function (hint) { - // TODO: improve hint logic - return functionCall(valueOf, this); - }); - } + symbolDefineToPrimitive(); + // `Symbol.prototype[@@toStringTag]` property // https://tc39.es/ecma262/#sec-symbol.prototype-@@tostringtag setToStringTag($Symbol, SYMBOL); hiddenKeys$1[HIDDEN] = true; + /* eslint-disable es-x/no-symbol -- safe */ + var nativeSymbolRegistry = nativeSymbol && !!Symbol['for'] && !!Symbol.keyFor; + + var StringToSymbolRegistry = shared('string-to-symbol-registry'); + var SymbolToStringRegistry$1 = shared('symbol-to-string-registry'); + + // `Symbol.for` method + // https://tc39.es/ecma262/#sec-symbol.for + _export({ target: 'Symbol', stat: true, forced: !nativeSymbolRegistry }, { + 'for': function (key) { + var string = toString_1(key); + if (hasOwnProperty_1(StringToSymbolRegistry, string)) { return StringToSymbolRegistry[string]; } + var symbol = getBuiltIn('Symbol')(string); + StringToSymbolRegistry[string] = symbol; + SymbolToStringRegistry$1[symbol] = string; + return symbol; + } + }); + + var SymbolToStringRegistry = shared('symbol-to-string-registry'); + + // `Symbol.keyFor` method + // https://tc39.es/ecma262/#sec-symbol.keyfor + _export({ target: 'Symbol', stat: true, forced: !nativeSymbolRegistry }, { + keyFor: function keyFor(sym) { + if (!isSymbol(sym)) { throw TypeError(tryToString(sym) + ' is not a symbol'); } + if (hasOwnProperty_1(SymbolToStringRegistry, sym)) { return SymbolToStringRegistry[sym]; } + } + }); + + var FunctionPrototype$2 = Function.prototype; + var apply = FunctionPrototype$2.apply; + var call = FunctionPrototype$2.call; + + // eslint-disable-next-line es-x/no-reflect -- safe + var functionApply = typeof Reflect == 'object' && Reflect.apply || (functionBindNative ? call.bind(apply) : function () { + return call.apply(apply, arguments); + }); + + var arraySlice$1 = functionUncurryThis([].slice); + + var $stringify = getBuiltIn('JSON', 'stringify'); + var exec$a = functionUncurryThis(/./.exec); + var charAt$h = functionUncurryThis(''.charAt); + var charCodeAt$5 = functionUncurryThis(''.charCodeAt); + var replace$b = functionUncurryThis(''.replace); + var numberToString$3 = functionUncurryThis(1.0.toString); + + var tester = /[\uD800-\uDFFF]/g; + var low = /^[\uD800-\uDBFF]$/; + var hi = /^[\uDC00-\uDFFF]$/; + + var WRONG_SYMBOLS_CONVERSION = !nativeSymbol || fails(function () { + var symbol = getBuiltIn('Symbol')(); + // MS Edge converts symbol values to JSON as {} + return $stringify([symbol]) != '[null]' + // WebKit converts symbol values to JSON as null + || $stringify({ a: symbol }) != '{}' + // V8 throws on boxed symbols + || $stringify(Object(symbol)) != '{}'; + }); + + // https://github.com/tc39/proposal-well-formed-stringify + var ILL_FORMED_UNICODE = fails(function () { + return $stringify('\uDF06\uD834') !== '"\\udf06\\ud834"' + || $stringify('\uDEAD') !== '"\\udead"'; + }); + + var stringifyWithSymbolsFix = function (it, replacer) { + var args = arraySlice$1(arguments); + var $replacer = replacer; + if (!isObject(replacer) && it === undefined || isSymbol(it)) { return; } // IE8 returns string on undefined + if (!isArray(replacer)) { replacer = function (key, value) { + if (isCallable($replacer)) { value = functionCall($replacer, this, key, value); } + if (!isSymbol(value)) { return value; } + }; } + args[1] = replacer; + return functionApply($stringify, null, args); + }; + + var fixIllFormed = function (match, offset, string) { + var prev = charAt$h(string, offset - 1); + var next = charAt$h(string, offset + 1); + if ((exec$a(low, match) && !exec$a(hi, next)) || (exec$a(hi, match) && !exec$a(low, prev))) { + return '\\u' + numberToString$3(charCodeAt$5(match, 0), 16); + } return match; + }; + + if ($stringify) { + // `JSON.stringify` method + // https://tc39.es/ecma262/#sec-json.stringify + _export({ target: 'JSON', stat: true, arity: 3, forced: WRONG_SYMBOLS_CONVERSION || ILL_FORMED_UNICODE }, { + // eslint-disable-next-line no-unused-vars -- required for `.length` + stringify: function stringify(it, replacer, space) { + var args = arraySlice$1(arguments); + var result = functionApply(WRONG_SYMBOLS_CONVERSION ? stringifyWithSymbolsFix : $stringify, null, args); + return ILL_FORMED_UNICODE && typeof result == 'string' ? replace$b(result, tester, fixIllFormed) : result; + } + }); + } + + // V8 ~ Chrome 38 and 39 `Object.getOwnPropertySymbols` fails on primitives + // https://bugs.chromium.org/p/v8/issues/detail?id=3443 + var FORCED$n = !nativeSymbol || fails(function () { objectGetOwnPropertySymbols.f(1); }); + + // `Object.getOwnPropertySymbols` method + // https://tc39.es/ecma262/#sec-object.getownpropertysymbols + _export({ target: 'Object', stat: true, forced: FORCED$n }, { + getOwnPropertySymbols: function getOwnPropertySymbols(it) { + var $getOwnPropertySymbols = objectGetOwnPropertySymbols.f; + return $getOwnPropertySymbols ? $getOwnPropertySymbols(toObject(it)) : []; + } + }); + var defineProperty$c = objectDefineProperty.f; @@ -3015,7 +3162,7 @@ var doric = (function (exports) { var symbolValueOf = functionUncurryThis(SymbolPrototype.valueOf); var regexp = /^Symbol\((.*)\)[^)]+$/; var replace$a = functionUncurryThis(''.replace); - var stringSlice$f = functionUncurryThis(''.slice); + var stringSlice$g = functionUncurryThis(''.slice); defineProperty$c(SymbolPrototype, 'description', { configurable: true, @@ -3023,12 +3170,12 @@ var doric = (function (exports) { var symbol = symbolValueOf(this); var string = symbolToString(symbol); if (hasOwnProperty_1(EmptyStringDescriptionStore, symbol)) { return ''; } - var desc = NATIVE_SYMBOL ? stringSlice$f(string, 7, -1) : replace$a(string, regexp, '$1'); + var desc = NATIVE_SYMBOL ? stringSlice$g(string, 7, -1) : replace$a(string, regexp, '$1'); return desc === '' ? undefined : desc; } }); - _export({ global: true, forced: true }, { + _export({ global: true, constructor: true, forced: true }, { Symbol: SymbolWrapper }); } @@ -3077,42 +3224,28 @@ var doric = (function (exports) { // https://tc39.es/ecma262/#sec-symbol.toprimitive defineWellKnownSymbol('toPrimitive'); + // `Symbol.prototype[@@toPrimitive]` method + // https://tc39.es/ecma262/#sec-symbol.prototype-@@toprimitive + symbolDefineToPrimitive(); + // `Symbol.toStringTag` well-known symbol // https://tc39.es/ecma262/#sec-symbol.tostringtag defineWellKnownSymbol('toStringTag'); + // `Symbol.prototype[@@toStringTag]` property + // https://tc39.es/ecma262/#sec-symbol.prototype-@@tostringtag + setToStringTag(getBuiltIn('Symbol'), 'Symbol'); + // `Symbol.unscopables` well-known symbol // https://tc39.es/ecma262/#sec-symbol.unscopables defineWellKnownSymbol('unscopables'); - var correctPrototypeGetter = !fails(function () { - function F() { /* empty */ } - F.prototype.constructor = null; - // eslint-disable-next-line es/no-object-getprototypeof -- required for testing - return Object.getPrototypeOf(new F()) !== F.prototype; - }); - - var IE_PROTO = sharedKey('IE_PROTO'); - var Object$3 = global_1.Object; - var ObjectPrototype$3 = Object$3.prototype; - - // `Object.getPrototypeOf` method - // https://tc39.es/ecma262/#sec-object.getprototypeof - var objectGetPrototypeOf = correctPrototypeGetter ? Object$3.getPrototypeOf : function (O) { - var object = toObject(O); - if (hasOwnProperty_1(object, IE_PROTO)) { return object[IE_PROTO]; } - var constructor = object.constructor; - if (isCallable(constructor) && object instanceof constructor) { - return constructor.prototype; - } return object instanceof Object$3 ? ObjectPrototype$3 : null; - }; - - var String$3 = global_1.String; - var TypeError$x = global_1.TypeError; + var $String$2 = String; + var $TypeError$t = TypeError; var aPossiblePrototype = function (argument) { if (typeof argument == 'object' || isCallable(argument)) { return argument; } - throw TypeError$x("Can't set " + String$3(argument) + ' as a prototype'); + throw $TypeError$t("Can't set " + $String$2(argument) + ' as a prototype'); }; /* eslint-disable no-proto -- safe */ @@ -3123,13 +3256,13 @@ var doric = (function (exports) { // `Object.setPrototypeOf` method // https://tc39.es/ecma262/#sec-object.setprototypeof // Works with __proto__ only. Old v8 can't work with null proto objects. - // eslint-disable-next-line es/no-object-setprototypeof -- safe + // eslint-disable-next-line es-x/no-object-setprototypeof -- safe var objectSetPrototypeOf = Object.setPrototypeOf || ('__proto__' in {} ? function () { var CORRECT_SETTER = false; var test = {}; var setter; try { - // eslint-disable-next-line es/no-object-getownpropertydescriptor -- safe + // eslint-disable-next-line es-x/no-object-getownpropertydescriptor -- safe setter = functionUncurryThis(Object.getOwnPropertyDescriptor(Object.prototype, '__proto__').set); setter(test, []); CORRECT_SETTER = test instanceof Array; @@ -3143,22 +3276,33 @@ var doric = (function (exports) { }; }() : undefined); - var replace$9 = functionUncurryThis(''.replace); - var split$3 = functionUncurryThis(''.split); - var join$7 = functionUncurryThis([].join); + var defineProperty$b = objectDefineProperty.f; - var TEST = (function (arg) { return String(Error(arg).stack); })('zxcasd'); - var V8_OR_CHAKRA_STACK_ENTRY = /\n\s*at [^:]*:[^\n]*/; - var IS_V8_OR_CHAKRA_STACK = V8_OR_CHAKRA_STACK_ENTRY.test(TEST); - var IS_FIREFOX_OR_SAFARI_STACK = /@[^\n]*\n/.test(TEST) && !/zxcasd/.test(TEST); + var proxyAccessor = function (Target, Source, key) { + key in Target || defineProperty$b(Target, key, { + configurable: true, + get: function () { return Source[key]; }, + set: function (it) { Source[key] = it; } + }); + }; - var clearErrorStack = function (stack, dropEntries) { - if (typeof stack != 'string') { return stack; } - if (IS_V8_OR_CHAKRA_STACK) { - while (dropEntries--) { stack = replace$9(stack, V8_OR_CHAKRA_STACK_ENTRY, ''); } - } else if (IS_FIREFOX_OR_SAFARI_STACK) { - return join$7(arraySlice$1(split$3(stack, '\n'), dropEntries), '\n'); - } return stack; + // makes subclassing work correct for wrapped built-ins + var inheritIfRequired = function ($this, dummy, Wrapper) { + var NewTarget, NewTargetPrototype; + if ( + // it can work only with native `setPrototypeOf` + objectSetPrototypeOf && + // we haven't completely correct pre-ES6 way for getting `new.target`, so use this + isCallable(NewTarget = dummy.constructor) && + NewTarget !== Wrapper && + isObject(NewTargetPrototype = NewTarget.prototype) && + NewTargetPrototype !== Wrapper.prototype + ) { objectSetPrototypeOf($this, NewTargetPrototype); } + return $this; + }; + + var normalizeStringArgument = function (argument, $default) { + return argument === undefined ? arguments.length < 2 ? '' : $default : toString_1(argument); }; // `InstallErrorCause` abstract operation @@ -3169,14 +3313,198 @@ var doric = (function (exports) { } }; + var $Error$1 = Error; + var replace$9 = functionUncurryThis(''.replace); + + var TEST = (function (arg) { return String($Error$1(arg).stack); })('zxcasd'); + var V8_OR_CHAKRA_STACK_ENTRY = /\n\s*at [^:]*:[^\n]*/; + var IS_V8_OR_CHAKRA_STACK = V8_OR_CHAKRA_STACK_ENTRY.test(TEST); + + var clearErrorStack = function (stack, dropEntries) { + if (IS_V8_OR_CHAKRA_STACK && typeof stack == 'string' && !$Error$1.prepareStackTrace) { + while (dropEntries--) { stack = replace$9(stack, V8_OR_CHAKRA_STACK_ENTRY, ''); } + } return stack; + }; + + var errorStackInstallable = !fails(function () { + var error = Error('a'); + if (!('stack' in error)) { return true; } + // eslint-disable-next-line es-x/no-object-defineproperty -- safe + Object.defineProperty(error, 'stack', createPropertyDescriptor(1, 7)); + return error.stack !== 7; + }); + + var wrapErrorConstructorWithCause = function (FULL_NAME, wrapper, FORCED, IS_AGGREGATE_ERROR) { + var STACK_TRACE_LIMIT = 'stackTraceLimit'; + var OPTIONS_POSITION = IS_AGGREGATE_ERROR ? 2 : 1; + var path = FULL_NAME.split('.'); + var ERROR_NAME = path[path.length - 1]; + var OriginalError = getBuiltIn.apply(null, path); + + if (!OriginalError) { return; } + + var OriginalErrorPrototype = OriginalError.prototype; + + // V8 9.3- bug https://bugs.chromium.org/p/v8/issues/detail?id=12006 + if (hasOwnProperty_1(OriginalErrorPrototype, 'cause')) { delete OriginalErrorPrototype.cause; } + + if (!FORCED) { return OriginalError; } + + var BaseError = getBuiltIn('Error'); + + var WrappedError = wrapper(function (a, b) { + var message = normalizeStringArgument(IS_AGGREGATE_ERROR ? b : a, undefined); + var result = IS_AGGREGATE_ERROR ? new OriginalError(a) : new OriginalError(); + if (message !== undefined) { createNonEnumerableProperty(result, 'message', message); } + if (errorStackInstallable) { createNonEnumerableProperty(result, 'stack', clearErrorStack(result.stack, 2)); } + if (this && objectIsPrototypeOf(OriginalErrorPrototype, this)) { inheritIfRequired(result, this, WrappedError); } + if (arguments.length > OPTIONS_POSITION) { installErrorCause(result, arguments[OPTIONS_POSITION]); } + return result; + }); + + WrappedError.prototype = OriginalErrorPrototype; + + if (ERROR_NAME !== 'Error') { + if (objectSetPrototypeOf) { objectSetPrototypeOf(WrappedError, BaseError); } + else { copyConstructorProperties(WrappedError, BaseError, { name: true }); } + } else if (descriptors && STACK_TRACE_LIMIT in OriginalError) { + proxyAccessor(WrappedError, OriginalError, STACK_TRACE_LIMIT); + proxyAccessor(WrappedError, OriginalError, 'prepareStackTrace'); + } + + copyConstructorProperties(WrappedError, OriginalError); + + { try { + // Safari 13- bug: WebAssembly errors does not have a proper `.name` + if (OriginalErrorPrototype.name !== ERROR_NAME) { + createNonEnumerableProperty(OriginalErrorPrototype, 'name', ERROR_NAME); + } + OriginalErrorPrototype.constructor = WrappedError; + } catch (error) { /* empty */ } } + + return WrappedError; + }; + + /* eslint-disable no-unused-vars -- required for functions `.length` */ + + + + + + var WEB_ASSEMBLY = 'WebAssembly'; + var WebAssembly$1 = global_1[WEB_ASSEMBLY]; + + var FORCED$m = Error('e', { cause: 7 }).cause !== 7; + + var exportGlobalErrorCauseWrapper = function (ERROR_NAME, wrapper) { + var O = {}; + O[ERROR_NAME] = wrapErrorConstructorWithCause(ERROR_NAME, wrapper, FORCED$m); + _export({ global: true, constructor: true, arity: 1, forced: FORCED$m }, O); + }; + + var exportWebAssemblyErrorCauseWrapper = function (ERROR_NAME, wrapper) { + if (WebAssembly$1 && WebAssembly$1[ERROR_NAME]) { + var O = {}; + O[ERROR_NAME] = wrapErrorConstructorWithCause(WEB_ASSEMBLY + '.' + ERROR_NAME, wrapper, FORCED$m); + _export({ target: WEB_ASSEMBLY, stat: true, constructor: true, arity: 1, forced: FORCED$m }, O); + } + }; + + // https://github.com/tc39/proposal-error-cause + exportGlobalErrorCauseWrapper('Error', function (init) { + return function Error(message) { return functionApply(init, this, arguments); }; + }); + exportGlobalErrorCauseWrapper('EvalError', function (init) { + return function EvalError(message) { return functionApply(init, this, arguments); }; + }); + exportGlobalErrorCauseWrapper('RangeError', function (init) { + return function RangeError(message) { return functionApply(init, this, arguments); }; + }); + exportGlobalErrorCauseWrapper('ReferenceError', function (init) { + return function ReferenceError(message) { return functionApply(init, this, arguments); }; + }); + exportGlobalErrorCauseWrapper('SyntaxError', function (init) { + return function SyntaxError(message) { return functionApply(init, this, arguments); }; + }); + exportGlobalErrorCauseWrapper('TypeError', function (init) { + return function TypeError(message) { return functionApply(init, this, arguments); }; + }); + exportGlobalErrorCauseWrapper('URIError', function (init) { + return function URIError(message) { return functionApply(init, this, arguments); }; + }); + exportWebAssemblyErrorCauseWrapper('CompileError', function (init) { + return function CompileError(message) { return functionApply(init, this, arguments); }; + }); + exportWebAssemblyErrorCauseWrapper('LinkError', function (init) { + return function LinkError(message) { return functionApply(init, this, arguments); }; + }); + exportWebAssemblyErrorCauseWrapper('RuntimeError', function (init) { + return function RuntimeError(message) { return functionApply(init, this, arguments); }; + }); + + var nativeErrorToString = Error.prototype.toString; + + var INCORRECT_TO_STRING$1 = fails(function () { + if (descriptors) { + // Chrome 32- incorrectly call accessor + // eslint-disable-next-line es-x/no-object-defineproperty -- safe + var object = objectCreate(Object.defineProperty({}, 'name', { get: function () { + return this === object; + } })); + if (nativeErrorToString.call(object) !== 'true') { return true; } + } + // FF10- does not properly handle non-strings + return nativeErrorToString.call({ message: 1, name: 2 }) !== '2: 1' + // IE8 does not properly handle defaults + || nativeErrorToString.call({}) !== 'Error'; + }); + + var errorToString = INCORRECT_TO_STRING$1 ? function toString() { + var O = anObject(this); + var name = normalizeStringArgument(O.name, 'Error'); + var message = normalizeStringArgument(O.message); + return !name ? message : !message ? name : name + ': ' + message; + } : nativeErrorToString; + + var ErrorPrototype$1 = Error.prototype; + + // `Error.prototype.toString` method fix + // https://tc39.es/ecma262/#sec-error.prototype.tostring + if (ErrorPrototype$1.toString !== errorToString) { + defineBuiltIn(ErrorPrototype$1, 'toString', errorToString); + } + + var correctPrototypeGetter = !fails(function () { + function F() { /* empty */ } + F.prototype.constructor = null; + // eslint-disable-next-line es-x/no-object-getprototypeof -- required for testing + return Object.getPrototypeOf(new F()) !== F.prototype; + }); + + var IE_PROTO = sharedKey('IE_PROTO'); + var $Object$2 = Object; + var ObjectPrototype$3 = $Object$2.prototype; + + // `Object.getPrototypeOf` method + // https://tc39.es/ecma262/#sec-object.getprototypeof + // eslint-disable-next-line es-x/no-object-getprototypeof -- safe + var objectGetPrototypeOf = correctPrototypeGetter ? $Object$2.getPrototypeOf : function (O) { + var object = toObject(O); + if (hasOwnProperty_1(object, IE_PROTO)) { return object[IE_PROTO]; } + var constructor = object.constructor; + if (isCallable(constructor) && object instanceof constructor) { + return constructor.prototype; + } return object instanceof $Object$2 ? ObjectPrototype$3 : null; + }; + var iterators = {}; var ITERATOR$a = wellKnownSymbol('iterator'); - var ArrayPrototype$1 = Array.prototype; + var ArrayPrototype$2 = Array.prototype; // check on default Array iterator var isArrayIteratorMethod = function (it) { - return it !== undefined && (iterators.Array === it || ArrayPrototype$1[ITERATOR$a] === it); + return it !== undefined && (iterators.Array === it || ArrayPrototype$2[ITERATOR$a] === it); }; var ITERATOR$9 = wellKnownSymbol('iterator'); @@ -3187,12 +3515,12 @@ var doric = (function (exports) { || iterators[classof(it)]; } }; - var TypeError$w = global_1.TypeError; + var $TypeError$s = TypeError; var getIterator = function (argument, usingIterator) { var iteratorMethod = arguments.length < 2 ? getIteratorMethod(argument) : usingIterator; if (aCallable(iteratorMethod)) { return anObject(functionCall(iteratorMethod, argument)); } - throw TypeError$w(tryToString(argument) + ' is not iterable'); + throw $TypeError$s(tryToString(argument) + ' is not iterable'); }; var iteratorClose = function (iterator, kind, value) { @@ -3215,7 +3543,7 @@ var doric = (function (exports) { return value; }; - var TypeError$v = global_1.TypeError; + var $TypeError$r = TypeError; var Result = function (stopped, result) { this.stopped = stopped; @@ -3248,7 +3576,7 @@ var doric = (function (exports) { iterator = iterable; } else { iterFn = getIteratorMethod(iterable); - if (!iterFn) { throw TypeError$v(tryToString(iterable) + ' is not iterable'); } + if (!iterFn) { throw $TypeError$r(tryToString(iterable) + ' is not iterable'); } // optimisation for array iterators if (isArrayIteratorMethod(iterFn)) { for (index = 0, length = lengthOfArrayLike(iterable); length > index; index++) { @@ -3270,58 +3598,69 @@ var doric = (function (exports) { } return new Result(false); }; - var normalizeStringArgument = function (argument, $default) { - return argument === undefined ? arguments.length < 2 ? '' : $default : toString_1(argument); - }; + var TO_STRING_TAG$6 = wellKnownSymbol('toStringTag'); + var $Error = Error; + var push$j = [].push; - var errorStackInstallable = !fails(function () { - var error = Error('a'); - if (!('stack' in error)) { return true; } - // eslint-disable-next-line es/no-object-defineproperty -- safe - Object.defineProperty(error, 'stack', createPropertyDescriptor(1, 7)); - return error.stack !== 7; - }); - - var Error$2 = global_1.Error; - var push$g = [].push; - - var $AggregateError = function AggregateError(errors, message /* , options */) { - var that = objectIsPrototypeOf(AggregateErrorPrototype, this) ? this : objectCreate(AggregateErrorPrototype); + var $AggregateError$1 = function AggregateError(errors, message /* , options */) { var options = arguments.length > 2 ? arguments[2] : undefined; + var isInstance = objectIsPrototypeOf(AggregateErrorPrototype, this); + var that; if (objectSetPrototypeOf) { - that = objectSetPrototypeOf(new Error$2(undefined), objectGetPrototypeOf(that)); + that = objectSetPrototypeOf(new $Error(), isInstance ? objectGetPrototypeOf(this) : AggregateErrorPrototype); + } else { + that = isInstance ? this : objectCreate(AggregateErrorPrototype); + createNonEnumerableProperty(that, TO_STRING_TAG$6, 'Error'); } - createNonEnumerableProperty(that, 'message', normalizeStringArgument(message, '')); + if (message !== undefined) { createNonEnumerableProperty(that, 'message', normalizeStringArgument(message)); } if (errorStackInstallable) { createNonEnumerableProperty(that, 'stack', clearErrorStack(that.stack, 1)); } installErrorCause(that, options); var errorsArray = []; - iterate(errors, push$g, { that: errorsArray }); + iterate(errors, push$j, { that: errorsArray }); createNonEnumerableProperty(that, 'errors', errorsArray); return that; }; - if (objectSetPrototypeOf) { objectSetPrototypeOf($AggregateError, Error$2); } - else { copyConstructorProperties($AggregateError, Error$2); } + if (objectSetPrototypeOf) { objectSetPrototypeOf($AggregateError$1, $Error); } + else { copyConstructorProperties($AggregateError$1, $Error, { name: true }); } - var AggregateErrorPrototype = $AggregateError.prototype = objectCreate(Error$2.prototype, { - constructor: createPropertyDescriptor(1, $AggregateError), + var AggregateErrorPrototype = $AggregateError$1.prototype = objectCreate($Error.prototype, { + constructor: createPropertyDescriptor(1, $AggregateError$1), message: createPropertyDescriptor(1, ''), name: createPropertyDescriptor(1, 'AggregateError') }); // `AggregateError` constructor // https://tc39.es/ecma262/#sec-aggregate-error-constructor - _export({ global: true }, { - AggregateError: $AggregateError + _export({ global: true, constructor: true, arity: 2 }, { + AggregateError: $AggregateError$1 }); + var AGGREGATE_ERROR = 'AggregateError'; + var $AggregateError = getBuiltIn(AGGREGATE_ERROR); + var FORCED$l = !fails(function () { + return $AggregateError([1]).errors[0] !== 1; + }) && fails(function () { + return $AggregateError([1], AGGREGATE_ERROR, { cause: 7 }).cause !== 7; + }); + + // https://github.com/tc39/proposal-error-cause + _export({ global: true, constructor: true, arity: 2, forced: FORCED$l }, { + AggregateError: wrapErrorConstructorWithCause(AGGREGATE_ERROR, function (init) { + // eslint-disable-next-line no-unused-vars -- required for functions `.length` + return function AggregateError(errors, message) { return functionApply(init, this, arguments); }; + }, FORCED$l, true) + }); + + var defineProperty$a = objectDefineProperty.f; + var UNSCOPABLES = wellKnownSymbol('unscopables'); - var ArrayPrototype = Array.prototype; + var ArrayPrototype$1 = Array.prototype; // Array.prototype[@@unscopables] // https://tc39.es/ecma262/#sec-array.prototype-@@unscopables - if (ArrayPrototype[UNSCOPABLES] == undefined) { - objectDefineProperty.f(ArrayPrototype, UNSCOPABLES, { + if (ArrayPrototype$1[UNSCOPABLES] == undefined) { + defineProperty$a(ArrayPrototype$1, UNSCOPABLES, { configurable: true, value: objectCreate(null) }); @@ -3329,7 +3668,7 @@ var doric = (function (exports) { // add a key to Array.prototype[@@unscopables] var addToUnscopables = function (key) { - ArrayPrototype[UNSCOPABLES][key] = true; + ArrayPrototype$1[UNSCOPABLES][key] = true; }; // `Array.prototype.at` method @@ -3346,10 +3685,12 @@ var doric = (function (exports) { addToUnscopables('at'); - var createProperty = function (object, key, value) { - var propertyKey = toPropertyKey(key); - if (propertyKey in object) { objectDefineProperty.f(object, propertyKey, createPropertyDescriptor(0, value)); } - else { object[propertyKey] = value; } + var $TypeError$q = TypeError; + var MAX_SAFE_INTEGER = 0x1FFFFFFFFFFFFF; // 2 ** 53 - 1 == 9007199254740991 + + var doesNotExceedSafeInteger = function (it) { + if (it > MAX_SAFE_INTEGER) { throw $TypeError$q('Maximum allowed index exceeded'); } + return it; }; var SPECIES$5 = wellKnownSymbol('species'); @@ -3369,9 +3710,6 @@ var doric = (function (exports) { }; var IS_CONCAT_SPREADABLE = wellKnownSymbol('isConcatSpreadable'); - var MAX_SAFE_INTEGER$2 = 0x1FFFFFFFFFFFFF; - var MAXIMUM_ALLOWED_INDEX_EXCEEDED = 'Maximum allowed index exceeded'; - var TypeError$u = global_1.TypeError; // We can't use this feature detection in V8 since it causes // deoptimization and serious performance degradation @@ -3390,12 +3728,12 @@ var doric = (function (exports) { return spreadable !== undefined ? !!spreadable : isArray(O); }; - var FORCED$q = !IS_CONCAT_SPREADABLE_SUPPORT || !SPECIES_SUPPORT; + var FORCED$k = !IS_CONCAT_SPREADABLE_SUPPORT || !SPECIES_SUPPORT; // `Array.prototype.concat` method // https://tc39.es/ecma262/#sec-array.prototype.concat // with adding support of @@isConcatSpreadable and @@species - _export({ target: 'Array', proto: true, forced: FORCED$q }, { + _export({ target: 'Array', proto: true, arity: 1, forced: FORCED$k }, { // eslint-disable-next-line no-unused-vars -- required for `.length` concat: function concat(arg) { var arguments$1 = arguments; @@ -3408,10 +3746,10 @@ var doric = (function (exports) { E = i === -1 ? O : arguments$1[i]; if (isConcatSpreadable(E)) { len = lengthOfArrayLike(E); - if (n + len > MAX_SAFE_INTEGER$2) { throw TypeError$u(MAXIMUM_ALLOWED_INDEX_EXCEEDED); } + doesNotExceedSafeInteger(n + len); for (k = 0; k < len; k++, n++) { if (k in E) { createProperty(A, n, E[k]); } } } else { - if (n >= MAX_SAFE_INTEGER$2) { throw TypeError$u(MAXIMUM_ALLOWED_INDEX_EXCEEDED); } + doesNotExceedSafeInteger(n + 1); createProperty(A, n++, E); } } @@ -3420,18 +3758,24 @@ var doric = (function (exports) { } }); - var min$8 = Math.min; + var $TypeError$p = TypeError; + + var deletePropertyOrThrow = function (O, P) { + if (!delete O[P]) { throw $TypeError$p('Cannot delete property ' + tryToString(P) + ' of ' + tryToString(O)); } + }; + + var min$9 = Math.min; // `Array.prototype.copyWithin` method implementation // https://tc39.es/ecma262/#sec-array.prototype.copywithin - // eslint-disable-next-line es/no-array-prototype-copywithin -- safe + // eslint-disable-next-line es-x/no-array-prototype-copywithin -- safe var arrayCopyWithin = [].copyWithin || function copyWithin(target /* = 0 */, start /* = 0, end = @length */) { var O = toObject(this); var len = lengthOfArrayLike(O); var to = toAbsoluteIndex(target, len); var from = toAbsoluteIndex(start, len); var end = arguments.length > 2 ? arguments[2] : undefined; - var count = min$8((end === undefined ? len : toAbsoluteIndex(end, len)) - from, len - to); + var count = min$9((end === undefined ? len : toAbsoluteIndex(end, len)) - from, len - to); var inc = 1; if (from < to && to < from + count) { inc = -1; @@ -3440,7 +3784,7 @@ var doric = (function (exports) { } while (count-- > 0) { if (from in O) { O[to] = O[from]; } - else { delete O[to]; } + else { deletePropertyOrThrow(O, to); } to += inc; from += inc; } return O; @@ -3458,8 +3802,8 @@ var doric = (function (exports) { var arrayMethodIsStrict = function (METHOD_NAME, argument) { var method = [][METHOD_NAME]; return !!method && fails(function () { - // eslint-disable-next-line no-useless-call,no-throw-literal -- required for testing - method.call(null, argument || function () { throw 1; }, 1); + // eslint-disable-next-line no-useless-call -- required for testing + method.call(null, argument || function () { return 1; }, 1); }); }; @@ -3552,7 +3896,61 @@ var doric = (function (exports) { // https://tc39.es/ecma262/#sec-array.prototype-@@unscopables addToUnscopables(FIND_INDEX); - var TypeError$t = global_1.TypeError; + // `Array.prototype.{ findLast, findLastIndex }` methods implementation + var createMethod$6 = function (TYPE) { + var IS_FIND_LAST_INDEX = TYPE == 1; + return function ($this, callbackfn, that) { + var O = toObject($this); + var self = indexedObject(O); + var boundFunction = functionBindContext(callbackfn, that); + var index = lengthOfArrayLike(self); + var value, result; + while (index-- > 0) { + value = self[index]; + result = boundFunction(value, index, O); + if (result) { switch (TYPE) { + case 0: return value; // findLast + case 1: return index; // findLastIndex + } } + } + return IS_FIND_LAST_INDEX ? -1 : undefined; + }; + }; + + var arrayIterationFromLast = { + // `Array.prototype.findLast` method + // https://github.com/tc39/proposal-array-find-from-last + findLast: createMethod$6(0), + // `Array.prototype.findLastIndex` method + // https://github.com/tc39/proposal-array-find-from-last + findLastIndex: createMethod$6(1) + }; + + var $findLast$1 = arrayIterationFromLast.findLast; + + + // `Array.prototype.findLast` method + // https://github.com/tc39/proposal-array-find-from-last + _export({ target: 'Array', proto: true }, { + findLast: function findLast(callbackfn /* , that = undefined */) { + return $findLast$1(this, callbackfn, arguments.length > 1 ? arguments[1] : undefined); + } + }); + + addToUnscopables('findLast'); + + var $findLastIndex$1 = arrayIterationFromLast.findLastIndex; + + + // `Array.prototype.findLastIndex` method + // https://github.com/tc39/proposal-array-find-from-last + _export({ target: 'Array', proto: true }, { + findLastIndex: function findLastIndex(callbackfn /* , that = undefined */) { + return $findLastIndex$1(this, callbackfn, arguments.length > 1 ? arguments[1] : undefined); + } + }); + + addToUnscopables('findLastIndex'); // `FlattenIntoArray` abstract operation // https://tc39.github.io/proposal-flatMap/#sec-FlattenIntoArray @@ -3570,7 +3968,7 @@ var doric = (function (exports) { elementLen = lengthOfArrayLike(element); targetIndex = flattenIntoArray(target, original, element, elementLen, targetIndex, depth - 1) - 1; } else { - if (targetIndex >= 0x1FFFFFFFFFFFFF) { throw TypeError$t('Exceed the acceptable array length'); } + doesNotExceedSafeInteger(targetIndex + 1); target[targetIndex] = element; } @@ -3619,12 +4017,12 @@ var doric = (function (exports) { // https://tc39.es/ecma262/#sec-array.prototype.foreach var arrayForEach = !STRICT_METHOD$7 ? function forEach(callbackfn /* , thisArg */) { return $forEach$2(this, callbackfn, arguments.length > 1 ? arguments[1] : undefined); - // eslint-disable-next-line es/no-array-prototype-foreach -- safe + // eslint-disable-next-line es-x/no-array-prototype-foreach -- safe } : [].forEach; // `Array.prototype.forEach` method // https://tc39.es/ecma262/#sec-array.prototype.foreach - // eslint-disable-next-line es/no-array-prototype-foreach -- safe + // eslint-disable-next-line es-x/no-array-prototype-foreach -- safe _export({ target: 'Array', proto: true, forced: [].forEach != arrayForEach }, { forEach: arrayForEach }); @@ -3638,7 +4036,7 @@ var doric = (function (exports) { } }; - var Array$9 = global_1.Array; + var $Array$8 = Array; // `Array.from` method implementation // https://tc39.es/ecma262/#sec-array.from @@ -3653,7 +4051,7 @@ var doric = (function (exports) { var index = 0; var length, result, step, iterator, next, value; // if the target is not iterable or it's an array with the default iterator - use a simple case - if (iteratorMethod && !(this == Array$9 && isArrayIteratorMethod(iteratorMethod))) { + if (iteratorMethod && !(this === $Array$8 && isArrayIteratorMethod(iteratorMethod))) { iterator = getIterator(O, iteratorMethod); next = iterator.next; result = IS_CONSTRUCTOR ? new this() : []; @@ -3663,7 +4061,7 @@ var doric = (function (exports) { } } else { length = lengthOfArrayLike(O); - result = IS_CONSTRUCTOR ? new this(length) : Array$9(length); + result = IS_CONSTRUCTOR ? new this(length) : $Array$8(length); for (;length > index; index++) { value = mapping ? mapfn(O[index], index) : O[index]; createProperty(result, index, value); @@ -3689,7 +4087,7 @@ var doric = (function (exports) { iteratorWithReturn[ITERATOR$8] = function () { return this; }; - // eslint-disable-next-line es/no-array-from, no-throw-literal -- required for testing + // eslint-disable-next-line es-x/no-array-from, no-throw-literal -- required for testing Array.from(iteratorWithReturn, function () { throw 2; }); } catch (error) { /* empty */ } @@ -3710,23 +4108,29 @@ var doric = (function (exports) { return ITERATION_SUPPORT; }; - var INCORRECT_ITERATION$1 = !checkCorrectnessOfIteration(function (iterable) { - // eslint-disable-next-line es/no-array-from -- required for testing + var INCORRECT_ITERATION = !checkCorrectnessOfIteration(function (iterable) { + // eslint-disable-next-line es-x/no-array-from -- required for testing Array.from(iterable); }); // `Array.from` method // https://tc39.es/ecma262/#sec-array.from - _export({ target: 'Array', stat: true, forced: INCORRECT_ITERATION$1 }, { + _export({ target: 'Array', stat: true, forced: INCORRECT_ITERATION }, { from: arrayFrom }); var $includes$1 = arrayIncludes.includes; + + // FF99+ bug + var BROKEN_ON_SPARSE = fails(function () { + return !Array(1).includes(); + }); + // `Array.prototype.includes` method // https://tc39.es/ecma262/#sec-array.prototype.includes - _export({ target: 'Array', proto: true }, { + _export({ target: 'Array', proto: true, forced: BROKEN_ON_SPARSE }, { includes: function includes(el /* , fromIndex = 0 */) { return $includes$1(this, el, arguments.length > 1 ? arguments[1] : undefined); } @@ -3735,7 +4139,7 @@ var doric = (function (exports) { // https://tc39.es/ecma262/#sec-array.prototype-@@unscopables addToUnscopables('includes'); - /* eslint-disable es/no-array-prototype-indexof -- required for testing */ + /* eslint-disable es-x/no-array-prototype-indexof -- required for testing */ var $IndexOf = arrayIncludes.indexOf; @@ -3771,7 +4175,7 @@ var doric = (function (exports) { // https://tc39.es/ecma262/#sec-%iteratorprototype%-object var IteratorPrototype$5, PrototypeOfArrayIteratorPrototype, arrayIterator$1; - /* eslint-disable es/no-array-prototype-keys -- safe */ + /* eslint-disable es-x/no-array-prototype-keys -- safe */ if ([].keys) { arrayIterator$1 = [].keys(); // Safari 8 has buggy iterators w/o `next` @@ -3793,7 +4197,7 @@ var doric = (function (exports) { // `%IteratorPrototype%[@@iterator]()` method // https://tc39.es/ecma262/#sec-%iteratorprototype%-@@iterator if (!isCallable(IteratorPrototype$5[ITERATOR$7])) { - redefine(IteratorPrototype$5, ITERATOR$7, function () { + defineBuiltIn(IteratorPrototype$5, ITERATOR$7, function () { return this; }); } @@ -3811,15 +4215,15 @@ var doric = (function (exports) { var returnThis$1 = function () { return this; }; - var createIteratorConstructor = function (IteratorConstructor, NAME, next) { + var createIteratorConstructor = function (IteratorConstructor, NAME, next, ENUMERABLE_NEXT) { var TO_STRING_TAG = NAME + ' Iterator'; - IteratorConstructor.prototype = objectCreate(IteratorPrototype$4, { next: createPropertyDescriptor(1, next) }); + IteratorConstructor.prototype = objectCreate(IteratorPrototype$4, { next: createPropertyDescriptor(+!ENUMERABLE_NEXT, next) }); setToStringTag(IteratorConstructor, TO_STRING_TAG, false); iterators[TO_STRING_TAG] = returnThis$1; return IteratorConstructor; }; - var PROPER_FUNCTION_NAME$4 = functionName.PROPER; + var PROPER_FUNCTION_NAME$3 = functionName.PROPER; var CONFIGURABLE_FUNCTION_NAME$1 = functionName.CONFIGURABLE; var IteratorPrototype$3 = iteratorsCore.IteratorPrototype; var BUGGY_SAFARI_ITERATORS = iteratorsCore.BUGGY_SAFARI_ITERATORS; @@ -3861,7 +4265,7 @@ var doric = (function (exports) { if (objectSetPrototypeOf) { objectSetPrototypeOf(CurrentIteratorPrototype, IteratorPrototype$3); } else if (!isCallable(CurrentIteratorPrototype[ITERATOR$6])) { - redefine(CurrentIteratorPrototype, ITERATOR$6, returnThis); + defineBuiltIn(CurrentIteratorPrototype, ITERATOR$6, returnThis); } } // Set @@toStringTag to native iterators @@ -3870,7 +4274,7 @@ var doric = (function (exports) { } // fix Array.prototype.{ values, @@iterator }.name in V8 / FF - if (PROPER_FUNCTION_NAME$4 && DEFAULT == VALUES && nativeIterator && nativeIterator.name !== VALUES) { + if (PROPER_FUNCTION_NAME$3 && DEFAULT == VALUES && nativeIterator && nativeIterator.name !== VALUES) { if (CONFIGURABLE_FUNCTION_NAME$1) { createNonEnumerableProperty(IterablePrototype, 'name', VALUES); } else { @@ -3888,23 +4292,28 @@ var doric = (function (exports) { }; if (FORCED) { for (KEY in methods) { if (BUGGY_SAFARI_ITERATORS || INCORRECT_VALUES_NAME || !(KEY in IterablePrototype)) { - redefine(IterablePrototype, KEY, methods[KEY]); + defineBuiltIn(IterablePrototype, KEY, methods[KEY]); } } } else { _export({ target: NAME, proto: true, forced: BUGGY_SAFARI_ITERATORS || INCORRECT_VALUES_NAME }, methods); } } // define iterator if (IterablePrototype[ITERATOR$6] !== defaultIterator) { - redefine(IterablePrototype, ITERATOR$6, defaultIterator, { name: DEFAULT }); + defineBuiltIn(IterablePrototype, ITERATOR$6, defaultIterator, { name: DEFAULT }); } iterators[NAME] = defaultIterator; return methods; }; + var defineProperty$9 = objectDefineProperty.f; + + + + var ARRAY_ITERATOR = 'Array Iterator'; - var setInternalState$g = internalState.set; - var getInternalState$f = internalState.getterFor(ARRAY_ITERATOR); + var setInternalState$h = internalState.set; + var getInternalState$e = internalState.getterFor(ARRAY_ITERATOR); // `Array.prototype.entries` method // https://tc39.es/ecma262/#sec-array.prototype.entries @@ -3917,7 +4326,7 @@ var doric = (function (exports) { // `CreateArrayIterator` internal method // https://tc39.es/ecma262/#sec-createarrayiterator var es_array_iterator = defineIterator(Array, 'Array', function (iterated, kind) { - setInternalState$g(this, { + setInternalState$h(this, { type: ARRAY_ITERATOR, target: toIndexedObject(iterated), // target index: 0, // next index @@ -3926,7 +4335,7 @@ var doric = (function (exports) { // `%ArrayIteratorPrototype%.next` method // https://tc39.es/ecma262/#sec-%arrayiteratorprototype%.next }, function () { - var state = getInternalState$f(this); + var state = getInternalState$e(this); var target = state.target; var kind = state.kind; var index = state.index++; @@ -3942,13 +4351,18 @@ var doric = (function (exports) { // argumentsList[@@iterator] is %ArrayProto_values% // https://tc39.es/ecma262/#sec-createunmappedargumentsobject // https://tc39.es/ecma262/#sec-createmappedargumentsobject - iterators.Arguments = iterators.Array; + var values = iterators.Arguments = iterators.Array; // https://tc39.es/ecma262/#sec-array.prototype-@@unscopables addToUnscopables('keys'); addToUnscopables('values'); addToUnscopables('entries'); + // V8 ~ Chrome 45- bug + if (descriptors && values.name !== 'values') { try { + defineProperty$9(values, 'name', { value: 'values' }); + } catch (error) { /* empty */ } } + var un$Join = functionUncurryThis([].join); var ES3_STRINGS = indexedObject != Object; @@ -3962,28 +4376,28 @@ var doric = (function (exports) { } }); - /* eslint-disable es/no-array-prototype-lastindexof -- safe */ + /* eslint-disable es-x/no-array-prototype-lastindexof -- safe */ - var min$7 = Math.min; + var min$8 = Math.min; var $lastIndexOf = [].lastIndexOf; var NEGATIVE_ZERO = !!$lastIndexOf && 1 / [1].lastIndexOf(1, -0) < 0; var STRICT_METHOD$4 = arrayMethodIsStrict('lastIndexOf'); - var FORCED$p = NEGATIVE_ZERO || !STRICT_METHOD$4; + var FORCED$j = NEGATIVE_ZERO || !STRICT_METHOD$4; // `Array.prototype.lastIndexOf` method implementation // https://tc39.es/ecma262/#sec-array.prototype.lastindexof - var arrayLastIndexOf = FORCED$p ? function lastIndexOf(searchElement /* , fromIndex = @[*-1] */) { + var arrayLastIndexOf = FORCED$j ? function lastIndexOf(searchElement /* , fromIndex = @[*-1] */) { // convert -0 to +0 if (NEGATIVE_ZERO) { return functionApply($lastIndexOf, this, arguments) || 0; } var O = toIndexedObject(this); var length = lengthOfArrayLike(O); var index = length - 1; - if (arguments.length > 1) { index = min$7(index, toIntegerOrInfinity(arguments[1])); } + if (arguments.length > 1) { index = min$8(index, toIntegerOrInfinity(arguments[1])); } if (index < 0) { index = length + index; } for (;index >= 0; index--) { if (index in O && O[index] === searchElement) { return index || 0; } } return -1; @@ -3991,7 +4405,7 @@ var doric = (function (exports) { // `Array.prototype.lastIndexOf` method // https://tc39.es/ecma262/#sec-array.prototype.lastindexof - // eslint-disable-next-line es/no-array-prototype-lastindexof -- required for testing + // eslint-disable-next-line es-x/no-array-prototype-lastindexof -- required for testing _export({ target: 'Array', proto: true, forced: arrayLastIndexOf !== [].lastIndexOf }, { lastIndexOf: arrayLastIndexOf }); @@ -4010,11 +4424,12 @@ var doric = (function (exports) { } }); - var Array$8 = global_1.Array; + var $Array$7 = Array; var ISNT_GENERIC = fails(function () { function F() { /* empty */ } - return !(Array$8.of.call(F) instanceof F); + // eslint-disable-next-line es-x/no-array-of -- safe + return !($Array$7.of.call(F) instanceof F); }); // `Array.of` method @@ -4026,17 +4441,52 @@ var doric = (function (exports) { var index = 0; var argumentsLength = arguments.length; - var result = new (isConstructor(this) ? this : Array$8)(argumentsLength); + var result = new (isConstructor(this) ? this : $Array$7)(argumentsLength); while (argumentsLength > index) { createProperty(result, index, arguments$1[index++]); } result.length = argumentsLength; return result; } }); - var TypeError$s = global_1.TypeError; + var INCORRECT_TO_LENGTH = fails(function () { + return [].push.call({ length: 0x100000000 }, 1) !== 4294967297; + }); + + // V8 and Safari <= 15.4, FF < 23 throws InternalError + // https://bugs.chromium.org/p/v8/issues/detail?id=12681 + var SILENT_ON_NON_WRITABLE_LENGTH$1 = !function () { + try { + // eslint-disable-next-line es-x/no-object-defineproperty -- safe + Object.defineProperty([], 'length', { writable: false }).push(); + } catch (error) { + return error instanceof TypeError; + } + }(); + + // `Array.prototype.push` method + // https://tc39.es/ecma262/#sec-array.prototype.push + _export({ target: 'Array', proto: true, arity: 1, forced: INCORRECT_TO_LENGTH || SILENT_ON_NON_WRITABLE_LENGTH$1 }, { + // eslint-disable-next-line no-unused-vars -- required for `.length` + push: function push(item) { + var arguments$1 = arguments; + + var O = toObject(this); + var len = lengthOfArrayLike(O); + var argCount = arguments.length; + doesNotExceedSafeInteger(len + argCount); + for (var i = 0; i < argCount; i++) { + O[len] = arguments$1[i]; + len++; + } + O.length = len; + return len; + } + }); + + var $TypeError$o = TypeError; // `Array.prototype.{ reduce, reduceRight }` methods implementation - var createMethod$6 = function (IS_RIGHT) { + var createMethod$5 = function (IS_RIGHT) { return function (that, callbackfn, argumentsLength, memo) { aCallable(callbackfn); var O = toObject(that); @@ -4052,7 +4502,7 @@ var doric = (function (exports) { } index += i; if (IS_RIGHT ? index < 0 : length <= index) { - throw TypeError$s('Reduce of empty array with no initial value'); + throw $TypeError$o('Reduce of empty array with no initial value'); } } } for (;IS_RIGHT ? index >= 0 : length > index; index += i) { if (index in self) { @@ -4065,10 +4515,10 @@ var doric = (function (exports) { var arrayReduce = { // `Array.prototype.reduce` method // https://tc39.es/ecma262/#sec-array.prototype.reduce - left: createMethod$6(false), + left: createMethod$5(false), // `Array.prototype.reduceRight` method // https://tc39.es/ecma262/#sec-array.prototype.reduceright - right: createMethod$6(true) + right: createMethod$5(true) }; var engineIsNode = classofRaw(global_1.process) == 'process'; @@ -4128,8 +4578,8 @@ var doric = (function (exports) { var HAS_SPECIES_SUPPORT$1 = arrayMethodHasSpeciesSupport('slice'); var SPECIES$4 = wellKnownSymbol('species'); - var Array$7 = global_1.Array; - var max$5 = Math.max; + var $Array$6 = Array; + var max$6 = Math.max; // `Array.prototype.slice` method // https://tc39.es/ecma262/#sec-array.prototype.slice @@ -4145,17 +4595,17 @@ var doric = (function (exports) { if (isArray(O)) { Constructor = O.constructor; // cross-realm fallback - if (isConstructor(Constructor) && (Constructor === Array$7 || isArray(Constructor.prototype))) { + if (isConstructor(Constructor) && (Constructor === $Array$6 || isArray(Constructor.prototype))) { Constructor = undefined; } else if (isObject(Constructor)) { Constructor = Constructor[SPECIES$4]; if (Constructor === null) { Constructor = undefined; } } - if (Constructor === Array$7 || Constructor === undefined) { + if (Constructor === $Array$6 || Constructor === undefined) { return arraySlice$1(O, k, fin); } } - result = new (Constructor === undefined ? Array$7 : Constructor)(max$5(fin - k, 0)); + result = new (Constructor === undefined ? $Array$6 : Constructor)(max$6(fin - k, 0)); for (n = 0; k < fin; k++, n++) { if (k in O) { createProperty(result, n, O[k]); } } result.length = n; return result; @@ -4182,8 +4632,8 @@ var doric = (function (exports) { var middle = floor$9(length / 2); return length < 8 ? insertionSort(array, comparefn) : merge( array, - mergeSort(arraySlice$1(array, 0, middle), comparefn), - mergeSort(arraySlice$1(array, middle), comparefn), + mergeSort(arraySliceSimple(array, 0, middle), comparefn), + mergeSort(arraySliceSimple(array, middle), comparefn), comparefn ); }; @@ -4230,7 +4680,7 @@ var doric = (function (exports) { var test = []; var un$Sort$1 = functionUncurryThis(test.sort); - var push$f = functionUncurryThis(test.push); + var push$i = functionUncurryThis(test.push); // IE8- var FAILS_ON_UNDEFINED = fails(function () { @@ -4278,7 +4728,7 @@ var doric = (function (exports) { return result !== 'DGBEFHACIJK'; }); - var FORCED$o = FAILS_ON_UNDEFINED || !FAILS_ON_NULL || !STRICT_METHOD || !STABLE_SORT$1; + var FORCED$i = FAILS_ON_UNDEFINED || !FAILS_ON_NULL || !STRICT_METHOD || !STABLE_SORT$1; var getSortCompare$1 = function (comparefn) { return function (x, y) { @@ -4291,7 +4741,7 @@ var doric = (function (exports) { // `Array.prototype.sort` method // https://tc39.es/ecma262/#sec-array.prototype.sort - _export({ target: 'Array', proto: true, forced: FORCED$o }, { + _export({ target: 'Array', proto: true, forced: FORCED$i }, { sort: function sort(comparefn) { if (comparefn !== undefined) { aCallable(comparefn); } @@ -4304,7 +4754,7 @@ var doric = (function (exports) { var itemsLength, index; for (index = 0; index < arrayLength; index++) { - if (index in array) { push$f(items, array[index]); } + if (index in array) { push$i(items, array[index]); } } arraySort(items, getSortCompare$1(comparefn)); @@ -4313,7 +4763,7 @@ var doric = (function (exports) { index = 0; while (index < itemsLength) { array[index] = items[index++]; } - while (index < arrayLength) { delete array[index++]; } + while (index < arrayLength) { deletePropertyOrThrow(array, index++); } return array; } @@ -4339,11 +4789,8 @@ var doric = (function (exports) { var HAS_SPECIES_SUPPORT = arrayMethodHasSpeciesSupport('splice'); - var TypeError$r = global_1.TypeError; - var max$4 = Math.max; - var min$6 = Math.min; - var MAX_SAFE_INTEGER$1 = 0x1FFFFFFFFFFFFF; - var MAXIMUM_ALLOWED_LENGTH_EXCEEDED = 'Maximum allowed length exceeded'; + var max$5 = Math.max; + var min$7 = Math.min; // `Array.prototype.splice` method // https://tc39.es/ecma262/#sec-array.prototype.splice @@ -4364,11 +4811,9 @@ var doric = (function (exports) { actualDeleteCount = len - actualStart; } else { insertCount = argumentsLength - 2; - actualDeleteCount = min$6(max$4(toIntegerOrInfinity(deleteCount), 0), len - actualStart); - } - if (len + insertCount - actualDeleteCount > MAX_SAFE_INTEGER$1) { - throw TypeError$r(MAXIMUM_ALLOWED_LENGTH_EXCEEDED); + actualDeleteCount = min$7(max$5(toIntegerOrInfinity(deleteCount), 0), len - actualStart); } + doesNotExceedSafeInteger(len + insertCount - actualDeleteCount); A = arraySpeciesCreate(O, actualDeleteCount); for (k = 0; k < actualDeleteCount; k++) { from = actualStart + k; @@ -4380,15 +4825,15 @@ var doric = (function (exports) { from = k + actualDeleteCount; to = k + insertCount; if (from in O) { O[to] = O[from]; } - else { delete O[to]; } + else { deletePropertyOrThrow(O, to); } } - for (k = len; k > len - actualDeleteCount + insertCount; k--) { delete O[k - 1]; } + for (k = len; k > len - actualDeleteCount + insertCount; k--) { deletePropertyOrThrow(O, k - 1); } } else if (insertCount > actualDeleteCount) { for (k = len - actualDeleteCount; k > actualStart; k--) { from = k + actualDeleteCount - 1; to = k + insertCount - 1; if (from in O) { O[to] = O[from]; } - else { delete O[to]; } + else { deletePropertyOrThrow(O, to); } } } for (k = 0; k < insertCount; k++) { @@ -4413,22 +4858,60 @@ var doric = (function (exports) { // https://tc39.es/ecma262/#sec-array.prototype-@@unscopables addToUnscopables('flatMap'); - // eslint-disable-next-line es/no-typed-arrays -- safe + // IE8- + var INCORRECT_RESULT = [].unshift(0) !== 1; + + // V8 ~ Chrome < 71 and Safari <= 15.4, FF < 23 throws InternalError + var SILENT_ON_NON_WRITABLE_LENGTH = !function () { + try { + // eslint-disable-next-line es-x/no-object-defineproperty -- safe + Object.defineProperty([], 'length', { writable: false }).unshift(); + } catch (error) { + return error instanceof TypeError; + } + }(); + + // `Array.prototype.unshift` method + // https://tc39.es/ecma262/#sec-array.prototype.unshift + _export({ target: 'Array', proto: true, arity: 1, forced: INCORRECT_RESULT || SILENT_ON_NON_WRITABLE_LENGTH }, { + // eslint-disable-next-line no-unused-vars -- required for `.length` + unshift: function unshift(item) { + var arguments$1 = arguments; + + var O = toObject(this); + var len = lengthOfArrayLike(O); + var argCount = arguments.length; + if (argCount) { + doesNotExceedSafeInteger(len + argCount); + var k = len; + while (k--) { + var to = k + argCount; + if (k in O) { O[to] = O[k]; } + else { deletePropertyOrThrow(O, to); } + } + for (var j = 0; j < argCount; j++) { + O[j] = arguments$1[j]; + } + } return O.length = len + argCount; + } + }); + + // eslint-disable-next-line es-x/no-typed-arrays -- safe var arrayBufferNative = typeof ArrayBuffer != 'undefined' && typeof DataView != 'undefined'; - var redefineAll = function (target, src, options) { - for (var key in src) { redefine(target, key, src[key], options); } + var defineBuiltIns = function (target, src, options) { + for (var key in src) { defineBuiltIn(target, key, src[key], options); } return target; }; - var TypeError$q = global_1.TypeError; + var $TypeError$n = TypeError; var anInstance = function (it, Prototype) { if (objectIsPrototypeOf(Prototype, it)) { return it; } - throw TypeError$q('Incorrect invocation'); + throw $TypeError$n('Incorrect invocation'); }; - var RangeError$b = global_1.RangeError; + var $RangeError$b = RangeError; // `ToIndex` abstract operation // https://tc39.es/ecma262/#sec-toindex @@ -4436,30 +4919,28 @@ var doric = (function (exports) { if (it === undefined) { return 0; } var number = toIntegerOrInfinity(it); var length = toLength(number); - if (number !== length) { throw RangeError$b('Wrong length or index'); } + if (number !== length) { throw $RangeError$b('Wrong length or index'); } return length; }; // IEEE754 conversions based on https://github.com/feross/ieee754 - - - var Array$6 = global_1.Array; - var abs$7 = Math.abs; - var pow$4 = Math.pow; + var $Array$5 = Array; + var abs$8 = Math.abs; + var pow$5 = Math.pow; var floor$8 = Math.floor; var log$8 = Math.log; var LN2$2 = Math.LN2; var pack = function (number, mantissaLength, bytes) { - var buffer = Array$6(bytes); + var buffer = $Array$5(bytes); var exponentLength = bytes * 8 - mantissaLength - 1; var eMax = (1 << exponentLength) - 1; var eBias = eMax >> 1; - var rt = mantissaLength === 23 ? pow$4(2, -24) - pow$4(2, -77) : 0; + var rt = mantissaLength === 23 ? pow$5(2, -24) - pow$5(2, -77) : 0; var sign = number < 0 || number === 0 && 1 / number < 0 ? 1 : 0; var index = 0; var exponent, mantissa, c; - number = abs$7(number); + number = abs$8(number); // eslint-disable-next-line no-self-compare -- NaN check if (number != number || number === Infinity) { // eslint-disable-next-line no-self-compare -- NaN check @@ -4467,14 +4948,15 @@ var doric = (function (exports) { exponent = eMax; } else { exponent = floor$8(log$8(number) / LN2$2); - if (number * (c = pow$4(2, -exponent)) < 1) { + c = pow$5(2, -exponent); + if (number * c < 1) { exponent--; c *= 2; } if (exponent + eBias >= 1) { number += rt / c; } else { - number += rt * pow$4(2, 1 - eBias); + number += rt * pow$5(2, 1 - eBias); } if (number * c >= 2) { exponent++; @@ -4484,17 +4966,25 @@ var doric = (function (exports) { mantissa = 0; exponent = eMax; } else if (exponent + eBias >= 1) { - mantissa = (number * c - 1) * pow$4(2, mantissaLength); + mantissa = (number * c - 1) * pow$5(2, mantissaLength); exponent = exponent + eBias; } else { - mantissa = number * pow$4(2, eBias - 1) * pow$4(2, mantissaLength); + mantissa = number * pow$5(2, eBias - 1) * pow$5(2, mantissaLength); exponent = 0; } } - for (; mantissaLength >= 8; buffer[index++] = mantissa & 255, mantissa /= 256, mantissaLength -= 8){ } + while (mantissaLength >= 8) { + buffer[index++] = mantissa & 255; + mantissa /= 256; + mantissaLength -= 8; + } exponent = exponent << mantissaLength | mantissa; exponentLength += mantissaLength; - for (; exponentLength > 0; buffer[index++] = exponent & 255, exponent /= 256, exponentLength -= 8){ } + while (exponentLength > 0) { + buffer[index++] = exponent & 255; + exponent /= 256; + exponentLength -= 8; + } buffer[--index] |= sign * 128; return buffer; }; @@ -4510,19 +5000,25 @@ var doric = (function (exports) { var exponent = sign & 127; var mantissa; sign >>= 7; - for (; nBits > 0; exponent = exponent * 256 + buffer[index], index--, nBits -= 8){ } + while (nBits > 0) { + exponent = exponent * 256 + buffer[index--]; + nBits -= 8; + } mantissa = exponent & (1 << -nBits) - 1; exponent >>= -nBits; nBits += mantissaLength; - for (; nBits > 0; mantissa = mantissa * 256 + buffer[index], index--, nBits -= 8){ } + while (nBits > 0) { + mantissa = mantissa * 256 + buffer[index--]; + nBits -= 8; + } if (exponent === 0) { exponent = 1 - eBias; } else if (exponent === eMax) { return mantissa ? NaN : sign ? -Infinity : Infinity; } else { - mantissa = mantissa + pow$4(2, mantissaLength); + mantissa = mantissa + pow$5(2, mantissaLength); exponent = exponent - eBias; - } return (sign ? -1 : 1) * mantissa * pow$4(2, exponent - mantissaLength); + } return (sign ? -1 : 1) * mantissa * pow$5(2, exponent - mantissaLength); }; var ieee754 = { @@ -4531,16 +5027,16 @@ var doric = (function (exports) { }; var getOwnPropertyNames$3 = objectGetOwnPropertyNames.f; - var defineProperty$b = objectDefineProperty.f; + var defineProperty$8 = objectDefineProperty.f; - var PROPER_FUNCTION_NAME$3 = functionName.PROPER; + var PROPER_FUNCTION_NAME$2 = functionName.PROPER; var CONFIGURABLE_FUNCTION_NAME = functionName.CONFIGURABLE; - var getInternalState$e = internalState.get; - var setInternalState$f = internalState.set; + var getInternalState$d = internalState.get; + var setInternalState$g = internalState.set; var ARRAY_BUFFER$1 = 'ArrayBuffer'; var DATA_VIEW = 'DataView'; var PROTOTYPE = 'prototype'; @@ -4552,8 +5048,8 @@ var doric = (function (exports) { var $DataView = global_1[DATA_VIEW]; var DataViewPrototype$1 = $DataView && $DataView[PROTOTYPE]; var ObjectPrototype$2 = Object.prototype; - var Array$5 = global_1.Array; - var RangeError$a = global_1.RangeError; + var Array$2 = global_1.Array; + var RangeError$3 = global_1.RangeError; var fill = functionUncurryThis(arrayFill); var reverse = functionUncurryThis([].reverse); @@ -4585,24 +5081,24 @@ var doric = (function (exports) { }; var addGetter = function (Constructor, key) { - defineProperty$b(Constructor[PROTOTYPE], key, { get: function () { return getInternalState$e(this)[key]; } }); + defineProperty$8(Constructor[PROTOTYPE], key, { get: function () { return getInternalState$d(this)[key]; } }); }; var get$1 = function (view, count, index, isLittleEndian) { var intIndex = toIndex(index); - var store = getInternalState$e(view); - if (intIndex + count > store.byteLength) { throw RangeError$a(WRONG_INDEX); } - var bytes = getInternalState$e(store.buffer).bytes; + var store = getInternalState$d(view); + if (intIndex + count > store.byteLength) { throw RangeError$3(WRONG_INDEX); } + var bytes = getInternalState$d(store.buffer).bytes; var start = intIndex + store.byteOffset; - var pack = arraySlice$1(bytes, start, start + count); + var pack = arraySliceSimple(bytes, start, start + count); return isLittleEndian ? pack : reverse(pack); }; var set$2 = function (view, count, index, conversion, value, isLittleEndian) { var intIndex = toIndex(index); - var store = getInternalState$e(view); - if (intIndex + count > store.byteLength) { throw RangeError$a(WRONG_INDEX); } - var bytes = getInternalState$e(store.buffer).bytes; + var store = getInternalState$d(view); + if (intIndex + count > store.byteLength) { throw RangeError$3(WRONG_INDEX); } + var bytes = getInternalState$d(store.buffer).bytes; var start = intIndex + store.byteOffset; var pack = conversion(+value); for (var i = 0; i < count; i++) { bytes[start + i] = pack[isLittleEndian ? i : count - i - 1]; } @@ -4612,8 +5108,8 @@ var doric = (function (exports) { $ArrayBuffer = function ArrayBuffer(length) { anInstance(this, ArrayBufferPrototype); var byteLength = toIndex(length); - setInternalState$f(this, { - bytes: fill(Array$5(byteLength), 0), + setInternalState$g(this, { + bytes: fill(Array$2(byteLength), 0), byteLength: byteLength }); if (!descriptors) { this.byteLength = byteLength; } @@ -4624,12 +5120,12 @@ var doric = (function (exports) { $DataView = function DataView(buffer, byteOffset, byteLength) { anInstance(this, DataViewPrototype$1); anInstance(buffer, ArrayBufferPrototype); - var bufferLength = getInternalState$e(buffer).byteLength; + var bufferLength = getInternalState$d(buffer).byteLength; var offset = toIntegerOrInfinity(byteOffset); - if (offset < 0 || offset > bufferLength) { throw RangeError$a('Wrong offset'); } + if (offset < 0 || offset > bufferLength) { throw RangeError$3('Wrong offset'); } byteLength = byteLength === undefined ? bufferLength - offset : toLength(byteLength); - if (offset + byteLength > bufferLength) { throw RangeError$a(WRONG_LENGTH); } - setInternalState$f(this, { + if (offset + byteLength > bufferLength) { throw RangeError$3(WRONG_LENGTH); } + setInternalState$g(this, { buffer: buffer, byteLength: byteLength, byteOffset: offset @@ -4650,7 +5146,7 @@ var doric = (function (exports) { addGetter($DataView, 'byteOffset'); } - redefineAll(DataViewPrototype$1, { + defineBuiltIns(DataViewPrototype$1, { getInt8: function getInt8(byteOffset) { return get$1(this, 1, byteOffset)[0] << 24 >> 24; }, @@ -4703,7 +5199,7 @@ var doric = (function (exports) { } }); } else { - var INCORRECT_ARRAY_BUFFER_NAME = PROPER_FUNCTION_NAME$3 && NativeArrayBuffer$1.name !== ARRAY_BUFFER$1; + var INCORRECT_ARRAY_BUFFER_NAME = PROPER_FUNCTION_NAME$2 && NativeArrayBuffer$1.name !== ARRAY_BUFFER$1; /* eslint-disable no-new -- required for testing */ if (!fails(function () { NativeArrayBuffer$1(1); @@ -4723,9 +5219,9 @@ var doric = (function (exports) { $ArrayBuffer[PROTOTYPE] = ArrayBufferPrototype; - for (var keys$2 = getOwnPropertyNames$3(NativeArrayBuffer$1), j$1 = 0, key$1; keys$2.length > j$1;) { - if (!((key$1 = keys$2[j$1++]) in $ArrayBuffer)) { - createNonEnumerableProperty($ArrayBuffer, key$1, NativeArrayBuffer$1[key$1]); + for (var keys$2 = getOwnPropertyNames$3(NativeArrayBuffer$1), j$1 = 0, key$3; keys$2.length > j$1;) { + if (!((key$3 = keys$2[j$1++]) in $ArrayBuffer)) { + createNonEnumerableProperty($ArrayBuffer, key$3, NativeArrayBuffer$1[key$3]); } } @@ -4744,7 +5240,7 @@ var doric = (function (exports) { var $setInt8 = functionUncurryThis(DataViewPrototype$1.setInt8); testView.setInt8(0, 2147483648); testView.setInt8(1, 2147483649); - if (testView.getInt8(0) || !testView.getInt8(1)) { redefineAll(DataViewPrototype$1, { + if (testView.getInt8(0) || !testView.getInt8(1)) { defineBuiltIns(DataViewPrototype$1, { setInt8: function setInt8(byteOffset, value) { $setInt8(this, byteOffset, value << 24 >> 24); }, @@ -4768,34 +5264,34 @@ var doric = (function (exports) { // `ArrayBuffer` constructor // https://tc39.es/ecma262/#sec-arraybuffer-constructor - _export({ global: true, forced: NativeArrayBuffer !== ArrayBuffer$3 }, { + _export({ global: true, constructor: true, forced: NativeArrayBuffer !== ArrayBuffer$3 }, { ArrayBuffer: ArrayBuffer$3 }); setSpecies(ARRAY_BUFFER); - var defineProperty$a = objectDefineProperty.f; + var defineProperty$7 = objectDefineProperty.f; - var Int8Array$3 = global_1.Int8Array; - var Int8ArrayPrototype = Int8Array$3 && Int8Array$3.prototype; - var Uint8ClampedArray = global_1.Uint8ClampedArray; - var Uint8ClampedArrayPrototype = Uint8ClampedArray && Uint8ClampedArray.prototype; - var TypedArray = Int8Array$3 && objectGetPrototypeOf(Int8Array$3); - var TypedArrayPrototype = Int8ArrayPrototype && objectGetPrototypeOf(Int8ArrayPrototype); + var Int8Array$4 = global_1.Int8Array; + var Int8ArrayPrototype$1 = Int8Array$4 && Int8Array$4.prototype; + var Uint8ClampedArray$1 = global_1.Uint8ClampedArray; + var Uint8ClampedArrayPrototype = Uint8ClampedArray$1 && Uint8ClampedArray$1.prototype; + var TypedArray = Int8Array$4 && objectGetPrototypeOf(Int8Array$4); + var TypedArrayPrototype$1 = Int8ArrayPrototype$1 && objectGetPrototypeOf(Int8ArrayPrototype$1); var ObjectPrototype$1 = Object.prototype; - var TypeError$p = global_1.TypeError; + var TypeError$6 = global_1.TypeError; var TO_STRING_TAG$5 = wellKnownSymbol('toStringTag'); var TYPED_ARRAY_TAG = uid('TYPED_ARRAY_TAG'); - var TYPED_ARRAY_CONSTRUCTOR$1 = uid('TYPED_ARRAY_CONSTRUCTOR'); + var TYPED_ARRAY_CONSTRUCTOR$5 = uid('TYPED_ARRAY_CONSTRUCTOR'); // Fixing native typed arrays in Opera Presto crashes the browser, see #595 var NATIVE_ARRAY_BUFFER_VIEWS$2 = arrayBufferNative && !!objectSetPrototypeOf && classof(global_1.opera) !== 'Opera'; - var TYPED_ARRAY_TAG_REQIRED = false; + var TYPED_ARRAY_TAG_REQUIRED = false; var NAME$1, Constructor, Prototype; var TypedArrayConstructorsList = { @@ -4830,27 +5326,32 @@ var doric = (function (exports) { || hasOwnProperty_1(BigIntArrayConstructorsList, klass); }; - var aTypedArray$t = function (it) { + var aTypedArray$x = function (it) { if (isTypedArray(it)) { return it; } - throw TypeError$p('Target is not a typed array'); + throw TypeError$6('Target is not a typed array'); }; var aTypedArrayConstructor$4 = function (C) { if (isCallable(C) && (!objectSetPrototypeOf || objectIsPrototypeOf(TypedArray, C))) { return C; } - throw TypeError$p(tryToString(C) + ' is not a typed array constructor'); + throw TypeError$6(tryToString(C) + ' is not a typed array constructor'); }; - var exportTypedArrayMethod$u = function (KEY, property, forced) { + var exportTypedArrayMethod$y = function (KEY, property, forced, options) { if (!descriptors) { return; } if (forced) { for (var ARRAY in TypedArrayConstructorsList) { var TypedArrayConstructor = global_1[ARRAY]; if (TypedArrayConstructor && hasOwnProperty_1(TypedArrayConstructor.prototype, KEY)) { try { delete TypedArrayConstructor.prototype[KEY]; - } catch (error) { /* empty */ } } + } catch (error) { + // old WebKit bug - some methods are non-configurable + try { + TypedArrayConstructor.prototype[KEY] = property; + } catch (error2) { /* empty */ } + } } } } - if (!TypedArrayPrototype[KEY] || forced) { - redefine(TypedArrayPrototype, KEY, forced ? property - : NATIVE_ARRAY_BUFFER_VIEWS$2 && Int8ArrayPrototype[KEY] || property); + if (!TypedArrayPrototype$1[KEY] || forced) { + defineBuiltIn(TypedArrayPrototype$1, KEY, forced ? property + : NATIVE_ARRAY_BUFFER_VIEWS$2 && Int8ArrayPrototype$1[KEY] || property, options); } }; @@ -4867,14 +5368,14 @@ var doric = (function (exports) { if (!TypedArray[KEY] || forced) { // V8 ~ Chrome 49-50 `%TypedArray%` methods are non-writable non-configurable try { - return redefine(TypedArray, KEY, forced ? property : NATIVE_ARRAY_BUFFER_VIEWS$2 && TypedArray[KEY] || property); + return defineBuiltIn(TypedArray, KEY, forced ? property : NATIVE_ARRAY_BUFFER_VIEWS$2 && TypedArray[KEY] || property); } catch (error$1) { /* empty */ } } else { return; } } for (ARRAY in TypedArrayConstructorsList) { TypedArrayConstructor = global_1[ARRAY]; if (TypedArrayConstructor && (!TypedArrayConstructor[KEY] || forced)) { - redefine(TypedArrayConstructor, KEY, property); + defineBuiltIn(TypedArrayConstructor, KEY, property); } } }; @@ -4882,42 +5383,42 @@ var doric = (function (exports) { for (NAME$1 in TypedArrayConstructorsList) { Constructor = global_1[NAME$1]; Prototype = Constructor && Constructor.prototype; - if (Prototype) { createNonEnumerableProperty(Prototype, TYPED_ARRAY_CONSTRUCTOR$1, Constructor); } + if (Prototype) { createNonEnumerableProperty(Prototype, TYPED_ARRAY_CONSTRUCTOR$5, Constructor); } else { NATIVE_ARRAY_BUFFER_VIEWS$2 = false; } } for (NAME$1 in BigIntArrayConstructorsList) { Constructor = global_1[NAME$1]; Prototype = Constructor && Constructor.prototype; - if (Prototype) { createNonEnumerableProperty(Prototype, TYPED_ARRAY_CONSTRUCTOR$1, Constructor); } + if (Prototype) { createNonEnumerableProperty(Prototype, TYPED_ARRAY_CONSTRUCTOR$5, Constructor); } } // WebKit bug - typed arrays constructors prototype is Object.prototype if (!NATIVE_ARRAY_BUFFER_VIEWS$2 || !isCallable(TypedArray) || TypedArray === Function.prototype) { // eslint-disable-next-line no-shadow -- safe TypedArray = function TypedArray() { - throw TypeError$p('Incorrect invocation'); + throw TypeError$6('Incorrect invocation'); }; if (NATIVE_ARRAY_BUFFER_VIEWS$2) { for (NAME$1 in TypedArrayConstructorsList) { if (global_1[NAME$1]) { objectSetPrototypeOf(global_1[NAME$1], TypedArray); } } } } - if (!NATIVE_ARRAY_BUFFER_VIEWS$2 || !TypedArrayPrototype || TypedArrayPrototype === ObjectPrototype$1) { - TypedArrayPrototype = TypedArray.prototype; + if (!NATIVE_ARRAY_BUFFER_VIEWS$2 || !TypedArrayPrototype$1 || TypedArrayPrototype$1 === ObjectPrototype$1) { + TypedArrayPrototype$1 = TypedArray.prototype; if (NATIVE_ARRAY_BUFFER_VIEWS$2) { for (NAME$1 in TypedArrayConstructorsList) { - if (global_1[NAME$1]) { objectSetPrototypeOf(global_1[NAME$1].prototype, TypedArrayPrototype); } + if (global_1[NAME$1]) { objectSetPrototypeOf(global_1[NAME$1].prototype, TypedArrayPrototype$1); } } } } // WebKit bug - one more object in Uint8ClampedArray prototype chain - if (NATIVE_ARRAY_BUFFER_VIEWS$2 && objectGetPrototypeOf(Uint8ClampedArrayPrototype) !== TypedArrayPrototype) { - objectSetPrototypeOf(Uint8ClampedArrayPrototype, TypedArrayPrototype); + if (NATIVE_ARRAY_BUFFER_VIEWS$2 && objectGetPrototypeOf(Uint8ClampedArrayPrototype) !== TypedArrayPrototype$1) { + objectSetPrototypeOf(Uint8ClampedArrayPrototype, TypedArrayPrototype$1); } - if (descriptors && !hasOwnProperty_1(TypedArrayPrototype, TO_STRING_TAG$5)) { - TYPED_ARRAY_TAG_REQIRED = true; - defineProperty$a(TypedArrayPrototype, TO_STRING_TAG$5, { get: function () { + if (descriptors && !hasOwnProperty_1(TypedArrayPrototype$1, TO_STRING_TAG$5)) { + TYPED_ARRAY_TAG_REQUIRED = true; + defineProperty$7(TypedArrayPrototype$1, TO_STRING_TAG$5, { get: function () { return isObject(this) ? this[TYPED_ARRAY_TAG] : undefined; } }); for (NAME$1 in TypedArrayConstructorsList) { if (global_1[NAME$1]) { @@ -4927,16 +5428,16 @@ var doric = (function (exports) { var arrayBufferViewCore = { NATIVE_ARRAY_BUFFER_VIEWS: NATIVE_ARRAY_BUFFER_VIEWS$2, - TYPED_ARRAY_CONSTRUCTOR: TYPED_ARRAY_CONSTRUCTOR$1, - TYPED_ARRAY_TAG: TYPED_ARRAY_TAG_REQIRED && TYPED_ARRAY_TAG, - aTypedArray: aTypedArray$t, + TYPED_ARRAY_CONSTRUCTOR: TYPED_ARRAY_CONSTRUCTOR$5, + TYPED_ARRAY_TAG: TYPED_ARRAY_TAG_REQUIRED && TYPED_ARRAY_TAG, + aTypedArray: aTypedArray$x, aTypedArrayConstructor: aTypedArrayConstructor$4, - exportTypedArrayMethod: exportTypedArrayMethod$u, + exportTypedArrayMethod: exportTypedArrayMethod$y, exportTypedArrayStaticMethod: exportTypedArrayStaticMethod$3, isView: isView, isTypedArray: isTypedArray, TypedArray: TypedArray, - TypedArrayPrototype: TypedArrayPrototype + TypedArrayPrototype: TypedArrayPrototype$1 }; var NATIVE_ARRAY_BUFFER_VIEWS$1 = arrayBufferViewCore.NATIVE_ARRAY_BUFFER_VIEWS; @@ -4947,12 +5448,12 @@ var doric = (function (exports) { isView: arrayBufferViewCore.isView }); - var TypeError$o = global_1.TypeError; + var $TypeError$m = TypeError; // `Assert: IsConstructor(argument) is true` var aConstructor = function (argument) { if (isConstructor(argument)) { return argument; } - throw TypeError$o(tryToString(argument) + ' is not a constructor'); + throw $TypeError$m(tryToString(argument) + ' is not a constructor'); }; var SPECIES$2 = wellKnownSymbol('species'); @@ -4998,11 +5499,11 @@ var doric = (function (exports) { // `DataView` constructor // https://tc39.es/ecma262/#sec-dataview-constructor - _export({ global: true, forced: !arrayBufferNative }, { + _export({ global: true, constructor: true, forced: !arrayBufferNative }, { DataView: arrayBuffer.DataView }); - var FORCED$n = fails(function () { + var FORCED$h = fails(function () { return new Date(16e11).getYear() !== 120; }); @@ -5010,25 +5511,29 @@ var doric = (function (exports) { // `Date.prototype.getYear` method // https://tc39.es/ecma262/#sec-date.prototype.getyear - _export({ target: 'Date', proto: true, forced: FORCED$n }, { + _export({ target: 'Date', proto: true, forced: FORCED$h }, { getYear: function getYear() { return getFullYear(this) - 1900; } }); - var Date$1 = global_1.Date; - var getTime$3 = functionUncurryThis(Date$1.prototype.getTime); + // TODO: Remove from `core-js@4` + + + + var $Date = Date; + var getTime$4 = functionUncurryThis($Date.prototype.getTime); // `Date.now` method // https://tc39.es/ecma262/#sec-date.now _export({ target: 'Date', stat: true }, { now: function now() { - return getTime$3(new Date$1()); + return getTime$4(new $Date()); } }); var DatePrototype$3 = Date.prototype; - var getTime$2 = functionUncurryThis(DatePrototype$3.getTime); + var getTime$3 = functionUncurryThis(DatePrototype$3.getTime); var setFullYear = functionUncurryThis(DatePrototype$3.setFullYear); // `Date.prototype.setYear` method @@ -5036,7 +5541,7 @@ var doric = (function (exports) { _export({ target: 'Date', proto: true }, { setYear: function setYear(year) { // validate - getTime$2(this); + getTime$3(this); var yi = toIntegerOrInfinity(year); var yyyy = 0 <= yi && yi <= 99 ? yi + 1900 : yi; return setFullYear(this, yyyy); @@ -5049,7 +5554,7 @@ var doric = (function (exports) { toGMTString: Date.prototype.toUTCString }); - var RangeError$9 = global_1.RangeError; + var $RangeError$a = RangeError; // `String.prototype.repeat` method implementation // https://tc39.es/ecma262/#sec-string.prototype.repeat @@ -5057,7 +5562,7 @@ var doric = (function (exports) { var str = toString_1(requireObjectCoercible(this)); var result = ''; var n = toIntegerOrInfinity(count); - if (n < 0 || n == Infinity) { throw RangeError$9('Wrong number of repetitions'); } + if (n < 0 || n == Infinity) { throw $RangeError$a('Wrong number of repetitions'); } for (;n > 0; (n >>>= 1) && (str += str)) { if (n & 1) { result += str; } } return result; }; @@ -5069,12 +5574,12 @@ var doric = (function (exports) { - var repeat$1 = functionUncurryThis(stringRepeat); - var stringSlice$e = functionUncurryThis(''.slice); - var ceil$1 = Math.ceil; + var repeat$2 = functionUncurryThis(stringRepeat); + var stringSlice$f = functionUncurryThis(''.slice); + var ceil = Math.ceil; // `String.prototype.{ padStart, padEnd }` methods implementation - var createMethod$5 = function (IS_END) { + var createMethod$4 = function (IS_END) { return function ($this, maxLength, fillString) { var S = toString_1(requireObjectCoercible($this)); var intMaxLength = toLength(maxLength); @@ -5083,8 +5588,8 @@ var doric = (function (exports) { var fillLen, stringFiller; if (intMaxLength <= stringLength || fillStr == '') { return S; } fillLen = intMaxLength - stringLength; - stringFiller = repeat$1(fillStr, ceil$1(fillLen / fillStr.length)); - if (stringFiller.length > fillLen) { stringFiller = stringSlice$e(stringFiller, 0, fillLen); } + stringFiller = repeat$2(fillStr, ceil(fillLen / fillStr.length)); + if (stringFiller.length > fillLen) { stringFiller = stringSlice$f(stringFiller, 0, fillLen); } return IS_END ? S + stringFiller : stringFiller + S; }; }; @@ -5092,19 +5597,19 @@ var doric = (function (exports) { var stringPad = { // `String.prototype.padStart` method // https://tc39.es/ecma262/#sec-string.prototype.padstart - start: createMethod$5(false), + start: createMethod$4(false), // `String.prototype.padEnd` method // https://tc39.es/ecma262/#sec-string.prototype.padend - end: createMethod$5(true) + end: createMethod$4(true) }; var padStart = stringPad.start; - var RangeError$8 = global_1.RangeError; - var abs$6 = Math.abs; + var $RangeError$9 = RangeError; + var abs$7 = Math.abs; var DatePrototype$2 = Date.prototype; var n$DateToISOString = DatePrototype$2.toISOString; - var getTime$1 = functionUncurryThis(DatePrototype$2.getTime); + var getTime$2 = functionUncurryThis(DatePrototype$2.getTime); var getUTCDate = functionUncurryThis(DatePrototype$2.getUTCDate); var getUTCFullYear = functionUncurryThis(DatePrototype$2.getUTCFullYear); var getUTCHours = functionUncurryThis(DatePrototype$2.getUTCHours); @@ -5121,12 +5626,12 @@ var doric = (function (exports) { }) || !fails(function () { n$DateToISOString.call(new Date(NaN)); })) ? function toISOString() { - if (!isFinite(getTime$1(this))) { throw RangeError$8('Invalid time value'); } + if (!isFinite(getTime$2(this))) { throw $RangeError$9('Invalid time value'); } var date = this; var year = getUTCFullYear(date); var milliseconds = getUTCMilliseconds(date); var sign = year < 0 ? '-' : year > 9999 ? '+' : ''; - return sign + padStart(abs$6(year), sign ? 6 : 4, 0) + + return sign + padStart(abs$7(year), sign ? 6 : 4, 0) + '-' + padStart(getUTCMonth(date) + 1, 2, 0) + '-' + padStart(getUTCDate(date), 2, 0) + 'T' + padStart(getUTCHours(date), 2, 0) + @@ -5143,14 +5648,14 @@ var doric = (function (exports) { toISOString: dateToIsoString }); - var FORCED$m = fails(function () { + var FORCED$g = fails(function () { return new Date(NaN).toJSON() !== null || Date.prototype.toJSON.call({ toISOString: function () { return 1; } }) !== 1; }); // `Date.prototype.toJSON` method // https://tc39.es/ecma262/#sec-date.prototype.tojson - _export({ target: 'Date', proto: true, forced: FORCED$m }, { + _export({ target: 'Date', proto: true, arity: 1, forced: FORCED$g }, { // eslint-disable-next-line no-unused-vars -- required for `.length` toJSON: function toJSON(key) { var O = toObject(this); @@ -5159,14 +5664,14 @@ var doric = (function (exports) { } }); - var TypeError$n = global_1.TypeError; + var $TypeError$l = TypeError; // `Date.prototype[@@toPrimitive](hint)` method implementation // https://tc39.es/ecma262/#sec-date.prototype-@@toprimitive var dateToPrimitive = function (hint) { anObject(this); if (hint === 'string' || hint === 'default') { hint = 'string'; } - else if (hint !== 'number') { throw TypeError$n('Incorrect hint'); } + else if (hint !== 'number') { throw $TypeError$l('Incorrect hint'); } return ordinaryToPrimitive(this, hint); }; @@ -5176,35 +5681,39 @@ var doric = (function (exports) { // `Date.prototype[@@toPrimitive]` method // https://tc39.es/ecma262/#sec-date.prototype-@@toprimitive if (!hasOwnProperty_1(DatePrototype$1, TO_PRIMITIVE)) { - redefine(DatePrototype$1, TO_PRIMITIVE, dateToPrimitive); + defineBuiltIn(DatePrototype$1, TO_PRIMITIVE, dateToPrimitive); } + // TODO: Remove from `core-js@4` + + + var DatePrototype = Date.prototype; var INVALID_DATE = 'Invalid Date'; var TO_STRING$1 = 'toString'; var un$DateToString = functionUncurryThis(DatePrototype[TO_STRING$1]); - var getTime = functionUncurryThis(DatePrototype.getTime); + var getTime$1 = functionUncurryThis(DatePrototype.getTime); // `Date.prototype.toString` method // https://tc39.es/ecma262/#sec-date.prototype.tostring if (String(new Date(NaN)) != INVALID_DATE) { - redefine(DatePrototype, TO_STRING$1, function toString() { - var value = getTime(this); + defineBuiltIn(DatePrototype, TO_STRING$1, function toString() { + var value = getTime$1(this); // eslint-disable-next-line no-self-compare -- NaN check return value === value ? un$DateToString(this) : INVALID_DATE; }); } - var charAt$f = functionUncurryThis(''.charAt); + var charAt$g = functionUncurryThis(''.charAt); var charCodeAt$4 = functionUncurryThis(''.charCodeAt); - var exec$8 = functionUncurryThis(/./.exec); - var numberToString$3 = functionUncurryThis(1.0.toString); + var exec$9 = functionUncurryThis(/./.exec); + var numberToString$2 = functionUncurryThis(1.0.toString); var toUpperCase = functionUncurryThis(''.toUpperCase); var raw = /[\w*+\-./@]/; var hex$1 = function (code, length) { - var result = numberToString$3(code, 16); + var result = numberToString$2(code, 16); while (result.length < length) { result = '0' + result; } return result; }; @@ -5219,8 +5728,8 @@ var doric = (function (exports) { var index = 0; var chr, code; while (index < length) { - chr = charAt$f(str, index++); - if (exec$8(raw, chr)) { + chr = charAt$g(str, index++); + if (exec$9(raw, chr)) { result += chr; } else { code = charCodeAt$4(chr, 0); @@ -5234,21 +5743,21 @@ var doric = (function (exports) { } }); - var Function$3 = global_1.Function; + var $Function = Function; var concat$3 = functionUncurryThis([].concat); - var join$6 = functionUncurryThis([].join); + var join$7 = functionUncurryThis([].join); var factories = {}; var construct = function (C, argsLength, args) { if (!hasOwnProperty_1(factories, argsLength)) { for (var list = [], i = 0; i < argsLength; i++) { list[i] = 'a[' + i + ']'; } - factories[argsLength] = Function$3('C,a', 'return new C(' + join$6(list, ',') + ')'); + factories[argsLength] = $Function('C,a', 'return new C(' + join$7(list, ',') + ')'); } return factories[argsLength](C, args); }; // `Function.prototype.bind` method implementation // https://tc39.es/ecma262/#sec-function.prototype.bind - var functionBind = Function$3.bind || function bind(that /* , ...args */) { + var functionBind = functionBindNative ? $Function.bind : function bind(that /* , ...args */) { var F = aCallable(this); var Prototype = F.prototype; var partArgs = arraySlice$1(arguments, 1); @@ -5260,9 +5769,13 @@ var doric = (function (exports) { return boundFunction; }; + // TODO: Remove from `core-js@4` + + + // `Function.prototype.bind` method // https://tc39.es/ecma262/#sec-function.prototype.bind - _export({ target: 'Function', proto: true }, { + _export({ target: 'Function', proto: true, forced: Function.bind !== functionBind }, { bind: functionBind }); @@ -5272,30 +5785,30 @@ var doric = (function (exports) { // `Function.prototype[@@hasInstance]` method // https://tc39.es/ecma262/#sec-function.prototype-@@hasinstance if (!(HAS_INSTANCE in FunctionPrototype$1)) { - objectDefineProperty.f(FunctionPrototype$1, HAS_INSTANCE, { value: function (O) { + objectDefineProperty.f(FunctionPrototype$1, HAS_INSTANCE, { value: makeBuiltIn_1(function (O) { if (!isCallable(this) || !isObject(O)) { return false; } var P = this.prototype; if (!isObject(P)) { return O instanceof this; } // for environment w/o native `@@hasInstance` logic enough `instanceof`, but add this: while (O = objectGetPrototypeOf(O)) { if (P === O) { return true; } } return false; - } }); + }, HAS_INSTANCE) }); } var FUNCTION_NAME_EXISTS = functionName.EXISTS; - var defineProperty$9 = objectDefineProperty.f; + var defineProperty$6 = objectDefineProperty.f; var FunctionPrototype = Function.prototype; var functionToString = functionUncurryThis(FunctionPrototype.toString); - var nameRE = /^\s*function ([^ (]*)/; + var nameRE = /function\b(?:\s|\/\*[\S\s]*?\*\/|\/\/[^\n\r]*[\n\r]+)*([^\s(/]*)/; var regExpExec = functionUncurryThis(nameRE.exec); var NAME = 'name'; // Function instances `.name` property // https://tc39.es/ecma262/#sec-function-instances-name if (descriptors && !FUNCTION_NAME_EXISTS) { - defineProperty$9(FunctionPrototype, NAME, { + defineProperty$6(FunctionPrototype, NAME, { configurable: true, get: function () { try { @@ -5313,53 +5826,35 @@ var doric = (function (exports) { globalThis: global_1 }); - var Array$4 = global_1.Array; - var $stringify = getBuiltIn('JSON', 'stringify'); - var exec$7 = functionUncurryThis(/./.exec); - var charAt$e = functionUncurryThis(''.charAt); - var charCodeAt$3 = functionUncurryThis(''.charCodeAt); - var replace$8 = functionUncurryThis(''.replace); - var numberToString$2 = functionUncurryThis(1.0.toString); - - var tester = /[\uD800-\uDFFF]/g; - var low = /^[\uD800-\uDBFF]$/; - var hi = /^[\uDC00-\uDFFF]$/; - - var fix = function (match, offset, string) { - var prev = charAt$e(string, offset - 1); - var next = charAt$e(string, offset + 1); - if ((exec$7(low, match) && !exec$7(hi, next)) || (exec$7(hi, match) && !exec$7(low, prev))) { - return '\\u' + numberToString$2(charCodeAt$3(match, 0), 16); - } return match; - }; - - var FORCED$l = fails(function () { - return $stringify('\uDF06\uD834') !== '"\\udf06\\ud834"' - || $stringify('\uDEAD') !== '"\\udead"'; - }); - - if ($stringify) { - // `JSON.stringify` method - // https://tc39.es/ecma262/#sec-json.stringify - // https://github.com/tc39/proposal-well-formed-stringify - _export({ target: 'JSON', stat: true, forced: FORCED$l }, { - // eslint-disable-next-line no-unused-vars -- required for `.length` - stringify: function stringify(it, replacer, space) { - var arguments$1 = arguments; - - for (var i = 0, l = arguments.length, args = Array$4(l); i < l; i++) { args[i] = arguments$1[i]; } - var result = functionApply($stringify, null, args); - return typeof result == 'string' ? replace$8(result, tester, fix) : result; - } - }); - } - // JSON[@@toStringTag] property // https://tc39.es/ecma262/#sec-json-@@tostringtag setToStringTag(global_1.JSON, 'JSON', true); + // FF26- bug: ArrayBuffers are non-extensible, but Object.isExtensible does not report it + + + var arrayBufferNonExtensible = fails(function () { + if (typeof ArrayBuffer == 'function') { + var buffer = new ArrayBuffer(8); + // eslint-disable-next-line es-x/no-object-isextensible, es-x/no-object-defineproperty -- safe + if (Object.isExtensible(buffer)) { Object.defineProperty(buffer, 'a', { value: 8 }); } + } + }); + + // eslint-disable-next-line es-x/no-object-isextensible -- safe + var $isExtensible = Object.isExtensible; + var FAILS_ON_PRIMITIVES$9 = fails(function () { $isExtensible(1); }); + + // `Object.isExtensible` method + // https://tc39.es/ecma262/#sec-object.isextensible + var objectIsExtensible = (FAILS_ON_PRIMITIVES$9 || arrayBufferNonExtensible) ? function isExtensible(it) { + if (!isObject(it)) { return false; } + if (arrayBufferNonExtensible && classofRaw(it) == 'ArrayBuffer') { return false; } + return $isExtensible ? $isExtensible(it) : true; + } : $isExtensible; + var freezing = !fails(function () { - // eslint-disable-next-line es/no-object-isextensible, es/no-object-preventextensions -- required for testing + // eslint-disable-next-line es-x/no-object-isextensible, es-x/no-object-preventextensions -- required for testing return Object.isExtensible(Object.preventExtensions({})); }); @@ -5370,15 +5865,11 @@ var doric = (function (exports) { + var REQUIRED = false; var METADATA = uid('meta'); var id = 0; - // eslint-disable-next-line es/no-object-isextensible -- safe - var isExtensible = Object.isExtensible || function () { - return true; - }; - var setMetadata = function (it) { defineProperty(it, METADATA, { value: { objectID: 'O' + id++, // object ID @@ -5391,7 +5882,7 @@ var doric = (function (exports) { if (!isObject(it)) { return typeof it == 'symbol' ? it : (typeof it == 'string' ? 'S' : 'P') + it; } if (!hasOwnProperty_1(it, METADATA)) { // can't set metadata to uncaught frozen object - if (!isExtensible(it)) { return 'F'; } + if (!objectIsExtensible(it)) { return 'F'; } // not necessary to add metadata if (!create) { return 'E'; } // add missing metadata @@ -5403,7 +5894,7 @@ var doric = (function (exports) { var getWeakData = function (it, create) { if (!hasOwnProperty_1(it, METADATA)) { // can't set metadata to uncaught frozen object - if (!isExtensible(it)) { return true; } + if (!objectIsExtensible(it)) { return true; } // not necessary to add metadata if (!create) { return false; } // add missing metadata @@ -5414,7 +5905,7 @@ var doric = (function (exports) { // add metadata on freeze-family methods calling var onFreeze = function (it) { - if (freezing && REQUIRED && isExtensible(it) && !hasOwnProperty_1(it, METADATA)) { setMetadata(it); } + if (freezing && REQUIRED && objectIsExtensible(it) && !hasOwnProperty_1(it, METADATA)) { setMetadata(it); } return it; }; @@ -5454,21 +5945,6 @@ var doric = (function (exports) { hiddenKeys$1[METADATA] = true; }); - // makes subclassing work correct for wrapped built-ins - var inheritIfRequired = function ($this, dummy, Wrapper) { - var NewTarget, NewTargetPrototype; - if ( - // it can work only with native `setPrototypeOf` - objectSetPrototypeOf && - // we haven't completely correct pre-ES6 way for getting `new.target`, so use this - isCallable(NewTarget = dummy.constructor) && - NewTarget !== Wrapper && - isObject(NewTargetPrototype = NewTarget.prototype) && - NewTargetPrototype !== Wrapper.prototype - ) { objectSetPrototypeOf($this, NewTargetPrototype); } - return $this; - }; - var collection = function (CONSTRUCTOR_NAME, wrapper, common) { var IS_MAP = CONSTRUCTOR_NAME.indexOf('Map') !== -1; var IS_WEAK = CONSTRUCTOR_NAME.indexOf('Weak') !== -1; @@ -5480,7 +5956,7 @@ var doric = (function (exports) { var fixMethod = function (KEY) { var uncurriedNativeMethod = functionUncurryThis(NativePrototype[KEY]); - redefine(NativePrototype, KEY, + defineBuiltIn(NativePrototype, KEY, KEY == 'add' ? function add(value) { uncurriedNativeMethod(this, value === 0 ? 0 : value); return this; @@ -5550,7 +6026,7 @@ var doric = (function (exports) { } exported[CONSTRUCTOR_NAME] = Constructor; - _export({ global: true, forced: Constructor != NativeConstructor }, exported); + _export({ global: true, constructor: true, forced: Constructor != NativeConstructor }, exported); setToStringTag(Constructor, CONSTRUCTOR_NAME); @@ -5559,7 +6035,7 @@ var doric = (function (exports) { return Constructor; }; - var defineProperty$8 = objectDefineProperty.f; + var defineProperty$5 = objectDefineProperty.f; @@ -5571,14 +6047,14 @@ var doric = (function (exports) { var fastKey = internalMetadata.fastKey; - var setInternalState$e = internalState.set; + var setInternalState$f = internalState.set; var internalStateGetterFor$1 = internalState.getterFor; var collectionStrong = { getConstructor: function (wrapper, CONSTRUCTOR_NAME, IS_MAP, ADDER) { var Constructor = wrapper(function (that, iterable) { anInstance(that, Prototype); - setInternalState$e(that, { + setInternalState$f(that, { type: CONSTRUCTOR_NAME, index: objectCreate(null), first: undefined, @@ -5631,7 +6107,7 @@ var doric = (function (exports) { } }; - redefineAll(Prototype, { + defineBuiltIns(Prototype, { // `{ Map, Set }.prototype.clear()` methods // https://tc39.es/ecma262/#sec-map.prototype.clear // https://tc39.es/ecma262/#sec-set.prototype.clear @@ -5691,7 +6167,7 @@ var doric = (function (exports) { } }); - redefineAll(Prototype, IS_MAP ? { + defineBuiltIns(Prototype, IS_MAP ? { // `Map.prototype.get(key)` method // https://tc39.es/ecma262/#sec-map.prototype.get get: function get(key) { @@ -5710,7 +6186,7 @@ var doric = (function (exports) { return define(this, value = value === 0 ? 0 : value, value); } }); - if (descriptors) { defineProperty$8(Prototype, 'size', { + if (descriptors) { defineProperty$5(Prototype, 'size', { get: function () { return getInternalState(this).size; } @@ -5731,7 +6207,7 @@ var doric = (function (exports) { // https://tc39.es/ecma262/#sec-set.prototype.values // https://tc39.es/ecma262/#sec-set.prototype-@@iterator defineIterator(Constructor, CONSTRUCTOR_NAME, function (iterated, kind) { - setInternalState$e(this, { + setInternalState$f(this, { type: ITERATOR_NAME, target: iterated, state: getInternalCollectionState(iterated), @@ -5773,18 +6249,19 @@ var doric = (function (exports) { // `Math.log1p` method implementation // https://tc39.es/ecma262/#sec-math.log1p - // eslint-disable-next-line es/no-math-log1p -- safe + // eslint-disable-next-line es-x/no-math-log1p -- safe var mathLog1p = Math.log1p || function log1p(x) { - return (x = +x) > -1e-8 && x < 1e-8 ? x - x * x / 2 : log$7(1 + x); + var n = +x; + return n > -1e-8 && n < 1e-8 ? n - n * n / 2 : log$7(1 + n); }; - // eslint-disable-next-line es/no-math-acosh -- required for testing + // eslint-disable-next-line es-x/no-math-acosh -- required for testing var $acosh = Math.acosh; var log$6 = Math.log; var sqrt$2 = Math.sqrt; var LN2$1 = Math.LN2; - var FORCED$k = !$acosh + var FORCED$f = !$acosh // V8 bug: https://code.google.com/p/v8/issues/detail?id=3509 || Math.floor($acosh(Number.MAX_VALUE)) != 710 // Tor Browser bug: Math.acosh(Infinity) -> NaN @@ -5792,21 +6269,23 @@ var doric = (function (exports) { // `Math.acosh` method // https://tc39.es/ecma262/#sec-math.acosh - _export({ target: 'Math', stat: true, forced: FORCED$k }, { + _export({ target: 'Math', stat: true, forced: FORCED$f }, { acosh: function acosh(x) { - return (x = +x) < 1 ? NaN : x > 94906265.62425156 - ? log$6(x) + LN2$1 - : mathLog1p(x - 1 + sqrt$2(x - 1) * sqrt$2(x + 1)); + var n = +x; + return n < 1 ? NaN : n > 94906265.62425156 + ? log$6(n) + LN2$1 + : mathLog1p(n - 1 + sqrt$2(n - 1) * sqrt$2(n + 1)); } }); - // eslint-disable-next-line es/no-math-asinh -- required for testing + // eslint-disable-next-line es-x/no-math-asinh -- required for testing var $asinh = Math.asinh; var log$5 = Math.log; var sqrt$1 = Math.sqrt; function asinh(x) { - return !isFinite(x = +x) || x == 0 ? x : x < 0 ? -asinh(-x) : log$5(x + sqrt$1(x * x + 1)); + var n = +x; + return !isFinite(n) || n == 0 ? n : n < 0 ? -asinh(-n) : log$5(n + sqrt$1(n * n + 1)); } // `Math.asinh` method @@ -5816,7 +6295,7 @@ var doric = (function (exports) { asinh: asinh }); - // eslint-disable-next-line es/no-math-atanh -- required for testing + // eslint-disable-next-line es-x/no-math-atanh -- required for testing var $atanh = Math.atanh; var log$4 = Math.log; @@ -5825,26 +6304,29 @@ var doric = (function (exports) { // Tor Browser bug: Math.atanh(-0) -> 0 _export({ target: 'Math', stat: true, forced: !($atanh && 1 / $atanh(-0) < 0) }, { atanh: function atanh(x) { - return (x = +x) == 0 ? x : log$4((1 + x) / (1 - x)) / 2; + var n = +x; + return n == 0 ? n : log$4((1 + n) / (1 - n)) / 2; } }); // `Math.sign` method implementation // https://tc39.es/ecma262/#sec-math.sign - // eslint-disable-next-line es/no-math-sign -- safe + // eslint-disable-next-line es-x/no-math-sign -- safe var mathSign = Math.sign || function sign(x) { + var n = +x; // eslint-disable-next-line no-self-compare -- NaN check - return (x = +x) == 0 || x != x ? x : x < 0 ? -1 : 1; + return n == 0 || n != n ? n : n < 0 ? -1 : 1; }; - var abs$5 = Math.abs; - var pow$3 = Math.pow; + var abs$6 = Math.abs; + var pow$4 = Math.pow; // `Math.cbrt` method // https://tc39.es/ecma262/#sec-math.cbrt _export({ target: 'Math', stat: true }, { cbrt: function cbrt(x) { - return mathSign(x = +x) * pow$3(abs$5(x), 1 / 3); + var n = +x; + return mathSign(n) * pow$4(abs$6(n), 1 / 3); } }); @@ -5856,11 +6338,12 @@ var doric = (function (exports) { // https://tc39.es/ecma262/#sec-math.clz32 _export({ target: 'Math', stat: true }, { clz32: function clz32(x) { - return (x >>>= 0) ? 31 - floor$7(log$3(x + 0.5) * LOG2E) : 32; + var n = x >>> 0; + return n ? 31 - floor$7(log$3(n + 0.5) * LOG2E) : 32; } }); - // eslint-disable-next-line es/no-math-expm1 -- safe + // eslint-disable-next-line es-x/no-math-expm1 -- safe var $expm1 = Math.expm1; var exp$2 = Math.exp; @@ -5872,34 +6355,35 @@ var doric = (function (exports) { // Tor Browser bug || $expm1(-2e-17) != -2e-17 ) ? function expm1(x) { - return (x = +x) == 0 ? x : x > -1e-6 && x < 1e-6 ? x + x * x / 2 : exp$2(x) - 1; + var n = +x; + return n == 0 ? n : n > -1e-6 && n < 1e-6 ? n + n * n / 2 : exp$2(n) - 1; } : $expm1; - // eslint-disable-next-line es/no-math-cosh -- required for testing + // eslint-disable-next-line es-x/no-math-cosh -- required for testing var $cosh = Math.cosh; - var abs$4 = Math.abs; + var abs$5 = Math.abs; var E$1 = Math.E; // `Math.cosh` method // https://tc39.es/ecma262/#sec-math.cosh _export({ target: 'Math', stat: true, forced: !$cosh || $cosh(710) === Infinity }, { cosh: function cosh(x) { - var t = mathExpm1(abs$4(x) - 1) + 1; + var t = mathExpm1(abs$5(x) - 1) + 1; return (t + 1 / (t * E$1 * E$1)) * (E$1 / 2); } }); // `Math.expm1` method // https://tc39.es/ecma262/#sec-math.expm1 - // eslint-disable-next-line es/no-math-expm1 -- required for testing + // eslint-disable-next-line es-x/no-math-expm1 -- required for testing _export({ target: 'Math', stat: true, forced: mathExpm1 != Math.expm1 }, { expm1: mathExpm1 }); - var abs$3 = Math.abs; - var pow$2 = Math.pow; - var EPSILON = pow$2(2, -52); - var EPSILON32 = pow$2(2, -23); - var MAX32 = pow$2(2, 127) * (2 - EPSILON32); - var MIN32 = pow$2(2, -126); + var abs$4 = Math.abs; + var pow$3 = Math.pow; + var EPSILON = pow$3(2, -52); + var EPSILON32 = pow$3(2, -23); + var MAX32 = pow$3(2, 127) * (2 - EPSILON32); + var MIN32 = pow$3(2, -126); var roundTiesToEven = function (n) { return n + 1 / EPSILON - 1 / EPSILON; @@ -5907,10 +6391,11 @@ var doric = (function (exports) { // `Math.fround` method implementation // https://tc39.es/ecma262/#sec-math.fround - // eslint-disable-next-line es/no-math-fround -- safe + // eslint-disable-next-line es-x/no-math-fround -- safe var mathFround = Math.fround || function fround(x) { - var $abs = abs$3(x); - var $sign = mathSign(x); + var n = +x; + var $abs = abs$4(n); + var $sign = mathSign(n); var a, result; if ($abs < MIN32) { return $sign * roundTiesToEven($abs / MIN32 / EPSILON32) * MIN32 * EPSILON32; } a = (1 + EPSILON32 / EPSILON) * $abs; @@ -5924,9 +6409,9 @@ var doric = (function (exports) { // https://tc39.es/ecma262/#sec-math.fround _export({ target: 'Math', stat: true }, { fround: mathFround }); - // eslint-disable-next-line es/no-math-hypot -- required for testing + // eslint-disable-next-line es-x/no-math-hypot -- required for testing var $hypot = Math.hypot; - var abs$2 = Math.abs; + var abs$3 = Math.abs; var sqrt = Math.sqrt; // Chrome 77 bug @@ -5935,7 +6420,7 @@ var doric = (function (exports) { // `Math.hypot` method // https://tc39.es/ecma262/#sec-math.hypot - _export({ target: 'Math', stat: true, forced: BUGGY }, { + _export({ target: 'Math', stat: true, arity: 2, forced: BUGGY }, { // eslint-disable-next-line no-unused-vars -- required for `.length` hypot: function hypot(value1, value2) { var arguments$1 = arguments; @@ -5946,7 +6431,7 @@ var doric = (function (exports) { var larg = 0; var arg, div; while (i < aLen) { - arg = abs$2(arguments$1[i++]); + arg = abs$3(arguments$1[i++]); if (larg < arg) { div = larg / arg; sum = sum * div * div + 1; @@ -5960,17 +6445,17 @@ var doric = (function (exports) { } }); - // eslint-disable-next-line es/no-math-imul -- required for testing + // eslint-disable-next-line es-x/no-math-imul -- required for testing var $imul = Math.imul; - var FORCED$j = fails(function () { + var FORCED$e = fails(function () { return $imul(0xFFFFFFFF, 5) != -5 || $imul.length != 2; }); // `Math.imul` method // https://tc39.es/ecma262/#sec-math.imul // some WebKit versions fails with big numbers, some has wrong arity - _export({ target: 'Math', stat: true, forced: FORCED$j }, { + _export({ target: 'Math', stat: true, forced: FORCED$e }, { imul: function imul(x, y) { var UINT16 = 0xFFFF; var xn = +x; @@ -5984,12 +6469,15 @@ var doric = (function (exports) { var log$2 = Math.log; var LOG10E = Math.LOG10E; + // eslint-disable-next-line es-x/no-math-log10 -- safe + var mathLog10 = Math.log10 || function log10(x) { + return log$2(x) * LOG10E; + }; + // `Math.log10` method // https://tc39.es/ecma262/#sec-math.log10 _export({ target: 'Math', stat: true }, { - log10: function log10(x) { - return log$2(x) * LOG10E; - } + log10: mathLog10 }); // `Math.log1p` method @@ -6013,21 +6501,22 @@ var doric = (function (exports) { sign: mathSign }); - var abs$1 = Math.abs; + var abs$2 = Math.abs; var exp$1 = Math.exp; var E = Math.E; - var FORCED$i = fails(function () { - // eslint-disable-next-line es/no-math-sinh -- required for testing + var FORCED$d = fails(function () { + // eslint-disable-next-line es-x/no-math-sinh -- required for testing return Math.sinh(-2e-17) != -2e-17; }); // `Math.sinh` method // https://tc39.es/ecma262/#sec-math.sinh // V8 near Chromium 38 has a problem with very small numbers - _export({ target: 'Math', stat: true, forced: FORCED$i }, { + _export({ target: 'Math', stat: true, forced: FORCED$d }, { sinh: function sinh(x) { - return abs$1(x = +x) < 1 ? (mathExpm1(x) - mathExpm1(-x)) / 2 : (exp$1(x - 1) - exp$1(-x - 1)) * (E / 2); + var n = +x; + return abs$2(n) < 1 ? (mathExpm1(n) - mathExpm1(-n)) / 2 : (exp$1(n - 1) - exp$1(-n - 1)) * (E / 2); } }); @@ -6037,9 +6526,10 @@ var doric = (function (exports) { // https://tc39.es/ecma262/#sec-math.tanh _export({ target: 'Math', stat: true }, { tanh: function tanh(x) { - var a = mathExpm1(x = +x); - var b = mathExpm1(-x); - return a == Infinity ? 1 : b == Infinity ? -1 : (a - b) / (exp(x) + exp(-x)); + var n = +x; + var a = mathExpm1(n); + var b = mathExpm1(-n); + return a == Infinity ? 1 : b == Infinity ? -1 : (a - b) / (exp(n) + exp(-n)); } }); @@ -6047,15 +6537,10 @@ var doric = (function (exports) { // https://tc39.es/ecma262/#sec-math-@@tostringtag setToStringTag(Math, 'Math', true); - var ceil = Math.ceil; - var floor$6 = Math.floor; - // `Math.trunc` method // https://tc39.es/ecma262/#sec-math.trunc _export({ target: 'Math', stat: true }, { - trunc: function trunc(it) { - return (it > 0 ? floor$6 : ceil)(it); - } + trunc: mathTrunc }); // `thisNumberValue` abstract operation @@ -6063,20 +6548,20 @@ var doric = (function (exports) { var thisNumberValue = functionUncurryThis(1.0.valueOf); // a string of all valid unicode whitespaces - var whitespaces = '\u0009\u000A\u000B\u000C\u000D\u0020\u00A0\u1680\u2000\u2001\u2002' + + var whitespaces$1 = '\u0009\u000A\u000B\u000C\u000D\u0020\u00A0\u1680\u2000\u2001\u2002' + '\u2003\u2004\u2005\u2006\u2007\u2008\u2009\u200A\u202F\u205F\u3000\u2028\u2029\uFEFF'; - var replace$7 = functionUncurryThis(''.replace); - var whitespace = '[' + whitespaces + ']'; + var replace$8 = functionUncurryThis(''.replace); + var whitespace = '[' + whitespaces$1 + ']'; var ltrim = RegExp('^' + whitespace + whitespace + '*'); var rtrim = RegExp(whitespace + whitespace + '*$'); // `String.prototype.{ trim, trimStart, trimEnd, trimLeft, trimRight }` methods implementation - var createMethod$4 = function (TYPE) { + var createMethod$3 = function (TYPE) { return function ($this) { var string = toString_1(requireObjectCoercible($this)); - if (TYPE & 1) { string = replace$7(string, ltrim, ''); } - if (TYPE & 2) { string = replace$7(string, rtrim, ''); } + if (TYPE & 1) { string = replace$8(string, ltrim, ''); } + if (TYPE & 2) { string = replace$8(string, rtrim, ''); } return string; }; }; @@ -6084,27 +6569,27 @@ var doric = (function (exports) { var stringTrim = { // `String.prototype.{ trimLeft, trimStart }` methods // https://tc39.es/ecma262/#sec-string.prototype.trimstart - start: createMethod$4(1), + start: createMethod$3(1), // `String.prototype.{ trimRight, trimEnd }` methods // https://tc39.es/ecma262/#sec-string.prototype.trimend - end: createMethod$4(2), + end: createMethod$3(2), // `String.prototype.trim` method // https://tc39.es/ecma262/#sec-string.prototype.trim - trim: createMethod$4(3) + trim: createMethod$3(3) }; var getOwnPropertyNames$2 = objectGetOwnPropertyNames.f; - var getOwnPropertyDescriptor$6 = objectGetOwnPropertyDescriptor.f; - var defineProperty$7 = objectDefineProperty.f; + var getOwnPropertyDescriptor$8 = objectGetOwnPropertyDescriptor.f; + var defineProperty$4 = objectDefineProperty.f; var trim$2 = stringTrim.trim; var NUMBER = 'Number'; var NativeNumber = global_1[NUMBER]; var NumberPrototype = NativeNumber.prototype; - var TypeError$m = global_1.TypeError; + var TypeError$5 = global_1.TypeError; var arraySlice = functionUncurryThis(''.slice); - var charCodeAt$2 = functionUncurryThis(''.charCodeAt); + var charCodeAt$3 = functionUncurryThis(''.charCodeAt); // `ToNumeric` abstract operation // https://tc39.es/ecma262/#sec-tonumeric @@ -6118,15 +6603,15 @@ var doric = (function (exports) { var toNumber = function (argument) { var it = toPrimitive(argument, 'number'); var first, third, radix, maxCode, digits, length, index, code; - if (isSymbol(it)) { throw TypeError$m('Cannot convert a Symbol value to a number'); } + if (isSymbol(it)) { throw TypeError$5('Cannot convert a Symbol value to a number'); } if (typeof it == 'string' && it.length > 2) { it = trim$2(it); - first = charCodeAt$2(it, 0); + first = charCodeAt$3(it, 0); if (first === 43 || first === 45) { - third = charCodeAt$2(it, 2); + third = charCodeAt$3(it, 2); if (third === 88 || third === 120) { return NaN; } // Number('+0x1') should be NaN, old V8 fix } else if (first === 48) { - switch (charCodeAt$2(it, 1)) { + switch (charCodeAt$3(it, 1)) { case 66: case 98: radix = 2; maxCode = 49; break; // fast equal of /^0b[01]+$/i case 79: case 111: radix = 8; maxCode = 55; break; // fast equal of /^0o[0-7]+$/i default: return +it; @@ -6134,7 +6619,7 @@ var doric = (function (exports) { digits = arraySlice(it, 2); length = digits.length; for (index = 0; index < length; index++) { - code = charCodeAt$2(digits, index); + code = charCodeAt$3(digits, index); // parseInt parses a string to a first unavailable symbol // but ToNumber should return NaN if a string contains unavailable symbols if (code < 48 || code > maxCode) { return NaN; } @@ -6160,19 +6645,19 @@ var doric = (function (exports) { 'EPSILON,MAX_SAFE_INTEGER,MIN_SAFE_INTEGER,isFinite,isInteger,isNaN,isSafeInteger,parseFloat,parseInt,' + // ESNext 'fromString,range' - ).split(','), j = 0, key; keys$1.length > j; j++) { - if (hasOwnProperty_1(NativeNumber, key = keys$1[j]) && !hasOwnProperty_1(NumberWrapper, key)) { - defineProperty$7(NumberWrapper, key, getOwnPropertyDescriptor$6(NativeNumber, key)); + ).split(','), j = 0, key$2; keys$1.length > j; j++) { + if (hasOwnProperty_1(NativeNumber, key$2 = keys$1[j]) && !hasOwnProperty_1(NumberWrapper, key$2)) { + defineProperty$4(NumberWrapper, key$2, getOwnPropertyDescriptor$8(NativeNumber, key$2)); } } NumberWrapper.prototype = NumberPrototype; NumberPrototype.constructor = NumberWrapper; - redefine(global_1, NUMBER, NumberWrapper); + defineBuiltIn(global_1, NUMBER, NumberWrapper, { constructor: true }); } // `Number.EPSILON` constant // https://tc39.es/ecma262/#sec-number.epsilon - _export({ target: 'Number', stat: true }, { + _export({ target: 'Number', stat: true, nonConfigurable: true, nonWritable: true }, { EPSILON: Math.pow(2, -52) }); @@ -6180,7 +6665,7 @@ var doric = (function (exports) { // `Number.isFinite` method // https://tc39.es/ecma262/#sec-number.isfinite - // eslint-disable-next-line es/no-number-isfinite -- safe + // eslint-disable-next-line es-x/no-number-isfinite -- safe var numberIsFinite = Number.isFinite || function isFinite(it) { return typeof it == 'number' && globalIsFinite(it); }; @@ -6189,13 +6674,13 @@ var doric = (function (exports) { // https://tc39.es/ecma262/#sec-number.isfinite _export({ target: 'Number', stat: true }, { isFinite: numberIsFinite }); - var floor$5 = Math.floor; + var floor$6 = Math.floor; // `IsIntegralNumber` abstract operation // https://tc39.es/ecma262/#sec-isintegralnumber - // eslint-disable-next-line es/no-number-isinteger -- safe + // eslint-disable-next-line es-x/no-number-isinteger -- safe var isIntegralNumber = Number.isInteger || function isInteger(it) { - return !isObject(it) && isFinite(it) && floor$5(it) === it; + return !isObject(it) && isFinite(it) && floor$6(it) === it; }; // `Number.isInteger` method @@ -6213,50 +6698,50 @@ var doric = (function (exports) { } }); - var abs = Math.abs; + var abs$1 = Math.abs; // `Number.isSafeInteger` method // https://tc39.es/ecma262/#sec-number.issafeinteger _export({ target: 'Number', stat: true }, { isSafeInteger: function isSafeInteger(number) { - return isIntegralNumber(number) && abs(number) <= 0x1FFFFFFFFFFFFF; + return isIntegralNumber(number) && abs$1(number) <= 0x1FFFFFFFFFFFFF; } }); // `Number.MAX_SAFE_INTEGER` constant // https://tc39.es/ecma262/#sec-number.max_safe_integer - _export({ target: 'Number', stat: true }, { + _export({ target: 'Number', stat: true, nonConfigurable: true, nonWritable: true }, { MAX_SAFE_INTEGER: 0x1FFFFFFFFFFFFF }); // `Number.MIN_SAFE_INTEGER` constant // https://tc39.es/ecma262/#sec-number.min_safe_integer - _export({ target: 'Number', stat: true }, { + _export({ target: 'Number', stat: true, nonConfigurable: true, nonWritable: true }, { MIN_SAFE_INTEGER: -0x1FFFFFFFFFFFFF }); var trim$1 = stringTrim.trim; - var charAt$d = functionUncurryThis(''.charAt); + var charAt$f = functionUncurryThis(''.charAt); var n$ParseFloat = global_1.parseFloat; var Symbol$2 = global_1.Symbol; var ITERATOR$5 = Symbol$2 && Symbol$2.iterator; - var FORCED$h = 1 / n$ParseFloat(whitespaces + '-0') !== -Infinity + var FORCED$c = 1 / n$ParseFloat(whitespaces$1 + '-0') !== -Infinity // MS Edge 18- broken with boxed symbols || (ITERATOR$5 && !fails(function () { n$ParseFloat(Object(ITERATOR$5)); })); // `parseFloat` method // https://tc39.es/ecma262/#sec-parsefloat-string - var numberParseFloat = FORCED$h ? function parseFloat(string) { + var numberParseFloat = FORCED$c ? function parseFloat(string) { var trimmedString = trim$1(toString_1(string)); var result = n$ParseFloat(trimmedString); - return result === 0 && charAt$d(trimmedString, 0) == '-' ? -0 : result; + return result === 0 && charAt$f(trimmedString, 0) == '-' ? -0 : result; } : n$ParseFloat; // `Number.parseFloat` method // https://tc39.es/ecma262/#sec-number.parseFloat - // eslint-disable-next-line es/no-number-parsefloat -- required for testing + // eslint-disable-next-line es-x/no-number-parsefloat -- required for testing _export({ target: 'Number', stat: true, forced: Number.parseFloat != numberParseFloat }, { parseFloat: numberParseFloat }); @@ -6268,27 +6753,118 @@ var doric = (function (exports) { var Symbol$1 = global_1.Symbol; var ITERATOR$4 = Symbol$1 && Symbol$1.iterator; var hex = /^[+-]?0x/i; - var exec$6 = functionUncurryThis(hex.exec); - var FORCED$g = $parseInt(whitespaces + '08') !== 8 || $parseInt(whitespaces + '0x16') !== 22 + var exec$8 = functionUncurryThis(hex.exec); + var FORCED$b = $parseInt(whitespaces$1 + '08') !== 8 || $parseInt(whitespaces$1 + '0x16') !== 22 // MS Edge 18- broken with boxed symbols || (ITERATOR$4 && !fails(function () { $parseInt(Object(ITERATOR$4)); })); // `parseInt` method // https://tc39.es/ecma262/#sec-parseint-string-radix - var numberParseInt = FORCED$g ? function parseInt(string, radix) { + var numberParseInt = FORCED$b ? function parseInt(string, radix) { var S = trim(toString_1(string)); - return $parseInt(S, (radix >>> 0) || (exec$6(hex, S) ? 16 : 10)); + return $parseInt(S, (radix >>> 0) || (exec$8(hex, S) ? 16 : 10)); } : $parseInt; // `Number.parseInt` method // https://tc39.es/ecma262/#sec-number.parseint - // eslint-disable-next-line es/no-number-parseint -- required for testing + // eslint-disable-next-line es-x/no-number-parseint -- required for testing _export({ target: 'Number', stat: true, forced: Number.parseInt != numberParseInt }, { parseInt: numberParseInt }); - var RangeError$7 = global_1.RangeError; - var String$2 = global_1.String; + var $RangeError$8 = RangeError; + var $String$1 = String; + var $isFinite = isFinite; + var abs = Math.abs; + var floor$5 = Math.floor; + var pow$2 = Math.pow; + var round = Math.round; + var un$ToExponential = functionUncurryThis(1.0.toExponential); + var repeat$1 = functionUncurryThis(stringRepeat); + var stringSlice$e = functionUncurryThis(''.slice); + + // Edge 17- + var ROUNDS_PROPERLY = un$ToExponential(-6.9e-11, 4) === '-6.9000e-11' + // IE11- && Edge 14- + && un$ToExponential(1.255, 2) === '1.25e+0' + // FF86-, V8 ~ Chrome 49-50 + && un$ToExponential(12345, 3) === '1.235e+4' + // FF86-, V8 ~ Chrome 49-50 + && un$ToExponential(25, 0) === '3e+1'; + + // IE8- + var THROWS_ON_INFINITY_FRACTION = fails(function () { + un$ToExponential(1, Infinity); + }) && fails(function () { + un$ToExponential(1, -Infinity); + }); + + // Safari <11 && FF <50 + var PROPER_NON_FINITE_THIS_CHECK = !fails(function () { + un$ToExponential(Infinity, Infinity); + }) && !fails(function () { + un$ToExponential(NaN, Infinity); + }); + + var FORCED$a = !ROUNDS_PROPERLY || !THROWS_ON_INFINITY_FRACTION || !PROPER_NON_FINITE_THIS_CHECK; + + // `Number.prototype.toExponential` method + // https://tc39.es/ecma262/#sec-number.prototype.toexponential + _export({ target: 'Number', proto: true, forced: FORCED$a }, { + toExponential: function toExponential(fractionDigits) { + var x = thisNumberValue(this); + if (fractionDigits === undefined) { return un$ToExponential(x); } + var f = toIntegerOrInfinity(fractionDigits); + if (!$isFinite(x)) { return String(x); } + // TODO: ES2018 increased the maximum number of fraction digits to 100, need to improve the implementation + if (f < 0 || f > 20) { throw $RangeError$8('Incorrect fraction digits'); } + if (ROUNDS_PROPERLY) { return un$ToExponential(x, f); } + var s = ''; + var m = ''; + var e = 0; + var c = ''; + var d = ''; + if (x < 0) { + s = '-'; + x = -x; + } + if (x === 0) { + e = 0; + m = repeat$1('0', f + 1); + } else { + // this block is based on https://gist.github.com/SheetJSDev/1100ad56b9f856c95299ed0e068eea08 + // TODO: improve accuracy with big fraction digits + var l = mathLog10(x); + e = floor$5(l); + var n = 0; + var w = pow$2(10, e - f); + n = round(x / w); + if (2 * x >= (2 * n + 1) * w) { + n += 1; + } + if (n >= pow$2(10, f + 1)) { + n /= 10; + e += 1; + } + m = $String$1(n); + } + if (f !== 0) { + m = stringSlice$e(m, 0, 1) + '.' + stringSlice$e(m, 1); + } + if (e === 0) { + c = '+'; + d = '0'; + } else { + c = e > 0 ? '+' : '-'; + d = $String$1(abs(e)); + } + m += 'e' + c + d; + return s + m; + } + }); + + var $RangeError$7 = RangeError; + var $String = String; var floor$4 = Math.floor; var repeat = functionUncurryThis(stringRepeat); var stringSlice$d = functionUncurryThis(''.slice); @@ -6336,13 +6912,13 @@ var doric = (function (exports) { var s = ''; while (--index >= 0) { if (s !== '' || index === 0 || data[index] !== 0) { - var t = String$2(data[index]); + var t = $String(data[index]); s = s === '' ? t : s + repeat('0', 7 - t.length) + t; } } return s; }; - var FORCED$f = fails(function () { + var FORCED$9 = fails(function () { return un$ToFixed(0.00008, 3) !== '0.000' || un$ToFixed(0.9, 0) !== '1' || un$ToFixed(1.255, 2) !== '1.25' || @@ -6354,7 +6930,7 @@ var doric = (function (exports) { // `Number.prototype.toFixed` method // https://tc39.es/ecma262/#sec-number.prototype.tofixed - _export({ target: 'Number', proto: true, forced: FORCED$f }, { + _export({ target: 'Number', proto: true, forced: FORCED$9 }, { toFixed: function toFixed(fractionDigits) { var number = thisNumberValue(this); var fractDigits = toIntegerOrInfinity(fractionDigits); @@ -6363,10 +6939,11 @@ var doric = (function (exports) { var result = '0'; var e, z, j, k; - if (fractDigits < 0 || fractDigits > 20) { throw RangeError$7('Incorrect fraction digits'); } + // TODO: ES2018 increased the maximum number of fraction digits to 100, need to improve the implementation + if (fractDigits < 0 || fractDigits > 20) { throw $RangeError$7('Incorrect fraction digits'); } // eslint-disable-next-line no-self-compare -- NaN check if (number != number) { return 'NaN'; } - if (number <= -1e21 || number >= 1e21) { return String$2(number); } + if (number <= -1e21 || number >= 1e21) { return $String(number); } if (number < 0) { sign = '-'; number = -number; @@ -6412,7 +6989,7 @@ var doric = (function (exports) { var un$ToPrecision = functionUncurryThis(1.0.toPrecision); - var FORCED$e = fails(function () { + var FORCED$8 = fails(function () { // IE7- return un$ToPrecision(1, undefined) !== '1'; }) || !fails(function () { @@ -6422,7 +6999,7 @@ var doric = (function (exports) { // `Number.prototype.toPrecision` method // https://tc39.es/ecma262/#sec-number.prototype.toprecision - _export({ target: 'Number', proto: true, forced: FORCED$e }, { + _export({ target: 'Number', proto: true, forced: FORCED$8 }, { toPrecision: function toPrecision(precision) { return precision === undefined ? un$ToPrecision(thisNumberValue(this)) @@ -6430,20 +7007,20 @@ var doric = (function (exports) { } }); - // eslint-disable-next-line es/no-object-assign -- safe + // eslint-disable-next-line es-x/no-object-assign -- safe var $assign = Object.assign; - // eslint-disable-next-line es/no-object-defineproperty -- required for testing - var defineProperty$6 = Object.defineProperty; + // eslint-disable-next-line es-x/no-object-defineproperty -- required for testing + var defineProperty$3 = Object.defineProperty; var concat$2 = functionUncurryThis([].concat); // `Object.assign` method // https://tc39.es/ecma262/#sec-object.assign var objectAssign = !$assign || fails(function () { // should have correct order of operations (Edge bug) - if (descriptors && $assign({ b: 1 }, $assign(defineProperty$6({}, 'a', { + if (descriptors && $assign({ b: 1 }, $assign(defineProperty$3({}, 'a', { enumerable: true, get: function () { - defineProperty$6(this, 'b', { + defineProperty$3(this, 'b', { value: 3, enumerable: false }); @@ -6452,12 +7029,12 @@ var doric = (function (exports) { // should work with symbols and should have deterministic property order (V8 bug) var A = {}; var B = {}; - // eslint-disable-next-line es/no-symbol -- safe + // eslint-disable-next-line es-x/no-symbol -- safe var symbol = Symbol(); var alphabet = 'abcdefghijklmnopqrst'; A[symbol] = 7; alphabet.split('').forEach(function (chr) { B[chr] = chr; }); - return $assign({}, A)[symbol] != 7 || objectKeys($assign({}, B)).join('') != alphabet; + return $assign({}, A)[symbol] != 7 || objectKeys$1($assign({}, B)).join('') != alphabet; }) ? function assign(target, source) { var arguments$1 = arguments; // eslint-disable-line no-unused-vars -- required for `.length` @@ -6468,7 +7045,7 @@ var doric = (function (exports) { var propertyIsEnumerable = objectPropertyIsEnumerable.f; while (argumentsLength > index) { var S = indexedObject(arguments$1[index++]); - var keys = getOwnPropertySymbols ? concat$2(objectKeys(S), getOwnPropertySymbols(S)) : objectKeys(S); + var keys = getOwnPropertySymbols ? concat$2(objectKeys$1(S), getOwnPropertySymbols(S)) : objectKeys$1(S); var length = keys.length; var j = 0; var key; @@ -6481,11 +7058,16 @@ var doric = (function (exports) { // `Object.assign` method // https://tc39.es/ecma262/#sec-object.assign - // eslint-disable-next-line es/no-object-assign -- required for testing - _export({ target: 'Object', stat: true, forced: Object.assign !== objectAssign }, { + // eslint-disable-next-line es-x/no-object-assign -- required for testing + _export({ target: 'Object', stat: true, arity: 2, forced: Object.assign !== objectAssign }, { assign: objectAssign }); + // TODO: Remove from `core-js@4` + + + + // `Object.create` method // https://tc39.es/ecma262/#sec-object.create _export({ target: 'Object', stat: true, sham: !descriptors }, { @@ -6499,7 +7081,7 @@ var doric = (function (exports) { if (engineWebkitVersion && engineWebkitVersion < 535) { return; } var key = Math.random(); // In FF throws only define methods - // eslint-disable-next-line no-undef, no-useless-call -- required for testing + // eslint-disable-next-line no-undef, no-useless-call, es-x/no-legacy-object-prototype-accessor-methods -- required for testing __defineSetter__.call(null, key, function () { /* empty */ }); delete global_1[key]; }); @@ -6514,16 +7096,22 @@ var doric = (function (exports) { }); } + var defineProperties$1 = objectDefineProperties.f; + // `Object.defineProperties` method // https://tc39.es/ecma262/#sec-object.defineproperties - _export({ target: 'Object', stat: true, forced: !descriptors, sham: !descriptors }, { - defineProperties: objectDefineProperties + // eslint-disable-next-line es-x/no-object-defineproperties -- safe + _export({ target: 'Object', stat: true, forced: Object.defineProperties !== defineProperties$1, sham: !descriptors }, { + defineProperties: defineProperties$1 }); + var defineProperty$2 = objectDefineProperty.f; + // `Object.defineProperty` method // https://tc39.es/ecma262/#sec-object.defineproperty - _export({ target: 'Object', stat: true, forced: !descriptors, sham: !descriptors }, { - defineProperty: objectDefineProperty.f + // eslint-disable-next-line es-x/no-object-defineproperty -- safe + _export({ target: 'Object', stat: true, forced: Object.defineProperty !== defineProperty$2, sham: !descriptors }, { + defineProperty: defineProperty$2 }); // `Object.prototype.__defineSetter__` method @@ -6539,13 +7127,13 @@ var doric = (function (exports) { var $propertyIsEnumerable = objectPropertyIsEnumerable.f; var propertyIsEnumerable = functionUncurryThis($propertyIsEnumerable); - var push$e = functionUncurryThis([].push); + var push$h = functionUncurryThis([].push); // `Object.{ entries, values }` methods implementation - var createMethod$3 = function (TO_ENTRIES) { + var createMethod$2 = function (TO_ENTRIES) { return function (it) { var O = toIndexedObject(it); - var keys = objectKeys(O); + var keys = objectKeys$1(O); var length = keys.length; var i = 0; var result = []; @@ -6553,7 +7141,7 @@ var doric = (function (exports) { while (length > i) { key = keys[i++]; if (!descriptors || propertyIsEnumerable(O, key)) { - push$e(result, TO_ENTRIES ? [key, O[key]] : O[key]); + push$h(result, TO_ENTRIES ? [key, O[key]] : O[key]); } } return result; @@ -6563,10 +7151,10 @@ var doric = (function (exports) { var objectToArray = { // `Object.entries` method // https://tc39.es/ecma262/#sec-object.entries - entries: createMethod$3(true), + entries: createMethod$2(true), // `Object.values` method // https://tc39.es/ecma262/#sec-object.values - values: createMethod$3(false) + values: createMethod$2(false) }; var $entries = objectToArray.entries; @@ -6581,13 +7169,13 @@ var doric = (function (exports) { var onFreeze$2 = internalMetadata.onFreeze; - // eslint-disable-next-line es/no-object-freeze -- safe + // eslint-disable-next-line es-x/no-object-freeze -- safe var $freeze = Object.freeze; - var FAILS_ON_PRIMITIVES$9 = fails(function () { $freeze(1); }); + var FAILS_ON_PRIMITIVES$8 = fails(function () { $freeze(1); }); // `Object.freeze` method // https://tc39.es/ecma262/#sec-object.freeze - _export({ target: 'Object', stat: true, forced: FAILS_ON_PRIMITIVES$9, sham: !freezing }, { + _export({ target: 'Object', stat: true, forced: FAILS_ON_PRIMITIVES$8, sham: !freezing }, { freeze: function freeze(it) { return $freeze && isObject(it) ? $freeze(onFreeze$2(it)) : it; } @@ -6608,12 +7196,12 @@ var doric = (function (exports) { var nativeGetOwnPropertyDescriptor = objectGetOwnPropertyDescriptor.f; - var FAILS_ON_PRIMITIVES$8 = fails(function () { nativeGetOwnPropertyDescriptor(1); }); - var FORCED$d = !descriptors || FAILS_ON_PRIMITIVES$8; + var FAILS_ON_PRIMITIVES$7 = fails(function () { nativeGetOwnPropertyDescriptor(1); }); + var FORCED$7 = !descriptors || FAILS_ON_PRIMITIVES$7; // `Object.getOwnPropertyDescriptor` method // https://tc39.es/ecma262/#sec-object.getownpropertydescriptor - _export({ target: 'Object', stat: true, forced: FORCED$d, sham: !descriptors }, { + _export({ target: 'Object', stat: true, forced: FORCED$7, sham: !descriptors }, { getOwnPropertyDescriptor: function getOwnPropertyDescriptor(it, key) { return nativeGetOwnPropertyDescriptor(toIndexedObject(it), key); } @@ -6639,20 +7227,20 @@ var doric = (function (exports) { var getOwnPropertyNames$1 = objectGetOwnPropertyNamesExternal.f; - // eslint-disable-next-line es/no-object-getownpropertynames -- required for testing - var FAILS_ON_PRIMITIVES$7 = fails(function () { return !Object.getOwnPropertyNames(1); }); + // eslint-disable-next-line es-x/no-object-getownpropertynames -- required for testing + var FAILS_ON_PRIMITIVES$6 = fails(function () { return !Object.getOwnPropertyNames(1); }); // `Object.getOwnPropertyNames` method // https://tc39.es/ecma262/#sec-object.getownpropertynames - _export({ target: 'Object', stat: true, forced: FAILS_ON_PRIMITIVES$7 }, { + _export({ target: 'Object', stat: true, forced: FAILS_ON_PRIMITIVES$6 }, { getOwnPropertyNames: getOwnPropertyNames$1 }); - var FAILS_ON_PRIMITIVES$6 = fails(function () { objectGetPrototypeOf(1); }); + var FAILS_ON_PRIMITIVES$5 = fails(function () { objectGetPrototypeOf(1); }); // `Object.getPrototypeOf` method // https://tc39.es/ecma262/#sec-object.getprototypeof - _export({ target: 'Object', stat: true, forced: FAILS_ON_PRIMITIVES$6, sham: !correctPrototypeGetter }, { + _export({ target: 'Object', stat: true, forced: FAILS_ON_PRIMITIVES$5, sham: !correctPrototypeGetter }, { getPrototypeOf: function getPrototypeOf(it) { return objectGetPrototypeOf(toObject(it)); } @@ -6666,7 +7254,7 @@ var doric = (function (exports) { // `SameValue` abstract operation // https://tc39.es/ecma262/#sec-samevalue - // eslint-disable-next-line es/no-object-is -- safe + // eslint-disable-next-line es-x/no-object-is -- safe var sameValue = Object.is || function is(x, y) { // eslint-disable-next-line no-self-compare -- NaN check return x === y ? x !== 0 || 1 / x === 1 / y : x != x && y != y; @@ -6678,53 +7266,52 @@ var doric = (function (exports) { is: sameValue }); - // eslint-disable-next-line es/no-object-isextensible -- safe - var $isExtensible = Object.isExtensible; - var FAILS_ON_PRIMITIVES$5 = fails(function () { $isExtensible(1); }); - // `Object.isExtensible` method // https://tc39.es/ecma262/#sec-object.isextensible - _export({ target: 'Object', stat: true, forced: FAILS_ON_PRIMITIVES$5 }, { - isExtensible: function isExtensible(it) { - return isObject(it) ? $isExtensible ? $isExtensible(it) : true : false; - } + // eslint-disable-next-line es-x/no-object-isextensible -- safe + _export({ target: 'Object', stat: true, forced: Object.isExtensible !== objectIsExtensible }, { + isExtensible: objectIsExtensible }); - // eslint-disable-next-line es/no-object-isfrozen -- safe + // eslint-disable-next-line es-x/no-object-isfrozen -- safe var $isFrozen = Object.isFrozen; var FAILS_ON_PRIMITIVES$4 = fails(function () { $isFrozen(1); }); // `Object.isFrozen` method // https://tc39.es/ecma262/#sec-object.isfrozen - _export({ target: 'Object', stat: true, forced: FAILS_ON_PRIMITIVES$4 }, { + _export({ target: 'Object', stat: true, forced: FAILS_ON_PRIMITIVES$4 || arrayBufferNonExtensible }, { isFrozen: function isFrozen(it) { - return isObject(it) ? $isFrozen ? $isFrozen(it) : false : true; + if (!isObject(it)) { return true; } + if (arrayBufferNonExtensible && classofRaw(it) == 'ArrayBuffer') { return true; } + return $isFrozen ? $isFrozen(it) : false; } }); - // eslint-disable-next-line es/no-object-issealed -- safe + // eslint-disable-next-line es-x/no-object-issealed -- safe var $isSealed = Object.isSealed; var FAILS_ON_PRIMITIVES$3 = fails(function () { $isSealed(1); }); // `Object.isSealed` method // https://tc39.es/ecma262/#sec-object.issealed - _export({ target: 'Object', stat: true, forced: FAILS_ON_PRIMITIVES$3 }, { + _export({ target: 'Object', stat: true, forced: FAILS_ON_PRIMITIVES$3 || arrayBufferNonExtensible }, { isSealed: function isSealed(it) { - return isObject(it) ? $isSealed ? $isSealed(it) : false : true; + if (!isObject(it)) { return true; } + if (arrayBufferNonExtensible && classofRaw(it) == 'ArrayBuffer') { return true; } + return $isSealed ? $isSealed(it) : false; } }); - var FAILS_ON_PRIMITIVES$2 = fails(function () { objectKeys(1); }); + var FAILS_ON_PRIMITIVES$2 = fails(function () { objectKeys$1(1); }); // `Object.keys` method // https://tc39.es/ecma262/#sec-object.keys _export({ target: 'Object', stat: true, forced: FAILS_ON_PRIMITIVES$2 }, { keys: function keys(it) { - return objectKeys(toObject(it)); + return objectKeys$1(toObject(it)); } }); - var getOwnPropertyDescriptor$5 = objectGetOwnPropertyDescriptor.f; + var getOwnPropertyDescriptor$7 = objectGetOwnPropertyDescriptor.f; // `Object.prototype.__lookupGetter__` method // https://tc39.es/ecma262/#sec-object.prototype.__lookupGetter__ @@ -6735,13 +7322,13 @@ var doric = (function (exports) { var key = toPropertyKey(P); var desc; do { - if (desc = getOwnPropertyDescriptor$5(O, key)) { return desc.get; } + if (desc = getOwnPropertyDescriptor$7(O, key)) { return desc.get; } } while (O = objectGetPrototypeOf(O)); } }); } - var getOwnPropertyDescriptor$4 = objectGetOwnPropertyDescriptor.f; + var getOwnPropertyDescriptor$6 = objectGetOwnPropertyDescriptor.f; // `Object.prototype.__lookupSetter__` method // https://tc39.es/ecma262/#sec-object.prototype.__lookupSetter__ @@ -6752,7 +7339,7 @@ var doric = (function (exports) { var key = toPropertyKey(P); var desc; do { - if (desc = getOwnPropertyDescriptor$4(O, key)) { return desc.set; } + if (desc = getOwnPropertyDescriptor$6(O, key)) { return desc.set; } } while (O = objectGetPrototypeOf(O)); } }); @@ -6762,7 +7349,7 @@ var doric = (function (exports) { - // eslint-disable-next-line es/no-object-preventextensions -- safe + // eslint-disable-next-line es-x/no-object-preventextensions -- safe var $preventExtensions = Object.preventExtensions; var FAILS_ON_PRIMITIVES$1 = fails(function () { $preventExtensions(1); }); @@ -6778,7 +7365,7 @@ var doric = (function (exports) { - // eslint-disable-next-line es/no-object-seal -- safe + // eslint-disable-next-line es-x/no-object-seal -- safe var $seal = Object.seal; var FAILS_ON_PRIMITIVES = fails(function () { $seal(1); }); @@ -6805,7 +7392,7 @@ var doric = (function (exports) { // `Object.prototype.toString` method // https://tc39.es/ecma262/#sec-object.prototype.tostring if (!toStringTagSupport) { - redefine(Object.prototype, 'toString', objectToString, { unsafe: true }); + defineBuiltIn(Object.prototype, 'toString', objectToString, { unsafe: true }); } var $values = objectToArray.values; @@ -6830,7 +7417,12 @@ var doric = (function (exports) { parseInt: numberParseInt }); - var nativePromiseConstructor = global_1.Promise; + var $TypeError$k = TypeError; + + var validateArgumentsLength = function (passed, required) { + if (passed < required) { throw $TypeError$k('Not enough arguments'); } + return passed; + }; var engineIsIos = /(?:ipad|iphone|ipod).*applewebkit/i.test(engineUserAgent); @@ -6842,7 +7434,7 @@ var doric = (function (exports) { var MessageChannel = global_1.MessageChannel; var String$1 = global_1.String; var counter = 0; - var queue = {}; + var queue$1 = {}; var ONREADYSTATECHANGE = 'onreadystatechange'; var location, defer, channel, port; @@ -6852,9 +7444,9 @@ var doric = (function (exports) { } catch (error) { /* empty */ } var run = function (id) { - if (hasOwnProperty_1(queue, id)) { - var fn = queue[id]; - delete queue[id]; + if (hasOwnProperty_1(queue$1, id)) { + var fn = queue$1[id]; + delete queue$1[id]; fn(); } }; @@ -6876,16 +7468,18 @@ var doric = (function (exports) { // Node.js 0.9+ & IE10+ has setImmediate, otherwise: if (!set$1 || !clear) { - set$1 = function setImmediate(fn) { + set$1 = function setImmediate(handler) { + validateArgumentsLength(arguments.length, 1); + var fn = isCallable(handler) ? handler : Function$2(handler); var args = arraySlice$1(arguments, 1); - queue[++counter] = function () { - functionApply(isCallable(fn) ? fn : Function$2(fn), undefined, args); + queue$1[++counter] = function () { + functionApply(fn, undefined, args); }; defer(counter); return counter; }; clear = function clearImmediate(id) { - delete queue[id]; + delete queue$1[id]; }; // Node.js 0.8- if (engineIsNode) { @@ -6940,7 +7534,7 @@ var doric = (function (exports) { var engineIsWebosWebkit = /web0s(?!.*chrome)/i.test(engineUserAgent); - var getOwnPropertyDescriptor$3 = objectGetOwnPropertyDescriptor.f; + var getOwnPropertyDescriptor$5 = objectGetOwnPropertyDescriptor.f; var macrotask = task$1.set; @@ -6952,7 +7546,7 @@ var doric = (function (exports) { var process$3 = global_1.process; var Promise$4 = global_1.Promise; // Node.js 11 shows ExperimentalWarning on getting `queueMicrotask` - var queueMicrotaskDescriptor = getOwnPropertyDescriptor$3(global_1, 'queueMicrotask'); + var queueMicrotaskDescriptor = getOwnPropertyDescriptor$5(global_1, 'queueMicrotask'); var queueMicrotask = queueMicrotaskDescriptor && queueMicrotaskDescriptor.value; var flush, head, last, notify$1, toggle, node, promise, then; @@ -7003,7 +7597,7 @@ var doric = (function (exports) { // for other environments - macrotask based on: // - setImmediate // - MessageChannel - // - window.postMessag + // - window.postMessage // - onreadystatechange // - setTimeout } else { @@ -7024,6 +7618,84 @@ var doric = (function (exports) { } last = task; }; + var hostReportErrors = function (a, b) { + var console = global_1.console; + if (console && console.error) { + arguments.length == 1 ? console.error(a) : console.error(a, b); + } + }; + + var perform = function (exec) { + try { + return { error: false, value: exec() }; + } catch (error) { + return { error: true, value: error }; + } + }; + + var Queue = function () { + this.head = null; + this.tail = null; + }; + + Queue.prototype = { + add: function (item) { + var entry = { item: item, next: null }; + if (this.head) { this.tail.next = entry; } + else { this.head = entry; } + this.tail = entry; + }, + get: function () { + var entry = this.head; + if (entry) { + this.head = entry.next; + if (this.tail === entry) { this.tail = null; } + return entry.item; + } + } + }; + + var queue = Queue; + + var promiseNativeConstructor = global_1.Promise; + + var engineIsBrowser = typeof window == 'object' && typeof Deno != 'object'; + + promiseNativeConstructor && promiseNativeConstructor.prototype; + var SPECIES$1 = wellKnownSymbol('species'); + var SUBCLASSING = false; + var NATIVE_PROMISE_REJECTION_EVENT$1 = isCallable(global_1.PromiseRejectionEvent); + + var FORCED_PROMISE_CONSTRUCTOR$5 = isForced_1('Promise', function () { + var PROMISE_CONSTRUCTOR_SOURCE = inspectSource(promiseNativeConstructor); + var GLOBAL_CORE_JS_PROMISE = PROMISE_CONSTRUCTOR_SOURCE !== String(promiseNativeConstructor); + // V8 6.6 (Node 10 and Chrome 66) have a bug with resolving custom thenables + // https://bugs.chromium.org/p/chromium/issues/detail?id=830565 + // We can't detect it synchronously, so just check versions + if (!GLOBAL_CORE_JS_PROMISE && engineV8Version === 66) { return true; } + // We can't use @@species feature detection in V8 since it causes + // deoptimization and performance degradation + // https://github.com/zloirock/core-js/issues/679 + if (engineV8Version >= 51 && /native code/.test(PROMISE_CONSTRUCTOR_SOURCE)) { return false; } + // Detect correctness of subclassing with @@species support + var promise = new promiseNativeConstructor(function (resolve) { resolve(1); }); + var FakePromise = function (exec) { + exec(function () { /* empty */ }, function () { /* empty */ }); + }; + var constructor = promise.constructor = {}; + constructor[SPECIES$1] = FakePromise; + SUBCLASSING = promise.then(function () { /* empty */ }) instanceof FakePromise; + if (!SUBCLASSING) { return true; } + // Unhandled rejections tracking support, NodeJS Promise without it fails @@species test + return !GLOBAL_CORE_JS_PROMISE && engineIsBrowser && !NATIVE_PROMISE_REJECTION_EVENT$1; + }); + + var promiseConstructorDetection = { + CONSTRUCTOR: FORCED_PROMISE_CONSTRUCTOR$5, + REJECTION_EVENT: NATIVE_PROMISE_REJECTION_EVENT$1, + SUBCLASSING: SUBCLASSING + }; + var PromiseCapability = function (C) { var resolve, reject; this.promise = new C(function ($$resolve, $$reject) { @@ -7045,32 +7717,6 @@ var doric = (function (exports) { f: f }; - var promiseResolve = function (C, x) { - anObject(C); - if (isObject(x) && x.constructor === C) { return x; } - var promiseCapability = newPromiseCapability$1.f(C); - var resolve = promiseCapability.resolve; - resolve(x); - return promiseCapability.promise; - }; - - var hostReportErrors = function (a, b) { - var console = global_1.console; - if (console && console.error) { - arguments.length == 1 ? console.error(a) : console.error(a, b); - } - }; - - var perform = function (exec) { - try { - return { error: false, value: exec() }; - } catch (error) { - return { error: true, value: error }; - } - }; - - var engineIsBrowser = typeof window == 'object'; - var task = task$1.set; @@ -7081,26 +7727,22 @@ var doric = (function (exports) { - - - - var SPECIES$1 = wellKnownSymbol('species'); var PROMISE = 'Promise'; - - var getInternalState$d = internalState.get; - var setInternalState$d = internalState.set; + var FORCED_PROMISE_CONSTRUCTOR$4 = promiseConstructorDetection.CONSTRUCTOR; + var NATIVE_PROMISE_REJECTION_EVENT = promiseConstructorDetection.REJECTION_EVENT; + var NATIVE_PROMISE_SUBCLASSING = promiseConstructorDetection.SUBCLASSING; var getInternalPromiseState = internalState.getterFor(PROMISE); - var NativePromisePrototype = nativePromiseConstructor && nativePromiseConstructor.prototype; - var PromiseConstructor = nativePromiseConstructor; - var PromisePrototype = NativePromisePrototype; - var TypeError$l = global_1.TypeError; + var setInternalState$e = internalState.set; + var NativePromisePrototype$2 = promiseNativeConstructor && promiseNativeConstructor.prototype; + var PromiseConstructor = promiseNativeConstructor; + var PromisePrototype = NativePromisePrototype$2; + var TypeError$4 = global_1.TypeError; var document$1 = global_1.document; var process$2 = global_1.process; var newPromiseCapability = newPromiseCapability$1.f; var newGenericPromiseCapability = newPromiseCapability; var DISPATCH_EVENT = !!(document$1 && document$1.createEvent && global_1.dispatchEvent); - var NATIVE_REJECTION_EVENT = isCallable(global_1.PromiseRejectionEvent); var UNHANDLED_REJECTION = 'unhandledrejection'; var REJECTION_HANDLED = 'rejectionhandled'; var PENDING = 0; @@ -7108,87 +7750,59 @@ var doric = (function (exports) { var REJECTED = 2; var HANDLED = 1; var UNHANDLED = 2; - var SUBCLASSING = false; var Internal, OwnPromiseCapability, PromiseWrapper, nativeThen; - var FORCED$c = isForced_1(PROMISE, function () { - var PROMISE_CONSTRUCTOR_SOURCE = inspectSource(PromiseConstructor); - var GLOBAL_CORE_JS_PROMISE = PROMISE_CONSTRUCTOR_SOURCE !== String(PromiseConstructor); - // V8 6.6 (Node 10 and Chrome 66) have a bug with resolving custom thenables - // https://bugs.chromium.org/p/chromium/issues/detail?id=830565 - // We can't detect it synchronously, so just check versions - if (!GLOBAL_CORE_JS_PROMISE && engineV8Version === 66) { return true; } - // We can't use @@species feature detection in V8 since it causes - // deoptimization and performance degradation - // https://github.com/zloirock/core-js/issues/679 - if (engineV8Version >= 51 && /native code/.test(PROMISE_CONSTRUCTOR_SOURCE)) { return false; } - // Detect correctness of subclassing with @@species support - var promise = new PromiseConstructor(function (resolve) { resolve(1); }); - var FakePromise = function (exec) { - exec(function () { /* empty */ }, function () { /* empty */ }); - }; - var constructor = promise.constructor = {}; - constructor[SPECIES$1] = FakePromise; - SUBCLASSING = promise.then(function () { /* empty */ }) instanceof FakePromise; - if (!SUBCLASSING) { return true; } - // Unhandled rejections tracking support, NodeJS Promise without it fails @@species test - return !GLOBAL_CORE_JS_PROMISE && engineIsBrowser && !NATIVE_REJECTION_EVENT; - }); - - var INCORRECT_ITERATION = FORCED$c || !checkCorrectnessOfIteration(function (iterable) { - PromiseConstructor.all(iterable)['catch'](function () { /* empty */ }); - }); - // helpers var isThenable = function (it) { var then; return isObject(it) && isCallable(then = it.then) ? then : false; }; + var callReaction = function (reaction, state) { + var value = state.value; + var ok = state.state == FULFILLED; + var handler = ok ? reaction.ok : reaction.fail; + var resolve = reaction.resolve; + var reject = reaction.reject; + var domain = reaction.domain; + var result, then, exited; + try { + if (handler) { + if (!ok) { + if (state.rejection === UNHANDLED) { onHandleUnhandled(state); } + state.rejection = HANDLED; + } + if (handler === true) { result = value; } + else { + if (domain) { domain.enter(); } + result = handler(value); // can throw + if (domain) { + domain.exit(); + exited = true; + } + } + if (result === reaction.promise) { + reject(TypeError$4('Promise-chain cycle')); + } else if (then = isThenable(result)) { + functionCall(then, result, resolve, reject); + } else { resolve(result); } + } else { reject(value); } + } catch (error) { + if (domain && !exited) { domain.exit(); } + reject(error); + } + }; + var notify = function (state, isReject) { if (state.notified) { return; } state.notified = true; - var chain = state.reactions; microtask(function () { - var value = state.value; - var ok = state.state == FULFILLED; - var index = 0; - // variable length - can't use forEach - while (chain.length > index) { - var reaction = chain[index++]; - var handler = ok ? reaction.ok : reaction.fail; - var resolve = reaction.resolve; - var reject = reaction.reject; - var domain = reaction.domain; - var result, then, exited; - try { - if (handler) { - if (!ok) { - if (state.rejection === UNHANDLED) { onHandleUnhandled(state); } - state.rejection = HANDLED; - } - if (handler === true) { result = value; } - else { - if (domain) { domain.enter(); } - result = handler(value); // can throw - if (domain) { - domain.exit(); - exited = true; - } - } - if (result === reaction.promise) { - reject(TypeError$l('Promise-chain cycle')); - } else if (then = isThenable(result)) { - functionCall(then, result, resolve, reject); - } else { resolve(result); } - } else { reject(value); } - } catch (error) { - if (domain && !exited) { domain.exit(); } - reject(error); - } + var reactions = state.reactions; + var reaction; + while (reaction = reactions.get()) { + callReaction(reaction, state); } - state.reactions = []; state.notified = false; if (isReject && !state.rejection) { onUnhandled(state); } }); @@ -7203,7 +7817,7 @@ var doric = (function (exports) { event.initEvent(name, false, true); global_1.dispatchEvent(event); } else { event = { promise: promise, reason: reason }; } - if (!NATIVE_REJECTION_EVENT && (handler = global_1['on' + name])) { handler(event); } + if (!NATIVE_PROMISE_REJECTION_EVENT && (handler = global_1['on' + name])) { handler(event); } else if (name === UNHANDLED_REJECTION) { hostReportErrors('Unhandled promise rejection', reason); } }; @@ -7259,7 +7873,7 @@ var doric = (function (exports) { state.done = true; if (unwrap) { state = unwrap; } try { - if (state.facade === value) { throw TypeError$l("Promise can't be resolved itself"); } + if (state.facade === value) { throw TypeError$4("Promise can't be resolved itself"); } var then = isThenable(value); if (then) { microtask(function () { @@ -7284,130 +7898,111 @@ var doric = (function (exports) { }; // constructor polyfill - if (FORCED$c) { + if (FORCED_PROMISE_CONSTRUCTOR$4) { // 25.4.3.1 Promise(executor) PromiseConstructor = function Promise(executor) { anInstance(this, PromisePrototype); aCallable(executor); functionCall(Internal, this); - var state = getInternalState$d(this); + var state = getInternalPromiseState(this); try { executor(bind(internalResolve, state), bind(internalReject, state)); } catch (error) { internalReject(state, error); } }; + PromisePrototype = PromiseConstructor.prototype; + // eslint-disable-next-line no-unused-vars -- required for `.length` Internal = function Promise(executor) { - setInternalState$d(this, { + setInternalState$e(this, { type: PROMISE, done: false, notified: false, parent: false, - reactions: [], + reactions: new queue(), rejection: false, state: PENDING, value: undefined }); }; - Internal.prototype = redefineAll(PromisePrototype, { - // `Promise.prototype.then` method - // https://tc39.es/ecma262/#sec-promise.prototype.then - then: function then(onFulfilled, onRejected) { - var state = getInternalPromiseState(this); - var reactions = state.reactions; - var reaction = newPromiseCapability(speciesConstructor(this, PromiseConstructor)); - reaction.ok = isCallable(onFulfilled) ? onFulfilled : true; - reaction.fail = isCallable(onRejected) && onRejected; - reaction.domain = engineIsNode ? process$2.domain : undefined; - state.parent = true; - reactions[reactions.length] = reaction; - if (state.state != PENDING) { notify(state, false); } - return reaction.promise; - }, - // `Promise.prototype.catch` method - // https://tc39.es/ecma262/#sec-promise.prototype.catch - 'catch': function (onRejected) { - return this.then(undefined, onRejected); - } + + // `Promise.prototype.then` method + // https://tc39.es/ecma262/#sec-promise.prototype.then + Internal.prototype = defineBuiltIn(PromisePrototype, 'then', function then(onFulfilled, onRejected) { + var state = getInternalPromiseState(this); + var reaction = newPromiseCapability(speciesConstructor(this, PromiseConstructor)); + state.parent = true; + reaction.ok = isCallable(onFulfilled) ? onFulfilled : true; + reaction.fail = isCallable(onRejected) && onRejected; + reaction.domain = engineIsNode ? process$2.domain : undefined; + if (state.state == PENDING) { state.reactions.add(reaction); } + else { microtask(function () { + callReaction(reaction, state); + }); } + return reaction.promise; }); + OwnPromiseCapability = function () { var promise = new Internal(); - var state = getInternalState$d(promise); + var state = getInternalPromiseState(promise); this.promise = promise; this.resolve = bind(internalResolve, state); this.reject = bind(internalReject, state); }; + newPromiseCapability$1.f = newPromiseCapability = function (C) { return C === PromiseConstructor || C === PromiseWrapper ? new OwnPromiseCapability(C) : newGenericPromiseCapability(C); }; - if (isCallable(nativePromiseConstructor) && NativePromisePrototype !== Object.prototype) { - nativeThen = NativePromisePrototype.then; + if (isCallable(promiseNativeConstructor) && NativePromisePrototype$2 !== Object.prototype) { + nativeThen = NativePromisePrototype$2.then; - if (!SUBCLASSING) { + if (!NATIVE_PROMISE_SUBCLASSING) { // make `Promise#then` return a polyfilled `Promise` for native promise-based APIs - redefine(NativePromisePrototype, 'then', function then(onFulfilled, onRejected) { + defineBuiltIn(NativePromisePrototype$2, 'then', function then(onFulfilled, onRejected) { var that = this; return new PromiseConstructor(function (resolve, reject) { functionCall(nativeThen, that, resolve, reject); }).then(onFulfilled, onRejected); // https://github.com/zloirock/core-js/issues/640 }, { unsafe: true }); - - // makes sure that native promise-based APIs `Promise#catch` properly works with patched `Promise#then` - redefine(NativePromisePrototype, 'catch', PromisePrototype['catch'], { unsafe: true }); } // make `.constructor === Promise` work for native promise-based APIs try { - delete NativePromisePrototype.constructor; + delete NativePromisePrototype$2.constructor; } catch (error) { /* empty */ } // make `instanceof Promise` work for native promise-based APIs if (objectSetPrototypeOf) { - objectSetPrototypeOf(NativePromisePrototype, PromisePrototype); + objectSetPrototypeOf(NativePromisePrototype$2, PromisePrototype); } } } - _export({ global: true, wrap: true, forced: FORCED$c }, { + _export({ global: true, constructor: true, wrap: true, forced: FORCED_PROMISE_CONSTRUCTOR$4 }, { Promise: PromiseConstructor }); setToStringTag(PromiseConstructor, PROMISE, false); setSpecies(PROMISE); - PromiseWrapper = getBuiltIn(PROMISE); + var FORCED_PROMISE_CONSTRUCTOR$3 = promiseConstructorDetection.CONSTRUCTOR; - // statics - _export({ target: PROMISE, stat: true, forced: FORCED$c }, { - // `Promise.reject` method - // https://tc39.es/ecma262/#sec-promise.reject - reject: function reject(r) { - var capability = newPromiseCapability(this); - functionCall(capability.reject, undefined, r); - return capability.promise; - } + var promiseStaticsIncorrectIteration = FORCED_PROMISE_CONSTRUCTOR$3 || !checkCorrectnessOfIteration(function (iterable) { + promiseNativeConstructor.all(iterable).then(undefined, function () { /* empty */ }); }); - _export({ target: PROMISE, stat: true, forced: FORCED$c }, { - // `Promise.resolve` method - // https://tc39.es/ecma262/#sec-promise.resolve - resolve: function resolve(x) { - return promiseResolve(this, x); - } - }); - - _export({ target: PROMISE, stat: true, forced: INCORRECT_ITERATION }, { - // `Promise.all` method - // https://tc39.es/ecma262/#sec-promise.all + // `Promise.all` method + // https://tc39.es/ecma262/#sec-promise.all + _export({ target: 'Promise', stat: true, forced: promiseStaticsIncorrectIteration }, { all: function all(iterable) { var C = this; - var capability = newPromiseCapability(C); + var capability = newPromiseCapability$1.f(C); var resolve = capability.resolve; var reject = capability.reject; var result = perform(function () { @@ -7430,12 +8025,39 @@ var doric = (function (exports) { }); if (result.error) { reject(result.value); } return capability.promise; - }, - // `Promise.race` method - // https://tc39.es/ecma262/#sec-promise.race + } + }); + + var FORCED_PROMISE_CONSTRUCTOR$2 = promiseConstructorDetection.CONSTRUCTOR; + + + + + + var NativePromisePrototype$1 = promiseNativeConstructor && promiseNativeConstructor.prototype; + + // `Promise.prototype.catch` method + // https://tc39.es/ecma262/#sec-promise.prototype.catch + _export({ target: 'Promise', proto: true, forced: FORCED_PROMISE_CONSTRUCTOR$2, real: true }, { + 'catch': function (onRejected) { + return this.then(undefined, onRejected); + } + }); + + // makes sure that native promise-based APIs `Promise#catch` properly works with patched `Promise#then` + if (isCallable(promiseNativeConstructor)) { + var method$1 = getBuiltIn('Promise').prototype['catch']; + if (NativePromisePrototype$1['catch'] !== method$1) { + defineBuiltIn(NativePromisePrototype$1, 'catch', method$1, { unsafe: true }); + } + } + + // `Promise.race` method + // https://tc39.es/ecma262/#sec-promise.race + _export({ target: 'Promise', stat: true, forced: promiseStaticsIncorrectIteration }, { race: function race(iterable) { var C = this; - var capability = newPromiseCapability(C); + var capability = newPromiseCapability$1.f(C); var reject = capability.reject; var result = perform(function () { var $promiseResolve = aCallable(C.resolve); @@ -7448,6 +8070,40 @@ var doric = (function (exports) { } }); + var FORCED_PROMISE_CONSTRUCTOR$1 = promiseConstructorDetection.CONSTRUCTOR; + + // `Promise.reject` method + // https://tc39.es/ecma262/#sec-promise.reject + _export({ target: 'Promise', stat: true, forced: FORCED_PROMISE_CONSTRUCTOR$1 }, { + reject: function reject(r) { + var capability = newPromiseCapability$1.f(this); + functionCall(capability.reject, undefined, r); + return capability.promise; + } + }); + + var promiseResolve = function (C, x) { + anObject(C); + if (isObject(x) && x.constructor === C) { return x; } + var promiseCapability = newPromiseCapability$1.f(C); + var resolve = promiseCapability.resolve; + resolve(x); + return promiseCapability.promise; + }; + + var FORCED_PROMISE_CONSTRUCTOR = promiseConstructorDetection.CONSTRUCTOR; + + + getBuiltIn('Promise'); + + // `Promise.resolve` method + // https://tc39.es/ecma262/#sec-promise.resolve + _export({ target: 'Promise', stat: true, forced: FORCED_PROMISE_CONSTRUCTOR }, { + resolve: function resolve(x) { + return promiseResolve(this, x); + } + }); + // `Promise.allSettled` method // https://tc39.es/ecma262/#sec-promise.allsettled _export({ target: 'Promise', stat: true }, { @@ -7523,9 +8179,12 @@ var doric = (function (exports) { } }); + var NativePromisePrototype = promiseNativeConstructor && promiseNativeConstructor.prototype; + // Safari bug https://bugs.webkit.org/show_bug.cgi?id=200829 - var NON_GENERIC = !!nativePromiseConstructor && fails(function () { - nativePromiseConstructor.prototype['finally'].call({ then: function () { /* empty */ } }, function () { /* empty */ }); + var NON_GENERIC = !!promiseNativeConstructor && fails(function () { + // eslint-disable-next-line unicorn/no-thenable -- required for testing + NativePromisePrototype['finally'].call({ then: function () { /* empty */ } }, function () { /* empty */ }); }); // `Promise.prototype.finally` method @@ -7546,16 +8205,16 @@ var doric = (function (exports) { }); // makes sure that native promise-based APIs `Promise#finally` properly works with patched `Promise#then` - if (isCallable(nativePromiseConstructor)) { + if (isCallable(promiseNativeConstructor)) { var method = getBuiltIn('Promise').prototype['finally']; - if (nativePromiseConstructor.prototype['finally'] !== method) { - redefine(nativePromiseConstructor.prototype, 'finally', method, { unsafe: true }); + if (NativePromisePrototype['finally'] !== method) { + defineBuiltIn(NativePromisePrototype, 'finally', method, { unsafe: true }); } } // MS Edge argumentsList argument is optional var OPTIONAL_ARGUMENTS_LIST = !fails(function () { - // eslint-disable-next-line es/no-reflect -- required for testing + // eslint-disable-next-line es-x/no-reflect -- required for testing Reflect.apply(function () { /* empty */ }); }); @@ -7569,7 +8228,7 @@ var doric = (function (exports) { var nativeConstruct = getBuiltIn('Reflect', 'construct'); var ObjectPrototype = Object.prototype; - var push$d = [].push; + var push$g = [].push; // `Reflect.construct` method // https://tc39.es/ecma262/#sec-reflect.construct @@ -7584,9 +8243,9 @@ var doric = (function (exports) { nativeConstruct(function () { /* empty */ }); }); - var FORCED$b = NEW_TARGET_BUG || ARGS_BUG; + var FORCED$6 = NEW_TARGET_BUG || ARGS_BUG; - _export({ target: 'Reflect', stat: true, forced: FORCED$b, sham: FORCED$b }, { + _export({ target: 'Reflect', stat: true, forced: FORCED$6, sham: FORCED$6 }, { construct: function construct(Target, args /* , newTarget */) { aConstructor(Target); anObject(args); @@ -7603,7 +8262,7 @@ var doric = (function (exports) { } // w/o altered newTarget, lot of arguments case var $args = [null]; - functionApply(push$d, $args, args); + functionApply(push$g, $args, args); return new (functionApply(functionBind, Target, $args))(); } // with altered newTarget, not support built-in constructors @@ -7616,7 +8275,7 @@ var doric = (function (exports) { // MS Edge has broken Reflect.defineProperty - throwing instead of returning false var ERROR_INSTEAD_OF_FALSE = fails(function () { - // eslint-disable-next-line es/no-reflect -- required for testing + // eslint-disable-next-line es-x/no-reflect -- required for testing Reflect.defineProperty(objectDefineProperty.f({}, 1, { value: 1 }), 1, { value: 2 }); }); @@ -7636,13 +8295,13 @@ var doric = (function (exports) { } }); - var getOwnPropertyDescriptor$2 = objectGetOwnPropertyDescriptor.f; + var getOwnPropertyDescriptor$4 = objectGetOwnPropertyDescriptor.f; // `Reflect.deleteProperty` method // https://tc39.es/ecma262/#sec-reflect.deleteproperty _export({ target: 'Reflect', stat: true }, { deleteProperty: function deleteProperty(target, propertyKey) { - var descriptor = getOwnPropertyDescriptor$2(anObject(target), propertyKey); + var descriptor = getOwnPropertyDescriptor$4(anObject(target), propertyKey); return descriptor && !descriptor.configurable ? false : delete target[propertyKey]; } }); @@ -7692,15 +8351,12 @@ var doric = (function (exports) { } }); - // eslint-disable-next-line es/no-object-isextensible -- safe - var objectIsExtensible = Object.isExtensible; - // `Reflect.isExtensible` method // https://tc39.es/ecma262/#sec-reflect.isextensible _export({ target: 'Reflect', stat: true }, { isExtensible: function isExtensible(target) { anObject(target); - return objectIsExtensible ? objectIsExtensible(target) : true; + return objectIsExtensible(target); } }); @@ -7756,7 +8412,7 @@ var doric = (function (exports) { var MS_EDGE_BUG = fails(function () { var Constructor = function () { /* empty */ }; var object = objectDefineProperty.f(new Constructor(), 'a', { configurable: true }); - // eslint-disable-next-line es/no-reflect -- required for testing + // eslint-disable-next-line es-x/no-reflect -- required for testing return Reflect.set(Constructor.prototype, 'a', 1, object) !== false; }); @@ -7799,25 +8455,41 @@ var doric = (function (exports) { var regexpFlags = function () { var that = anObject(this); var result = ''; + if (that.hasIndices) { result += 'd'; } if (that.global) { result += 'g'; } if (that.ignoreCase) { result += 'i'; } if (that.multiline) { result += 'm'; } if (that.dotAll) { result += 's'; } if (that.unicode) { result += 'u'; } + if (that.unicodeSets) { result += 'v'; } if (that.sticky) { result += 'y'; } return result; }; + var RegExpPrototype$7 = RegExp.prototype; + + var regexpGetFlags = function (R) { + var flags = R.flags; + return flags === undefined && !('flags' in RegExpPrototype$7) && !hasOwnProperty_1(R, 'flags') && objectIsPrototypeOf(RegExpPrototype$7, R) + ? functionCall(regexpFlags, R) : flags; + }; + // babel-minify and Closure Compiler transpiles RegExp('a', 'y') -> /a/y and it causes SyntaxError var $RegExp$2 = global_1.RegExp; - var UNSUPPORTED_Y$4 = fails(function () { + var UNSUPPORTED_Y$3 = fails(function () { var re = $RegExp$2('a', 'y'); re.lastIndex = 2; return re.exec('abcd') != null; }); - var BROKEN_CARET = fails(function () { + // UC Browser bug + // https://github.com/zloirock/core-js/issues/1008 + var MISSED_STICKY$2 = UNSUPPORTED_Y$3 || fails(function () { + return !$RegExp$2('a', 'y').sticky; + }); + + var BROKEN_CARET = UNSUPPORTED_Y$3 || fails(function () { // https://bugzilla.mozilla.org/show_bug.cgi?id=773687 var re = $RegExp$2('^r', 'gy'); re.lastIndex = 2; @@ -7825,8 +8497,9 @@ var doric = (function (exports) { }); var regexpStickyHelpers = { - UNSUPPORTED_Y: UNSUPPORTED_Y$4, - BROKEN_CARET: BROKEN_CARET + BROKEN_CARET: BROKEN_CARET, + MISSED_STICKY: MISSED_STICKY$2, + UNSUPPORTED_Y: UNSUPPORTED_Y$3 }; // babel-minify and Closure Compiler transpiles RegExp('.', 's') -> /./s and it causes SyntaxError @@ -7846,7 +8519,6 @@ var doric = (function (exports) { 'b'.replace(re, '$c') !== 'bc'; }); - var defineProperty$5 = objectDefineProperty.f; var getOwnPropertyNames = objectGetOwnPropertyNames.f; @@ -7856,7 +8528,8 @@ var doric = (function (exports) { - var enforceInternalState = internalState.enforce; + + var enforceInternalState$1 = internalState.enforce; @@ -7864,12 +8537,11 @@ var doric = (function (exports) { var MATCH$1 = wellKnownSymbol('match'); var NativeRegExp = global_1.RegExp; - var RegExpPrototype$7 = NativeRegExp.prototype; - var SyntaxError$1 = global_1.SyntaxError; - var getFlags$3 = functionUncurryThis(regexpFlags); - var exec$5 = functionUncurryThis(RegExpPrototype$7.exec); - var charAt$c = functionUncurryThis(''.charAt); - var replace$6 = functionUncurryThis(''.replace); + var RegExpPrototype$6 = NativeRegExp.prototype; + var SyntaxError$2 = global_1.SyntaxError; + var exec$7 = functionUncurryThis(RegExpPrototype$6.exec); + var charAt$e = functionUncurryThis(''.charAt); + var replace$7 = functionUncurryThis(''.replace); var stringIndexOf$4 = functionUncurryThis(''.indexOf); var stringSlice$c = functionUncurryThis(''.slice); // TODO: Use only propper RegExpIdentifierName @@ -7880,10 +8552,11 @@ var doric = (function (exports) { // "new" should create a new object, old webkit bug var CORRECT_NEW = new NativeRegExp(re1) !== re1; - var UNSUPPORTED_Y$3 = regexpStickyHelpers.UNSUPPORTED_Y; + var MISSED_STICKY$1 = regexpStickyHelpers.MISSED_STICKY; + var UNSUPPORTED_Y$2 = regexpStickyHelpers.UNSUPPORTED_Y; var BASE_FORCED = descriptors && - (!CORRECT_NEW || UNSUPPORTED_Y$3 || regexpUnsupportedDotAll || regexpUnsupportedNcg || fails(function () { + (!CORRECT_NEW || MISSED_STICKY$1 || regexpUnsupportedDotAll || regexpUnsupportedNcg || fails(function () { re2[MATCH$1] = false; // RegExp constructor can alter flags and IsRegExp works correct with @@match return NativeRegExp(re1) != re1 || NativeRegExp(re2) == re2 || NativeRegExp(re1, 'i') != '/a/i'; @@ -7896,9 +8569,9 @@ var doric = (function (exports) { var brackets = false; var chr; for (; index <= length; index++) { - chr = charAt$c(string, index); + chr = charAt$e(string, index); if (chr === '\\') { - result += chr + charAt$c(string, ++index); + result += chr + charAt$e(string, ++index); continue; } if (!brackets && chr === '.') { @@ -7925,9 +8598,9 @@ var doric = (function (exports) { var groupname = ''; var chr; for (; index <= length; index++) { - chr = charAt$c(string, index); + chr = charAt$e(string, index); if (chr === '\\') { - chr = chr + charAt$c(string, ++index); + chr = chr + charAt$e(string, ++index); } else if (chr === ']') { brackets = false; } else if (!brackets) { switch (true) { @@ -7935,7 +8608,7 @@ var doric = (function (exports) { brackets = true; break; case chr === '(': - if (exec$5(IS_NCG, stringSlice$c(string, index + 1))) { + if (exec$7(IS_NCG, stringSlice$c(string, index + 1))) { index += 2; ncg = true; } @@ -7944,7 +8617,7 @@ var doric = (function (exports) { continue; case chr === '>' && ncg: if (groupname === '' || hasOwnProperty_1(names, groupname)) { - throw new SyntaxError$1('Invalid capture group name'); + throw new SyntaxError$2('Invalid capture group name'); } names[groupname] = true; named[named.length] = [groupname, groupid]; @@ -7961,7 +8634,7 @@ var doric = (function (exports) { // https://tc39.es/ecma262/#sec-regexp-constructor if (isForced_1('RegExp', BASE_FORCED)) { var RegExpWrapper = function RegExp(pattern, flags) { - var thisIsRegExp = objectIsPrototypeOf(RegExpPrototype$7, this); + var thisIsRegExp = objectIsPrototypeOf(RegExpPrototype$6, this); var patternIsRegExp = isRegexp(pattern); var flagsAreUndefined = flags === undefined; var groups = []; @@ -7972,9 +8645,9 @@ var doric = (function (exports) { return pattern; } - if (patternIsRegExp || objectIsPrototypeOf(RegExpPrototype$7, pattern)) { + if (patternIsRegExp || objectIsPrototypeOf(RegExpPrototype$6, pattern)) { pattern = pattern.source; - if (flagsAreUndefined) { flags = 'flags' in rawPattern ? rawPattern.flags : getFlags$3(rawPattern); } + if (flagsAreUndefined) { flags = regexpGetFlags(rawPattern); } } pattern = pattern === undefined ? '' : toString_1(pattern); @@ -7983,14 +8656,14 @@ var doric = (function (exports) { if (regexpUnsupportedDotAll && 'dotAll' in re1) { dotAll = !!flags && stringIndexOf$4(flags, 's') > -1; - if (dotAll) { flags = replace$6(flags, /s/g, ''); } + if (dotAll) { flags = replace$7(flags, /s/g, ''); } } rawFlags = flags; - if (UNSUPPORTED_Y$3 && 'sticky' in re1) { + if (MISSED_STICKY$1 && 'sticky' in re1) { sticky = !!flags && stringIndexOf$4(flags, 'y') > -1; - if (sticky) { flags = replace$6(flags, /y/g, ''); } + if (sticky && UNSUPPORTED_Y$2) { flags = replace$7(flags, /y/g, ''); } } if (regexpUnsupportedNcg) { @@ -7999,10 +8672,10 @@ var doric = (function (exports) { groups = handled[1]; } - result = inheritIfRequired(NativeRegExp(pattern, flags), thisIsRegExp ? this : RegExpPrototype$7, RegExpWrapper); + result = inheritIfRequired(NativeRegExp(pattern, flags), thisIsRegExp ? this : RegExpPrototype$6, RegExpWrapper); if (dotAll || sticky || groups.length) { - state = enforceInternalState(result); + state = enforceInternalState$1(result); if (dotAll) { state.dotAll = true; state.raw = RegExpWrapper(handleDotAll(pattern), rawFlags); @@ -8019,45 +8692,42 @@ var doric = (function (exports) { return result; }; - var proxy = function (key) { - key in RegExpWrapper || defineProperty$5(RegExpWrapper, key, { - configurable: true, - get: function () { return NativeRegExp[key]; }, - set: function (it) { NativeRegExp[key] = it; } - }); - }; - - for (var keys = getOwnPropertyNames(NativeRegExp), index = 0; keys.length > index;) { - proxy(keys[index++]); + for (var keys = getOwnPropertyNames(NativeRegExp), index$1 = 0; keys.length > index$1;) { + proxyAccessor(RegExpWrapper, NativeRegExp, keys[index$1++]); } - RegExpPrototype$7.constructor = RegExpWrapper; - RegExpWrapper.prototype = RegExpPrototype$7; - redefine(global_1, 'RegExp', RegExpWrapper); + RegExpPrototype$6.constructor = RegExpWrapper; + RegExpWrapper.prototype = RegExpPrototype$6; + defineBuiltIn(global_1, 'RegExp', RegExpWrapper, { constructor: true }); } // https://tc39.es/ecma262/#sec-get-regexp-@@species setSpecies('RegExp'); - var defineProperty$4 = objectDefineProperty.f; + var defineBuiltInAccessor = function (target, name, descriptor) { + if (descriptor.get) { makeBuiltIn_1(descriptor.get, name, { getter: true }); } + if (descriptor.set) { makeBuiltIn_1(descriptor.set, name, { setter: true }); } + return objectDefineProperty.f(target, name, descriptor); + }; + var getInternalState$c = internalState.get; - var RegExpPrototype$6 = RegExp.prototype; - var TypeError$k = global_1.TypeError; + var RegExpPrototype$5 = RegExp.prototype; + var $TypeError$j = TypeError; // `RegExp.prototype.dotAll` getter // https://tc39.es/ecma262/#sec-get-regexp.prototype.dotall if (descriptors && regexpUnsupportedDotAll) { - defineProperty$4(RegExpPrototype$6, 'dotAll', { + defineBuiltInAccessor(RegExpPrototype$5, 'dotAll', { configurable: true, - get: function () { - if (this === RegExpPrototype$6) { return undefined; } + get: function dotAll() { + if (this === RegExpPrototype$5) { return undefined; } // We can't use InternalStateModule.getterFor because // we don't add metadata for regexps created by a literal. if (classofRaw(this) === 'RegExp') { return !!getInternalState$c(this).dotAll; } - throw TypeError$k('Incompatible receiver, RegExp required'); + throw $TypeError$j('Incompatible receiver, RegExp required'); } }); } @@ -8078,9 +8748,9 @@ var doric = (function (exports) { var nativeReplace = shared('native-string-replace', String.prototype.replace); var nativeExec = RegExp.prototype.exec; var patchedExec = nativeExec; - var charAt$b = functionUncurryThis(''.charAt); + var charAt$d = functionUncurryThis(''.charAt); var indexOf$1 = functionUncurryThis(''.indexOf); - var replace$5 = functionUncurryThis(''.replace); + var replace$6 = functionUncurryThis(''.replace); var stringSlice$b = functionUncurryThis(''.slice); var UPDATES_LAST_INDEX_WRONG = (function () { @@ -8091,15 +8761,14 @@ var doric = (function (exports) { return re1.lastIndex !== 0 || re2.lastIndex !== 0; })(); - var UNSUPPORTED_Y$2 = regexpStickyHelpers.UNSUPPORTED_Y || regexpStickyHelpers.BROKEN_CARET; + var UNSUPPORTED_Y$1 = regexpStickyHelpers.BROKEN_CARET; // nonparticipating capturing group, copied from es5-shim's String#split patch. var NPCG_INCLUDED = /()??/.exec('')[1] !== undefined; - var PATCH = UPDATES_LAST_INDEX_WRONG || NPCG_INCLUDED || UNSUPPORTED_Y$2 || regexpUnsupportedDotAll || regexpUnsupportedNcg; + var PATCH = UPDATES_LAST_INDEX_WRONG || NPCG_INCLUDED || UNSUPPORTED_Y$1 || regexpUnsupportedDotAll || regexpUnsupportedNcg; if (PATCH) { - // eslint-disable-next-line max-statements -- TODO patchedExec = function exec(string) { var re = this; var state = getInternalState$b(re); @@ -8115,21 +8784,21 @@ var doric = (function (exports) { } var groups = state.groups; - var sticky = UNSUPPORTED_Y$2 && re.sticky; + var sticky = UNSUPPORTED_Y$1 && re.sticky; var flags = functionCall(regexpFlags, re); var source = re.source; var charsAdded = 0; var strCopy = str; if (sticky) { - flags = replace$5(flags, 'y', ''); + flags = replace$6(flags, 'y', ''); if (indexOf$1(flags, 'g') === -1) { flags += 'g'; } strCopy = stringSlice$b(str, re.lastIndex); // Support anchored sticky behavior. - if (re.lastIndex > 0 && (!re.multiline || re.multiline && charAt$b(str, re.lastIndex - 1) !== '\n')) { + if (re.lastIndex > 0 && (!re.multiline || re.multiline && charAt$d(str, re.lastIndex - 1) !== '\n')) { source = '(?: ' + source + ')'; strCopy = ' ' + strCopy; charsAdded++; @@ -8188,41 +8857,77 @@ var doric = (function (exports) { exec: regexpExec }); - var RegExpPrototype$5 = RegExp.prototype; + // babel-minify and Closure Compiler transpiles RegExp('.', 'd') -> /./d and it causes SyntaxError + var RegExp$2 = global_1.RegExp; + var RegExpPrototype$4 = RegExp$2.prototype; - var FORCED$a = descriptors && fails(function () { - // eslint-disable-next-line es/no-object-getownpropertydescriptor -- safe - return Object.getOwnPropertyDescriptor(RegExpPrototype$5, 'flags').get.call({ dotAll: true, sticky: true }) !== 'sy'; + var FORCED$5 = descriptors && fails(function () { + var INDICES_SUPPORT = true; + try { + RegExp$2('.', 'd'); + } catch (error) { + INDICES_SUPPORT = false; + } + + var O = {}; + // modern V8 bug + var calls = ''; + var expected = INDICES_SUPPORT ? 'dgimsy' : 'gimsy'; + + var addGetter = function (key, chr) { + // eslint-disable-next-line es-x/no-object-defineproperty -- safe + Object.defineProperty(O, key, { get: function () { + calls += chr; + return true; + } }); + }; + + var pairs = { + dotAll: 's', + global: 'g', + ignoreCase: 'i', + multiline: 'm', + sticky: 'y' + }; + + if (INDICES_SUPPORT) { pairs.hasIndices = 'd'; } + + for (var key in pairs) { addGetter(key, pairs[key]); } + + // eslint-disable-next-line es-x/no-object-getownpropertydescriptor -- safe + var result = Object.getOwnPropertyDescriptor(RegExpPrototype$4, 'flags').get.call(O); + + return result !== expected || calls !== expected; }); // `RegExp.prototype.flags` getter // https://tc39.es/ecma262/#sec-get-regexp.prototype.flags - if (FORCED$a) { objectDefineProperty.f(RegExpPrototype$5, 'flags', { + if (FORCED$5) { defineBuiltInAccessor(RegExpPrototype$4, 'flags', { configurable: true, get: regexpFlags }); } - var UNSUPPORTED_Y$1 = regexpStickyHelpers.UNSUPPORTED_Y; + var MISSED_STICKY = regexpStickyHelpers.MISSED_STICKY; + - var defineProperty$3 = objectDefineProperty.f; var getInternalState$a = internalState.get; - var RegExpPrototype$4 = RegExp.prototype; - var TypeError$j = global_1.TypeError; + var RegExpPrototype$3 = RegExp.prototype; + var $TypeError$i = TypeError; // `RegExp.prototype.sticky` getter // https://tc39.es/ecma262/#sec-get-regexp.prototype.sticky - if (descriptors && UNSUPPORTED_Y$1) { - defineProperty$3(RegExpPrototype$4, 'sticky', { + if (descriptors && MISSED_STICKY) { + defineBuiltInAccessor(RegExpPrototype$3, 'sticky', { configurable: true, - get: function () { - if (this === RegExpPrototype$4) { return undefined; } + get: function sticky() { + if (this === RegExpPrototype$3) { return undefined; } // We can't use InternalStateModule.getterFor because // we don't add metadata for regexps created by a literal. if (classofRaw(this) === 'RegExp') { return !!getInternalState$a(this).sticky; } - throw TypeError$j('Incompatible receiver, RegExp required'); + throw $TypeError$i('Incompatible receiver, RegExp required'); } }); } @@ -8235,7 +8940,6 @@ var doric = (function (exports) { - var DELEGATES_TO_EXEC = function () { var execCalled = false; var re = /[ac]/; @@ -8246,7 +8950,7 @@ var doric = (function (exports) { return re.test('abc') === true && execCalled; }(); - var Error$1 = global_1.Error; + var $TypeError$h = TypeError; var un$Test = functionUncurryThis(/./.test); // `RegExp.prototype.test` method @@ -8257,14 +8961,13 @@ var doric = (function (exports) { if (!isCallable(exec)) { return un$Test(this, str); } var result = functionCall(exec, this, str); if (result !== null && !isObject(result)) { - throw new Error$1('RegExp exec method returned something other than an Object or null'); + throw new $TypeError$h('RegExp exec method returned something other than an Object or null'); } return !!result; } }); - var PROPER_FUNCTION_NAME$2 = functionName.PROPER; - + var PROPER_FUNCTION_NAME$1 = functionName.PROPER; @@ -8272,23 +8975,21 @@ var doric = (function (exports) { var TO_STRING = 'toString'; - var RegExpPrototype$3 = RegExp.prototype; - var n$ToString = RegExpPrototype$3[TO_STRING]; - var getFlags$2 = functionUncurryThis(regexpFlags); + var RegExpPrototype$2 = RegExp.prototype; + var n$ToString = RegExpPrototype$2[TO_STRING]; var NOT_GENERIC = fails(function () { return n$ToString.call({ source: 'a', flags: 'b' }) != '/a/b'; }); // FF44- RegExp#toString has a wrong name - var INCORRECT_NAME = PROPER_FUNCTION_NAME$2 && n$ToString.name != TO_STRING; + var INCORRECT_NAME = PROPER_FUNCTION_NAME$1 && n$ToString.name != TO_STRING; // `RegExp.prototype.toString` method // https://tc39.es/ecma262/#sec-regexp.prototype.tostring if (NOT_GENERIC || INCORRECT_NAME) { - redefine(RegExp.prototype, TO_STRING, function toString() { + defineBuiltIn(RegExp.prototype, TO_STRING, function toString() { var R = anObject(this); - var p = toString_1(R.source); - var rf = R.flags; - var f = toString_1(rf === undefined && objectIsPrototypeOf(RegExpPrototype$3, R) && !('flags' in RegExpPrototype$3) ? getFlags$2(R) : rf); - return '/' + p + '/' + f; + var pattern = toString_1(R.source); + var flags = toString_1(regexpGetFlags(R)); + return '/' + pattern + '/' + flags; }, { unsafe: true }); } @@ -8298,40 +8999,41 @@ var doric = (function (exports) { return function Set() { return init(this, arguments.length ? arguments[0] : undefined); }; }, collectionStrong); - var charAt$a = functionUncurryThis(''.charAt); + var charAt$c = functionUncurryThis(''.charAt); - var FORCED$9 = fails(function () { - return '𠮷'.at(0) !== '\uD842'; + var FORCED$4 = fails(function () { + // eslint-disable-next-line es-x/no-array-string-prototype-at -- safe + return '𠮷'.at(-2) !== '\uD842'; }); // `String.prototype.at` method // https://github.com/tc39/proposal-relative-indexing-method - _export({ target: 'String', proto: true, forced: FORCED$9 }, { + _export({ target: 'String', proto: true, forced: FORCED$4 }, { at: function at(index) { var S = toString_1(requireObjectCoercible(this)); var len = S.length; var relativeIndex = toIntegerOrInfinity(index); var k = relativeIndex >= 0 ? relativeIndex : len + relativeIndex; - return (k < 0 || k >= len) ? undefined : charAt$a(S, k); + return (k < 0 || k >= len) ? undefined : charAt$c(S, k); } }); - var charAt$9 = functionUncurryThis(''.charAt); - var charCodeAt$1 = functionUncurryThis(''.charCodeAt); + var charAt$b = functionUncurryThis(''.charAt); + var charCodeAt$2 = functionUncurryThis(''.charCodeAt); var stringSlice$a = functionUncurryThis(''.slice); - var createMethod$2 = function (CONVERT_TO_STRING) { + var createMethod$1 = function (CONVERT_TO_STRING) { return function ($this, pos) { var S = toString_1(requireObjectCoercible($this)); var position = toIntegerOrInfinity(pos); var size = S.length; var first, second; if (position < 0 || position >= size) { return CONVERT_TO_STRING ? '' : undefined; } - first = charCodeAt$1(S, position); + first = charCodeAt$2(S, position); return first < 0xD800 || first > 0xDBFF || position + 1 === size - || (second = charCodeAt$1(S, position + 1)) < 0xDC00 || second > 0xDFFF + || (second = charCodeAt$2(S, position + 1)) < 0xDC00 || second > 0xDFFF ? CONVERT_TO_STRING - ? charAt$9(S, position) + ? charAt$b(S, position) : first : CONVERT_TO_STRING ? stringSlice$a(S, position, position + 2) @@ -8342,10 +9044,10 @@ var doric = (function (exports) { var stringMultibyte = { // `String.prototype.codePointAt` method // https://tc39.es/ecma262/#sec-string.prototype.codepointat - codeAt: createMethod$2(false), + codeAt: createMethod$1(false), // `String.prototype.at` method // https://github.com/mathiasbynens/String.prototype.at - charAt: createMethod$2(true) + charAt: createMethod$1(true) }; var codeAt$2 = stringMultibyte.codeAt; @@ -8358,11 +9060,11 @@ var doric = (function (exports) { } }); - var TypeError$i = global_1.TypeError; + var $TypeError$g = TypeError; var notARegexp = function (it) { if (isRegexp(it)) { - throw TypeError$i("The method doesn't accept regular expressions"); + throw $TypeError$g("The method doesn't accept regular expressions"); } return it; }; @@ -8380,7 +9082,7 @@ var doric = (function (exports) { } return false; }; - var getOwnPropertyDescriptor$1 = objectGetOwnPropertyDescriptor.f; + var getOwnPropertyDescriptor$3 = objectGetOwnPropertyDescriptor.f; @@ -8388,15 +9090,15 @@ var doric = (function (exports) { - // eslint-disable-next-line es/no-string-prototype-endswith -- safe + // eslint-disable-next-line es-x/no-string-prototype-endswith -- safe var un$EndsWith = functionUncurryThis(''.endsWith); - var slice = functionUncurryThis(''.slice); - var min$5 = Math.min; + var slice$2 = functionUncurryThis(''.slice); + var min$6 = Math.min; var CORRECT_IS_REGEXP_LOGIC$1 = correctIsRegexpLogic('endsWith'); // https://github.com/zloirock/core-js/pull/702 var MDN_POLYFILL_BUG$1 = !CORRECT_IS_REGEXP_LOGIC$1 && !!function () { - var descriptor = getOwnPropertyDescriptor$1(String.prototype, 'endsWith'); + var descriptor = getOwnPropertyDescriptor$3(String.prototype, 'endsWith'); return descriptor && !descriptor.writable; }(); @@ -8408,26 +9110,26 @@ var doric = (function (exports) { notARegexp(searchString); var endPosition = arguments.length > 1 ? arguments[1] : undefined; var len = that.length; - var end = endPosition === undefined ? len : min$5(toLength(endPosition), len); + var end = endPosition === undefined ? len : min$6(toLength(endPosition), len); var search = toString_1(searchString); return un$EndsWith ? un$EndsWith(that, search, end) - : slice(that, end - search.length, end) === search; + : slice$2(that, end - search.length, end) === search; } }); - var RangeError$6 = global_1.RangeError; - var fromCharCode$2 = String.fromCharCode; - // eslint-disable-next-line es/no-string-fromcodepoint -- required for testing + var $RangeError$6 = RangeError; + var fromCharCode$3 = String.fromCharCode; + // eslint-disable-next-line es-x/no-string-fromcodepoint -- required for testing var $fromCodePoint = String.fromCodePoint; - var join$5 = functionUncurryThis([].join); + var join$6 = functionUncurryThis([].join); // length should be 1, old FF problem var INCORRECT_LENGTH = !!$fromCodePoint && $fromCodePoint.length != 1; // `String.fromCodePoint` method // https://tc39.es/ecma262/#sec-string.fromcodepoint - _export({ target: 'String', stat: true, forced: INCORRECT_LENGTH }, { + _export({ target: 'String', stat: true, arity: 1, forced: INCORRECT_LENGTH }, { // eslint-disable-next-line no-unused-vars -- required for `.length` fromCodePoint: function fromCodePoint(x) { var arguments$1 = arguments; @@ -8438,11 +9140,11 @@ var doric = (function (exports) { var code; while (length > i) { code = +arguments$1[i++]; - if (toAbsoluteIndex(code, 0x10FFFF) !== code) { throw RangeError$6(code + ' is not a valid code point'); } + if (toAbsoluteIndex(code, 0x10FFFF) !== code) { throw $RangeError$6(code + ' is not a valid code point'); } elements[i] = code < 0x10000 - ? fromCharCode$2(code) - : fromCharCode$2(((code -= 0x10000) >> 10) + 0xD800, code % 0x400 + 0xDC00); - } return join$5(elements, ''); + ? fromCharCode$3(code) + : fromCharCode$3(((code -= 0x10000) >> 10) + 0xD800, code % 0x400 + 0xDC00); + } return join$6(elements, ''); } }); @@ -8460,19 +9162,19 @@ var doric = (function (exports) { } }); - var charAt$8 = stringMultibyte.charAt; + var charAt$a = stringMultibyte.charAt; var STRING_ITERATOR$1 = 'String Iterator'; - var setInternalState$c = internalState.set; + var setInternalState$d = internalState.set; var getInternalState$9 = internalState.getterFor(STRING_ITERATOR$1); // `String.prototype[@@iterator]` method // https://tc39.es/ecma262/#sec-string.prototype-@@iterator defineIterator(String, 'String', function (iterated) { - setInternalState$c(this, { + setInternalState$d(this, { type: STRING_ITERATOR$1, string: toString_1(iterated), index: 0 @@ -8485,7 +9187,7 @@ var doric = (function (exports) { var index = state.index; var point; if (index >= string.length) { return { value: undefined, done: true }; } - point = charAt$8(string, index); + point = charAt$a(string, index); state.index += point.length; return { value: point, done: false }; }); @@ -8500,7 +9202,7 @@ var doric = (function (exports) { var SPECIES = wellKnownSymbol('species'); - var RegExpPrototype$2 = RegExp.prototype; + var RegExpPrototype$1 = RegExp.prototype; var fixRegexpWellKnownSymbolLogic = function (KEY, exec, FORCED, SHAM) { var SYMBOL = wellKnownSymbol(KEY); @@ -8545,7 +9247,7 @@ var doric = (function (exports) { var methods = exec(SYMBOL, ''[KEY], function (nativeMethod, regexp, str, arg2, forceStringMethod) { var uncurriedNativeMethod = functionUncurryThis(nativeMethod); var $exec = regexp.exec; - if ($exec === regexpExec || $exec === RegExpPrototype$2.exec) { + if ($exec === regexpExec || $exec === RegExpPrototype$1.exec) { if (DELEGATES_TO_SYMBOL && !forceStringMethod) { // The native String method already delegates to @@method (this // polyfilled function), leasing to infinite recursion. @@ -8557,22 +9259,22 @@ var doric = (function (exports) { return { done: false }; }); - redefine(String.prototype, KEY, methods[0]); - redefine(RegExpPrototype$2, SYMBOL, methods[1]); + defineBuiltIn(String.prototype, KEY, methods[0]); + defineBuiltIn(RegExpPrototype$1, SYMBOL, methods[1]); } - if (SHAM) { createNonEnumerableProperty(RegExpPrototype$2[SYMBOL], 'sham', true); } + if (SHAM) { createNonEnumerableProperty(RegExpPrototype$1[SYMBOL], 'sham', true); } }; - var charAt$7 = stringMultibyte.charAt; + var charAt$9 = stringMultibyte.charAt; // `AdvanceStringIndex` abstract operation // https://tc39.es/ecma262/#sec-advancestringindex var advanceStringIndex = function (S, index, unicode) { - return index + (unicode ? charAt$7(S, index).length : 1); + return index + (unicode ? charAt$9(S, index).length : 1); }; - var TypeError$h = global_1.TypeError; + var $TypeError$f = TypeError; // `RegExpExec` abstract operation // https://tc39.es/ecma262/#sec-regexpexec @@ -8584,7 +9286,7 @@ var doric = (function (exports) { return result; } if (classofRaw(R) === 'RegExp') { return functionCall(regexpExec, R, S); } - throw TypeError$h('RegExp#exec called on incompatible receiver'); + throw $TypeError$f('RegExp#exec called on incompatible receiver'); }; // @@match logic @@ -8624,9 +9326,7 @@ var doric = (function (exports) { ]; }); - /* eslint-disable es/no-string-prototype-matchall -- safe */ - - + /* eslint-disable es-x/no-string-prototype-matchall -- safe */ @@ -8651,11 +9351,10 @@ var doric = (function (exports) { var MATCH_ALL = wellKnownSymbol('matchAll'); var REGEXP_STRING = 'RegExp String'; var REGEXP_STRING_ITERATOR = REGEXP_STRING + ' Iterator'; - var setInternalState$b = internalState.set; + var setInternalState$c = internalState.set; var getInternalState$8 = internalState.getterFor(REGEXP_STRING_ITERATOR); - var RegExpPrototype$1 = RegExp.prototype; - var TypeError$g = global_1.TypeError; - var getFlags$1 = functionUncurryThis(regexpFlags); + var RegExpPrototype = RegExp.prototype; + var $TypeError$e = TypeError; var stringIndexOf$2 = functionUncurryThis(''.indexOf); var un$MatchAll = functionUncurryThis(''.matchAll); @@ -8664,7 +9363,7 @@ var doric = (function (exports) { }); var $RegExpStringIterator = createIteratorConstructor(function RegExpStringIterator(regexp, string, $global, fullUnicode) { - setInternalState$b(this, { + setInternalState$c(this, { type: REGEXP_STRING_ITERATOR, regexp: regexp, string: string, @@ -8690,13 +9389,9 @@ var doric = (function (exports) { var $matchAll = function (string) { var R = anObject(this); var S = toString_1(string); - var C, flagsValue, flags, matcher, $global, fullUnicode; - C = speciesConstructor(R, RegExp); - flagsValue = R.flags; - if (flagsValue === undefined && objectIsPrototypeOf(RegExpPrototype$1, R) && !('flags' in RegExpPrototype$1)) { - flagsValue = getFlags$1(R); - } - flags = flagsValue === undefined ? '' : toString_1(flagsValue); + var C = speciesConstructor(R, RegExp); + var flags = toString_1(regexpGetFlags(R)); + var matcher, $global, fullUnicode; matcher = new C(C === RegExp ? R.source : R, flags); $global = !!~stringIndexOf$2(flags, 'g'); fullUnicode = !!~stringIndexOf$2(flags, 'u'); @@ -8712,11 +9407,8 @@ var doric = (function (exports) { var flags, S, matcher, rx; if (regexp != null) { if (isRegexp(regexp)) { - flags = toString_1(requireObjectCoercible('flags' in RegExpPrototype$1 - ? regexp.flags - : getFlags$1(regexp) - )); - if (!~stringIndexOf$2(flags, 'g')) { throw TypeError$g('`.matchAll` does not allow non-global regexes'); } + flags = toString_1(requireObjectCoercible(regexpGetFlags(regexp))); + if (!~stringIndexOf$2(flags, 'g')) { throw $TypeError$e('`.matchAll` does not allow non-global regexes'); } } if (WORKS_WITH_NON_GLOBAL_REGEX) { return un$MatchAll(O, regexp); } matcher = getMethod(regexp, MATCH_ALL); @@ -8729,7 +9421,7 @@ var doric = (function (exports) { } }); - MATCH_ALL in RegExpPrototype$1 || redefine(RegExpPrototype$1, MATCH_ALL, $matchAll); + MATCH_ALL in RegExpPrototype || defineBuiltIn(RegExpPrototype, MATCH_ALL, $matchAll); // https://github.com/zloirock/core-js/issues/280 @@ -8758,8 +9450,8 @@ var doric = (function (exports) { } }); - var push$c = functionUncurryThis([].push); - var join$4 = functionUncurryThis([].join); + var push$f = functionUncurryThis([].push); + var join$5 = functionUncurryThis([].join); // `String.raw` method // https://tc39.es/ecma262/#sec-string.raw @@ -8773,9 +9465,9 @@ var doric = (function (exports) { var elements = []; var i = 0; while (literalSegments > i) { - push$c(elements, toString_1(rawTemplate[i++])); - if (i === literalSegments) { return join$4(elements, ''); } - if (i < argumentsLength) { push$c(elements, toString_1(arguments$1[i])); } + push$f(elements, toString_1(rawTemplate[i++])); + if (i === literalSegments) { return join$5(elements, ''); } + if (i < argumentsLength) { push$f(elements, toString_1(arguments$1[i])); } } } }); @@ -8787,8 +9479,8 @@ var doric = (function (exports) { }); var floor$3 = Math.floor; - var charAt$6 = functionUncurryThis(''.charAt); - var replace$4 = functionUncurryThis(''.replace); + var charAt$8 = functionUncurryThis(''.charAt); + var replace$5 = functionUncurryThis(''.replace); var stringSlice$9 = functionUncurryThis(''.slice); var SUBSTITUTION_SYMBOLS = /\$([$&'`]|\d{1,2}|<[^>]*>)/g; var SUBSTITUTION_SYMBOLS_NO_NAMED = /\$([$&'`]|\d{1,2})/g; @@ -8803,9 +9495,9 @@ var doric = (function (exports) { namedCaptures = toObject(namedCaptures); symbols = SUBSTITUTION_SYMBOLS; } - return replace$4(replacement, symbols, function (match, ch) { + return replace$5(replacement, symbols, function (match, ch) { var capture; - switch (charAt$6(ch, 0)) { + switch (charAt$8(ch, 0)) { case '$': return '$'; case '&': return matched; case '`': return stringSlice$9(str, 0, position); @@ -8819,7 +9511,7 @@ var doric = (function (exports) { if (n > m) { var f = floor$3(n / 10); if (f === 0) { return match; } - if (f <= m) { return captures[f - 1] === undefined ? charAt$6(ch, 1) : captures[f - 1] + charAt$6(ch, 1); } + if (f <= m) { return captures[f - 1] === undefined ? charAt$8(ch, 1) : captures[f - 1] + charAt$8(ch, 1); } return match; } capture = captures[n - 1]; @@ -8829,10 +9521,10 @@ var doric = (function (exports) { }; var REPLACE$1 = wellKnownSymbol('replace'); - var max$3 = Math.max; - var min$4 = Math.min; + var max$4 = Math.max; + var min$5 = Math.min; var concat$1 = functionUncurryThis([].concat); - var push$b = functionUncurryThis([].push); + var push$e = functionUncurryThis([].push); var stringIndexOf$1 = functionUncurryThis(''.indexOf); var stringSlice$8 = functionUncurryThis(''.slice); @@ -8908,7 +9600,7 @@ var doric = (function (exports) { var result = regexpExecAbstract(rx, S); if (result === null) { break; } - push$b(results, result); + push$e(results, result); if (!global) { break; } var matchStr = toString_1(result[0]); @@ -8921,18 +9613,18 @@ var doric = (function (exports) { result = results[i]; var matched = toString_1(result[0]); - var position = max$3(min$4(toIntegerOrInfinity(result.index), S.length), 0); + var position = max$4(min$5(toIntegerOrInfinity(result.index), S.length), 0); var captures = []; // NOTE: This is equivalent to // captures = result.slice(1).map(maybeToString) // but for some reason `nativeSlice.call(result, 1, result.length)` (called in // the slice polyfill when slicing native arrays) "doesn't work" in safari 9 and // causes a crash (https://pastebin.com/N21QzeQA) when trying to debug it. - for (var j = 1; j < result.length; j++) { push$b(captures, maybeToString(result[j])); } + for (var j = 1; j < result.length; j++) { push$e(captures, maybeToString(result[j])); } var namedCaptures = result.groups; if (functionalReplace) { var replacerArgs = concat$1([matched], captures, position, S); - if (namedCaptures !== undefined) { push$b(replacerArgs, namedCaptures); } + if (namedCaptures !== undefined) { push$e(replacerArgs, namedCaptures); } var replacement = toString_1(functionApply(replaceValue, undefined, replacerArgs)); } else { replacement = getSubstitution(matched, S, position, captures, namedCaptures, replaceValue); @@ -8948,13 +9640,11 @@ var doric = (function (exports) { }, !REPLACE_SUPPORTS_NAMED_GROUPS || !REPLACE_KEEPS_$0 || REGEXP_REPLACE_SUBSTITUTES_UNDEFINED_CAPTURE); var REPLACE = wellKnownSymbol('replace'); - var RegExpPrototype = RegExp.prototype; - var TypeError$f = global_1.TypeError; - var getFlags = functionUncurryThis(regexpFlags); + var $TypeError$d = TypeError; var indexOf = functionUncurryThis(''.indexOf); functionUncurryThis(''.replace); var stringSlice$7 = functionUncurryThis(''.slice); - var max$2 = Math.max; + var max$3 = Math.max; var stringIndexOf = function (string, searchValue, fromIndex) { if (fromIndex > string.length) { return -1; } @@ -8974,11 +9664,8 @@ var doric = (function (exports) { if (searchValue != null) { IS_REG_EXP = isRegexp(searchValue); if (IS_REG_EXP) { - flags = toString_1(requireObjectCoercible('flags' in RegExpPrototype - ? searchValue.flags - : getFlags(searchValue) - )); - if (!~indexOf(flags, 'g')) { throw TypeError$f('`.replaceAll` does not allow non-global regexes'); } + flags = toString_1(requireObjectCoercible(regexpGetFlags(searchValue))); + if (!~indexOf(flags, 'g')) { throw $TypeError$d('`.replaceAll` does not allow non-global regexes'); } } replacer = getMethod(searchValue, REPLACE); if (replacer) { @@ -8990,7 +9677,7 @@ var doric = (function (exports) { functionalReplace = isCallable(replaceValue); if (!functionalReplace) { replaceValue = toString_1(replaceValue); } searchLength = searchString.length; - advanceBy = max$2(1, searchLength); + advanceBy = max$3(1, searchLength); position = stringIndexOf(string, searchString, 0); while (position !== -1) { replacement = functionalReplace @@ -9037,10 +9724,10 @@ var doric = (function (exports) { var UNSUPPORTED_Y = regexpStickyHelpers.UNSUPPORTED_Y; var MAX_UINT32 = 0xFFFFFFFF; - var min$3 = Math.min; + var min$4 = Math.min; var $push = [].push; - var exec$4 = functionUncurryThis(/./.exec); - var push$a = functionUncurryThis($push); + var exec$6 = functionUncurryThis(/./.exec); + var push$d = functionUncurryThis($push); var stringSlice$6 = functionUncurryThis(''.slice); // Chrome 51 has a buggy "split" implementation when RegExp#exec !== nativeExec @@ -9089,8 +9776,8 @@ var doric = (function (exports) { while (match = functionCall(regexpExec, separatorCopy, string)) { lastIndex = separatorCopy.lastIndex; if (lastIndex > lastLastIndex) { - push$a(output, stringSlice$6(string, lastLastIndex, match.index)); - if (match.length > 1 && match.index < string.length) { functionApply($push, output, arraySlice$1(match, 1)); } + push$d(output, stringSlice$6(string, lastLastIndex, match.index)); + if (match.length > 1 && match.index < string.length) { functionApply($push, output, arraySliceSimple(match, 1)); } lastLength = match[0].length; lastLastIndex = lastIndex; if (output.length >= lim) { break; } @@ -9098,9 +9785,9 @@ var doric = (function (exports) { if (separatorCopy.lastIndex === match.index) { separatorCopy.lastIndex++; } // Avoid an infinite loop } if (lastLastIndex === string.length) { - if (lastLength || !exec$4(separatorCopy, '')) { push$a(output, ''); } - } else { push$a(output, stringSlice$6(string, lastLastIndex)); } - return output.length > lim ? arraySlice$1(output, 0, lim) : output; + if (lastLength || !exec$6(separatorCopy, '')) { push$d(output, ''); } + } else { push$d(output, stringSlice$6(string, lastLastIndex)); } + return output.length > lim ? arraySliceSimple(output, 0, lim) : output; }; // Chakra, V8 } else if ('0'.split(undefined, 0).length) { @@ -9154,26 +9841,26 @@ var doric = (function (exports) { var e; if ( z === null || - (e = min$3(toLength(splitter.lastIndex + (UNSUPPORTED_Y ? q : 0)), S.length)) === p + (e = min$4(toLength(splitter.lastIndex + (UNSUPPORTED_Y ? q : 0)), S.length)) === p ) { q = advanceStringIndex(S, q, unicodeMatching); } else { - push$a(A, stringSlice$6(S, p, q)); + push$d(A, stringSlice$6(S, p, q)); if (A.length === lim) { return A; } for (var i = 1; i <= z.length - 1; i++) { - push$a(A, z[i]); + push$d(A, z[i]); if (A.length === lim) { return A; } } q = p = e; } } - push$a(A, stringSlice$6(S, p)); + push$d(A, stringSlice$6(S, p)); return A; } ]; }, !SPLIT_WORKS_WITH_OVERWRITTEN_EXEC, UNSUPPORTED_Y); - var getOwnPropertyDescriptor = objectGetOwnPropertyDescriptor.f; + var getOwnPropertyDescriptor$2 = objectGetOwnPropertyDescriptor.f; @@ -9181,15 +9868,15 @@ var doric = (function (exports) { - // eslint-disable-next-line es/no-string-prototype-startswith -- safe + // eslint-disable-next-line es-x/no-string-prototype-startswith -- safe var un$StartsWith = functionUncurryThis(''.startsWith); var stringSlice$5 = functionUncurryThis(''.slice); - var min$2 = Math.min; + var min$3 = Math.min; var CORRECT_IS_REGEXP_LOGIC = correctIsRegexpLogic('startsWith'); // https://github.com/zloirock/core-js/pull/702 var MDN_POLYFILL_BUG = !CORRECT_IS_REGEXP_LOGIC && !!function () { - var descriptor = getOwnPropertyDescriptor(String.prototype, 'startsWith'); + var descriptor = getOwnPropertyDescriptor$2(String.prototype, 'startsWith'); return descriptor && !descriptor.writable; }(); @@ -9199,7 +9886,7 @@ var doric = (function (exports) { startsWith: function startsWith(searchString /* , position = 0 */) { var that = toString_1(requireObjectCoercible(this)); notARegexp(searchString); - var index = toLength(min$2(arguments.length > 1 ? arguments[1] : undefined, that.length)); + var index = toLength(min$3(arguments.length > 1 ? arguments[1] : undefined, that.length)); var search = toString_1(searchString); return un$StartsWith ? un$StartsWith(that, search, index) @@ -9208,30 +9895,30 @@ var doric = (function (exports) { }); var stringSlice$4 = functionUncurryThis(''.slice); - var max$1 = Math.max; - var min$1 = Math.min; + var max$2 = Math.max; + var min$2 = Math.min; - // eslint-disable-next-line unicorn/prefer-string-slice -- required for testing - var FORCED$8 = !''.substr || 'ab'.substr(-1) !== 'b'; + // eslint-disable-next-line unicorn/prefer-string-slice, es-x/no-string-prototype-substr -- required for testing + var FORCED$3 = !''.substr || 'ab'.substr(-1) !== 'b'; // `String.prototype.substr` method // https://tc39.es/ecma262/#sec-string.prototype.substr - _export({ target: 'String', proto: true, forced: FORCED$8 }, { + _export({ target: 'String', proto: true, forced: FORCED$3 }, { substr: function substr(start, length) { var that = toString_1(requireObjectCoercible(this)); var size = that.length; var intStart = toIntegerOrInfinity(start); var intLength, intEnd; if (intStart === Infinity) { intStart = 0; } - if (intStart < 0) { intStart = max$1(size + intStart, 0); } + if (intStart < 0) { intStart = max$2(size + intStart, 0); } intLength = length === undefined ? size : toIntegerOrInfinity(length); if (intLength <= 0 || intLength === Infinity) { return ''; } - intEnd = min$1(intStart + intLength, size); + intEnd = min$2(intStart + intLength, size); return intStart >= intEnd ? '' : stringSlice$4(that, intStart, intEnd); } }); - var PROPER_FUNCTION_NAME$1 = functionName.PROPER; + var PROPER_FUNCTION_NAME = functionName.PROPER; @@ -9241,9 +9928,9 @@ var doric = (function (exports) { // of whitespaces and has a correct name var stringTrimForced = function (METHOD_NAME) { return fails(function () { - return !!whitespaces[METHOD_NAME]() + return !!whitespaces$1[METHOD_NAME]() || non[METHOD_NAME]() !== non - || (PROPER_FUNCTION_NAME$1 && whitespaces[METHOD_NAME].name !== METHOD_NAME); + || (PROPER_FUNCTION_NAME && whitespaces$1[METHOD_NAME].name !== METHOD_NAME); }); }; @@ -9261,48 +9948,72 @@ var doric = (function (exports) { var $trimEnd = stringTrim.end; - var FORCED$7 = stringTrimForced('trimEnd'); - - var trimEnd = FORCED$7 ? function trimEnd() { - return $trimEnd(this); - // eslint-disable-next-line es/no-string-prototype-trimstart-trimend -- safe - } : ''.trimEnd; - - // `String.prototype.{ trimEnd, trimRight }` methods + // `String.prototype.{ trimEnd, trimRight }` method // https://tc39.es/ecma262/#sec-string.prototype.trimend // https://tc39.es/ecma262/#String.prototype.trimright - _export({ target: 'String', proto: true, name: 'trimEnd', forced: FORCED$7 }, { - trimEnd: trimEnd, - trimRight: trimEnd + var stringTrimEnd = stringTrimForced('trimEnd') ? function trimEnd() { + return $trimEnd(this); + // eslint-disable-next-line es-x/no-string-prototype-trimstart-trimend -- safe + } : ''.trimEnd; + + // `String.prototype.trimRight` method + // https://tc39.es/ecma262/#sec-string.prototype.trimend + // eslint-disable-next-line es-x/no-string-prototype-trimleft-trimright -- safe + _export({ target: 'String', proto: true, name: 'trimEnd', forced: ''.trimRight !== stringTrimEnd }, { + trimRight: stringTrimEnd + }); + + // TODO: Remove this line from `core-js@4` + + + + + // `String.prototype.trimEnd` method + // https://tc39.es/ecma262/#sec-string.prototype.trimend + // eslint-disable-next-line es-x/no-string-prototype-trimstart-trimend -- safe + _export({ target: 'String', proto: true, name: 'trimEnd', forced: ''.trimEnd !== stringTrimEnd }, { + trimEnd: stringTrimEnd }); var $trimStart = stringTrim.start; - var FORCED$6 = stringTrimForced('trimStart'); - - var trimStart = FORCED$6 ? function trimStart() { - return $trimStart(this); - // eslint-disable-next-line es/no-string-prototype-trimstart-trimend -- safe - } : ''.trimStart; - - // `String.prototype.{ trimStart, trimLeft }` methods + // `String.prototype.{ trimStart, trimLeft }` method // https://tc39.es/ecma262/#sec-string.prototype.trimstart // https://tc39.es/ecma262/#String.prototype.trimleft - _export({ target: 'String', proto: true, name: 'trimStart', forced: FORCED$6 }, { - trimStart: trimStart, - trimLeft: trimStart + var stringTrimStart = stringTrimForced('trimStart') ? function trimStart() { + return $trimStart(this); + // eslint-disable-next-line es-x/no-string-prototype-trimstart-trimend -- safe + } : ''.trimStart; + + // `String.prototype.trimLeft` method + // https://tc39.es/ecma262/#sec-string.prototype.trimleft + // eslint-disable-next-line es-x/no-string-prototype-trimleft-trimright -- safe + _export({ target: 'String', proto: true, name: 'trimStart', forced: ''.trimLeft !== stringTrimStart }, { + trimLeft: stringTrimStart + }); + + // TODO: Remove this line from `core-js@4` + + + + + // `String.prototype.trimStart` method + // https://tc39.es/ecma262/#sec-string.prototype.trimstart + // eslint-disable-next-line es-x/no-string-prototype-trimstart-trimend -- safe + _export({ target: 'String', proto: true, name: 'trimStart', forced: ''.trimStart !== stringTrimStart }, { + trimStart: stringTrimStart }); var quot = /"/g; - var replace$3 = functionUncurryThis(''.replace); + var replace$4 = functionUncurryThis(''.replace); // `CreateHTML` abstract operation // https://tc39.es/ecma262/#sec-createhtml var createHtml = function (string, tag, attribute, value) { var S = toString_1(requireObjectCoercible(string)); var p1 = '<' + tag; - if (attribute !== '') { p1 += ' ' + attribute + '="' + replace$3(toString_1(value), quot, '"') + '"'; } + if (attribute !== '') { p1 += ' ' + attribute + '="' + replace$4(toString_1(value), quot, '"') + '"'; } return p1 + '>' + S + ''; }; @@ -9426,35 +10137,35 @@ var doric = (function (exports) { var NATIVE_ARRAY_BUFFER_VIEWS = arrayBufferViewCore.NATIVE_ARRAY_BUFFER_VIEWS; var ArrayBuffer$1 = global_1.ArrayBuffer; - var Int8Array$2 = global_1.Int8Array; + var Int8Array$3 = global_1.Int8Array; var typedArrayConstructorsRequireWrappers = !NATIVE_ARRAY_BUFFER_VIEWS || !fails(function () { - Int8Array$2(1); + Int8Array$3(1); }) || !fails(function () { - new Int8Array$2(-1); + new Int8Array$3(-1); }) || !checkCorrectnessOfIteration(function (iterable) { - new Int8Array$2(); - new Int8Array$2(null); - new Int8Array$2(1.5); - new Int8Array$2(iterable); + new Int8Array$3(); + new Int8Array$3(null); + new Int8Array$3(1.5); + new Int8Array$3(iterable); }, true) || fails(function () { // Safari (11+) bug - a reason why even Safari 13 should load a typed array polyfill - return new Int8Array$2(new ArrayBuffer$1(2), 1, undefined).length !== 1; + return new Int8Array$3(new ArrayBuffer$1(2), 1, undefined).length !== 1; }); - var RangeError$5 = global_1.RangeError; + var $RangeError$5 = RangeError; var toPositiveInteger = function (it) { var result = toIntegerOrInfinity(it); - if (result < 0) { throw RangeError$5("The argument can't be less than 0"); } + if (result < 0) { throw $RangeError$5("The argument can't be less than 0"); } return result; }; - var RangeError$4 = global_1.RangeError; + var $RangeError$4 = RangeError; var toOffset = function (it, BYTES) { var offset = toPositiveInteger(it); - if (offset % BYTES) { throw RangeError$4('Wrong offset'); } + if (offset % BYTES) { throw $RangeError$4('Wrong offset'); } return offset; }; @@ -9712,11 +10423,11 @@ var doric = (function (exports) { createNonEnumerableProperty(TypedArrayConstructorPrototype, TYPED_ARRAY_TAG, CONSTRUCTOR_NAME); } + var FORCED = TypedArrayConstructor != NativeTypedArrayConstructor; + exported[CONSTRUCTOR_NAME] = TypedArrayConstructor; - _export({ - global: true, forced: TypedArrayConstructor != NativeTypedArrayConstructor, sham: !NATIVE_ARRAY_BUFFER_VIEWS - }, exported); + _export({ global: true, constructor: true, forced: FORCED, sham: !NATIVE_ARRAY_BUFFER_VIEWS }, exported); if (!(BYTES_PER_ELEMENT in TypedArrayConstructor)) { createNonEnumerableProperty(TypedArrayConstructor, BYTES_PER_ELEMENT, BYTES); @@ -9803,13 +10514,13 @@ var doric = (function (exports) { }; }); - var aTypedArray$s = arrayBufferViewCore.aTypedArray; - var exportTypedArrayMethod$t = arrayBufferViewCore.exportTypedArrayMethod; + var aTypedArray$w = arrayBufferViewCore.aTypedArray; + var exportTypedArrayMethod$x = arrayBufferViewCore.exportTypedArrayMethod; // `%TypedArray%.prototype.at` method // https://github.com/tc39/proposal-relative-indexing-method - exportTypedArrayMethod$t('at', function at(index) { - var O = aTypedArray$s(this); + exportTypedArrayMethod$x('at', function at(index) { + var O = aTypedArray$w(this); var len = lengthOfArrayLike(O); var relativeIndex = toIntegerOrInfinity(index); var k = relativeIndex >= 0 ? relativeIndex : len + relativeIndex; @@ -9817,57 +10528,73 @@ var doric = (function (exports) { }); var u$ArrayCopyWithin = functionUncurryThis(arrayCopyWithin); - var aTypedArray$r = arrayBufferViewCore.aTypedArray; - var exportTypedArrayMethod$s = arrayBufferViewCore.exportTypedArrayMethod; + var aTypedArray$v = arrayBufferViewCore.aTypedArray; + var exportTypedArrayMethod$w = arrayBufferViewCore.exportTypedArrayMethod; // `%TypedArray%.prototype.copyWithin` method // https://tc39.es/ecma262/#sec-%typedarray%.prototype.copywithin - exportTypedArrayMethod$s('copyWithin', function copyWithin(target, start /* , end */) { - return u$ArrayCopyWithin(aTypedArray$r(this), target, start, arguments.length > 2 ? arguments[2] : undefined); + exportTypedArrayMethod$w('copyWithin', function copyWithin(target, start /* , end */) { + return u$ArrayCopyWithin(aTypedArray$v(this), target, start, arguments.length > 2 ? arguments[2] : undefined); }); var $every$1 = arrayIteration.every; - var aTypedArray$q = arrayBufferViewCore.aTypedArray; - var exportTypedArrayMethod$r = arrayBufferViewCore.exportTypedArrayMethod; + var aTypedArray$u = arrayBufferViewCore.aTypedArray; + var exportTypedArrayMethod$v = arrayBufferViewCore.exportTypedArrayMethod; // `%TypedArray%.prototype.every` method // https://tc39.es/ecma262/#sec-%typedarray%.prototype.every - exportTypedArrayMethod$r('every', function every(callbackfn /* , thisArg */) { - return $every$1(aTypedArray$q(this), callbackfn, arguments.length > 1 ? arguments[1] : undefined); + exportTypedArrayMethod$v('every', function every(callbackfn /* , thisArg */) { + return $every$1(aTypedArray$u(this), callbackfn, arguments.length > 1 ? arguments[1] : undefined); }); - var aTypedArray$p = arrayBufferViewCore.aTypedArray; - var exportTypedArrayMethod$q = arrayBufferViewCore.exportTypedArrayMethod; + var $TypeError$c = TypeError; + + // `ToBigInt` abstract operation + // https://tc39.es/ecma262/#sec-tobigint + var toBigInt = function (argument) { + var prim = toPrimitive(argument, 'number'); + if (typeof prim == 'number') { throw $TypeError$c("Can't convert number to bigint"); } + // eslint-disable-next-line es-x/no-bigint -- safe + return BigInt(prim); + }; + + var aTypedArray$t = arrayBufferViewCore.aTypedArray; + var exportTypedArrayMethod$u = arrayBufferViewCore.exportTypedArrayMethod; + var slice$1 = functionUncurryThis(''.slice); + + // V8 ~ Chrome < 59, Safari < 14.1, FF < 55, Edge <=18 + var CONVERSION_BUG = fails(function () { + var count = 0; + // eslint-disable-next-line es-x/no-typed-arrays -- safe + new Int8Array(2).fill({ valueOf: function () { return count++; } }); + return count !== 1; + }); // `%TypedArray%.prototype.fill` method // https://tc39.es/ecma262/#sec-%typedarray%.prototype.fill - exportTypedArrayMethod$q('fill', function fill(value /* , start, end */) { + exportTypedArrayMethod$u('fill', function fill(value /* , start, end */) { var length = arguments.length; - return functionCall( - arrayFill, - aTypedArray$p(this), - value, - length > 1 ? arguments[1] : undefined, - length > 2 ? arguments[2] : undefined - ); - }); + aTypedArray$t(this); + var actualValue = slice$1(classof(this), 0, 3) === 'Big' ? toBigInt(value) : +value; + return functionCall(arrayFill, this, actualValue, length > 1 ? arguments[1] : undefined, length > 2 ? arguments[2] : undefined); + }, CONVERSION_BUG); var arrayFromConstructorAndList = function (Constructor, list) { var index = 0; - var length = list.length; + var length = lengthOfArrayLike(list); var result = new Constructor(length); while (length > index) { result[index] = list[index++]; } return result; }; - var TYPED_ARRAY_CONSTRUCTOR = arrayBufferViewCore.TYPED_ARRAY_CONSTRUCTOR; + var TYPED_ARRAY_CONSTRUCTOR$4 = arrayBufferViewCore.TYPED_ARRAY_CONSTRUCTOR; var aTypedArrayConstructor$2 = arrayBufferViewCore.aTypedArrayConstructor; // a part of `TypedArraySpeciesCreate` abstract operation // https://tc39.es/ecma262/#typedarray-species-create var typedArraySpeciesConstructor = function (originalArray) { - return aTypedArrayConstructor$2(speciesConstructor(originalArray, originalArray[TYPED_ARRAY_CONSTRUCTOR])); + return aTypedArrayConstructor$2(speciesConstructor(originalArray, originalArray[TYPED_ARRAY_CONSTRUCTOR$4])); }; var typedArrayFromSpeciesAndList = function (instance, list) { @@ -9877,47 +10604,69 @@ var doric = (function (exports) { var $filter = arrayIteration.filter; - var aTypedArray$o = arrayBufferViewCore.aTypedArray; - var exportTypedArrayMethod$p = arrayBufferViewCore.exportTypedArrayMethod; + var aTypedArray$s = arrayBufferViewCore.aTypedArray; + var exportTypedArrayMethod$t = arrayBufferViewCore.exportTypedArrayMethod; // `%TypedArray%.prototype.filter` method // https://tc39.es/ecma262/#sec-%typedarray%.prototype.filter - exportTypedArrayMethod$p('filter', function filter(callbackfn /* , thisArg */) { - var list = $filter(aTypedArray$o(this), callbackfn, arguments.length > 1 ? arguments[1] : undefined); + exportTypedArrayMethod$t('filter', function filter(callbackfn /* , thisArg */) { + var list = $filter(aTypedArray$s(this), callbackfn, arguments.length > 1 ? arguments[1] : undefined); return typedArrayFromSpeciesAndList(this, list); }); var $find$1 = arrayIteration.find; - var aTypedArray$n = arrayBufferViewCore.aTypedArray; - var exportTypedArrayMethod$o = arrayBufferViewCore.exportTypedArrayMethod; + var aTypedArray$r = arrayBufferViewCore.aTypedArray; + var exportTypedArrayMethod$s = arrayBufferViewCore.exportTypedArrayMethod; // `%TypedArray%.prototype.find` method // https://tc39.es/ecma262/#sec-%typedarray%.prototype.find - exportTypedArrayMethod$o('find', function find(predicate /* , thisArg */) { - return $find$1(aTypedArray$n(this), predicate, arguments.length > 1 ? arguments[1] : undefined); + exportTypedArrayMethod$s('find', function find(predicate /* , thisArg */) { + return $find$1(aTypedArray$r(this), predicate, arguments.length > 1 ? arguments[1] : undefined); }); var $findIndex = arrayIteration.findIndex; - var aTypedArray$m = arrayBufferViewCore.aTypedArray; - var exportTypedArrayMethod$n = arrayBufferViewCore.exportTypedArrayMethod; + var aTypedArray$q = arrayBufferViewCore.aTypedArray; + var exportTypedArrayMethod$r = arrayBufferViewCore.exportTypedArrayMethod; // `%TypedArray%.prototype.findIndex` method // https://tc39.es/ecma262/#sec-%typedarray%.prototype.findindex - exportTypedArrayMethod$n('findIndex', function findIndex(predicate /* , thisArg */) { - return $findIndex(aTypedArray$m(this), predicate, arguments.length > 1 ? arguments[1] : undefined); + exportTypedArrayMethod$r('findIndex', function findIndex(predicate /* , thisArg */) { + return $findIndex(aTypedArray$q(this), predicate, arguments.length > 1 ? arguments[1] : undefined); + }); + + var $findLast = arrayIterationFromLast.findLast; + + var aTypedArray$p = arrayBufferViewCore.aTypedArray; + var exportTypedArrayMethod$q = arrayBufferViewCore.exportTypedArrayMethod; + + // `%TypedArray%.prototype.findLast` method + // https://github.com/tc39/proposal-array-find-from-last + exportTypedArrayMethod$q('findLast', function findLast(predicate /* , thisArg */) { + return $findLast(aTypedArray$p(this), predicate, arguments.length > 1 ? arguments[1] : undefined); + }); + + var $findLastIndex = arrayIterationFromLast.findLastIndex; + + var aTypedArray$o = arrayBufferViewCore.aTypedArray; + var exportTypedArrayMethod$p = arrayBufferViewCore.exportTypedArrayMethod; + + // `%TypedArray%.prototype.findLastIndex` method + // https://github.com/tc39/proposal-array-find-from-last + exportTypedArrayMethod$p('findLastIndex', function findLastIndex(predicate /* , thisArg */) { + return $findLastIndex(aTypedArray$o(this), predicate, arguments.length > 1 ? arguments[1] : undefined); }); var $forEach$1 = arrayIteration.forEach; - var aTypedArray$l = arrayBufferViewCore.aTypedArray; - var exportTypedArrayMethod$m = arrayBufferViewCore.exportTypedArrayMethod; + var aTypedArray$n = arrayBufferViewCore.aTypedArray; + var exportTypedArrayMethod$o = arrayBufferViewCore.exportTypedArrayMethod; // `%TypedArray%.prototype.forEach` method // https://tc39.es/ecma262/#sec-%typedarray%.prototype.foreach - exportTypedArrayMethod$m('forEach', function forEach(callbackfn /* , thisArg */) { - $forEach$1(aTypedArray$l(this), callbackfn, arguments.length > 1 ? arguments[1] : undefined); + exportTypedArrayMethod$o('forEach', function forEach(callbackfn /* , thisArg */) { + $forEach$1(aTypedArray$n(this), callbackfn, arguments.length > 1 ? arguments[1] : undefined); }); var exportTypedArrayStaticMethod$2 = arrayBufferViewCore.exportTypedArrayStaticMethod; @@ -9929,93 +10678,95 @@ var doric = (function (exports) { var $includes = arrayIncludes.includes; - var aTypedArray$k = arrayBufferViewCore.aTypedArray; - var exportTypedArrayMethod$l = arrayBufferViewCore.exportTypedArrayMethod; + var aTypedArray$m = arrayBufferViewCore.aTypedArray; + var exportTypedArrayMethod$n = arrayBufferViewCore.exportTypedArrayMethod; // `%TypedArray%.prototype.includes` method // https://tc39.es/ecma262/#sec-%typedarray%.prototype.includes - exportTypedArrayMethod$l('includes', function includes(searchElement /* , fromIndex */) { - return $includes(aTypedArray$k(this), searchElement, arguments.length > 1 ? arguments[1] : undefined); + exportTypedArrayMethod$n('includes', function includes(searchElement /* , fromIndex */) { + return $includes(aTypedArray$m(this), searchElement, arguments.length > 1 ? arguments[1] : undefined); }); var $indexOf = arrayIncludes.indexOf; - var aTypedArray$j = arrayBufferViewCore.aTypedArray; - var exportTypedArrayMethod$k = arrayBufferViewCore.exportTypedArrayMethod; + var aTypedArray$l = arrayBufferViewCore.aTypedArray; + var exportTypedArrayMethod$m = arrayBufferViewCore.exportTypedArrayMethod; // `%TypedArray%.prototype.indexOf` method // https://tc39.es/ecma262/#sec-%typedarray%.prototype.indexof - exportTypedArrayMethod$k('indexOf', function indexOf(searchElement /* , fromIndex */) { - return $indexOf(aTypedArray$j(this), searchElement, arguments.length > 1 ? arguments[1] : undefined); + exportTypedArrayMethod$m('indexOf', function indexOf(searchElement /* , fromIndex */) { + return $indexOf(aTypedArray$l(this), searchElement, arguments.length > 1 ? arguments[1] : undefined); }); - var PROPER_FUNCTION_NAME = functionName.PROPER; - - - - var ITERATOR$3 = wellKnownSymbol('iterator'); var Uint8Array$2 = global_1.Uint8Array; var arrayValues = functionUncurryThis(es_array_iterator.values); var arrayKeys = functionUncurryThis(es_array_iterator.keys); var arrayEntries = functionUncurryThis(es_array_iterator.entries); - var aTypedArray$i = arrayBufferViewCore.aTypedArray; - var exportTypedArrayMethod$j = arrayBufferViewCore.exportTypedArrayMethod; - var nativeTypedArrayIterator = Uint8Array$2 && Uint8Array$2.prototype[ITERATOR$3]; + var aTypedArray$k = arrayBufferViewCore.aTypedArray; + var exportTypedArrayMethod$l = arrayBufferViewCore.exportTypedArrayMethod; + var TypedArrayPrototype = Uint8Array$2 && Uint8Array$2.prototype; - var PROPER_ARRAY_VALUES_NAME = !!nativeTypedArrayIterator && nativeTypedArrayIterator.name === 'values'; + var GENERIC = !fails(function () { + TypedArrayPrototype[ITERATOR$3].call([1]); + }); + + var ITERATOR_IS_VALUES = !!TypedArrayPrototype + && TypedArrayPrototype.values + && TypedArrayPrototype[ITERATOR$3] === TypedArrayPrototype.values + && TypedArrayPrototype.values.name === 'values'; var typedArrayValues = function values() { - return arrayValues(aTypedArray$i(this)); + return arrayValues(aTypedArray$k(this)); }; // `%TypedArray%.prototype.entries` method // https://tc39.es/ecma262/#sec-%typedarray%.prototype.entries - exportTypedArrayMethod$j('entries', function entries() { - return arrayEntries(aTypedArray$i(this)); - }); + exportTypedArrayMethod$l('entries', function entries() { + return arrayEntries(aTypedArray$k(this)); + }, GENERIC); // `%TypedArray%.prototype.keys` method // https://tc39.es/ecma262/#sec-%typedarray%.prototype.keys - exportTypedArrayMethod$j('keys', function keys() { - return arrayKeys(aTypedArray$i(this)); - }); + exportTypedArrayMethod$l('keys', function keys() { + return arrayKeys(aTypedArray$k(this)); + }, GENERIC); // `%TypedArray%.prototype.values` method // https://tc39.es/ecma262/#sec-%typedarray%.prototype.values - exportTypedArrayMethod$j('values', typedArrayValues, PROPER_FUNCTION_NAME && !PROPER_ARRAY_VALUES_NAME); + exportTypedArrayMethod$l('values', typedArrayValues, GENERIC || !ITERATOR_IS_VALUES, { name: 'values' }); // `%TypedArray%.prototype[@@iterator]` method // https://tc39.es/ecma262/#sec-%typedarray%.prototype-@@iterator - exportTypedArrayMethod$j(ITERATOR$3, typedArrayValues, PROPER_FUNCTION_NAME && !PROPER_ARRAY_VALUES_NAME); + exportTypedArrayMethod$l(ITERATOR$3, typedArrayValues, GENERIC || !ITERATOR_IS_VALUES, { name: 'values' }); - var aTypedArray$h = arrayBufferViewCore.aTypedArray; - var exportTypedArrayMethod$i = arrayBufferViewCore.exportTypedArrayMethod; + var aTypedArray$j = arrayBufferViewCore.aTypedArray; + var exportTypedArrayMethod$k = arrayBufferViewCore.exportTypedArrayMethod; var $join = functionUncurryThis([].join); // `%TypedArray%.prototype.join` method // https://tc39.es/ecma262/#sec-%typedarray%.prototype.join - exportTypedArrayMethod$i('join', function join(separator) { - return $join(aTypedArray$h(this), separator); + exportTypedArrayMethod$k('join', function join(separator) { + return $join(aTypedArray$j(this), separator); }); - var aTypedArray$g = arrayBufferViewCore.aTypedArray; - var exportTypedArrayMethod$h = arrayBufferViewCore.exportTypedArrayMethod; + var aTypedArray$i = arrayBufferViewCore.aTypedArray; + var exportTypedArrayMethod$j = arrayBufferViewCore.exportTypedArrayMethod; // `%TypedArray%.prototype.lastIndexOf` method // https://tc39.es/ecma262/#sec-%typedarray%.prototype.lastindexof - exportTypedArrayMethod$h('lastIndexOf', function lastIndexOf(searchElement /* , fromIndex */) { + exportTypedArrayMethod$j('lastIndexOf', function lastIndexOf(searchElement /* , fromIndex */) { var length = arguments.length; - return functionApply(arrayLastIndexOf, aTypedArray$g(this), length > 1 ? [searchElement, arguments[1]] : [searchElement]); + return functionApply(arrayLastIndexOf, aTypedArray$i(this), length > 1 ? [searchElement, arguments[1]] : [searchElement]); }); var $map = arrayIteration.map; - var aTypedArray$f = arrayBufferViewCore.aTypedArray; - var exportTypedArrayMethod$g = arrayBufferViewCore.exportTypedArrayMethod; + var aTypedArray$h = arrayBufferViewCore.aTypedArray; + var exportTypedArrayMethod$i = arrayBufferViewCore.exportTypedArrayMethod; // `%TypedArray%.prototype.map` method // https://tc39.es/ecma262/#sec-%typedarray%.prototype.map - exportTypedArrayMethod$g('map', function map(mapfn /* , thisArg */) { - return $map(aTypedArray$f(this), mapfn, arguments.length > 1 ? arguments[1] : undefined, function (O, length) { + exportTypedArrayMethod$i('map', function map(mapfn /* , thisArg */) { + return $map(aTypedArray$h(this), mapfn, arguments.length > 1 ? arguments[1] : undefined, function (O, length) { return new (typedArraySpeciesConstructor(O))(length); }); }); @@ -10037,37 +10788,37 @@ var doric = (function (exports) { var $reduce = arrayReduce.left; - var aTypedArray$e = arrayBufferViewCore.aTypedArray; - var exportTypedArrayMethod$f = arrayBufferViewCore.exportTypedArrayMethod; + var aTypedArray$g = arrayBufferViewCore.aTypedArray; + var exportTypedArrayMethod$h = arrayBufferViewCore.exportTypedArrayMethod; // `%TypedArray%.prototype.reduce` method // https://tc39.es/ecma262/#sec-%typedarray%.prototype.reduce - exportTypedArrayMethod$f('reduce', function reduce(callbackfn /* , initialValue */) { + exportTypedArrayMethod$h('reduce', function reduce(callbackfn /* , initialValue */) { var length = arguments.length; - return $reduce(aTypedArray$e(this), callbackfn, length, length > 1 ? arguments[1] : undefined); + return $reduce(aTypedArray$g(this), callbackfn, length, length > 1 ? arguments[1] : undefined); }); var $reduceRight = arrayReduce.right; - var aTypedArray$d = arrayBufferViewCore.aTypedArray; - var exportTypedArrayMethod$e = arrayBufferViewCore.exportTypedArrayMethod; + var aTypedArray$f = arrayBufferViewCore.aTypedArray; + var exportTypedArrayMethod$g = arrayBufferViewCore.exportTypedArrayMethod; // `%TypedArray%.prototype.reduceRicht` method // https://tc39.es/ecma262/#sec-%typedarray%.prototype.reduceright - exportTypedArrayMethod$e('reduceRight', function reduceRight(callbackfn /* , initialValue */) { + exportTypedArrayMethod$g('reduceRight', function reduceRight(callbackfn /* , initialValue */) { var length = arguments.length; - return $reduceRight(aTypedArray$d(this), callbackfn, length, length > 1 ? arguments[1] : undefined); + return $reduceRight(aTypedArray$f(this), callbackfn, length, length > 1 ? arguments[1] : undefined); }); - var aTypedArray$c = arrayBufferViewCore.aTypedArray; - var exportTypedArrayMethod$d = arrayBufferViewCore.exportTypedArrayMethod; + var aTypedArray$e = arrayBufferViewCore.aTypedArray; + var exportTypedArrayMethod$f = arrayBufferViewCore.exportTypedArrayMethod; var floor$2 = Math.floor; // `%TypedArray%.prototype.reverse` method // https://tc39.es/ecma262/#sec-%typedarray%.prototype.reverse - exportTypedArrayMethod$d('reverse', function reverse() { + exportTypedArrayMethod$f('reverse', function reverse() { var that = this; - var length = aTypedArray$c(that).length; + var length = aTypedArray$e(that).length; var middle = floor$2(length / 2); var index = 0; var value; @@ -10078,62 +10829,75 @@ var doric = (function (exports) { } return that; }); - var RangeError$3 = global_1.RangeError; - var aTypedArray$b = arrayBufferViewCore.aTypedArray; - var exportTypedArrayMethod$c = arrayBufferViewCore.exportTypedArrayMethod; + var RangeError$2 = global_1.RangeError; + var Int8Array$2 = global_1.Int8Array; + var Int8ArrayPrototype = Int8Array$2 && Int8Array$2.prototype; + var $set = Int8ArrayPrototype && Int8ArrayPrototype.set; + var aTypedArray$d = arrayBufferViewCore.aTypedArray; + var exportTypedArrayMethod$e = arrayBufferViewCore.exportTypedArrayMethod; - var FORCED$5 = fails(function () { - // eslint-disable-next-line es/no-typed-arrays -- required for testing - new Int8Array(1).set({}); + var WORKS_WITH_OBJECTS_AND_GEERIC_ON_TYPED_ARRAYS = !fails(function () { + // eslint-disable-next-line es-x/no-typed-arrays -- required for testing + var array = new Uint8ClampedArray(2); + functionCall($set, array, { length: 1, 0: 3 }, 1); + return array[1] !== 3; + }); + + // https://bugs.chromium.org/p/v8/issues/detail?id=11294 and other + var TO_OBJECT_BUG = WORKS_WITH_OBJECTS_AND_GEERIC_ON_TYPED_ARRAYS && arrayBufferViewCore.NATIVE_ARRAY_BUFFER_VIEWS && fails(function () { + var array = new Int8Array$2(2); + array.set(1); + array.set('2', 1); + return array[0] !== 0 || array[1] !== 2; }); // `%TypedArray%.prototype.set` method // https://tc39.es/ecma262/#sec-%typedarray%.prototype.set - exportTypedArrayMethod$c('set', function set(arrayLike /* , offset */) { - aTypedArray$b(this); + exportTypedArrayMethod$e('set', function set(arrayLike /* , offset */) { + aTypedArray$d(this); var offset = toOffset(arguments.length > 1 ? arguments[1] : undefined, 1); - var length = this.length; var src = toObject(arrayLike); + if (WORKS_WITH_OBJECTS_AND_GEERIC_ON_TYPED_ARRAYS) { return functionCall($set, this, src, offset); } + var length = this.length; var len = lengthOfArrayLike(src); var index = 0; - if (len + offset > length) { throw RangeError$3('Wrong length'); } + if (len + offset > length) { throw RangeError$2('Wrong length'); } while (index < len) { this[offset + index] = src[index++]; } - }, FORCED$5); + }, !WORKS_WITH_OBJECTS_AND_GEERIC_ON_TYPED_ARRAYS || TO_OBJECT_BUG); - var aTypedArray$a = arrayBufferViewCore.aTypedArray; - var exportTypedArrayMethod$b = arrayBufferViewCore.exportTypedArrayMethod; + var aTypedArray$c = arrayBufferViewCore.aTypedArray; + var exportTypedArrayMethod$d = arrayBufferViewCore.exportTypedArrayMethod; - var FORCED$4 = fails(function () { - // eslint-disable-next-line es/no-typed-arrays -- required for testing + var FORCED$2 = fails(function () { + // eslint-disable-next-line es-x/no-typed-arrays -- required for testing new Int8Array(1).slice(); }); // `%TypedArray%.prototype.slice` method // https://tc39.es/ecma262/#sec-%typedarray%.prototype.slice - exportTypedArrayMethod$b('slice', function slice(start, end) { - var list = arraySlice$1(aTypedArray$a(this), start, end); + exportTypedArrayMethod$d('slice', function slice(start, end) { + var list = arraySlice$1(aTypedArray$c(this), start, end); var C = typedArraySpeciesConstructor(this); var index = 0; var length = list.length; var result = new C(length); while (length > index) { result[index] = list[index++]; } return result; - }, FORCED$4); + }, FORCED$2); var $some$1 = arrayIteration.some; - var aTypedArray$9 = arrayBufferViewCore.aTypedArray; - var exportTypedArrayMethod$a = arrayBufferViewCore.exportTypedArrayMethod; + var aTypedArray$b = arrayBufferViewCore.aTypedArray; + var exportTypedArrayMethod$c = arrayBufferViewCore.exportTypedArrayMethod; // `%TypedArray%.prototype.some` method // https://tc39.es/ecma262/#sec-%typedarray%.prototype.some - exportTypedArrayMethod$a('some', function some(callbackfn /* , thisArg */) { - return $some$1(aTypedArray$9(this), callbackfn, arguments.length > 1 ? arguments[1] : undefined); + exportTypedArrayMethod$c('some', function some(callbackfn /* , thisArg */) { + return $some$1(aTypedArray$b(this), callbackfn, arguments.length > 1 ? arguments[1] : undefined); }); - var Array$3 = global_1.Array; - var aTypedArray$8 = arrayBufferViewCore.aTypedArray; - var exportTypedArrayMethod$9 = arrayBufferViewCore.exportTypedArrayMethod; + var aTypedArray$a = arrayBufferViewCore.aTypedArray; + var exportTypedArrayMethod$b = arrayBufferViewCore.exportTypedArrayMethod; var Uint16Array = global_1.Uint16Array; var un$Sort = Uint16Array && functionUncurryThis(Uint16Array.prototype.sort); @@ -10152,7 +10916,7 @@ var doric = (function (exports) { if (engineWebkitVersion) { return engineWebkitVersion < 602; } var array = new Uint16Array(516); - var expected = Array$3(516); + var expected = Array(516); var index, mod; for (index = 0; index < 516; index++) { @@ -10184,20 +10948,20 @@ var doric = (function (exports) { // `%TypedArray%.prototype.sort` method // https://tc39.es/ecma262/#sec-%typedarray%.prototype.sort - exportTypedArrayMethod$9('sort', function sort(comparefn) { + exportTypedArrayMethod$b('sort', function sort(comparefn) { if (comparefn !== undefined) { aCallable(comparefn); } if (STABLE_SORT) { return un$Sort(this, comparefn); } - return arraySort(aTypedArray$8(this), getSortCompare(comparefn)); + return arraySort(aTypedArray$a(this), getSortCompare(comparefn)); }, !STABLE_SORT || ACCEPT_INCORRECT_ARGUMENTS); - var aTypedArray$7 = arrayBufferViewCore.aTypedArray; - var exportTypedArrayMethod$8 = arrayBufferViewCore.exportTypedArrayMethod; + var aTypedArray$9 = arrayBufferViewCore.aTypedArray; + var exportTypedArrayMethod$a = arrayBufferViewCore.exportTypedArrayMethod; // `%TypedArray%.prototype.subarray` method // https://tc39.es/ecma262/#sec-%typedarray%.prototype.subarray - exportTypedArrayMethod$8('subarray', function subarray(begin, end) { - var O = aTypedArray$7(this); + exportTypedArrayMethod$a('subarray', function subarray(begin, end) { + var O = aTypedArray$9(this); var length = O.length; var beginIndex = toAbsoluteIndex(begin, length); var C = typedArraySpeciesConstructor(O); @@ -10209,8 +10973,8 @@ var doric = (function (exports) { }); var Int8Array$1 = global_1.Int8Array; - var aTypedArray$6 = arrayBufferViewCore.aTypedArray; - var exportTypedArrayMethod$7 = arrayBufferViewCore.exportTypedArrayMethod; + var aTypedArray$8 = arrayBufferViewCore.aTypedArray; + var exportTypedArrayMethod$9 = arrayBufferViewCore.exportTypedArrayMethod; var $toLocaleString = [].toLocaleString; // iOS Safari 6.x fails here @@ -10218,7 +10982,7 @@ var doric = (function (exports) { $toLocaleString.call(new Int8Array$1(1)); }); - var FORCED$3 = fails(function () { + var FORCED$1 = fails(function () { return [1, 2].toLocaleString() != new Int8Array$1([1, 2]).toLocaleString(); }) || !fails(function () { Int8Array$1.prototype.toLocaleString.call([1, 2]); @@ -10226,15 +10990,15 @@ var doric = (function (exports) { // `%TypedArray%.prototype.toLocaleString` method // https://tc39.es/ecma262/#sec-%typedarray%.prototype.tolocalestring - exportTypedArrayMethod$7('toLocaleString', function toLocaleString() { + exportTypedArrayMethod$9('toLocaleString', function toLocaleString() { return functionApply( $toLocaleString, - TO_LOCALE_STRING_BUG ? arraySlice$1(aTypedArray$6(this)) : aTypedArray$6(this), + TO_LOCALE_STRING_BUG ? arraySlice$1(aTypedArray$8(this)) : aTypedArray$8(this), arraySlice$1(arguments) ); - }, FORCED$3); + }, FORCED$1); - var exportTypedArrayMethod$6 = arrayBufferViewCore.exportTypedArrayMethod; + var exportTypedArrayMethod$8 = arrayBufferViewCore.exportTypedArrayMethod; @@ -10242,11 +11006,11 @@ var doric = (function (exports) { var Uint8Array$1 = global_1.Uint8Array; var Uint8ArrayPrototype = Uint8Array$1 && Uint8Array$1.prototype || {}; var arrayToString = [].toString; - var join$3 = functionUncurryThis([].join); + var join$4 = functionUncurryThis([].join); if (fails(function () { arrayToString.call({}); })) { arrayToString = function toString() { - return join$3(this); + return join$4(this); }; } @@ -10254,11 +11018,11 @@ var doric = (function (exports) { // `%TypedArray%.prototype.toString` method // https://tc39.es/ecma262/#sec-%typedarray%.prototype.tostring - exportTypedArrayMethod$6('toString', arrayToString, IS_NOT_ARRAY_METHOD); + exportTypedArrayMethod$8('toString', arrayToString, IS_NOT_ARRAY_METHOD); - var fromCharCode$1 = String.fromCharCode; - var charAt$5 = functionUncurryThis(''.charAt); - var exec$3 = functionUncurryThis(/./.exec); + var fromCharCode$2 = String.fromCharCode; + var charAt$7 = functionUncurryThis(''.charAt); + var exec$5 = functionUncurryThis(/./.exec); var stringSlice$3 = functionUncurryThis(''.slice); var hex2 = /^[\da-f]{2}$/i; @@ -10274,19 +11038,19 @@ var doric = (function (exports) { var index = 0; var chr, part; while (index < length) { - chr = charAt$5(str, index++); + chr = charAt$7(str, index++); if (chr === '%') { - if (charAt$5(str, index) === 'u') { + if (charAt$7(str, index) === 'u') { part = stringSlice$3(str, index + 1, index + 5); - if (exec$3(hex4, part)) { - result += fromCharCode$1(parseInt(part, 16)); + if (exec$5(hex4, part)) { + result += fromCharCode$2(parseInt(part, 16)); index += 5; continue; } } else { part = stringSlice$3(str, index, index + 2); - if (exec$3(hex2, part)) { - result += fromCharCode$1(parseInt(part, 16)); + if (exec$5(hex2, part)) { + result += fromCharCode$2(parseInt(part, 16)); index += 2; continue; } @@ -10306,7 +11070,7 @@ var doric = (function (exports) { - var setInternalState$a = internalState.set; + var setInternalState$b = internalState.set; var internalStateGetterFor = internalState.getterFor; var find$1 = arrayIteration.find; var findIndex = arrayIteration.findIndex; @@ -10354,7 +11118,7 @@ var doric = (function (exports) { getConstructor: function (wrapper, CONSTRUCTOR_NAME, IS_MAP, ADDER) { var Constructor = wrapper(function (that, iterable) { anInstance(that, Prototype); - setInternalState$a(that, { + setInternalState$b(that, { type: CONSTRUCTOR_NAME, id: id++, frozen: undefined @@ -10374,7 +11138,7 @@ var doric = (function (exports) { return that; }; - redefineAll(Prototype, { + defineBuiltIns(Prototype, { // `{ WeakMap, WeakSet }.prototype.delete(key)` methods // https://tc39.es/ecma262/#sec-weakmap.prototype.delete // https://tc39.es/ecma262/#sec-weakset.prototype.delete @@ -10397,7 +11161,7 @@ var doric = (function (exports) { } }); - redefineAll(Prototype, IS_MAP ? { + defineBuiltIns(Prototype, IS_MAP ? { // `WeakMap.prototype.get(key)` method // https://tc39.es/ecma262/#sec-weakmap.prototype.get get: function get(key) { @@ -10425,12 +11189,10 @@ var doric = (function (exports) { } }; - var enforceIternalState = internalState.enforce; + var enforceInternalState = internalState.enforce; var IS_IE11 = !global_1.ActiveXObject && 'ActiveXObject' in global_1; - // eslint-disable-next-line es/no-object-isextensible -- safe - var isExtensible = Object.isExtensible; var InternalWeakMap; var wrapper = function (init) { @@ -10454,31 +11216,31 @@ var doric = (function (exports) { var nativeHas = functionUncurryThis(WeakMapPrototype.has); var nativeGet = functionUncurryThis(WeakMapPrototype.get); var nativeSet = functionUncurryThis(WeakMapPrototype.set); - redefineAll(WeakMapPrototype, { + defineBuiltIns(WeakMapPrototype, { 'delete': function (key) { - if (isObject(key) && !isExtensible(key)) { - var state = enforceIternalState(this); + if (isObject(key) && !objectIsExtensible(key)) { + var state = enforceInternalState(this); if (!state.frozen) { state.frozen = new InternalWeakMap(); } return nativeDelete(this, key) || state.frozen['delete'](key); } return nativeDelete(this, key); }, has: function has(key) { - if (isObject(key) && !isExtensible(key)) { - var state = enforceIternalState(this); + if (isObject(key) && !objectIsExtensible(key)) { + var state = enforceInternalState(this); if (!state.frozen) { state.frozen = new InternalWeakMap(); } return nativeHas(this, key) || state.frozen.has(key); } return nativeHas(this, key); }, get: function get(key) { - if (isObject(key) && !isExtensible(key)) { - var state = enforceIternalState(this); + if (isObject(key) && !objectIsExtensible(key)) { + var state = enforceInternalState(this); if (!state.frozen) { state.frozen = new InternalWeakMap(); } return nativeHas(this, key) ? nativeGet(this, key) : state.frozen.get(key); } return nativeGet(this, key); }, set: function set(key, value) { - if (isObject(key) && !isExtensible(key)) { - var state = enforceIternalState(this); + if (isObject(key) && !objectIsExtensible(key)) { + var state = enforceInternalState(this); if (!state.frozen) { state.frozen = new InternalWeakMap(); } nativeHas(this, key) ? nativeSet(this, key, value) : state.frozen.set(key, value); } else { nativeSet(this, key, value); } @@ -10514,7 +11276,7 @@ var doric = (function (exports) { if (!AsyncIteratorPrototype) { AsyncIteratorPrototype = {}; } if (!isCallable(AsyncIteratorPrototype[ASYNC_ITERATOR$3])) { - redefine(AsyncIteratorPrototype, ASYNC_ITERATOR$3, function () { + defineBuiltIn(AsyncIteratorPrototype, ASYNC_ITERATOR$3, function () { return this; }); } @@ -10523,8 +11285,9 @@ var doric = (function (exports) { var Promise$3 = getBuiltIn('Promise'); - var setInternalState$9 = internalState.set; - var getInternalState$7 = internalState.get; + var ASYNC_FROM_SYNC_ITERATOR = 'AsyncFromSyncIterator'; + var setInternalState$a = internalState.set; + var getInternalState$7 = internalState.getterFor(ASYNC_FROM_SYNC_ITERATOR); var asyncFromSyncIteratorContinuation = function (result, resolve, reject) { var done = result.done; @@ -10534,13 +11297,14 @@ var doric = (function (exports) { }; var AsyncFromSyncIterator = function AsyncIterator(iterator) { - setInternalState$9(this, { + setInternalState$a(this, { + type: ASYNC_FROM_SYNC_ITERATOR, iterator: anObject(iterator), next: iterator.next }); }; - AsyncFromSyncIterator.prototype = redefineAll(objectCreate(asyncIteratorPrototype), { + AsyncFromSyncIterator.prototype = defineBuiltIns(objectCreate(asyncIteratorPrototype), { next: function next(arg) { var state = getInternalState$7(this); var hasArg = !!arguments.length; @@ -10593,10 +11357,7 @@ var doric = (function (exports) { - var MAX_SAFE_INTEGER = 0x1FFFFFFFFFFFFF; - var TypeError$e = global_1.TypeError; - - var createMethod$1 = function (TYPE) { + var createMethod = function (TYPE) { var IS_TO_ARRAY = TYPE == 0; var IS_FOR_EACH = TYPE == 1; var IS_EVERY = TYPE == 2; @@ -10631,9 +11392,7 @@ var doric = (function (exports) { var loop = function () { try { - if (IS_TO_ARRAY && (index > MAX_SAFE_INTEGER) && MAPPING) { - throw TypeError$e('The allowed number of iterations has been exceeded'); - } + if (IS_TO_ARRAY && MAPPING) { doesNotExceedSafeInteger(index); } Promise.resolve(anObject(functionCall(next, iterator))).then(function (step) { try { if (anObject(step).done) { @@ -10672,11 +11431,11 @@ var doric = (function (exports) { }; var asyncIteratorIteration = { - toArray: createMethod$1(0), - forEach: createMethod$1(1), - every: createMethod$1(2), - some: createMethod$1(3), - find: createMethod$1(4) + toArray: createMethod(0), + forEach: createMethod(1), + every: createMethod(2), + some: createMethod(3), + find: createMethod(4) }; var toArray = asyncIteratorIteration.toArray; @@ -10706,7 +11465,7 @@ var doric = (function (exports) { // `Array.fromAsync` method // https://github.com/tc39/proposal-array-from-async - _export({ target: 'Array', stat: true }, { + _export({ target: 'Array', stat: true, forced: true }, { fromAsync: arrayFromAsync }); @@ -10717,7 +11476,7 @@ var doric = (function (exports) { // `Array.prototype.filterOut` method // https://github.com/tc39/proposal-array-filtering - _export({ target: 'Array', proto: true }, { + _export({ target: 'Array', proto: true, forced: true }, { filterOut: function filterOut(callbackfn /* , thisArg */) { return $filterReject$3(this, callbackfn, arguments.length > 1 ? arguments[1] : undefined); } @@ -10730,7 +11489,7 @@ var doric = (function (exports) { // `Array.prototype.filterReject` method // https://github.com/tc39/proposal-array-filtering - _export({ target: 'Array', proto: true }, { + _export({ target: 'Array', proto: true, forced: true }, { filterReject: function filterReject(callbackfn /* , thisArg */) { return $filterReject$2(this, callbackfn, arguments.length > 1 ? arguments[1] : undefined); } @@ -10738,66 +11497,10 @@ var doric = (function (exports) { addToUnscopables('filterReject'); - // `Array.prototype.{ findLast, findLastIndex }` methods implementation - var createMethod = function (TYPE) { - var IS_FIND_LAST_INDEX = TYPE == 1; - return function ($this, callbackfn, that) { - var O = toObject($this); - var self = indexedObject(O); - var boundFunction = functionBindContext(callbackfn, that); - var index = lengthOfArrayLike(self); - var value, result; - while (index-- > 0) { - value = self[index]; - result = boundFunction(value, index, O); - if (result) { switch (TYPE) { - case 0: return value; // findLast - case 1: return index; // findLastIndex - } } - } - return IS_FIND_LAST_INDEX ? -1 : undefined; - }; - }; + var $Array$4 = Array; + var push$c = functionUncurryThis([].push); - var arrayIterationFromLast = { - // `Array.prototype.findLast` method - // https://github.com/tc39/proposal-array-find-from-last - findLast: createMethod(0), - // `Array.prototype.findLastIndex` method - // https://github.com/tc39/proposal-array-find-from-last - findLastIndex: createMethod(1) - }; - - var $findLast$1 = arrayIterationFromLast.findLast; - - - // `Array.prototype.findLast` method - // https://github.com/tc39/proposal-array-find-from-last - _export({ target: 'Array', proto: true }, { - findLast: function findLast(callbackfn /* , that = undefined */) { - return $findLast$1(this, callbackfn, arguments.length > 1 ? arguments[1] : undefined); - } - }); - - addToUnscopables('findLast'); - - var $findLastIndex$1 = arrayIterationFromLast.findLastIndex; - - - // `Array.prototype.findLastIndex` method - // https://github.com/tc39/proposal-array-find-from-last - _export({ target: 'Array', proto: true }, { - findLastIndex: function findLastIndex(callbackfn /* , that = undefined */) { - return $findLastIndex$1(this, callbackfn, arguments.length > 1 ? arguments[1] : undefined); - } - }); - - addToUnscopables('findLastIndex'); - - var Array$2 = global_1.Array; - var push$9 = functionUncurryThis([].push); - - var arrayGroupBy = function ($this, callbackfn, that, specificConstructor) { + var arrayGroup = function ($this, callbackfn, that, specificConstructor) { var O = toObject($this); var self = indexedObject(O); var boundFunction = functionBindContext(callbackfn, that); @@ -10810,29 +11513,96 @@ var doric = (function (exports) { key = toPropertyKey(boundFunction(value, index, O)); // in some IE10 builds, `hasOwnProperty` returns incorrect result on integer keys // but since it's a `null` prototype object, we can safely use `in` - if (key in target) { push$9(target[key], value); } + if (key in target) { push$c(target[key], value); } else { target[key] = [value]; } } + // TODO: Remove this block from `core-js@4` if (specificConstructor) { Constructor = specificConstructor(O); - if (Constructor !== Array$2) { + if (Constructor !== $Array$4) { for (key in target) { target[key] = arrayFromConstructorAndList(Constructor, target[key]); } } } return target; }; - // `Array.prototype.groupBy` method + // `Array.prototype.group` method // https://github.com/tc39/proposal-array-grouping _export({ target: 'Array', proto: true }, { + group: function group(callbackfn /* , thisArg */) { + var thisArg = arguments.length > 1 ? arguments[1] : undefined; + return arrayGroup(this, callbackfn, thisArg); + } + }); + + addToUnscopables('group'); + + // TODO: Remove from `core-js@4` + + + + + + // `Array.prototype.groupBy` method + // https://github.com/tc39/proposal-array-grouping + // https://bugs.webkit.org/show_bug.cgi?id=236541 + _export({ target: 'Array', proto: true, forced: !arrayMethodIsStrict('groupBy') }, { groupBy: function groupBy(callbackfn /* , thisArg */) { var thisArg = arguments.length > 1 ? arguments[1] : undefined; - return arrayGroupBy(this, callbackfn, thisArg, arraySpeciesConstructor); + return arrayGroup(this, callbackfn, thisArg); } }); addToUnscopables('groupBy'); - // eslint-disable-next-line es/no-object-isfrozen -- safe + var Map$5 = getBuiltIn('Map'); + var MapPrototype$2 = Map$5.prototype; + var mapGet$1 = functionUncurryThis(MapPrototype$2.get); + var mapHas$2 = functionUncurryThis(MapPrototype$2.has); + var mapSet$2 = functionUncurryThis(MapPrototype$2.set); + var push$b = functionUncurryThis([].push); + + // `Array.prototype.groupToMap` method + // https://github.com/tc39/proposal-array-grouping + var arrayGroupToMap = function groupToMap(callbackfn /* , thisArg */) { + var O = toObject(this); + var self = indexedObject(O); + var boundFunction = functionBindContext(callbackfn, arguments.length > 1 ? arguments[1] : undefined); + var map = new Map$5(); + var length = lengthOfArrayLike(self); + var index = 0; + var key, value; + for (;length > index; index++) { + value = self[index]; + key = boundFunction(value, index, O); + if (mapHas$2(map, key)) { push$b(mapGet$1(map, key), value); } + else { mapSet$2(map, key, [value]); } + } return map; + }; + + // TODO: Remove from `core-js@4` + + + + + + // `Array.prototype.groupByToMap` method + // https://github.com/tc39/proposal-array-grouping + // https://bugs.webkit.org/show_bug.cgi?id=236541 + _export({ target: 'Array', proto: true, name: 'groupToMap', forced: !arrayMethodIsStrict('groupByToMap') }, { + groupByToMap: arrayGroupToMap + }); + + addToUnscopables('groupByToMap'); + + // `Array.prototype.groupToMap` method + // https://github.com/tc39/proposal-array-grouping + _export({ target: 'Array', proto: true }, { + groupToMap: arrayGroupToMap + }); + + addToUnscopables('groupToMap'); + + // eslint-disable-next-line es-x/no-object-isfrozen -- safe var isFrozen = Object.isFrozen; var isFrozenStringArray = function (array, allowUndefined) { @@ -10850,21 +11620,25 @@ var doric = (function (exports) { // `Array.isTemplateObject` method // https://github.com/tc39/proposal-array-is-template-object - _export({ target: 'Array', stat: true }, { + _export({ target: 'Array', stat: true, sham: true, forced: true }, { isTemplateObject: function isTemplateObject(value) { if (!isFrozenStringArray(value, true)) { return false; } var raw = value.raw; - if (raw.length !== value.length || !isFrozenStringArray(raw, false)) { return false; } - return true; + return raw.length === value.length && isFrozenStringArray(raw, false); } }); - var defineProperty$2 = objectDefineProperty.f; + // TODO: Remove from `core-js@4` + + + + + // `Array.prototype.lastIndex` getter // https://github.com/keithamus/proposal-array-last - if (descriptors && !('lastIndex' in [])) { - defineProperty$2(Array.prototype, 'lastIndex', { + if (descriptors) { + defineBuiltInAccessor(Array.prototype, 'lastIndex', { configurable: true, get: function lastIndex() { var O = toObject(this); @@ -10876,12 +11650,17 @@ var doric = (function (exports) { addToUnscopables('lastIndex'); } - var defineProperty$1 = objectDefineProperty.f; + // TODO: Remove from `core-js@4` + + + + + // `Array.prototype.lastIndex` accessor // https://github.com/keithamus/proposal-array-last - if (descriptors && !('lastItem' in [])) { - defineProperty$1(Array.prototype, 'lastItem', { + if (descriptors) { + defineBuiltInAccessor(Array.prototype, 'lastItem', { configurable: true, get: function lastItem() { var O = toObject(this); @@ -10898,12 +11677,95 @@ var doric = (function (exports) { addToUnscopables('lastItem'); } - var Map$3 = getBuiltIn('Map'); - var MapPrototype = Map$3.prototype; - var mapForEach = functionUncurryThis(MapPrototype.forEach); - var mapHas = functionUncurryThis(MapPrototype.has); - var mapSet = functionUncurryThis(MapPrototype.set); - var push$8 = functionUncurryThis([].push); + // https://tc39.es/proposal-change-array-by-copy/#sec-array.prototype.toReversed + // https://tc39.es/proposal-change-array-by-copy/#sec-%typedarray%.prototype.toReversed + var arrayToReversed = function (O, C) { + var len = lengthOfArrayLike(O); + var A = new C(len); + var k = 0; + for (; k < len; k++) { A[k] = O[len - k - 1]; } + return A; + }; + + var $Array$3 = Array; + + // `Array.prototype.toReversed` method + // https://tc39.es/proposal-change-array-by-copy/#sec-array.prototype.toReversed + _export({ target: 'Array', proto: true }, { + toReversed: function toReversed() { + return arrayToReversed(toIndexedObject(this), $Array$3); + } + }); + + addToUnscopables('toReversed'); + + var $Array$2 = Array; + var sort$1 = functionUncurryThis(entryVirtual('Array').sort); + + // `Array.prototype.toSorted` method + // https://tc39.es/proposal-change-array-by-copy/#sec-array.prototype.toSorted + _export({ target: 'Array', proto: true }, { + toSorted: function toSorted(compareFn) { + if (compareFn !== undefined) { aCallable(compareFn); } + var O = toIndexedObject(this); + var A = arrayFromConstructorAndList($Array$2, O); + return sort$1(A, compareFn); + } + }); + + addToUnscopables('toSorted'); + + var max$1 = Math.max; + var min$1 = Math.min; + + // https://tc39.es/proposal-change-array-by-copy/#sec-array.prototype.toSpliced + // https://tc39.es/proposal-change-array-by-copy/#sec-%typedarray%.prototype.toSpliced + var arrayToSpliced = function (O, C, args) { + var start = args[0]; + var deleteCount = args[1]; + var len = lengthOfArrayLike(O); + var actualStart = toAbsoluteIndex(start, len); + var argumentsLength = args.length; + var k = 0; + var insertCount, actualDeleteCount, newLen, A; + if (argumentsLength === 0) { + insertCount = actualDeleteCount = 0; + } else if (argumentsLength === 1) { + insertCount = 0; + actualDeleteCount = len - actualStart; + } else { + insertCount = argumentsLength - 2; + actualDeleteCount = min$1(max$1(toIntegerOrInfinity(deleteCount), 0), len - actualStart); + } + newLen = doesNotExceedSafeInteger(len + insertCount - actualDeleteCount); + A = new C(newLen); + + for (; k < actualStart; k++) { A[k] = O[k]; } + for (; k < actualStart + insertCount; k++) { A[k] = args[k - actualStart + 2]; } + for (; k < newLen; k++) { A[k] = O[k + actualDeleteCount - insertCount]; } + + return A; + }; + + var $Array$1 = Array; + + // `Array.prototype.toSpliced` method + // https://tc39.es/proposal-change-array-by-copy/#sec-array.prototype.toSpliced + _export({ target: 'Array', proto: true, arity: 2 }, { + // eslint-disable-next-line no-unused-vars -- required for .length + toSpliced: function toSpliced(start, deleteCount /* , ...items */) { + return arrayToSpliced(toIndexedObject(this), $Array$1, arraySlice$1(arguments)); + } + }); + + addToUnscopables('toSpliced'); + + var Map$4 = getBuiltIn('Map'); + var MapPrototype$1 = Map$4.prototype; + var mapForEach = functionUncurryThis(MapPrototype$1.forEach); + var mapHas$1 = functionUncurryThis(MapPrototype$1.has); + var mapSet$1 = functionUncurryThis(MapPrototype$1.set); + var push$a = functionUncurryThis([].push); // `Array.prototype.uniqueBy` method // https://github.com/tc39/proposal-array-unique @@ -10911,7 +11773,7 @@ var doric = (function (exports) { var that = toObject(this); var length = lengthOfArrayLike(that); var result = arraySpeciesCreate(that, 0); - var map = new Map$3(); + var map = new Map$4(); var resolverFunction = resolver != null ? aCallable(resolver) : function (value) { return value; }; @@ -10919,22 +11781,47 @@ var doric = (function (exports) { for (index = 0; index < length; index++) { item = that[index]; key = resolverFunction(item); - if (!mapHas(map, key)) { mapSet(map, key, item); } + if (!mapHas$1(map, key)) { mapSet$1(map, key, item); } } mapForEach(map, function (value) { - push$8(result, value); + push$a(result, value); }); return result; }; // `Array.prototype.uniqueBy` method // https://github.com/tc39/proposal-array-unique - _export({ target: 'Array', proto: true }, { + _export({ target: 'Array', proto: true, forced: true }, { uniqueBy: arrayUniqueBy$2 }); addToUnscopables('uniqueBy'); + var $RangeError$3 = RangeError; + + // https://tc39.es/proposal-change-array-by-copy/#sec-array.prototype.with + // https://tc39.es/proposal-change-array-by-copy/#sec-%typedarray%.prototype.with + var arrayWith = function (O, C, index, value) { + var len = lengthOfArrayLike(O); + var relativeIndex = toIntegerOrInfinity(index); + var actualIndex = relativeIndex < 0 ? len + relativeIndex : relativeIndex; + if (actualIndex >= len || actualIndex < 0) { throw $RangeError$3('Incorrect index'); } + var A = new C(len); + var k = 0; + for (; k < len; k++) { A[k] = k === actualIndex ? value : O[k]; } + return A; + }; + + var $Array = Array; + + // `Array.prototype.with` method + // https://tc39.es/proposal-change-array-by-copy/#sec-array.prototype.with + _export({ target: 'Array', proto: true }, { + 'with': function (index, value) { + return arrayWith(toIndexedObject(this), $Array, index, value); + } + }); + // https://github.com/tc39/proposal-iterator-helpers @@ -10960,26 +11847,28 @@ var doric = (function (exports) { createNonEnumerableProperty(asyncIteratorPrototype, 'constructor', AsyncIteratorConstructor); } - _export({ global: true, forced: isPure }, { + _export({ global: true, constructor: true, forced: isPure }, { AsyncIterator: AsyncIteratorConstructor }); var Promise$2 = getBuiltIn('Promise'); - var setInternalState$8 = internalState.set; - var getInternalState$6 = internalState.get; + var ASYNC_ITERATOR_PROXY = 'AsyncIteratorProxy'; + var setInternalState$9 = internalState.set; + var getInternalState$6 = internalState.getterFor(ASYNC_ITERATOR_PROXY); var TO_STRING_TAG$3 = wellKnownSymbol('toStringTag'); var asyncIteratorCreateProxy = function (nextHandler, IS_ITERATOR) { var AsyncIteratorProxy = function AsyncIterator(state) { + state.type = ASYNC_ITERATOR_PROXY; state.next = aCallable(state.iterator.next); state.done = false; state.ignoreArgument = !IS_ITERATOR; - setInternalState$8(this, state); + setInternalState$9(this, state); }; - AsyncIteratorProxy.prototype = redefineAll(objectCreate(asyncIteratorPrototype), { + AsyncIteratorProxy.prototype = defineBuiltIns(objectCreate(asyncIteratorPrototype), { next: function next(arg) { var that = this; var hasArgument = !!arguments.length; @@ -11043,7 +11932,7 @@ var doric = (function (exports) { }); }); - _export({ target: 'AsyncIterator', proto: true, real: true }, { + _export({ target: 'AsyncIterator', proto: true, real: true, forced: true }, { asIndexedPairs: function asIndexedPairs() { return new AsyncIteratorProxy$6({ iterator: anObject(this), @@ -11085,7 +11974,7 @@ var doric = (function (exports) { }); }); - _export({ target: 'AsyncIterator', proto: true, real: true }, { + _export({ target: 'AsyncIterator', proto: true, real: true, forced: true }, { drop: function drop(limit) { return new AsyncIteratorProxy$5({ iterator: anObject(this), @@ -11098,7 +11987,7 @@ var doric = (function (exports) { var $every = asyncIteratorIteration.every; - _export({ target: 'AsyncIterator', proto: true, real: true }, { + _export({ target: 'AsyncIterator', proto: true, real: true, forced: true }, { every: function every(fn) { return $every(this, fn); } @@ -11138,7 +12027,7 @@ var doric = (function (exports) { }); }); - _export({ target: 'AsyncIterator', proto: true, real: true }, { + _export({ target: 'AsyncIterator', proto: true, real: true, forced: true }, { filter: function filter(filterer) { return new AsyncIteratorProxy$4({ iterator: anObject(this), @@ -11151,7 +12040,7 @@ var doric = (function (exports) { var $find = asyncIteratorIteration.find; - _export({ target: 'AsyncIterator', proto: true, real: true }, { + _export({ target: 'AsyncIterator', proto: true, real: true, forced: true }, { find: function find(fn) { return $find(this, fn); } @@ -11211,7 +12100,7 @@ var doric = (function (exports) { }); }); - _export({ target: 'AsyncIterator', proto: true, real: true }, { + _export({ target: 'AsyncIterator', proto: true, real: true, forced: true }, { flatMap: function flatMap(mapper) { return new AsyncIteratorProxy$3({ iterator: anObject(this), @@ -11226,7 +12115,7 @@ var doric = (function (exports) { var $forEach = asyncIteratorIteration.forEach; - _export({ target: 'AsyncIterator', proto: true, real: true }, { + _export({ target: 'AsyncIterator', proto: true, real: true, forced: true }, { forEach: function forEach(fn) { return $forEach(this, fn); } @@ -11253,7 +12142,7 @@ var doric = (function (exports) { return anObject(functionApply(this.next, this.iterator, args)); }, true); - _export({ target: 'AsyncIterator', stat: true }, { + _export({ target: 'AsyncIterator', stat: true, forced: true }, { from: function from(O) { var object = toObject(O); var usingIterator = getMethod(object, ASYNC_ITERATOR); @@ -11292,7 +12181,7 @@ var doric = (function (exports) { }); }); - _export({ target: 'AsyncIterator', proto: true, real: true }, { + _export({ target: 'AsyncIterator', proto: true, real: true, forced: true }, { map: function map(mapper) { return new AsyncIteratorProxy$1({ iterator: anObject(this), @@ -11308,11 +12197,10 @@ var doric = (function (exports) { - var Promise$1 = getBuiltIn('Promise'); - var TypeError$d = global_1.TypeError; + var $TypeError$b = TypeError; - _export({ target: 'AsyncIterator', proto: true, real: true }, { + _export({ target: 'AsyncIterator', proto: true, real: true, forced: true }, { reduce: function reduce(reducer /* , initialValue */) { var iterator = anObject(this); var next = aCallable(iterator.next); @@ -11326,7 +12214,7 @@ var doric = (function (exports) { Promise$1.resolve(anObject(functionCall(next, iterator))).then(function (step) { try { if (anObject(step).done) { - noInitial ? reject(TypeError$d('Reduce of empty iterator with no initial value')) : resolve(accumulator); + noInitial ? reject($TypeError$b('Reduce of empty iterator with no initial value')) : resolve(accumulator); } else { var value = step.value; if (noInitial) { @@ -11354,7 +12242,7 @@ var doric = (function (exports) { var $some = asyncIteratorIteration.some; - _export({ target: 'AsyncIterator', proto: true, real: true }, { + _export({ target: 'AsyncIterator', proto: true, real: true, forced: true }, { some: function some(fn) { return $some(this, fn); } @@ -11384,7 +12272,7 @@ var doric = (function (exports) { } return functionApply(this.next, iterator, args); }); - _export({ target: 'AsyncIterator', proto: true, real: true }, { + _export({ target: 'AsyncIterator', proto: true, real: true, forced: true }, { take: function take(limit) { return new AsyncIteratorProxy({ iterator: anObject(this), @@ -11397,27 +12285,30 @@ var doric = (function (exports) { var $toArray = asyncIteratorIteration.toArray; - _export({ target: 'AsyncIterator', proto: true, real: true }, { + _export({ target: 'AsyncIterator', proto: true, real: true, forced: true }, { toArray: function toArray() { return $toArray(this, undefined, []); } }); + var defineProperties = objectDefineProperties.f; + + var INCORRECT_RANGE = 'Incorrect Number.range arguments'; var NUMERIC_RANGE_ITERATOR = 'NumericRangeIterator'; - var setInternalState$7 = internalState.set; + var setInternalState$8 = internalState.set; var getInternalState$5 = internalState.getterFor(NUMERIC_RANGE_ITERATOR); - var RangeError$2 = global_1.RangeError; - var TypeError$c = global_1.TypeError; + var $RangeError$2 = RangeError; + var $TypeError$a = TypeError; var $RangeIterator = createIteratorConstructor(function NumericRangeIterator(start, end, option, type, zero, one) { if (typeof start != type || (end !== Infinity && end !== -Infinity && typeof end != type)) { - throw new TypeError$c(INCORRECT_RANGE); + throw new $TypeError$a(INCORRECT_RANGE); } if (start === Infinity || start === -Infinity) { - throw new RangeError$2(INCORRECT_RANGE); + throw new $RangeError$2(INCORRECT_RANGE); } var ifIncrease = end > start; var inclusiveEnd = false; @@ -11430,20 +12321,20 @@ var doric = (function (exports) { } else if (typeof option == type) { step = option; } else { - throw new TypeError$c(INCORRECT_RANGE); + throw new $TypeError$a(INCORRECT_RANGE); } if (step == null) { step = ifIncrease ? one : -one; } if (typeof step != type) { - throw new TypeError$c(INCORRECT_RANGE); + throw new $TypeError$a(INCORRECT_RANGE); } if (step === Infinity || step === -Infinity || (step === zero && start !== end)) { - throw new RangeError$2(INCORRECT_RANGE); + throw new $RangeError$2(INCORRECT_RANGE); } // eslint-disable-next-line no-self-compare -- NaN check var hitsEnd = start != start || end != end || step != step || (end > start) !== (step > zero); - setInternalState$7(this, { + setInternalState$8(this, { type: NUMERIC_RANGE_ITERATOR, start: start, end: end, @@ -11484,7 +12375,7 @@ var doric = (function (exports) { }; if (descriptors) { - objectDefineProperties($RangeIterator.prototype, { + defineProperties($RangeIterator.prototype, { start: getter(function () { return getInternalState$5(this).start; }), @@ -11502,14 +12393,14 @@ var doric = (function (exports) { var numericRangeIterator = $RangeIterator; - /* eslint-disable es/no-bigint -- safe */ + /* eslint-disable es-x/no-bigint -- safe */ // `BigInt.range` method // https://github.com/tc39/proposal-Number.range if (typeof BigInt == 'function') { - _export({ target: 'BigInt', stat: true }, { + _export({ target: 'BigInt', stat: true, forced: true }, { range: function range(start, end, option) { return new numericRangeIterator(start, end, option, 'bigint', BigInt(0), BigInt(1)); } @@ -11523,10 +12414,9 @@ var doric = (function (exports) { - - var Object$2 = global_1.Object; - var TypeError$b = global_1.TypeError; - var Map$2 = getBuiltIn('Map'); + var $Object$1 = Object; + var $TypeError$9 = TypeError; + var Map$3 = getBuiltIn('Map'); var WeakMap$2 = getBuiltIn('WeakMap'); var Node = function () { @@ -11545,7 +12435,7 @@ var doric = (function (exports) { Node.prototype.next = function (i, it, IS_OBJECT) { var store = IS_OBJECT ? this.objectsByIndex[i] || (this.objectsByIndex[i] = new WeakMap$2()) - : this.primitives || (this.primitives = new Map$2()); + : this.primitives || (this.primitives = new Map$3()); var entry = store.get(it); if (!entry) { store.set(it, entry = new Node()); } return entry; @@ -11563,13 +12453,13 @@ var doric = (function (exports) { for (i = 0; i < length; i++) { if (isObject(it = arguments$1[i])) { active = active.next(i, it, true); } } - if (this === Object$2 && active === root) { throw TypeError$b('Composite keys must contain a non-primitive component'); } + if (this === $Object$1 && active === root) { throw $TypeError$9('Composite keys must contain a non-primitive component'); } for (i = 0; i < length; i++) { if (!isObject(it = arguments$1[i])) { active = active.next(i, it, false); } } return active; }; - var Object$1 = global_1.Object; + var $Object = Object; var initializer = function () { var freeze = getBuiltIn('Object', 'freeze'); @@ -11577,20 +12467,57 @@ var doric = (function (exports) { }; // https://github.com/tc39/proposal-richer-keys/tree/master/compositeKey - _export({ global: true }, { + _export({ global: true, forced: true }, { compositeKey: function compositeKey$1() { - return functionApply(compositeKey, Object$1, arguments).get('object', initializer); + return functionApply(compositeKey, $Object, arguments).get('object', initializer); } }); // https://github.com/tc39/proposal-richer-keys/tree/master/compositeKey - _export({ global: true }, { + _export({ global: true, forced: true }, { compositeSymbol: function compositeSymbol() { if (arguments.length == 1 && typeof arguments[0] == 'string') { return getBuiltIn('Symbol')['for'](arguments[0]); } return functionApply(compositeKey, null, arguments).get('symbol', getBuiltIn('Symbol')); } }); + // eslint-disable-next-line es-x/no-object-getownpropertydescriptor -- safe + var getOwnPropertyDescriptor$1 = Object.getOwnPropertyDescriptor; + var classRegExp = /^\s*class\b/; + var exec$4 = functionUncurryThis(classRegExp.exec); + + var isClassConstructor = function (argument) { + try { + // `Function#toString` throws on some built-it function in some legacy engines + // (for example, `DOMQuad` and similar in FF41-) + if (!descriptors || !exec$4(classRegExp, inspectSource(argument))) { return false; } + } catch (error) { /* empty */ } + var prototype = getOwnPropertyDescriptor$1(argument, 'prototype'); + return !!prototype && hasOwnProperty_1(prototype, 'writable') && !prototype.writable; + }; + + // `Function.isCallable` method + // https://github.com/caitp/TC39-Proposals/blob/trunk/tc39-reflect-isconstructor-iscallable.md + _export({ target: 'Function', stat: true, sham: true, forced: true }, { + isCallable: function isCallable$1(argument) { + return isCallable(argument) && !isClassConstructor(argument); + } + }); + + // `Function.isConstructor` method + // https://github.com/caitp/TC39-Proposals/blob/trunk/tc39-reflect-isconstructor-iscallable.md + _export({ target: 'Function', stat: true, forced: true }, { + isConstructor: isConstructor + }); + + // `Function.prototype.unThis` method + // https://github.com/js-choi/proposal-function-un-this + _export({ target: 'Function', proto: true, forced: true }, { + unThis: function unThis() { + return functionUncurryThis(aCallable(this)); + } + }); + // https://github.com/tc39/proposal-iterator-helpers @@ -11608,7 +12535,7 @@ var doric = (function (exports) { var NativeIterator = global_1.Iterator; // FF56- have non-standard global helper `Iterator` - var FORCED$2 = !isCallable(NativeIterator) + var FORCED = !isCallable(NativeIterator) || NativeIterator.prototype !== IteratorPrototype$2 // FF44- non-standard `Iterator` passes previous tests || !fails(function () { NativeIterator({}); }); @@ -11621,32 +12548,34 @@ var doric = (function (exports) { createNonEnumerableProperty(IteratorPrototype$2, TO_STRING_TAG$2, 'Iterator'); } - if (FORCED$2 || !hasOwnProperty_1(IteratorPrototype$2, 'constructor') || IteratorPrototype$2.constructor === Object) { + if (FORCED || !hasOwnProperty_1(IteratorPrototype$2, 'constructor') || IteratorPrototype$2.constructor === Object) { createNonEnumerableProperty(IteratorPrototype$2, 'constructor', IteratorConstructor); } IteratorConstructor.prototype = IteratorPrototype$2; - _export({ global: true, forced: FORCED$2 }, { + _export({ global: true, constructor: true, forced: FORCED }, { Iterator: IteratorConstructor }); var IteratorPrototype$1 = iteratorsCore.IteratorPrototype; - var setInternalState$6 = internalState.set; - var getInternalState$4 = internalState.get; + var ITERATOR_PROXY = 'IteratorProxy'; + var setInternalState$7 = internalState.set; + var getInternalState$4 = internalState.getterFor(ITERATOR_PROXY); var TO_STRING_TAG$1 = wellKnownSymbol('toStringTag'); var iteratorCreateProxy = function (nextHandler, IS_ITERATOR) { var IteratorProxy = function Iterator(state) { + state.type = ITERATOR_PROXY; state.next = aCallable(state.iterator.next); state.done = false; state.ignoreArg = !IS_ITERATOR; - setInternalState$6(this, state); + setInternalState$7(this, state); }; - IteratorProxy.prototype = redefineAll(objectCreate(IteratorPrototype$1), { + IteratorProxy.prototype = defineBuiltIns(objectCreate(IteratorPrototype$1), { next: function next(arg) { var state = getInternalState$4(this); var args = arguments.length ? [state.ignoreArg ? undefined : arg] : IS_ITERATOR ? [] : [undefined]; @@ -11690,7 +12619,7 @@ var doric = (function (exports) { if (!done) { return [this.index++, result.value]; } }); - _export({ target: 'Iterator', proto: true, real: true }, { + _export({ target: 'Iterator', proto: true, real: true, forced: true }, { asIndexedPairs: function asIndexedPairs() { return new IteratorProxy$6({ iterator: anObject(this), @@ -11722,7 +12651,7 @@ var doric = (function (exports) { if (!done) { return result.value; } }); - _export({ target: 'Iterator', proto: true, real: true }, { + _export({ target: 'Iterator', proto: true, real: true, forced: true }, { drop: function drop(limit) { return new IteratorProxy$5({ iterator: anObject(this), @@ -11737,7 +12666,7 @@ var doric = (function (exports) { - _export({ target: 'Iterator', proto: true, real: true }, { + _export({ target: 'Iterator', proto: true, real: true, forced: true }, { every: function every(fn) { anObject(this); aCallable(fn); @@ -11769,7 +12698,7 @@ var doric = (function (exports) { } }); - _export({ target: 'Iterator', proto: true, real: true }, { + _export({ target: 'Iterator', proto: true, real: true, forced: true }, { filter: function filter(filterer) { return new IteratorProxy$4({ iterator: anObject(this), @@ -11784,7 +12713,7 @@ var doric = (function (exports) { - _export({ target: 'Iterator', proto: true, real: true }, { + _export({ target: 'Iterator', proto: true, real: true, forced: true }, { find: function find(fn) { anObject(this); aCallable(fn); @@ -11803,8 +12732,7 @@ var doric = (function (exports) { - - var TypeError$a = global_1.TypeError; + var $TypeError$8 = TypeError; var IteratorProxy$3 = iteratorCreateProxy(function () { var iterator = this.iterator; @@ -11827,7 +12755,7 @@ var doric = (function (exports) { iteratorMethod = getIteratorMethod(mapped); if (!iteratorMethod) { - throw TypeError$a('.flatMap callback should return an iterable object'); + throw $TypeError$8('.flatMap callback should return an iterable object'); } this.innerIterator = innerIterator = anObject(functionCall(iteratorMethod, mapped)); @@ -11838,7 +12766,7 @@ var doric = (function (exports) { } }); - _export({ target: 'Iterator', proto: true, real: true }, { + _export({ target: 'Iterator', proto: true, real: true, forced: true }, { flatMap: function flatMap(mapper) { return new IteratorProxy$3({ iterator: anObject(this), @@ -11854,7 +12782,7 @@ var doric = (function (exports) { - _export({ target: 'Iterator', proto: true, real: true }, { + _export({ target: 'Iterator', proto: true, real: true, forced: true }, { forEach: function forEach(fn) { iterate(anObject(this), fn, { IS_ITERATOR: true }); } @@ -11877,7 +12805,7 @@ var doric = (function (exports) { if (!done) { return result.value; } }, true); - _export({ target: 'Iterator', stat: true }, { + _export({ target: 'Iterator', stat: true, forced: true }, { from: function from(O) { var object = toObject(O); var usingIterator = getIteratorMethod(object); @@ -11906,7 +12834,7 @@ var doric = (function (exports) { if (!done) { return callWithSafeIterationClosing(iterator, this.mapper, result.value); } }); - _export({ target: 'Iterator', proto: true, real: true }, { + _export({ target: 'Iterator', proto: true, real: true, forced: true }, { map: function map(mapper) { return new IteratorProxy$1({ iterator: anObject(this), @@ -11921,10 +12849,9 @@ var doric = (function (exports) { + var $TypeError$7 = TypeError; - var TypeError$9 = global_1.TypeError; - - _export({ target: 'Iterator', proto: true, real: true }, { + _export({ target: 'Iterator', proto: true, real: true, forced: true }, { reduce: function reduce(reducer /* , initialValue */) { anObject(this); aCallable(reducer); @@ -11938,7 +12865,7 @@ var doric = (function (exports) { accumulator = reducer(accumulator, value); } }, { IS_ITERATOR: true }); - if (noInitial) { throw TypeError$9('Reduce of empty iterator with no initial value'); } + if (noInitial) { throw $TypeError$7('Reduce of empty iterator with no initial value'); } return accumulator; } }); @@ -11949,7 +12876,7 @@ var doric = (function (exports) { - _export({ target: 'Iterator', proto: true, real: true }, { + _export({ target: 'Iterator', proto: true, real: true, forced: true }, { some: function some(fn) { anObject(this); aCallable(fn); @@ -11978,7 +12905,7 @@ var doric = (function (exports) { if (!done) { return result.value; } }); - _export({ target: 'Iterator', proto: true, real: true }, { + _export({ target: 'Iterator', proto: true, real: true, forced: true }, { take: function take(limit) { return new IteratorProxy({ iterator: anObject(this), @@ -11992,16 +12919,26 @@ var doric = (function (exports) { - var push$7 = [].push; + var push$9 = [].push; - _export({ target: 'Iterator', proto: true, real: true }, { + _export({ target: 'Iterator', proto: true, real: true, forced: true }, { toArray: function toArray() { var result = []; - iterate(anObject(this), push$7, { that: result, IS_ITERATOR: true }); + iterate(anObject(this), push$9, { that: result, IS_ITERATOR: true }); return result; } }); + // https://github.com/tc39/proposal-iterator-helpers + + + + _export({ target: 'Iterator', proto: true, real: true, forced: true }, { + toAsync: function toAsync() { + return new asyncFromSyncIterator(this); + } + }); + // https://github.com/tc39/collection-methods var collectionDeleteAll = function deleteAll(/* ...elements */) { var arguments$1 = arguments; @@ -12019,7 +12956,7 @@ var doric = (function (exports) { // `Map.prototype.deleteAll` method // https://github.com/tc39/proposal-collection-methods - _export({ target: 'Map', proto: true, real: true, forced: isPure }, { + _export({ target: 'Map', proto: true, real: true, forced: true }, { deleteAll: collectionDeleteAll }); @@ -12039,18 +12976,18 @@ var doric = (function (exports) { // `Map.prototype.emplace` method // https://github.com/thumbsupep/proposal-upsert - _export({ target: 'Map', proto: true, real: true, forced: isPure }, { + _export({ target: 'Map', proto: true, real: true, forced: true }, { emplace: mapEmplace }); var getMapIterator = function (it) { - // eslint-disable-next-line es/no-map -- safe + // eslint-disable-next-line es-x/no-map -- safe return functionCall(Map.prototype.entries, it); }; // `Map.prototype.every` method // https://github.com/tc39/proposal-collection-methods - _export({ target: 'Map', proto: true, real: true, forced: isPure }, { + _export({ target: 'Map', proto: true, real: true, forced: true }, { every: function every(callbackfn /* , thisArg */) { var map = anObject(this); var iterator = getMapIterator(map); @@ -12063,7 +13000,7 @@ var doric = (function (exports) { // `Map.prototype.filter` method // https://github.com/tc39/proposal-collection-methods - _export({ target: 'Map', proto: true, real: true, forced: isPure }, { + _export({ target: 'Map', proto: true, real: true, forced: true }, { filter: function filter(callbackfn /* , thisArg */) { var map = anObject(this); var iterator = getMapIterator(map); @@ -12079,7 +13016,7 @@ var doric = (function (exports) { // `Map.prototype.find` method // https://github.com/tc39/proposal-collection-methods - _export({ target: 'Map', proto: true, real: true, forced: isPure }, { + _export({ target: 'Map', proto: true, real: true, forced: true }, { find: function find(callbackfn /* , thisArg */) { var map = anObject(this); var iterator = getMapIterator(map); @@ -12092,7 +13029,7 @@ var doric = (function (exports) { // `Map.prototype.findKey` method // https://github.com/tc39/proposal-collection-methods - _export({ target: 'Map', proto: true, real: true, forced: isPure }, { + _export({ target: 'Map', proto: true, real: true, forced: true }, { findKey: function findKey(callbackfn /* , thisArg */) { var map = anObject(this); var iterator = getMapIterator(map); @@ -12110,7 +13047,7 @@ var doric = (function (exports) { - var push$6 = [].push; + var push$8 = [].push; var collectionFrom = function from(source /* , mapFn, thisArg */) { var length = arguments.length; @@ -12125,25 +13062,25 @@ var doric = (function (exports) { n = 0; boundFunction = functionBindContext(mapFn, length > 2 ? arguments[2] : undefined); iterate(source, function (nextItem) { - functionCall(push$6, array, boundFunction(nextItem, n++)); + functionCall(push$8, array, boundFunction(nextItem, n++)); }); } else { - iterate(source, push$6, { that: array }); + iterate(source, push$8, { that: array }); } return new this(array); }; // `Map.from` method // https://tc39.github.io/proposal-setmap-offrom/#sec-map.from - _export({ target: 'Map', stat: true }, { + _export({ target: 'Map', stat: true, forced: true }, { from: collectionFrom }); - var push$5 = functionUncurryThis([].push); + var push$7 = functionUncurryThis([].push); // `Map.groupBy` method // https://github.com/tc39/proposal-collection-methods - _export({ target: 'Map', stat: true }, { + _export({ target: 'Map', stat: true, forced: true }, { groupBy: function groupBy(iterable, keyDerivative) { aCallable(keyDerivative); var iterator = getIterator(iterable); @@ -12154,7 +13091,7 @@ var doric = (function (exports) { iterate(iterator, function (element) { var derivedKey = keyDerivative(element); if (!functionCall(has, newMap, derivedKey)) { functionCall(set, newMap, derivedKey, [element]); } - else { push$5(functionCall(get, newMap, derivedKey), element); } + else { push$7(functionCall(get, newMap, derivedKey), element); } }, { IS_ITERATOR: true }); return newMap; } @@ -12169,7 +13106,7 @@ var doric = (function (exports) { // `Map.prototype.includes` method // https://github.com/tc39/proposal-collection-methods - _export({ target: 'Map', proto: true, real: true, forced: isPure }, { + _export({ target: 'Map', proto: true, real: true, forced: true }, { includes: function includes(searchElement) { return iterate(getMapIterator(anObject(this)), function (key, value, stop) { if (sameValueZero(value, searchElement)) { return stop(); } @@ -12179,7 +13116,7 @@ var doric = (function (exports) { // `Map.keyBy` method // https://github.com/tc39/proposal-collection-methods - _export({ target: 'Map', stat: true }, { + _export({ target: 'Map', stat: true, forced: true }, { keyBy: function keyBy(iterable, keyDerivative) { var newMap = new this(); aCallable(keyDerivative); @@ -12193,7 +13130,7 @@ var doric = (function (exports) { // `Map.prototype.keyOf` method // https://github.com/tc39/proposal-collection-methods - _export({ target: 'Map', proto: true, real: true, forced: isPure }, { + _export({ target: 'Map', proto: true, real: true, forced: true }, { keyOf: function keyOf(searchElement) { return iterate(getMapIterator(anObject(this)), function (key, value, stop) { if (value === searchElement) { return stop(key); } @@ -12203,7 +13140,7 @@ var doric = (function (exports) { // `Map.prototype.mapKeys` method // https://github.com/tc39/proposal-collection-methods - _export({ target: 'Map', proto: true, real: true, forced: isPure }, { + _export({ target: 'Map', proto: true, real: true, forced: true }, { mapKeys: function mapKeys(callbackfn /* , thisArg */) { var map = anObject(this); var iterator = getMapIterator(map); @@ -12219,7 +13156,7 @@ var doric = (function (exports) { // `Map.prototype.mapValues` method // https://github.com/tc39/proposal-collection-methods - _export({ target: 'Map', proto: true, real: true, forced: isPure }, { + _export({ target: 'Map', proto: true, real: true, forced: true }, { mapValues: function mapValues(callbackfn /* , thisArg */) { var map = anObject(this); var iterator = getMapIterator(map); @@ -12235,9 +13172,9 @@ var doric = (function (exports) { // `Map.prototype.merge` method // https://github.com/tc39/proposal-collection-methods - _export({ target: 'Map', proto: true, real: true, forced: isPure }, { + _export({ target: 'Map', proto: true, real: true, arity: 1, forced: true }, { // eslint-disable-next-line no-unused-vars -- required for `.length` - merge: function merge(iterable /* ...iterbles */) { + merge: function merge(iterable /* ...iterables */) { var arguments$1 = arguments; var map = anObject(this); @@ -12258,15 +13195,15 @@ var doric = (function (exports) { // `Map.of` method // https://tc39.github.io/proposal-setmap-offrom/#sec-map.of - _export({ target: 'Map', stat: true }, { + _export({ target: 'Map', stat: true, forced: true }, { of: collectionOf }); - var TypeError$8 = global_1.TypeError; + var $TypeError$6 = TypeError; // `Map.prototype.reduce` method // https://github.com/tc39/proposal-collection-methods - _export({ target: 'Map', proto: true, real: true, forced: isPure }, { + _export({ target: 'Map', proto: true, real: true, forced: true }, { reduce: function reduce(callbackfn /* , initialValue */) { var map = anObject(this); var iterator = getMapIterator(map); @@ -12281,14 +13218,14 @@ var doric = (function (exports) { accumulator = callbackfn(accumulator, value, key, map); } }, { AS_ENTRIES: true, IS_ITERATOR: true }); - if (noInitial) { throw TypeError$8('Reduce of empty map with no initial value'); } + if (noInitial) { throw $TypeError$6('Reduce of empty map with no initial value'); } return accumulator; } }); // `Set.prototype.some` method // https://github.com/tc39/proposal-collection-methods - _export({ target: 'Map', proto: true, real: true, forced: isPure }, { + _export({ target: 'Map', proto: true, real: true, forced: true }, { some: function some(callbackfn /* , thisArg */) { var map = anObject(this); var iterator = getMapIterator(map); @@ -12299,11 +13236,11 @@ var doric = (function (exports) { } }); - var TypeError$7 = global_1.TypeError; + var $TypeError$5 = TypeError; // `Set.prototype.update` method // https://github.com/tc39/proposal-collection-methods - _export({ target: 'Map', proto: true, real: true, forced: isPure }, { + _export({ target: 'Map', proto: true, real: true, forced: true }, { update: function update(key, callback /* , thunk */) { var map = anObject(this); var get = aCallable(map.get); @@ -12313,7 +13250,7 @@ var doric = (function (exports) { aCallable(callback); var isPresentInMap = functionCall(has, map, key); if (!isPresentInMap && length < 3) { - throw TypeError$7('Updating absent value'); + throw $TypeError$5('Updating absent value'); } var value = isPresentInMap ? functionCall(get, map, key) : aCallable(length > 2 ? arguments[2] : undefined)(key, map); functionCall(set, map, key, callback(value, key, map)); @@ -12321,7 +13258,7 @@ var doric = (function (exports) { } }); - var TypeError$6 = global_1.TypeError; + var $TypeError$4 = TypeError; // `Map.prototype.upsert` method // https://github.com/thumbsupep/proposal-upsert @@ -12333,7 +13270,7 @@ var doric = (function (exports) { var insertFn = arguments.length > 2 ? arguments[2] : undefined; var value; if (!isCallable(updateFn) && !isCallable(insertFn)) { - throw TypeError$6('At least one callback required'); + throw $TypeError$4('At least one callback required'); } if (functionCall(has, map, key)) { value = functionCall(get, map, key); @@ -12351,10 +13288,9 @@ var doric = (function (exports) { - // `Map.prototype.updateOrInsert` method (replaced by `Map.prototype.emplace`) // https://github.com/thumbsupep/proposal-upsert - _export({ target: 'Map', proto: true, real: true, name: 'upsert', forced: isPure }, { + _export({ target: 'Map', proto: true, real: true, name: 'upsert', forced: true }, { updateOrInsert: mapUpsert }); @@ -12362,10 +13298,9 @@ var doric = (function (exports) { - // `Map.prototype.upsert` method (replaced by `Map.prototype.emplace`) // https://github.com/thumbsupep/proposal-upsert - _export({ target: 'Map', proto: true, real: true, forced: isPure }, { + _export({ target: 'Map', proto: true, real: true, forced: true }, { upsert: mapUpsert }); @@ -12374,25 +13309,27 @@ var doric = (function (exports) { // `Math.clamp` method // https://rwaldron.github.io/proposal-math-extensions/ - _export({ target: 'Math', stat: true }, { + _export({ target: 'Math', stat: true, forced: true }, { clamp: function clamp(x, lower, upper) { return min(upper, max(lower, x)); } }); + var DEG_PER_RAD$1 = Math.PI / 180; + // `Math.DEG_PER_RAD` constant // https://rwaldron.github.io/proposal-math-extensions/ - _export({ target: 'Math', stat: true }, { - DEG_PER_RAD: Math.PI / 180 + _export({ target: 'Math', stat: true, nonConfigurable: true, nonWritable: true, forced: Math.DEG_PER_RAD !== DEG_PER_RAD$1 }, { + DEG_PER_RAD: DEG_PER_RAD$1 }); - var RAD_PER_DEG = 180 / Math.PI; + var RAD_PER_DEG$1 = 180 / Math.PI; // `Math.degrees` method // https://rwaldron.github.io/proposal-math-extensions/ - _export({ target: 'Math', stat: true }, { + _export({ target: 'Math', stat: true, forced: true }, { degrees: function degrees(radians) { - return radians * RAD_PER_DEG; + return radians * RAD_PER_DEG$1; } }); @@ -12412,7 +13349,7 @@ var doric = (function (exports) { // `Math.fscale` method // https://rwaldron.github.io/proposal-math-extensions/ - _export({ target: 'Math', stat: true }, { + _export({ target: 'Math', stat: true, forced: true }, { fscale: function fscale(x, inLow, inHigh, outLow, outHigh) { return mathFround(mathScale(x, inLow, inHigh, outLow, outHigh)); } @@ -12421,7 +13358,7 @@ var doric = (function (exports) { // `Math.iaddh` method // https://gist.github.com/BrendanEich/4294d5c212a6d2254703 // TODO: Remove from `core-js@4` - _export({ target: 'Math', stat: true }, { + _export({ target: 'Math', stat: true, forced: true }, { iaddh: function iaddh(x0, x1, y0, y1) { var $x0 = x0 >>> 0; var $x1 = x1 >>> 0; @@ -12433,7 +13370,7 @@ var doric = (function (exports) { // `Math.imulh` method // https://gist.github.com/BrendanEich/4294d5c212a6d2254703 // TODO: Remove from `core-js@4` - _export({ target: 'Math', stat: true }, { + _export({ target: 'Math', stat: true, forced: true }, { imulh: function imulh(u, v) { var UINT16 = 0xFFFF; var $u = +u; @@ -12450,7 +13387,7 @@ var doric = (function (exports) { // `Math.isubh` method // https://gist.github.com/BrendanEich/4294d5c212a6d2254703 // TODO: Remove from `core-js@4` - _export({ target: 'Math', stat: true }, { + _export({ target: 'Math', stat: true, forced: true }, { isubh: function isubh(x0, x1, y0, y1) { var $x0 = x0 >>> 0; var $x1 = x1 >>> 0; @@ -12459,17 +13396,19 @@ var doric = (function (exports) { } }); + var RAD_PER_DEG = 180 / Math.PI; + // `Math.RAD_PER_DEG` constant // https://rwaldron.github.io/proposal-math-extensions/ - _export({ target: 'Math', stat: true }, { - RAD_PER_DEG: 180 / Math.PI + _export({ target: 'Math', stat: true, nonConfigurable: true, nonWritable: true, forced: Math.RAD_PER_DEG !== RAD_PER_DEG }, { + RAD_PER_DEG: RAD_PER_DEG }); var DEG_PER_RAD = Math.PI / 180; // `Math.radians` method // https://rwaldron.github.io/proposal-math-extensions/ - _export({ target: 'Math', stat: true }, { + _export({ target: 'Math', stat: true, forced: true }, { radians: function radians(degrees) { return degrees * DEG_PER_RAD; } @@ -12477,19 +13416,19 @@ var doric = (function (exports) { // `Math.scale` method // https://rwaldron.github.io/proposal-math-extensions/ - _export({ target: 'Math', stat: true }, { + _export({ target: 'Math', stat: true, forced: true }, { scale: mathScale }); var SEEDED_RANDOM = 'Seeded Random'; var SEEDED_RANDOM_GENERATOR = SEEDED_RANDOM + ' Generator'; var SEED_TYPE_ERROR = 'Math.seededPRNG() argument should have a "seed" field with a finite value.'; - var setInternalState$5 = internalState.set; + var setInternalState$6 = internalState.set; var getInternalState$3 = internalState.getterFor(SEEDED_RANDOM_GENERATOR); - var TypeError$5 = global_1.TypeError; + var $TypeError$3 = TypeError; var $SeededRandomGenerator = createIteratorConstructor(function SeededRandomGenerator(seed) { - setInternalState$5(this, { + setInternalState$6(this, { type: SEEDED_RANDOM_GENERATOR, seed: seed % 2147483647 }); @@ -12505,23 +13444,25 @@ var doric = (function (exports) { _export({ target: 'Math', stat: true, forced: true }, { seededPRNG: function seededPRNG(it) { var seed = anObject(it).seed; - if (!numberIsFinite(seed)) { throw TypeError$5(SEED_TYPE_ERROR); } + if (!numberIsFinite(seed)) { throw $TypeError$3(SEED_TYPE_ERROR); } return new $SeededRandomGenerator(seed); } }); // `Math.signbit` method // https://github.com/tc39/proposal-Math.signbit - _export({ target: 'Math', stat: true }, { + _export({ target: 'Math', stat: true, forced: true }, { signbit: function signbit(x) { - return (x = +x) == x && x == 0 ? 1 / x == -Infinity : x < 0; + var n = +x; + // eslint-disable-next-line no-self-compare -- NaN check + return n == n && n == 0 ? 1 / n == -Infinity : n < 0; } }); // `Math.umulh` method // https://gist.github.com/BrendanEich/4294d5c212a6d2254703 // TODO: Remove from `core-js@4` - _export({ target: 'Math', stat: true }, { + _export({ target: 'Math', stat: true, forced: true }, { umulh: function umulh(u, v) { var UINT16 = 0xFFFF; var $u = +u; @@ -12537,32 +13478,32 @@ var doric = (function (exports) { var INVALID_NUMBER_REPRESENTATION = 'Invalid number representation'; var INVALID_RADIX = 'Invalid radix'; - var RangeError$1 = global_1.RangeError; - var SyntaxError = global_1.SyntaxError; - var TypeError$4 = global_1.TypeError; + var $RangeError$1 = RangeError; + var $SyntaxError = SyntaxError; + var $TypeError$2 = TypeError; var valid = /^[\da-z]+$/; - var charAt$4 = functionUncurryThis(''.charAt); - var exec$2 = functionUncurryThis(valid.exec); + var charAt$6 = functionUncurryThis(''.charAt); + var exec$3 = functionUncurryThis(valid.exec); var numberToString$1 = functionUncurryThis(1.0.toString); var stringSlice$2 = functionUncurryThis(''.slice); // `Number.fromString` method // https://github.com/tc39/proposal-number-fromstring - _export({ target: 'Number', stat: true }, { + _export({ target: 'Number', stat: true, forced: true }, { fromString: function fromString(string, radix) { var sign = 1; var R, mathNum; - if (typeof string != 'string') { throw TypeError$4(INVALID_NUMBER_REPRESENTATION); } - if (!string.length) { throw SyntaxError(INVALID_NUMBER_REPRESENTATION); } - if (charAt$4(string, 0) == '-') { + if (typeof string != 'string') { throw $TypeError$2(INVALID_NUMBER_REPRESENTATION); } + if (!string.length) { throw $SyntaxError(INVALID_NUMBER_REPRESENTATION); } + if (charAt$6(string, 0) == '-') { sign = -1; string = stringSlice$2(string, 1); - if (!string.length) { throw SyntaxError(INVALID_NUMBER_REPRESENTATION); } + if (!string.length) { throw $SyntaxError(INVALID_NUMBER_REPRESENTATION); } } R = radix === undefined ? 10 : toIntegerOrInfinity(radix); - if (R < 2 || R > 36) { throw RangeError$1(INVALID_RADIX); } - if (!exec$2(valid, string) || numberToString$1(mathNum = numberParseInt(string, R), R) !== string) { - throw SyntaxError(INVALID_NUMBER_REPRESENTATION); + if (R < 2 || R > 36) { throw $RangeError$1(INVALID_RADIX); } + if (!exec$3(valid, string) || numberToString$1(mathNum = numberParseInt(string, R), R) !== string) { + throw $SyntaxError(INVALID_NUMBER_REPRESENTATION); } return sign * mathNum; } @@ -12570,23 +13511,23 @@ var doric = (function (exports) { // `Number.range` method // https://github.com/tc39/proposal-Number.range - _export({ target: 'Number', stat: true }, { + _export({ target: 'Number', stat: true, forced: true }, { range: function range(start, end, option) { return new numericRangeIterator(start, end, option, 'number', 0, 1); } }); var OBJECT_ITERATOR = 'Object Iterator'; - var setInternalState$4 = internalState.set; + var setInternalState$5 = internalState.set; var getInternalState$2 = internalState.getterFor(OBJECT_ITERATOR); var objectIterator = createIteratorConstructor(function ObjectIterator(source, mode) { var object = toObject(source); - setInternalState$4(this, { + setInternalState$5(this, { type: OBJECT_ITERATOR, mode: mode, object: object, - keys: objectKeys(object), + keys: objectKeys$1(object), index: 0 }); }, 'Object', function next() { @@ -12607,30 +13548,52 @@ var doric = (function (exports) { } }); + // TODO: Remove from `core-js@4` + + + // `Object.iterateEntries` method // https://github.com/tc39/proposal-object-iteration - _export({ target: 'Object', stat: true }, { + _export({ target: 'Object', stat: true, forced: true }, { iterateEntries: function iterateEntries(object) { return new objectIterator(object, 'entries'); } }); + // TODO: Remove from `core-js@4` + + + // `Object.iterateKeys` method // https://github.com/tc39/proposal-object-iteration - _export({ target: 'Object', stat: true }, { + _export({ target: 'Object', stat: true, forced: true }, { iterateKeys: function iterateKeys(object) { return new objectIterator(object, 'keys'); } }); + // TODO: Remove from `core-js@4` + + + // `Object.iterateValues` method // https://github.com/tc39/proposal-object-iteration - _export({ target: 'Object', stat: true }, { + _export({ target: 'Object', stat: true, forced: true }, { iterateValues: function iterateValues(object) { return new objectIterator(object, 'values'); } }); + var $$OBSERVABLE$2 = wellKnownSymbol('observable'); + var NativeObservable = global_1.Observable; + var NativeObservablePrototype = NativeObservable && NativeObservable.prototype; + + var observableForced = !isCallable(NativeObservable) + || !isCallable(NativeObservable.from) + || !isCallable(NativeObservable.of) + || !isCallable(NativeObservablePrototype.subscribe) + || !isCallable(NativeObservablePrototype[$$OBSERVABLE$2]); + // https://github.com/tc39/proposal-observable @@ -12643,7 +13606,6 @@ var doric = (function (exports) { - var defineProperty = objectDefineProperty.f; @@ -12651,44 +13613,50 @@ var doric = (function (exports) { + var $$OBSERVABLE$1 = wellKnownSymbol('observable'); + var OBSERVABLE = 'Observable'; + var SUBSCRIPTION = 'Subscription'; + var SUBSCRIPTION_OBSERVER = 'SubscriptionObserver'; + var getterFor$1 = internalState.getterFor; + var setInternalState$4 = internalState.set; + var getObservableInternalState = getterFor$1(OBSERVABLE); + var getSubscriptionInternalState = getterFor$1(SUBSCRIPTION); + var getSubscriptionObserverInternalState = getterFor$1(SUBSCRIPTION_OBSERVER); + var SubscriptionState = function (observer) { + this.observer = anObject(observer); + this.cleanup = undefined; + this.subscriptionObserver = undefined; + }; - var OBSERVABLE = wellKnownSymbol('observable'); - var getInternalState$1 = internalState.get; - var setInternalState$3 = internalState.set; - var Array$1 = global_1.Array; - - var cleanupSubscription = function (subscriptionState) { - var cleanup = subscriptionState.cleanup; - if (cleanup) { - subscriptionState.cleanup = undefined; - try { - cleanup(); - } catch (error) { - hostReportErrors(error); + SubscriptionState.prototype = { + type: SUBSCRIPTION, + clean: function () { + var cleanup = this.cleanup; + if (cleanup) { + this.cleanup = undefined; + try { + cleanup(); + } catch (error) { + hostReportErrors(error); + } } + }, + close: function () { + if (!descriptors) { + var subscription = this.facade; + var subscriptionObserver = this.subscriptionObserver; + subscription.closed = true; + if (subscriptionObserver) { subscriptionObserver.closed = true; } + } this.observer = undefined; + }, + isClosed: function () { + return this.observer === undefined; } }; - var subscriptionClosed = function (subscriptionState) { - return subscriptionState.observer === undefined; - }; - - var close = function (subscriptionState) { - var subscription = subscriptionState.facade; - if (!descriptors) { - subscription.closed = true; - var subscriptionObserver = subscriptionState.subscriptionObserver; - if (subscriptionObserver) { subscriptionObserver.closed = true; } - } subscriptionState.observer = undefined; - }; - var Subscription = function (observer, subscriber) { - var subscriptionState = setInternalState$3(this, { - cleanup: undefined, - observer: anObject(observer), - subscriptionObserver: undefined - }); + var subscriptionState = setInternalState$4(this, new SubscriptionState(observer)); var start; if (!descriptors) { this.closed = false; } try { @@ -12696,8 +13664,8 @@ var doric = (function (exports) { } catch (error) { hostReportErrors(error); } - if (subscriptionClosed(subscriptionState)) { return; } - var subscriptionObserver = subscriptionState.subscriptionObserver = new SubscriptionObserver(this); + if (subscriptionState.isClosed()) { return; } + var subscriptionObserver = subscriptionState.subscriptionObserver = new SubscriptionObserver(subscriptionState); try { var cleanup = subscriber(subscriptionObserver); var subscription = cleanup; @@ -12707,35 +13675,38 @@ var doric = (function (exports) { } catch (error$1) { subscriptionObserver.error(error$1); return; - } if (subscriptionClosed(subscriptionState)) { cleanupSubscription(subscriptionState); } + } if (subscriptionState.isClosed()) { subscriptionState.clean(); } }; - Subscription.prototype = redefineAll({}, { + Subscription.prototype = defineBuiltIns({}, { unsubscribe: function unsubscribe() { - var subscriptionState = getInternalState$1(this); - if (!subscriptionClosed(subscriptionState)) { - close(subscriptionState); - cleanupSubscription(subscriptionState); + var subscriptionState = getSubscriptionInternalState(this); + if (!subscriptionState.isClosed()) { + subscriptionState.close(); + subscriptionState.clean(); } } }); - if (descriptors) { defineProperty(Subscription.prototype, 'closed', { + if (descriptors) { defineBuiltInAccessor(Subscription.prototype, 'closed', { configurable: true, - get: function () { - return subscriptionClosed(getInternalState$1(this)); + get: function closed() { + return getSubscriptionInternalState(this).isClosed(); } }); } - var SubscriptionObserver = function (subscription) { - setInternalState$3(this, { subscription: subscription }); + var SubscriptionObserver = function (subscriptionState) { + setInternalState$4(this, { + type: SUBSCRIPTION_OBSERVER, + subscriptionState: subscriptionState + }); if (!descriptors) { this.closed = false; } }; - SubscriptionObserver.prototype = redefineAll({}, { + SubscriptionObserver.prototype = defineBuiltIns({}, { next: function next(value) { - var subscriptionState = getInternalState$1(getInternalState$1(this).subscription); - if (!subscriptionClosed(subscriptionState)) { + var subscriptionState = getSubscriptionObserverInternalState(this).subscriptionState; + if (!subscriptionState.isClosed()) { var observer = subscriptionState.observer; try { var nextMethod = getMethod(observer, 'next'); @@ -12746,63 +13717,78 @@ var doric = (function (exports) { } }, error: function error(value) { - var subscriptionState = getInternalState$1(getInternalState$1(this).subscription); - if (!subscriptionClosed(subscriptionState)) { + var subscriptionState = getSubscriptionObserverInternalState(this).subscriptionState; + if (!subscriptionState.isClosed()) { var observer = subscriptionState.observer; - close(subscriptionState); + subscriptionState.close(); try { var errorMethod = getMethod(observer, 'error'); if (errorMethod) { functionCall(errorMethod, observer, value); } else { hostReportErrors(value); } } catch (err) { hostReportErrors(err); - } cleanupSubscription(subscriptionState); + } subscriptionState.clean(); } }, complete: function complete() { - var subscriptionState = getInternalState$1(getInternalState$1(this).subscription); - if (!subscriptionClosed(subscriptionState)) { + var subscriptionState = getSubscriptionObserverInternalState(this).subscriptionState; + if (!subscriptionState.isClosed()) { var observer = subscriptionState.observer; - close(subscriptionState); + subscriptionState.close(); try { var completeMethod = getMethod(observer, 'complete'); if (completeMethod) { functionCall(completeMethod, observer); } } catch (error) { hostReportErrors(error); - } cleanupSubscription(subscriptionState); + } subscriptionState.clean(); } } }); - if (descriptors) { defineProperty(SubscriptionObserver.prototype, 'closed', { + if (descriptors) { defineBuiltInAccessor(SubscriptionObserver.prototype, 'closed', { configurable: true, - get: function () { - return subscriptionClosed(getInternalState$1(getInternalState$1(this).subscription)); + get: function closed() { + return getSubscriptionObserverInternalState(this).subscriptionState.isClosed(); } }); } var $Observable = function Observable(subscriber) { anInstance(this, ObservablePrototype); - setInternalState$3(this, { subscriber: aCallable(subscriber) }); + setInternalState$4(this, { + type: OBSERVABLE, + subscriber: aCallable(subscriber) + }); }; var ObservablePrototype = $Observable.prototype; - redefineAll(ObservablePrototype, { + defineBuiltIns(ObservablePrototype, { subscribe: function subscribe(observer) { var length = arguments.length; return new Subscription(isCallable(observer) ? { next: observer, error: length > 1 ? arguments[1] : undefined, complete: length > 2 ? arguments[2] : undefined - } : isObject(observer) ? observer : {}, getInternalState$1(this).subscriber); + } : isObject(observer) ? observer : {}, getObservableInternalState(this).subscriber); } }); - redefineAll($Observable, { + defineBuiltIn(ObservablePrototype, $$OBSERVABLE$1, function () { return this; }); + + _export({ global: true, constructor: true, forced: observableForced }, { + Observable: $Observable + }); + + setSpecies(OBSERVABLE); + + var $$OBSERVABLE = wellKnownSymbol('observable'); + + // `Observable.from` method + // https://github.com/tc39/proposal-observable + _export({ target: 'Observable', stat: true, forced: observableForced }, { from: function from(x) { - var C = isConstructor(this) ? this : $Observable; - var observableMethod = getMethod(anObject(x), OBSERVABLE); + var C = isConstructor(this) ? this : getBuiltIn('Observable'); + var observableMethod = getMethod(anObject(x), $$OBSERVABLE); if (observableMethod) { var observable = anObject(functionCall(observableMethod, x)); return observable.constructor === C ? observable : new C(function (observer) { @@ -12817,11 +13803,18 @@ var doric = (function (exports) { }, { IS_ITERATOR: true, INTERRUPTED: true }); observer.complete(); }); - }, + } + }); + + var Array$1 = getBuiltIn('Array'); + + // `Observable.of` method + // https://github.com/tc39/proposal-observable + _export({ target: 'Observable', stat: true, forced: observableForced }, { of: function of() { var arguments$1 = arguments; - var C = isConstructor(this) ? this : $Observable; + var C = isConstructor(this) ? this : getBuiltIn('Observable'); var length = arguments.length; var items = Array$1(length); var index = 0; @@ -12835,17 +13828,14 @@ var doric = (function (exports) { } }); - redefine(ObservablePrototype, OBSERVABLE, function () { return this; }); + // TODO: Remove from `core-js@4` + - _export({ global: true }, { - Observable: $Observable - }); - setSpecies('Observable'); // `Promise.try` method // https://github.com/tc39/proposal-promise-try - _export({ target: 'Promise', stat: true }, { + _export({ target: 'Promise', stat: true, forced: true }, { 'try': function (callbackfn) { var promiseCapability = newPromiseCapability$1.f(this); var result = perform(callbackfn); @@ -12861,9 +13851,9 @@ var doric = (function (exports) { - var Map$1 = getBuiltIn('Map'); + var Map$2 = getBuiltIn('Map'); var WeakMap$1 = getBuiltIn('WeakMap'); - var push$4 = functionUncurryThis([].push); + var push$6 = functionUncurryThis([].push); var metadata = shared('metadata'); var store$1 = metadata.store || (metadata.store = new WeakMap$1()); @@ -12872,12 +13862,12 @@ var doric = (function (exports) { var targetMetadata = store$1.get(target); if (!targetMetadata) { if (!create) { return; } - store$1.set(target, targetMetadata = new Map$1()); + store$1.set(target, targetMetadata = new Map$2()); } var keyMetadata = targetMetadata.get(targetKey); if (!keyMetadata) { if (!create) { return; } - targetMetadata.set(targetKey, keyMetadata = new Map$1()); + targetMetadata.set(targetKey, keyMetadata = new Map$2()); } return keyMetadata; }; @@ -12898,7 +13888,7 @@ var doric = (function (exports) { var ordinaryOwnMetadataKeys$2 = function (target, targetKey) { var metadataMap = getOrCreateMetadataMap$1(target, targetKey, false); var keys = []; - if (metadataMap) { metadataMap.forEach(function (_, key) { push$4(keys, key); }); } + if (metadataMap) { metadataMap.forEach(function (_, key) { push$6(keys, key); }); } return keys; }; @@ -12916,6 +13906,11 @@ var doric = (function (exports) { toKey: toMetadataKey$9 }; + // TODO: Remove from `core-js@4` + + + + var toMetadataKey$8 = reflectMetadata.toKey; var ordinaryDefineOwnMetadata$1 = reflectMetadata.set; @@ -12946,6 +13941,12 @@ var doric = (function (exports) { } }); + // TODO: Remove from `core-js@4` + + + + + var ordinaryHasOwnMetadata$2 = reflectMetadata.has; var ordinaryGetOwnMetadata$1 = reflectMetadata.get; var toMetadataKey$6 = reflectMetadata.toKey; @@ -12966,6 +13967,14 @@ var doric = (function (exports) { } }); + // TODO: Remove from `core-js@4` + + + + + + + var arrayUniqueBy$1 = functionUncurryThis(arrayUniqueBy$2); var concat = functionUncurryThis([].concat); var ordinaryOwnMetadataKeys$1 = reflectMetadata.keys; @@ -12988,6 +13997,11 @@ var doric = (function (exports) { } }); + // TODO: Remove from `core-js@4` + + + + var ordinaryGetOwnMetadata = reflectMetadata.get; var toMetadataKey$4 = reflectMetadata.toKey; @@ -13000,6 +14014,11 @@ var doric = (function (exports) { } }); + // TODO: Remove from `core-js@4` + + + + var ordinaryOwnMetadataKeys = reflectMetadata.keys; var toMetadataKey$3 = reflectMetadata.toKey; @@ -13012,6 +14031,12 @@ var doric = (function (exports) { } }); + // TODO: Remove from `core-js@4` + + + + + var ordinaryHasOwnMetadata$1 = reflectMetadata.has; var toMetadataKey$2 = reflectMetadata.toKey; @@ -13031,6 +14056,11 @@ var doric = (function (exports) { } }); + // TODO: Remove from `core-js@4` + + + + var ordinaryHasOwnMetadata = reflectMetadata.has; var toMetadataKey$1 = reflectMetadata.toKey; @@ -13070,19 +14100,19 @@ var doric = (function (exports) { // `Set.prototype.addAll` method // https://github.com/tc39/proposal-collection-methods - _export({ target: 'Set', proto: true, real: true, forced: isPure }, { + _export({ target: 'Set', proto: true, real: true, forced: true }, { addAll: collectionAddAll }); // `Set.prototype.deleteAll` method // https://github.com/tc39/proposal-collection-methods - _export({ target: 'Set', proto: true, real: true, forced: isPure }, { + _export({ target: 'Set', proto: true, real: true, forced: true }, { deleteAll: collectionDeleteAll }); // `Set.prototype.difference` method // https://github.com/tc39/proposal-set-methods - _export({ target: 'Set', proto: true, real: true, forced: isPure }, { + _export({ target: 'Set', proto: true, real: true, forced: true }, { difference: function difference(iterable) { var set = anObject(this); var newSet = new (speciesConstructor(set, getBuiltIn('Set')))(set); @@ -13095,13 +14125,13 @@ var doric = (function (exports) { }); var getSetIterator = function (it) { - // eslint-disable-next-line es/no-set -- safe + // eslint-disable-next-line es-x/no-set -- safe return functionCall(Set.prototype.values, it); }; // `Set.prototype.every` method // https://github.com/tc39/proposal-collection-methods - _export({ target: 'Set', proto: true, real: true, forced: isPure }, { + _export({ target: 'Set', proto: true, real: true, forced: true }, { every: function every(callbackfn /* , thisArg */) { var set = anObject(this); var iterator = getSetIterator(set); @@ -13114,7 +14144,7 @@ var doric = (function (exports) { // `Set.prototype.filter` method // https://github.com/tc39/proposal-collection-methods - _export({ target: 'Set', proto: true, real: true, forced: isPure }, { + _export({ target: 'Set', proto: true, real: true, forced: true }, { filter: function filter(callbackfn /* , thisArg */) { var set = anObject(this); var iterator = getSetIterator(set); @@ -13130,7 +14160,7 @@ var doric = (function (exports) { // `Set.prototype.find` method // https://github.com/tc39/proposal-collection-methods - _export({ target: 'Set', proto: true, real: true, forced: isPure }, { + _export({ target: 'Set', proto: true, real: true, forced: true }, { find: function find(callbackfn /* , thisArg */) { var set = anObject(this); var iterator = getSetIterator(set); @@ -13143,13 +14173,13 @@ var doric = (function (exports) { // `Set.from` method // https://tc39.github.io/proposal-setmap-offrom/#sec-set.from - _export({ target: 'Set', stat: true }, { + _export({ target: 'Set', stat: true, forced: true }, { from: collectionFrom }); // `Set.prototype.intersection` method // https://github.com/tc39/proposal-set-methods - _export({ target: 'Set', proto: true, real: true, forced: isPure }, { + _export({ target: 'Set', proto: true, real: true, forced: true }, { intersection: function intersection(iterable) { var set = anObject(this); var newSet = new (speciesConstructor(set, getBuiltIn('Set')))(); @@ -13164,7 +14194,7 @@ var doric = (function (exports) { // `Set.prototype.isDisjointFrom` method // https://tc39.github.io/proposal-set-methods/#Set.prototype.isDisjointFrom - _export({ target: 'Set', proto: true, real: true, forced: isPure }, { + _export({ target: 'Set', proto: true, real: true, forced: true }, { isDisjointFrom: function isDisjointFrom(iterable) { var set = anObject(this); var hasCheck = aCallable(set.has); @@ -13176,7 +14206,7 @@ var doric = (function (exports) { // `Set.prototype.isSubsetOf` method // https://tc39.github.io/proposal-set-methods/#Set.prototype.isSubsetOf - _export({ target: 'Set', proto: true, real: true, forced: isPure }, { + _export({ target: 'Set', proto: true, real: true, forced: true }, { isSubsetOf: function isSubsetOf(iterable) { var iterator = getIterator(this); var otherSet = anObject(iterable); @@ -13193,7 +14223,7 @@ var doric = (function (exports) { // `Set.prototype.isSupersetOf` method // https://tc39.github.io/proposal-set-methods/#Set.prototype.isSupersetOf - _export({ target: 'Set', proto: true, real: true, forced: isPure }, { + _export({ target: 'Set', proto: true, real: true, forced: true }, { isSupersetOf: function isSupersetOf(iterable) { var set = anObject(this); var hasCheck = aCallable(set.has); @@ -13204,24 +14234,24 @@ var doric = (function (exports) { }); var arrayJoin = functionUncurryThis([].join); - var push$3 = [].push; + var push$5 = [].push; // `Set.prototype.join` method // https://github.com/tc39/proposal-collection-methods - _export({ target: 'Set', proto: true, real: true, forced: isPure }, { + _export({ target: 'Set', proto: true, real: true, forced: true }, { join: function join(separator) { var set = anObject(this); var iterator = getSetIterator(set); var sep = separator === undefined ? ',' : toString_1(separator); var result = []; - iterate(iterator, push$3, { that: result, IS_ITERATOR: true }); + iterate(iterator, push$5, { that: result, IS_ITERATOR: true }); return arrayJoin(result, sep); } }); // `Set.prototype.map` method // https://github.com/tc39/proposal-collection-methods - _export({ target: 'Set', proto: true, real: true, forced: isPure }, { + _export({ target: 'Set', proto: true, real: true, forced: true }, { map: function map(callbackfn /* , thisArg */) { var set = anObject(this); var iterator = getSetIterator(set); @@ -13237,15 +14267,15 @@ var doric = (function (exports) { // `Set.of` method // https://tc39.github.io/proposal-setmap-offrom/#sec-set.of - _export({ target: 'Set', stat: true }, { + _export({ target: 'Set', stat: true, forced: true }, { of: collectionOf }); - var TypeError$3 = global_1.TypeError; + var $TypeError$1 = TypeError; // `Set.prototype.reduce` method // https://github.com/tc39/proposal-collection-methods - _export({ target: 'Set', proto: true, real: true, forced: isPure }, { + _export({ target: 'Set', proto: true, real: true, forced: true }, { reduce: function reduce(callbackfn /* , initialValue */) { var set = anObject(this); var iterator = getSetIterator(set); @@ -13260,14 +14290,14 @@ var doric = (function (exports) { accumulator = callbackfn(accumulator, value, value, set); } }, { IS_ITERATOR: true }); - if (noInitial) { throw TypeError$3('Reduce of empty set with no initial value'); } + if (noInitial) { throw $TypeError$1('Reduce of empty set with no initial value'); } return accumulator; } }); // `Set.prototype.some` method // https://github.com/tc39/proposal-collection-methods - _export({ target: 'Set', proto: true, real: true, forced: isPure }, { + _export({ target: 'Set', proto: true, real: true, forced: true }, { some: function some(callbackfn /* , thisArg */) { var set = anObject(this); var iterator = getSetIterator(set); @@ -13280,7 +14310,7 @@ var doric = (function (exports) { // `Set.prototype.symmetricDifference` method // https://github.com/tc39/proposal-set-methods - _export({ target: 'Set', proto: true, real: true, forced: isPure }, { + _export({ target: 'Set', proto: true, real: true, forced: true }, { symmetricDifference: function symmetricDifference(iterable) { var set = anObject(this); var newSet = new (speciesConstructor(set, getBuiltIn('Set')))(set); @@ -13295,7 +14325,7 @@ var doric = (function (exports) { // `Set.prototype.union` method // https://github.com/tc39/proposal-set-methods - _export({ target: 'Set', proto: true, real: true, forced: isPure }, { + _export({ target: 'Set', proto: true, real: true, forced: true }, { union: function union(iterable) { var set = anObject(this); var newSet = new (speciesConstructor(set, getBuiltIn('Set')))(set); @@ -13304,48 +14334,78 @@ var doric = (function (exports) { } }); - var charAt$3 = stringMultibyte.charAt; + // TODO: Remove from `core-js@4` + + var charAt$5 = stringMultibyte.charAt; + - var FORCED$1 = fails(function () { - return '𠮷'.at(0) !== '𠮷'; - }); // `String.prototype.at` method // https://github.com/mathiasbynens/String.prototype.at - _export({ target: 'String', proto: true, forced: FORCED$1 }, { - at: function at(pos) { - return charAt$3(this, pos); + _export({ target: 'String', proto: true, forced: true }, { + at: function at(index) { + var S = toString_1(requireObjectCoercible(this)); + var len = S.length; + var relativeIndex = toIntegerOrInfinity(index); + var k = relativeIndex >= 0 ? relativeIndex : len + relativeIndex; + return (k < 0 || k >= len) ? undefined : charAt$5(S, k); + } + }); + + var $TypeError = TypeError; + var ArrayPrototype = Array.prototype; + var push$4 = functionUncurryThis(ArrayPrototype.push); + var join$3 = functionUncurryThis(ArrayPrototype.join); + + // `String.cooked` method + // https://github.com/tc39/proposal-string-cooked + _export({ target: 'String', stat: true, forced: true }, { + cooked: function cooked(template /* , ...substitutions */) { + var arguments$1 = arguments; + + var cookedTemplate = toIndexedObject(template); + var literalSegments = lengthOfArrayLike(cookedTemplate); + var argumentsLength = arguments.length; + var elements = []; + var i = 0; + while (literalSegments > i) { + var nextVal = cookedTemplate[i++]; + if (nextVal === undefined) { throw $TypeError('Incorrect template'); } + push$4(elements, toString_1(nextVal)); + if (i === literalSegments) { return join$3(elements, ''); } + if (i < argumentsLength) { push$4(elements, toString_1(arguments$1[i])); } + } } }); var codeAt$1 = stringMultibyte.codeAt; - var charAt$2 = stringMultibyte.charAt; + var charAt$4 = stringMultibyte.charAt; var STRING_ITERATOR = 'String Iterator'; - var setInternalState$2 = internalState.set; - var getInternalState = internalState.getterFor(STRING_ITERATOR); + var setInternalState$3 = internalState.set; + var getInternalState$1 = internalState.getterFor(STRING_ITERATOR); // TODO: unify with String#@@iterator var $StringIterator = createIteratorConstructor(function StringIterator(string) { - setInternalState$2(this, { + setInternalState$3(this, { type: STRING_ITERATOR, string: string, index: 0 }); }, 'String', function next() { - var state = getInternalState(this); + var state = getInternalState$1(this); var string = state.string; var index = state.index; var point; if (index >= string.length) { return { value: undefined, done: true }; } - point = charAt$2(string, index); + point = charAt$4(string, index); state.index += point.length; return { value: { codePoint: codeAt$1(point, 0), position: index }, done: false }; }); // `String.prototype.codePoints` method // https://github.com/tc39/proposal-string-prototype-codepoints - _export({ target: 'String', proto: true }, { + _export({ target: 'String', proto: true, forced: true }, { codePoints: function codePoints() { return new $StringIterator(toString_1(requireObjectCoercible(this))); } @@ -13363,10 +14423,17 @@ var doric = (function (exports) { // https://github.com/tc39/proposal-pattern-matching defineWellKnownSymbol('matcher'); + // TODO: Remove from `core-js@4` + + // `Symbol.metadata` well-known symbol // https://github.com/tc39/proposal-decorators defineWellKnownSymbol('metadata'); + // `Symbol.metadataKey` well-known symbol + // https://github.com/tc39/proposal-decorator-metadata + defineWellKnownSymbol('metadataKey'); + // `Symbol.observable` well-known symbol // https://github.com/tc39/proposal-observable defineWellKnownSymbol('observable'); @@ -13383,6 +14450,13 @@ var doric = (function (exports) { defineWellKnownSymbol('replaceAll'); + // TODO: Remove from `core-js@4` + + + + + + var aTypedArrayConstructor = arrayBufferViewCore.aTypedArrayConstructor; var exportTypedArrayStaticMethod = arrayBufferViewCore.exportTypedArrayStaticMethod; @@ -13399,99 +14473,142 @@ var doric = (function (exports) { }).then(function (list) { return arrayFromConstructorAndList(aTypedArrayConstructor(C), list); }); - }, typedArrayConstructorsRequireWrappers); + }, true); // TODO: Remove from `core-js@4` var $filterReject$1 = arrayIteration.filterReject; - var aTypedArray$5 = arrayBufferViewCore.aTypedArray; - var exportTypedArrayMethod$5 = arrayBufferViewCore.exportTypedArrayMethod; + var aTypedArray$7 = arrayBufferViewCore.aTypedArray; + var exportTypedArrayMethod$7 = arrayBufferViewCore.exportTypedArrayMethod; // `%TypedArray%.prototype.filterOut` method // https://github.com/tc39/proposal-array-filtering - exportTypedArrayMethod$5('filterOut', function filterOut(callbackfn /* , thisArg */) { - var list = $filterReject$1(aTypedArray$5(this), callbackfn, arguments.length > 1 ? arguments[1] : undefined); + exportTypedArrayMethod$7('filterOut', function filterOut(callbackfn /* , thisArg */) { + var list = $filterReject$1(aTypedArray$7(this), callbackfn, arguments.length > 1 ? arguments[1] : undefined); return typedArrayFromSpeciesAndList(this, list); - }); + }, true); var $filterReject = arrayIteration.filterReject; - var aTypedArray$4 = arrayBufferViewCore.aTypedArray; - var exportTypedArrayMethod$4 = arrayBufferViewCore.exportTypedArrayMethod; + var aTypedArray$6 = arrayBufferViewCore.aTypedArray; + var exportTypedArrayMethod$6 = arrayBufferViewCore.exportTypedArrayMethod; // `%TypedArray%.prototype.filterReject` method // https://github.com/tc39/proposal-array-filtering - exportTypedArrayMethod$4('filterReject', function filterReject(callbackfn /* , thisArg */) { - var list = $filterReject(aTypedArray$4(this), callbackfn, arguments.length > 1 ? arguments[1] : undefined); + exportTypedArrayMethod$6('filterReject', function filterReject(callbackfn /* , thisArg */) { + var list = $filterReject(aTypedArray$6(this), callbackfn, arguments.length > 1 ? arguments[1] : undefined); return typedArrayFromSpeciesAndList(this, list); - }); + }, true); - var $findLast = arrayIterationFromLast.findLast; + // TODO: Remove from `core-js@4` - var aTypedArray$3 = arrayBufferViewCore.aTypedArray; - var exportTypedArrayMethod$3 = arrayBufferViewCore.exportTypedArrayMethod; - // `%TypedArray%.prototype.findLast` method - // https://github.com/tc39/proposal-array-find-from-last - exportTypedArrayMethod$3('findLast', function findLast(predicate /* , thisArg */) { - return $findLast(aTypedArray$3(this), predicate, arguments.length > 1 ? arguments[1] : undefined); - }); - var $findLastIndex = arrayIterationFromLast.findLastIndex; - var aTypedArray$2 = arrayBufferViewCore.aTypedArray; - var exportTypedArrayMethod$2 = arrayBufferViewCore.exportTypedArrayMethod; - - // `%TypedArray%.prototype.findLastIndex` method - // https://github.com/tc39/proposal-array-find-from-last - exportTypedArrayMethod$2('findLastIndex', function findLastIndex(predicate /* , thisArg */) { - return $findLastIndex(aTypedArray$2(this), predicate, arguments.length > 1 ? arguments[1] : undefined); - }); - - var aTypedArray$1 = arrayBufferViewCore.aTypedArray; - var exportTypedArrayMethod$1 = arrayBufferViewCore.exportTypedArrayMethod; + var aTypedArray$5 = arrayBufferViewCore.aTypedArray; + var exportTypedArrayMethod$5 = arrayBufferViewCore.exportTypedArrayMethod; // `%TypedArray%.prototype.groupBy` method // https://github.com/tc39/proposal-array-grouping - exportTypedArrayMethod$1('groupBy', function groupBy(callbackfn /* , thisArg */) { + exportTypedArrayMethod$5('groupBy', function groupBy(callbackfn /* , thisArg */) { var thisArg = arguments.length > 1 ? arguments[1] : undefined; - return arrayGroupBy(aTypedArray$1(this), callbackfn, thisArg, typedArraySpeciesConstructor); + return arrayGroup(aTypedArray$5(this), callbackfn, thisArg, typedArraySpeciesConstructor); + }, true); + + var aTypedArray$4 = arrayBufferViewCore.aTypedArray; + var exportTypedArrayMethod$4 = arrayBufferViewCore.exportTypedArrayMethod; + var TYPED_ARRAY_CONSTRUCTOR$3 = arrayBufferViewCore.TYPED_ARRAY_CONSTRUCTOR; + + // `%TypedArray%.prototype.toReversed` method + // https://tc39.es/proposal-change-array-by-copy/#sec-%typedarray%.prototype.toReversed + exportTypedArrayMethod$4('toReversed', function toReversed() { + return arrayToReversed(aTypedArray$4(this), this[TYPED_ARRAY_CONSTRUCTOR$3]); }); - var aTypedArray = arrayBufferViewCore.aTypedArray; - var exportTypedArrayMethod = arrayBufferViewCore.exportTypedArrayMethod; + var aTypedArray$3 = arrayBufferViewCore.aTypedArray; + var exportTypedArrayMethod$3 = arrayBufferViewCore.exportTypedArrayMethod; + var TYPED_ARRAY_CONSTRUCTOR$2 = arrayBufferViewCore.TYPED_ARRAY_CONSTRUCTOR; + var sort = functionUncurryThis(arrayBufferViewCore.TypedArrayPrototype.sort); + + // `%TypedArray%.prototype.toSorted` method + // https://tc39.es/proposal-change-array-by-copy/#sec-%typedarray%.prototype.toSorted + exportTypedArrayMethod$3('toSorted', function toSorted(compareFn) { + if (compareFn !== undefined) { aCallable(compareFn); } + var O = aTypedArray$3(this); + var A = arrayFromConstructorAndList(O[TYPED_ARRAY_CONSTRUCTOR$2], O); + return sort(A, compareFn); + }); + + var aTypedArray$2 = arrayBufferViewCore.aTypedArray; + var exportTypedArrayMethod$2 = arrayBufferViewCore.exportTypedArrayMethod; + var TYPED_ARRAY_CONSTRUCTOR$1 = arrayBufferViewCore.TYPED_ARRAY_CONSTRUCTOR; + + // `%TypedArray%.prototype.toSpliced` method + // https://tc39.es/proposal-change-array-by-copy/#sec-%typedarray%.prototype.toSpliced + // eslint-disable-next-line no-unused-vars -- required for .length + exportTypedArrayMethod$2('toSpliced', function toSpliced(start, deleteCount /* , ...items */) { + return arrayToSpliced(aTypedArray$2(this), this[TYPED_ARRAY_CONSTRUCTOR$1], arraySlice$1(arguments)); + }, { arity: 2 }); + + var aTypedArray$1 = arrayBufferViewCore.aTypedArray; + var exportTypedArrayMethod$1 = arrayBufferViewCore.exportTypedArrayMethod; var arrayUniqueBy = functionUncurryThis(arrayUniqueBy$2); // `%TypedArray%.prototype.uniqueBy` method // https://github.com/tc39/proposal-array-unique - exportTypedArrayMethod('uniqueBy', function uniqueBy(resolver) { - return typedArrayFromSpeciesAndList(this, arrayUniqueBy(aTypedArray(this), resolver)); - }); + exportTypedArrayMethod$1('uniqueBy', function uniqueBy(resolver) { + return typedArrayFromSpeciesAndList(this, arrayUniqueBy(aTypedArray$1(this), resolver)); + }, true); + + var aTypedArray = arrayBufferViewCore.aTypedArray; + var exportTypedArrayMethod = arrayBufferViewCore.exportTypedArrayMethod; + var TYPED_ARRAY_CONSTRUCTOR = arrayBufferViewCore.TYPED_ARRAY_CONSTRUCTOR; + var slice = functionUncurryThis(''.slice); + + var PROPER_ORDER = !!function () { + try { + // eslint-disable-next-line no-throw-literal, es-x/no-typed-arrays -- required for testing + new Int8Array(1)['with'](2, { valueOf: function () { throw 8; } }); + } catch (error) { + // some early implementations, like WebKit, does not follow the final semantic + // https://github.com/tc39/proposal-change-array-by-copy/pull/86 + return error === 8; + } + }(); + + // `%TypedArray%.prototype.with` method + // https://tc39.es/proposal-change-array-by-copy/#sec-%typedarray%.prototype.with + exportTypedArrayMethod('with', { 'with': function (index, value) { + aTypedArray(this); + var relativeIndex = toIntegerOrInfinity(index); + var actualValue = slice(classof(this), 0, 3) === 'Big' ? toBigInt(value) : +value; + return arrayWith(this, this[TYPED_ARRAY_CONSTRUCTOR], relativeIndex, actualValue); + } }['with'], !PROPER_ORDER); // `WeakMap.prototype.deleteAll` method // https://github.com/tc39/proposal-collection-methods - _export({ target: 'WeakMap', proto: true, real: true, forced: isPure }, { + _export({ target: 'WeakMap', proto: true, real: true, forced: true }, { deleteAll: collectionDeleteAll }); // `WeakMap.from` method // https://tc39.github.io/proposal-setmap-offrom/#sec-weakmap.from - _export({ target: 'WeakMap', stat: true }, { + _export({ target: 'WeakMap', stat: true, forced: true }, { from: collectionFrom }); // `WeakMap.of` method // https://tc39.github.io/proposal-setmap-offrom/#sec-weakmap.of - _export({ target: 'WeakMap', stat: true }, { + _export({ target: 'WeakMap', stat: true, forced: true }, { of: collectionOf }); // `WeakMap.prototype.emplace` method // https://github.com/tc39/proposal-upsert - _export({ target: 'WeakMap', proto: true, real: true, forced: isPure }, { + _export({ target: 'WeakMap', proto: true, real: true, forced: true }, { emplace: mapEmplace }); @@ -13499,37 +14616,136 @@ var doric = (function (exports) { - // `WeakMap.prototype.upsert` method (replaced by `WeakMap.prototype.emplace`) // https://github.com/tc39/proposal-upsert - _export({ target: 'WeakMap', proto: true, real: true, forced: isPure }, { + _export({ target: 'WeakMap', proto: true, real: true, forced: true }, { upsert: mapUpsert }); // `WeakSet.prototype.addAll` method // https://github.com/tc39/proposal-collection-methods - _export({ target: 'WeakSet', proto: true, real: true, forced: isPure }, { + _export({ target: 'WeakSet', proto: true, real: true, forced: true }, { addAll: collectionAddAll }); // `WeakSet.prototype.deleteAll` method // https://github.com/tc39/proposal-collection-methods - _export({ target: 'WeakSet', proto: true, real: true, forced: isPure }, { + _export({ target: 'WeakSet', proto: true, real: true, forced: true }, { deleteAll: collectionDeleteAll }); // `WeakSet.from` method // https://tc39.github.io/proposal-setmap-offrom/#sec-weakset.from - _export({ target: 'WeakSet', stat: true }, { + _export({ target: 'WeakSet', stat: true, forced: true }, { from: collectionFrom }); // `WeakSet.of` method // https://tc39.github.io/proposal-setmap-offrom/#sec-weakset.of - _export({ target: 'WeakSet', stat: true }, { + _export({ target: 'WeakSet', stat: true, forced: true }, { of: collectionOf }); + var itoc$1 = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/='; + var ctoi$1 = {}; + + for (var index = 0; index < 66; index++) { ctoi$1[itoc$1.charAt(index)] = index; } + + var base64Map = { + itoc: itoc$1, + ctoi: ctoi$1 + }; + + var ctoi = base64Map.ctoi; + + var disallowed = /[^\d+/a-z]/i; + var whitespaces = /[\t\n\f\r ]+/g; + var finalEq = /[=]+$/; + + var $atob = getBuiltIn('atob'); + var fromCharCode$1 = String.fromCharCode; + var charAt$3 = functionUncurryThis(''.charAt); + var replace$3 = functionUncurryThis(''.replace); + var exec$2 = functionUncurryThis(disallowed.exec); + + var NO_SPACES_IGNORE = fails(function () { + return $atob(' ') !== ''; + }); + + var NO_ENCODING_CHECK = !fails(function () { + $atob('a'); + }); + + var NO_ARG_RECEIVING_CHECK$1 = !NO_SPACES_IGNORE && !NO_ENCODING_CHECK && !fails(function () { + $atob(); + }); + + var WRONG_ARITY$1 = !NO_SPACES_IGNORE && !NO_ENCODING_CHECK && $atob.length !== 1; + + // `atob` method + // https://html.spec.whatwg.org/multipage/webappapis.html#dom-atob + _export({ global: true, enumerable: true, forced: NO_SPACES_IGNORE || NO_ENCODING_CHECK || NO_ARG_RECEIVING_CHECK$1 || WRONG_ARITY$1 }, { + atob: function atob(data) { + validateArgumentsLength(arguments.length, 1); + if (NO_ARG_RECEIVING_CHECK$1 || WRONG_ARITY$1) { return $atob(data); } + var string = replace$3(toString_1(data), whitespaces, ''); + var output = ''; + var position = 0; + var bc = 0; + var chr, bs; + if (string.length % 4 == 0) { + string = replace$3(string, finalEq, ''); + } + if (string.length % 4 == 1 || exec$2(disallowed, string)) { + throw new (getBuiltIn('DOMException'))('The string is not correctly encoded', 'InvalidCharacterError'); + } + while (chr = charAt$3(string, position++)) { + if (hasOwnProperty_1(ctoi, chr)) { + bs = bc % 4 ? bs * 64 + ctoi[chr] : ctoi[chr]; + if (bc++ % 4) { output += fromCharCode$1(255 & bs >> (-2 * bc & 6)); } + } + } return output; + } + }); + + var itoc = base64Map.itoc; + + var $btoa = getBuiltIn('btoa'); + var charAt$2 = functionUncurryThis(''.charAt); + var charCodeAt$1 = functionUncurryThis(''.charCodeAt); + + var NO_ARG_RECEIVING_CHECK = !!$btoa && !fails(function () { + $btoa(); + }); + + var WRONG_ARG_CONVERSION = !!$btoa && fails(function () { + return $btoa(null) !== 'bnVsbA=='; + }); + + var WRONG_ARITY = !!$btoa && $btoa.length !== 1; + + // `btoa` method + // https://html.spec.whatwg.org/multipage/webappapis.html#dom-btoa + _export({ global: true, enumerable: true, forced: NO_ARG_RECEIVING_CHECK || WRONG_ARG_CONVERSION || WRONG_ARITY }, { + btoa: function btoa(data) { + validateArgumentsLength(arguments.length, 1); + if (NO_ARG_RECEIVING_CHECK || WRONG_ARG_CONVERSION || WRONG_ARITY) { return $btoa(toString_1(data)); } + var string = toString_1(data); + var output = ''; + var position = 0; + var map = itoc; + var block, charCode; + while (charAt$2(string, position) || (map = '=', position % 1)) { + charCode = charCodeAt$1(string, position += 3 / 4); + if (charCode > 0xFF) { + throw new (getBuiltIn('DOMException'))('The string contains characters outside of the Latin1 range', 'InvalidCharacterError'); + } + block = block << 8 | charCode; + output += charAt$2(map, 63 & block >> 8 - position % 1 * 8); + } return output; + } + }); + // iterable DOM collections // flag - `iterable` interface - 'entries', 'keys', 'values', 'forEach' methods var domIterables = { @@ -13623,56 +14839,771 @@ var doric = (function (exports) { handlePrototype(domTokenListPrototype, 'DOMTokenList'); - var FORCED = !global_1.setImmediate || !global_1.clearImmediate; + var tryNodeRequire = function (name) { + try { + // eslint-disable-next-line no-new-func -- safe + if (engineIsNode) { return Function('return require("' + name + '")')(); } + } catch (error) { /* empty */ } + }; - // http://w3c.github.io/setImmediate/ - _export({ global: true, bind: true, enumerable: true, forced: FORCED }, { - // `setImmediate` method - // http://w3c.github.io/setImmediate/#si-setImmediate - setImmediate: task$1.set, - // `clearImmediate` method - // http://w3c.github.io/setImmediate/#si-clearImmediate - clearImmediate: task$1.clear + var domExceptionConstants = { + IndexSizeError: { s: 'INDEX_SIZE_ERR', c: 1, m: 1 }, + DOMStringSizeError: { s: 'DOMSTRING_SIZE_ERR', c: 2, m: 0 }, + HierarchyRequestError: { s: 'HIERARCHY_REQUEST_ERR', c: 3, m: 1 }, + WrongDocumentError: { s: 'WRONG_DOCUMENT_ERR', c: 4, m: 1 }, + InvalidCharacterError: { s: 'INVALID_CHARACTER_ERR', c: 5, m: 1 }, + NoDataAllowedError: { s: 'NO_DATA_ALLOWED_ERR', c: 6, m: 0 }, + NoModificationAllowedError: { s: 'NO_MODIFICATION_ALLOWED_ERR', c: 7, m: 1 }, + NotFoundError: { s: 'NOT_FOUND_ERR', c: 8, m: 1 }, + NotSupportedError: { s: 'NOT_SUPPORTED_ERR', c: 9, m: 1 }, + InUseAttributeError: { s: 'INUSE_ATTRIBUTE_ERR', c: 10, m: 1 }, + InvalidStateError: { s: 'INVALID_STATE_ERR', c: 11, m: 1 }, + SyntaxError: { s: 'SYNTAX_ERR', c: 12, m: 1 }, + InvalidModificationError: { s: 'INVALID_MODIFICATION_ERR', c: 13, m: 1 }, + NamespaceError: { s: 'NAMESPACE_ERR', c: 14, m: 1 }, + InvalidAccessError: { s: 'INVALID_ACCESS_ERR', c: 15, m: 1 }, + ValidationError: { s: 'VALIDATION_ERR', c: 16, m: 0 }, + TypeMismatchError: { s: 'TYPE_MISMATCH_ERR', c: 17, m: 1 }, + SecurityError: { s: 'SECURITY_ERR', c: 18, m: 1 }, + NetworkError: { s: 'NETWORK_ERR', c: 19, m: 1 }, + AbortError: { s: 'ABORT_ERR', c: 20, m: 1 }, + URLMismatchError: { s: 'URL_MISMATCH_ERR', c: 21, m: 1 }, + QuotaExceededError: { s: 'QUOTA_EXCEEDED_ERR', c: 22, m: 1 }, + TimeoutError: { s: 'TIMEOUT_ERR', c: 23, m: 1 }, + InvalidNodeTypeError: { s: 'INVALID_NODE_TYPE_ERR', c: 24, m: 1 }, + DataCloneError: { s: 'DATA_CLONE_ERR', c: 25, m: 1 } + }; + + var defineProperty$1 = objectDefineProperty.f; + + + + + + + + + + + + + + var DOM_EXCEPTION$2 = 'DOMException'; + var DATA_CLONE_ERR = 'DATA_CLONE_ERR'; + var Error$3 = getBuiltIn('Error'); + // NodeJS < 17.0 does not expose `DOMException` to global + var NativeDOMException$1 = getBuiltIn(DOM_EXCEPTION$2) || (function () { + try { + // NodeJS < 15.0 does not expose `MessageChannel` to global + var MessageChannel = getBuiltIn('MessageChannel') || tryNodeRequire('worker_threads').MessageChannel; + // eslint-disable-next-line es-x/no-weak-map, unicorn/require-post-message-target-origin -- safe + new MessageChannel().port1.postMessage(new WeakMap()); + } catch (error) { + if (error.name == DATA_CLONE_ERR && error.code == 25) { return error.constructor; } + } + })(); + var NativeDOMExceptionPrototype = NativeDOMException$1 && NativeDOMException$1.prototype; + var ErrorPrototype = Error$3.prototype; + var setInternalState$2 = internalState.set; + var getInternalState = internalState.getterFor(DOM_EXCEPTION$2); + var HAS_STACK = 'stack' in Error$3(DOM_EXCEPTION$2); + + var codeFor = function (name) { + return hasOwnProperty_1(domExceptionConstants, name) && domExceptionConstants[name].m ? domExceptionConstants[name].c : 0; + }; + + var $DOMException$1 = function DOMException() { + anInstance(this, DOMExceptionPrototype$1); + var argumentsLength = arguments.length; + var message = normalizeStringArgument(argumentsLength < 1 ? undefined : arguments[0]); + var name = normalizeStringArgument(argumentsLength < 2 ? undefined : arguments[1], 'Error'); + var code = codeFor(name); + setInternalState$2(this, { + type: DOM_EXCEPTION$2, + name: name, + message: message, + code: code + }); + if (!descriptors) { + this.name = name; + this.message = message; + this.code = code; + } + if (HAS_STACK) { + var error = Error$3(message); + error.name = DOM_EXCEPTION$2; + defineProperty$1(this, 'stack', createPropertyDescriptor(1, clearErrorStack(error.stack, 1))); + } + }; + + var DOMExceptionPrototype$1 = $DOMException$1.prototype = objectCreate(ErrorPrototype); + + var createGetterDescriptor = function (get) { + return { enumerable: true, configurable: true, get: get }; + }; + + var getterFor = function (key) { + return createGetterDescriptor(function () { + return getInternalState(this)[key]; + }); + }; + + if (descriptors) { + defineBuiltInAccessor(DOMExceptionPrototype$1, 'code', getterFor('code')); + defineBuiltInAccessor(DOMExceptionPrototype$1, 'message', getterFor('message')); + defineBuiltInAccessor(DOMExceptionPrototype$1, 'name', getterFor('name')); + } + + defineProperty$1(DOMExceptionPrototype$1, 'constructor', createPropertyDescriptor(1, $DOMException$1)); + + // FF36- DOMException is a function, but can't be constructed + var INCORRECT_CONSTRUCTOR = fails(function () { + return !(new NativeDOMException$1() instanceof Error$3); + }); + + // Safari 10.1 / Chrome 32- / IE8- DOMException.prototype.toString bugs + var INCORRECT_TO_STRING = INCORRECT_CONSTRUCTOR || fails(function () { + return ErrorPrototype.toString !== errorToString || String(new NativeDOMException$1(1, 2)) !== '2: 1'; + }); + + // Deno 1.6.3- DOMException.prototype.code just missed + var INCORRECT_CODE = INCORRECT_CONSTRUCTOR || fails(function () { + return new NativeDOMException$1(1, 'DataCloneError').code !== 25; + }); + + // Deno 1.6.3- DOMException constants just missed + INCORRECT_CONSTRUCTOR + || NativeDOMException$1[DATA_CLONE_ERR] !== 25 + || NativeDOMExceptionPrototype[DATA_CLONE_ERR] !== 25; + + var FORCED_CONSTRUCTOR$1 = INCORRECT_CONSTRUCTOR; + + // `DOMException` constructor + // https://webidl.spec.whatwg.org/#idl-DOMException + _export({ global: true, constructor: true, forced: FORCED_CONSTRUCTOR$1 }, { + DOMException: FORCED_CONSTRUCTOR$1 ? $DOMException$1 : NativeDOMException$1 + }); + + var PolyfilledDOMException$1 = getBuiltIn(DOM_EXCEPTION$2); + var PolyfilledDOMExceptionPrototype$1 = PolyfilledDOMException$1.prototype; + + if (INCORRECT_TO_STRING && (NativeDOMException$1 === PolyfilledDOMException$1)) { + defineBuiltIn(PolyfilledDOMExceptionPrototype$1, 'toString', errorToString); + } + + if (INCORRECT_CODE && descriptors && NativeDOMException$1 === PolyfilledDOMException$1) { + defineBuiltInAccessor(PolyfilledDOMExceptionPrototype$1, 'code', createGetterDescriptor(function () { + return codeFor(anObject(this).name); + })); + } + + for (var key$1 in domExceptionConstants) { if (hasOwnProperty_1(domExceptionConstants, key$1)) { + var constant$1 = domExceptionConstants[key$1]; + var constantName$1 = constant$1.s; + var descriptor = createPropertyDescriptor(6, constant$1.c); + if (!hasOwnProperty_1(PolyfilledDOMException$1, constantName$1)) { + defineProperty$1(PolyfilledDOMException$1, constantName$1, descriptor); + } + if (!hasOwnProperty_1(PolyfilledDOMExceptionPrototype$1, constantName$1)) { + defineProperty$1(PolyfilledDOMExceptionPrototype$1, constantName$1, descriptor); + } + } } + + var defineProperty = objectDefineProperty.f; + + + + + + + + + var DOM_EXCEPTION$1 = 'DOMException'; + var Error$2 = getBuiltIn('Error'); + var NativeDOMException = getBuiltIn(DOM_EXCEPTION$1); + + var $DOMException = function DOMException() { + anInstance(this, DOMExceptionPrototype); + var argumentsLength = arguments.length; + var message = normalizeStringArgument(argumentsLength < 1 ? undefined : arguments[0]); + var name = normalizeStringArgument(argumentsLength < 2 ? undefined : arguments[1], 'Error'); + var that = new NativeDOMException(message, name); + var error = Error$2(message); + error.name = DOM_EXCEPTION$1; + defineProperty(that, 'stack', createPropertyDescriptor(1, clearErrorStack(error.stack, 1))); + inheritIfRequired(that, this, $DOMException); + return that; + }; + + var DOMExceptionPrototype = $DOMException.prototype = NativeDOMException.prototype; + + var ERROR_HAS_STACK = 'stack' in Error$2(DOM_EXCEPTION$1); + var DOM_EXCEPTION_HAS_STACK = 'stack' in new NativeDOMException(1, 2); + var FORCED_CONSTRUCTOR = ERROR_HAS_STACK && !DOM_EXCEPTION_HAS_STACK; + + // `DOMException` constructor patch for `.stack` where it's required + // https://webidl.spec.whatwg.org/#es-DOMException-specialness + _export({ global: true, constructor: true, forced: FORCED_CONSTRUCTOR }, { // TODO: fix export logic + DOMException: FORCED_CONSTRUCTOR ? $DOMException : NativeDOMException + }); + + var PolyfilledDOMException = getBuiltIn(DOM_EXCEPTION$1); + var PolyfilledDOMExceptionPrototype = PolyfilledDOMException.prototype; + + if (PolyfilledDOMExceptionPrototype.constructor !== PolyfilledDOMException) { + { + defineProperty(PolyfilledDOMExceptionPrototype, 'constructor', createPropertyDescriptor(1, PolyfilledDOMException)); + } + + for (var key in domExceptionConstants) { if (hasOwnProperty_1(domExceptionConstants, key)) { + var constant = domExceptionConstants[key]; + var constantName = constant.s; + if (!hasOwnProperty_1(PolyfilledDOMException, constantName)) { + defineProperty(PolyfilledDOMException, constantName, createPropertyDescriptor(6, constant.c)); + } + } } + } + + var DOM_EXCEPTION = 'DOMException'; + + setToStringTag(getBuiltIn(DOM_EXCEPTION), DOM_EXCEPTION); + + var clearImmediate = task$1.clear; + + // `clearImmediate` method + // http://w3c.github.io/setImmediate/#si-clearImmediate + _export({ global: true, bind: true, enumerable: true, forced: global_1.clearImmediate !== clearImmediate }, { + clearImmediate: clearImmediate + }); + + var setImmediate = task$1.set; + + // `setImmediate` method + // http://w3c.github.io/setImmediate/#si-setImmediate + _export({ global: true, bind: true, enumerable: true, forced: global_1.setImmediate !== setImmediate }, { + setImmediate: setImmediate }); var process$1 = global_1.process; // `queueMicrotask` method // https://html.spec.whatwg.org/multipage/timers-and-user-prompts.html#dom-queuemicrotask - _export({ global: true, enumerable: true, noTargetGet: true }, { + _export({ global: true, enumerable: true, dontCallGetSet: true }, { queueMicrotask: function queueMicrotask(fn) { + validateArgumentsLength(arguments.length, 1); + aCallable(fn); var domain = engineIsNode && process$1.domain; microtask(domain ? domain.bind(fn) : fn); } }); + /* global Deno -- Deno case */ + var engineIsDeno = typeof Deno == 'object' && Deno && typeof Deno.version == 'object'; + + var Object$1 = global_1.Object; + var Date$1 = global_1.Date; + var Error$1 = global_1.Error; + var EvalError = global_1.EvalError; + var RangeError$1 = global_1.RangeError; + var ReferenceError = global_1.ReferenceError; + var SyntaxError$1 = global_1.SyntaxError; + var TypeError$3 = global_1.TypeError; + var URIError = global_1.URIError; + var PerformanceMark = global_1.PerformanceMark; + var WebAssembly = global_1.WebAssembly; + var CompileError = WebAssembly && WebAssembly.CompileError || Error$1; + var LinkError = WebAssembly && WebAssembly.LinkError || Error$1; + var RuntimeError = WebAssembly && WebAssembly.RuntimeError || Error$1; + var DOMException = getBuiltIn('DOMException'); + var Set$1 = getBuiltIn('Set'); + var Map$1 = getBuiltIn('Map'); + var MapPrototype = Map$1.prototype; + var mapHas = functionUncurryThis(MapPrototype.has); + var mapGet = functionUncurryThis(MapPrototype.get); + var mapSet = functionUncurryThis(MapPrototype.set); + var setAdd = functionUncurryThis(Set$1.prototype.add); + var objectKeys = getBuiltIn('Object', 'keys'); + var push$3 = functionUncurryThis([].push); + var booleanValueOf = functionUncurryThis(true.valueOf); + var numberValueOf = functionUncurryThis(1.0.valueOf); + var stringValueOf = functionUncurryThis(''.valueOf); + var getTime = functionUncurryThis(Date$1.prototype.getTime); + var PERFORMANCE_MARK = uid('structuredClone'); + var DATA_CLONE_ERROR = 'DataCloneError'; + var TRANSFERRING = 'Transferring'; + + var checkBasicSemantic = function (structuredCloneImplementation) { + return !fails(function () { + var set1 = new global_1.Set([7]); + var set2 = structuredCloneImplementation(set1); + var number = structuredCloneImplementation(Object$1(7)); + return set2 == set1 || !set2.has(7) || typeof number != 'object' || number != 7; + }) && structuredCloneImplementation; + }; + + var checkErrorsCloning = function (structuredCloneImplementation, $Error) { + return !fails(function () { + var error = new $Error(); + var test = structuredCloneImplementation({ a: error, b: error }); + return !(test && test.a === test.b && test.a instanceof $Error); + }); + }; + + // https://github.com/whatwg/html/pull/5749 + var checkNewErrorsCloningSemantic = function (structuredCloneImplementation) { + return !fails(function () { + var test = structuredCloneImplementation(new global_1.AggregateError([1], PERFORMANCE_MARK, { cause: 3 })); + return test.name != 'AggregateError' || test.errors[0] != 1 || test.message != PERFORMANCE_MARK || test.cause != 3; + }); + }; + + // FF94+, Safari 15.4+, Chrome 98+, NodeJS 17.0+, Deno 1.13+ + // FF and Safari implementations can't clone errors + // https://bugzilla.mozilla.org/show_bug.cgi?id=1556604 + // Chrome <102 returns `null` if cloned object contains multiple references to one error + // https://bugs.chromium.org/p/v8/issues/detail?id=12542 + // NodeJS implementation can't clone DOMExceptions + // https://github.com/nodejs/node/issues/41038 + // no one of current implementations supports new (html/5749) error cloning semantic + var nativeStructuredClone = global_1.structuredClone; + + var FORCED_REPLACEMENT = !checkErrorsCloning(nativeStructuredClone, Error$1) + || !checkErrorsCloning(nativeStructuredClone, DOMException) + || !checkNewErrorsCloningSemantic(nativeStructuredClone); + + // Chrome 82+, Safari 14.1+, Deno 1.11+ + // Chrome 78-81 implementation swaps `.name` and `.message` of cloned `DOMException` + // Chrome returns `null` if cloned object contains multiple references to one error + // Safari 14.1 implementation doesn't clone some `RegExp` flags, so requires a workaround + // Safari implementation can't clone errors + // Deno 1.2-1.10 implementations too naive + // NodeJS 16.0+ does not have `PerformanceMark` constructor + // NodeJS <17.2 structured cloning implementation from `performance.mark` is too naive + // and can't clone, for example, `RegExp` or some boxed primitives + // https://github.com/nodejs/node/issues/40840 + // no one of current implementations supports new (html/5749) error cloning semantic + var structuredCloneFromMark = !nativeStructuredClone && checkBasicSemantic(function (value) { + return new PerformanceMark(PERFORMANCE_MARK, { detail: value }).detail; + }); + + var nativeRestrictedStructuredClone = checkBasicSemantic(nativeStructuredClone) || structuredCloneFromMark; + + var throwUncloneable = function (type) { + throw new DOMException('Uncloneable type: ' + type, DATA_CLONE_ERROR); + }; + + var throwUnpolyfillable = function (type, kind) { + throw new DOMException((kind || 'Cloning') + ' of ' + type + ' cannot be properly polyfilled in this engine', DATA_CLONE_ERROR); + }; + + var structuredCloneInternal = function (value, map) { + if (isSymbol(value)) { throwUncloneable('Symbol'); } + if (!isObject(value)) { return value; } + // effectively preserves circular references + if (map) { + if (mapHas(map, value)) { return mapGet(map, value); } + } else { map = new Map$1(); } + + var type = classof(value); + var deep = false; + var C, name, cloned, dataTransfer, i, length, keys, key, source, target; + + switch (type) { + case 'Array': + cloned = []; + deep = true; + break; + case 'Object': + cloned = {}; + deep = true; + break; + case 'Map': + cloned = new Map$1(); + deep = true; + break; + case 'Set': + cloned = new Set$1(); + deep = true; + break; + case 'RegExp': + // in this block because of a Safari 14.1 bug + // old FF does not clone regexes passed to the constructor, so get the source and flags directly + cloned = new RegExp(value.source, regexpGetFlags(value)); + break; + case 'Error': + name = value.name; + switch (name) { + case 'AggregateError': + cloned = getBuiltIn('AggregateError')([]); + break; + case 'EvalError': + cloned = EvalError(); + break; + case 'RangeError': + cloned = RangeError$1(); + break; + case 'ReferenceError': + cloned = ReferenceError(); + break; + case 'SyntaxError': + cloned = SyntaxError$1(); + break; + case 'TypeError': + cloned = TypeError$3(); + break; + case 'URIError': + cloned = URIError(); + break; + case 'CompileError': + cloned = CompileError(); + break; + case 'LinkError': + cloned = LinkError(); + break; + case 'RuntimeError': + cloned = RuntimeError(); + break; + default: + cloned = Error$1(); + } + deep = true; + break; + case 'DOMException': + cloned = new DOMException(value.message, value.name); + deep = true; + break; + case 'DataView': + case 'Int8Array': + case 'Uint8Array': + case 'Uint8ClampedArray': + case 'Int16Array': + case 'Uint16Array': + case 'Int32Array': + case 'Uint32Array': + case 'Float32Array': + case 'Float64Array': + case 'BigInt64Array': + case 'BigUint64Array': + C = global_1[type]; + // in some old engines like Safari 9, typeof C is 'object' + // on Uint8ClampedArray or some other constructors + if (!isObject(C)) { throwUnpolyfillable(type); } + cloned = new C( + // this is safe, since arraybuffer cannot have circular references + structuredCloneInternal(value.buffer, map), + value.byteOffset, + type === 'DataView' ? value.byteLength : value.length + ); + break; + case 'DOMQuad': + try { + cloned = new DOMQuad( + structuredCloneInternal(value.p1, map), + structuredCloneInternal(value.p2, map), + structuredCloneInternal(value.p3, map), + structuredCloneInternal(value.p4, map) + ); + } catch (error) { + if (nativeRestrictedStructuredClone) { + cloned = nativeRestrictedStructuredClone(value); + } else { throwUnpolyfillable(type); } + } + break; + case 'FileList': + C = global_1.DataTransfer; + if (isConstructor(C)) { + dataTransfer = new C(); + for (i = 0, length = lengthOfArrayLike(value); i < length; i++) { + dataTransfer.items.add(structuredCloneInternal(value[i], map)); + } + cloned = dataTransfer.files; + } else if (nativeRestrictedStructuredClone) { + cloned = nativeRestrictedStructuredClone(value); + } else { throwUnpolyfillable(type); } + break; + case 'ImageData': + // Safari 9 ImageData is a constructor, but typeof ImageData is 'object' + try { + cloned = new ImageData( + structuredCloneInternal(value.data, map), + value.width, + value.height, + { colorSpace: value.colorSpace } + ); + } catch (error$1) { + if (nativeRestrictedStructuredClone) { + cloned = nativeRestrictedStructuredClone(value); + } else { throwUnpolyfillable(type); } + } break; + default: + if (nativeRestrictedStructuredClone) { + cloned = nativeRestrictedStructuredClone(value); + } else { switch (type) { + case 'BigInt': + // can be a 3rd party polyfill + cloned = Object$1(value.valueOf()); + break; + case 'Boolean': + cloned = Object$1(booleanValueOf(value)); + break; + case 'Number': + cloned = Object$1(numberValueOf(value)); + break; + case 'String': + cloned = Object$1(stringValueOf(value)); + break; + case 'Date': + cloned = new Date$1(getTime(value)); + break; + case 'ArrayBuffer': + C = global_1.DataView; + // `ArrayBuffer#slice` is not available in IE10 + // `ArrayBuffer#slice` and `DataView` are not available in old FF + if (!C && typeof value.slice != 'function') { throwUnpolyfillable(type); } + // detached buffers throws in `DataView` and `.slice` + try { + if (typeof value.slice == 'function') { + cloned = value.slice(0); + } else { + length = value.byteLength; + cloned = new ArrayBuffer(length); + source = new C(value); + target = new C(cloned); + for (i = 0; i < length; i++) { + target.setUint8(i, source.getUint8(i)); + } + } + } catch (error$2) { + throw new DOMException('ArrayBuffer is detached', DATA_CLONE_ERROR); + } break; + case 'SharedArrayBuffer': + // SharedArrayBuffer should use shared memory, we can't polyfill it, so return the original + cloned = value; + break; + case 'Blob': + try { + cloned = value.slice(0, value.size, value.type); + } catch (error$3) { + throwUnpolyfillable(type); + } break; + case 'DOMPoint': + case 'DOMPointReadOnly': + C = global_1[type]; + try { + cloned = C.fromPoint + ? C.fromPoint(value) + : new C(value.x, value.y, value.z, value.w); + } catch (error$4) { + throwUnpolyfillable(type); + } break; + case 'DOMRect': + case 'DOMRectReadOnly': + C = global_1[type]; + try { + cloned = C.fromRect + ? C.fromRect(value) + : new C(value.x, value.y, value.width, value.height); + } catch (error$5) { + throwUnpolyfillable(type); + } break; + case 'DOMMatrix': + case 'DOMMatrixReadOnly': + C = global_1[type]; + try { + cloned = C.fromMatrix + ? C.fromMatrix(value) + : new C(value); + } catch (error$6) { + throwUnpolyfillable(type); + } break; + case 'AudioData': + case 'VideoFrame': + if (!isCallable(value.clone)) { throwUnpolyfillable(type); } + try { + cloned = value.clone(); + } catch (error$7) { + throwUncloneable(type); + } break; + case 'File': + try { + cloned = new File([value], value.name, value); + } catch (error$8) { + throwUnpolyfillable(type); + } break; + case 'CryptoKey': + case 'GPUCompilationMessage': + case 'GPUCompilationInfo': + case 'ImageBitmap': + case 'RTCCertificate': + case 'WebAssembly.Module': + throwUnpolyfillable(type); + // break omitted + default: + throwUncloneable(type); + } } + } + + mapSet(map, value, cloned); + + if (deep) { switch (type) { + case 'Array': + case 'Object': + keys = objectKeys(value); + for (i = 0, length = lengthOfArrayLike(keys); i < length; i++) { + key = keys[i]; + createProperty(cloned, key, structuredCloneInternal(value[key], map)); + } break; + case 'Map': + value.forEach(function (v, k) { + mapSet(cloned, structuredCloneInternal(k, map), structuredCloneInternal(v, map)); + }); + break; + case 'Set': + value.forEach(function (v) { + setAdd(cloned, structuredCloneInternal(v, map)); + }); + break; + case 'Error': + createNonEnumerableProperty(cloned, 'message', structuredCloneInternal(value.message, map)); + if (hasOwnProperty_1(value, 'cause')) { + createNonEnumerableProperty(cloned, 'cause', structuredCloneInternal(value.cause, map)); + } + if (name == 'AggregateError') { + cloned.errors = structuredCloneInternal(value.errors, map); + } // break omitted + case 'DOMException': + if (errorStackInstallable) { + createNonEnumerableProperty(cloned, 'stack', structuredCloneInternal(value.stack, map)); + } + } } + + return cloned; + }; + + var PROPER_TRANSFER = nativeStructuredClone && !fails(function () { + // prevent V8 ArrayBufferDetaching protector cell invalidation and performance degradation + // https://github.com/zloirock/core-js/issues/679 + if ((engineIsDeno && engineV8Version > 92) || (engineIsNode && engineV8Version > 94) || (engineIsBrowser && engineV8Version > 97)) { return false; } + var buffer = new ArrayBuffer(8); + var clone = nativeStructuredClone(buffer, { transfer: [buffer] }); + return buffer.byteLength != 0 || clone.byteLength != 8; + }); + + var tryToTransfer = function (rawTransfer, map) { + if (!isObject(rawTransfer)) { throw TypeError$3('Transfer option cannot be converted to a sequence'); } + + var transfer = []; + + iterate(rawTransfer, function (value) { + push$3(transfer, anObject(value)); + }); + + var i = 0; + var length = lengthOfArrayLike(transfer); + var value, type, C, transferredArray, transferred, canvas, context; + + if (PROPER_TRANSFER) { + transferredArray = nativeStructuredClone(transfer, { transfer: transfer }); + while (i < length) { mapSet(map, transfer[i], transferredArray[i++]); } + } else { while (i < length) { + value = transfer[i++]; + if (mapHas(map, value)) { throw new DOMException('Duplicate transferable', DATA_CLONE_ERROR); } + + type = classof(value); + + switch (type) { + case 'ImageBitmap': + C = global_1.OffscreenCanvas; + if (!isConstructor(C)) { throwUnpolyfillable(type, TRANSFERRING); } + try { + canvas = new C(value.width, value.height); + context = canvas.getContext('bitmaprenderer'); + context.transferFromImageBitmap(value); + transferred = canvas.transferToImageBitmap(); + } catch (error) { /* empty */ } + break; + case 'AudioData': + case 'VideoFrame': + if (!isCallable(value.clone) || !isCallable(value.close)) { throwUnpolyfillable(type, TRANSFERRING); } + try { + transferred = value.clone(); + value.close(); + } catch (error$1) { /* empty */ } + break; + case 'ArrayBuffer': + case 'MessagePort': + case 'OffscreenCanvas': + case 'ReadableStream': + case 'TransformStream': + case 'WritableStream': + throwUnpolyfillable(type, TRANSFERRING); + } + + if (transferred === undefined) { throw new DOMException('This object cannot be transferred: ' + type, DATA_CLONE_ERROR); } + mapSet(map, value, transferred); + } } + }; + + _export({ global: true, enumerable: true, sham: !PROPER_TRANSFER, forced: FORCED_REPLACEMENT }, { + structuredClone: function structuredClone(value /* , { transfer } */) { + var options = validateArgumentsLength(arguments.length, 1) > 1 && arguments[1] != null ? anObject(arguments[1]) : undefined; + var transfer = options ? options.transfer : undefined; + var map; + + if (transfer !== undefined) { + map = new Map$1(); + tryToTransfer(transfer, map); + } + + return structuredCloneInternal(value, map); + } + }); + var MSIE = /MSIE .\./.test(engineUserAgent); // <- dirty ie9- check var Function$1 = global_1.Function; var wrap = function (scheduler) { - return function (handler, timeout /* , ...arguments */) { - var boundArgs = arguments.length > 2; + return MSIE ? function (handler, timeout /* , ...arguments */) { + var boundArgs = validateArgumentsLength(arguments.length, 1) > 2; + var fn = isCallable(handler) ? handler : Function$1(handler); var args = boundArgs ? arraySlice$1(arguments, 2) : undefined; return scheduler(boundArgs ? function () { - functionApply(isCallable(handler) ? handler : Function$1(handler), this, args); - } : handler, timeout); - }; + functionApply(fn, this, args); + } : fn, timeout); + } : scheduler; }; // ie9- setTimeout & setInterval additional parameters fix // https://html.spec.whatwg.org/multipage/timers-and-user-prompts.html#timers - _export({ global: true, bind: true, forced: MSIE }, { + var schedulersFix = { // `setTimeout` method // https://html.spec.whatwg.org/multipage/timers-and-user-prompts.html#dom-settimeout setTimeout: wrap(global_1.setTimeout), // `setInterval` method // https://html.spec.whatwg.org/multipage/timers-and-user-prompts.html#dom-setinterval setInterval: wrap(global_1.setInterval) + }; + + var setInterval = schedulersFix.setInterval; + + // ie9- setInterval additional parameters fix + // https://html.spec.whatwg.org/multipage/timers-and-user-prompts.html#dom-setinterval + _export({ global: true, bind: true, forced: global_1.setInterval !== setInterval }, { + setInterval: setInterval + }); + + var setTimeout$1 = schedulersFix.setTimeout; + + // ie9- setTimeout additional parameters fix + // https://html.spec.whatwg.org/multipage/timers-and-user-prompts.html#dom-settimeout + _export({ global: true, bind: true, forced: global_1.setTimeout !== setTimeout$1 }, { + setTimeout: setTimeout$1 }); var ITERATOR$1 = wellKnownSymbol('iterator'); var nativeUrl = !fails(function () { + // eslint-disable-next-line unicorn/relative-url-style -- required for testing var url = new URL('b?a=1&b=2&c=3', 'http://a'); var searchParams = url.searchParams; var result = ''; @@ -13703,7 +15634,6 @@ var doric = (function (exports) { // based on https://github.com/bestiejs/punycode.js/blob/master/punycode.js - var maxInt = 2147483647; // aka. 0x7FFFFFFF or 2^31-1 var base = 36; var tMin = 1; @@ -13718,7 +15648,7 @@ var doric = (function (exports) { var OVERFLOW_ERROR = 'Overflow: input needs wider integers to process'; var baseMinusTMin = base - tMin; - var RangeError = global_1.RangeError; + var $RangeError = RangeError; var exec$1 = functionUncurryThis(regexSeparators.exec); var floor$1 = Math.floor; var fromCharCode = String.fromCharCode; @@ -13777,8 +15707,9 @@ var doric = (function (exports) { var k = 0; delta = firstTime ? floor$1(delta / damp) : delta >> 1; delta += floor$1(delta / numPoints); - for (; delta > baseMinusTMin * tMax >> 1; k += base) { + while (delta > baseMinusTMin * tMax >> 1) { delta = floor$1(delta / baseMinusTMin); + k += base; } return floor$1(k + (baseMinusTMin + 1) * delta / (delta + skew)); }; @@ -13787,7 +15718,6 @@ var doric = (function (exports) { * Converts a string of Unicode symbols (e.g. a domain name label) to a * Punycode string of ASCII-only symbols. */ - // eslint-disable-next-line max-statements -- TODO var encode = function (input) { var output = []; @@ -13833,7 +15763,7 @@ var doric = (function (exports) { // Increase `delta` enough to advance the decoder's state to , but guard against overflow. var handledCPCountPlusOne = handledCPCount + 1; if (m - n > floor$1((maxInt - delta) / handledCPCountPlusOne)) { - throw RangeError(OVERFLOW_ERROR); + throw $RangeError(OVERFLOW_ERROR); } delta += (m - n) * handledCPCountPlusOne; @@ -13842,29 +15772,31 @@ var doric = (function (exports) { for (i = 0; i < input.length; i++) { currentValue = input[i]; if (currentValue < n && ++delta > maxInt) { - throw RangeError(OVERFLOW_ERROR); + throw $RangeError(OVERFLOW_ERROR); } if (currentValue == n) { // Represent delta as a generalized variable-length integer. var q = delta; - for (var k = base; /* no condition */; k += base) { + var k = base; + while (true) { var t = k <= bias ? tMin : (k >= bias + tMax ? tMax : k - bias); if (q < t) { break; } var qMinusT = q - t; var baseMinusT = base - t; push$2(output, fromCharCode(digitToBasic(t + qMinusT % baseMinusT))); q = floor$1(qMinusT / baseMinusT); + k += base; } push$2(output, fromCharCode(digitToBasic(q))); bias = adapt(delta, handledCPCountPlusOne, handledCPCount == basicLength); delta = 0; - ++handledCPCount; + handledCPCount++; } } - ++delta; - ++n; + delta++; + n++; } return join$2(output, ''); }; @@ -13906,6 +15838,7 @@ var doric = (function (exports) { + var ITERATOR = wellKnownSymbol('iterator'); @@ -13914,11 +15847,20 @@ var doric = (function (exports) { var setInternalState$1 = internalState.set; var getInternalParamsState = internalState.getterFor(URL_SEARCH_PARAMS); var getInternalIteratorState = internalState.getterFor(URL_SEARCH_PARAMS_ITERATOR); + // eslint-disable-next-line es-x/no-object-getownpropertydescriptor -- safe + var getOwnPropertyDescriptor = Object.getOwnPropertyDescriptor; - var n$Fetch = getBuiltIn('fetch'); - var N$Request = getBuiltIn('Request'); - var Headers = getBuiltIn('Headers'); - var RequestPrototype = N$Request && N$Request.prototype; + // Avoid NodeJS experimental warning + var safeGetBuiltIn = function (name) { + if (!descriptors) { return global_1[name]; } + var descriptor = getOwnPropertyDescriptor(global_1, name); + return descriptor && descriptor.value; + }; + + var nativeFetch = safeGetBuiltIn('fetch'); + var NativeRequest = safeGetBuiltIn('Request'); + var Headers = safeGetBuiltIn('Headers'); + var RequestPrototype = NativeRequest && NativeRequest.prototype; var HeadersPrototype = Headers && Headers.prototype; var RegExp$1 = global_1.RegExp; var TypeError$2 = global_1.TypeError; @@ -13980,33 +15922,6 @@ var doric = (function (exports) { return replace$1(encodeURIComponent$1(it), find, replacer); }; - var parseSearchParams = function (result, query) { - if (query) { - var attributes = split$1(query, '&'); - var index = 0; - var attribute, entry; - while (index < attributes.length) { - attribute = attributes[index++]; - if (attribute.length) { - entry = split$1(attribute, '='); - push$1(result, { - key: deserialize(shift$1(entry)), - value: deserialize(join$1(entry, '=')) - }); - } - } - } - }; - - var updateSearchParams = function (query) { - this.entries.length = 0; - parseSearchParams(this.entries, query); - }; - - var validateArgumentsLength = function (passed, required) { - if (passed < required) { throw TypeError$2('Not enough arguments'); } - }; - var URLSearchParamsIterator = createIteratorConstructor(function Iterator(params, kind) { setInternalState$1(this, { type: URL_SEARCH_PARAMS_ITERATOR, @@ -14021,53 +15936,92 @@ var doric = (function (exports) { if (!step.done) { step.value = kind === 'keys' ? entry.key : kind === 'values' ? entry.value : [entry.key, entry.value]; } return step; - }); + }, true); + + var URLSearchParamsState = function (init) { + this.entries = []; + this.url = null; + + if (init !== undefined) { + if (isObject(init)) { this.parseObject(init); } + else { this.parseQuery(typeof init == 'string' ? charAt$1(init, 0) === '?' ? stringSlice$1(init, 1) : init : toString_1(init)); } + } + }; + + URLSearchParamsState.prototype = { + type: URL_SEARCH_PARAMS, + bindURL: function (url) { + this.url = url; + this.update(); + }, + parseObject: function (object) { + var iteratorMethod = getIteratorMethod(object); + var iterator, next, step, entryIterator, entryNext, first, second; + + if (iteratorMethod) { + iterator = getIterator(object, iteratorMethod); + next = iterator.next; + while (!(step = functionCall(next, iterator)).done) { + entryIterator = getIterator(anObject(step.value)); + entryNext = entryIterator.next; + if ( + (first = functionCall(entryNext, entryIterator)).done || + (second = functionCall(entryNext, entryIterator)).done || + !functionCall(entryNext, entryIterator).done + ) { throw TypeError$2('Expected sequence with length 2'); } + push$1(this.entries, { key: toString_1(first.value), value: toString_1(second.value) }); + } + } else { for (var key in object) { if (hasOwnProperty_1(object, key)) { + push$1(this.entries, { key: key, value: toString_1(object[key]) }); + } } } + }, + parseQuery: function (query) { + if (query) { + var attributes = split$1(query, '&'); + var index = 0; + var attribute, entry; + while (index < attributes.length) { + attribute = attributes[index++]; + if (attribute.length) { + entry = split$1(attribute, '='); + push$1(this.entries, { + key: deserialize(shift$1(entry)), + value: deserialize(join$1(entry, '=')) + }); + } + } + } + }, + serialize: function () { + var entries = this.entries; + var result = []; + var index = 0; + var entry; + while (index < entries.length) { + entry = entries[index++]; + push$1(result, serialize(entry.key) + '=' + serialize(entry.value)); + } return join$1(result, '&'); + }, + update: function () { + this.entries.length = 0; + this.parseQuery(this.url.query); + }, + updateURL: function () { + if (this.url) { this.url.update(); } + } + }; // `URLSearchParams` constructor // https://url.spec.whatwg.org/#interface-urlsearchparams var URLSearchParamsConstructor = function URLSearchParams(/* init */) { anInstance(this, URLSearchParamsPrototype); var init = arguments.length > 0 ? arguments[0] : undefined; - var that = this; - var entries = []; - var iteratorMethod, iterator, next, step, entryIterator, entryNext, first, second, key; - - setInternalState$1(that, { - type: URL_SEARCH_PARAMS, - entries: entries, - updateURL: function () { /* empty */ }, - updateSearchParams: updateSearchParams - }); - - if (init !== undefined) { - if (isObject(init)) { - iteratorMethod = getIteratorMethod(init); - if (iteratorMethod) { - iterator = getIterator(init, iteratorMethod); - next = iterator.next; - while (!(step = functionCall(next, iterator)).done) { - entryIterator = getIterator(anObject(step.value)); - entryNext = entryIterator.next; - if ( - (first = functionCall(entryNext, entryIterator)).done || - (second = functionCall(entryNext, entryIterator)).done || - !functionCall(entryNext, entryIterator).done - ) { throw TypeError$2('Expected sequence with length 2'); } - push$1(entries, { key: toString_1(first.value), value: toString_1(second.value) }); - } - } else { for (key in init) { if (hasOwnProperty_1(init, key)) { push$1(entries, { key: key, value: toString_1(init[key]) }); } } } - } else { - parseSearchParams( - entries, - typeof init == 'string' ? charAt$1(init, 0) === '?' ? stringSlice$1(init, 1) : init : toString_1(init) - ); - } - } + setInternalState$1(this, new URLSearchParamsState(init)); }; var URLSearchParamsPrototype = URLSearchParamsConstructor.prototype; - redefineAll(URLSearchParamsPrototype, { + defineBuiltIns(URLSearchParamsPrototype, { // `URLSearchParams.prototype.append` method // https://url.spec.whatwg.org/#dom-urlsearchparams-append append: function append(name, value) { @@ -14186,24 +16140,17 @@ var doric = (function (exports) { }, { enumerable: true }); // `URLSearchParams.prototype[@@iterator]` method - redefine(URLSearchParamsPrototype, ITERATOR, URLSearchParamsPrototype.entries, { name: 'entries' }); + defineBuiltIn(URLSearchParamsPrototype, ITERATOR, URLSearchParamsPrototype.entries, { name: 'entries' }); // `URLSearchParams.prototype.toString` method // https://url.spec.whatwg.org/#urlsearchparams-stringification-behavior - redefine(URLSearchParamsPrototype, 'toString', function toString() { - var entries = getInternalParamsState(this).entries; - var result = []; - var index = 0; - var entry; - while (index < entries.length) { - entry = entries[index++]; - push$1(result, serialize(entry.key) + '=' + serialize(entry.value)); - } return join$1(result, '&'); + defineBuiltIn(URLSearchParamsPrototype, 'toString', function toString() { + return getInternalParamsState(this).serialize(); }, { enumerable: true }); setToStringTag(URLSearchParamsConstructor, URL_SEARCH_PARAMS); - _export({ global: true, forced: !nativeUrl }, { + _export({ global: true, constructor: true, forced: !nativeUrl }, { URLSearchParams: URLSearchParamsConstructor }); @@ -14229,30 +16176,30 @@ var doric = (function (exports) { } return init; }; - if (isCallable(n$Fetch)) { - _export({ global: true, enumerable: true, forced: true }, { + if (isCallable(nativeFetch)) { + _export({ global: true, enumerable: true, dontCallGetSet: true, forced: true }, { fetch: function fetch(input /* , init */) { - return n$Fetch(input, arguments.length > 1 ? wrapRequestOptions(arguments[1]) : {}); + return nativeFetch(input, arguments.length > 1 ? wrapRequestOptions(arguments[1]) : {}); } }); } - if (isCallable(N$Request)) { + if (isCallable(NativeRequest)) { var RequestConstructor = function Request(input /* , init */) { anInstance(this, RequestPrototype); - return new N$Request(input, arguments.length > 1 ? wrapRequestOptions(arguments[1]) : {}); + return new NativeRequest(input, arguments.length > 1 ? wrapRequestOptions(arguments[1]) : {}); }; RequestPrototype.constructor = RequestConstructor; RequestConstructor.prototype = RequestPrototype; - _export({ global: true, forced: true }, { + _export({ global: true, constructor: true, dontCallGetSet: true, forced: true }, { Request: RequestConstructor }); } } - var web_urlSearchParams = { + var web_urlSearchParams_constructor = { URLSearchParams: URLSearchParamsConstructor, getState: getInternalParamsState }; @@ -14272,7 +16219,6 @@ var doric = (function (exports) { - var codeAt = stringMultibyte.codeAt; @@ -14280,10 +16226,11 @@ var doric = (function (exports) { + var setInternalState = internalState.set; var getInternalURLState = internalState.getterFor('URL'); - var URLSearchParams$1 = web_urlSearchParams.URLSearchParams; - var getInternalSearchParamsState = web_urlSearchParams.getState; + var URLSearchParams$1 = web_urlSearchParams_constructor.URLSearchParams; + var getInternalSearchParamsState = web_urlSearchParams_constructor.getState; var NativeURL = global_1.URL; var TypeError$1 = global_1.TypeError; @@ -14324,31 +16271,7 @@ var doric = (function (exports) { /* eslint-enable regexp/no-control-character -- safe */ var EOF; - var parseHost = function (url, input) { - var result, codePoints, index; - if (charAt(input, 0) == '[') { - if (charAt(input, input.length - 1) != ']') { return INVALID_HOST; } - result = parseIPv6(stringSlice(input, 1, -1)); - if (!result) { return INVALID_HOST; } - url.host = result; - // opaque host - } else if (!isSpecial(url)) { - if (exec(FORBIDDEN_HOST_CODE_POINT_EXCLUDING_PERCENT, input)) { return INVALID_HOST; } - result = ''; - codePoints = arrayFrom(input); - for (index = 0; index < codePoints.length; index++) { - result += percentEncode(codePoints[index], C0ControlPercentEncodeSet); - } - url.host = result; - } else { - input = stringPunycodeToAscii(input); - if (exec(FORBIDDEN_HOST_CODE_POINT, input)) { return INVALID_HOST; } - result = parseIPv4(input); - if (result === null) { return INVALID_HOST; } - url.host = result; - } - }; - + // https://url.spec.whatwg.org/#ipv4-number-parser var parseIPv4 = function (input) { var parts = split(input, '.'); var partsLength, numbers, index, part, radix, number, ipv4; @@ -14387,6 +16310,7 @@ var doric = (function (exports) { return ipv4; }; + // https://url.spec.whatwg.org/#concept-ipv6-parser // eslint-disable-next-line max-statements -- TODO var parseIPv6 = function (input) { var address = [0, 0, 0, 0, 0, 0, 0, 0]; @@ -14490,6 +16414,7 @@ var doric = (function (exports) { return maxIndex; }; + // https://url.spec.whatwg.org/#host-serializing var serializeHost = function (host) { var result, index, compress, ignore0; // ipv4 @@ -14534,6 +16459,7 @@ var doric = (function (exports) { return code > 0x20 && code < 0x7F && !hasOwnProperty_1(set, chr) ? chr : encodeURIComponent(chr); }; + // https://url.spec.whatwg.org/#special-scheme var specialSchemes = { ftp: 21, file: null, @@ -14543,24 +16469,14 @@ var doric = (function (exports) { wss: 443 }; - var isSpecial = function (url) { - return hasOwnProperty_1(specialSchemes, url.scheme); - }; - - var includesCredentials = function (url) { - return url.username != '' || url.password != ''; - }; - - var cannotHaveUsernamePasswordPort = function (url) { - return !url.host || url.cannotBeABaseURL || url.scheme == 'file'; - }; - + // https://url.spec.whatwg.org/#windows-drive-letter var isWindowsDriveLetter = function (string, normalized) { var second; return string.length == 2 && exec(ALPHA, charAt(string, 0)) && ((second = charAt(string, 1)) == ':' || (!normalized && second == '|')); }; + // https://url.spec.whatwg.org/#start-with-a-windows-drive-letter var startsWithWindowsDriveLetter = function (string) { var third; return string.length > 1 && isWindowsDriveLetter(stringSlice(string, 0, 2)) && ( @@ -14569,18 +16485,12 @@ var doric = (function (exports) { ); }; - var shortenURLsPath = function (url) { - var path = url.path; - var pathSize = path.length; - if (pathSize && (url.scheme != 'file' || pathSize != 1 || !isWindowsDriveLetter(path[0], true))) { - path.length--; - } - }; - + // https://url.spec.whatwg.org/#single-dot-path-segment var isSingleDot = function (segment) { return segment === '.' || toLowerCase(segment) === '%2e'; }; + // https://url.spec.whatwg.org/#double-dot-path-segment var isDoubleDot = function (segment) { segment = toLowerCase(segment); return segment === '..' || segment === '%2e.' || segment === '.%2e' || segment === '%2e%2e'; @@ -14609,402 +16519,625 @@ var doric = (function (exports) { var QUERY = {}; var FRAGMENT = {}; - // eslint-disable-next-line max-statements -- TODO - var parseURL = function (url, input, stateOverride, base) { - var state = stateOverride || SCHEME_START; - var pointer = 0; - var buffer = ''; - var seenAt = false; - var seenBracket = false; - var seenPasswordToken = false; - var codePoints, chr, bufferCodePoints, failure; - - if (!stateOverride) { - url.scheme = ''; - url.username = ''; - url.password = ''; - url.host = null; - url.port = null; - url.path = []; - url.query = null; - url.fragment = null; - url.cannotBeABaseURL = false; - input = replace(input, LEADING_AND_TRAILING_C0_CONTROL_OR_SPACE, ''); + var URLState = function (url, isBase, base) { + var urlString = toString_1(url); + var baseState, failure, searchParams; + if (isBase) { + failure = this.parse(urlString); + if (failure) { throw TypeError$1(failure); } + this.searchParams = null; + } else { + if (base !== undefined) { baseState = new URLState(base, true); } + failure = this.parse(urlString, null, baseState); + if (failure) { throw TypeError$1(failure); } + searchParams = getInternalSearchParamsState(new URLSearchParams$1()); + searchParams.bindURL(this); + this.searchParams = searchParams; } + }; - input = replace(input, TAB_AND_NEW_LINE, ''); + URLState.prototype = { + type: 'URL', + // https://url.spec.whatwg.org/#url-parsing + // eslint-disable-next-line max-statements -- TODO + parse: function (input, stateOverride, base) { + var url = this; + var state = stateOverride || SCHEME_START; + var pointer = 0; + var buffer = ''; + var seenAt = false; + var seenBracket = false; + var seenPasswordToken = false; + var codePoints, chr, bufferCodePoints, failure; - codePoints = arrayFrom(input); + input = toString_1(input); - while (pointer <= codePoints.length) { - chr = codePoints[pointer]; - switch (state) { - case SCHEME_START: - if (chr && exec(ALPHA, chr)) { - buffer += toLowerCase(chr); - state = SCHEME; - } else if (!stateOverride) { - state = NO_SCHEME; - continue; - } else { return INVALID_SCHEME; } - break; + if (!stateOverride) { + url.scheme = ''; + url.username = ''; + url.password = ''; + url.host = null; + url.port = null; + url.path = []; + url.query = null; + url.fragment = null; + url.cannotBeABaseURL = false; + input = replace(input, LEADING_AND_TRAILING_C0_CONTROL_OR_SPACE, ''); + } - case SCHEME: - if (chr && (exec(ALPHANUMERIC, chr) || chr == '+' || chr == '-' || chr == '.')) { - buffer += toLowerCase(chr); - } else if (chr == ':') { - if (stateOverride && ( - (isSpecial(url) != hasOwnProperty_1(specialSchemes, buffer)) || - (buffer == 'file' && (includesCredentials(url) || url.port !== null)) || - (url.scheme == 'file' && !url.host) - )) { return; } - url.scheme = buffer; - if (stateOverride) { - if (isSpecial(url) && specialSchemes[url.scheme] == url.port) { url.port = null; } - return; + input = replace(input, TAB_AND_NEW_LINE, ''); + + codePoints = arrayFrom(input); + + while (pointer <= codePoints.length) { + chr = codePoints[pointer]; + switch (state) { + case SCHEME_START: + if (chr && exec(ALPHA, chr)) { + buffer += toLowerCase(chr); + state = SCHEME; + } else if (!stateOverride) { + state = NO_SCHEME; + continue; + } else { return INVALID_SCHEME; } + break; + + case SCHEME: + if (chr && (exec(ALPHANUMERIC, chr) || chr == '+' || chr == '-' || chr == '.')) { + buffer += toLowerCase(chr); + } else if (chr == ':') { + if (stateOverride && ( + (url.isSpecial() != hasOwnProperty_1(specialSchemes, buffer)) || + (buffer == 'file' && (url.includesCredentials() || url.port !== null)) || + (url.scheme == 'file' && !url.host) + )) { return; } + url.scheme = buffer; + if (stateOverride) { + if (url.isSpecial() && specialSchemes[url.scheme] == url.port) { url.port = null; } + return; + } + buffer = ''; + if (url.scheme == 'file') { + state = FILE; + } else if (url.isSpecial() && base && base.scheme == url.scheme) { + state = SPECIAL_RELATIVE_OR_AUTHORITY; + } else if (url.isSpecial()) { + state = SPECIAL_AUTHORITY_SLASHES; + } else if (codePoints[pointer + 1] == '/') { + state = PATH_OR_AUTHORITY; + pointer++; + } else { + url.cannotBeABaseURL = true; + push(url.path, ''); + state = CANNOT_BE_A_BASE_URL_PATH; + } + } else if (!stateOverride) { + buffer = ''; + state = NO_SCHEME; + pointer = 0; + continue; + } else { return INVALID_SCHEME; } + break; + + case NO_SCHEME: + if (!base || (base.cannotBeABaseURL && chr != '#')) { return INVALID_SCHEME; } + if (base.cannotBeABaseURL && chr == '#') { + url.scheme = base.scheme; + url.path = arraySliceSimple(base.path); + url.query = base.query; + url.fragment = ''; + url.cannotBeABaseURL = true; + state = FRAGMENT; + break; } - buffer = ''; - if (url.scheme == 'file') { - state = FILE; - } else if (isSpecial(url) && base && base.scheme == url.scheme) { - state = SPECIAL_RELATIVE_OR_AUTHORITY; - } else if (isSpecial(url)) { - state = SPECIAL_AUTHORITY_SLASHES; - } else if (codePoints[pointer + 1] == '/') { - state = PATH_OR_AUTHORITY; + state = base.scheme == 'file' ? FILE : RELATIVE; + continue; + + case SPECIAL_RELATIVE_OR_AUTHORITY: + if (chr == '/' && codePoints[pointer + 1] == '/') { + state = SPECIAL_AUTHORITY_IGNORE_SLASHES; pointer++; } else { - url.cannotBeABaseURL = true; - push(url.path, ''); - state = CANNOT_BE_A_BASE_URL_PATH; - } - } else if (!stateOverride) { - buffer = ''; - state = NO_SCHEME; - pointer = 0; - continue; - } else { return INVALID_SCHEME; } - break; + state = RELATIVE; + continue; + } break; - case NO_SCHEME: - if (!base || (base.cannotBeABaseURL && chr != '#')) { return INVALID_SCHEME; } - if (base.cannotBeABaseURL && chr == '#') { + case PATH_OR_AUTHORITY: + if (chr == '/') { + state = AUTHORITY; + break; + } else { + state = PATH; + continue; + } + + case RELATIVE: url.scheme = base.scheme; - url.path = arraySlice$1(base.path); - url.query = base.query; - url.fragment = ''; - url.cannotBeABaseURL = true; - state = FRAGMENT; - break; - } - state = base.scheme == 'file' ? FILE : RELATIVE; - continue; - - case SPECIAL_RELATIVE_OR_AUTHORITY: - if (chr == '/' && codePoints[pointer + 1] == '/') { - state = SPECIAL_AUTHORITY_IGNORE_SLASHES; - pointer++; - } else { - state = RELATIVE; - continue; - } break; - - case PATH_OR_AUTHORITY: - if (chr == '/') { - state = AUTHORITY; - break; - } else { - state = PATH; - continue; - } - - case RELATIVE: - url.scheme = base.scheme; - if (chr == EOF) { - url.username = base.username; - url.password = base.password; - url.host = base.host; - url.port = base.port; - url.path = arraySlice$1(base.path); - url.query = base.query; - } else if (chr == '/' || (chr == '\\' && isSpecial(url))) { - state = RELATIVE_SLASH; - } else if (chr == '?') { - url.username = base.username; - url.password = base.password; - url.host = base.host; - url.port = base.port; - url.path = arraySlice$1(base.path); - url.query = ''; - state = QUERY; - } else if (chr == '#') { - url.username = base.username; - url.password = base.password; - url.host = base.host; - url.port = base.port; - url.path = arraySlice$1(base.path); - url.query = base.query; - url.fragment = ''; - state = FRAGMENT; - } else { - url.username = base.username; - url.password = base.password; - url.host = base.host; - url.port = base.port; - url.path = arraySlice$1(base.path); - url.path.length--; - state = PATH; - continue; - } break; - - case RELATIVE_SLASH: - if (isSpecial(url) && (chr == '/' || chr == '\\')) { - state = SPECIAL_AUTHORITY_IGNORE_SLASHES; - } else if (chr == '/') { - state = AUTHORITY; - } else { - url.username = base.username; - url.password = base.password; - url.host = base.host; - url.port = base.port; - state = PATH; - continue; - } break; - - case SPECIAL_AUTHORITY_SLASHES: - state = SPECIAL_AUTHORITY_IGNORE_SLASHES; - if (chr != '/' || charAt(buffer, pointer + 1) != '/') { continue; } - pointer++; - break; - - case SPECIAL_AUTHORITY_IGNORE_SLASHES: - if (chr != '/' && chr != '\\') { - state = AUTHORITY; - continue; - } break; - - case AUTHORITY: - if (chr == '@') { - if (seenAt) { buffer = '%40' + buffer; } - seenAt = true; - bufferCodePoints = arrayFrom(buffer); - for (var i = 0; i < bufferCodePoints.length; i++) { - var codePoint = bufferCodePoints[i]; - if (codePoint == ':' && !seenPasswordToken) { - seenPasswordToken = true; - continue; - } - var encodedCodePoints = percentEncode(codePoint, userinfoPercentEncodeSet); - if (seenPasswordToken) { url.password += encodedCodePoints; } - else { url.username += encodedCodePoints; } - } - buffer = ''; - } else if ( - chr == EOF || chr == '/' || chr == '?' || chr == '#' || - (chr == '\\' && isSpecial(url)) - ) { - if (seenAt && buffer == '') { return INVALID_AUTHORITY; } - pointer -= arrayFrom(buffer).length + 1; - buffer = ''; - state = HOST; - } else { buffer += chr; } - break; - - case HOST: - case HOSTNAME: - if (stateOverride && url.scheme == 'file') { - state = FILE_HOST; - continue; - } else if (chr == ':' && !seenBracket) { - if (buffer == '') { return INVALID_HOST; } - failure = parseHost(url, buffer); - if (failure) { return failure; } - buffer = ''; - state = PORT; - if (stateOverride == HOSTNAME) { return; } - } else if ( - chr == EOF || chr == '/' || chr == '?' || chr == '#' || - (chr == '\\' && isSpecial(url)) - ) { - if (isSpecial(url) && buffer == '') { return INVALID_HOST; } - if (stateOverride && buffer == '' && (includesCredentials(url) || url.port !== null)) { return; } - failure = parseHost(url, buffer); - if (failure) { return failure; } - buffer = ''; - state = PATH_START; - if (stateOverride) { return; } - continue; - } else { - if (chr == '[') { seenBracket = true; } - else if (chr == ']') { seenBracket = false; } - buffer += chr; - } break; - - case PORT: - if (exec(DIGIT, chr)) { - buffer += chr; - } else if ( - chr == EOF || chr == '/' || chr == '?' || chr == '#' || - (chr == '\\' && isSpecial(url)) || - stateOverride - ) { - if (buffer != '') { - var port = parseInt$1(buffer, 10); - if (port > 0xFFFF) { return INVALID_PORT; } - url.port = (isSpecial(url) && port === specialSchemes[url.scheme]) ? null : port; - buffer = ''; - } - if (stateOverride) { return; } - state = PATH_START; - continue; - } else { return INVALID_PORT; } - break; - - case FILE: - url.scheme = 'file'; - if (chr == '/' || chr == '\\') { state = FILE_SLASH; } - else if (base && base.scheme == 'file') { if (chr == EOF) { + url.username = base.username; + url.password = base.password; url.host = base.host; - url.path = arraySlice$1(base.path); + url.port = base.port; + url.path = arraySliceSimple(base.path); url.query = base.query; + } else if (chr == '/' || (chr == '\\' && url.isSpecial())) { + state = RELATIVE_SLASH; } else if (chr == '?') { + url.username = base.username; + url.password = base.password; url.host = base.host; - url.path = arraySlice$1(base.path); + url.port = base.port; + url.path = arraySliceSimple(base.path); url.query = ''; state = QUERY; } else if (chr == '#') { + url.username = base.username; + url.password = base.password; url.host = base.host; - url.path = arraySlice$1(base.path); + url.port = base.port; + url.path = arraySliceSimple(base.path); url.query = base.query; url.fragment = ''; state = FRAGMENT; } else { - if (!startsWithWindowsDriveLetter(join(arraySlice$1(codePoints, pointer), ''))) { - url.host = base.host; - url.path = arraySlice$1(base.path); - shortenURLsPath(url); - } + url.username = base.username; + url.password = base.password; + url.host = base.host; + url.port = base.port; + url.path = arraySliceSimple(base.path); + url.path.length--; state = PATH; continue; - } - } else { - state = PATH; - continue; - } break; + } break; - case FILE_SLASH: - if (chr == '/' || chr == '\\') { - state = FILE_HOST; - break; - } - if (base && base.scheme == 'file' && !startsWithWindowsDriveLetter(join(arraySlice$1(codePoints, pointer), ''))) { - if (isWindowsDriveLetter(base.path[0], true)) { push(url.path, base.path[0]); } - else { url.host = base.host; } - } - state = PATH; - continue; - - case FILE_HOST: - if (chr == EOF || chr == '/' || chr == '\\' || chr == '?' || chr == '#') { - if (!stateOverride && isWindowsDriveLetter(buffer)) { - state = PATH; - } else if (buffer == '') { - url.host = ''; - if (stateOverride) { return; } - state = PATH_START; + case RELATIVE_SLASH: + if (url.isSpecial() && (chr == '/' || chr == '\\')) { + state = SPECIAL_AUTHORITY_IGNORE_SLASHES; + } else if (chr == '/') { + state = AUTHORITY; } else { - failure = parseHost(url, buffer); + url.username = base.username; + url.password = base.password; + url.host = base.host; + url.port = base.port; + state = PATH; + continue; + } break; + + case SPECIAL_AUTHORITY_SLASHES: + state = SPECIAL_AUTHORITY_IGNORE_SLASHES; + if (chr != '/' || charAt(buffer, pointer + 1) != '/') { continue; } + pointer++; + break; + + case SPECIAL_AUTHORITY_IGNORE_SLASHES: + if (chr != '/' && chr != '\\') { + state = AUTHORITY; + continue; + } break; + + case AUTHORITY: + if (chr == '@') { + if (seenAt) { buffer = '%40' + buffer; } + seenAt = true; + bufferCodePoints = arrayFrom(buffer); + for (var i = 0; i < bufferCodePoints.length; i++) { + var codePoint = bufferCodePoints[i]; + if (codePoint == ':' && !seenPasswordToken) { + seenPasswordToken = true; + continue; + } + var encodedCodePoints = percentEncode(codePoint, userinfoPercentEncodeSet); + if (seenPasswordToken) { url.password += encodedCodePoints; } + else { url.username += encodedCodePoints; } + } + buffer = ''; + } else if ( + chr == EOF || chr == '/' || chr == '?' || chr == '#' || + (chr == '\\' && url.isSpecial()) + ) { + if (seenAt && buffer == '') { return INVALID_AUTHORITY; } + pointer -= arrayFrom(buffer).length + 1; + buffer = ''; + state = HOST; + } else { buffer += chr; } + break; + + case HOST: + case HOSTNAME: + if (stateOverride && url.scheme == 'file') { + state = FILE_HOST; + continue; + } else if (chr == ':' && !seenBracket) { + if (buffer == '') { return INVALID_HOST; } + failure = url.parseHost(buffer); + if (failure) { return failure; } + buffer = ''; + state = PORT; + if (stateOverride == HOSTNAME) { return; } + } else if ( + chr == EOF || chr == '/' || chr == '?' || chr == '#' || + (chr == '\\' && url.isSpecial()) + ) { + if (url.isSpecial() && buffer == '') { return INVALID_HOST; } + if (stateOverride && buffer == '' && (url.includesCredentials() || url.port !== null)) { return; } + failure = url.parseHost(buffer); if (failure) { return failure; } - if (url.host == 'localhost') { url.host = ''; } - if (stateOverride) { return; } buffer = ''; state = PATH_START; - } continue; - } else { buffer += chr; } - break; + if (stateOverride) { return; } + continue; + } else { + if (chr == '[') { seenBracket = true; } + else if (chr == ']') { seenBracket = false; } + buffer += chr; + } break; - case PATH_START: - if (isSpecial(url)) { - state = PATH; - if (chr != '/' && chr != '\\') { continue; } - } else if (!stateOverride && chr == '?') { - url.query = ''; - state = QUERY; - } else if (!stateOverride && chr == '#') { - url.fragment = ''; - state = FRAGMENT; - } else if (chr != EOF) { - state = PATH; - if (chr != '/') { continue; } - } break; - - case PATH: - if ( - chr == EOF || chr == '/' || - (chr == '\\' && isSpecial(url)) || - (!stateOverride && (chr == '?' || chr == '#')) - ) { - if (isDoubleDot(buffer)) { - shortenURLsPath(url); - if (chr != '/' && !(chr == '\\' && isSpecial(url))) { - push(url.path, ''); + case PORT: + if (exec(DIGIT, chr)) { + buffer += chr; + } else if ( + chr == EOF || chr == '/' || chr == '?' || chr == '#' || + (chr == '\\' && url.isSpecial()) || + stateOverride + ) { + if (buffer != '') { + var port = parseInt$1(buffer, 10); + if (port > 0xFFFF) { return INVALID_PORT; } + url.port = (url.isSpecial() && port === specialSchemes[url.scheme]) ? null : port; + buffer = ''; } - } else if (isSingleDot(buffer)) { - if (chr != '/' && !(chr == '\\' && isSpecial(url))) { - push(url.path, ''); + if (stateOverride) { return; } + state = PATH_START; + continue; + } else { return INVALID_PORT; } + break; + + case FILE: + url.scheme = 'file'; + if (chr == '/' || chr == '\\') { state = FILE_SLASH; } + else if (base && base.scheme == 'file') { + if (chr == EOF) { + url.host = base.host; + url.path = arraySliceSimple(base.path); + url.query = base.query; + } else if (chr == '?') { + url.host = base.host; + url.path = arraySliceSimple(base.path); + url.query = ''; + state = QUERY; + } else if (chr == '#') { + url.host = base.host; + url.path = arraySliceSimple(base.path); + url.query = base.query; + url.fragment = ''; + state = FRAGMENT; + } else { + if (!startsWithWindowsDriveLetter(join(arraySliceSimple(codePoints, pointer), ''))) { + url.host = base.host; + url.path = arraySliceSimple(base.path); + url.shortenPath(); + } + state = PATH; + continue; } } else { - if (url.scheme == 'file' && !url.path.length && isWindowsDriveLetter(buffer)) { - if (url.host) { url.host = ''; } - buffer = charAt(buffer, 0) + ':'; // normalize windows drive letter - } - push(url.path, buffer); + state = PATH; + continue; + } break; + + case FILE_SLASH: + if (chr == '/' || chr == '\\') { + state = FILE_HOST; + break; } - buffer = ''; - if (url.scheme == 'file' && (chr == EOF || chr == '?' || chr == '#')) { - while (url.path.length > 1 && url.path[0] === '') { - shift(url.path); - } + if (base && base.scheme == 'file' && !startsWithWindowsDriveLetter(join(arraySliceSimple(codePoints, pointer), ''))) { + if (isWindowsDriveLetter(base.path[0], true)) { push(url.path, base.path[0]); } + else { url.host = base.host; } } + state = PATH; + continue; + + case FILE_HOST: + if (chr == EOF || chr == '/' || chr == '\\' || chr == '?' || chr == '#') { + if (!stateOverride && isWindowsDriveLetter(buffer)) { + state = PATH; + } else if (buffer == '') { + url.host = ''; + if (stateOverride) { return; } + state = PATH_START; + } else { + failure = url.parseHost(buffer); + if (failure) { return failure; } + if (url.host == 'localhost') { url.host = ''; } + if (stateOverride) { return; } + buffer = ''; + state = PATH_START; + } continue; + } else { buffer += chr; } + break; + + case PATH_START: + if (url.isSpecial()) { + state = PATH; + if (chr != '/' && chr != '\\') { continue; } + } else if (!stateOverride && chr == '?') { + url.query = ''; + state = QUERY; + } else if (!stateOverride && chr == '#') { + url.fragment = ''; + state = FRAGMENT; + } else if (chr != EOF) { + state = PATH; + if (chr != '/') { continue; } + } break; + + case PATH: + if ( + chr == EOF || chr == '/' || + (chr == '\\' && url.isSpecial()) || + (!stateOverride && (chr == '?' || chr == '#')) + ) { + if (isDoubleDot(buffer)) { + url.shortenPath(); + if (chr != '/' && !(chr == '\\' && url.isSpecial())) { + push(url.path, ''); + } + } else if (isSingleDot(buffer)) { + if (chr != '/' && !(chr == '\\' && url.isSpecial())) { + push(url.path, ''); + } + } else { + if (url.scheme == 'file' && !url.path.length && isWindowsDriveLetter(buffer)) { + if (url.host) { url.host = ''; } + buffer = charAt(buffer, 0) + ':'; // normalize windows drive letter + } + push(url.path, buffer); + } + buffer = ''; + if (url.scheme == 'file' && (chr == EOF || chr == '?' || chr == '#')) { + while (url.path.length > 1 && url.path[0] === '') { + shift(url.path); + } + } + if (chr == '?') { + url.query = ''; + state = QUERY; + } else if (chr == '#') { + url.fragment = ''; + state = FRAGMENT; + } + } else { + buffer += percentEncode(chr, pathPercentEncodeSet); + } break; + + case CANNOT_BE_A_BASE_URL_PATH: if (chr == '?') { url.query = ''; state = QUERY; } else if (chr == '#') { url.fragment = ''; state = FRAGMENT; - } - } else { - buffer += percentEncode(chr, pathPercentEncodeSet); - } break; + } else if (chr != EOF) { + url.path[0] += percentEncode(chr, C0ControlPercentEncodeSet); + } break; - case CANNOT_BE_A_BASE_URL_PATH: - if (chr == '?') { - url.query = ''; - state = QUERY; - } else if (chr == '#') { - url.fragment = ''; - state = FRAGMENT; - } else if (chr != EOF) { - url.path[0] += percentEncode(chr, C0ControlPercentEncodeSet); - } break; + case QUERY: + if (!stateOverride && chr == '#') { + url.fragment = ''; + state = FRAGMENT; + } else if (chr != EOF) { + if (chr == "'" && url.isSpecial()) { url.query += '%27'; } + else if (chr == '#') { url.query += '%23'; } + else { url.query += percentEncode(chr, C0ControlPercentEncodeSet); } + } break; - case QUERY: - if (!stateOverride && chr == '#') { - url.fragment = ''; - state = FRAGMENT; - } else if (chr != EOF) { - if (chr == "'" && isSpecial(url)) { url.query += '%27'; } - else if (chr == '#') { url.query += '%23'; } - else { url.query += percentEncode(chr, C0ControlPercentEncodeSet); } - } break; + case FRAGMENT: + if (chr != EOF) { url.fragment += percentEncode(chr, fragmentPercentEncodeSet); } + break; + } - case FRAGMENT: - if (chr != EOF) { url.fragment += percentEncode(chr, fragmentPercentEncodeSet); } - break; + pointer++; } - - pointer++; + }, + // https://url.spec.whatwg.org/#host-parsing + parseHost: function (input) { + var result, codePoints, index; + if (charAt(input, 0) == '[') { + if (charAt(input, input.length - 1) != ']') { return INVALID_HOST; } + result = parseIPv6(stringSlice(input, 1, -1)); + if (!result) { return INVALID_HOST; } + this.host = result; + // opaque host + } else if (!this.isSpecial()) { + if (exec(FORBIDDEN_HOST_CODE_POINT_EXCLUDING_PERCENT, input)) { return INVALID_HOST; } + result = ''; + codePoints = arrayFrom(input); + for (index = 0; index < codePoints.length; index++) { + result += percentEncode(codePoints[index], C0ControlPercentEncodeSet); + } + this.host = result; + } else { + input = stringPunycodeToAscii(input); + if (exec(FORBIDDEN_HOST_CODE_POINT, input)) { return INVALID_HOST; } + result = parseIPv4(input); + if (result === null) { return INVALID_HOST; } + this.host = result; + } + }, + // https://url.spec.whatwg.org/#cannot-have-a-username-password-port + cannotHaveUsernamePasswordPort: function () { + return !this.host || this.cannotBeABaseURL || this.scheme == 'file'; + }, + // https://url.spec.whatwg.org/#include-credentials + includesCredentials: function () { + return this.username != '' || this.password != ''; + }, + // https://url.spec.whatwg.org/#is-special + isSpecial: function () { + return hasOwnProperty_1(specialSchemes, this.scheme); + }, + // https://url.spec.whatwg.org/#shorten-a-urls-path + shortenPath: function () { + var path = this.path; + var pathSize = path.length; + if (pathSize && (this.scheme != 'file' || pathSize != 1 || !isWindowsDriveLetter(path[0], true))) { + path.length--; + } + }, + // https://url.spec.whatwg.org/#concept-url-serializer + serialize: function () { + var url = this; + var scheme = url.scheme; + var username = url.username; + var password = url.password; + var host = url.host; + var port = url.port; + var path = url.path; + var query = url.query; + var fragment = url.fragment; + var output = scheme + ':'; + if (host !== null) { + output += '//'; + if (url.includesCredentials()) { + output += username + (password ? ':' + password : '') + '@'; + } + output += serializeHost(host); + if (port !== null) { output += ':' + port; } + } else if (scheme == 'file') { output += '//'; } + output += url.cannotBeABaseURL ? path[0] : path.length ? '/' + join(path, '/') : ''; + if (query !== null) { output += '?' + query; } + if (fragment !== null) { output += '#' + fragment; } + return output; + }, + // https://url.spec.whatwg.org/#dom-url-href + setHref: function (href) { + var failure = this.parse(href); + if (failure) { throw TypeError$1(failure); } + this.searchParams.update(); + }, + // https://url.spec.whatwg.org/#dom-url-origin + getOrigin: function () { + var scheme = this.scheme; + var port = this.port; + if (scheme == 'blob') { try { + return new URLConstructor(scheme.path[0]).origin; + } catch (error) { + return 'null'; + } } + if (scheme == 'file' || !this.isSpecial()) { return 'null'; } + return scheme + '://' + serializeHost(this.host) + (port !== null ? ':' + port : ''); + }, + // https://url.spec.whatwg.org/#dom-url-protocol + getProtocol: function () { + return this.scheme + ':'; + }, + setProtocol: function (protocol) { + this.parse(toString_1(protocol) + ':', SCHEME_START); + }, + // https://url.spec.whatwg.org/#dom-url-username + getUsername: function () { + return this.username; + }, + setUsername: function (username) { + var codePoints = arrayFrom(toString_1(username)); + if (this.cannotHaveUsernamePasswordPort()) { return; } + this.username = ''; + for (var i = 0; i < codePoints.length; i++) { + this.username += percentEncode(codePoints[i], userinfoPercentEncodeSet); + } + }, + // https://url.spec.whatwg.org/#dom-url-password + getPassword: function () { + return this.password; + }, + setPassword: function (password) { + var codePoints = arrayFrom(toString_1(password)); + if (this.cannotHaveUsernamePasswordPort()) { return; } + this.password = ''; + for (var i = 0; i < codePoints.length; i++) { + this.password += percentEncode(codePoints[i], userinfoPercentEncodeSet); + } + }, + // https://url.spec.whatwg.org/#dom-url-host + getHost: function () { + var host = this.host; + var port = this.port; + return host === null ? '' + : port === null ? serializeHost(host) + : serializeHost(host) + ':' + port; + }, + setHost: function (host) { + if (this.cannotBeABaseURL) { return; } + this.parse(host, HOST); + }, + // https://url.spec.whatwg.org/#dom-url-hostname + getHostname: function () { + var host = this.host; + return host === null ? '' : serializeHost(host); + }, + setHostname: function (hostname) { + if (this.cannotBeABaseURL) { return; } + this.parse(hostname, HOSTNAME); + }, + // https://url.spec.whatwg.org/#dom-url-port + getPort: function () { + var port = this.port; + return port === null ? '' : toString_1(port); + }, + setPort: function (port) { + if (this.cannotHaveUsernamePasswordPort()) { return; } + port = toString_1(port); + if (port == '') { this.port = null; } + else { this.parse(port, PORT); } + }, + // https://url.spec.whatwg.org/#dom-url-pathname + getPathname: function () { + var path = this.path; + return this.cannotBeABaseURL ? path[0] : path.length ? '/' + join(path, '/') : ''; + }, + setPathname: function (pathname) { + if (this.cannotBeABaseURL) { return; } + this.path = []; + this.parse(pathname, PATH_START); + }, + // https://url.spec.whatwg.org/#dom-url-search + getSearch: function () { + var query = this.query; + return query ? '?' + query : ''; + }, + setSearch: function (search) { + search = toString_1(search); + if (search == '') { + this.query = null; + } else { + if ('?' == charAt(search, 0)) { search = stringSlice(search, 1); } + this.query = ''; + this.parse(search, QUERY); + } + this.searchParams.update(); + }, + // https://url.spec.whatwg.org/#dom-url-searchparams + getSearchParams: function () { + return this.searchParams.facade; + }, + // https://url.spec.whatwg.org/#dom-url-hash + getHash: function () { + var fragment = this.fragment; + return fragment ? '#' + fragment : ''; + }, + setHash: function (hash) { + hash = toString_1(hash); + if (hash == '') { + this.fragment = null; + return; + } + if ('#' == charAt(hash, 0)) { hash = stringSlice(hash, 1); } + this.fragment = ''; + this.parse(hash, FRAGMENT); + }, + update: function () { + this.query = this.searchParams.serialize() || null; } }; @@ -15012,253 +17145,88 @@ var doric = (function (exports) { // https://url.spec.whatwg.org/#url-class var URLConstructor = function URL(url /* , base */) { var that = anInstance(this, URLPrototype); - var base = arguments.length > 1 ? arguments[1] : undefined; - var urlString = toString_1(url); - var state = setInternalState(that, { type: 'URL' }); - var baseState, failure; - if (base !== undefined) { - try { - baseState = getInternalURLState(base); - } catch (error) { - failure = parseURL(baseState = {}, toString_1(base)); - if (failure) { throw TypeError$1(failure); } - } - } - failure = parseURL(state, urlString, null, baseState); - if (failure) { throw TypeError$1(failure); } - var searchParams = state.searchParams = new URLSearchParams$1(); - var searchParamsState = getInternalSearchParamsState(searchParams); - searchParamsState.updateSearchParams(state.query); - searchParamsState.updateURL = function () { - state.query = toString_1(searchParams) || null; - }; + var base = validateArgumentsLength(arguments.length, 1) > 1 ? arguments[1] : undefined; + var state = setInternalState(that, new URLState(url, false, base)); if (!descriptors) { - that.href = functionCall(serializeURL, that); - that.origin = functionCall(getOrigin, that); - that.protocol = functionCall(getProtocol, that); - that.username = functionCall(getUsername, that); - that.password = functionCall(getPassword, that); - that.host = functionCall(getHost, that); - that.hostname = functionCall(getHostname, that); - that.port = functionCall(getPort, that); - that.pathname = functionCall(getPathname, that); - that.search = functionCall(getSearch, that); - that.searchParams = functionCall(getSearchParams, that); - that.hash = functionCall(getHash, that); + that.href = state.serialize(); + that.origin = state.getOrigin(); + that.protocol = state.getProtocol(); + that.username = state.getUsername(); + that.password = state.getPassword(); + that.host = state.getHost(); + that.hostname = state.getHostname(); + that.port = state.getPort(); + that.pathname = state.getPathname(); + that.search = state.getSearch(); + that.searchParams = state.getSearchParams(); + that.hash = state.getHash(); } }; var URLPrototype = URLConstructor.prototype; - var serializeURL = function () { - var url = getInternalURLState(this); - var scheme = url.scheme; - var username = url.username; - var password = url.password; - var host = url.host; - var port = url.port; - var path = url.path; - var query = url.query; - var fragment = url.fragment; - var output = scheme + ':'; - if (host !== null) { - output += '//'; - if (includesCredentials(url)) { - output += username + (password ? ':' + password : '') + '@'; - } - output += serializeHost(host); - if (port !== null) { output += ':' + port; } - } else if (scheme == 'file') { output += '//'; } - output += url.cannotBeABaseURL ? path[0] : path.length ? '/' + join(path, '/') : ''; - if (query !== null) { output += '?' + query; } - if (fragment !== null) { output += '#' + fragment; } - return output; - }; - - var getOrigin = function () { - var url = getInternalURLState(this); - var scheme = url.scheme; - var port = url.port; - if (scheme == 'blob') { try { - return new URLConstructor(scheme.path[0]).origin; - } catch (error) { - return 'null'; - } } - if (scheme == 'file' || !isSpecial(url)) { return 'null'; } - return scheme + '://' + serializeHost(url.host) + (port !== null ? ':' + port : ''); - }; - - var getProtocol = function () { - return getInternalURLState(this).scheme + ':'; - }; - - var getUsername = function () { - return getInternalURLState(this).username; - }; - - var getPassword = function () { - return getInternalURLState(this).password; - }; - - var getHost = function () { - var url = getInternalURLState(this); - var host = url.host; - var port = url.port; - return host === null ? '' - : port === null ? serializeHost(host) - : serializeHost(host) + ':' + port; - }; - - var getHostname = function () { - var host = getInternalURLState(this).host; - return host === null ? '' : serializeHost(host); - }; - - var getPort = function () { - var port = getInternalURLState(this).port; - return port === null ? '' : toString_1(port); - }; - - var getPathname = function () { - var url = getInternalURLState(this); - var path = url.path; - return url.cannotBeABaseURL ? path[0] : path.length ? '/' + join(path, '/') : ''; - }; - - var getSearch = function () { - var query = getInternalURLState(this).query; - return query ? '?' + query : ''; - }; - - var getSearchParams = function () { - return getInternalURLState(this).searchParams; - }; - - var getHash = function () { - var fragment = getInternalURLState(this).fragment; - return fragment ? '#' + fragment : ''; - }; - var accessorDescriptor = function (getter, setter) { - return { get: getter, set: setter, configurable: true, enumerable: true }; + return { + get: function () { + return getInternalURLState(this)[getter](); + }, + set: setter && function (value) { + return getInternalURLState(this)[setter](value); + }, + configurable: true, + enumerable: true + }; }; if (descriptors) { - objectDefineProperties(URLPrototype, { - // `URL.prototype.href` accessors pair - // https://url.spec.whatwg.org/#dom-url-href - href: accessorDescriptor(serializeURL, function (href) { - var url = getInternalURLState(this); - var urlString = toString_1(href); - var failure = parseURL(url, urlString); - if (failure) { throw TypeError$1(failure); } - getInternalSearchParamsState(url.searchParams).updateSearchParams(url.query); - }), - // `URL.prototype.origin` getter - // https://url.spec.whatwg.org/#dom-url-origin - origin: accessorDescriptor(getOrigin), - // `URL.prototype.protocol` accessors pair - // https://url.spec.whatwg.org/#dom-url-protocol - protocol: accessorDescriptor(getProtocol, function (protocol) { - var url = getInternalURLState(this); - parseURL(url, toString_1(protocol) + ':', SCHEME_START); - }), - // `URL.prototype.username` accessors pair - // https://url.spec.whatwg.org/#dom-url-username - username: accessorDescriptor(getUsername, function (username) { - var url = getInternalURLState(this); - var codePoints = arrayFrom(toString_1(username)); - if (cannotHaveUsernamePasswordPort(url)) { return; } - url.username = ''; - for (var i = 0; i < codePoints.length; i++) { - url.username += percentEncode(codePoints[i], userinfoPercentEncodeSet); - } - }), - // `URL.prototype.password` accessors pair - // https://url.spec.whatwg.org/#dom-url-password - password: accessorDescriptor(getPassword, function (password) { - var url = getInternalURLState(this); - var codePoints = arrayFrom(toString_1(password)); - if (cannotHaveUsernamePasswordPort(url)) { return; } - url.password = ''; - for (var i = 0; i < codePoints.length; i++) { - url.password += percentEncode(codePoints[i], userinfoPercentEncodeSet); - } - }), - // `URL.prototype.host` accessors pair - // https://url.spec.whatwg.org/#dom-url-host - host: accessorDescriptor(getHost, function (host) { - var url = getInternalURLState(this); - if (url.cannotBeABaseURL) { return; } - parseURL(url, toString_1(host), HOST); - }), - // `URL.prototype.hostname` accessors pair - // https://url.spec.whatwg.org/#dom-url-hostname - hostname: accessorDescriptor(getHostname, function (hostname) { - var url = getInternalURLState(this); - if (url.cannotBeABaseURL) { return; } - parseURL(url, toString_1(hostname), HOSTNAME); - }), - // `URL.prototype.port` accessors pair - // https://url.spec.whatwg.org/#dom-url-port - port: accessorDescriptor(getPort, function (port) { - var url = getInternalURLState(this); - if (cannotHaveUsernamePasswordPort(url)) { return; } - port = toString_1(port); - if (port == '') { url.port = null; } - else { parseURL(url, port, PORT); } - }), - // `URL.prototype.pathname` accessors pair - // https://url.spec.whatwg.org/#dom-url-pathname - pathname: accessorDescriptor(getPathname, function (pathname) { - var url = getInternalURLState(this); - if (url.cannotBeABaseURL) { return; } - url.path = []; - parseURL(url, toString_1(pathname), PATH_START); - }), - // `URL.prototype.search` accessors pair - // https://url.spec.whatwg.org/#dom-url-search - search: accessorDescriptor(getSearch, function (search) { - var url = getInternalURLState(this); - search = toString_1(search); - if (search == '') { - url.query = null; - } else { - if ('?' == charAt(search, 0)) { search = stringSlice(search, 1); } - url.query = ''; - parseURL(url, search, QUERY); - } - getInternalSearchParamsState(url.searchParams).updateSearchParams(url.query); - }), - // `URL.prototype.searchParams` getter - // https://url.spec.whatwg.org/#dom-url-searchparams - searchParams: accessorDescriptor(getSearchParams), - // `URL.prototype.hash` accessors pair - // https://url.spec.whatwg.org/#dom-url-hash - hash: accessorDescriptor(getHash, function (hash) { - var url = getInternalURLState(this); - hash = toString_1(hash); - if (hash == '') { - url.fragment = null; - return; - } - if ('#' == charAt(hash, 0)) { hash = stringSlice(hash, 1); } - url.fragment = ''; - parseURL(url, hash, FRAGMENT); - }) - }); + // `URL.prototype.href` accessors pair + // https://url.spec.whatwg.org/#dom-url-href + defineBuiltInAccessor(URLPrototype, 'href', accessorDescriptor('serialize', 'setHref')); + // `URL.prototype.origin` getter + // https://url.spec.whatwg.org/#dom-url-origin + defineBuiltInAccessor(URLPrototype, 'origin', accessorDescriptor('getOrigin')); + // `URL.prototype.protocol` accessors pair + // https://url.spec.whatwg.org/#dom-url-protocol + defineBuiltInAccessor(URLPrototype, 'protocol', accessorDescriptor('getProtocol', 'setProtocol')); + // `URL.prototype.username` accessors pair + // https://url.spec.whatwg.org/#dom-url-username + defineBuiltInAccessor(URLPrototype, 'username', accessorDescriptor('getUsername', 'setUsername')); + // `URL.prototype.password` accessors pair + // https://url.spec.whatwg.org/#dom-url-password + defineBuiltInAccessor(URLPrototype, 'password', accessorDescriptor('getPassword', 'setPassword')); + // `URL.prototype.host` accessors pair + // https://url.spec.whatwg.org/#dom-url-host + defineBuiltInAccessor(URLPrototype, 'host', accessorDescriptor('getHost', 'setHost')); + // `URL.prototype.hostname` accessors pair + // https://url.spec.whatwg.org/#dom-url-hostname + defineBuiltInAccessor(URLPrototype, 'hostname', accessorDescriptor('getHostname', 'setHostname')); + // `URL.prototype.port` accessors pair + // https://url.spec.whatwg.org/#dom-url-port + defineBuiltInAccessor(URLPrototype, 'port', accessorDescriptor('getPort', 'setPort')); + // `URL.prototype.pathname` accessors pair + // https://url.spec.whatwg.org/#dom-url-pathname + defineBuiltInAccessor(URLPrototype, 'pathname', accessorDescriptor('getPathname', 'setPathname')); + // `URL.prototype.search` accessors pair + // https://url.spec.whatwg.org/#dom-url-search + defineBuiltInAccessor(URLPrototype, 'search', accessorDescriptor('getSearch', 'setSearch')); + // `URL.prototype.searchParams` getter + // https://url.spec.whatwg.org/#dom-url-searchparams + defineBuiltInAccessor(URLPrototype, 'searchParams', accessorDescriptor('getSearchParams')); + // `URL.prototype.hash` accessors pair + // https://url.spec.whatwg.org/#dom-url-hash + defineBuiltInAccessor(URLPrototype, 'hash', accessorDescriptor('getHash', 'setHash')); } // `URL.prototype.toJSON` method // https://url.spec.whatwg.org/#dom-url-tojson - redefine(URLPrototype, 'toJSON', function toJSON() { - return functionCall(serializeURL, this); + defineBuiltIn(URLPrototype, 'toJSON', function toJSON() { + return getInternalURLState(this).serialize(); }, { enumerable: true }); // `URL.prototype.toString` method // https://url.spec.whatwg.org/#URL-stringification-behavior - redefine(URLPrototype, 'toString', function toString() { - return functionCall(serializeURL, this); + defineBuiltIn(URLPrototype, 'toString', function toString() { + return getInternalURLState(this).serialize(); }, { enumerable: true }); if (NativeURL) { @@ -15266,15 +17234,15 @@ var doric = (function (exports) { var nativeRevokeObjectURL = NativeURL.revokeObjectURL; // `URL.createObjectURL` method // https://developer.mozilla.org/en-US/docs/Web/API/URL/createObjectURL - if (nativeCreateObjectURL) { redefine(URLConstructor, 'createObjectURL', functionBindContext(nativeCreateObjectURL, NativeURL)); } + if (nativeCreateObjectURL) { defineBuiltIn(URLConstructor, 'createObjectURL', functionBindContext(nativeCreateObjectURL, NativeURL)); } // `URL.revokeObjectURL` method // https://developer.mozilla.org/en-US/docs/Web/API/URL/revokeObjectURL - if (nativeRevokeObjectURL) { redefine(URLConstructor, 'revokeObjectURL', functionBindContext(nativeRevokeObjectURL, NativeURL)); } + if (nativeRevokeObjectURL) { defineBuiltIn(URLConstructor, 'revokeObjectURL', functionBindContext(nativeRevokeObjectURL, NativeURL)); } } setToStringTag(URLConstructor, 'URL'); - _export({ global: true, forced: !nativeUrl, sham: !descriptors }, { + _export({ global: true, constructor: true, forced: !nativeUrl, sham: !descriptors }, { URL: URLConstructor }); @@ -15286,7 +17254,9 @@ var doric = (function (exports) { } }); - var features = path; + var full = path; + + var features = full; var coreJs = features; diff --git a/doric-js/bundle/doric-vm.js b/doric-js/bundle/doric-vm.js index 52aafce1..3cae048f 100644 --- a/doric-js/bundle/doric-vm.js +++ b/doric-js/bundle/doric-vm.js @@ -3481,6 +3481,18 @@ __decorate$a([ Property, __metadata$a("design:type", Boolean) ], List.prototype, "bounces", void 0); +__decorate$a([ + Property, + __metadata$a("design:type", Boolean) +], List.prototype, "canDrag", void 0); +__decorate$a([ + Property, + __metadata$a("design:type", Function) +], List.prototype, "onDragging", void 0); +__decorate$a([ + Property, + __metadata$a("design:type", Function) +], List.prototype, "onDragged", void 0); function list(config) { const ret = new List; ret.apply(config); diff --git a/doric-js/index.d.ts b/doric-js/index.d.ts index a4c82327..d626b648 100644 --- a/doric-js/index.d.ts +++ b/doric-js/index.d.ts @@ -763,6 +763,9 @@ declare module 'doric/lib/src/widget/list' { * Take effect only on iOS */ bounces?: boolean; + canDrag?: boolean; + onDragging?: (from: number, to: number) => void; + onDragged?: (from: number, to: number) => void; scrollToItem(context: BridgeContext, index: number, config?: { animated?: boolean; }): Promise; @@ -1211,11 +1214,11 @@ declare module 'doric/lib/src/native/navigator' { export function internalScheme(context: BridgeContext, panelClass: ClassType): string; export function navigator(context: BridgeContext): { push: (source: string | ClassType, config?: { - alias?: string | undefined; - animated?: boolean | undefined; - extra?: object | undefined; - singlePage?: boolean | undefined; - } | undefined) => Promise; + alias?: string; + animated?: boolean; + extra?: object; + singlePage?: boolean; + }) => Promise; pop: (animated?: boolean) => Promise; popSelf: (animated?: boolean) => Promise; popToRoot: (animated?: boolean) => Promise; @@ -1246,19 +1249,19 @@ declare module 'doric/lib/src/native/network' { } export function network(context: BridgeContext): { request: (config: IRequest) => Promise; - get: (url: string, config?: IRequest | undefined) => Promise; - post: (url: string, data?: string | object | undefined, config?: IRequest | undefined) => Promise; - put: (url: string, data?: string | object | undefined, config?: IRequest | undefined) => Promise; - delete: (url: string, data?: string | object | undefined, config?: IRequest | undefined) => Promise; + get: (url: string, config?: IRequest) => Promise; + post: (url: string, data?: object | string, config?: IRequest) => Promise; + put: (url: string, data?: object | string, config?: IRequest) => Promise; + delete: (url: string, data?: object | string, config?: IRequest) => Promise; }; } declare module 'doric/lib/src/native/storage' { import { BridgeContext } from "doric/lib/src/runtime/global"; export function storage(context: BridgeContext): { - setItem: (key: string, value: string, zone?: string | undefined) => Promise; - getItem: (key: string, zone?: string | undefined) => Promise; - remove: (key: string, zone?: string | undefined) => Promise; + setItem: (key: string, value: string, zone?: string) => Promise; + getItem: (key: string, zone?: string) => Promise; + remove: (key: string, zone?: string) => Promise; clear: (zone: string) => Promise; }; } diff --git a/doric-js/lib/src/native/navigator.d.ts b/doric-js/lib/src/native/navigator.d.ts index f8bc2089..2bf1a69b 100644 --- a/doric-js/lib/src/native/navigator.d.ts +++ b/doric-js/lib/src/native/navigator.d.ts @@ -4,11 +4,11 @@ import { ClassType } from "../util/types"; export declare function internalScheme(context: BridgeContext, panelClass: ClassType): string; export declare function navigator(context: BridgeContext): { push: (source: string | ClassType, config?: { - alias?: string | undefined; - animated?: boolean | undefined; - extra?: object | undefined; - singlePage?: boolean | undefined; - } | undefined) => Promise; + alias?: string; + animated?: boolean; + extra?: object; + singlePage?: boolean; + }) => Promise; pop: (animated?: boolean) => Promise; popSelf: (animated?: boolean) => Promise; popToRoot: (animated?: boolean) => Promise; diff --git a/doric-js/lib/src/native/network.d.ts b/doric-js/lib/src/native/network.d.ts index cd0485a0..63dbb7f8 100644 --- a/doric-js/lib/src/native/network.d.ts +++ b/doric-js/lib/src/native/network.d.ts @@ -20,8 +20,8 @@ export interface IResponse { } export declare function network(context: BridgeContext): { request: (config: IRequest) => Promise; - get: (url: string, config?: IRequest | undefined) => Promise; - post: (url: string, data?: string | object | undefined, config?: IRequest | undefined) => Promise; - put: (url: string, data?: string | object | undefined, config?: IRequest | undefined) => Promise; - delete: (url: string, data?: string | object | undefined, config?: IRequest | undefined) => Promise; + get: (url: string, config?: IRequest) => Promise; + post: (url: string, data?: object | string, config?: IRequest) => Promise; + put: (url: string, data?: object | string, config?: IRequest) => Promise; + delete: (url: string, data?: object | string, config?: IRequest) => Promise; }; diff --git a/doric-js/lib/src/native/storage.d.ts b/doric-js/lib/src/native/storage.d.ts index d90ebed0..878506c0 100644 --- a/doric-js/lib/src/native/storage.d.ts +++ b/doric-js/lib/src/native/storage.d.ts @@ -1,7 +1,7 @@ import { BridgeContext } from "../runtime/global"; export declare function storage(context: BridgeContext): { - setItem: (key: string, value: string, zone?: string | undefined) => Promise; - getItem: (key: string, zone?: string | undefined) => Promise; - remove: (key: string, zone?: string | undefined) => Promise; + setItem: (key: string, value: string, zone?: string) => Promise; + getItem: (key: string, zone?: string) => Promise; + remove: (key: string, zone?: string) => Promise; clear: (zone: string) => Promise; }; diff --git a/doric-js/lib/src/widget/list.d.ts b/doric-js/lib/src/widget/list.d.ts index 7bb329f8..e528be31 100644 --- a/doric-js/lib/src/widget/list.d.ts +++ b/doric-js/lib/src/widget/list.d.ts @@ -36,6 +36,9 @@ export declare class List extends Superview { * Take effect only on iOS */ bounces?: boolean; + canDrag?: boolean; + onDragging?: (from: number, to: number) => void; + onDragged?: (from: number, to: number) => void; scrollToItem(context: BridgeContext, index: number, config?: { animated?: boolean; }): Promise; diff --git a/doric-js/lib/src/widget/list.js b/doric-js/lib/src/widget/list.js index d351fe7d..15d7e725 100644 --- a/doric-js/lib/src/widget/list.js +++ b/doric-js/lib/src/widget/list.js @@ -134,6 +134,18 @@ __decorate([ Property, __metadata("design:type", Boolean) ], List.prototype, "bounces", void 0); +__decorate([ + Property, + __metadata("design:type", Boolean) +], List.prototype, "canDrag", void 0); +__decorate([ + Property, + __metadata("design:type", Function) +], List.prototype, "onDragging", void 0); +__decorate([ + Property, + __metadata("design:type", Function) +], List.prototype, "onDragged", void 0); export function list(config) { const ret = new List; ret.apply(config); diff --git a/doric-js/src/widget/list.ts b/doric-js/src/widget/list.ts index 6a34ec6e..e54caa23 100644 --- a/doric-js/src/widget/list.ts +++ b/doric-js/src/widget/list.ts @@ -81,6 +81,15 @@ export class List extends Superview { @Property bounces?: boolean + @Property + canDrag?: boolean + + @Property + onDragging?: (from: number, to: number) => void + + @Property + onDragged?: (from: number, to: number) => void + scrollToItem(context: BridgeContext, index: number, config?: { animated?: boolean, }) { const animated = config?.animated return this.nativeChannel(context, 'scrollToItem')({ index, animated, }) as Promise