typeson-registry 9.2.0 → 10.0.0

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.
Files changed (90) hide show
  1. package/README.md +4 -3
  2. package/dist/index.d.ts +2 -1
  3. package/dist/index.js +81 -36
  4. package/dist/index.js.map +1 -1
  5. package/dist/index.min.js +1 -1
  6. package/dist/index.min.js.map +1 -1
  7. package/dist/index.umd.cjs +186 -178
  8. package/dist/index.umd.cjs.map +1 -1
  9. package/dist/index.umd.min.cjs +1 -1
  10. package/dist/index.umd.min.cjs.map +1 -1
  11. package/dist/presets/array-nonindex-keys.umd.cjs +1 -1
  12. package/dist/presets/array-nonindex-keys.umd.cjs.map +1 -1
  13. package/dist/presets/builtin.umd.cjs +1 -1
  14. package/dist/presets/builtin.umd.cjs.map +1 -1
  15. package/dist/presets/postmessage.umd.cjs +1 -1
  16. package/dist/presets/postmessage.umd.cjs.map +1 -1
  17. package/dist/presets/socketio.umd.cjs +1 -1
  18. package/dist/presets/socketio.umd.cjs.map +1 -1
  19. package/dist/presets/structured-cloning-throwing.umd.cjs +1 -1
  20. package/dist/presets/structured-cloning-throwing.umd.cjs.map +1 -1
  21. package/dist/presets/structured-cloning.d.ts.map +1 -1
  22. package/dist/presets/structured-cloning.umd.cjs +1 -1
  23. package/dist/presets/structured-cloning.umd.cjs.map +1 -1
  24. package/dist/presets/undef.umd.cjs +1 -1
  25. package/dist/presets/undef.umd.cjs.map +1 -1
  26. package/dist/presets/universal.umd.cjs +1 -1
  27. package/dist/presets/universal.umd.cjs.map +1 -1
  28. package/dist/types/arraybuffer.d.ts.map +1 -1
  29. package/dist/types/arraybuffer.umd.cjs +1 -1
  30. package/dist/types/arraybuffer.umd.cjs.map +1 -1
  31. package/dist/types/bigint-object.umd.cjs +1 -1
  32. package/dist/types/bigint-object.umd.cjs.map +1 -1
  33. package/dist/types/blob.umd.cjs +1 -1
  34. package/dist/types/blob.umd.cjs.map +1 -1
  35. package/dist/types/cloneable.umd.cjs.map +1 -1
  36. package/dist/types/cryptokey.umd.cjs +1 -1
  37. package/dist/types/cryptokey.umd.cjs.map +1 -1
  38. package/dist/types/dataview.d.ts.map +1 -1
  39. package/dist/types/dataview.umd.cjs +1 -1
  40. package/dist/types/dataview.umd.cjs.map +1 -1
  41. package/dist/types/date.umd.cjs +1 -1
  42. package/dist/types/date.umd.cjs.map +1 -1
  43. package/dist/types/domexception.umd.cjs +1 -1
  44. package/dist/types/domexception.umd.cjs.map +1 -1
  45. package/dist/types/dommatrix.umd.cjs +1 -1
  46. package/dist/types/dommatrix.umd.cjs.map +1 -1
  47. package/dist/types/dompoint.umd.cjs +1 -1
  48. package/dist/types/dompoint.umd.cjs.map +1 -1
  49. package/dist/types/domquad.umd.cjs +1 -1
  50. package/dist/types/domquad.umd.cjs.map +1 -1
  51. package/dist/types/domrect.umd.cjs +1 -1
  52. package/dist/types/domrect.umd.cjs.map +1 -1
  53. package/dist/types/error.umd.cjs +1 -1
  54. package/dist/types/error.umd.cjs.map +1 -1
  55. package/dist/types/errors.d.ts +1 -1
  56. package/dist/types/errors.d.ts.map +1 -1
  57. package/dist/types/errors.umd.cjs +1 -1
  58. package/dist/types/errors.umd.cjs.map +1 -1
  59. package/dist/types/file.umd.cjs +1 -1
  60. package/dist/types/file.umd.cjs.map +1 -1
  61. package/dist/types/filelist.umd.cjs +1 -1
  62. package/dist/types/filelist.umd.cjs.map +1 -1
  63. package/dist/types/imagebitmap.d.ts.map +1 -1
  64. package/dist/types/imagebitmap.umd.cjs +1 -1
  65. package/dist/types/imagebitmap.umd.cjs.map +1 -1
  66. package/dist/types/imagedata.umd.cjs +1 -1
  67. package/dist/types/imagedata.umd.cjs.map +1 -1
  68. package/dist/types/intl-types.umd.cjs +1 -1
  69. package/dist/types/intl-types.umd.cjs.map +1 -1
  70. package/dist/types/map.umd.cjs +1 -1
  71. package/dist/types/map.umd.cjs.map +1 -1
  72. package/dist/types/nonbuiltin-ignore.umd.cjs +1 -1
  73. package/dist/types/nonbuiltin-ignore.umd.cjs.map +1 -1
  74. package/dist/types/primitive-objects.umd.cjs +1 -1
  75. package/dist/types/primitive-objects.umd.cjs.map +1 -1
  76. package/dist/types/regexp.umd.cjs +1 -1
  77. package/dist/types/regexp.umd.cjs.map +1 -1
  78. package/dist/types/set.umd.cjs +1 -1
  79. package/dist/types/set.umd.cjs.map +1 -1
  80. package/dist/types/typed-arrays-socketio.umd.cjs +1 -1
  81. package/dist/types/typed-arrays-socketio.umd.cjs.map +1 -1
  82. package/dist/types/typed-arrays.umd.cjs +1 -1
  83. package/dist/types/typed-arrays.umd.cjs.map +1 -1
  84. package/dist/types/undef.umd.cjs +1 -1
  85. package/dist/types/undef.umd.cjs.map +1 -1
  86. package/dist/types/user-object.umd.cjs +1 -1
  87. package/dist/types/user-object.umd.cjs.map +1 -1
  88. package/package.json +25 -23
  89. package/polyfills/createObjectURL.umd.cjs +1 -1
  90. package/polyfills/createObjectURL.umd.cjs.map +1 -1
