typeson-registry 9.2.1 → 11.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 (143) hide show
  1. package/README.md +4 -7
  2. package/dist/index.js +77 -47
  3. package/dist/index.js.map +1 -1
  4. package/dist/index.min.js +1 -1
  5. package/dist/index.min.js.map +1 -1
  6. package/dist/index.umd.cjs +175 -184
  7. package/dist/index.umd.cjs.map +1 -1
  8. package/dist/index.umd.min.cjs +1 -1
  9. package/dist/index.umd.min.cjs.map +1 -1
  10. package/dist/polyfills/createObjectURL.d.ts.map +1 -1
  11. package/dist/presets/array-nonindex-keys.d.ts +1 -1
  12. package/dist/presets/array-nonindex-keys.umd.cjs +1 -1
  13. package/dist/presets/array-nonindex-keys.umd.cjs.map +1 -1
  14. package/dist/presets/builtin.d.ts +1 -1
  15. package/dist/presets/builtin.umd.cjs +1 -1
  16. package/dist/presets/builtin.umd.cjs.map +1 -1
  17. package/dist/presets/postmessage.d.ts +1 -1
  18. package/dist/presets/postmessage.umd.cjs +1 -1
  19. package/dist/presets/postmessage.umd.cjs.map +1 -1
  20. package/dist/presets/socketio.d.ts +1 -1
  21. package/dist/presets/socketio.umd.cjs +1 -1
  22. package/dist/presets/socketio.umd.cjs.map +1 -1
  23. package/dist/presets/sparse-undefined.d.ts +1 -1
  24. package/dist/presets/special-numbers.d.ts +1 -1
  25. package/dist/presets/structured-cloning-throwing.d.ts +1 -1
  26. package/dist/presets/structured-cloning-throwing.umd.cjs +1 -1
  27. package/dist/presets/structured-cloning-throwing.umd.cjs.map +1 -1
  28. package/dist/presets/structured-cloning.d.ts +1 -1
  29. package/dist/presets/structured-cloning.d.ts.map +1 -1
  30. package/dist/presets/structured-cloning.umd.cjs +1 -1
  31. package/dist/presets/structured-cloning.umd.cjs.map +1 -1
  32. package/dist/presets/undef.d.ts +1 -1
  33. package/dist/presets/undef.umd.cjs +1 -1
  34. package/dist/presets/undef.umd.cjs.map +1 -1
  35. package/dist/presets/universal.d.ts +1 -1
  36. package/dist/presets/universal.umd.cjs +1 -1
  37. package/dist/presets/universal.umd.cjs.map +1 -1
  38. package/dist/types/arraybuffer.d.ts +1 -1
  39. package/dist/types/arraybuffer.d.ts.map +1 -1
  40. package/dist/types/arraybuffer.umd.cjs +1 -1
  41. package/dist/types/arraybuffer.umd.cjs.map +1 -1
  42. package/dist/types/bigint-object.d.ts +1 -1
  43. package/dist/types/bigint-object.umd.cjs +1 -1
  44. package/dist/types/bigint-object.umd.cjs.map +1 -1
  45. package/dist/types/bigint.d.ts +1 -1
  46. package/dist/types/blob.d.ts +1 -1
  47. package/dist/types/blob.d.ts.map +1 -1
  48. package/dist/types/blob.umd.cjs +1 -1
  49. package/dist/types/blob.umd.cjs.map +1 -1
  50. package/dist/types/cloneable.d.ts +1 -1
  51. package/dist/types/cloneable.umd.cjs +1 -1
  52. package/dist/types/cloneable.umd.cjs.map +1 -1
  53. package/dist/types/cryptokey.d.ts +1 -1
  54. package/dist/types/cryptokey.d.ts.map +1 -1
  55. package/dist/types/cryptokey.umd.cjs +1 -1
  56. package/dist/types/cryptokey.umd.cjs.map +1 -1
  57. package/dist/types/dataview.d.ts +1 -1
  58. package/dist/types/dataview.d.ts.map +1 -1
  59. package/dist/types/dataview.umd.cjs +1 -1
  60. package/dist/types/dataview.umd.cjs.map +1 -1
  61. package/dist/types/date.d.ts +1 -1
  62. package/dist/types/date.umd.cjs +1 -1
  63. package/dist/types/date.umd.cjs.map +1 -1
  64. package/dist/types/domexception.d.ts +1 -1
  65. package/dist/types/domexception.umd.cjs +1 -1
  66. package/dist/types/domexception.umd.cjs.map +1 -1
  67. package/dist/types/dommatrix.d.ts +1 -1
  68. package/dist/types/dommatrix.umd.cjs +1 -1
  69. package/dist/types/dommatrix.umd.cjs.map +1 -1
  70. package/dist/types/dompoint.d.ts +1 -1
  71. package/dist/types/dompoint.umd.cjs +1 -1
  72. package/dist/types/dompoint.umd.cjs.map +1 -1
  73. package/dist/types/domquad.d.ts +1 -1
  74. package/dist/types/domquad.umd.cjs +1 -1
  75. package/dist/types/domquad.umd.cjs.map +1 -1
  76. package/dist/types/domrect.d.ts +1 -1
  77. package/dist/types/domrect.umd.cjs +1 -1
  78. package/dist/types/domrect.umd.cjs.map +1 -1
  79. package/dist/types/error.d.ts +1 -1
  80. package/dist/types/error.umd.cjs +1 -1
  81. package/dist/types/error.umd.cjs.map +1 -1
  82. package/dist/types/errors.d.ts +2 -2
  83. package/dist/types/errors.d.ts.map +1 -1
  84. package/dist/types/errors.umd.cjs +1 -1
  85. package/dist/types/errors.umd.cjs.map +1 -1
  86. package/dist/types/file.d.ts +1 -1
  87. package/dist/types/file.d.ts.map +1 -1
  88. package/dist/types/file.umd.cjs +1 -1
  89. package/dist/types/file.umd.cjs.map +1 -1
  90. package/dist/types/filelist.d.ts +1 -1
  91. package/dist/types/filelist.umd.cjs +1 -1
  92. package/dist/types/filelist.umd.cjs.map +1 -1
  93. package/dist/types/imagebitmap.d.ts +1 -1
  94. package/dist/types/imagebitmap.d.ts.map +1 -1
  95. package/dist/types/imagebitmap.umd.cjs +1 -1
  96. package/dist/types/imagebitmap.umd.cjs.map +1 -1
  97. package/dist/types/imagedata.d.ts +1 -1
  98. package/dist/types/imagedata.umd.cjs +1 -1
  99. package/dist/types/imagedata.umd.cjs.map +1 -1
  100. package/dist/types/infinity.d.ts +1 -1
  101. package/dist/types/intl-types.d.ts +3 -3
  102. package/dist/types/intl-types.umd.cjs +1 -1
  103. package/dist/types/intl-types.umd.cjs.map +1 -1
  104. package/dist/types/map.d.ts +1 -1
  105. package/dist/types/map.umd.cjs +1 -1
  106. package/dist/types/map.umd.cjs.map +1 -1
  107. package/dist/types/nan.d.ts +1 -1
  108. package/dist/types/negative-infinity.d.ts +1 -1
  109. package/dist/types/negative-zero.d.ts +1 -1
  110. package/dist/types/nonbuiltin-ignore.d.ts +1 -1
  111. package/dist/types/nonbuiltin-ignore.umd.cjs +1 -1
  112. package/dist/types/nonbuiltin-ignore.umd.cjs.map +1 -1
  113. package/dist/types/primitive-objects.d.ts +1 -1
  114. package/dist/types/primitive-objects.umd.cjs +1 -1
  115. package/dist/types/primitive-objects.umd.cjs.map +1 -1
  116. package/dist/types/regexp.d.ts +1 -1
  117. package/dist/types/regexp.umd.cjs +1 -1
  118. package/dist/types/regexp.umd.cjs.map +1 -1
  119. package/dist/types/resurrectable.d.ts +1 -1
  120. package/dist/types/resurrectable.umd.cjs +1 -1
  121. package/dist/types/resurrectable.umd.cjs.map +1 -1
  122. package/dist/types/set.d.ts +1 -1
  123. package/dist/types/set.umd.cjs +1 -1
  124. package/dist/types/set.umd.cjs.map +1 -1
  125. package/dist/types/typed-arrays-socketio.d.ts +1 -1
  126. package/dist/types/typed-arrays-socketio.umd.cjs +1 -1
  127. package/dist/types/typed-arrays-socketio.umd.cjs.map +1 -1
  128. package/dist/types/typed-arrays.d.ts +1 -1
  129. package/dist/types/typed-arrays.umd.cjs +1 -1
  130. package/dist/types/typed-arrays.umd.cjs.map +1 -1
  131. package/dist/types/undef.d.ts +1 -1
  132. package/dist/types/undef.umd.cjs +1 -1
  133. package/dist/types/undef.umd.cjs.map +1 -1
  134. package/dist/types/user-object.d.ts +1 -1
  135. package/dist/types/user-object.umd.cjs +1 -1
  136. package/dist/types/user-object.umd.cjs.map +1 -1
  137. package/dist/utils/generateUUID.d.ts.map +1 -1
  138. package/package.json +51 -49
  139. package/polyfills/createObjectURL.js +5 -9
  140. package/polyfills/createObjectURL.umd.cjs +1 -1
  141. package/polyfills/createObjectURL.umd.cjs.map +1 -1
  142. package/utils/generateUUID.js +1 -9
  143. package/tools/append-to-declaration-files.js +0 -13
