typeson-registry 1.0.0-alpha.7 → 2.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 (215) hide show
  1. package/{LICENSE → LICENSE-MIT.txt} +0 -0
  2. package/README.md +189 -77
  3. package/dist/index.js +1205 -0
  4. package/dist/index.js.map +1 -0
  5. package/dist/index.min.js +2 -0
  6. package/dist/index.min.js.map +1 -0
  7. package/dist/index.umd.js +2274 -0
  8. package/dist/index.umd.js.map +1 -0
  9. package/dist/index.umd.min.js +2 -0
  10. package/dist/index.umd.min.js.map +1 -0
  11. package/dist/presets/array-nonindex-keys.umd.js +2 -0
  12. package/dist/presets/array-nonindex-keys.umd.js.map +1 -0
  13. package/dist/presets/builtin.umd.js +2 -0
  14. package/dist/presets/builtin.umd.js.map +1 -0
  15. package/dist/presets/postmessage.umd.js +2 -0
  16. package/dist/presets/postmessage.umd.js.map +1 -0
  17. package/dist/presets/socketio.umd.js +2 -0
  18. package/dist/presets/socketio.umd.js.map +1 -0
  19. package/dist/presets/sparse-undefined.umd.js +2 -0
  20. package/dist/presets/sparse-undefined.umd.js.map +1 -0
  21. package/dist/presets/special-numbers.umd.js +2 -0
  22. package/dist/presets/special-numbers.umd.js.map +1 -0
  23. package/dist/presets/structured-cloning-throwing.umd.js +2 -0
  24. package/dist/presets/structured-cloning-throwing.umd.js.map +1 -0
  25. package/dist/presets/structured-cloning.umd.js +2 -0
  26. package/dist/presets/structured-cloning.umd.js.map +1 -0
  27. package/dist/presets/undef.umd.js +2 -0
  28. package/dist/presets/undef.umd.js.map +1 -0
  29. package/dist/presets/universal.umd.js +2 -0
  30. package/dist/presets/universal.umd.js.map +1 -0
  31. package/dist/types/arraybuffer.umd.js +2 -0
  32. package/dist/types/arraybuffer.umd.js.map +1 -0
  33. package/dist/types/bigint-object.umd.js +2 -0
  34. package/dist/types/bigint-object.umd.js.map +1 -0
  35. package/dist/types/bigint.umd.js +2 -0
  36. package/dist/types/bigint.umd.js.map +1 -0
  37. package/dist/types/blob.umd.js +2 -0
  38. package/dist/types/blob.umd.js.map +1 -0
  39. package/dist/types/cloneable.umd.js +2 -0
  40. package/dist/types/cloneable.umd.js.map +1 -0
  41. package/dist/types/cryptokey.umd.js +2 -0
  42. package/dist/types/cryptokey.umd.js.map +1 -0
  43. package/dist/types/dataview.umd.js +2 -0
  44. package/dist/types/dataview.umd.js.map +1 -0
  45. package/dist/types/date.umd.js +2 -0
  46. package/dist/types/date.umd.js.map +1 -0
  47. package/dist/types/error.umd.js +2 -0
  48. package/dist/types/error.umd.js.map +1 -0
  49. package/dist/types/errors.umd.js +2 -0
  50. package/dist/types/errors.umd.js.map +1 -0
  51. package/dist/types/file.umd.js +2 -0
  52. package/dist/types/file.umd.js.map +1 -0
  53. package/dist/types/filelist.umd.js +2 -0
  54. package/dist/types/filelist.umd.js.map +1 -0
  55. package/dist/types/imagebitmap.umd.js +2 -0
  56. package/dist/types/imagebitmap.umd.js.map +1 -0
  57. package/dist/types/imagedata.umd.js +2 -0
  58. package/dist/types/imagedata.umd.js.map +1 -0
  59. package/dist/types/infinity.umd.js +2 -0
  60. package/dist/types/infinity.umd.js.map +1 -0
  61. package/dist/types/intl-types.umd.js +2 -0
  62. package/dist/types/intl-types.umd.js.map +1 -0
  63. package/dist/types/map.umd.js +2 -0
  64. package/dist/types/map.umd.js.map +1 -0
  65. package/dist/types/nan.umd.js +2 -0
  66. package/dist/types/nan.umd.js.map +1 -0
  67. package/dist/types/negative-infinity.umd.js +2 -0
  68. package/dist/types/negative-infinity.umd.js.map +1 -0
  69. package/dist/types/nonbuiltin-ignore.umd.js +2 -0
  70. package/dist/types/nonbuiltin-ignore.umd.js.map +1 -0
  71. package/dist/types/primitive-objects.umd.js +2 -0
  72. package/dist/types/primitive-objects.umd.js.map +1 -0
  73. package/dist/types/regexp.umd.js +2 -0
  74. package/dist/types/regexp.umd.js.map +1 -0
  75. package/dist/types/resurrectable.umd.js +2 -0
  76. package/dist/types/resurrectable.umd.js.map +1 -0
  77. package/dist/types/set.umd.js +2 -0
  78. package/dist/types/set.umd.js.map +1 -0
  79. package/dist/types/typed-arrays-socketio.umd.js +2 -0
  80. package/dist/types/typed-arrays-socketio.umd.js.map +1 -0
  81. package/dist/types/typed-arrays.umd.js +2 -0
  82. package/dist/types/typed-arrays.umd.js.map +1 -0
  83. package/dist/types/undef.umd.js +2 -0
  84. package/dist/types/undef.umd.js.map +1 -0
  85. package/dist/types/user-object.umd.js +2 -0
  86. package/dist/types/user-object.umd.js.map +1 -0
  87. package/package.json +98 -27
  88. package/polyfills/createObjectURL.js +96 -0
  89. package/polyfills/createObjectURL.umd.js +2 -0
  90. package/polyfills/createObjectURL.umd.js.map +1 -0
  91. package/utils/generateUUID.js +29 -0
  92. package/utils/stringArrayBuffer.js +72 -0
  93. package/CHANGES +0 -126
  94. package/browser-test/index.html +0 -30
  95. package/browser-test/testLoading.js +0 -57
  96. package/browser-test/worker.html +0 -31
  97. package/browser-test/worker.js +0 -16
  98. package/build.js +0 -99
  99. package/dist/all.js +0 -126
  100. package/dist/all.js.map +0 -89
  101. package/dist/presets/builtin.js +0 -78
  102. package/dist/presets/builtin.js.map +0 -59
  103. package/dist/presets/post-message.js +0 -21
  104. package/dist/presets/post-message.js.map +0 -23
  105. package/dist/presets/socketio.js +0 -87
  106. package/dist/presets/socketio.js.map +0 -63
  107. package/dist/presets/sparse-undefined.js +0 -12
  108. package/dist/presets/sparse-undefined.js.map +0 -19
  109. package/dist/presets/special-numbers.js +0 -21
  110. package/dist/presets/special-numbers.js.map +0 -25
  111. package/dist/presets/structured-cloning-throwing.js +0 -90
  112. package/dist/presets/structured-cloning-throwing.js.map +0 -69
  113. package/dist/presets/structured-cloning.js +0 -87
  114. package/dist/presets/structured-cloning.js.map +0 -67
  115. package/dist/presets/undefined.js +0 -18
  116. package/dist/presets/undefined.js.map +0 -23
  117. package/dist/presets/universal.js +0 -81
  118. package/dist/presets/universal.js.map +0 -61
  119. package/dist/types/Infinity.js +0 -12
  120. package/dist/types/Infinity.js.map +0 -19
  121. package/dist/types/NaN.js +0 -12
  122. package/dist/types/NaN.js.map +0 -19
  123. package/dist/types/NegativeInfinity.js +0 -12
  124. package/dist/types/NegativeInfinity.js.map +0 -19
  125. package/dist/types/arraybuffer.js +0 -15
  126. package/dist/types/arraybuffer.js.map +0 -21
  127. package/dist/types/blob.js +0 -12
  128. package/dist/types/blob.js.map +0 -19
  129. package/dist/types/cloneable.js +0 -12
  130. package/dist/types/cloneable.js.map +0 -19
  131. package/dist/types/dataview.js +0 -15
  132. package/dist/types/dataview.js.map +0 -21
  133. package/dist/types/date.js +0 -12
  134. package/dist/types/date.js.map +0 -19
  135. package/dist/types/error.js +0 -12
  136. package/dist/types/error.js.map +0 -19
  137. package/dist/types/errors.js +0 -15
  138. package/dist/types/errors.js.map +0 -19
  139. package/dist/types/file.js +0 -12
  140. package/dist/types/file.js.map +0 -19
  141. package/dist/types/filelist.js +0 -15
  142. package/dist/types/filelist.js.map +0 -21
  143. package/dist/types/imagebitmap.js +0 -12
  144. package/dist/types/imagebitmap.js.map +0 -19
  145. package/dist/types/imagedata.js +0 -12
  146. package/dist/types/imagedata.js.map +0 -19
  147. package/dist/types/intl-types.js +0 -12
  148. package/dist/types/intl-types.js.map +0 -19
  149. package/dist/types/map.js +0 -15
  150. package/dist/types/map.js.map +0 -21
  151. package/dist/types/nonbuiltin-ignore.js +0 -12
  152. package/dist/types/nonbuiltin-ignore.js.map +0 -19
  153. package/dist/types/primitive-objects.js +0 -12
  154. package/dist/types/primitive-objects.js.map +0 -19
  155. package/dist/types/regexp.js +0 -12
  156. package/dist/types/regexp.js.map +0 -19
  157. package/dist/types/resurrectable.js +0 -12
  158. package/dist/types/resurrectable.js.map +0 -19
  159. package/dist/types/set.js +0 -15
  160. package/dist/types/set.js.map +0 -21
  161. package/dist/types/special-numbers.js +0 -12
  162. package/dist/types/special-numbers.js.map +0 -19
  163. package/dist/types/typed-arrays-socketio.js +0 -15
  164. package/dist/types/typed-arrays-socketio.js.map +0 -19
  165. package/dist/types/typed-arrays.js +0 -18
  166. package/dist/types/typed-arrays.js.map +0 -21
  167. package/dist/types/undefined.js +0 -12
  168. package/dist/types/undefined.js.map +0 -19
  169. package/dist/types/user-object.js +0 -12
  170. package/dist/types/user-object.js.map +0 -19
  171. package/index.js +0 -39
  172. package/presets/builtin.js +0 -24
  173. package/presets/post-message.js +0 -15
  174. package/presets/socketio.js +0 -5
  175. package/presets/sparse-undefined.js +0 -19
  176. package/presets/special-numbers.js +0 -5
  177. package/presets/structured-cloning-throwing.js +0 -32
  178. package/presets/structured-cloning.js +0 -24
  179. package/presets/undefined.js +0 -4
  180. package/presets/universal.js +0 -4
  181. package/server.js +0 -10
  182. package/test/Flag_of_the_United_Nations.png +0 -0
  183. package/test/createObjectURL.js +0 -28
  184. package/test/test-entry.js +0 -49
  185. package/test/test-environment.js +0 -119
  186. package/test/test-node.js +0 -56
  187. package/test/test-utils.js +0 -38
  188. package/test/test.js +0 -885
  189. package/types/Infinity.js +0 -5
  190. package/types/NaN.js +0 -5
  191. package/types/NegativeInfinity.js +0 -5
  192. package/types/arraybuffer.js +0 -9
  193. package/types/blob.js +0 -36
  194. package/types/cloneable.js +0 -30
  195. package/types/dataview.js +0 -7
  196. package/types/date.js +0 -17
  197. package/types/error.js +0 -11
  198. package/types/errors.js +0 -20
  199. package/types/file.js +0 -41
  200. package/types/filelist.js +0 -23
  201. package/types/imagebitmap.js +0 -49
  202. package/types/imagedata.js +0 -14
  203. package/types/intl-types.js +0 -18
  204. package/types/map.js +0 -7
  205. package/types/nonbuiltin-ignore.js +0 -16
  206. package/types/primitive-objects.js +0 -23
  207. package/types/regexp.js +0 -11
  208. package/types/resurrectable.js +0 -28
  209. package/types/set.js +0 -7
  210. package/types/typed-arrays-socketio.js +0 -32
  211. package/types/typed-arrays.js +0 -23
  212. package/types/undefined.js +0 -9
  213. package/types/user-object.js +0 -6
  214. package/utils/array-from-iterator.js +0 -7
  215. package/windows-devinstall.js +0 -41