@@ -4,6 +4,67 @@
4
4
  (global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory(global.TypesonNamespace = {}));
5
5
  })(this, (function (exports) { 'use strict';
6
6
 
7
+ function _arrayLikeToArray$1(r, a) {
8
+ (null == a || a > r.length) && (a = r.length);
9
+ for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e];
10
+ return n;
11
+ }
12
+ function _arrayWithHoles(r) {
13
+ if (Array.isArray(r)) return r;
14
+ }
15
+ function _arrayWithoutHoles(r) {
16
+ if (Array.isArray(r)) return _arrayLikeToArray$1(r);
17
+ }
18
+ function asyncGeneratorStep(n, t, e, r, o, a, c) {
19
+ try {
20
+ var i = n[a](c),
21
+ u = i.value;
22
+ } catch (n) {
23
+ return void e(n);
24
+ }
25
+ i.done ? t(u) : Promise.resolve(u).then(r, o);
26
+ }
27
+ function _asyncToGenerator(n) {
28
+ return function () {
29
+ var t = this,
30
+ e = arguments;
31
+ return new Promise(function (r, o) {
32
+ var a = n.apply(t, e);
33
+ function _next(n) {
34
+ asyncGeneratorStep(a, r, o, _next, _throw, "next", n);
35
+ }
36
+ function _throw(n) {
37
+ asyncGeneratorStep(a, r, o, _next, _throw, "throw", n);
38
+ }
39
+ _next(void 0);
40
+ });
41
+ };
42
+ }
43
+ function _classCallCheck$1(a, n) {
44
+ if (!(a instanceof n)) throw new TypeError("Cannot call a class as a function");
45
+ }
46
+ function _defineProperties$1(e, r) {
47
+ for (var t = 0; t < r.length; t++) {
48
+ var o = r[t];
49
+ o.enumerable = o.enumerable || !1, o.configurable = !0, "value" in o && (o.writable = !0), Object.defineProperty(e, _toPropertyKey$1(o.key), o);
50
+ }
51
+ }
52
+ function _createClass$1(e, r, t) {
53
+ return r && _defineProperties$1(e.prototype, r), Object.defineProperty(e, "prototype", {
54
+ writable: !1
55
+ }), e;
56
+ }
57
+ function _defineProperty$1(e, r, t) {
58
+ return (r = _toPropertyKey$1(r)) in e ? Object.defineProperty(e, r, {
59
+ value: t,
60
+ enumerable: !0,
61
+ configurable: !0,
62
+ writable: !0
63
+ }) : e[r] = t, e;
64
+ }
65
+ function _iterableToArray(r) {
66
+ if ("undefined" != typeof Symbol && null != r[Symbol.iterator] || null != r["@@iterator"]) return Array.from(r);
67
+ }
7
68
  function _iterableToArrayLimit(r, l) {
8
69
  var t = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"];
9
70
  if (null != t) {
@@ -15,10 +76,7 @@
15
76
  f = !0,
16
77
  o = !1;
17
78
  try {
18
- if (i = (t = t.call(r)).next, 0 === l) {
19
- if (Object(t) !== t) return;
20
- f = !1;
21
- } else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0);
79
+ if (i = (t = t.call(r)).next, 0 === l) ; else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0);
22
80
  } catch (r) {
23
81
  o = !0, n = r;
24
82
  } finally {
@@ -31,6 +89,12 @@
31
89
  return a;
32
90
  }
33
91
  }
92
+ function _nonIterableRest() {
93
+ throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
94
+ }
95
+ function _nonIterableSpread() {
96
+ throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
97
+ }
34
98
  function ownKeys$1(e, r) {
35
99
  var t = Object.keys(e);
36
100
  if (Object.getOwnPropertySymbols) {
@@ -160,7 +224,7 @@
160
224
  function makeInvokeMethod(e, r, n) {
161
225
  var o = h;
162
226
  return function (i, a) {
163
- if (o === f) throw new Error("Generator is already running");
227
+ if (o === f) throw Error("Generator is already running");
164
228
  if (o === s) {
165
229
  if ("throw" === i) throw a;
166
230
  return {
@@ -302,7 +366,7 @@
302
366
  } else if (c) {
303
367
  if (this.prev < i.catchLoc) return handle(i.catchLoc, !0);
304
368
  } else {
305
- if (!u) throw new Error("try statement without catch or finally");
369
+ if (!u) throw Error("try statement without catch or finally");
306
370
  if (this.prev < i.finallyLoc) return handle(i.finallyLoc);
307
371
  }
308
372
  }
@@ -342,7 +406,7 @@
342
406
  return o;
343
407
  }
344
408
  }
345
- throw new Error("illegal catch attempt");
409
+ throw Error("illegal catch attempt");
346
410
  },
347
411
  delegateYield: function (e, r, n) {
348
412
  return this.delegate = {
@@ -353,6 +417,26 @@
353
417
  }
354
418
  }, e;
355
419
  }
420
+ function _slicedToArray$1(r, e) {
421
+ return _arrayWithHoles(r) || _iterableToArrayLimit(r, e) || _unsupportedIterableToArray$1(r, e) || _nonIterableRest();
422
+ }
423
+ function _toConsumableArray$1(r) {
424
+ return _arrayWithoutHoles(r) || _iterableToArray(r) || _unsupportedIterableToArray$1(r) || _nonIterableSpread();
425
+ }
426
+ function _toPrimitive(t, r) {
427
+ if ("object" != typeof t || !t) return t;
428
+ var e = t[Symbol.toPrimitive];
429
+ if (void 0 !== e) {
430
+ var i = e.call(t, r || "default");
431
+ if ("object" != typeof i) return i;
432
+ throw new TypeError("@@toPrimitive must return a primitive value.");
433
+ }
434
+ return ("string" === r ? String : Number)(t);
435
+ }
436
+ function _toPropertyKey$1(t) {
437
+ var i = _toPrimitive(t, "string");
438
+ return "symbol" == typeof i ? i : i + "";
439
+ }
356
440
  function _typeof$1(o) {
357
441
  "@babel/helpers - typeof";
358
442
 
@@ -362,120 +446,13 @@
362
446
  return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o;
363
447
  }, _typeof$1(o);
364
448
  }