@@ -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,119 +446,12 @@
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");
398
- }
399
- }
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.");
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;
472
454
  }
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
455
  }
479
456
 
480
457
  function ownKeys(e, t) {
@@ -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
  }
@@ -1377,6 +1363,11 @@
1377
1363
  * @param {ArrayBuffer} buf
1378
1364
  * @returns {string}
1379
1365
  */
1366
+ function arraybuffer2string(buf) {
1367
+ return new Uint8Array(buf).reduce(function (s, _byte) {
1368
+ return s + String.fromCodePoint(_byte);
1369
+ }, '');
1370
+ }
1380
1371
 
1381
1372
  /**
1382
1373
  *
@@ -1435,11 +1426,10 @@
1435
1426
  // eslint-disable-next-line unicorn/prefer-code-point -- Iterating char. codes
1436
1427
  array[i] = str.charCodeAt(i); // & 0xff;
1437
1428
  }
1438
-
1439
1429
  return array.buffer;
1440
1430
  }
1441
1431
 
1442
- /* globals XMLHttpRequest, Blob, FileReader */
1432
+ /* globals XMLHttpRequest, FileReader */
1443
1433
 
1444
1434
  /**
1445
1435
  * @type {import('typeson').TypeSpecSet}
@@ -1467,8 +1457,8 @@
1467
1457
  };
1468
1458
  },
1469
1459
  revive: function revive(obj) {
1470
- var type = /** @type {{type: string, stringContents: string}} */obj.type,
1471
- stringContents = /** @type {{type: string, stringContents: string}} */obj.stringContents;
1460
+ var type = ( /** @type {{type: string, stringContents: string}} */obj).type,
1461
+ stringContents = ( /** @type {{type: string, stringContents: string}} */obj).stringContents;
1472
1462
  return new Blob([string2arraybuffer(stringContents)], {
1473
1463
  type: type
1474
1464
  });
