core-js-bundle 3.31.0 → 3.31.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/index.js CHANGED
@@ -1,7 +1,7 @@
1
1
  /**
2
- * core-js 3.31.0
2
+ * core-js 3.31.1
3
3
  * © 2014-2023 Denis Pushkarev (zloirock.ru)
4
- * license: https://github.com/zloirock/core-js/blob/v3.31.0/LICENSE
4
+ * license: https://github.com/zloirock/core-js/blob/v3.31.1/LICENSE
5
5
  * source: https://github.com/zloirock/core-js
6
6
  */
7
7
  !function (undefined) { 'use strict'; /******/ (function(modules) { // webpackBootstrap
@@ -1402,10 +1402,10 @@ var store = __webpack_require__(37);
1402
1402
  (module.exports = function (key, value) {
1403
1403
  return store[key] || (store[key] = value !== undefined ? value : {});
1404
1404
  })('versions', []).push({
1405
- version: '3.31.0',
1405
+ version: '3.31.1',
1406
1406
  mode: IS_PURE ? 'pure' : 'global',
1407
1407
  copyright: '© 2014-2023 Denis Pushkarev (zloirock.ru)',
1408
- license: 'https://github.com/zloirock/core-js/blob/v3.31.0/LICENSE',
1408
+ license: 'https://github.com/zloirock/core-js/blob/v3.31.1/LICENSE',
1409
1409
  source: 'https://github.com/zloirock/core-js'
1410
1410
  });
1411
1411
 
@@ -3186,7 +3186,6 @@ var exportWebAssemblyErrorCauseWrapper = function (ERROR_NAME, wrapper) {
3186
3186
  };
3187
3187
 
3188
3188
  // https://tc39.es/ecma262/#sec-nativeerror
3189
- // https://github.com/tc39/proposal-error-cause
3190
3189
  exportGlobalErrorCauseWrapper('Error', function (init) {
3191
3190
  return function Error(message) { return apply(init, this, arguments); };
3192
3191
  });
@@ -3818,7 +3817,7 @@ var FORCED = !fails(function () {
3818
3817
  return $AggregateError([1], AGGREGATE_ERROR, { cause: 7 }).cause !== 7;
3819
3818
  });
3820
3819
 
3821
- // https://github.com/tc39/proposal-error-cause
3820
+ // https://tc39.es/ecma262/#sec-aggregate-error
3822
3821
  $({ global: true, constructor: true, arity: 2, forced: FORCED }, {
3823
3822
  AggregateError: wrapErrorConstructorWithCause(AGGREGATE_ERROR, function (init) {
3824
3823
  // eslint-disable-next-line no-unused-vars -- required for functions `.length`
@@ -3840,7 +3839,7 @@ var toIntegerOrInfinity = __webpack_require__(62);
3840
3839
  var addToUnscopables = __webpack_require__(140);
3841
3840
 
3842
3841
  // `Array.prototype.at` method
3843
- // https://github.com/tc39/proposal-relative-indexing-method
3842
+ // https://tc39.es/ecma262/#sec-array.prototype.at
3844
3843
  $({ target: 'Array', proto: true }, {
3845
3844
  at: function at(index) {
3846
3845
  var O = toObject(this);
@@ -4225,7 +4224,7 @@ var $findLast = __webpack_require__(155).findLast;
4225
4224
  var addToUnscopables = __webpack_require__(140);
4226
4225
 
4227
4226
  // `Array.prototype.findLast` method
4228
- // https://github.com/tc39/proposal-array-find-from-last
4227
+ // https://tc39.es/ecma262/#sec-array.prototype.findlast
4229
4228
  $({ target: 'Array', proto: true }, {
4230
4229
  findLast: function findLast(callbackfn /* , that = undefined */) {
4231
4230
  return $findLast(this, callbackfn, arguments.length > 1 ? arguments[1] : undefined);
@@ -4286,7 +4285,7 @@ var $findLastIndex = __webpack_require__(155).findLastIndex;
4286
4285
  var addToUnscopables = __webpack_require__(140);
4287
4286
 
4288
4287
  // `Array.prototype.findLastIndex` method
4289
- // https://github.com/tc39/proposal-array-find-from-last
4288
+ // https://tc39.es/ecma262/#sec-array.prototype.findlastindex
4290
4289
  $({ target: 'Array', proto: true }, {
4291
4290
  findLastIndex: function findLastIndex(callbackfn /* , that = undefined */) {
4292
4291
  return $findLastIndex(this, callbackfn, arguments.length > 1 ? arguments[1] : undefined);
@@ -5645,7 +5644,7 @@ var addToUnscopables = __webpack_require__(140);
5645
5644
  var $Array = Array;
5646
5645
 
5647
5646
  // `Array.prototype.toReversed` method
5648
- // https://tc39.es/proposal-change-array-by-copy/#sec-array.prototype.toReversed
5647
+ // https://tc39.es/ecma262/#sec-array.prototype.toreversed
5649
5648
  $({ target: 'Array', proto: true }, {
5650
5649
  toReversed: function toReversed() {
5651
5650
  return arrayToReversed(toIndexedObject(this), $Array);
@@ -5690,7 +5689,7 @@ var $Array = Array;
5690
5689
  var sort = uncurryThis(getVirtual('Array').sort);
5691
5690
 
5692
5691
  // `Array.prototype.toSorted` method
5693
- // https://tc39.es/proposal-change-array-by-copy/#sec-array.prototype.toSorted
5692
+ // https://tc39.es/ecma262/#sec-array.prototype.tosorted
5694
5693
  $({ target: 'Array', proto: true }, {
5695
5694
  toSorted: function toSorted(compareFn) {
5696
5695
  if (compareFn !== undefined) aCallable(compareFn);
@@ -5748,7 +5747,7 @@ var max = Math.max;
5748
5747
  var min = Math.min;
5749
5748
 
5750
5749
  // `Array.prototype.toSpliced` method
5751
- // https://tc39.es/proposal-change-array-by-copy/#sec-array.prototype.toSpliced
5750
+ // https://tc39.es/ecma262/#sec-array.prototype.tospliced
5752
5751
  $({ target: 'Array', proto: true }, {
5753
5752
  toSpliced: function toSpliced(start, deleteCount /* , ...items */) {
5754
5753
  var O = toIndexedObject(this);
@@ -5869,7 +5868,7 @@ var toIndexedObject = __webpack_require__(12);
5869
5868
  var $Array = Array;
5870
5869
 
5871
5870
  // `Array.prototype.with` method
5872
- // https://tc39.es/proposal-change-array-by-copy/#sec-array.prototype.with
5871
+ // https://tc39.es/ecma262/#sec-array.prototype.with
5873
5872
  $({ target: 'Array', proto: true }, {
5874
5873
  'with': function (index, value) {
5875
5874
  return arrayWith(toIndexedObject(this), $Array, index, value);
@@ -6010,23 +6009,25 @@ var addGetter = function (Constructor, key, getInternalState) {
6010
6009
  };
6011
6010
 
6012
6011
  var get = function (view, count, index, isLittleEndian) {
6013
- var intIndex = toIndex(index);
6014
6012
  var store = getInternalDataViewState(view);
6013
+ var intIndex = toIndex(index);
6014
+ var boolIsLittleEndian = !!isLittleEndian;
6015
6015
  if (intIndex + count > store.byteLength) throw RangeError(WRONG_INDEX);
6016
6016
  var bytes = store.bytes;
6017
6017
  var start = intIndex + store.byteOffset;
6018
6018
  var pack = arraySlice(bytes, start, start + count);
6019
- return isLittleEndian ? pack : reverse(pack);
6019
+ return boolIsLittleEndian ? pack : reverse(pack);
6020
6020
  };
6021
6021
 
6022
6022
  var set = function (view, count, index, conversion, value, isLittleEndian) {
6023
- var intIndex = toIndex(index);
6024
6023
  var store = getInternalDataViewState(view);
6024
+ var intIndex = toIndex(index);
6025
+ var pack = conversion(+value);
6026
+ var boolIsLittleEndian = !!isLittleEndian;
6025
6027
  if (intIndex + count > store.byteLength) throw RangeError(WRONG_INDEX);
6026
6028
  var bytes = store.bytes;
6027
6029
  var start = intIndex + store.byteOffset;
6028
- var pack = conversion(+value);
6029
- for (var i = 0; i < count; i++) bytes[start + i] = pack[isLittleEndian ? i : count - i - 1];
6030
+ for (var i = 0; i < count; i++) bytes[start + i] = pack[boolIsLittleEndian ? i : count - i - 1];
6030
6031
  };
6031
6032
 
6032
6033
  if (!NATIVE_ARRAY_BUFFER) {
@@ -6086,24 +6087,24 @@ if (!NATIVE_ARRAY_BUFFER) {
6086
6087
  return get(this, 1, byteOffset)[0];
6087
6088
  },
6088
6089
  getInt16: function getInt16(byteOffset /* , littleEndian */) {
6089
- var bytes = get(this, 2, byteOffset, arguments.length > 1 ? arguments[1] : undefined);
6090
+ var bytes = get(this, 2, byteOffset, arguments.length > 1 ? arguments[1] : false);
6090
6091
  return (bytes[1] << 8 | bytes[0]) << 16 >> 16;
6091
6092
  },
6092
6093
  getUint16: function getUint16(byteOffset /* , littleEndian */) {
6093
- var bytes = get(this, 2, byteOffset, arguments.length > 1 ? arguments[1] : undefined);
6094
+ var bytes = get(this, 2, byteOffset, arguments.length > 1 ? arguments[1] : false);
6094
6095
  return bytes[1] << 8 | bytes[0];
6095
6096
  },
6096
6097
  getInt32: function getInt32(byteOffset /* , littleEndian */) {
6097
- return unpackInt32(get(this, 4, byteOffset, arguments.length > 1 ? arguments[1] : undefined));
6098
+ return unpackInt32(get(this, 4, byteOffset, arguments.length > 1 ? arguments[1] : false));
6098
6099
  },
6099
6100
  getUint32: function getUint32(byteOffset /* , littleEndian */) {
6100
- return unpackInt32(get(this, 4, byteOffset, arguments.length > 1 ? arguments[1] : undefined)) >>> 0;
6101
+ return unpackInt32(get(this, 4, byteOffset, arguments.length > 1 ? arguments[1] : false)) >>> 0;
6101
6102
  },
6102
6103
  getFloat32: function getFloat32(byteOffset /* , littleEndian */) {
6103
- return unpackIEEE754(get(this, 4, byteOffset, arguments.length > 1 ? arguments[1] : undefined), 23);
6104
+ return unpackIEEE754(get(this, 4, byteOffset, arguments.length > 1 ? arguments[1] : false), 23);
6104
6105
  },
6105
6106
  getFloat64: function getFloat64(byteOffset /* , littleEndian */) {
6106
- return unpackIEEE754(get(this, 8, byteOffset, arguments.length > 1 ? arguments[1] : undefined), 52);
6107
+ return unpackIEEE754(get(this, 8, byteOffset, arguments.length > 1 ? arguments[1] : false), 52);
6107
6108
  },
6108
6109
  setInt8: function setInt8(byteOffset, value) {
6109
6110
  set(this, 1, byteOffset, packInt8, value);
@@ -6112,22 +6113,22 @@ if (!NATIVE_ARRAY_BUFFER) {
6112
6113
  set(this, 1, byteOffset, packInt8, value);
6113
6114
  },
6114
6115
  setInt16: function setInt16(byteOffset, value /* , littleEndian */) {
6115
- set(this, 2, byteOffset, packInt16, value, arguments.length > 2 ? arguments[2] : undefined);
6116
+ set(this, 2, byteOffset, packInt16, value, arguments.length > 2 ? arguments[2] : false);
6116
6117
  },
6117
6118
  setUint16: function setUint16(byteOffset, value /* , littleEndian */) {
6118
- set(this, 2, byteOffset, packInt16, value, arguments.length > 2 ? arguments[2] : undefined);
6119
+ set(this, 2, byteOffset, packInt16, value, arguments.length > 2 ? arguments[2] : false);
6119
6120
  },
6120
6121
  setInt32: function setInt32(byteOffset, value /* , littleEndian */) {
6121
- set(this, 4, byteOffset, packInt32, value, arguments.length > 2 ? arguments[2] : undefined);
6122
+ set(this, 4, byteOffset, packInt32, value, arguments.length > 2 ? arguments[2] : false);
6122
6123
  },
6123
6124
  setUint32: function setUint32(byteOffset, value /* , littleEndian */) {
6124
- set(this, 4, byteOffset, packInt32, value, arguments.length > 2 ? arguments[2] : undefined);
6125
+ set(this, 4, byteOffset, packInt32, value, arguments.length > 2 ? arguments[2] : false);
6125
6126
  },
6126
6127
  setFloat32: function setFloat32(byteOffset, value /* , littleEndian */) {
6127
- set(this, 4, byteOffset, packFloat32, value, arguments.length > 2 ? arguments[2] : undefined);
6128
+ set(this, 4, byteOffset, packFloat32, value, arguments.length > 2 ? arguments[2] : false);
6128
6129
  },
6129
6130
  setFloat64: function setFloat64(byteOffset, value /* , littleEndian */) {
6130
- set(this, 8, byteOffset, packFloat64, value, arguments.length > 2 ? arguments[2] : undefined);
6131
+ set(this, 8, byteOffset, packFloat64, value, arguments.length > 2 ? arguments[2] : false);
6131
6132
  }
6132
6133
  });
6133
6134
  } else {
@@ -9216,7 +9217,7 @@ var $ = __webpack_require__(3);
9216
9217
  var hasOwn = __webpack_require__(39);
9217
9218
 
9218
9219
  // `Object.hasOwn` method
9219
- // https://github.com/tc39/proposal-accessible-object-hasownproperty
9220
+ // https://tc39.es/ecma262/#sec-object.hasown
9220
9221
  $({ target: 'Object', stat: true }, {
9221
9222
  hasOwn: hasOwn
9222
9223
  });
@@ -11726,7 +11727,7 @@ var FORCED = fails(function () {
11726
11727
  });
11727
11728
 
11728
11729
  // `String.prototype.at` method
11729
- // https://github.com/tc39/proposal-relative-indexing-method
11730
+ // https://tc39.es/ecma262/#sec-string.prototype.at
11730
11731
  $({ target: 'String', proto: true, forced: FORCED }, {
11731
11732
  at: function at(index) {
11732
11733
  var S = toString(requireObjectCoercible(this));
@@ -13966,7 +13967,7 @@ var aTypedArray = ArrayBufferViewCore.aTypedArray;
13966
13967
  var exportTypedArrayMethod = ArrayBufferViewCore.exportTypedArrayMethod;
13967
13968
 
13968
13969
  // `%TypedArray%.prototype.at` method
13969
- // https://github.com/tc39/proposal-relative-indexing-method
13970
+ // https://tc39.es/ecma262/#sec-%typedarray%.prototype.at
13970
13971
  exportTypedArrayMethod('at', function at(index) {
13971
13972
  var O = aTypedArray(this);
13972
13973
  var len = lengthOfArrayLike(O);
@@ -14153,7 +14154,7 @@ var aTypedArray = ArrayBufferViewCore.aTypedArray;
14153
14154
  var exportTypedArrayMethod = ArrayBufferViewCore.exportTypedArrayMethod;
14154
14155
 
14155
14156
  // `%TypedArray%.prototype.findLast` method
14156
- // https://github.com/tc39/proposal-array-find-from-last
14157
+ // https://tc39.es/ecma262/#sec-%typedarray%.prototype.findlast
14157
14158
  exportTypedArrayMethod('findLast', function findLast(predicate /* , thisArg */) {
14158
14159
  return $findLast(aTypedArray(this), predicate, arguments.length > 1 ? arguments[1] : undefined);
14159
14160
  });
@@ -14172,7 +14173,7 @@ var aTypedArray = ArrayBufferViewCore.aTypedArray;
14172
14173
  var exportTypedArrayMethod = ArrayBufferViewCore.exportTypedArrayMethod;
14173
14174
 
14174
14175
  // `%TypedArray%.prototype.findLastIndex` method
14175
- // https://github.com/tc39/proposal-array-find-from-last
14176
+ // https://tc39.es/ecma262/#sec-%typedarray%.prototype.findlastindex
14176
14177
  exportTypedArrayMethod('findLastIndex', function findLastIndex(predicate /* , thisArg */) {
14177
14178
  return $findLastIndex(aTypedArray(this), predicate, arguments.length > 1 ? arguments[1] : undefined);
14178
14179
  });
@@ -14718,7 +14719,7 @@ var exportTypedArrayMethod = ArrayBufferViewCore.exportTypedArrayMethod;
14718
14719
  var getTypedArrayConstructor = ArrayBufferViewCore.getTypedArrayConstructor;
14719
14720
 
14720
14721
  // `%TypedArray%.prototype.toReversed` method
14721
- // https://tc39.es/proposal-change-array-by-copy/#sec-%typedarray%.prototype.toReversed
14722
+ // https://tc39.es/ecma262/#sec-%typedarray%.prototype.toreversed
14722
14723
  exportTypedArrayMethod('toReversed', function toReversed() {
14723
14724
  return arrayToReversed(aTypedArray(this), getTypedArrayConstructor(this));
14724
14725
  });
@@ -14741,7 +14742,7 @@ var exportTypedArrayMethod = ArrayBufferViewCore.exportTypedArrayMethod;
14741
14742
  var sort = uncurryThis(ArrayBufferViewCore.TypedArrayPrototype.sort);
14742
14743
 
14743
14744
  // `%TypedArray%.prototype.toSorted` method
14744
- // https://tc39.es/proposal-change-array-by-copy/#sec-%typedarray%.prototype.toSorted
14745
+ // https://tc39.es/ecma262/#sec-%typedarray%.prototype.tosorted
14745
14746
  exportTypedArrayMethod('toSorted', function toSorted(compareFn) {
14746
14747
  if (compareFn !== undefined) aCallable(compareFn);
14747
14748
  var O = aTypedArray(this);
@@ -14807,7 +14808,7 @@ var PROPER_ORDER = !!function () {
14807
14808
  }();
14808
14809
 
14809
14810
  // `%TypedArray%.prototype.with` method
14810
- // https://tc39.es/proposal-change-array-by-copy/#sec-%typedarray%.prototype.with
14811
+ // https://tc39.es/ecma262/#sec-%typedarray%.prototype.with
14811
14812
  exportTypedArrayMethod('with', { 'with': function (index, value) {
14812
14813
  var O = aTypedArray(this);
14813
14814
  var relativeIndex = toIntegerOrInfinity(index);
@@ -23336,7 +23337,61 @@ var createDataTransfer = function () {
23336
23337
  return dataTransfer && dataTransfer.items && dataTransfer.files ? dataTransfer : null;
23337
23338
  };
23338
23339
 
23339
- var structuredCloneInternal = function (value, map) {
23340
+ var cloneBuffer = function (value, map, $type) {
23341
+ if (mapHas(map, value)) return mapGet(map, value);
23342
+
23343
+ var type = $type || classof(value);
23344
+ var clone, length, options, source, target, i;
23345
+
23346
+ if (type === 'SharedArrayBuffer') {
23347
+ if (nativeRestrictedStructuredClone) clone = nativeRestrictedStructuredClone(value);
23348
+ // SharedArrayBuffer should use shared memory, we can't polyfill it, so return the original
23349
+ else clone = value;
23350
+ } else {
23351
+ var DataView = global.DataView;
23352
+
23353
+ // `ArrayBuffer#slice` is not available in IE10
23354
+ // `ArrayBuffer#slice` and `DataView` are not available in old FF
23355
+ if (!DataView && typeof value.slice != 'function') throwUnpolyfillable('ArrayBuffer');
23356
+ // detached buffers throws in `DataView` and `.slice`
23357
+ try {
23358
+ if (typeof value.slice == 'function' && !value.resizable) {
23359
+ clone = value.slice(0);
23360
+ } else {
23361
+ length = value.byteLength;
23362
+ options = 'maxByteLength' in value ? { maxByteLength: value.maxByteLength } : undefined;
23363
+ clone = new ArrayBuffer(length, options);
23364
+ source = new DataView(value);
23365
+ target = new DataView(clone);
23366
+ for (i = 0; i < length; i++) {
23367
+ target.setUint8(i, source.getUint8(i));
23368
+ }
23369
+ }
23370
+ } catch (error) {
23371
+ throw new DOMException('ArrayBuffer is detached', DATA_CLONE_ERROR);
23372
+ }
23373
+ }
23374
+
23375
+ mapSet(map, value, clone);
23376
+
23377
+ return clone;
23378
+ };
23379
+
23380
+ var cloneView = function (value, type, offset, length, map) {
23381
+ var C = global[type];
23382
+ // in some old engines like Safari 9, typeof C is 'object'
23383
+ // on Uint8ClampedArray or some other constructors
23384
+ if (!isObject(C)) throwUnpolyfillable(type);
23385
+ return new C(cloneBuffer(value.buffer, map), offset, length);
23386
+ };
23387
+
23388
+ var Placeholder = function (object, type, metadata) {
23389
+ this.object = object;
23390
+ this.type = type;
23391
+ this.metadata = metadata;
23392
+ };
23393
+
23394
+ var structuredCloneInternal = function (value, map, transferredBuffers) {
23340
23395
  if (isSymbol(value)) throwUncloneable('Symbol');
23341
23396
  if (!isObject(value)) return value;
23342
23397
  // effectively preserves circular references
@@ -23345,25 +23400,20 @@ var structuredCloneInternal = function (value, map) {
23345
23400
  } else map = new Map();
23346
23401
 
23347
23402
  var type = classof(value);
23348
- var deep = false;
23349
- var C, name, cloned, dataTransfer, i, length, keys, key, source, target, options;
23403
+ var C, name, cloned, dataTransfer, i, length, keys, key;
23350
23404
 
23351
23405
  switch (type) {
23352
23406
  case 'Array':
23353
23407
  cloned = Array(lengthOfArrayLike(value));
23354
- deep = true;
23355
23408
  break;
23356
23409
  case 'Object':
23357
23410
  cloned = {};
23358
- deep = true;
23359
23411
  break;
23360
23412
  case 'Map':
23361
23413
  cloned = new Map();
23362
- deep = true;
23363
23414
  break;
23364
23415
  case 'Set':
23365
23416
  cloned = new Set();
23366
- deep = true;
23367
23417
  break;
23368
23418
  case 'RegExp':
23369
23419
  // in this block because of a Safari 14.1 bug
@@ -23406,11 +23456,15 @@ var structuredCloneInternal = function (value, map) {
23406
23456
  default:
23407
23457
  cloned = Error();
23408
23458
  }
23409
- deep = true;
23410
23459
  break;
23411
23460
  case 'DOMException':
23412
23461
  cloned = new DOMException(value.message, value.name);
23413
- deep = true;
23462
+ break;
23463
+ case 'ArrayBuffer':
23464
+ case 'SharedArrayBuffer':
23465
+ cloned = transferredBuffers
23466
+ ? new Placeholder(value, type)
23467
+ : cloneBuffer(value, map, type);
23414
23468
  break;
23415
23469
  case 'DataView':
23416
23470
  case 'Int8Array':
@@ -23420,28 +23474,23 @@ var structuredCloneInternal = function (value, map) {
23420
23474
  case 'Uint16Array':
23421
23475
  case 'Int32Array':
23422
23476
  case 'Uint32Array':
23477
+ case 'Float16Array':
23423
23478
  case 'Float32Array':
23424
23479
  case 'Float64Array':
23425
23480
  case 'BigInt64Array':
23426
23481
  case 'BigUint64Array':
23427
- C = global[type];
23428
- // in some old engines like Safari 9, typeof C is 'object'
23429
- // on Uint8ClampedArray or some other constructors
23430
- if (!isObject(C)) throwUnpolyfillable(type);
23431
- cloned = new C(
23432
- // this is safe, since arraybuffer cannot have circular references
23433
- structuredCloneInternal(value.buffer, map),
23434
- value.byteOffset,
23435
- type === 'DataView' ? value.byteLength : value.length
23436
- );
23482
+ length = type === 'DataView' ? value.byteLength : value.length;
23483
+ cloned = transferredBuffers
23484
+ ? new Placeholder(value, type, { offset: value.byteOffset, length: length })
23485
+ : cloneView(value, type, value.byteOffset, length, map);
23437
23486
  break;
23438
23487
  case 'DOMQuad':
23439
23488
  try {
23440
23489
  cloned = new DOMQuad(
23441
- structuredCloneInternal(value.p1, map),
23442
- structuredCloneInternal(value.p2, map),
23443
- structuredCloneInternal(value.p3, map),
23444
- structuredCloneInternal(value.p4, map)
23490
+ structuredCloneInternal(value.p1, map, transferredBuffers),
23491
+ structuredCloneInternal(value.p2, map, transferredBuffers),
23492
+ structuredCloneInternal(value.p3, map, transferredBuffers),
23493
+ structuredCloneInternal(value.p4, map, transferredBuffers)
23445
23494
  );
23446
23495
  } catch (error) {
23447
23496
  cloned = tryNativeRestrictedStructuredClone(value, type);
@@ -23462,7 +23511,7 @@ var structuredCloneInternal = function (value, map) {
23462
23511
  dataTransfer = createDataTransfer();
23463
23512
  if (dataTransfer) {
23464
23513
  for (i = 0, length = lengthOfArrayLike(value); i < length; i++) {
23465
- dataTransfer.items.add(structuredCloneInternal(value[i], map));
23514
+ dataTransfer.items.add(structuredCloneInternal(value[i], map, transferredBuffers));
23466
23515
  }
23467
23516
  cloned = dataTransfer.files;
23468
23517
  } else cloned = tryNativeRestrictedStructuredClone(value, type);
@@ -23471,7 +23520,7 @@ var structuredCloneInternal = function (value, map) {
23471
23520
  // Safari 9 ImageData is a constructor, but typeof ImageData is 'object'
23472
23521
  try {
23473
23522
  cloned = new ImageData(
23474
- structuredCloneInternal(value.data, map),
23523
+ structuredCloneInternal(value.data, map, transferredBuffers),
23475
23524
  value.width,
23476
23525
  value.height,
23477
23526
  { colorSpace: value.colorSpace }
@@ -23499,32 +23548,6 @@ var structuredCloneInternal = function (value, map) {
23499
23548
  case 'Date':
23500
23549
  cloned = new Date(thisTimeValue(value));
23501
23550
  break;
23502
- case 'ArrayBuffer':
23503
- C = global.DataView;
23504
- // `ArrayBuffer#slice` is not available in IE10
23505
- // `ArrayBuffer#slice` and `DataView` are not available in old FF
23506
- if (!C && typeof value.slice != 'function') throwUnpolyfillable(type);
23507
- // detached buffers throws in `DataView` and `.slice`
23508
- try {
23509
- if (typeof value.slice == 'function' && !value.resizable) {
23510
- cloned = value.slice(0);
23511
- } else {
23512
- length = value.byteLength;
23513
- options = 'maxByteLength' in value ? { maxByteLength: value.maxByteLength } : undefined;
23514
- cloned = new ArrayBuffer(length, options);
23515
- source = new C(value);
23516
- target = new C(cloned);
23517
- for (i = 0; i < length; i++) {
23518
- target.setUint8(i, source.getUint8(i));
23519
- }
23520
- }
23521
- } catch (error) {
23522
- throw new DOMException('ArrayBuffer is detached', DATA_CLONE_ERROR);
23523
- } break;
23524
- case 'SharedArrayBuffer':
23525
- // SharedArrayBuffer should use shared memory, we can't polyfill it, so return the original
23526
- cloned = value;
23527
- break;
23528
23551
  case 'Blob':
23529
23552
  try {
23530
23553
  cloned = value.slice(0, value.size, value.type);
@@ -23588,41 +23611,111 @@ var structuredCloneInternal = function (value, map) {
23588
23611
 
23589
23612
  mapSet(map, value, cloned);
23590
23613
 
23591
- if (deep) switch (type) {
23614
+ switch (type) {
23592
23615
  case 'Array':
23593
23616
  case 'Object':
23594
23617
  keys = objectKeys(value);
23595
23618
  for (i = 0, length = lengthOfArrayLike(keys); i < length; i++) {
23596
23619
  key = keys[i];
23597
- createProperty(cloned, key, structuredCloneInternal(value[key], map));
23620
+ createProperty(cloned, key, structuredCloneInternal(value[key], map, transferredBuffers));
23598
23621
  } break;
23599
23622
  case 'Map':
23600
23623
  value.forEach(function (v, k) {
23601
- mapSet(cloned, structuredCloneInternal(k, map), structuredCloneInternal(v, map));
23624
+ mapSet(cloned, structuredCloneInternal(k, map, transferredBuffers), structuredCloneInternal(v, map, transferredBuffers));
23602
23625
  });
23603
23626
  break;
23604
23627
  case 'Set':
23605
23628
  value.forEach(function (v) {
23606
- setAdd(cloned, structuredCloneInternal(v, map));
23629
+ setAdd(cloned, structuredCloneInternal(v, map, transferredBuffers));
23607
23630
  });
23608
23631
  break;
23609
23632
  case 'Error':
23610
- createNonEnumerableProperty(cloned, 'message', structuredCloneInternal(value.message, map));
23633
+ createNonEnumerableProperty(cloned, 'message', structuredCloneInternal(value.message, map, transferredBuffers));
23611
23634
  if (hasOwn(value, 'cause')) {
23612
- createNonEnumerableProperty(cloned, 'cause', structuredCloneInternal(value.cause, map));
23635
+ createNonEnumerableProperty(cloned, 'cause', structuredCloneInternal(value.cause, map, transferredBuffers));
23613
23636
  }
23614
23637
  if (name == 'AggregateError') {
23615
- cloned.errors = structuredCloneInternal(value.errors, map);
23638
+ cloned.errors = structuredCloneInternal(value.errors, map, transferredBuffers);
23616
23639
  } // break omitted
23617
23640
  case 'DOMException':
23618
23641
  if (ERROR_STACK_INSTALLABLE) {
23619
- createNonEnumerableProperty(cloned, 'stack', structuredCloneInternal(value.stack, map));
23642
+ createNonEnumerableProperty(cloned, 'stack', structuredCloneInternal(value.stack, map, transferredBuffers));
23620
23643
  }
23621
23644
  }
23622
23645
 
23623
23646
  return cloned;
23624
23647
  };
23625
23648
 
23649
+ var replacePlaceholders = function (value, map) {
23650
+ if (!isObject(value)) return value;
23651
+ if (mapHas(map, value)) return mapGet(map, value);
23652
+
23653
+ var type, object, metadata, i, length, keys, key, replacement;
23654
+
23655
+ if (value instanceof Placeholder) {
23656
+ type = value.type;
23657
+ object = value.object;
23658
+
23659
+ switch (type) {
23660
+ case 'ArrayBuffer':
23661
+ case 'SharedArrayBuffer':
23662
+ replacement = cloneBuffer(object, map, type);
23663
+ break;
23664
+ case 'DataView':
23665
+ case 'Int8Array':
23666
+ case 'Uint8Array':
23667
+ case 'Uint8ClampedArray':
23668
+ case 'Int16Array':
23669
+ case 'Uint16Array':
23670
+ case 'Int32Array':
23671
+ case 'Uint32Array':
23672
+ case 'Float16Array':
23673
+ case 'Float32Array':
23674
+ case 'Float64Array':
23675
+ case 'BigInt64Array':
23676
+ case 'BigUint64Array':
23677
+ metadata = value.metadata;
23678
+ replacement = cloneView(object, type, metadata.offset, metadata.length, map);
23679
+ }
23680
+ } else switch (classof(value)) {
23681
+ case 'Array':
23682
+ case 'Object':
23683
+ keys = objectKeys(value);
23684
+ for (i = 0, length = lengthOfArrayLike(keys); i < length; i++) {
23685
+ key = keys[i];
23686
+ value[key] = replacePlaceholders(value[key], map);
23687
+ } break;
23688
+ case 'Map':
23689
+ replacement = new Map();
23690
+ value.forEach(function (v, k) {
23691
+ mapSet(replacement, replacePlaceholders(k, map), replacePlaceholders(v, map));
23692
+ });
23693
+ break;
23694
+ case 'Set':
23695
+ replacement = new Set();
23696
+ value.forEach(function (v) {
23697
+ setAdd(replacement, replacePlaceholders(v, map));
23698
+ });
23699
+ break;
23700
+ case 'Error':
23701
+ value.message = replacePlaceholders(value.message, map);
23702
+ if (hasOwn(value, 'cause')) {
23703
+ value.cause = replacePlaceholders(value.cause, map);
23704
+ }
23705
+ if (value.name == 'AggregateError') {
23706
+ value.errors = replacePlaceholders(value.errors, map);
23707
+ } // break omitted
23708
+ case 'DOMException':
23709
+ if (ERROR_STACK_INSTALLABLE) {
23710
+ value.stack = replacePlaceholders(value.stack, map);
23711
+ }
23712
+ }
23713
+
23714
+ mapSet(map, value, replacement || value);
23715
+
23716
+ return replacement || value;
23717
+ };
23718
+
23626
23719
  var tryToTransfer = function (rawTransfer, map) {
23627
23720
  if (!isObject(rawTransfer)) throw TypeError('Transfer option cannot be converted to a sequence');
23628
23721
 
@@ -23634,18 +23727,24 @@ var tryToTransfer = function (rawTransfer, map) {
23634
23727
 
23635
23728
  var i = 0;
23636
23729
  var length = lengthOfArrayLike(transfer);
23637
- var value, type, C, transferredArray, transferred, canvas, context;
23730
+ var buffers = [];
23731
+ var value, type, C, transferred, canvas, context;
23638
23732
 
23639
- if (PROPER_TRANSFER) {
23640
- transferredArray = nativeStructuredClone(transfer, { transfer: transfer });
23641
- while (i < length) mapSet(map, transfer[i], transferredArray[i++]);
23642
- } else while (i < length) {
23733
+ while (i < length) {
23643
23734
  value = transfer[i++];
23644
- if (mapHas(map, value)) throw new DOMException('Duplicate transferable', DATA_CLONE_ERROR);
23645
23735
 
23646
23736
  type = classof(value);
23647
23737
 
23648
- switch (type) {
23738
+ if (type === 'ArrayBuffer') {
23739
+ push(buffers, value);
23740
+ continue;
23741
+ }
23742
+
23743
+ if (mapHas(map, value)) throw new DOMException('Duplicate transferable', DATA_CLONE_ERROR);
23744
+
23745
+ if (PROPER_TRANSFER) {
23746
+ transferred = nativeStructuredClone(value, { transfer: [value] });
23747
+ } else switch (type) {
23649
23748
  case 'ImageBitmap':
23650
23749
  C = global.OffscreenCanvas;
23651
23750
  if (!isConstructor(C)) throwUnpolyfillable(type, TRANSFERRING);
@@ -23664,10 +23763,6 @@ var tryToTransfer = function (rawTransfer, map) {
23664
23763
  value.close();
23665
23764
  } catch (error) { /* empty */ }
23666
23765
  break;
23667
- case 'ArrayBuffer':
23668
- if (!isCallable(value.transfer)) throwUnpolyfillable(type, TRANSFERRING);
23669
- transferred = value.transfer();
23670
- break;
23671
23766
  case 'MediaSourceHandle':
23672
23767
  case 'MessagePort':
23673
23768
  case 'OffscreenCanvas':
@@ -23678,6 +23773,30 @@ var tryToTransfer = function (rawTransfer, map) {
23678
23773
  }
23679
23774
 
23680
23775
  if (transferred === undefined) throw new DOMException('This object cannot be transferred: ' + type, DATA_CLONE_ERROR);
23776
+
23777
+ mapSet(map, value, transferred);
23778
+ }
23779
+
23780
+ return buffers;
23781
+ };
23782
+
23783
+ var tryToTransferBuffers = function (transfer, map) {
23784
+ var i = 0;
23785
+ var length = lengthOfArrayLike(transfer);
23786
+ var value, transferred;
23787
+
23788
+ while (i < length) {
23789
+ value = transfer[i++];
23790
+
23791
+ if (mapHas(map, value)) throw new DOMException('Duplicate transferable', DATA_CLONE_ERROR);
23792
+
23793
+ if (PROPER_TRANSFER) {
23794
+ transferred = nativeStructuredClone(value, { transfer: [value] });
23795
+ } else {
23796
+ if (!isCallable(value.transfer)) throwUnpolyfillable('ArrayBuffer', TRANSFERRING);
23797
+ transferred = value.transfer();
23798
+ }
23799
+
23681
23800
  mapSet(map, value, transferred);
23682
23801
  }
23683
23802
  };
@@ -23688,14 +23807,26 @@ $({ global: true, enumerable: true, sham: !PROPER_TRANSFER, forced: FORCED_REPLA
23688
23807
  structuredClone: function structuredClone(value /* , { transfer } */) {
23689
23808
  var options = validateArgumentsLength(arguments.length, 1) > 1 && !isNullOrUndefined(arguments[1]) ? anObject(arguments[1]) : undefined;
23690
23809
  var transfer = options ? options.transfer : undefined;
23691
- var map;
23810
+ var transferredBuffers = false;
23811
+ var map, buffers;
23692
23812
 
23693
23813
  if (transfer !== undefined) {
23694
23814
  map = new Map();
23695
- tryToTransfer(transfer, map);
23815
+ buffers = tryToTransfer(transfer, map);
23816
+ transferredBuffers = !!lengthOfArrayLike(buffers);
23817
+ }
23818
+
23819
+ var clone = structuredCloneInternal(value, map, transferredBuffers);
23820
+
23821
+ // since of an issue with cloning views of transferred buffers, we a forced to transfer / clone them in 2 steps
23822
+ // https://github.com/zloirock/core-js/issues/1265
23823
+ if (transferredBuffers) {
23824
+ map = new Map();
23825
+ tryToTransferBuffers(transfer, map);
23826
+ clone = replacePlaceholders(clone, map);
23696
23827
  }
23697
23828
 
23698
- return structuredCloneInternal(value, map);
23829
+ return clone;
23699
23830
  }
23700
23831
  });
23701
23832