365
- function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) {
366
- try {
367
- var info = gen[key](arg);
368
- var value = info.value;
369
- } catch (error) {
370
- reject(error);
371
- return;
372
- }
373
- if (info.done) {
374
- resolve(value);
375
- } else {
376
- Promise.resolve(value).then(_next, _throw);
377
- }
378
- }
379
- function _asyncToGenerator(fn) {
380
- return function () {
381
- var self = this,
382
- args = arguments;
383
- return new Promise(function (resolve, reject) {
384
- var gen = fn.apply(self, args);
385
- function _next(value) {
386
- asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value);
387
- }
388
- function _throw(err) {
389
- asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err);
390
- }
391
- _next(undefined);
392
- });
393
- };
394
- }
395
- function _classCallCheck$1(instance, Constructor) {
396
- if (!(instance instanceof Constructor)) {
397
- throw new TypeError("Cannot call a class as a function");
449
+ function _unsupportedIterableToArray$1(r, a) {
450
+ if (r) {
451
+ if ("string" == typeof r) return _arrayLikeToArray$1(r, a);
452
+ var t = {}.toString.call(r).slice(8, -1);
453
+ return "Object" === t && r.constructor && (t = r.constructor.name), "Map" === t || "Set" === t ? Array.from(r) : "Arguments" === t || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t) ? _arrayLikeToArray$1(r, a) : void 0;
398
454
  }
399
455
  }
400
- function _defineProperties$1(target, props) {
401
- for (var i = 0; i < props.length; i++) {
402
- var descriptor = props[i];
403
- descriptor.enumerable = descriptor.enumerable || false;
404
- descriptor.configurable = true;
405
- if ("value" in descriptor) descriptor.writable = true;
406
- Object.defineProperty(target, _toPropertyKey$1(descriptor.key), descriptor);
407
- }
408
- }
409
- function _createClass$1(Constructor, protoProps, staticProps) {
410
- if (protoProps) _defineProperties$1(Constructor.prototype, protoProps);
411
- if (staticProps) _defineProperties$1(Constructor, staticProps);
412
- Object.defineProperty(Constructor, "prototype", {
413
- writable: false
414
- });
415
- return Constructor;
416
- }
417
- function _defineProperty$1(obj, key, value) {
418
- key = _toPropertyKey$1(key);
419
- if (key in obj) {
420
- Object.defineProperty(obj, key, {
421
- value: value,
422
- enumerable: true,
423
- configurable: true,
424
- writable: true
425
- });
426
- } else {
427
- obj[key] = value;
428
- }
429
- return obj;
430
- }
431
- function _slicedToArray$1(arr, i) {
432
- return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray$1(arr, i) || _nonIterableRest();
433
- }
434
- function _toConsumableArray$1(arr) {
435
- return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray$1(arr) || _nonIterableSpread();
436
- }
437
- function _arrayWithoutHoles(arr) {
438
- if (Array.isArray(arr)) return _arrayLikeToArray$1(arr);
439
- }
440
- function _arrayWithHoles(arr) {
441
- if (Array.isArray(arr)) return arr;
442
- }
443
- function _iterableToArray(iter) {
444
- if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter);
445
- }
446
- function _unsupportedIterableToArray$1(o, minLen) {
447
- if (!o) return;
448
- if (typeof o === "string") return _arrayLikeToArray$1(o, minLen);
449
- var n = Object.prototype.toString.call(o).slice(8, -1);
450
- if (n === "Object" && o.constructor) n = o.constructor.name;
451
- if (n === "Map" || n === "Set") return Array.from(o);
452
- if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray$1(o, minLen);
453
- }
454
- function _arrayLikeToArray$1(arr, len) {
455
- if (len == null || len > arr.length) len = arr.length;
456
- for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i];
457
- return arr2;
458
- }
459
- function _nonIterableSpread() {
460
- throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
461
- }
462
- function _nonIterableRest() {
463
- throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
464
- }
465
- function _toPrimitive(input, hint) {
466
- if (typeof input !== "object" || input === null) return input;
467
- var prim = input[Symbol.toPrimitive];
468
- if (prim !== undefined) {
469
- var res = prim.call(input, hint || "default");
470
- if (typeof res !== "object") return res;
471
- throw new TypeError("@@toPrimitive must return a primitive value.");
472
- }
473
- return (hint === "string" ? String : Number)(input);
474
- }
475
- function _toPropertyKey$1(arg) {
476
- var key = _toPrimitive(arg, "string");
477
- return typeof key === "symbol" ? key : String(key);
478
- }
479
456
 