@@ -1485,7 +1475,7 @@
1485
1475
  reader.addEventListener('load', function () {
1486
1476
  resolve({
1487
1477
  type: b.type,
1488
- stringContents: reader.result
1478
+ stringContents: arraybuffer2string( /** @type {ArrayBuffer} */reader.result)
1489
1479
  });
1490
1480
  });
1491
1481
  // Seems not feasible to accurately simulate
@@ -1493,14 +1483,14 @@
1493
1483
  reader.addEventListener('error', function () {
1494
1484
  reject(reader.error);
1495
1485
  });
1496
- reader.readAsBinaryString(b);
1486
+ // eslint-disable-next-line @stylistic/max-len -- Long
1487
+ // eslint-disable-next-line unicorn/prefer-blob-reading-methods -- Too new?
1488
+ reader.readAsArrayBuffer(b);
1497
1489
  });
1498
1490
  }
1499
1491
  }
1500
1492
  };
1501
1493
 
1502
- // The `performance` global is optional
1503
-
1504
1494
  /**
1505
1495
  * @todo We could use `import generateUUID from 'uuid/v4';` (but it needs
1506
1496
  * crypto library, etc.; `rollup-plugin-node-builtins` doesn't recommend
@@ -1511,10 +1501,7 @@
1511
1501
  function generateUUID() {
1512
1502
  // Adapted from original: public domain/MIT: http://stackoverflow.com/a/8809472/271577
1513
1503
  /* c8 ignore next */
1514
- var d = Date.now() + (
1515
- // use high-precision timer if available
1516
- /* c8 ignore next 4 */
1517
- typeof performance !== 'undefined' && typeof performance.now === 'function' ? performance.now() : 0);
1504
+ var d = Date.now();
1518
1505
 