@@ -0,0 +1,2274 @@
1
+ (function (global, factory) {
2
+ typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports) :
3
+ typeof define === 'function' && define.amd ? define(['exports'], factory) :
4
+ (global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory(global.TypesonNamespace = {}));
5
+ })(this, (function (exports) { 'use strict';
6
+
7
+ function ownKeys$1(object, enumerableOnly) {
8
+ var keys = Object.keys(object);
9
+
10
+ if (Object.getOwnPropertySymbols) {
11
+ var symbols = Object.getOwnPropertySymbols(object);
12
+ enumerableOnly && (symbols = symbols.filter(function (sym) {
13
+ return Object.getOwnPropertyDescriptor(object, sym).enumerable;
14
+ })), keys.push.apply(keys, symbols);
15
+ }
16
+
17
+ return keys;
18
+ }
19
+
20
+ function _objectSpread2$1(target) {
21
+ for (var i = 1; i < arguments.length; i++) {
22
+ var source = null != arguments[i] ? arguments[i] : {};
23
+ i % 2 ? ownKeys$1(Object(source), !0).forEach(function (key) {
24
+ _defineProperty$1(target, key, source[key]);
25
+ }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys$1(Object(source)).forEach(function (key) {
26
+ Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key));
27
+ });
28
+ }
29
+
30
+ return target;
31
+ }
32
+
33
+ function _typeof$1(obj) {
34
+ "@babel/helpers - typeof";
35
+
36
+ return _typeof$1 = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) {
37
+ return typeof obj;
38
+ } : function (obj) {
39
+ return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj;
40
+ }, _typeof$1(obj);
41
+ }
42
+
43
+ function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) {
44
+ try {
45
+ var info = gen[key](arg);
46
+ var value = info.value;
47
+ } catch (error) {
48
+ reject(error);
49
+ return;
50
+ }
51
+
52
+ if (info.done) {
53
+ resolve(value);
54
+ } else {
55
+ Promise.resolve(value).then(_next, _throw);
56
+ }
57
+ }
58
+
59
+ function _asyncToGenerator(fn) {
60
+ return function () {
61
+ var self = this,
62
+ args = arguments;
63
+ return new Promise(function (resolve, reject) {
64
+ var gen = fn.apply(self, args);
65
+
66
+ function _next(value) {
67
+ asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value);
68
+ }
69
+
70
+ function _throw(err) {
71
+ asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err);
72
+ }
73
+
74
+ _next(undefined);
75
+ });
76
+ };
77
+ }
78
+
79
+ function _classCallCheck$1(instance, Constructor) {
80
+ if (!(instance instanceof Constructor)) {
81
+ throw new TypeError("Cannot call a class as a function");
82
+ }
83
+ }
84
+
85
+ function _defineProperties$1(target, props) {
86
+ for (var i = 0; i < props.length; i++) {
87
+ var descriptor = props[i];
88
+ descriptor.enumerable = descriptor.enumerable || false;
89
+ descriptor.configurable = true;
90
+ if ("value" in descriptor) descriptor.writable = true;
91
+ Object.defineProperty(target, descriptor.key, descriptor);
92
+ }
93
+ }
94
+
95
+ function _createClass$1(Constructor, protoProps, staticProps) {
96
+ if (protoProps) _defineProperties$1(Constructor.prototype, protoProps);
97
+ if (staticProps) _defineProperties$1(Constructor, staticProps);
98
+ Object.defineProperty(Constructor, "prototype", {
99
+ writable: false
100
+ });
101
+ return Constructor;
102
+ }
103
+
104
+ function _defineProperty$1(obj, key, value) {
105
+ if (key in obj) {
106
+ Object.defineProperty(obj, key, {
107
+ value: value,
108
+ enumerable: true,
109
+ configurable: true,
110
+ writable: true
111
+ });
112
+ } else {
113
+ obj[key] = value;
114
+ }
115
+
116
+ return obj;
117
+ }
118
+
119
+ function _toConsumableArray$1(arr) {
120
+ return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray$1(arr) || _nonIterableSpread();
121
+ }
122
+
123
+ function _arrayWithoutHoles(arr) {
124
+ if (Array.isArray(arr)) return _arrayLikeToArray$1(arr);
125
+ }
126
+
127
+ function _iterableToArray(iter) {
128
+ if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter);
129
+ }
130
+
131
+ function _unsupportedIterableToArray$1(o, minLen) {
132
+ if (!o) return;
133
+ if (typeof o === "string") return _arrayLikeToArray$1(o, minLen);
134
+ var n = Object.prototype.toString.call(o).slice(8, -1);
135
+ if (n === "Object" && o.constructor) n = o.constructor.name;
136
+ if (n === "Map" || n === "Set") return Array.from(o);
137
+ if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray$1(o, minLen);
138
+ }
139
+
140
+ function _arrayLikeToArray$1(arr, len) {
141
+ if (len == null || len > arr.length) len = arr.length;
142
+
143
+ for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i];
144
+
145
+ return arr2;
146
+ }
147
+
148
+ function _nonIterableSpread() {
149
+ throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
150
+ }
151
+
152
+ function ownKeys(e, t) {
153
+ var r = Object.keys(e);
154
+
155
+ if (Object.getOwnPropertySymbols) {
156
+ var n = Object.getOwnPropertySymbols(e);
157
+ t && (n = n.filter(function (t) {
158
+ return Object.getOwnPropertyDescriptor(e, t).enumerable;
159
+ })), r.push.apply(r, n);
160
+ }
161
+
162
+ return r;
163
+ }
164
+
165
+ function _objectSpread2(e) {
166
+ for (var t = 1; t < arguments.length; t++) {
167
+ var r = null != arguments[t] ? arguments[t] : {};
168
+ t % 2 ? ownKeys(Object(r), !0).forEach(function (t) {
169
+ _defineProperty(e, t, r[t]);
170
+ }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(r)) : ownKeys(Object(r)).forEach(function (t) {
171
+ Object.defineProperty(e, t, Object.getOwnPropertyDescriptor(r, t));
172
+ });
173
+ }
174
+
175
+ return e;
176
+ }
177
+
178
+ function _typeof(e) {
179
+ return (_typeof = "function" == typeof Symbol && "symbol" == _typeof$1(Symbol.iterator) ? function (e) {
180
+ return _typeof$1(e);
181
+ } : function (e) {
182
+ return e && "function" == typeof Symbol && e.constructor === Symbol && e !== Symbol.prototype ? "symbol" : _typeof$1(e);
183
+ })(e);
184
+ }
185
+
186
+ function _classCallCheck(e, t) {
187
+ if (!(e instanceof t)) throw new TypeError("Cannot call a class as a function");
188
+ }
189
+
190
+ function _defineProperties(e, t) {
191
+ for (var r = 0; r < t.length; r++) {
192
+ var n = t[r];
193
+ n.enumerable = n.enumerable || !1, n.configurable = !0, "value" in n && (n.writable = !0), Object.defineProperty(e, n.key, n);
194
+ }
195
+ }
196
+
197
+ function _createClass(e, t, r) {
198
+ return t && _defineProperties(e.prototype, t), r && _defineProperties(e, r), Object.defineProperty(e, "prototype", {
199
+ writable: !1
200
+ }), e;
201
+ }
202
+
203
+ function _defineProperty(e, t, r) {
204
+ return t in e ? Object.defineProperty(e, t, {
205
+ value: r,
206
+ enumerable: !0,
207
+ configurable: !0,
208
+ writable: !0
209
+ }) : e[t] = r, e;
210
+ }
211
+
212
+ function _slicedToArray(e, t) {
213
+ return function _arrayWithHoles(e) {
214
+ if (Array.isArray(e)) return e;
215
+ }(e) || function _iterableToArrayLimit(e, t) {
216
+ var r = null == e ? null : "undefined" != typeof Symbol && e[Symbol.iterator] || e["@@iterator"];
217
+ if (null == r) return;
218
+ var n,
219
+ a,
220
+ o = [],
221
+ i = !0,
222
+ c = !1;
223
+
224
+ try {
225
+ for (r = r.call(e); !(i = (n = r.next()).done) && (o.push(n.value), !t || o.length !== t); i = !0) {
226
+ ;
227
+ }
228
+ } catch (e) {
229
+ c = !0, a = e;
230
+ } finally {
231
+ try {
232
+ i || null == r["return"] || r["return"]();
233
+ } finally {
234
+ if (c) throw a;
235
+ }
236
+ }
237
+
238
+ return o;
239
+ }(e, t) || _unsupportedIterableToArray(e, t) || function _nonIterableRest() {
240
+ throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
241
+ }();
242
+ }
243
+
244
+ function _toConsumableArray(e) {
245
+ return function _arrayWithoutHoles(e) {
246
+ if (Array.isArray(e)) return _arrayLikeToArray(e);
247
+ }(e) || function _iterableToArray(e) {
248
+ if ("undefined" != typeof Symbol && null != e[Symbol.iterator] || null != e["@@iterator"]) return Array.from(e);
249
+ }(e) || _unsupportedIterableToArray(e) || function _nonIterableSpread() {
250
+ throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
251
+ }();
252
+ }
253
+
254
+ function _unsupportedIterableToArray(e, t) {
255
+ if (e) {
256
+ if ("string" == typeof e) return _arrayLikeToArray(e, t);
257
+ var r = Object.prototype.toString.call(e).slice(8, -1);
258
+ return "Object" === r && e.constructor && (r = e.constructor.name), "Map" === r || "Set" === r ? Array.from(e) : "Arguments" === r || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r) ? _arrayLikeToArray(e, t) : void 0;
259
+ }
260
+ }
261
+
262
+ function _arrayLikeToArray(e, t) {
263
+ (null == t || t > e.length) && (t = e.length);
264
+
265
+ for (var r = 0, n = new Array(t); r < t; r++) {
266
+ n[r] = e[r];
267
+ }
268
+
269
+ return n;
270
+ }
271
+
272
+ var e = _createClass(function TypesonPromise(e) {
273
+ _classCallCheck(this, TypesonPromise), this.p = new Promise(e);
274
+ });
275
+
276
+ e.__typeson__type__ = "TypesonPromise", "undefined" != typeof Symbol && (e.prototype[Symbol.toStringTag] = "TypesonPromise"), e.prototype.then = function (t, r) {
277
+ var n = this;
278
+ return new e(function (e, a) {
279
+ n.p.then(function (r) {
280
+ e(t ? t(r) : r);
281
+ })["catch"](function (e) {
282
+ return r ? r(e) : Promise.reject(e);
283
+ }).then(e, a);
284
+ });
285
+ }, e.prototype["catch"] = function (e) {
286
+ return this.then(null, e);
287
+ }, e.resolve = function (t) {
288
+ return new e(function (e) {
289
+ e(t);
290
+ });
291
+ }, e.reject = function (t) {
292
+ return new e(function (e, r) {
293
+ r(t);
294
+ });
295
+ }, ["all", "race", "allSettled"].forEach(function (t) {
296
+ e[t] = function (r) {
297
+ return new e(function (e, n) {
298
+ Promise[t](r.map(function (e) {
299
+ return e && e.constructor && "TypesonPromise" === e.constructor.__typeson__type__ ? e.p : e;
300
+ })).then(e, n);
301
+ });
302
+ };
303
+ });
304
+ var t = {}.toString,
305
+ r = {}.hasOwnProperty,
306
+ n = Object.getPrototypeOf,
307
+ a = r.toString;
308
+
309
+ function isThenable(e, t) {
310
+ return isObject(e) && "function" == typeof e.then && (!t || "function" == typeof e["catch"]);
311
+ }
312
+
313
+ function toStringTag(e) {
314
+ return t.call(e).slice(8, -1);
315
+ }
316
+
317
+ function hasConstructorOf(e, t) {
318
+ if (!e || "object" !== _typeof(e)) return !1;
319
+ var o = n(e);
320
+ if (!o) return null === t;
321
+ var i = r.call(o, "constructor") && o.constructor;
322
+ return "function" != typeof i ? null === t : t === i || null !== t && a.call(i) === a.call(t) || "function" == typeof t && "string" == typeof i.__typeson__type__ && i.__typeson__type__ === t.__typeson__type__;
323
+ }
324
+
325
+ function isPlainObject(e) {
326
+ return !(!e || "Object" !== toStringTag(e)) && (!n(e) || hasConstructorOf(e, Object));
327
+ }
328
+
329
+ function isUserObject(e) {
330
+ if (!e || "Object" !== toStringTag(e)) return !1;
331
+ var t = n(e);
332
+ return !t || hasConstructorOf(e, Object) || isUserObject(t);
333
+ }
334
+
335
+ function isObject(e) {
336
+ return e && "object" === _typeof(e);
337
+ }
338
+
339
+ function escapeKeyPathComponent(e) {
340
+ return e.replace(/~/g, "~0").replace(/\./g, "~1");
341
+ }
342
+
343
+ function unescapeKeyPathComponent(e) {
344
+ return e.replace(/~1/g, ".").replace(/~0/g, "~");
345
+ }
346
+
347
+ function getByKeyPath(e, t) {
348
+ if ("" === t) return e;
349
+ var r = t.indexOf(".");
350
+
351
+ if (r > -1) {
352
+ var n = e[unescapeKeyPathComponent(t.slice(0, r))];
353
+ return void 0 === n ? void 0 : getByKeyPath(n, t.slice(r + 1));
354
+ }
355
+
356
+ return e[unescapeKeyPathComponent(t)];
357
+ }
358
+
359
+ function setAtKeyPath(e, t, r) {
360
+ if ("" === t) return r;
361
+ var n = t.indexOf(".");
362
+ return n > -1 ? setAtKeyPath(e[unescapeKeyPathComponent(t.slice(0, n))], t.slice(n + 1), r) : (e[unescapeKeyPathComponent(t)] = r, e);
363
+ }
364
+
365
+ function getJSONType(e) {
366
+ return null === e ? "null" : Array.isArray(e) ? "array" : _typeof(e);
367
+ }
368
+
369
+ function _await(e, t, r) {
370
+ return r ? t ? t(e) : e : (e && e.then || (e = Promise.resolve(e)), t ? e.then(t) : e);
371
+ }
372
+
373
+ var o = Object.keys,
374
+ i$1 = Array.isArray,
375
+ c = {}.hasOwnProperty,
376
+ s = ["type", "replaced", "iterateIn", "iterateUnsetNumeric"];
377
+
378
+ function _async(e) {
379
+ return function () {
380
+ for (var t = [], r = 0; r < arguments.length; r++) {
381
+ t[r] = arguments[r];
382
+ }
383
+
384
+ try {
385
+ return Promise.resolve(e.apply(this, t));
386
+ } catch (e) {
387
+ return Promise.reject(e);
388
+ }
389
+ };
390
+ }
391
+
392
+ function nestedPathsFirst(e, t) {
393
+ if ("" === e.keypath) return -1;
394
+ var r = e.keypath.match(/\./g) || 0,
395
+ n = t.keypath.match(/\./g) || 0;
396
+ return r && (r = r.length), n && (n = n.length), r > n ? -1 : r < n ? 1 : e.keypath < t.keypath ? -1 : e.keypath > t.keypath;
397
+ }
398
+
399
+ var u = function () {
400
+ function Typeson(e) {
401
+ _classCallCheck(this, Typeson), this.options = e, this.plainObjectReplacers = [], this.nonplainObjectReplacers = [], this.revivers = {}, this.types = {};
402
+ }
403
+
404
+ return _createClass(Typeson, [{
405
+ key: "stringify",
406
+ value: function stringify(e, t, r, n) {
407
+ n = _objectSpread2(_objectSpread2(_objectSpread2({}, this.options), n), {}, {
408
+ stringification: !0
409
+ });
410
+ var a = this.encapsulate(e, null, n);
411
+ return i$1(a) ? JSON.stringify(a[0], t, r) : a.then(function (e) {
412
+ return JSON.stringify(e, t, r);
413
+ });
414
+ }
415
+ }, {
416
+ key: "stringifySync",
417
+ value: function stringifySync(e, t, r, n) {
418
+ return this.stringify(e, t, r, _objectSpread2(_objectSpread2({
419
+ throwOnBadSyncType: !0
420
+ }, n), {}, {
421
+ sync: !0
422
+ }));
423
+ }
424
+ }, {
425
+ key: "stringifyAsync",
426
+ value: function stringifyAsync(e, t, r, n) {
427
+ return this.stringify(e, t, r, _objectSpread2(_objectSpread2({
428
+ throwOnBadSyncType: !0
429
+ }, n), {}, {
430
+ sync: !1
431
+ }));
432
+ }
433
+ }, {
434
+ key: "parse",
435
+ value: function parse(e, t, r) {
436
+ return r = _objectSpread2(_objectSpread2(_objectSpread2({}, this.options), r), {}, {
437
+ parse: !0
438
+ }), this.revive(JSON.parse(e, t), r);
439
+ }
440
+ }, {
441
+ key: "parseSync",
442
+ value: function parseSync(e, t, r) {
443
+ return this.parse(e, t, _objectSpread2(_objectSpread2({
444
+ throwOnBadSyncType: !0
445
+ }, r), {}, {
446
+ sync: !0
447
+ }));
448
+ }
449
+ }, {
450
+ key: "parseAsync",
451
+ value: function parseAsync(e, t, r) {
452
+ return this.parse(e, t, _objectSpread2(_objectSpread2({
453
+ throwOnBadSyncType: !0
454
+ }, r), {}, {
455
+ sync: !1
456
+ }));
457
+ }
458
+ }, {
459
+ key: "specialTypeNames",
460
+ value: function specialTypeNames(e, t) {
461
+ var r = arguments.length > 2 && void 0 !== arguments[2] ? arguments[2] : {};
462
+ return r.returnTypeNames = !0, this.encapsulate(e, t, r);
463
+ }
464
+ }, {
465
+ key: "rootTypeName",
466
+ value: function rootTypeName(e, t) {
467
+ var r = arguments.length > 2 && void 0 !== arguments[2] ? arguments[2] : {};
468
+ return r.iterateNone = !0, this.encapsulate(e, t, r);
469
+ }
470
+ }, {
471
+ key: "encapsulate",
472
+ value: function encapsulate(t, r, n) {
473
+ var a = _async(function (t, r) {
474
+ return _await(Promise.all(r.map(function (e) {
475
+ return e[1].p;
476
+ })), function (n) {
477
+ return _await(Promise.all(n.map(_async(function (n) {
478
+ var o = !1,
479
+ i = [],
480
+ c = _slicedToArray(r.splice(0, 1), 1),
481
+ s = _slicedToArray(c[0], 7),
482
+ u = s[0],
483
+ p = s[2],
484
+ y = s[3],
485
+ l = s[4],
486
+ f = s[5],
487
+ h = s[6],
488
+ v = _encapsulate(u, n, p, y, i, !0, h),
489
+ d = hasConstructorOf(v, e);
490
+
491
+ return function _invoke(e, t) {
492
+ var r = e();
493
+ return r && r.then ? r.then(t) : t(r);
494
+ }(function () {
495
+ if (u && d) return _await(v.p, function (e) {
496
+ l[f] = e;
497
+ var r = a(t, i);
498
+ return o = !0, r;
499
+ });
500
+ }, function (e) {
501
+ return o ? e : (u ? l[f] = v : t = d ? v.p : v, a(t, i));
502
+ });
503
+ }))), function () {
504
+ return t;
505
+ });
506
+ });
507
+ }),
508
+ u = (n = _objectSpread2(_objectSpread2({
509
+ sync: !0
510
+ }, this.options), n)).sync,
511
+ p = this,
512
+ y = {},
513
+ l = [],
514
+ f = [],
515
+ h = [],
516
+ v = !("cyclic" in n) || n.cyclic,
517
+ d = n.encapsulateObserver,
518
+ b = _encapsulate("", t, v, r || {}, h);
519
+
520
+ function finish(e) {
521
+ var t = Object.values(y);
522
+ if (n.iterateNone) return t.length ? t[0] : getJSONType(e);
523
+
524
+ if (t.length) {
525
+ if (n.returnTypeNames) return _toConsumableArray(new Set(t));
526
+ e && isPlainObject(e) && !c.call(e, "$types") ? e.$types = y : e = {
527
+ $: e,
528
+ $types: {
529
+ $: y
530
+ }
531
+ };
532
+ } else isObject(e) && c.call(e, "$types") && (e = {
533
+ $: e,
534
+ $types: !0
535
+ });
536
+
537
+ return !n.returnTypeNames && e;
538
+ }
539
+
540
+ function _adaptBuiltinStateObjectProperties(e, t, r) {
541
+ Object.assign(e, t);
542
+ var n = s.map(function (t) {
543
+ var r = e[t];
544
+ return delete e[t], r;
545
+ });
546
+ r(), s.forEach(function (t, r) {
547
+ e[t] = n[r];
548
+ });
549
+ }
550
+
551
+ function _encapsulate(t, r, a, s, u, h, v) {
552
+ var b,
553
+ _ = {},
554
+ O = _typeof(r),
555
+ j = d ? function (n) {
556
+ var o = v || s.type || getJSONType(r);
557
+ d(Object.assign(n || _, {
558
+ keypath: t,
559
+ value: r,
560
+ cyclic: a,
561
+ stateObj: s,
562
+ promisesData: u,
563
+ resolvingTypesonPromise: h,
564
+ awaitingTypesonPromise: hasConstructorOf(r, e)
565
+ }, {
566
+ type: o
567
+ }));
568
+ } : null;
569
+
570
+ if (["string", "boolean", "number", "undefined"].includes(O)) return void 0 === r || Number.isNaN(r) || r === Number.NEGATIVE_INFINITY || r === Number.POSITIVE_INFINITY ? (b = s.replaced ? r : replace(t, r, s, u, !1, h, j)) !== r && (_ = {
571
+ replaced: b
572
+ }) : b = r, j && j(), b;
573
+ if (null === r) return j && j(), r;
574
+
575
+ if (a && !s.iterateIn && !s.iterateUnsetNumeric && r && "object" === _typeof(r)) {
576
+ var m = l.indexOf(r);
577
+ if (!(m < 0)) return y[t] = "#", j && j({
578
+ cyclicKeypath: f[m]
579
+ }), "#" + f[m];
580
+ !0 === a && (l.push(r), f.push(t));
581
+ }
582
+
583
+ var S,
584
+ g = isPlainObject(r),
585
+ P = i$1(r),
586
+ T = (g || P) && (!p.plainObjectReplacers.length || s.replaced) || s.iterateIn ? r : replace(t, r, s, u, g || P, null, j);
587
+ if (T !== r ? (b = T, _ = {
588
+ replaced: T
589
+ }) : "" === t && hasConstructorOf(r, e) ? (u.push([t, r, a, s, void 0, void 0, s.type]), b = r) : P && "object" !== s.iterateIn || "array" === s.iterateIn ? (S = new Array(r.length), _ = {
590
+ clone: S
591
+ }) : (["function", "symbol"].includes(_typeof(r)) || "toJSON" in r || hasConstructorOf(r, e) || hasConstructorOf(r, Promise) || hasConstructorOf(r, ArrayBuffer)) && !g && "object" !== s.iterateIn ? b = r : (S = {}, s.addLength && (S.length = r.length), _ = {
592
+ clone: S
593
+ }), j && j(), n.iterateNone) return S || b;
594
+ if (!S) return b;
595
+
596
+ if (s.iterateIn) {
597
+ var w = function _loop(n) {
598
+ var o = {
599
+ ownKeys: c.call(r, n)
600
+ };
601
+
602
+ _adaptBuiltinStateObjectProperties(s, o, function () {
603
+ var o = t + (t ? "." : "") + escapeKeyPathComponent(n),
604
+ i = _encapsulate(o, r[n], Boolean(a), s, u, h);
605
+
606
+ hasConstructorOf(i, e) ? u.push([o, i, Boolean(a), s, S, n, s.type]) : void 0 !== i && (S[n] = i);
607
+ });
608
+ };
609
+
610
+ for (var A in r) {
611
+ w(A);
612
+ }
613
+
614
+ j && j({
615
+ endIterateIn: !0,
616
+ end: !0
617
+ });
618
+ } else o(r).forEach(function (n) {
619
+ var o = t + (t ? "." : "") + escapeKeyPathComponent(n);
620
+
621
+ _adaptBuiltinStateObjectProperties(s, {
622
+ ownKeys: !0
623
+ }, function () {
624
+ var t = _encapsulate(o, r[n], Boolean(a), s, u, h);
625
+
626
+ hasConstructorOf(t, e) ? u.push([o, t, Boolean(a), s, S, n, s.type]) : void 0 !== t && (S[n] = t);
627
+ });
628
+ }), j && j({
629
+ endIterateOwn: !0,
630
+ end: !0
631
+ });
632
+
633
+ if (s.iterateUnsetNumeric) {
634
+ for (var C = r.length, k = function _loop2(n) {
635
+ if (!(n in r)) {
636
+ var o = t + (t ? "." : "") + n;
637
+
638
+ _adaptBuiltinStateObjectProperties(s, {
639
+ ownKeys: !1
640
+ }, function () {
641
+ var t = _encapsulate(o, void 0, Boolean(a), s, u, h);
642
+
643
+ hasConstructorOf(t, e) ? u.push([o, t, Boolean(a), s, S, n, s.type]) : void 0 !== t && (S[n] = t);
644
+ });
645
+ }
646
+ }, N = 0; N < C; N++) {
647
+ k(N);
648
+ }
649
+
650
+ j && j({
651
+ endIterateUnsetNumeric: !0,
652
+ end: !0
653
+ });
654
+ }
655
+
656
+ return S;
657
+ }
658
+
659
+ function replace(e, t, r, n, a, o, i) {
660
+ for (var c = a ? p.plainObjectReplacers : p.nonplainObjectReplacers, s = c.length; s--;) {
661
+ var l = c[s];
662
+
663
+ if (l.test(t, r)) {
664
+ var f = l.type;
665
+
666
+ if (p.revivers[f]) {
667
+ var h = y[e];
668
+ y[e] = h ? [f].concat(h) : f;
669
+ }
670
+
671
+ return Object.assign(r, {
672
+ type: f,
673
+ replaced: !0
674
+ }), !u && l.replaceAsync || l.replace ? (i && i({
675
+ replacing: !0
676
+ }), _encapsulate(e, l[u || !l.replaceAsync ? "replace" : "replaceAsync"](t, r), v && "readonly", r, n, o, f)) : (i && i({
677
+ typeDetected: !0
678
+ }), _encapsulate(e, t, v && "readonly", r, n, o, f));
679
+ }
680
+ }
681
+
682
+ return t;
683
+ }
684
+
685
+ return h.length ? u && n.throwOnBadSyncType ? function () {
686
+ throw new TypeError("Sync method requested but async result obtained");
687
+ }() : Promise.resolve(a(b, h)).then(finish) : !u && n.throwOnBadSyncType ? function () {
688
+ throw new TypeError("Async method requested but sync result obtained");
689
+ }() : n.stringification && u ? [finish(b)] : u ? finish(b) : Promise.resolve(finish(b));
690
+ }
691
+ }, {
692
+ key: "encapsulateSync",
693
+ value: function encapsulateSync(e, t, r) {
694
+ return this.encapsulate(e, t, _objectSpread2(_objectSpread2({
695
+ throwOnBadSyncType: !0
696
+ }, r), {}, {
697
+ sync: !0
698
+ }));
699
+ }
700
+ }, {
701
+ key: "encapsulateAsync",
702
+ value: function encapsulateAsync(e, t, r) {
703
+ return this.encapsulate(e, t, _objectSpread2(_objectSpread2({
704
+ throwOnBadSyncType: !0
705
+ }, r), {}, {
706
+ sync: !1
707
+ }));
708
+ }
709
+ }, {
710
+ key: "revive",
711
+ value: function revive(t, r) {
712
+ var n = t && t.$types;
713
+ if (!n) return t;
714
+ if (!0 === n) return t.$;
715
+
716
+ var a = (r = _objectSpread2(_objectSpread2({
717
+ sync: !0
718
+ }, this.options), r)).sync,
719
+ c = [],
720
+ s = {},
721
+ u = !0;
722
+
723
+ n.$ && isPlainObject(n.$) && (t = t.$, n = n.$, u = !1);
724
+ var y = this;
725
+
726
+ function executeReviver(e, t) {
727
+ var r = _slicedToArray(y.revivers[e] || [], 1)[0];
728
+
729
+ if (!r) throw new Error("Unregistered type: " + e);
730
+ return a && !("revive" in r) ? t : r[a && r.revive ? "revive" : !a && r.reviveAsync ? "reviveAsync" : "revive"](t, s);
731
+ }
732
+
733
+ var l = [];
734
+
735
+ function checkUndefined(e) {
736
+ return hasConstructorOf(e, p) ? void 0 : e;
737
+ }
738
+
739
+ var f,
740
+ h = function revivePlainObjects() {
741
+ var r = [];
742
+ if (Object.entries(n).forEach(function (e) {
743
+ var t = _slicedToArray(e, 2),
744
+ a = t[0],
745
+ o = t[1];
746
+
747
+ "#" !== o && [].concat(o).forEach(function (e) {
748
+ _slicedToArray(y.revivers[e] || [null, {}], 2)[1].plain && (r.push({
749
+ keypath: a,
750
+ type: e
751
+ }), delete n[a]);
752
+ });
753
+ }), r.length) return r.sort(nestedPathsFirst).reduce(function reducer(r, n) {
754
+ var a = n.keypath,
755
+ o = n.type;
756
+ if (isThenable(r)) return r.then(function (e) {
757
+ return reducer(e, {
758
+ keypath: a,
759
+ type: o
760
+ });
761
+ });
762
+ var i = getByKeyPath(t, a);
763
+ if (hasConstructorOf(i = executeReviver(o, i), e)) return i.then(function (e) {
764
+ var r = setAtKeyPath(t, a, e);
765
+ r === e && (t = r);
766
+ });
767
+ var c = setAtKeyPath(t, a, i);
768
+ c === i && (t = c);
769
+ }, void 0);
770
+ }();
771
+
772
+ return hasConstructorOf(h, e) ? f = h.then(function () {
773
+ return t;
774
+ }) : (f = function _revive(t, r, a, s, y) {
775
+ if (!u || "$types" !== t) {
776
+ var f = n[t],
777
+ h = i$1(r);
778
+
779
+ if (h || isPlainObject(r)) {
780
+ var v = h ? new Array(r.length) : {};
781
+
782
+ for (o(r).forEach(function (n) {
783
+ var o = _revive(t + (t ? "." : "") + escapeKeyPathComponent(n), r[n], a || v, v, n),
784
+ i = function set(e) {
785
+ return hasConstructorOf(e, p) ? v[n] = void 0 : void 0 !== e && (v[n] = e), e;
786
+ };
787
+
788
+ hasConstructorOf(o, e) ? l.push(o.then(function (e) {
789
+ return i(e);
790
+ })) : i(o);
791
+ }), r = v; c.length;) {
792
+ var d = _slicedToArray(c[0], 4),
793
+ b = d[0],
794
+ _ = d[1],
795
+ O = d[2],
796
+ j = d[3],
797
+ m = getByKeyPath(b, _);
798
+
799
+ if (void 0 === m) break;
800
+ O[j] = m, c.splice(0, 1);
801
+ }
802
+ }
803
+
804
+ if (!f) return r;
805
+
806
+ if ("#" === f) {
807
+ var S = getByKeyPath(a, r.slice(1));
808
+ return void 0 === S && c.push([a, r.slice(1), s, y]), S;
809
+ }
810
+
811
+ return [].concat(f).reduce(function reducer(t, r) {
812
+ return hasConstructorOf(t, e) ? t.then(function (e) {
813
+ return reducer(e, r);
814
+ }) : executeReviver(r, t);
815
+ }, r);
816
+ }
817
+ }("", t, null), l.length && (f = e.resolve(f).then(function (t) {
818
+ return e.all([t].concat(l));
819
+ }).then(function (e) {
820
+ return _slicedToArray(e, 1)[0];
821
+ }))), isThenable(f) ? a && r.throwOnBadSyncType ? function () {
822
+ throw new TypeError("Sync method requested but async result obtained");
823
+ }() : hasConstructorOf(f, e) ? f.p.then(checkUndefined) : f : !a && r.throwOnBadSyncType ? function () {
824
+ throw new TypeError("Async method requested but sync result obtained");
825
+ }() : a ? checkUndefined(f) : Promise.resolve(checkUndefined(f));
826
+ }
827
+ }, {
828
+ key: "reviveSync",
829
+ value: function reviveSync(e, t) {
830
+ return this.revive(e, _objectSpread2(_objectSpread2({
831
+ throwOnBadSyncType: !0
832
+ }, t), {}, {
833
+ sync: !0
834
+ }));
835
+ }
836
+ }, {
837
+ key: "reviveAsync",
838
+ value: function reviveAsync(e, t) {
839
+ return this.revive(e, _objectSpread2(_objectSpread2({
840
+ throwOnBadSyncType: !0
841
+ }, t), {}, {
842
+ sync: !1
843
+ }));
844
+ }
845
+ }, {
846
+ key: "register",
847
+ value: function register(e, t) {
848
+ var r = this;
849
+ t = t || {};
850
+
851
+ var n = function R(e) {
852
+ i$1(e) ? e.forEach(function (e) {
853
+ return R(e);
854
+ }) : e && o(e).forEach(function (n) {
855
+ if ("#" === n) throw new TypeError("# cannot be used as a type name as it is reserved for cyclic objects");
856
+ if (y.includes(n)) throw new TypeError("Plain JSON object types are reserved as type names");
857
+ var a = e[n],
858
+ o = a && a.testPlainObjects ? r.plainObjectReplacers : r.nonplainObjectReplacers,
859
+ c = o.filter(function (e) {
860
+ return e.type === n;
861
+ });
862
+
863
+ if (c.length && (o.splice(o.indexOf(c[0]), 1), delete r.revivers[n], delete r.types[n]), "function" == typeof a) {
864
+ var s = a;
865
+ a = {
866
+ test: function test(e) {
867
+ return e && e.constructor === s;
868
+ },
869
+ replace: function replace(e) {
870
+ return _objectSpread2({}, e);
871
+ },
872
+ revive: function revive(e) {
873
+ return Object.assign(Object.create(s.prototype), e);
874
+ }
875
+ };
876
+ } else if (i$1(a)) {
877
+ var u = _slicedToArray(a, 3);
878
+
879
+ a = {
880
+ test: u[0],
881
+ replace: u[1],
882
+ revive: u[2]
883
+ };
884
+ }
885
+
886
+ if (a && a.test) {
887
+ var p = {
888
+ type: n,
889
+ test: a.test.bind(a)
890
+ };
891
+ a.replace && (p.replace = a.replace.bind(a)), a.replaceAsync && (p.replaceAsync = a.replaceAsync.bind(a));
892
+ var l = "number" == typeof t.fallback ? t.fallback : t.fallback ? 0 : Number.POSITIVE_INFINITY;
893
+
894
+ if (a.testPlainObjects ? r.plainObjectReplacers.splice(l, 0, p) : r.nonplainObjectReplacers.splice(l, 0, p), a.revive || a.reviveAsync) {
895
+ var f = {};
896
+ a.revive && (f.revive = a.revive.bind(a)), a.reviveAsync && (f.reviveAsync = a.reviveAsync.bind(a)), r.revivers[n] = [f, {
897
+ plain: a.testPlainObjects
898
+ }];
899
+ }
900
+
901
+ r.types[n] = a;
902
+ }
903
+ });
904
+ };
905
+
906
+ return [].concat(e).forEach(function (e) {
907
+ return n(e);
908
+ }), this;
909
+ }
910
+ }]), Typeson;
911
+ }(),
912
+ p = _createClass(function Undefined() {
913
+ _classCallCheck(this, Undefined);
914
+ });
915
+
916
+ p.__typeson__type__ = "TypesonUndefined";
917
+ var y = ["null", "boolean", "number", "string", "array", "object"];
918
+
919
+ /*
920
+ * base64-arraybuffer
921
+ * https://github.com/niklasvh/base64-arraybuffer
922
+ *
923
+ * Copyright (c) 2017 Brett Zamir, 2012 Niklas von Hertzen
924
+ * Licensed under the MIT license.
925
+ */
926
+ var chars = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/'; // Use a lookup table to find the index.
927
+
928
+ var lookup = new Uint8Array(256);
929
+
930
+ for (var i = 0; i < chars.length; i++) {
931
+ lookup[chars.codePointAt(i)] = i;
932
+ }
933
+ /**
934
+ * @param {ArrayBuffer} arraybuffer
935
+ * @param {Integer} byteOffset
936
+ * @param {Integer} lngth
937
+ * @returns {string}
938
+ */
939
+
940
+
941
+ var encode = function encode(arraybuffer, byteOffset, lngth) {
942
+ if (lngth === null || lngth === undefined) {
943
+ lngth = arraybuffer.byteLength; // Needed for Safari
944
+ }
945
+
946
+ var bytes = new Uint8Array(arraybuffer, byteOffset || 0, // Default needed for Safari
947
+ lngth);
948
+ var len = bytes.length;
949
+ var base64 = '';
950
+
951
+ for (var _i = 0; _i < len; _i += 3) {
952
+ base64 += chars[bytes[_i] >> 2];
953
+ base64 += chars[(bytes[_i] & 3) << 4 | bytes[_i + 1] >> 4];
954
+ base64 += chars[(bytes[_i + 1] & 15) << 2 | bytes[_i + 2] >> 6];
955
+ base64 += chars[bytes[_i + 2] & 63];
956
+ }
957
+
958
+ if (len % 3 === 2) {
959
+ base64 = base64.slice(0, -1) + '=';
960
+ } else if (len % 3 === 1) {
961
+ base64 = base64.slice(0, -2) + '==';
962
+ }
963
+
964
+ return base64;
965
+ };
966
+ /**
967
+ * @param {string} base64
968
+ * @returns {ArrayBuffer}
969
+ */
970
+
971
+
972
+ var decode = function decode(base64) {
973
+ var len = base64.length;
974
+ var bufferLength = base64.length * 0.75;
975
+ var p = 0;
976
+ var encoded1, encoded2, encoded3, encoded4;
977
+
978
+ if (base64[base64.length - 1] === '=') {
979
+ bufferLength--;
980
+
981
+ if (base64[base64.length - 2] === '=') {
982
+ bufferLength--;
983
+ }
984
+ }
985
+
986
+ var arraybuffer = new ArrayBuffer(bufferLength),
987
+ bytes = new Uint8Array(arraybuffer);
988
+
989
+ for (var _i2 = 0; _i2 < len; _i2 += 4) {
990
+ encoded1 = lookup[base64.codePointAt(_i2)];
991
+ encoded2 = lookup[base64.codePointAt(_i2 + 1)];
992
+ encoded3 = lookup[base64.codePointAt(_i2 + 2)];
993
+ encoded4 = lookup[base64.codePointAt(_i2 + 3)];
994
+ bytes[p++] = encoded1 << 2 | encoded2 >> 4;
995
+ bytes[p++] = (encoded2 & 15) << 4 | encoded3 >> 2;
996
+ bytes[p++] = (encoded3 & 3) << 6 | encoded4 & 63;
997
+ }
998
+
999
+ return arraybuffer;
1000
+ };
1001
+
1002
+ var arraybuffer = {
1003
+ arraybuffer: {
1004
+ test: function test(x) {
1005
+ return toStringTag(x) === 'ArrayBuffer';
1006
+ },
1007
+ replace: function replace(b, stateObj) {
1008
+ if (!stateObj.buffers) {
1009
+ stateObj.buffers = [];
1010
+ }
1011
+
1012
+ var index = stateObj.buffers.indexOf(b);
1013
+
1014
+ if (index > -1) {
1015
+ return {
1016
+ index: index
1017
+ };
1018
+ }
1019
+
1020
+ stateObj.buffers.push(b);
1021
+ return encode(b);
1022
+ },
1023
+ revive: function revive(b64, stateObj) {
1024
+ if (!stateObj.buffers) {
1025
+ stateObj.buffers = [];
1026
+ }
1027
+
1028
+ if (_typeof$1(b64) === 'object') {
1029
+ return stateObj.buffers[b64.index];
1030
+ }
1031
+
1032
+ var buffer = decode(b64);
1033
+ stateObj.buffers.push(buffer);
1034
+ return buffer;
1035
+ }
1036
+ }
1037
+ };
1038
+ // See also typed-arrays!
1039
+
1040
+ var bigintObject = {
1041
+ bigintObject: {
1042
+ test: function test(x) {
1043
+ return _typeof$1(x) === 'object' && hasConstructorOf(x, BigInt);
1044
+ },
1045
+ replace: function replace(n) {
1046
+ return String(n);
1047
+ },
1048
+ revive: function revive(s) {
1049
+ // Filed this to avoid error: https://github.com/eslint/eslint/issues/11810
1050
+ // eslint-disable-next-line no-new-object
1051
+ return new Object(BigInt(s));
1052
+ }
1053
+ }
1054
+ };
1055
+
1056
+ /* globals BigInt */
1057
+ var bigint = {
1058
+ bigint: {
1059
+ test: function test(x) {
1060
+ return typeof x === 'bigint';
1061
+ },
1062
+ replace: function replace(n) {
1063
+ return String(n);
1064
+ },
1065
+ revive: function revive(s) {
1066
+ return BigInt(s);
1067
+ }
1068
+ }
1069
+ };
1070
+
1071
+ /**
1072
+ * Not currently in use internally, but provided for parity.
1073
+ * @param {ArrayBuffer} buf
1074
+ * @returns {Uint8Array}
1075
+ */
1076
+ /**
1077
+ *
1078
+ * @param {string} str
1079
+ * @returns {ArrayBuffer}
1080
+ */
1081
+
1082
+
1083
+ function string2arraybuffer(str) {
1084
+ /*
1085
+ // UTF-8 approaches
1086
+ const utf8 = unescape(encodeURIComponent(str));
1087
+ const arr = new Uint8Array(utf8.length);
1088
+ for (let i = 0; i < utf8.length; i++) {
1089
+ arr[i] = utf8.charCodeAt(i);
1090
+ }
1091
+ return arr.buffer;
1092
+ const utf8 = [];
1093
+ for (let i = 0; i < str.length; i++) {
1094
+ let charcode = str.charCodeAt(i);
1095
+ if (charcode < 0x80) utf8.push(charcode);
1096
+ else if (charcode < 0x800) {
1097
+ utf8.push(0xc0 | (charcode >> 6),
1098
+ 0x80 | (charcode & 0x3f));
1099
+ } else if (charcode < 0xd800 || charcode >= 0xe000) {
1100
+ utf8.push(0xe0 | (charcode >> 12),
1101
+ 0x80 | ((charcode >> 6) & 0x3f),
1102
+ 0x80 | (charcode & 0x3f));
1103
+ // surrogate pair
1104
+ } else {
1105
+ i++;
1106
+ // UTF-16 encodes 0x10000-0x10FFFF by
1107
+ // subtracting 0x10000 and splitting the
1108
+ // 20 bits of 0x0-0xFFFFF into two halves
1109
+ charcode = 0x10000 + (((charcode & 0x3ff) << 10) |
1110
+ (str.charCodeAt(i) & 0x3ff));
1111
+ utf8.push(0xf0 | (charcode >> 18),
1112
+ 0x80 | ((charcode >> 12) & 0x3f),
1113
+ 0x80 | ((charcode >> 6) & 0x3f),
1114
+ 0x80 | (charcode & 0x3f));
1115
+ }
1116
+ }
1117
+ return utf8;
1118
+ */
1119
+
1120
+ /*
1121
+ // Working UTF-16 options (equivalents)
1122
+ const buf = new ArrayBuffer(str.length * 2); // 2 bytes for each char
1123
+ const bufView = new Uint16Array(buf);
1124
+ for (let i = 0, strLen = str.length; i < strLen; i++) {
1125
+ bufView[i] = str.charCodeAt(i);
1126
+ }
1127
+ return buf;
1128
+ */
1129
+ var array = new Uint8Array(str.length);
1130
+
1131
+ for (var i = 0; i < str.length; i++) {
1132
+ // eslint-disable-next-line max-len -- Long
1133
+ // eslint-disable-next-line unicorn/prefer-code-point -- Iterating char. codes
1134
+ array[i] = str.charCodeAt(i); // & 0xff;
1135
+ }
1136
+
1137
+ return array.buffer;
1138
+ }
1139
+
1140
+ /* globals XMLHttpRequest, Blob, FileReader */
1141
+ var blob = {
1142
+ blob: {
1143
+ test: function test(x) {
1144
+ return toStringTag(x) === 'Blob';
1145
+ },
1146
+ replace: function replace(b) {
1147
+ // Sync
1148
+ var req = new XMLHttpRequest();
1149
+ req.overrideMimeType('text/plain; charset=x-user-defined');
1150
+ req.open('GET', URL.createObjectURL(b), false); // Sync
1151
+
1152
+ req.send(); // Seems not feasible to accurately simulate
1153
+
1154
+ /* c8 ignore next 3 */
1155
+
1156
+ if (req.status !== 200 && req.status !== 0) {
1157
+ throw new Error('Bad Blob access: ' + req.status);
1158
+ }
1159
+
1160
+ return {
1161
+ type: b.type,
1162
+ stringContents: req.responseText
1163
+ };
1164
+ },
1165
+ revive: function revive(_ref) {
1166
+ var type = _ref.type,
1167
+ stringContents = _ref.stringContents;
1168
+ return new Blob([string2arraybuffer(stringContents)], {
1169
+ type: type
1170
+ });
1171
+ },
1172
+ replaceAsync: function replaceAsync(b) {
1173
+ return new e(function (resolve, reject) {
1174
+ /*
1175
+ if (b.isClosed) { // On MDN, but not in https://w3c.github.io/FileAPI/#dfn-Blob
1176
+ reject(new Error('The Blob is closed'));
1177
+ return;
1178
+ }
1179
+ */
1180
+ var reader = new FileReader();
1181
+ reader.addEventListener('load', function () {
1182
+ resolve({
1183
+ type: b.type,
1184
+ stringContents: reader.result
1185
+ });
1186
+ }); // Seems not feasible to accurately simulate
1187
+
1188
+ /* c8 ignore next 3 */
1189
+
1190
+ reader.addEventListener('error', function () {
1191
+ reject(reader.error);
1192
+ });
1193
+ reader.readAsBinaryString(b);
1194
+ });
1195
+ }
1196
+ }
1197
+ };
1198
+
1199
+ /* globals performance */
1200
+ // The `performance` global is optional
1201
+
1202
+ /**
1203
+ * @todo We could use `import generateUUID from 'uuid/v4';` (but it needs
1204
+ * crypto library, etc.; `rollup-plugin-node-builtins` doesn't recommend
1205
+ * using its own version and though there is <https://www.npmjs.com/package/crypto-browserify>,
1206
+ * it may be troublesome to bundle and not strongly needed)
1207
+ * @returns {string}
1208
+ */
1209
+ function generateUUID() {
1210
+ // Adapted from original: public domain/MIT: http://stackoverflow.com/a/8809472/271577
1211
+
1212
+ /* c8 ignore next */
1213
+ var d = Date.now() + ( // use high-precision timer if available
1214
+
1215
+ /* c8 ignore next 4 */
1216
+ typeof performance !== 'undefined' && typeof performance.now === 'function' ? performance.now() : 0);
1217
+ return 'xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx'.replace(/[xy]/g, function (c) {
1218
+ /* eslint-disable no-bitwise */
1219
+ var r = Math.trunc((d + Math.random() * 16) % 16);
1220
+ d = Math.floor(d / 16);
1221
+ return (c === 'x' ? r : r & 0x3 | 0x8).toString(16);
1222
+ /* eslint-enable no-bitwise */
1223
+ });
1224
+ }
1225
+
1226
+ var cloneableObjectsByUUID = {};
1227
+ var cloneable = {
1228
+ cloneable: {
1229
+ test: function test(x) {
1230
+ return x && _typeof$1(x) === 'object' && typeof x[Symbol["for"]('cloneEncapsulate')] === 'function';
1231
+ },
1232
+ replace: function replace(clonable) {
1233
+ var encapsulated = clonable[Symbol["for"]('cloneEncapsulate')]();
1234
+ var uuid = generateUUID();
1235
+ cloneableObjectsByUUID[uuid] = clonable;
1236
+ return {
1237
+ uuid: uuid,
1238
+ encapsulated: encapsulated
1239
+ };
1240
+ },
1241
+ revive: function revive(_ref) {
1242
+ var uuid = _ref.uuid,
1243
+ encapsulated = _ref.encapsulated;
1244
+ return cloneableObjectsByUUID[uuid][Symbol["for"]('cloneRevive')](encapsulated);
1245
+ }
1246
+ }
1247
+ };
1248
+
1249
+ var cryptokey = {
1250
+ cryptokey: {
1251
+ test: function test(x) {
1252
+ return toStringTag(x) === 'CryptoKey' && x.extractable;
1253
+ },
1254
+ replaceAsync: function replaceAsync(key) {
1255
+ return new e( /*#__PURE__*/function () {
1256
+ var _ref = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee(resolve, reject) {
1257
+ var jwk;
1258
+ return regeneratorRuntime.wrap(function _callee$(_context) {
1259
+ while (1) {
1260
+ switch (_context.prev = _context.next) {
1261
+ case 0:
1262
+ _context.prev = 0;
1263
+ _context.next = 3;
1264
+ return crypto.subtle.exportKey('jwk', key);
1265
+
1266
+ case 3:
1267
+ jwk = _context.sent;
1268
+ _context.next = 10;
1269
+ break;
1270
+
1271
+ case 6:
1272
+ _context.prev = 6;
1273
+ _context.t0 = _context["catch"](0);
1274
+ reject(_context.t0);
1275
+ return _context.abrupt("return");
1276
+
1277
+ case 10:
1278
+ resolve({
1279
+ jwk: jwk,
1280
+ algorithm: key.algorithm,
1281
+ usages: key.usages
1282
+ });
1283
+
1284
+ case 11:
1285
+ case "end":
1286
+ return _context.stop();
1287
+ }
1288
+ }
1289
+ }, _callee, null, [[0, 6]]);
1290
+ }));
1291
+
1292
+ return function (_x, _x2) {
1293
+ return _ref.apply(this, arguments);
1294
+ };
1295
+ }());
1296
+ },
1297
+ revive: function revive(_ref2) {
1298
+ var jwk = _ref2.jwk,
1299
+ algorithm = _ref2.algorithm,
1300
+ usages = _ref2.usages;
1301
+ return crypto.subtle.importKey('jwk', jwk, algorithm, true, usages);
1302
+ }
1303
+ }
1304
+ };
1305
+
1306
+ var dataview = {
1307
+ dataview: {
1308
+ test: function test(x) {
1309
+ return toStringTag(x) === 'DataView';
1310
+ },
1311
+ replace: function replace(_ref, stateObj) {
1312
+ var buffer = _ref.buffer,
1313
+ byteOffset = _ref.byteOffset,
1314
+ byteLength = _ref.byteLength;
1315
+
1316
+ if (!stateObj.buffers) {
1317
+ stateObj.buffers = [];
1318
+ }
1319
+
1320
+ var index = stateObj.buffers.indexOf(buffer);
1321
+
1322
+ if (index > -1) {
1323
+ return {
1324
+ index: index,
1325
+ byteOffset: byteOffset,
1326
+ byteLength: byteLength
1327
+ };
1328
+ }
1329
+
1330
+ stateObj.buffers.push(buffer);
1331
+ return {
1332
+ encoded: encode(buffer),
1333
+ byteOffset: byteOffset,
1334
+ byteLength: byteLength
1335
+ };
1336
+ },
1337
+ revive: function revive(b64Obj, stateObj) {
1338
+ if (!stateObj.buffers) {
1339
+ stateObj.buffers = [];
1340
+ }
1341
+
1342
+ var byteOffset = b64Obj.byteOffset,
1343
+ byteLength = b64Obj.byteLength,
1344
+ encoded = b64Obj.encoded,
1345
+ index = b64Obj.index;
1346
+ var buffer;
1347
+
1348
+ if ('index' in b64Obj) {
1349
+ buffer = stateObj.buffers[index];
1350
+ } else {
1351
+ buffer = decode(encoded);
1352
+ stateObj.buffers.push(buffer);
1353
+ }
1354
+
1355
+ return new DataView(buffer, byteOffset, byteLength);
1356
+ }
1357
+ }
1358
+ };
1359
+
1360
+ var date = {
1361
+ date: {
1362
+ test: function test(x) {
1363
+ return toStringTag(x) === 'Date';
1364
+ },
1365
+ replace: function replace(dt) {
1366
+ var time = dt.getTime();
1367
+
1368
+ if (Number.isNaN(time)) {
1369
+ return 'NaN';
1370
+ }
1371
+
1372
+ return time;
1373
+ },
1374
+ revive: function revive(time) {
1375
+ if (time === 'NaN') {
1376
+ return new Date(Number.NaN);
1377
+ }
1378
+
1379
+ return new Date(time);
1380
+ }
1381
+ }
1382
+ };
1383
+
1384
+ var error = {
1385
+ error: {
1386
+ test: function test(x) {
1387
+ return toStringTag(x) === 'Error';
1388
+ },
1389
+ replace: function replace(_ref) {
1390
+ var name = _ref.name,
1391
+ message = _ref.message;
1392
+ return {
1393
+ name: name,
1394
+ message: message
1395
+ };
1396
+ },
1397
+ revive: function revive(_ref2) {
1398
+ var name = _ref2.name,
1399
+ message = _ref2.message;
1400
+ var e = new Error(message);
1401
+ e.name = name;
1402
+ return e;
1403
+ }
1404
+ }
1405
+ }; // See also errors.js that may be registered after having registered this type.
1406
+
1407
+ /* eslint-env browser, node */
1408
+ /* c8 ignore next */
1409
+
1410
+ var _global$2 = typeof self === 'undefined' ? global : self;
1411
+
1412
+ var errors = {}; // Comprises all built-in errors.
1413
+
1414
+ ['TypeError', 'RangeError', 'SyntaxError', 'ReferenceError', 'EvalError', 'URIError', 'InternalError' // non-standard
1415
+ ].forEach(function (errName) {
1416
+ var Cnstrctr = _global$2[errName];
1417
+
1418
+ if (Cnstrctr) {
1419
+ errors[errName.toLowerCase()] = {
1420
+ test: function test(x) {
1421
+ return hasConstructorOf(x, Cnstrctr);
1422
+ },
1423
+ replace: function replace(e) {
1424
+ return e.message;
1425
+ },
1426
+ revive: function revive(message) {
1427
+ return new Cnstrctr(message);
1428
+ }
1429
+ };
1430
+ }
1431
+ });
1432
+
1433
+ /* globals XMLHttpRequest, File, FileReader */
1434
+ var file = {
1435
+ file: {
1436
+ test: function test(x) {
1437
+ return toStringTag(x) === 'File';
1438
+ },
1439
+ replace: function replace(f) {
1440
+ // Sync
1441
+ var req = new XMLHttpRequest();
1442
+ req.overrideMimeType('text/plain; charset=x-user-defined');
1443
+ req.open('GET', URL.createObjectURL(f), false); // Sync
1444
+
1445
+ req.send(); // Seems not feasible to accurately simulate
1446
+
1447
+ /* c8 ignore next 3 */
1448
+
1449
+ if (req.status !== 200 && req.status !== 0) {
1450
+ throw new Error('Bad File access: ' + req.status);
1451
+ }
1452
+
1453
+ return {
1454
+ type: f.type,
1455
+ stringContents: req.responseText,
1456
+ name: f.name,
1457
+ lastModified: f.lastModified
1458
+ };
1459
+ },
1460
+ revive: function revive(_ref) {
1461
+ var name = _ref.name,
1462
+ type = _ref.type,
1463
+ stringContents = _ref.stringContents,
1464
+ lastModified = _ref.lastModified;
1465
+ return new File([string2arraybuffer(stringContents)], name, {
1466
+ type: type,
1467
+ lastModified: lastModified
1468
+ });
1469
+ },
1470
+ replaceAsync: function replaceAsync(f) {
1471
+ return new e(function (resolve, reject) {
1472
+ /*
1473
+ if (f.isClosed) { // On MDN, but not in https://w3c.github.io/FileAPI/#dfn-Blob
1474
+ reject(new Error('The File is closed'));
1475
+ return;
1476
+ }
1477
+ */
1478
+ var reader = new FileReader();
1479
+ reader.addEventListener('load', function () {
1480
+ resolve({
1481
+ type: f.type,
1482
+ stringContents: reader.result,
1483
+ name: f.name,
1484
+ lastModified: f.lastModified
1485
+ });
1486
+ }); // Seems not feasible to accurately simulate
1487
+
1488
+ /* c8 ignore next 3 */
1489
+
1490
+ reader.addEventListener('error', function () {
1491
+ reject(reader.error);
1492
+ });
1493
+ reader.readAsBinaryString(f);
1494
+ });
1495
+ }
1496
+ }
1497
+ };
1498
+
1499
+ var filelist = {
1500
+ file: file.file,
1501
+ filelist: {
1502
+ test: function test(x) {
1503
+ return toStringTag(x) === 'FileList';
1504
+ },
1505
+ replace: function replace(fl) {
1506
+ var arr = [];
1507
+
1508
+ for (var i = 0; i < fl.length; i++) {
1509
+ arr[i] = fl.item(i);
1510
+ }
1511
+
1512
+ return arr;
1513
+ },
1514
+ revive: function revive(o) {
1515
+ /**
1516
+ * `FileList` polyfill.
1517
+ */
1518
+ var FileList = /*#__PURE__*/function (_Symbol$toStringTag) {
1519
+ /**
1520
+ * Set private properties and length.
1521
+ */
1522
+ function FileList() {
1523
+ _classCallCheck$1(this, FileList);
1524
+
1525
+ // eslint-disable-next-line prefer-rest-params
1526
+ this._files = arguments[0];
1527
+ this.length = this._files.length;
1528
+ }
1529
+ /**
1530
+ * @param {Integer} index
1531
+ * @returns {File}
1532
+ */
1533
+
1534
+
1535
+ _createClass$1(FileList, [{
1536
+ key: "item",
1537
+ value: function item(index) {
1538
+ return this._files[index];
1539
+ }
1540
+ /* eslint-disable class-methods-use-this */
1541
+
1542
+ /**
1543
+ * @returns {"FileList"}
1544
+ */
1545
+
1546
+ }, {
1547
+ key: _Symbol$toStringTag,
1548
+ get: function get() {
1549
+ /* eslint-enable class-methods-use-this */
1550
+ return 'FileList';
1551
+ }
1552
+ }]);
1553
+
1554
+ return FileList;
1555
+ }(Symbol.toStringTag);
1556
+
1557
+ return new FileList(o);
1558
+ }
1559
+ }
1560
+ };
1561
+
1562
+ /* globals createImageBitmap */
1563
+ var imagebitmap = {
1564
+ imagebitmap: {
1565
+ test: function test(x) {
1566
+ return toStringTag(x) === 'ImageBitmap' || // In Node, our polyfill sets the dataset on a canvas
1567
+ // element as JSDom no longer allows overriding toStringTag
1568
+ x && x.dataset && x.dataset.toStringTag === 'ImageBitmap';
1569
+ },
1570
+ replace: function replace(bm) {
1571
+ var canvas = document.createElement('canvas');
1572
+ var ctx = canvas.getContext('2d');
1573
+ ctx.drawImage(bm, 0, 0); // Although `width` and `height` are part of `ImageBitMap`,
1574
+ // these will be auto-created for us when reviving with the
1575
+ // data URL (and they are not settable even if they weren't)
1576
+ // return {
1577
+ // width: bm.width, height: bm.height, dataURL: canvas.toDataURL()
1578
+ // };
1579
+
1580
+ return canvas.toDataURL();
1581
+ },
1582
+ revive: function revive(o) {
1583
+ /*
1584
+ var req = new XMLHttpRequest();
1585
+ req.open('GET', o, false); // Sync
1586
+ if (req.status !== 200 && req.status !== 0) {
1587
+ throw new Error('Bad ImageBitmap access: ' + req.status);
1588
+ }
1589
+ req.send();
1590
+ return req.responseText;
1591
+ */
1592
+ var canvas = document.createElement('canvas');
1593
+ var ctx = canvas.getContext('2d');
1594
+ var img = document.createElement('img'); // The onload is needed by some browsers per http://stackoverflow.com/a/4776378/271577
1595
+
1596
+ img.addEventListener('load', function () {
1597
+ ctx.drawImage(img, 0, 0);
1598
+ });
1599
+ img.src = o; // Works in contexts allowing an `ImageBitmap` (We might use
1600
+ // `OffscreenCanvas.transferToBitmap` when supported)
1601
+
1602
+ return canvas;
1603
+ },
1604
+ reviveAsync: function reviveAsync(o) {
1605
+ var canvas = document.createElement('canvas');
1606
+ var ctx = canvas.getContext('2d');
1607
+ var img = document.createElement('img'); // The onload is needed by some browsers per http://stackoverflow.com/a/4776378/271577
1608
+
1609
+ img.addEventListener('load', function () {
1610
+ ctx.drawImage(img, 0, 0);
1611
+ });
1612
+ img.src = o; // o.dataURL;
1613
+
1614
+ return createImageBitmap(canvas); // Returns a promise
1615
+ }
1616
+ }
1617
+ };
1618
+
1619
+ var imagedata = {
1620
+ imagedata: {
1621
+ test: function test(x) {
1622
+ return toStringTag(x) === 'ImageData';
1623
+ },
1624
+ replace: function replace(d) {
1625
+ return {
1626
+ // Ensure `length` gets preserved for revival
1627
+ array: _toConsumableArray$1(d.data),
1628
+ width: d.width,
1629
+ height: d.height
1630
+ };
1631
+ },
1632
+ revive: function revive(o) {
1633
+ return new ImageData(new Uint8ClampedArray(o.array), o.width, o.height);
1634
+ }
1635
+ }
1636
+ };
1637
+
1638
+ var infinity = {
1639
+ infinity: {
1640
+ test: function test(x) {
1641
+ return x === Number.POSITIVE_INFINITY;
1642
+ },
1643
+ replace: function replace(n) {
1644
+ return 'Infinity';
1645
+ },
1646
+ revive: function revive(s) {
1647
+ return Number.POSITIVE_INFINITY;
1648
+ }
1649
+ }
1650
+ };
1651
+
1652
+ var IntlCollator = {
1653
+ test: function test(x) {
1654
+ return hasConstructorOf(x, Intl.Collator);
1655
+ },
1656
+ replace: function replace(c) {
1657
+ return c.resolvedOptions();
1658
+ },
1659
+ revive: function revive(options) {
1660
+ return new Intl.Collator(options.locale, options);
1661
+ }
1662
+ };
1663
+ var IntlDateTimeFormat = {
1664
+ test: function test(x) {
1665
+ return hasConstructorOf(x, Intl.DateTimeFormat);
1666
+ },
1667
+ replace: function replace(dtf) {
1668
+ return dtf.resolvedOptions();
1669
+ },
1670
+ revive: function revive(options) {
1671
+ return new Intl.DateTimeFormat(options.locale, options);
1672
+ }
1673
+ };
1674
+ var IntlNumberFormat = {
1675
+ test: function test(x) {
1676
+ return hasConstructorOf(x, Intl.NumberFormat);
1677
+ },
1678
+ replace: function replace(nf) {
1679
+ return nf.resolvedOptions();
1680
+ },
1681
+ revive: function revive(options) {
1682
+ return new Intl.NumberFormat(options.locale, options);
1683
+ }
1684
+ };
1685
+ var intlTypes = {
1686
+ IntlCollator: IntlCollator,
1687
+ IntlDateTimeFormat: IntlDateTimeFormat,
1688
+ IntlNumberFormat: IntlNumberFormat
1689
+ };
1690
+
1691
+ var map = {
1692
+ map: {
1693
+ test: function test(x) {
1694
+ return toStringTag(x) === 'Map';
1695
+ },
1696
+ replace: function replace(mp) {
1697
+ return _toConsumableArray$1(mp.entries());
1698
+ },
1699
+ revive: function revive(entries) {
1700
+ return new Map(entries);
1701
+ }
1702
+ }
1703
+ };
1704
+
1705
+ var nan = {
1706
+ nan: {
1707
+ test: function test(x) {
1708
+ return Number.isNaN(x);
1709
+ },
1710
+ replace: function replace(n) {
1711
+ return 'NaN';
1712
+ },
1713
+ revive: function revive(s) {
1714
+ return Number.NaN;
1715
+ }
1716
+ }
1717
+ };
1718
+
1719
+ var negativeInfinity = {
1720
+ negativeInfinity: {
1721
+ test: function test(x) {
1722
+ return x === Number.NEGATIVE_INFINITY;
1723
+ },
1724
+ replace: function replace(n) {
1725
+ return '-Infinity';
1726
+ },
1727
+ revive: function revive(s) {
1728
+ return Number.NEGATIVE_INFINITY;
1729
+ }
1730
+ }
1731
+ };
1732
+
1733
+ var nonbuiltinIgnore = {
1734
+ nonbuiltinIgnore: {
1735
+ test: function test(x) {
1736
+ return x && _typeof$1(x) === 'object' && !Array.isArray(x) && !['Object', // `Proxy` and `Reflect`, two other built-in objects, will also
1737
+ // have a `toStringTag` of `Object`; we don't want built-in
1738
+ // function objects, however
1739
+ 'Boolean', 'Number', 'String', 'Error', 'RegExp', 'Math', 'Date', 'Map', 'Set', 'JSON', 'ArrayBuffer', 'SharedArrayBuffer', 'DataView', 'Int8Array', 'Uint8Array', 'Uint8ClampedArray', 'Int16Array', 'Uint16Array', 'Int32Array', 'Uint32Array', 'Float32Array', 'Float64Array', 'Promise', 'String Iterator', 'Array Iterator', 'Map Iterator', 'Set Iterator', 'WeakMap', 'WeakSet', 'Atomics', 'Module'].includes(toStringTag(x));
1740
+ },
1741
+ replace: function replace(rexp) {// Not in use
1742
+ }
1743
+ }
1744
+ };
1745
+
1746
+ var primitiveObjects = {
1747
+ // String Object (not primitive string which need no type spec)
1748
+ StringObject: {
1749
+ test: function test(x) {
1750
+ return toStringTag(x) === 'String' && _typeof$1(x) === 'object';
1751
+ },
1752
+ replace: function replace(s) {
1753
+ return String(s);
1754
+ },
1755
+ // convert to primitive string
1756
+ revive: function revive(s) {
1757
+ return new String(s);
1758
+ } // Revive to an objectified string
1759
+
1760
+ },
1761
+ // Boolean Object (not primitive boolean which need no type spec)
1762
+ BooleanObject: {
1763
+ test: function test(x) {
1764
+ return toStringTag(x) === 'Boolean' && _typeof$1(x) === 'object';
1765
+ },
1766
+ replace: function replace(b) {
1767
+ return Boolean(b);
1768
+ },
1769
+ // convert to primitive boolean
1770
+ revive: function revive(b) {
1771
+ // Revive to an objectified Boolean
1772
+ return new Boolean(b);
1773
+ }
1774
+ },
1775
+ // Number Object (not primitive number which need no type spec)
1776
+ NumberObject: {
1777
+ test: function test(x) {
1778
+ return toStringTag(x) === 'Number' && _typeof$1(x) === 'object';
1779
+ },
1780
+ replace: function replace(n) {
1781
+ return Number(n);
1782
+ },
1783
+ // convert to primitive number
1784
+ revive: function revive(n) {
1785
+ return new Number(n);
1786
+ } // Revive to an objectified number
1787
+
1788
+ }
1789
+ };
1790
+
1791
+ var regexp = {
1792
+ regexp: {
1793
+ test: function test(x) {
1794
+ return toStringTag(x) === 'RegExp';
1795
+ },
1796
+ replace: function replace(rexp) {
1797
+ return {
1798
+ source: rexp.source,
1799
+ flags: (rexp.global ? 'g' : '') + (rexp.ignoreCase ? 'i' : '') + (rexp.multiline ? 'm' : '') + (rexp.sticky ? 'y' : '') + (rexp.unicode ? 'u' : '')
1800
+ };
1801
+ },
1802
+ revive: function revive(_ref) {
1803
+ var source = _ref.source,
1804
+ flags = _ref.flags;
1805
+ return new RegExp(source, flags);
1806
+ }
1807
+ }
1808
+ };
1809
+
1810
+ var resurrectableObjectsByUUID = {};
1811
+ var resurrectable = {
1812
+ resurrectable: {
1813
+ test: function test(x) {
1814
+ return x && !Array.isArray(x) && ['object', 'function', 'symbol'].includes(_typeof$1(x));
1815
+ },
1816
+ replace: function replace(rsrrctble) {
1817
+ var uuid = generateUUID();
1818
+ resurrectableObjectsByUUID[uuid] = rsrrctble;
1819
+ return uuid;
1820
+ },
1821
+ revive: function revive(serializedResurrectable) {
1822
+ return resurrectableObjectsByUUID[serializedResurrectable];
1823
+ }
1824
+ }
1825
+ };
1826
+
1827
+ var set = {
1828
+ set: {
1829
+ test: function test(x) {
1830
+ return toStringTag(x) === 'Set';
1831
+ },
1832
+ replace: function replace(st) {
1833
+ return _toConsumableArray$1(st.values());
1834
+ },
1835
+ revive: function revive(values) {
1836
+ return new Set(values);
1837
+ }
1838
+ }
1839
+ };
1840
+
1841
+ /* eslint-env browser, node */
1842
+ /* c8 ignore next */
1843
+
1844
+ var _global$1 = typeof self === 'undefined' ? global : self; // Support all kinds of typed arrays (views of ArrayBuffers)
1845
+
1846
+
1847
+ var typedArraysSocketIO = {};
1848
+ ['Int8Array', 'Uint8Array', 'Uint8ClampedArray', 'Int16Array', 'Uint16Array', 'Int32Array', 'Uint32Array', 'Float32Array', 'Float64Array'].forEach(function (typeName) {
1849
+ var arrType = typeName;
1850
+ var TypedArray = _global$1[typeName];
1851
+ /* c8 ignore next 3 */
1852
+
1853
+ if (!TypedArray) {
1854
+ return;
1855
+ }
1856
+
1857
+ typedArraysSocketIO[typeName.toLowerCase()] = {
1858
+ test: function test(x) {
1859
+ return toStringTag(x) === arrType;
1860
+ },
1861
+ replace: function replace(a) {
1862
+ return (a.byteOffset === 0 && a.byteLength === a.buffer.byteLength ? a // socket.io supports streaming ArrayBuffers.
1863
+ // If we have a typed array representing a portion
1864
+ // of the buffer, we need to clone
1865
+ // the buffer before leaving it to socket.io.
1866
+ : a.slice(0)).buffer;
1867
+ },
1868
+ revive: function revive(buf) {
1869
+ // One may configure socket.io to revive binary data as
1870
+ // Buffer or Blob.
1871
+ // We should therefore not rely on that the instance we
1872
+ // get here is an ArrayBuffer
1873
+ // If not, let's assume user wants to receive it as
1874
+ // configured with socket.io.
1875
+ return toStringTag(buf) === 'ArrayBuffer' ? new TypedArray(buf) : buf;
1876
+ }
1877
+ };
1878
+ });
1879
+
1880
+ /* eslint-env browser, node */
1881
+ /* c8 ignore next */
1882
+
1883
+ var _global = typeof self === 'undefined' ? global : self;
1884
+
1885
+ var typedArrays = {};
1886
+ ['Int8Array', 'Uint8Array', 'Uint8ClampedArray', 'Int16Array', 'Uint16Array', 'Int32Array', 'Uint32Array', 'Float32Array', 'Float64Array'].forEach(function (typeName) {
1887
+ var arrType = typeName;
1888
+ var TypedArray = _global[arrType];
1889
+ /* c8 ignore next 3 */
1890
+
1891
+ if (!TypedArray) {
1892
+ return;
1893
+ }
1894
+
1895
+ typedArrays[typeName.toLowerCase()] = {
1896
+ test: function test(x) {
1897
+ return toStringTag(x) === arrType;
1898
+ },
1899
+ replace: function replace(_ref, stateObj) {
1900
+ var buffer = _ref.buffer,
1901
+ byteOffset = _ref.byteOffset,
1902
+ l = _ref.length;
1903
+
1904
+ if (!stateObj.buffers) {
1905
+ stateObj.buffers = [];
1906
+ }
1907
+
1908
+ var index = stateObj.buffers.indexOf(buffer);
1909
+
1910
+ if (index > -1) {
1911
+ return {
1912
+ index: index,
1913
+ byteOffset: byteOffset,
1914
+ length: l
1915
+ };
1916
+ }
1917
+
1918
+ stateObj.buffers.push(buffer);
1919
+ return {
1920
+ encoded: encode(buffer),
1921
+ byteOffset: byteOffset,
1922
+ length: l
1923
+ };
1924
+ },
1925
+ revive: function revive(b64Obj, stateObj) {
1926
+ if (!stateObj.buffers) {
1927
+ stateObj.buffers = [];
1928
+ }
1929
+
1930
+ var byteOffset = b64Obj.byteOffset,
1931
+ len = b64Obj.length,
1932
+ encoded = b64Obj.encoded,
1933
+ index = b64Obj.index;
1934
+ var buffer;
1935
+
1936
+ if ('index' in b64Obj) {
1937
+ buffer = stateObj.buffers[index];
1938
+ } else {
1939
+ buffer = decode(encoded);
1940
+ stateObj.buffers.push(buffer);
1941
+ }
1942
+
1943
+ return new TypedArray(buffer, byteOffset, len);
1944
+ }
1945
+ };
1946
+ });
1947
+
1948
+ // This does not preserve `undefined` in sparse arrays; see the `undef`
1949
+ var undef$1 = {
1950
+ undef: {
1951
+ test: function test(x, stateObj) {
1952
+ return typeof x === 'undefined' && (stateObj.ownKeys || !('ownKeys' in stateObj));
1953
+ },
1954
+ replace: function replace(n) {
1955
+ return 0;
1956
+ },
1957
+ revive: function revive(s) {
1958
+ // Will add `undefined` (returning `undefined` would instead
1959
+ // avoid explicitly setting)
1960
+ return new p();
1961
+ }
1962
+ }
1963
+ };
1964
+
1965
+ var userObject = {
1966
+ userObject: {
1967
+ test: function test(x, stateObj) {
1968
+ return isUserObject(x);
1969
+ },
1970
+ replace: function replace(n) {
1971
+ return _objectSpread2$1({}, n);
1972
+ },
1973
+ revive: function revive(s) {
1974
+ return s;
1975
+ }
1976
+ }
1977
+ };
1978
+
1979
+ var arrayNonindexKeys = [{
1980
+ arrayNonindexKeys: {
1981
+ testPlainObjects: true,
1982
+ test: function test(x, stateObj) {
1983
+ if (Array.isArray(x)) {
1984
+ if ( // By avoiding serializing arrays into objects which
1985
+ // have only positive-integer keys, we reduce
1986
+ // size and improve revival performance; arrays with
1987
+ // non-index keys will be larger however
1988
+ Object.keys(x).some(function (k) {
1989
+ // No need to check for `isNaN` or
1990
+ // `isNaN(Number.parseInt())` as `NaN` will be
1991
+ // treated as a string.
1992
+ // No need to do check as
1993
+ // `Number.parseInt(Number())` since scientific
1994
+ // notation will be pre-resolved if a number
1995
+ // was given, and it will otherwise be a string
1996
+ return String(Number.parseInt(k)) !== k;
1997
+ })) {
1998
+ stateObj.iterateIn = 'object';
1999
+ stateObj.addLength = true;
2000
+ }
2001
+
2002
+ return true;
2003
+ }
2004
+
2005
+ return false;
2006
+ },
2007
+ replace: function replace(a, stateObj) {
2008
+ // Catch sparse undefined
2009
+ stateObj.iterateUnsetNumeric = true;
2010
+ return a;
2011
+ },
2012
+ revive: function revive(o) {
2013
+ if (Array.isArray(o)) {
2014
+ return o;
2015
+ }
2016
+
2017
+ var arr = []; // No map here as may be a sparse array (including
2018
+ // with `length` set)
2019
+ // Todo: Reenable when Node `engines` >= 7
2020
+ // Object.entries(o).forEach(([key, val]) => {
2021
+
2022
+ Object.keys(o).forEach(function (key) {
2023
+ var val = o[key];
2024
+ arr[key] = val;
2025
+ });
2026
+ return arr;
2027
+ }
2028
+ }
2029
+ }, {
2030
+ sparseUndefined: {
2031
+ test: function test(x, stateObj) {
2032
+ return typeof x === 'undefined' && stateObj.ownKeys === false;
2033
+ },
2034
+ replace: function replace(n) {
2035
+ return 0;
2036
+ },
2037
+ revive: function revive(s) {
2038
+ return undefined;
2039
+ } // Will avoid adding anything
2040
+
2041
+ }
2042
+ }];
2043
+
2044
+ var specialNumbers = [nan, infinity, negativeInfinity];
2045
+
2046
+ /* This preset includes types that are built-in into the JavaScript
2047
+ language itself, this should work universally.
2048
+
2049
+ Types that were added in ES6 or beyond will be checked before inclusion
2050
+ so that this module can be consumed by both ES5 and ES6 environments.
2051
+
2052
+ Some types cannot be encapsulated because their inner state is private:
2053
+ `WeakMap`, `WeakSet`.
2054
+
2055
+ The Function type is not included because their closures would not be
2056
+ serialized, so a revived Function that uses closures would not behave
2057
+ as expected.
2058
+
2059
+ Symbols are similarly not included.
2060
+ */
2061
+ var expObj$1 = [undef$1, // ES5
2062
+ arrayNonindexKeys, primitiveObjects, specialNumbers, date, error, errors, regexp].concat( // ES2015 (ES6)
2063
+
2064
+ /* c8 ignore next */
2065
+ typeof Map === 'function' ? map : [],
2066
+ /* c8 ignore next */
2067
+ typeof Set === 'function' ? set : [],
2068
+ /* c8 ignore next */
2069
+ typeof ArrayBuffer === 'function' ? arraybuffer : [],
2070
+ /* c8 ignore next */
2071
+ typeof Uint8Array === 'function' ? typedArrays : [],
2072
+ /* c8 ignore next */
2073
+ typeof DataView === 'function' ? dataview : [],
2074
+ /* c8 ignore next */
2075
+ typeof Intl !== 'undefined' ? intlTypes : [],
2076
+ /* c8 ignore next */
2077
+ typeof BigInt !== 'undefined' ? [bigint, bigintObject] : []);
2078
+
2079
+ /*
2080
+ When communicating via `postMessage()` (`Worker.postMessage()` or
2081
+ `window.postMessage()`), the browser will use a similar algorithm as Typeson
2082
+ does to encapsulate and revive all items in the structure (aka the structured
2083
+ clone algorithm). This algorithm supports all built-in types as well as many
2084
+ DOM types. Therefore, only types that are not included in the structured clone
2085
+ algorithm need to be registered, which is:
2086
+
2087
+ * Error
2088
+ * Specific Errors like SyntaxError, TypeError, etc.
2089
+ * Any custom type you want to send across window- or worker boundraries
2090
+
2091
+ This preset will only include the Error types and you can register your
2092
+ custom types after having registered these.
2093
+ */
2094
+ var postmessage = [error, errors];
2095
+
2096
+ var socketio = [expObj$1, // Leave ArrayBuffer as is, and let socket.io stream it instead.
2097
+ {
2098
+ arraybuffer: null
2099
+ }, // Encapsulate TypedArrays in ArrayBuffers instead of base64 strings.
2100
+ typedArraysSocketIO];
2101
+
2102
+ var sparseUndefined = [{
2103
+ sparseArrays: {
2104
+ testPlainObjects: true,
2105
+ test: function test(x) {
2106
+ return Array.isArray(x);
2107
+ },
2108
+ replace: function replace(a, stateObj) {
2109
+ stateObj.iterateUnsetNumeric = true;
2110
+ return a;
2111
+ }
2112
+ }
2113
+ }, {
2114
+ sparseUndefined: {
2115
+ test: function test(x, stateObj) {
2116
+ return typeof x === 'undefined' && stateObj.ownKeys === false;
2117
+ },
2118
+ replace: function replace(n) {
2119
+ return 0;
2120
+ },
2121
+ revive: function revive(s) {
2122
+ return undefined;
2123
+ } // Will avoid adding anything
2124
+
2125
+ }
2126
+ }];
2127
+
2128
+ /* This preset includes types for the Structured Cloning Algorithm. */
2129
+ var expObj = [// Todo: Might also register synchronous `ImageBitmap` and
2130
+ // `Blob`/`File`/`FileList`?
2131
+ // ES5
2132
+ userObject, // Processed last (non-builtin)
2133
+ undef$1, arrayNonindexKeys, primitiveObjects, specialNumbers, date, regexp, // Non-built-ins
2134
+ imagedata, imagebitmap, // Async return
2135
+ file, filelist, blob].concat( // ES2015 (ES6)
2136
+
2137
+ /* c8 ignore next */
2138
+ typeof Map === 'function' ? map : [],
2139
+ /* c8 ignore next */
2140
+ typeof Set === 'function' ? set : [],
2141
+ /* c8 ignore next */
2142
+ typeof ArrayBuffer === 'function' ? arraybuffer : [],
2143
+ /* c8 ignore next */
2144
+ typeof Uint8Array === 'function' ? typedArrays : [],
2145
+ /* c8 ignore next */
2146
+ typeof DataView === 'function' ? dataview : [],
2147
+ /* c8 ignore next */
2148
+ typeof Intl !== 'undefined' ? intlTypes : [],
2149
+ /* c8 ignore next */
2150
+ typeof crypto !== 'undefined' ? cryptokey : [],
2151
+ /* c8 ignore next */
2152
+ typeof BigInt !== 'undefined' ? [bigint, bigintObject] : []);
2153
+
2154
+ var structuredCloningThrowing = expObj.concat({
2155
+ checkDataCloneException: {
2156
+ test: function test(val) {
2157
+ // Should also throw with:
2158
+ // 1. `IsDetachedBuffer` (a process not called within the
2159
+ // ECMAScript spec)
2160
+ // 2. `IsCallable` (covered by `typeof === 'function'` or a
2161
+ // function's `toStringTag`)
2162
+ // 3. internal slots besides [[Prototype]] or [[Extensible]] (e.g.,
2163
+ // [[PromiseState]] or [[WeakMapData]])
2164
+ // 4. exotic object (e.g., `Proxy`) (unless an `%ObjectPrototype%`
2165
+ // intrinsic object) (which does not have default
2166
+ // behavior for one or more of the essential internal methods
2167
+ // that are limited to the following for non-function objects
2168
+ // (we auto-exclude functions):
2169
+ // [[GetPrototypeOf]],[[SetPrototypeOf]],[[IsExtensible]],
2170
+ // [[PreventExtensions]],[[GetOwnProperty]],
2171
+ // [[DefineOwnProperty]],[[HasProperty]],
2172
+ // [[Get]],[[Set]],[[Delete]],[[OwnPropertyKeys]]);
2173
+ // except for the standard, built-in exotic objects, we'd need
2174
+ // to know whether these methods had distinct behaviors
2175
+ // Note: There is no apparent way for us to detect a `Proxy` and
2176
+ // reject (Chrome at least is not rejecting anyways)
2177
+ var stringTag = {}.toString.call(val).slice(8, -1);
2178
+
2179
+ if ([// Symbol's `toStringTag` is only "Symbol" for its initial
2180
+ // value, so we check `typeof`
2181
+ 'symbol', // All functions including bound function exotic objects
2182
+ 'function'].includes(_typeof$1(val)) || [// A non-array exotic object
2183
+ 'Arguments', // A non-array exotic object
2184
+ 'Module', // `Error` and other errors have the [[ErrorData]] internal
2185
+ // slot and give "Error"
2186
+ 'Error', // Promise instances have an extra slot ([[PromiseState]])
2187
+ // but not throwing in Chrome `postMessage`
2188
+ 'Promise', // WeakMap instances have an extra slot ([[WeakMapData]])
2189
+ // but not throwing in Chrome `postMessage`
2190
+ 'WeakMap', // WeakSet instances have an extra slot ([[WeakSetData]])
2191
+ // but not throwing in Chrome `postMessage`
2192
+ 'WeakSet', // HTML-SPECIFIC
2193
+ 'Event', // Also in Node `worker_threads` (currently experimental)
2194
+ 'MessageChannel'].includes(stringTag) ||
2195
+ /*
2196
+ // isClosed is no longer documented
2197
+ ((stringTag === 'Blob' || stringTag === 'File') &&
2198
+ val.isClosed) ||
2199
+ */
2200
+ val && _typeof$1(val) === 'object' && // Duck-type DOM node objects (non-array exotic?
2201
+ // objects which cannot be cloned by the SCA)
2202
+ typeof val.nodeType === 'number' && typeof val.insertBefore === 'function') {
2203
+ throw new DOMException('The object cannot be cloned.', 'DataCloneError');
2204
+ }
2205
+
2206
+ return false;
2207
+ }
2208
+ }
2209
+ });
2210
+
2211
+ var undef = [sparseUndefined, undef$1];
2212
+
2213
+ var universal = [expObj$1 // TODO: Add types that are de-facto universal even though not
2214
+ // built-in into ecmasript standard.
2215
+ ];
2216
+
2217
+ exports.JSON_TYPES = y;
2218
+ exports.Typeson = u;
2219
+ exports.TypesonPromise = e;
2220
+ exports.Undefined = p;
2221
+ exports.arrayNonindexKeys = arrayNonindexKeys;
2222
+ exports.arraybuffer = arraybuffer;
2223
+ exports.bigint = bigint;
2224
+ exports.bigintObject = bigintObject;
2225
+ exports.blob = blob;
2226
+ exports.builtin = expObj$1;
2227
+ exports.cloneable = cloneable;
2228
+ exports.cryptokey = cryptokey;
2229
+ exports.dataview = dataview;
2230
+ exports.date = date;
2231
+ exports.error = error;
2232
+ exports.errors = errors;
2233
+ exports.escapeKeyPathComponent = escapeKeyPathComponent;
2234
+ exports.file = file;
2235
+ exports.filelist = filelist;
2236
+ exports.getByKeyPath = getByKeyPath;
2237
+ exports.getJSONType = getJSONType;
2238
+ exports.hasConstructorOf = hasConstructorOf;
2239
+ exports.imagebitmap = imagebitmap;
2240
+ exports.imagedata = imagedata;
2241
+ exports.infinity = infinity;
2242
+ exports.intlTypes = intlTypes;
2243
+ exports.isObject = isObject;
2244
+ exports.isPlainObject = isPlainObject;
2245
+ exports.isThenable = isThenable;
2246
+ exports.isUserObject = isUserObject;
2247
+ exports.map = map;
2248
+ exports.nan = nan;
2249
+ exports.negativeInfinity = negativeInfinity;
2250
+ exports.nonbuiltinIgnore = nonbuiltinIgnore;
2251
+ exports.postmessage = postmessage;
2252
+ exports.primitiveObjects = primitiveObjects;
2253
+ exports.regexp = regexp;
2254
+ exports.resurrectable = resurrectable;
2255
+ exports.set = set;
2256
+ exports.setAtKeyPath = setAtKeyPath;
2257
+ exports.socketio = socketio;
2258
+ exports.sparseUndefined = sparseUndefined;
2259
+ exports.specialNumbers = specialNumbers;
2260
+ exports.structuredCloning = expObj;
2261
+ exports.structuredCloningThrowing = structuredCloningThrowing;
2262
+ exports.toStringTag = toStringTag;
2263
+ exports.typedArrays = typedArrays;
2264
+ exports.typedArraysSocketio = typedArraysSocketIO;
2265
+ exports.undef = undef$1;
2266
+ exports.undefPreset = undef;
2267
+ exports.unescapeKeyPathComponent = unescapeKeyPathComponent;
2268
+ exports.universal = universal;
2269
+ exports.userObject = userObject;
2270
+
2271
+ Object.defineProperty(exports, '__esModule', { value: true });
2272
+
2273
+ }));
2274
+ //# sourceMappingURL=index.umd.js.map