480
457
  function ownKeys(e, t) {
481
458
  var r = Object.keys(e);
@@ -515,7 +492,7 @@
515
492
  }
516
493
  }
517
494
  function _createClass(e, t, r) {
518
- return t && _defineProperties(e.prototype, t), r && _defineProperties(e, r), Object.defineProperty(e, "prototype", {
495
+ return t && _defineProperties(e.prototype, t), Object.defineProperty(e, "prototype", {
519
496
  writable: !1
520
497
  }), e;
521
498
  }
@@ -691,7 +668,7 @@
691
668
  return null === e ? "null" : Array.isArray(e) ? "array" : _typeof(e);
692
669
  }
693
670
  function _await(e, t, r) {
694
- return r ? t ? t(e) : e : (e && e.then || (e = Promise.resolve(e)), t ? e.then(t) : e);
671
+ return (e && e.then || (e = Promise.resolve(e)), t ? e.then(t) : e);
695
672
  }
696
673
  var n = Object.keys,
697
674
  o = Object.hasOwn,
@@ -1234,8 +1211,7 @@
1234
1211
  if (lngth === null || lngth === undefined) {
1235
1212
  lngth = arraybuffer.byteLength; // Needed for Safari
1236
1213
  }
1237
-
1238
- var bytes = new Uint8Array(arraybuffer, byteOffset || 0,
1214
+ var bytes = new Uint8Array(arraybuffer, 0,
1239
1215
  // Default needed for Safari
1240
1216
  lngth);
1241
1217
  var len = bytes.length;
@@ -1256,9 +1232,12 @@
1256
1232
 
1257
1233
  /**
1258
1234
  * @param {string} base64
1235
+ * @param {{
1236
+ * maxByteLength: number
1237
+ * }} [options]
1259
1238
  * @returns {ArrayBuffer}
1260
1239
  */
1261
- var decode = function decode(base64) {
1240
+ var decode = function decode(base64, options) {
1262
1241
  var len = base64.length;
1263
1242
  if (len % 4) {
1264
1243
  throw new Error('Bad base64 length: not divisible by four');
@@ -1272,7 +1251,9 @@
1272
1251
  bufferLength--;
1273
1252
  }
1274
1253
  }
1275
- var arraybuffer = new ArrayBuffer(bufferLength),
1254
+
1255
+ // @ts-expect-error Second argument is not yet standard
1256
+ var arraybuffer = new ArrayBuffer(bufferLength, options),
1276
1257
  bytes = new Uint8Array(arraybuffer);
1277
1258
  for (var _i2 = 0; _i2 < len; _i2 += 4) {
1278
1259
  // We know the result will not be undefined, as we have a text
@@ -1312,7 +1293,10 @@
1312
1293
  };
1313
1294
  }
1314
1295
  stateObj.buffers.push(b);
1315
- return encode(b);
1296
+ return {
1297
+ s: encode(b),
1298
+ maxByteLength: b.maxByteLength
1299
+ };
1316
1300
  },
1317
1301
  revive: function revive(b64,
1318
1302
  /**
@@ -1323,14 +1307,16 @@
1323
1307
  if (!stateObj.buffers) {
1324
1308
  stateObj.buffers = [];
1325
1309
  }
1326
- if (_typeof$1(b64) === 'object') {
1310
+ if (Object.hasOwn(b64, 'index')) {
1327
1311
  return stateObj.buffers[
1328
1312
  /**
1329
1313
  * @type {{index: import('typeson').Integer}}
1330
1314
  */
1331
1315
  b64.index];
1332
1316
  }