1519
1506
  // eslint-disable-next-line @stylistic/max-len -- Long
1520
1507
  // eslint-disable-next-line no-use-extend-native/no-use-extend-native -- Need to update plugin
@@ -1550,8 +1537,8 @@
1550
1537
  };
1551
1538
  },
1552
1539
  revive: function revive(obj) {
1553
- var uuid = /** @type {{uuid: string, encapsulated: any}} */obj.uuid,
1554
- encapsulated = /** @type {{uuid: string, encapsulated: any}} */obj.encapsulated;
1540
+ var uuid = ( /** @type {{uuid: string, encapsulated: any}} */obj).uuid,
1541
+ encapsulated = ( /** @type {{uuid: string, encapsulated: any}} */obj).encapsulated;
1555
1542
  return cloneableObjectsByUUID[uuid][Symbol["for"]('cloneRevive')](encapsulated);
1556
1543
  }
1557
1544
  }
@@ -1603,7 +1590,7 @@
1603
1590
  }());
1604
1591
  },
1605
1592
  revive: function revive(obj) {
1606
- var jwk =
1593
+ var jwk = (
1607
1594
  /**
1608
1595
  * @type {{
1609
1596
  * jwk: JsonWebKey,
@@ -1611,8 +1598,8 @@
1611
1598
  * usages: KeyUsage[]
1612
1599
  * }}
1613
1600
  */
1614
- obj.jwk,
1615
- algorithm =
1601
+ obj).jwk,
1602
+ algorithm = (
1616
1603
  /**
1617
1604
  * @type {{
1618
1605
  * jwk: JsonWebKey,
@@ -1620,8 +1607,8 @@
1620
1607
  * usages: KeyUsage[]
1621
1608
  * }}
1622
1609
  */
1623
- obj.algorithm,
1624
- usages =
1610
+ obj).algorithm,
1611
+ usages = (
1625
1612
  /**
1626
1613
  * @type {{
1627
1614
  * jwk: JsonWebKey,
@@ -1629,7 +1616,7 @@
1629
1616
  * usages: KeyUsage[]
1630
1617
  * }}
1631
1618
  */
1632
- obj.usages;
1619
+ obj).usages;
1633
1620
  return crypto.subtle.importKey('jwk', jwk, algorithm, true, usages);
1634
1621
  }
1635
1622
  }
@@ -1667,6 +1654,7 @@
1667
1654
  stateObj.buffers.push(buffer);
1668
1655
  return {
1669
1656
  encoded: encode(buffer),
1657
+ maxByteLength: buffer.maxByteLength,
1670
1658
  byteOffset: byteOffset,
1671
1659
  byteLength: byteLength
1672
1660
  };
@@ -1684,12 +1672,16 @@
1684
1672
  var byteOffset = b64Obj.byteOffset,
1685
1673
  byteLength = b64Obj.byteLength,
1686
1674
  encoded = b64Obj.encoded,
1687
- index = b64Obj.index;
1675
+ index = b64Obj.index,
1676
+ maxByteLength = b64Obj.maxByteLength;
1688
1677
  var buffer;
1689
1678
  if ('index' in b64Obj) {
1690
1679
  buffer = stateObj.buffers[index];
1691
1680
  } else {
1692
- buffer = decode(encoded);
1681
+ buffer = decode(encoded, /* c8 ignore next 3 -- Depends on Node version */
1682
+ maxByteLength === undefined ? maxByteLength : {
1683
+ maxByteLength: maxByteLength
1684
+ });
1693
1685
  stateObj.buffers.push(buffer);
1694
1686
  }
1695
1687
  return new DataView(buffer, byteOffset, byteLength);
@@ -2055,15 +2047,15 @@
2055
2047
  * columnNumber?: import('typeson').Integer
2056
2048
  * }}
2057
2049
  */
2058
- isAggregateError ? new /** @type {AggregateErrorConstructor} */
2059
- Ctor(obj.errors, obj.message) : new
2050
+ isAggregateError ? new ( /** @type {AggregateErrorConstructor} */
2051
+ Ctor)(obj.errors, obj.message) : new (
2060
2052
  /**
2061
2053
  * @type {TypeErrorConstructor|RangeErrorConstructor|
2062
2054
  * SyntaxErrorConstructor|ReferenceErrorConstructor|
2063
2055
  * EvalErrorConstructor|URIErrorConstructor|
2064
2056
  * InternalErrorConstructor}
2065
2057
  */
2066
- Ctor(obj.message);
2058
+ Ctor)(obj.message);
2067
2059
  e.name = obj.name;