1333
- var buffer = decode( /** @type {string} */b64);
1317
+ var buffer = decode( /** @type {string} */b64.s, {
1318
+ maxByteLength: b64.maxByteLength
1319
+ });
1334
1320
  stateObj.buffers.push(buffer);
1335
1321
  return buffer;
1336
1322
  }
@@ -1435,7 +1421,6 @@
1435
1421
  // eslint-disable-next-line unicorn/prefer-code-point -- Iterating char. codes
1436
1422
  array[i] = str.charCodeAt(i); // & 0xff;
1437
1423
  }
1438
-
1439
1424
  return array.buffer;
1440
1425
  }
1441
1426
 
@@ -1467,8 +1452,8 @@
1467
1452
  };
1468
1453
  },
1469
1454
  revive: function revive(obj) {
1470
- var type = /** @type {{type: string, stringContents: string}} */obj.type,
1471
- stringContents = /** @type {{type: string, stringContents: string}} */obj.stringContents;
1455
+ var type = ( /** @type {{type: string, stringContents: string}} */obj).type,
1456
+ stringContents = ( /** @type {{type: string, stringContents: string}} */obj).stringContents;
1472
1457
  return new Blob([string2arraybuffer(stringContents)], {
1473
1458
  type: type
1474
1459
  });
@@ -1550,8 +1535,8 @@
1550
1535
  };
1551
1536
  },
1552
1537
  revive: function revive(obj) {
1553
- var uuid = /** @type {{uuid: string, encapsulated: any}} */obj.uuid,
1554
- encapsulated = /** @type {{uuid: string, encapsulated: any}} */obj.encapsulated;
1538
+ var uuid = ( /** @type {{uuid: string, encapsulated: any}} */obj).uuid,
1539
+ encapsulated = ( /** @type {{uuid: string, encapsulated: any}} */obj).encapsulated;
1555
1540
  return cloneableObjectsByUUID[uuid][Symbol["for"]('cloneRevive')](encapsulated);
1556
1541
  }
1557
1542
  }
@@ -1603,7 +1588,7 @@
1603
1588
  }());
1604
1589
  },
1605
1590
  revive: function revive(obj) {
1606
- var jwk =
1591
+ var jwk = (
1607
1592
  /**
1608
1593
  * @type {{
1609
1594
  * jwk: JsonWebKey,
@@ -1611,8 +1596,8 @@
1611
1596
  * usages: KeyUsage[]
1612
1597
  * }}
1613
1598
  */
1614
- obj.jwk,
1615
- algorithm =
1599
+ obj).jwk,
1600
+ algorithm = (
1616
1601
  /**
1617
1602
  * @type {{
1618
1603
  * jwk: JsonWebKey,
@@ -1620,8 +1605,8 @@
1620
1605
  * usages: KeyUsage[]
1621
1606
  * }}
1622
1607
  */
1623
- obj.algorithm,
1624
- usages =
1608
+ obj).algorithm,
1609
+ usages = (
1625
1610
  /**
1626
1611
  * @type {{
1627
1612
  * jwk: JsonWebKey,
@@ -1629,7 +1614,7 @@
1629
1614
  * usages: KeyUsage[]
1630
1615
  * }}
1631
1616
  */
1632
- obj.usages;
1617
+ obj).usages;
1633
1618
  return crypto.subtle.importKey('jwk', jwk, algorithm, true, usages);
1634
1619
  }
1635
1620
  }
@@ -1667,6 +1652,7 @@
1667
1652
  stateObj.buffers.push(buffer);
1668
1653
  return {
1669
1654
  encoded: encode(buffer),
1655
+ maxByteLength: buffer.maxByteLength,
1670
1656
  byteOffset: byteOffset,
1671
1657
  byteLength: byteLength
1672
1658
  };
@@ -1684,12 +1670,16 @@
1684
1670
  var byteOffset = b64Obj.byteOffset,
1685
1671
  byteLength = b64Obj.byteLength,
1686
1672
  encoded = b64Obj.encoded,
1687
- index = b64Obj.index;
1673
+ index = b64Obj.index,
1674
+ maxByteLength = b64Obj.maxByteLength;
1688
1675
  var buffer;
1689
1676
  if ('index' in b64Obj) {
1690
1677
  buffer = stateObj.buffers[index];
1691
1678
  } else {
1692
- buffer = decode(encoded);
1679
+ buffer = decode(encoded, /* c8 ignore next 3 -- Depends on Node version */
1680
+ maxByteLength === undefined ? maxByteLength : {
1681
+ maxByteLength: maxByteLength
1682
+ });
1693
1683
  stateObj.buffers.push(buffer);
1694
1684
  }
1695
1685
  return new DataView(buffer, byteOffset, byteLength);
@@ -1751,8 +1741,15 @@
1751
1741
  * @type {import('typeson').TypeSpecSet}
1752
1742
  */
1753
1743
  var dommatrix = {};
1754
- create$5(DOMMatrix);
1755
- create$5(DOMMatrixReadOnly);
1744
+
1745
+ /* c8 ignore next */
1746
+ if (typeof DOMMatrix !== 'undefined') {
1747
+ create$5(DOMMatrix);
1748
+ }
1749
+ /* c8 ignore next */
1750
+ if (typeof DOMMatrixReadOnly !== 'undefined') {
1751
+ create$5(DOMMatrixReadOnly);
1752
+ }
1756
1753
 
1757
1754
  /**
1758
1755
  * @param {typeof DOMMatrix|typeof DOMMatrixReadOnly} Ctor
@@ -1808,8 +1805,15 @@
1808
1805
  * @type {import('typeson').TypeSpecSet}
1809
1806
  */
1810
1807
  var dompoint = {};
1811
- create$4(DOMPoint);
1812
- create$4(DOMPointReadOnly);
1808
+
1809
+ /* c8 ignore next */
1810
+ if (typeof DOMPoint !== 'undefined') {
1811
+ create$4(DOMPoint);
1812
+ }
1813
+ /* c8 ignore next */
1814
+ if (typeof DOMPointReadOnly !== 'undefined') {
1815
+ create$4(DOMPointReadOnly);
1816
+ }
1813
1817
 
1814
1818
  /**
1815
1819
  * @param {typeof DOMPoint|typeof DOMPointReadOnly} Ctor
@@ -1872,8 +1876,15 @@
1872
1876
  * @type {import('typeson').TypeSpecSet}
1873
1877
  */