2068
2060
  e.cause = obj.cause;
2069
2061
  e.stack = obj.stack;
@@ -2075,7 +2067,7 @@
2075
2067
  };
2076
2068
  }
2077
2069
 
2078
- /* globals XMLHttpRequest, File, FileReader */
2070
+ /* globals XMLHttpRequest, FileReader */
2079
2071
 
2080
2072
  /**
2081
2073
  * @type {import('typeson').TypeSpecSet}
@@ -2126,7 +2118,7 @@
2126
2118
  reader.addEventListener('load', function () {
2127
2119
  resolve({
2128
2120
  type: f.type,
2129
- stringContents: reader.result,
2121
+ stringContents: arraybuffer2string( /** @type {ArrayBuffer} */reader.result),
2130
2122
  name: f.name,
2131
2123
  lastModified: f.lastModified
2132
2124
  });
@@ -2136,7 +2128,9 @@
2136
2128
  reader.addEventListener('error', function () {
2137
2129
  reject(reader.error);
2138
2130
  });
2139
- reader.readAsBinaryString(f);
2131
+ // eslint-disable-next-line @stylistic/max-len -- Long
2132
+ // eslint-disable-next-line unicorn/prefer-blob-reading-methods -- Too new?
2133
+ reader.readAsArrayBuffer(f);
2140
2134
  });
2141
2135
  }
2142
2136
  }
@@ -2162,7 +2156,7 @@
2162
2156
  /**
2163
2157
  * `FileList` polyfill.
2164
2158
  */