1874
1878
  var domrect = {};
1875
- create$3(DOMRect);
1876
- create$3(DOMRectReadOnly);
1879
+
1880
+ /* c8 ignore next */
1881
+ if (typeof DOMRect !== 'undefined') {
1882
+ create$3(DOMRect);
1883
+ }
1884
+ /* c8 ignore next */
1885
+ if (typeof DOMRectReadOnly !== 'undefined') {
1886
+ create$3(DOMRectReadOnly);
1887
+ }
1877
1888
 
1878
1889
  /**
1879
1890
  * @param {typeof DOMRect|typeof DOMRectReadOnly} Ctor
@@ -2034,15 +2045,15 @@
2034
2045
  * columnNumber?: import('typeson').Integer
2035
2046
  * }}
2036
2047
  */
2037
- isAggregateError ? new /** @type {AggregateErrorConstructor} */
2038
- Ctor(obj.errors, obj.message) : new
2048
+ isAggregateError ? new ( /** @type {AggregateErrorConstructor} */
2049
+ Ctor)(obj.errors, obj.message) : new (
2039
2050
  /**
2040
2051
  * @type {TypeErrorConstructor|RangeErrorConstructor|
2041
2052
  * SyntaxErrorConstructor|ReferenceErrorConstructor|
2042
2053
  * EvalErrorConstructor|URIErrorConstructor|
2043
2054
  * InternalErrorConstructor}
2044
2055
  */
2045
- Ctor(obj.message);
2056
+ Ctor)(obj.message);
2046
2057
  e.name = obj.name;
2047
2058
  e.cause = obj.cause;
2048
2059
  e.stack = obj.stack;
@@ -2141,7 +2152,7 @@
2141
2152
  /**
2142
2153
  * `FileList` polyfill.
2143
2154
  */
2144
- var FileList = /*#__PURE__*/function (_Symbol$toStringTag) {
2155
+ var FileList = /*#__PURE__*/function () {
2145
2156
  /**
2146
2157
  * Set private properties and length.
2147
2158
  */
@@ -2155,7 +2166,7 @@
2155
2166
  * @param {import('typeson').Integer} index
2156
2167
  * @returns {File}
2157
2168
  */
2158
- _createClass$1(FileList, [{
2169
+ return _createClass$1(FileList, [{
2159
2170
  key: "item",
2160
2171
  value: function item(index) {
2161
2172
  return this._files[index];
@@ -2165,14 +2176,13 @@
2165
2176
  * @returns {"FileList"}
2166
2177
  */
2167
2178
  }, {
2168
- key: _Symbol$toStringTag,
2179
+ key: Symbol.toStringTag,
2169
2180
  get: function get() {
2170
2181
  /* eslint-enable class-methods-use-this */
2171
2182
  return 'FileList';
2172
2183
  }
2173
2184
  }]);
2174
- return FileList;
2175
- }(Symbol.toStringTag);
2185
+ }();
2176
2186
  return new FileList(o);
2177
2187
  }
2178
2188
  }
@@ -2194,15 +2204,15 @@
2194
2204
  var ctx = /** @type {CanvasRenderingContext2D} */
2195
2205
  canvas.getContext('2d');
2196
2206
  ctx.drawImage(bm, 0, 0);
2197
- // Although `width` and `height` are part of `ImageBitMap`,
2198
- // these will be auto-created for us when reviving with the
2199
- // data URL (and they are not settable even if they weren't)
2200
- // return {
2201
- // width: bm.width, height: bm.height, dataURL: canvas.toDataURL()
2202
- // };
2203
- return canvas.toDataURL();
2207
+ return {
2208
+ width: bm.width,
2209
+ height: bm.height,
2210
+ dataURL: canvas.toDataURL()
2211
+ };
2204
2212
  },
2205
2213
  revive: function revive(o) {
2214
+ var canvas = typeof OffscreenCanvas === 'undefined' ? document.createElement('canvas')
2215
+ /* c8 ignore next -- Browser only */ : new OffscreenCanvas(o.width, o.height);
2206
2216
  /*
2207
2217
  var req = new XMLHttpRequest();
2208
2218
  req.open('GET', o, false); // Sync
@@ -2212,7 +2222,6 @@
2212
2222
  req.send();
2213
2223
  return req.responseText;
2214
2224
  */
2215
- var canvas = document.createElement('canvas');
2216
2225
  var ctx = /** @type {CanvasRenderingContext2D} */
2217
2226
  canvas.getContext('2d');
2218
2227
  var img = document.createElement('img');
@@ -2220,10 +2229,11 @@
2220
2229
  img.addEventListener('load', function () {
2221
2230
  ctx.drawImage(img, 0, 0);
2222
2231
  });
2223
- img.src = o;
2232
+ img.src = o.dataURL;
2224
2233
  // Works in contexts allowing an `ImageBitmap` (We might use
2225
2234
  // `OffscreenCanvas.transferToBitmap` when supported)
2226
- return canvas;
2235
+ return typeof OffscreenCanvas === 'undefined' ? canvas
2236
+ /* c8 ignore next 3 -- Browser only */ : /** @type {OffscreenCanvas} */canvas.transferToImageBitmap();
2227
2237
  },
2228
2238
  reviveAsync: function reviveAsync(o) {
2229
2239
  var canvas = document.createElement('canvas');
@@ -2234,8 +2244,7 @@
2234
2244
  img.addEventListener('load', function () {
2235
2245
  ctx.drawImage(img, 0, 0);
2236
2246
  });
2237
- img.src = o; // o.dataURL;
2238
-
2247
+ img.src = o.dataURL;
2239
2248
  return new e( /*#__PURE__*/function () {
2240
2249
  var _ref = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(resolve, reject) {
2241
2250
  var resp;
@@ -2620,11 +2629,7 @@
2620
2629
  * @returns {void}
2621
2630
  */
2622
2631
  function create(TypedArray) {
2623
- var typeName =
2624
- /**
2625
- * @type {TypedArrayConstructor & {name: string}}
2626
- */
2627
- TypedArray.name;
2632
+ var typeName = TypedArray.name;
2628
2633
  typedArrays[typeName.toLowerCase()] = {
2629
2634
  test: function test(x) {
2630
2635
  return toStringTag(x) === typeName;
@@ -2652,6 +2657,7 @@
2652
2657
  }
2653
2658
  stateObj.buffers.push(buffer);
2654
2659
  return {
2660
+ maxByteLength: buffer.maxByteLength,
2655
2661
  encoded: encode(buffer),
2656
2662
  byteOffset: byteOffset,
2657
2663
  length: l
@@ -2670,12 +2676,16 @@
2670
2676
  var byteOffset = b64Obj.byteOffset,
2671
2677
  len = b64Obj.length,
2672
2678
  encoded = b64Obj.encoded,
2673
- index = b64Obj.index;
2679
+ index = b64Obj.index,
2680
+ maxByteLength = b64Obj.maxByteLength;
2674
2681
  var buffer;
2675
2682
  if ('index' in b64Obj) {
2676
2683
  buffer = stateObj.buffers[index];
2677
2684
  } else {
2678
- buffer = decode(encoded);
2685
+ buffer = decode(encoded, /* c8 ignore next 3 -- Depends on Node version */
2686
+ maxByteLength === undefined ? undefined : {
2687
+ maxByteLength: maxByteLength
2688
+ });
2679
2689
  stateObj.buffers.push(buffer);
2680
2690
  }
2681
2691
  return new TypedArray(buffer, byteOffset, len);
@@ -2905,8 +2915,6 @@
2905
2915
  * @type {import('typeson').Preset}
2906
2916
  */
2907
2917
  var expObj = [
2908
- // Todo: Might also register synchronous `ImageBitmap` and
2909
- // `Blob`/`File`/`FileList`?
2910
2918
  // ES5
2911
2919
  userObject,
2912
2920
  // Processed last (non-builtin)
@@ -2980,7 +2988,7 @@
2980
2988
  // HTML-SPECIFIC
2981
2989
  'Event',
2982
2990
  // Also in Node `worker_threads` (currently experimental)
2983
- 'MessageChannel'].includes(stringTag) ||
2991
+ 'MessageChannel'].includes(stringTag) || (
2984
2992
  /*
2985
2993
  // isClosed is no longer documented
2986
2994
  ((stringTag === 'Blob' || stringTag === 'File') &&
@@ -2989,7 +2997,7 @@
2989
2997
  val && _typeof$1(val) === 'object' &&
2990
2998
  // Duck-type DOM node objects (non-array exotic?
2991
2999
  // objects which cannot be cloned by the SCA)
2992
- typeof val.nodeType === 'number' && typeof val.insertBefore === 'function') {
3000
+ typeof val.nodeType === 'number' && typeof val.insertBefore === 'function')) {
2993
3001
  throw new DOMException('The object cannot be cloned.', 'DataCloneError');
2994
3002
  }
2995
3003
  return false;