2165
- var FileList = /*#__PURE__*/function (_Symbol$toStringTag) {
2159
+ var FileList = /*#__PURE__*/function () {
2166
2160
  /**
2167
2161
  * Set private properties and length.
2168
2162
  */
@@ -2176,7 +2170,7 @@
2176
2170
  * @param {import('typeson').Integer} index
2177
2171
  * @returns {File}
2178
2172
  */
2179
- _createClass$1(FileList, [{
2173
+ return _createClass$1(FileList, [{
2180
2174
  key: "item",
2181
2175
  value: function item(index) {
2182
2176
  return this._files[index];
@@ -2186,14 +2180,13 @@
2186
2180
  * @returns {"FileList"}
2187
2181
  */
2188
2182
  }, {
2189
- key: _Symbol$toStringTag,
2183
+ key: Symbol.toStringTag,
2190
2184
  get: function get() {
2191
2185
  /* eslint-enable class-methods-use-this */
2192
2186
  return 'FileList';
2193
2187
  }
2194
2188
  }]);
2195
- return FileList;
2196
- }(Symbol.toStringTag);
2189
+ }();
2197
2190
  return new FileList(o);
2198
2191
  }
2199
2192
  }
@@ -2215,15 +2208,15 @@
2215
2208
  var ctx = /** @type {CanvasRenderingContext2D} */
2216
2209
  canvas.getContext('2d');
2217
2210
  ctx.drawImage(bm, 0, 0);
2218
- // Although `width` and `height` are part of `ImageBitMap`,
2219
- // these will be auto-created for us when reviving with the
2220
- // data URL (and they are not settable even if they weren't)
2221
- // return {
2222
- // width: bm.width, height: bm.height, dataURL: canvas.toDataURL()
2223
- // };
2224
- return canvas.toDataURL();
2211
+ return {
2212
+ width: bm.width,
2213
+ height: bm.height,
2214
+ dataURL: canvas.toDataURL()
2215
+ };
2225
2216
  },
2226
2217
  revive: function revive(o) {
2218
+ var canvas = typeof OffscreenCanvas === 'undefined' ? document.createElement('canvas')
2219
+ /* c8 ignore next -- Browser only */ : new OffscreenCanvas(o.width, o.height);
2227
2220
  /*
2228
2221
  var req = new XMLHttpRequest();
2229
2222
  req.open('GET', o, false); // Sync
@@ -2233,7 +2226,6 @@
2233
2226
  req.send();
2234
2227
  return req.responseText;
2235
2228
  */
2236
- var canvas = document.createElement('canvas');
2237
2229
  var ctx = /** @type {CanvasRenderingContext2D} */
2238
2230
  canvas.getContext('2d');
2239
2231
  var img = document.createElement('img');
@@ -2241,10 +2233,11 @@
2241
2233
  img.addEventListener('load', function () {
2242
2234
  ctx.drawImage(img, 0, 0);
2243
2235
  });
2244
- img.src = o;
2236
+ img.src = o.dataURL;
2245
2237
  // Works in contexts allowing an `ImageBitmap` (We might use
2246
2238
  // `OffscreenCanvas.transferToBitmap` when supported)
2247
- return canvas;
2239
+ return typeof OffscreenCanvas === 'undefined' ? canvas
2240
+ /* c8 ignore next 3 -- Browser only */ : /** @type {OffscreenCanvas} */canvas.transferToImageBitmap();
2248
2241
  },
2249
2242
  reviveAsync: function reviveAsync(o) {
2250
2243
  var canvas = document.createElement('canvas');
@@ -2255,8 +2248,7 @@
2255
2248
  img.addEventListener('load', function () {
2256
2249
  ctx.drawImage(img, 0, 0);
2257
2250
  });
2258
- img.src = o; // o.dataURL;
2259
-
2251
+ img.src = o.dataURL;
2260
2252
  return new e( /*#__PURE__*/function () {
2261
2253
  var _ref = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(resolve, reject) {
2262
2254
  var resp;
@@ -2641,11 +2633,7 @@
2641
2633
  * @returns {void}
2642
2634
  */
2643
2635
  function create(TypedArray) {
2644
- var typeName =
2645
- /**
2646
- * @type {TypedArrayConstructor & {name: string}}
2647
- */
2648
- TypedArray.name;
2636
+ var typeName = TypedArray.name;
2649
2637
  typedArrays[typeName.toLowerCase()] = {
2650
2638
  test: function test(x) {
2651
2639
  return toStringTag(x) === typeName;
@@ -2673,6 +2661,7 @@
2673
2661
  }
2674
2662
  stateObj.buffers.push(buffer);
2675
2663
  return {
2664
+ maxByteLength: buffer.maxByteLength,
2676
2665
  encoded: encode(buffer),
2677
2666
  byteOffset: byteOffset,
2678
2667
  length: l
@@ -2691,12 +2680,16 @@
2691
2680
  var byteOffset = b64Obj.byteOffset,
2692
2681
  len = b64Obj.length,
2693
2682
  encoded = b64Obj.encoded,
2694
- index = b64Obj.index;
2683
+ index = b64Obj.index,
2684
+ maxByteLength = b64Obj.maxByteLength;
2695
2685
  var buffer;
2696
2686
  if ('index' in b64Obj) {
2697
2687
  buffer = stateObj.buffers[index];
2698
2688
  } else {
2699
- buffer = decode(encoded);
2689
+ buffer = decode(encoded, /* c8 ignore next 3 -- Depends on Node version */
2690
+ maxByteLength === undefined ? undefined : {
2691
+ maxByteLength: maxByteLength
2692
+ });
2700
2693
  stateObj.buffers.push(buffer);
2701
2694
  }
2702
2695
  return new TypedArray(buffer, byteOffset, len);
@@ -2926,8 +2919,6 @@
2926
2919
  * @type {import('typeson').Preset}
2927
2920
  */
2928
2921
  var expObj = [
2929
- // Todo: Might also register synchronous `ImageBitmap` and
2930
- // `Blob`/`File`/`FileList`?
2931
2922
  // ES5
2932
2923
  userObject,
2933
2924
  // Processed last (non-builtin)
@@ -3001,7 +2992,7 @@
3001
2992
  // HTML-SPECIFIC
3002
2993
  'Event',
3003
2994
  // Also in Node `worker_threads` (currently experimental)
3004
- 'MessageChannel'].includes(stringTag) ||
2995
+ 'MessageChannel'].includes(stringTag) || (
3005
2996
  /*
3006
2997
  // isClosed is no longer documented
3007
2998
  ((stringTag === 'Blob' || stringTag === 'File') &&
@@ -3010,7 +3001,7 @@
3010
3001
  val && _typeof$1(val) === 'object' &&
3011
3002
  // Duck-type DOM node objects (non-array exotic?
3012
3003
  // objects which cannot be cloned by the SCA)
3013
- typeof val.nodeType === 'number' && typeof val.insertBefore === 'function') {
3004
+ typeof val.nodeType === 'number' && typeof val.insertBefore === 'function')) {
3014
3005
  throw new DOMException('The object cannot be cloned.', 'DataCloneError');
3015
3006
  }
3016
3007
  return false;