indexeddbshim 17.6.0 → 17.7.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.
@@ -1,4 +1,4 @@
1
- /*! indexeddbshim - v17.6.0 - 9/1/2026 */
1
+ /*! indexeddbshim - v17.7.0 - 9/2/2026 */
2
2
 
3
3
  'use strict';
4
4
 
@@ -6059,10 +6059,10 @@ function toStringTag(e) {
6059
6059
  }
6060
6060
  function hasConstructorOf(r, n) {
6061
6061
  if (!r || "object" != typeof r) return false;
6062
- const a = t(r);
6063
- if (!a) return null === n;
6064
- const o = e(a, "constructor") && a.constructor;
6065
- return "function" != typeof o ? null === n : n === o || null !== n && Function.prototype.toString.call(o) === Function.prototype.toString.call(n) || "function" == typeof n && "string" == typeof o.__typeson__type__ && o.__typeson__type__ === n.__typeson__type__;
6062
+ const o = t(r);
6063
+ if (!o) return null === n;
6064
+ const a = e(o, "constructor") && o.constructor;
6065
+ return "function" != typeof a ? null === n : n === a || null !== n && Function.prototype.toString.call(a) === Function.prototype.toString.call(n) || "function" == typeof n && "string" == typeof a.__typeson__type__ && a.__typeson__type__ === n.__typeson__type__;
6066
6066
  }
6067
6067
  function isPlainObject(e) {
6068
6068
  return !(!e || "Object" !== toStringTag(e)) && (!t(e) || hasConstructorOf(e, Object));
@@ -6084,28 +6084,28 @@ function unescapeKeyPathComponent(e) {
6084
6084
  function getByKeyPath(t, r, n) {
6085
6085
  if ("" === r) return t;
6086
6086
  if (null === t || "object" != typeof t) throw new TypeError("Unexpected non-object type");
6087
- const a = r.indexOf("."),
6088
- o = unescapeKeyPathComponent(-1 === a ? r : r.slice(0, a));
6089
- if (e(t, o)) {
6090
- if (-1 !== a) {
6091
- const e = t[o];
6092
- return void 0 === e ? void 0 : getByKeyPath(e, r.slice(a + 1));
6087
+ const o = r.indexOf("."),
6088
+ a = unescapeKeyPathComponent(-1 === o ? r : r.slice(0, o));
6089
+ if (e(t, a)) {
6090
+ if (-1 !== o) {
6091
+ const e = t[a];
6092
+ return void 0 === e ? void 0 : getByKeyPath(e, r.slice(o + 1));
6093
6093
  }
6094
- return t[o];
6094
+ return t[a];
6095
6095
  }
6096
6096
  }
6097
- function setAtKeyPath(t, r, n, a) {
6097
+ function setAtKeyPath(t, r, n, o) {
6098
6098
  if ("" === r) return n;
6099
- let o = t,
6099
+ let a = t,
6100
6100
  s = r;
6101
6101
  for (;;) {
6102
- if (!o || "object" != typeof o) throw new TypeError("Unexpected non-object type");
6102
+ if (!a || "object" != typeof a) throw new TypeError("Unexpected non-object type");
6103
6103
  const r = s.indexOf("."),
6104
6104
  i = unescapeKeyPathComponent(-1 === r ? s : s.slice(0, r));
6105
6105
  if ("__proto__" === i) throw new TypeError("Invalid property");
6106
- if (-1 === r) return o[i] = n, t;
6107
- if (!e(o, i)) throw new TypeError("Invalid property");
6108
- o = o[i], s = s.slice(r + 1);
6106
+ if (-1 === r) return a[i] = n, t;
6107
+ if (!e(a, i)) throw new TypeError("Invalid property");
6108
+ a = a[i], s = s.slice(r + 1);
6109
6109
  }
6110
6110
  }
6111
6111
  function getJSONType(e) {
@@ -6121,9 +6121,9 @@ const {
6121
6121
  hasOwn: n
6122
6122
  } = Object,
6123
6123
  {
6124
- isArray: a
6124
+ isArray: o
6125
6125
  } = Array,
6126
- o = ["type", "replaced", "iterateIn", "iterateUnsetNumeric", "addLength"];
6126
+ a = ["type", "replaced", "iterateIn", "iterateUnsetNumeric", "iterateSymbols", "addLength"];
6127
6127
  function setOwnEnumerable(e, t, r) {
6128
6128
  Object.defineProperty(e, t, {
6129
6129
  configurable: true,
@@ -6132,6 +6132,7 @@ function setOwnEnumerable(e, t, r) {
6132
6132
  writable: true
6133
6133
  });
6134
6134
  }
6135
+ const s = ["asyncIterator", "hasInstance", "isConcatSpreadable", "iterator", "match", "matchAll", "replace", "search", "species", "split", "toPrimitive", "toStringTag", "unscopables"];
6135
6136
  function nestedPathsFirst(e, t) {
6136
6137
  if ("" === e.keypath) return -1;
6137
6138
  let r = e.keypath.match(/\./gu) ?? 0,
@@ -6140,7 +6141,12 @@ function nestedPathsFirst(e, t) {
6140
6141
  }
6141
6142
  class Typeson {
6142
6143
  constructor(e) {
6143
- this.options = e, this.plainObjectReplacers = [], this.nonplainObjectReplacers = [], this.revivers = {}, this.types = {};
6144
+ this.options = e, this.plainObjectReplacers = [], this.nonplainObjectReplacers = [], this.revivers = {}, this.types = {}, this.symbolsByName = Object.create(null), this.symbolsByValue = new Map();
6145
+ const t = e?.symbols;
6146
+ t && Object.entries(t).forEach(([e, t]) => {
6147
+ if ("symbol" != typeof t) throw new TypeError("Non-symbol value supplied for `symbols` entry: " + e);
6148
+ this.symbolsByName[e] = t, this.symbolsByValue.set(t, e);
6149
+ });
6144
6150
  }
6145
6151
  stringify(e, t, r, n) {
6146
6152
  n = {
@@ -6148,8 +6154,8 @@ class Typeson {
6148
6154
  ...n,
6149
6155
  stringification: true
6150
6156
  };
6151
- const o = this.encapsulate(e, null, n);
6152
- return a(o) ? JSON.stringify(o[0], t, r) : o.then(e => JSON.stringify(e, t, r));
6157
+ const a = this.encapsulate(e, null, n);
6158
+ return o(a) ? JSON.stringify(a[0], t, r) : a.then(e => JSON.stringify(e, t, r));
6153
6159
  }
6154
6160
  stringifySync(e, t, r, n) {
6155
6161
  return this.stringify(e, t, r, {
@@ -6198,74 +6204,74 @@ class Typeson {
6198
6204
  iterateNone: true
6199
6205
  });
6200
6206
  }
6201
- encapsulate(e, t, s) {
6202
- const i = {
6207
+ encapsulate(e, t, i) {
6208
+ const c = {
6203
6209
  sync: true,
6204
6210
  ...this.options,
6205
- ...s
6211
+ ...i
6206
6212
  },
6207
6213
  {
6208
- sync: c
6209
- } = i,
6214
+ sync: l
6215
+ } = c,
6216
+ y = {},
6210
6217
  u = {},
6211
- y = [],
6212
- l = [],
6213
6218
  p = [],
6214
- f = !("cyclic" in i) || i.cyclic,
6219
+ f = [],
6220
+ d = [],
6221
+ m = !("cyclic" in c) || c.cyclic,
6215
6222
  {
6216
- encapsulateObserver: d,
6217
- encapsulateError: m
6218
- } = i,
6223
+ encapsulateObserver: h,
6224
+ encapsulateError: b
6225
+ } = c,
6219
6226
  finish = e => {
6220
- const t = Object.values(u);
6221
- if (i.iterateNone) return t.length ? t[0] : getJSONType(e);
6222
- if (t.length) {
6223
- if (i.returnTypeNames) return [...new Set(t)];
6224
- e && isPlainObject(e) && !n(e, "$types") ? e.$types = u : e = {
6225
- $: e,
6226
- $types: {
6227
- $: u
6228
- }
6229
- };
6230
- } else isObject(e) && n(e, "$types") && (e = {
6227
+ const t = Object.values(y);
6228
+ if (c.iterateNone) return t.length ? t[0] : getJSONType(e);
6229
+ if (c.returnTypeNames) return !!t.length && [...new Set(t)];
6230
+ const r = Object.keys(u).length > 0,
6231
+ o = isObject(e) && (n(e, "$types") || n(e, "$symbolKeys"));
6232
+ return r || t.length ? (!o && e && isPlainObject(e) ? t.length && (e.$types = y) : e = {
6233
+ $: e,
6234
+ $types: {
6235
+ $: y
6236
+ }
6237
+ }, r && (e.$symbolKeys = u)) : o && (e = {
6231
6238
  $: e,
6232
6239
  $types: true
6233
- });
6234
- return !i.returnTypeNames && e;
6240
+ }), e;
6235
6241
  },
6236
6242
  checkPromises = async (e, t) => {
6237
6243
  const r = await Promise.all(t.map(e => e[1].p));
6238
6244
  return await Promise.all(r.map(async function (r) {
6239
6245
  const n = [],
6240
- [a] = t.splice(0, 1),
6241
- [o,, s, i, c, u, y] = a,
6242
- l = _encapsulate(o, r, s, i, n, true, y),
6243
- p = hasConstructorOf(l, TypesonPromise);
6244
- return o && p ? (setOwnEnumerable(c, u, await l.p), checkPromises(e, n)) : (o ? setOwnEnumerable(c, u, l) : e = p ? l.p : l, checkPromises(e, n));
6246
+ [o] = t.splice(0, 1),
6247
+ [a,, s, i, c, l, y] = o,
6248
+ u = _encapsulate(a, r, s, i, n, true, y),
6249
+ p = hasConstructorOf(u, TypesonPromise);
6250
+ return a && p ? (setOwnEnumerable(c, l, await u.p), checkPromises(e, n)) : (a ? setOwnEnumerable(c, l, u) : e = p ? u.p : u, checkPromises(e, n));
6245
6251
  })), e;
6246
6252
  },
6247
6253
  _adaptBuiltinStateObjectProperties = (e, t, r) => {
6248
6254
  Object.assign(e, t);
6249
- const n = o.map(t => {
6255
+ const n = a.map(t => {
6250
6256
  const r = e[t];
6251
6257
  return delete e[t], r;
6252
6258
  });
6253
- r(), o.forEach((t, r) => {
6259
+ r(), a.forEach((t, r) => {
6254
6260
  e[t] = n[r];
6255
6261
  });
6256
6262
  },
6257
- _encapsulate = (e, t, o, s, c, p, f) => {
6258
- let h,
6259
- g = {};
6260
- const b = d ? function (r) {
6261
- const n = f ?? s.type ?? getJSONType(t);
6262
- d(Object.assign(r ?? g, {
6263
+ _encapsulate = (e, t, a, i, l, d, m) => {
6264
+ let g,
6265
+ v = {};
6266
+ const w = h ? function (r) {
6267
+ const n = m ?? i.type ?? getJSONType(t);
6268
+ h(Object.assign(r ?? v, {
6263
6269
  keypath: e,
6264
6270
  value: t,
6265
- cyclic: o,
6266
- stateObj: s,
6267
- promisesData: c,
6268
- resolvingTypesonPromise: p,
6271
+ cyclic: a,
6272
+ stateObj: i,
6273
+ promisesData: l,
6274
+ resolvingTypesonPromise: d,
6269
6275
  awaitingTypesonPromise: hasConstructorOf(t, TypesonPromise)
6270
6276
  }, {
6271
6277
  type: n
@@ -6274,136 +6280,175 @@ class Typeson {
6274
6280
  getEncapsulatedValue = (e, t, r) => {
6275
6281
  try {
6276
6282
  return {
6277
- value: _encapsulate(e, t[r], Boolean(o), s, c, p)
6283
+ value: _encapsulate(e, t[r], Boolean(a), i, l, d)
6278
6284
  };
6279
6285
  } catch (n) {
6280
- if (!m) throw n;
6281
- const a = f ?? s.type ?? getJSONType(t),
6282
- o = m({
6286
+ if (!b) throw n;
6287
+ const o = m ?? i.type ?? getJSONType(t),
6288
+ a = b({
6283
6289
  keypath: e,
6284
6290
  error: n,
6285
6291
  parent: t,
6286
6292
  key: r,
6287
- stateObj: s,
6288
- type: a
6293
+ stateObj: i,
6294
+ type: o
6289
6295
  });
6290
- if (!o) throw n;
6291
- if ("substitute" in o) return {
6292
- value: o.substitute,
6296
+ if (!a) throw n;
6297
+ if ("substitute" in a) return {
6298
+ value: a.substitute,
6293
6299
  substitute: true
6294
6300
  };
6295
- if (o.ignore) return;
6301
+ if (a.ignore) return;
6296
6302
  throw n;
6297
6303
  }
6298
6304
  };
6299
- if (["string", "boolean", "number", "undefined"].includes(typeof t)) return void 0 === t || t === 1 / 0 || 0 === t || t === -1 / 0 || Number.isNaN(t) ? (h = s.replaced ? t : replace(e, t, s, c, false, p, b), h !== t && (g = {
6300
- replaced: h
6301
- })) : h = t, b && b(), h;
6302
- if (null === t) return b && b(), t;
6303
- if (o && t && "object" == typeof t && !s.iterateIn && !s.iterateUnsetNumeric) {
6304
- const r = y.indexOf(t);
6305
- if (-1 !== r) return u[e] = "#", b && b({
6306
- cyclicKeypath: l[r]
6307
- }), "#" + l[r];
6308
- true === o && (y.push(t), l.push(e));
6305
+ if (["string", "boolean", "number", "undefined"].includes(typeof t)) return void 0 === t || t === 1 / 0 || 0 === t || t === -1 / 0 || Number.isNaN(t) ? (g = i.replaced ? t : replace(e, t, i, l, false, d, w), g !== t && (v = {
6306
+ replaced: g
6307
+ })) : g = t, w && w(), g;
6308
+ if (null === t) return w && w(), t;
6309
+ if (a && t && "object" == typeof t && !i.iterateIn && !i.iterateUnsetNumeric) {
6310
+ const r = p.indexOf(t);
6311
+ if (-1 !== r) return y[e] = "#", w && w({
6312
+ cyclicKeypath: f[r]
6313
+ }), "#" + f[r];
6314
+ true === a && (p.push(t), f.push(e));
6309
6315
  }
6310
- const v = isPlainObject(t),
6311
- w = a(t),
6312
- O = (v || w) && (!this.plainObjectReplacers.length || s.replaced) || s.iterateIn ? t : replace(e, t, s, c, v || w, null, b);
6313
- let A;
6314
- if (O !== t ? (h = O, g = {
6315
- replaced: O
6316
- }) : "" === e && hasConstructorOf(t, TypesonPromise) ? (c.push([e, t, o, s, void 0, void 0, s.type]), h = t) : w && "object" !== s.iterateIn || "array" === s.iterateIn ? (A = new Array(t.length), g = {
6317
- clone: A
6318
- }) : !v && ("object" != typeof t || "toJSON" in t || hasConstructorOf(t, TypesonPromise) || hasConstructorOf(t, Promise) || hasConstructorOf(t, ArrayBuffer)) && "object" !== s.iterateIn ? h = t : (A = {}, s.addLength && (A.length = t.length), g = {
6319
- clone: A
6320
- }), b && b(), i.iterateNone) return A ?? h;
6321
- if (!A) return h;
6322
- if (s.iterateIn) {
6316
+ const O = isPlainObject(t),
6317
+ A = o(t),
6318
+ T = (O || A) && (!this.plainObjectReplacers.length || i.replaced) || i.iterateIn ? t : replace(e, t, i, l, O || A, null, w);
6319
+ let S;
6320
+ if (T !== t ? (g = T, v = {
6321
+ replaced: T
6322
+ }) : "" === e && hasConstructorOf(t, TypesonPromise) ? (l.push([e, t, a, i, void 0, void 0, i.type]), g = t) : A && "object" !== i.iterateIn || "array" === i.iterateIn ? (S = new Array(t.length), v = {
6323
+ clone: S
6324
+ }) : !O && ("object" != typeof t || "toJSON" in t || hasConstructorOf(t, TypesonPromise) || hasConstructorOf(t, Promise) || hasConstructorOf(t, ArrayBuffer)) && "object" !== i.iterateIn ? g = t : (S = {}, i.addLength && (S.length = t.length), v = {
6325
+ clone: S
6326
+ }), w && w(), c.iterateNone) return S ?? g;
6327
+ if (!S) return g;
6328
+ if (i.iterateIn) {
6323
6329
  for (const r in t) {
6324
- const a = {
6330
+ const o = {
6325
6331
  ownKeys: n(t, r)
6326
6332
  };
6327
- _adaptBuiltinStateObjectProperties(s, a, () => {
6333
+ _adaptBuiltinStateObjectProperties(i, o, () => {
6328
6334
  const n = e + (e ? "." : "") + escapeKeyPathComponent(r),
6329
- a = getEncapsulatedValue(n, t, r),
6330
- i = a && a.value;
6331
- hasConstructorOf(i, TypesonPromise) ? c.push([n, i, Boolean(o), s, A, r, s.type]) : a && (void 0 !== i || "substitute" in a) && setOwnEnumerable(A, r, i);
6335
+ o = getEncapsulatedValue(n, t, r),
6336
+ s = o && o.value;
6337
+ hasConstructorOf(s, TypesonPromise) ? l.push([n, s, Boolean(a), i, S, r, i.type]) : o && (void 0 !== s || "substitute" in o) && setOwnEnumerable(S, r, s);
6332
6338
  });
6333
6339
  }
6334
- b && b({
6340
+ w && w({
6335
6341
  endIterateIn: true,
6336
6342
  end: true
6337
6343
  });
6338
6344
  } else r(t).forEach(function (r) {
6339
6345
  const n = e + (e ? "." : "") + escapeKeyPathComponent(r);
6340
- _adaptBuiltinStateObjectProperties(s, {
6346
+ _adaptBuiltinStateObjectProperties(i, {
6341
6347
  ownKeys: true
6342
6348
  }, () => {
6343
6349
  const e = getEncapsulatedValue(n, t, r),
6344
- a = e && e.value;
6345
- hasConstructorOf(a, TypesonPromise) ? c.push([n, a, Boolean(o), s, A, r, s.type]) : e && (void 0 !== a || "substitute" in e) && setOwnEnumerable(A, r, a);
6350
+ o = e && e.value;
6351
+ hasConstructorOf(o, TypesonPromise) ? l.push([n, o, Boolean(a), i, S, r, i.type]) : e && (void 0 !== o || "substitute" in e) && setOwnEnumerable(S, r, o);
6346
6352
  });
6347
- }), b && b({
6353
+ }), w && w({
6348
6354
  endIterateOwn: true,
6349
6355
  end: true
6350
- });
6351
- if (s.iterateUnsetNumeric) {
6356
+ }), (i.iterateSymbols || c.iterateSymbols) && (Object.getOwnPropertySymbols(t).filter(e => Object.prototype.propertyIsEnumerable.call(t, e)).forEach(r => {
6357
+ const n = function resolveSymbolIdentity(e, t) {
6358
+ const r = Symbol.keyFor(e);
6359
+ if (void 0 !== r) return {
6360
+ for: r
6361
+ };
6362
+ const n = s.find(t => Symbol[t] === e);
6363
+ if (n) return {
6364
+ wellKnown: n
6365
+ };
6366
+ const o = t.get(e);
6367
+ return void 0 !== o ? {
6368
+ registered: o
6369
+ } : null;
6370
+ }(r, this.symbolsByValue);
6371
+ if (!n) {
6372
+ if (c.throwOnUnregisteredSymbol) throw new TypeError("Cannot serialize a Symbol-keyed property whose Symbol has no portable identity (not global, not well-known, and not in the `symbols` option): " + String(r));
6373
+ return;
6374
+ }
6375
+ const o = u[e] ??= [],
6376
+ y = {
6377
+ key: n
6378
+ };
6379
+ o.push(y);
6380
+ const p = o.length - 1,
6381
+ f = `$symbolKeys.${escapeKeyPathComponent(e)}.${String(p)}.value`,
6382
+ d = {
6383
+ value: t[r]
6384
+ };
6385
+ _adaptBuiltinStateObjectProperties(i, {
6386
+ ownKeys: true
6387
+ }, () => {
6388
+ const e = getEncapsulatedValue(f, d, "value"),
6389
+ t = e && e.value;
6390
+ hasConstructorOf(t, TypesonPromise) ? l.push([f, t, Boolean(a), i, y, "value", i.type]) : e && (void 0 !== t || "substitute" in e) && setOwnEnumerable(y, "value", t);
6391
+ });
6392
+ }), w && w({
6393
+ endIterateSymbols: true,
6394
+ end: true
6395
+ }));
6396
+ if (i.iterateUnsetNumeric) {
6352
6397
  const r = t.length;
6353
6398
  for (let n = 0; n < r; n++) {
6354
6399
  if (n in t) continue;
6355
6400
  const r = `${e}${e ? "." : ""}${String(n)}`;
6356
- _adaptBuiltinStateObjectProperties(s, {
6401
+ _adaptBuiltinStateObjectProperties(i, {
6357
6402
  ownKeys: false
6358
6403
  }, () => {
6359
- const e = _encapsulate(r, void 0, Boolean(o), s, c, p);
6360
- hasConstructorOf(e, TypesonPromise) ? c.push([r, e, Boolean(o), s, A, n, s.type]) : void 0 !== e && setOwnEnumerable(A, n, e);
6404
+ const e = _encapsulate(r, void 0, Boolean(a), i, l, d);
6405
+ hasConstructorOf(e, TypesonPromise) ? l.push([r, e, Boolean(a), i, S, n, i.type]) : void 0 !== e && setOwnEnumerable(S, n, e);
6361
6406
  });
6362
6407
  }
6363
- b && b({
6408
+ w && w({
6364
6409
  endIterateUnsetNumeric: true,
6365
6410
  end: true
6366
6411
  });
6367
6412
  }
6368
- return A;
6413
+ return S;
6369
6414
  },
6370
- replace = (e, t, r, n, a, o, s) => {
6371
- const i = a ? this.plainObjectReplacers : this.nonplainObjectReplacers;
6372
- let y = i.length;
6373
- for (; y--;) {
6374
- const a = i[y];
6375
- if (a.test(t, r)) {
6415
+ replace = (e, t, r, n, o, a, s) => {
6416
+ const i = o ? this.plainObjectReplacers : this.nonplainObjectReplacers;
6417
+ let c = i.length;
6418
+ for (; c--;) {
6419
+ const o = i[c];
6420
+ if (o.test(t, r)) {
6376
6421
  const {
6377
6422
  type: i
6378
- } = a;
6423
+ } = o;
6379
6424
  if (Object.hasOwn(this.revivers, i)) {
6380
- const t = u[e];
6381
- u[e] = t ? [i].concat(t) : i;
6425
+ const t = y[e];
6426
+ y[e] = t ? [i].concat(t) : i;
6382
6427
  }
6383
6428
  if (Object.assign(r, {
6384
6429
  type: i,
6385
6430
  replaced: true
6386
- }), (c || !a.replaceAsync) && !a.replace) return s && s({
6431
+ }), (l || !o.replaceAsync) && !o.replace) return s && s({
6387
6432
  typeDetected: true
6388
- }), _encapsulate(e, t, f && "readonly", r, n, o, i);
6389
- let y;
6433
+ }), _encapsulate(e, t, m && "readonly", r, n, a, i);
6434
+ let c;
6390
6435
  if (s && s({
6391
6436
  replacing: true
6392
- }), c || !a.replaceAsync) {
6393
- if (void 0 === a.replace) throw new TypeError("Missing replacer");
6394
- y = a.replace(t, r);
6395
- } else y = a.replaceAsync(t, r);
6396
- return _encapsulate(e, y, f && "readonly", r, n, o, i);
6437
+ }), l || !o.replaceAsync) {
6438
+ if (void 0 === o.replace) throw new TypeError("Missing replacer");
6439
+ c = o.replace(t, r);
6440
+ } else c = o.replaceAsync(t, r);
6441
+ return _encapsulate(e, c, m && "readonly", r, n, a, i);
6397
6442
  }
6398
6443
  }
6399
6444
  return t;
6400
6445
  },
6401
- h = _encapsulate("", e, f, t ?? {}, p);
6402
- if (p.length) return c && i.throwOnBadSyncType ? (() => {
6446
+ g = _encapsulate("", e, m, t ?? {}, d);
6447
+ if (d.length) return l && c.throwOnBadSyncType ? (() => {
6403
6448
  throw new TypeError("Sync method requested but async result obtained");
6404
- })() : Promise.resolve(checkPromises(h, p)).then(finish);
6405
- if (!c && i.throwOnBadSyncType) throw new TypeError("Async method requested but sync result obtained");
6406
- return c && i.stringification ? [finish(h)] : c ? finish(h) : Promise.resolve(finish(h));
6449
+ })() : Promise.resolve(checkPromises(g, d)).then(finish);
6450
+ if (!l && c.throwOnBadSyncType) throw new TypeError("Async method requested but sync result obtained");
6451
+ return l && c.stringification ? [finish(g)] : l ? finish(g) : Promise.resolve(finish(g));
6407
6452
  }
6408
6453
  encapsulateSync(e, t, r) {
6409
6454
  return this.encapsulate(e, t, {
@@ -6420,111 +6465,144 @@ class Typeson {
6420
6465
  });
6421
6466
  }
6422
6467
  revive(e, t) {
6423
- const o = {
6468
+ const a = {
6424
6469
  sync: true,
6425
6470
  ...this.options,
6426
6471
  ...t
6427
6472
  },
6428
6473
  {
6429
- sync: s
6430
- } = o;
6474
+ sync: i
6475
+ } = a;
6431
6476
  function finishRevival(e) {
6432
- if (s) return e;
6433
- if (o.throwOnBadSyncType) throw new TypeError("Async method requested but sync result obtained");
6477
+ if (i) return e;
6478
+ if (a.throwOnBadSyncType) throw new TypeError("Async method requested but sync result obtained");
6434
6479
  return Promise.resolve(e);
6435
6480
  }
6436
6481
  if (!e || "object" != typeof e || Array.isArray(e)) return finishRevival(e);
6437
- let i = e.$types;
6438
- if (true === i) return finishRevival(e.$);
6439
- if (!i || "object" != typeof i || Array.isArray(i)) return finishRevival(e);
6440
- const c = [],
6441
- u = Object.create(null),
6442
- y = {};
6443
- let l = true;
6444
- i.$ && isPlainObject(i.$) && (e = e.$, i = i.$, l = false);
6482
+ let c = e.$types;
6483
+ if (true === c) return finishRevival(e.$);
6484
+ const l = e.$symbolKeys;
6485
+ let y = void 0 !== l;
6486
+ if (!c || "object" != typeof c || Array.isArray(c)) {
6487
+ if (!l) return finishRevival(e);
6488
+ c = {};
6489
+ }
6490
+ const u = [],
6491
+ p = Object.create(null),
6492
+ f = {};
6493
+ let d = true;
6494
+ c.$ && isPlainObject(c.$) && (e = e.$, c = c.$, d = false, y = false, void 0 !== l && isObject(e) && !n(e, "$symbolKeys") && (e.$symbolKeys = l, y = true));
6445
6495
  const executeReviver = (e, t) => {
6446
6496
  const [r] = this.revivers[e] ?? [];
6447
6497
  if (!r) throw new Error("Unregistered type: " + e);
6448
- if (s && !("revive" in r)) return t;
6449
- if (!s && r.reviveAsync) return r.reviveAsync(t, y);
6450
- if (r.revive) return r.revive(t, y);
6498
+ if (i && !("revive" in r)) return t;
6499
+ if (!i && r.reviveAsync) return r.reviveAsync(t, f);
6500
+ if (r.revive) return r.revive(t, f);
6451
6501
  throw new Error("Missing reviver");
6452
6502
  },
6453
- p = [];
6503
+ m = [];
6454
6504
  function checkUndefined(e) {
6455
6505
  return hasConstructorOf(e, Undefined) ? void 0 : e;
6456
6506
  }
6457
- const f = (() => {
6458
- if (!i) throw new Error("Found bad `types`");
6459
- const t = [];
6460
- if (Object.entries(i).forEach(([e, r]) => {
6461
- "#" !== r && [].concat(r).forEach(r => {
6462
- const [, {
6463
- plain: n
6464
- }] = this.revivers[r] ?? [null, {}];
6465
- n && (t.push({
6466
- keypath: e,
6467
- type: r
6468
- }), delete i[e]);
6469
- });
6470
- }), t.length) return t.sort(nestedPathsFirst), t.reduce(function reducer(t, {
6471
- keypath: r,
6472
- type: n
6473
- }) {
6474
- if (isThenable(t)) return t.then(e => reducer(e, {
6507
+ const reHomeSymbolKeys = e => {
6508
+ if (!isObject(e)) return;
6509
+ const t = y ? e.$symbolKeys : l;
6510
+ t && (Object.entries(t).forEach(([t, r]) => {
6511
+ const o = getByKeyPath(e, t);
6512
+ isObject(o) && r.forEach(e => {
6513
+ if (!n(e, "value")) return;
6514
+ const t = function resolveSymbolFromIdentity(e, t) {
6515
+ if ("for" in e) return Symbol.for(e.for);
6516
+ if ("wellKnown" in e) {
6517
+ const t = s.find(t => t === e.wellKnown);
6518
+ if (!t) throw new Error("Unknown well-known Symbol: " + e.wellKnown);
6519
+ return Symbol[t];
6520
+ }
6521
+ if (!n(t, e.registered)) throw new Error("Unregistered symbol: " + e.registered);
6522
+ return t[e.registered];
6523
+ }(e.key, this.symbolsByName),
6524
+ r = checkUndefined(e.value);
6525
+ e.descriptor ? Object.defineProperty(o, t, {
6526
+ configurable: true,
6527
+ enumerable: true,
6528
+ writable: true,
6529
+ ...e.descriptor,
6530
+ value: r
6531
+ }) : o[t] = r;
6532
+ });
6533
+ }), y && delete e.$symbolKeys);
6534
+ },
6535
+ h = (() => {
6536
+ if (!c) throw new Error("Found bad `types`");
6537
+ const t = [];
6538
+ if (Object.entries(c).forEach(([e, r]) => {
6539
+ "#" !== r && [].concat(r).forEach(r => {
6540
+ const [, {
6541
+ plain: n
6542
+ }] = this.revivers[r] ?? [null, {}];
6543
+ n && (t.push({
6544
+ keypath: e,
6545
+ type: r
6546
+ }), delete c[e]);
6547
+ });
6548
+ }), t.length) return t.sort(nestedPathsFirst), t.reduce(function reducer(t, {
6475
6549
  keypath: r,
6476
6550
  type: n
6477
- }));
6478
- let a = getByKeyPath(e, r);
6479
- if (a = executeReviver(n, a), hasConstructorOf(a, TypesonPromise)) return a.then(t => {
6480
- const n = setAtKeyPath(e, r, t);
6481
- n === t && (e = n);
6482
- });
6483
- const o = setAtKeyPath(e, r, a);
6484
- o === a && (e = o);
6485
- }, void 0);
6486
- })();
6487
- let d;
6488
- return hasConstructorOf(f, TypesonPromise) ? d = f.then(() => e) : (d = function _revive(e, t, o, y, f) {
6489
- if (l && "$types" === e) return;
6490
- const d = p.length,
6491
- m = n(i, e) ? i[e] : void 0,
6492
- h = a(t);
6551
+ }) {
6552
+ if (isThenable(t)) return t.then(e => reducer(e, {
6553
+ keypath: r,
6554
+ type: n
6555
+ }));
6556
+ let o = getByKeyPath(e, r);
6557
+ if (o = executeReviver(n, o), hasConstructorOf(o, TypesonPromise)) return o.then(t => {
6558
+ const n = setAtKeyPath(e, r, t);
6559
+ n === t && (e = n);
6560
+ });
6561
+ const a = setAtKeyPath(e, r, o);
6562
+ a === o && (e = a);
6563
+ }, void 0);
6564
+ })();
6565
+ let b;
6566
+ return hasConstructorOf(h, TypesonPromise) ? b = h.then(() => e) : (b = function _revive(e, t, a, s, l) {
6567
+ if (d && "$types" === e) return;
6568
+ const y = m.length,
6569
+ f = n(c, e) ? c[e] : void 0,
6570
+ h = o(t);
6493
6571
  if (h || isPlainObject(t)) {
6494
- const a = h ? new Array(t.length) : {};
6572
+ const o = h ? new Array(t.length) : {};
6495
6573
  for (r(t).forEach(r => {
6496
- const n = _revive(e + (e ? "." : "") + escapeKeyPathComponent(r), t[r], o ?? a, a, r),
6497
- set = e => (hasConstructorOf(e, Undefined) ? setOwnEnumerable(a, r, void 0) : void 0 !== e && setOwnEnumerable(a, r, e), e);
6498
- hasConstructorOf(n, TypesonPromise) ? p.push(n.then(e => set(e))) : set(n);
6499
- }), t = a; c.length;) {
6500
- const [[e, t, r, a]] = c,
6501
- o = n(u, t),
6502
- s = o ? u[t] : getByKeyPath(e, t);
6503
- if (!o && void 0 === s) break;
6504
- setOwnEnumerable(r, a, s), c.shift();
6574
+ const n = _revive(e + (e ? "." : "") + escapeKeyPathComponent(r), t[r], a ?? o, o, r),
6575
+ set = e => (hasConstructorOf(e, Undefined) ? setOwnEnumerable(o, r, void 0) : void 0 !== e && setOwnEnumerable(o, r, e), e);
6576
+ hasConstructorOf(n, TypesonPromise) ? m.push(n.then(e => set(e))) : set(n);
6577
+ }), t = o; u.length;) {
6578
+ const [[e, t, r, o]] = u,
6579
+ a = n(p, t),
6580
+ s = a ? p[t] : getByKeyPath(e, t);
6581
+ if (!a && void 0 === s) break;
6582
+ setOwnEnumerable(r, o, s), u.shift();
6505
6583
  }
6506
6584
  }
6507
- if (!m) return u[e] = t, t;
6508
- if ("#" === m) {
6585
+ if (!f) return p[e] = t, t;
6586
+ if ("#" === f) {
6509
6587
  const e = t.slice(1),
6510
- r = n(u, e),
6511
- a = r ? u[e] : getByKeyPath(o, e);
6512
- return r || void 0 !== a || c.push([o, e, y, f]), a;
6588
+ r = n(p, e),
6589
+ o = r ? p[e] : getByKeyPath(a, e);
6590
+ return r || void 0 !== o || u.push([a, e, s, l]), o;
6513
6591
  }
6514
6592
  const applyType = t => {
6515
- const r = [].concat(m).reduce(function reducer(e, t) {
6593
+ const r = [].concat(f).reduce(function reducer(e, t) {
6516
6594
  if (hasConstructorOf(e, TypesonPromise)) return e.then(e => reducer(e, t));
6517
6595
  if ("string" != typeof t) throw new TypeError("Bad type JSON");
6518
6596
  return executeReviver(t, e);
6519
6597
  }, t);
6520
- return hasConstructorOf(r, TypesonPromise) ? r.then(t => (u[e] = t, t)) : (u[e] = r, r);
6598
+ return hasConstructorOf(r, TypesonPromise) ? r.then(t => (p[e] = t, t)) : (p[e] = r, r);
6521
6599
  };
6522
- return !s && p.length > d ? TypesonPromise.all(p.slice(d)).then(() => applyType(t)) : applyType(t);
6523
- }("", e, null), p.length && (d = TypesonPromise.resolve(d).then(e => TypesonPromise.all([e, ...p])).then(([e]) => e))), isThenable(d) ? s && o.throwOnBadSyncType ? (() => {
6600
+ return !i && m.length > y ? TypesonPromise.all(m.slice(y)).then(() => applyType(t)) : applyType(t);
6601
+ }("", e, null), m.length && (b = TypesonPromise.resolve(b).then(e => TypesonPromise.all([e, ...m])).then(([e]) => e))), l && (isThenable(b) ? b = b.then(e => (reHomeSymbolKeys(e), e)) : reHomeSymbolKeys(b)), isThenable(b) ? i && a.throwOnBadSyncType ? (() => {
6524
6602
  throw new TypeError("Sync method requested but async result obtained");
6525
- })() : hasConstructorOf(d, TypesonPromise) ? d.p.then(checkUndefined) : d : !s && o.throwOnBadSyncType ? (() => {
6603
+ })() : hasConstructorOf(b, TypesonPromise) ? b.p.then(checkUndefined) : b : !i && a.throwOnBadSyncType ? (() => {
6526
6604
  throw new TypeError("Async method requested but sync result obtained");
6527
- })() : s ? checkUndefined(d) : Promise.resolve(checkUndefined(d));
6605
+ })() : i ? checkUndefined(b) : Promise.resolve(checkUndefined(b));
6528
6606
  }
6529
6607
  reviveSync(e, t) {
6530
6608
  return this.revive(e, {
@@ -6543,11 +6621,11 @@ class Typeson {
6543
6621
  register(e, t) {
6544
6622
  const n = t ?? {},
6545
6623
  reg = e => {
6546
- a(e) ? e.forEach(e => {
6624
+ o(e) ? e.forEach(e => {
6547
6625
  reg(e);
6548
6626
  }) : r(e).forEach(t => {
6549
6627
  if ("#" === t) throw new TypeError("# cannot be used as a type name as it is reserved for cyclic objects");
6550
- if (s.includes(t)) throw new TypeError("Plain JSON object types are reserved as type names");
6628
+ if (i.includes(t)) throw new TypeError("Plain JSON object types are reserved as type names");
6551
6629
  let r = e[t];
6552
6630
  if ([this.plainObjectReplacers, this.nonplainObjectReplacers].forEach(e => {
6553
6631
  const r = e.findIndex(e => e.type === t);
@@ -6561,7 +6639,7 @@ class Typeson {
6561
6639
  }),
6562
6640
  revive: t => Object.assign(Object.create(e.prototype), t)
6563
6641
  };
6564
- } else if (a(r)) {
6642
+ } else if (o(r)) {
6565
6643
  const [e, t, n] = r;
6566
6644
  r = {
6567
6645
  test: e,
@@ -6570,13 +6648,13 @@ class Typeson {
6570
6648
  };
6571
6649
  }
6572
6650
  if (!r?.test) return;
6573
- const o = {
6651
+ const a = {
6574
6652
  type: t,
6575
6653
  test: r.test.bind(r)
6576
6654
  };
6577
- r.replace && (o.replace = r.replace.bind(r)), r.replaceAsync && (o.replaceAsync = r.replaceAsync.bind(r));
6578
- const i = "number" == typeof n.fallback ? n.fallback : n.fallback ? 0 : 1 / 0;
6579
- if (r.testPlainObjects ? this.plainObjectReplacers.splice(i, 0, o) : this.nonplainObjectReplacers.splice(i, 0, o), r.revive || r.reviveAsync) {
6655
+ r.replace && (a.replace = r.replace.bind(r)), r.replaceAsync && (a.replaceAsync = r.replaceAsync.bind(r));
6656
+ const s = "number" == typeof n.fallback ? n.fallback : n.fallback ? 0 : 1 / 0;
6657
+ if (r.testPlainObjects ? this.plainObjectReplacers.splice(s, 0, a) : this.nonplainObjectReplacers.splice(s, 0, a), r.revive || r.reviveAsync) {
6580
6658
  const e = {};
6581
6659
  r.revive && (e.revive = r.revive.bind(r)), r.reviveAsync && (e.reviveAsync = r.reviveAsync.bind(r)), this.revivers[t] = [e, {
6582
6660
  plain: r.testPlainObjects
@@ -6592,27 +6670,27 @@ class Typeson {
6592
6670
  }
6593
6671
  class Undefined {}
6594
6672
  Undefined.__typeson__type__ = "TypesonUndefined";
6595
- const s = ["null", "boolean", "number", "string", "array", "object"];
6596
- for (var i = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/", c = new Uint8Array(256), u = 0; u < 64; u++) c[i.codePointAt(u)] = u;
6597
- var y = function encode(e, t, r) {
6673
+ const i = ["null", "boolean", "number", "string", "array", "object"];
6674
+ for (var c = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/", l = new Uint8Array(256), y = 0; y < 64; y++) l[c.codePointAt(y)] = y;
6675
+ var u = function encode(e, t, r) {
6598
6676
  null == r && (r = e.byteLength);
6599
- for (var n = new Uint8Array(e, 0, r), a = n.length, o = "", s = 0; s < a; s += 3) o += i[n[s] >> 2], o += i[(3 & n[s]) << 4 | n[s + 1] >> 4], o += i[(15 & n[s + 1]) << 2 | n[s + 2] >> 6], o += i[63 & n[s + 2]];
6600
- return a % 3 == 2 ? o = o.slice(0, -1) + "=" : a % 3 == 1 && (o = o.slice(0, -2) + "=="), o;
6677
+ for (var n = new Uint8Array(e, 0, r), o = n.length, a = "", s = 0; s < o; s += 3) a += c[n[s] >> 2], a += c[(3 & n[s]) << 4 | n[s + 1] >> 4], a += c[(15 & n[s + 1]) << 2 | n[s + 2] >> 6], a += c[63 & n[s + 2]];
6678
+ return o % 3 == 2 ? a = a.slice(0, -1) + "=" : o % 3 == 1 && (a = a.slice(0, -2) + "=="), a;
6601
6679
  },
6602
- l = function decode(e, t) {
6680
+ p = function decode(e, t) {
6603
6681
  var r = e.length;
6604
6682
  if (r % 4) throw new Error("Bad base64 length: not divisible by four");
6605
6683
  var n,
6606
- a,
6607
6684
  o,
6685
+ a,
6608
6686
  s,
6609
6687
  i = .75 * e.length,
6610
- u = 0;
6688
+ c = 0;
6611
6689
  "=" === e[e.length - 1] && (i--, "=" === e[e.length - 2] && i--);
6612
- for (var y = new ArrayBuffer(i, t), l = new Uint8Array(y), p = 0; p < r; p += 4) n = c[e.codePointAt(p)], a = c[e.codePointAt(p + 1)], o = c[e.codePointAt(p + 2)], s = c[e.codePointAt(p + 3)], l[u++] = n << 2 | a >> 4, l[u++] = (15 & a) << 4 | o >> 2, l[u++] = (3 & o) << 6 | 63 & s;
6690
+ for (var y = new ArrayBuffer(i, t), u = new Uint8Array(y), p = 0; p < r; p += 4) n = l[e.codePointAt(p)], o = l[e.codePointAt(p + 1)], a = l[e.codePointAt(p + 2)], s = l[e.codePointAt(p + 3)], u[c++] = n << 2 | o >> 4, u[c++] = (15 & o) << 4 | a >> 2, u[c++] = (3 & a) << 6 | 63 & s;
6613
6691
  return y;
6614
6692
  };
6615
- const p = {
6693
+ const f = {
6616
6694
  arraybuffer: {
6617
6695
  test: e => "ArrayBuffer" === toStringTag(e),
6618
6696
  replace(e, t) {
@@ -6621,21 +6699,21 @@ const p = {
6621
6699
  return -1 !== r ? {
6622
6700
  index: r
6623
6701
  } : (t.buffers.push(e), {
6624
- s: y(e),
6702
+ s: u(e),
6625
6703
  maxByteLength: e.maxByteLength,
6626
6704
  resizable: e.resizable
6627
6705
  });
6628
6706
  },
6629
6707
  revive(e, t) {
6630
6708
  if (t.buffers || (t.buffers = []), Object.hasOwn(e, "index")) return t.buffers[e.index];
6631
- const r = l(e.s, e.resizable ? {
6709
+ const r = p(e.s, e.resizable ? {
6632
6710
  maxByteLength: e.maxByteLength
6633
6711
  } : void 0);
6634
6712
  return t.buffers.push(r), r;
6635
6713
  }
6636
6714
  }
6637
6715
  },
6638
- f = {
6716
+ d = {
6639
6717
  audiodata: {
6640
6718
  test: e => "AudioData" === toStringTag(e),
6641
6719
  replace(e) {
@@ -6643,10 +6721,10 @@ const p = {
6643
6721
  format: t,
6644
6722
  sampleRate: r,
6645
6723
  numberOfFrames: n,
6646
- numberOfChannels: a,
6647
- timestamp: o
6724
+ numberOfChannels: o,
6725
+ timestamp: a
6648
6726
  } = e,
6649
- s = t.endsWith("-planar") ? a : 1,
6727
+ s = t.endsWith("-planar") ? o : 1,
6650
6728
  i = [];
6651
6729
  let c = 0;
6652
6730
  for (let t = 0; t < s; t++) {
@@ -6655,10 +6733,10 @@ const p = {
6655
6733
  });
6656
6734
  i.push(r), c += r;
6657
6735
  }
6658
- const u = new ArrayBuffer(c);
6736
+ const l = new ArrayBuffer(c);
6659
6737
  let y = 0;
6660
6738
  for (let t = 0; t < s; t++) {
6661
- const r = new Uint8Array(u, y, i[t]);
6739
+ const r = new Uint8Array(l, y, i[t]);
6662
6740
  e.copyTo(r, {
6663
6741
  planeIndex: t
6664
6742
  }), y += i[t];
@@ -6667,9 +6745,9 @@ const p = {
6667
6745
  format: t,
6668
6746
  sampleRate: r,
6669
6747
  numberOfFrames: n,
6670
- numberOfChannels: a,
6671
- timestamp: o,
6672
- data: u
6748
+ numberOfChannels: o,
6749
+ timestamp: a,
6750
+ data: l
6673
6751
  };
6674
6752
  },
6675
6753
  revive: ({
@@ -6677,26 +6755,26 @@ const p = {
6677
6755
  sampleRate: t,
6678
6756
  numberOfFrames: r,
6679
6757
  numberOfChannels: n,
6680
- timestamp: a,
6681
- data: o
6758
+ timestamp: o,
6759
+ data: a
6682
6760
  }) => new AudioData({
6683
6761
  format: e,
6684
6762
  sampleRate: t,
6685
6763
  numberOfFrames: r,
6686
6764
  numberOfChannels: n,
6687
- timestamp: a,
6688
- data: new Uint8Array(o)
6765
+ timestamp: o,
6766
+ data: new Uint8Array(a)
6689
6767
  })
6690
6768
  }
6691
6769
  },
6692
- d = {
6770
+ m = {
6693
6771
  bigintObject: {
6694
6772
  test: e => "object" == typeof e && hasConstructorOf(e, BigInt),
6695
6773
  replace: String,
6696
6774
  revive: e => new Object(BigInt(e))
6697
6775
  }
6698
6776
  },
6699
- m = {
6777
+ h = {
6700
6778
  bigint: {
6701
6779
  test: e => "bigint" == typeof e,
6702
6780
  replace: String,
@@ -6711,7 +6789,7 @@ function string2arraybuffer(e) {
6711
6789
  for (let r = 0; r < e.length; r++) t[r] = e.charCodeAt(r);
6712
6790
  return t.buffer;
6713
6791
  }
6714
- const h = {
6792
+ const b = {
6715
6793
  blob: {
6716
6794
  test: e => "Blob" === toStringTag(e),
6717
6795
  replace(e) {
@@ -6744,7 +6822,7 @@ const h = {
6744
6822
  })
6745
6823
  }
6746
6824
  };
6747
- const v = {
6825
+ const w = {
6748
6826
  cryptokey: {
6749
6827
  test: e => "CryptoKey" === toStringTag(e) && e.extractable,
6750
6828
  replaceAsync: e => new TypesonPromise(async (t, r) => {
@@ -6770,7 +6848,7 @@ const v = {
6770
6848
  }
6771
6849
  }
6772
6850
  },
6773
- w = {
6851
+ O = {
6774
6852
  dataview: {
6775
6853
  test: e => "DataView" === toStringTag(e),
6776
6854
  replace({
@@ -6779,13 +6857,13 @@ const v = {
6779
6857
  byteLength: r
6780
6858
  }, n) {
6781
6859
  n.buffers || (n.buffers = []);
6782
- const a = n.buffers.indexOf(e);
6783
- return -1 !== a ? {
6784
- index: a,
6860
+ const o = n.buffers.indexOf(e);
6861
+ return -1 !== o ? {
6862
+ index: o,
6785
6863
  byteOffset: t,
6786
6864
  byteLength: r
6787
6865
  } : (n.buffers.push(e), {
6788
- encoded: y(e),
6866
+ encoded: u(e),
6789
6867
  maxByteLength: e.maxByteLength,
6790
6868
  resizable: e.resizable,
6791
6869
  byteOffset: t,
@@ -6797,19 +6875,19 @@ const v = {
6797
6875
  const {
6798
6876
  byteOffset: r,
6799
6877
  byteLength: n,
6800
- encoded: a,
6801
- index: o,
6878
+ encoded: o,
6879
+ index: a,
6802
6880
  maxByteLength: s,
6803
6881
  resizable: i
6804
6882
  } = e;
6805
6883
  let c;
6806
- return "index" in e ? c = t.buffers[o] : (c = l(a, i ? {
6884
+ return "index" in e ? c = t.buffers[a] : (c = p(o, i ? {
6807
6885
  maxByteLength: s
6808
6886
  } : s), t.buffers.push(c)), new DataView(c, r, n);
6809
6887
  }
6810
6888
  }
6811
6889
  },
6812
- O = {
6890
+ A = {
6813
6891
  date: {
6814
6892
  test: e => "Date" === toStringTag(e),
6815
6893
  replace(e) {
@@ -6819,7 +6897,7 @@ const v = {
6819
6897
  revive: e => "NaN" === e ? new Date(NaN) : new Date(e)
6820
6898
  }
6821
6899
  },
6822
- A = {
6900
+ T = {
6823
6901
  domexception: {
6824
6902
  test: e => "DOMException" === toStringTag(e),
6825
6903
  replace: e => ({
@@ -6832,9 +6910,9 @@ const v = {
6832
6910
  }) => new DOMException(e, t)
6833
6911
  }
6834
6912
  },
6835
- T = {};
6913
+ S = {};
6836
6914
  function create$5(e) {
6837
- T[e.name.toLowerCase()] = {
6915
+ S[e.name.toLowerCase()] = {
6838
6916
  test: t => toStringTag(t) === e.name,
6839
6917
  replace: e => e.is2D ? {
6840
6918
  a: e.a,
@@ -6865,9 +6943,9 @@ function create$5(e) {
6865
6943
  };
6866
6944
  }
6867
6945
  "undefined" != typeof DOMMatrix && create$5(DOMMatrix), "undefined" != typeof DOMMatrixReadOnly && create$5(DOMMatrixReadOnly);
6868
- const S = {};
6946
+ const P = {};
6869
6947
  function create$4(e) {
6870
- S[e.name.toLowerCase()] = {
6948
+ P[e.name.toLowerCase()] = {
6871
6949
  test: t => toStringTag(t) === e.name,
6872
6950
  replace: e => ({
6873
6951
  x: e.x,
@@ -6879,12 +6957,12 @@ function create$4(e) {
6879
6957
  x: t,
6880
6958
  y: r,
6881
6959
  z: n,
6882
- w: a
6883
- }) => new e(t, r, n, a)
6960
+ w: o
6961
+ }) => new e(t, r, n, o)
6884
6962
  };
6885
6963
  }
6886
6964
  "undefined" != typeof DOMPoint && create$4(DOMPoint), "undefined" != typeof DOMPointReadOnly && create$4(DOMPointReadOnly);
6887
- const P = {
6965
+ const E = {
6888
6966
  domquad: {
6889
6967
  test: e => "DOMQuad" === toStringTag(e),
6890
6968
  replace: e => ({
@@ -6915,12 +6993,12 @@ function create$3(e) {
6915
6993
  x: t,
6916
6994
  y: r,
6917
6995
  width: n,
6918
- height: a
6919
- }) => new e(t, r, n, a)
6996
+ height: o
6997
+ }) => new e(t, r, n, o)
6920
6998
  };
6921
6999
  }
6922
7000
  "undefined" != typeof DOMRect && create$3(DOMRect), "undefined" != typeof DOMRectReadOnly && create$3(DOMRectReadOnly);
6923
- const E = {
7001
+ const j = {
6924
7002
  encodedaudiochunk: {
6925
7003
  test: e => "EncodedAudioChunk" === toStringTag(e),
6926
7004
  replace(e) {
@@ -6928,30 +7006,32 @@ const E = {
6928
7006
  type: t,
6929
7007
  timestamp: r,
6930
7008
  duration: n,
6931
- byteLength: a
7009
+ byteLength: o
6932
7010
  } = e,
6933
- o = new ArrayBuffer(a);
6934
- return e.copyTo(o), {
7011
+ a = new ArrayBuffer(o);
7012
+ return e.copyTo(a), {
6935
7013
  type: t,
6936
7014
  timestamp: r,
6937
7015
  duration: n,
6938
- data: o
7016
+ data: a
6939
7017
  };
6940
7018
  },
6941
- revive: ({
7019
+ revive({
6942
7020
  type: e,
6943
7021
  timestamp: t,
6944
7022
  duration: r,
6945
7023
  data: n
6946
- }) => new EncodedAudioChunk({
6947
- type: e,
6948
- timestamp: t,
6949
- duration: r,
6950
- data: new Uint8Array(n)
6951
- })
7024
+ }) {
7025
+ const o = {
7026
+ type: e,
7027
+ timestamp: t,
7028
+ data: new Uint8Array(n)
7029
+ };
7030
+ return null != r && (o.duration = r), new EncodedAudioChunk(o);
7031
+ }
6952
7032
  }
6953
7033
  },
6954
- j = {
7034
+ B = {
6955
7035
  encodedvideochunk: {
6956
7036
  test: e => "EncodedVideoChunk" === toStringTag(e),
6957
7037
  replace(e) {
@@ -6959,27 +7039,29 @@ const E = {
6959
7039
  type: t,
6960
7040
  timestamp: r,
6961
7041
  duration: n,
6962
- byteLength: a
7042
+ byteLength: o
6963
7043
  } = e,
6964
- o = new ArrayBuffer(a);
6965
- return e.copyTo(o), {
7044
+ a = new ArrayBuffer(o);
7045
+ return e.copyTo(a), {
6966
7046
  type: t,
6967
7047
  timestamp: r,
6968
7048
  duration: n,
6969
- data: o
7049
+ data: a
6970
7050
  };
6971
7051
  },
6972
- revive: ({
7052
+ revive({
6973
7053
  type: e,
6974
7054
  timestamp: t,
6975
7055
  duration: r,
6976
7056
  data: n
6977
- }) => new EncodedVideoChunk({
6978
- type: e,
6979
- timestamp: t,
6980
- duration: r,
6981
- data: new Uint8Array(n)
6982
- })
7057
+ }) {
7058
+ const o = {
7059
+ type: e,
7060
+ timestamp: t,
7061
+ data: new Uint8Array(n)
7062
+ };
7063
+ return null != r && (o.duration = r), new EncodedVideoChunk(o);
7064
+ }
6983
7065
  }
6984
7066
  },
6985
7067
  N = {
@@ -6990,16 +7072,16 @@ const E = {
6990
7072
  message: t,
6991
7073
  cause: r,
6992
7074
  stack: n,
6993
- fileName: a,
6994
- lineNumber: o,
7075
+ fileName: o,
7076
+ lineNumber: a,
6995
7077
  columnNumber: s
6996
7078
  }) => ({
6997
7079
  name: e,
6998
7080
  message: t,
6999
7081
  cause: r,
7000
7082
  stack: n,
7001
- fileName: a,
7002
- lineNumber: o,
7083
+ fileName: o,
7084
+ lineNumber: a,
7003
7085
  columnNumber: s
7004
7086
  }),
7005
7087
  revive(e) {
@@ -7017,8 +7099,8 @@ function create$2(e) {
7017
7099
  message: t,
7018
7100
  cause: r,
7019
7101
  stack: n,
7020
- fileName: a,
7021
- lineNumber: o,
7102
+ fileName: o,
7103
+ lineNumber: a,
7022
7104
  columnNumber: s,
7023
7105
  errors: i
7024
7106
  }) => ({
@@ -7026,8 +7108,8 @@ function create$2(e) {
7026
7108
  message: t,
7027
7109
  cause: r,
7028
7110
  stack: n,
7029
- fileName: a,
7030
- lineNumber: o,
7111
+ fileName: o,
7112
+ lineNumber: a,
7031
7113
  columnNumber: s,
7032
7114
  errors: i
7033
7115
  }),
@@ -7038,7 +7120,7 @@ function create$2(e) {
7038
7120
  };
7039
7121
  }
7040
7122
  [TypeError, RangeError, SyntaxError, ReferenceError, EvalError, URIError].forEach(e => create$2(e)), "undefined" != typeof AggregateError && create$2(AggregateError), "function" == typeof InternalError && create$2(InternalError);
7041
- const B = {
7123
+ const I = {
7042
7124
  file: {
7043
7125
  test: e => "File" === toStringTag(e),
7044
7126
  replace(e) {
@@ -7075,8 +7157,8 @@ const B = {
7075
7157
  })
7076
7158
  }
7077
7159
  },
7078
- I = {
7079
- file: B.file,
7160
+ U = {
7161
+ file: I.file,
7080
7162
  filelist: {
7081
7163
  test: e => "FileList" === toStringTag(e),
7082
7164
  replace(e) {
@@ -7135,15 +7217,35 @@ const B = {
7135
7217
  }
7136
7218
  }
7137
7219
  },
7138
- U = {
7220
+ k = {
7139
7221
  imagedata: {
7140
7222
  test: e => "ImageData" === toStringTag(e),
7141
- replace: e => ({
7142
- array: [...e.data],
7143
- width: e.width,
7144
- height: e.height
7145
- }),
7146
- revive: e => new ImageData(new Uint8ClampedArray(e.array), e.width, e.height)
7223
+ replace(e) {
7224
+ const t = "Float16Array" === toStringTag(e.data) ? "rgba-float16" : "rgba-unorm8";
7225
+ return {
7226
+ array: [...e.data],
7227
+ width: e.width,
7228
+ height: e.height,
7229
+ pixelFormat: t,
7230
+ colorSpace: e.colorSpace
7231
+ };
7232
+ },
7233
+ revive(e) {
7234
+ const {
7235
+ array: t,
7236
+ width: r,
7237
+ height: n,
7238
+ colorSpace: o,
7239
+ pixelFormat: a
7240
+ } = e;
7241
+ return "rgba-float16" === a ? new ImageData(new Float16Array(t), r, n, {
7242
+ colorSpace: o,
7243
+ pixelFormat: a
7244
+ }) : new ImageData(new Uint8ClampedArray(t), r, n, {
7245
+ colorSpace: o,
7246
+ pixelFormat: a
7247
+ });
7248
+ }
7147
7249
  }
7148
7250
  },
7149
7251
  M = {
@@ -7153,35 +7255,35 @@ const B = {
7153
7255
  revive: () => 1 / 0
7154
7256
  }
7155
7257
  },
7156
- D = {
7258
+ L = {
7157
7259
  map: {
7158
7260
  test: e => "Map" === toStringTag(e),
7159
7261
  replace: e => e.entries().toArray(),
7160
7262
  revive: e => new Map(e)
7161
7263
  }
7162
7264
  },
7163
- R = {
7265
+ F = {
7164
7266
  nan: {
7165
7267
  test: e => Number.isNaN(e),
7166
7268
  replace: () => "NaN",
7167
7269
  revive: () => NaN
7168
7270
  }
7169
7271
  },
7170
- L = {
7272
+ K = {
7171
7273
  negativeInfinity: {
7172
7274
  test: e => e === -1 / 0,
7173
7275
  replace: () => "-Infinity",
7174
7276
  revive: () => -1 / 0
7175
7277
  }
7176
7278
  },
7177
- F = {
7279
+ $ = {
7178
7280
  negativeZero: {
7179
7281
  test: e => Object.is(e, -0),
7180
7282
  replace: () => 0,
7181
7283
  revive: () => -0
7182
7284
  }
7183
7285
  },
7184
- K = {
7286
+ W = {
7185
7287
  StringObject: {
7186
7288
  test: e => "String" === toStringTag(e) && "object" == typeof e,
7187
7289
  replace: String,
@@ -7201,7 +7303,7 @@ const B = {
7201
7303
  revive: e => new Number("NaN" === e ? NaN : "Infinity" === e ? 1 / 0 : "-Infinity" === e ? -1 / 0 : "-0" === e ? -0 : e)
7202
7304
  }
7203
7305
  },
7204
- W = {
7306
+ V = {
7205
7307
  quotaexceedederror: {
7206
7308
  test: e => "QuotaExceededError" === toStringTag(e),
7207
7309
  replace: ({
@@ -7223,7 +7325,7 @@ const B = {
7223
7325
  }
7224
7326
  }
7225
7327
  },
7226
- z = {
7328
+ J = {
7227
7329
  regexp: {
7228
7330
  test: e => "RegExp" === toStringTag(e),
7229
7331
  replace: e => ({
@@ -7236,26 +7338,26 @@ const B = {
7236
7338
  }) => new RegExp(e, t)
7237
7339
  }
7238
7340
  },
7239
- H = {
7341
+ G = {
7240
7342
  set: {
7241
7343
  test: e => "Set" === toStringTag(e),
7242
7344
  replace: e => e.values().toArray(),
7243
7345
  revive: e => new Set(e)
7244
7346
  }
7245
7347
  },
7246
- G = {};
7348
+ Y = {};
7247
7349
  "function" == typeof Int8Array && [Int8Array, Uint8Array, Uint8ClampedArray, Int16Array, Uint16Array, Int32Array, Uint32Array, Float32Array, Float64Array, ...("function" == typeof BigInt64Array ? [BigInt64Array, BigUint64Array] : []), ...("function" == typeof Float16Array ? [Float16Array] : [])].forEach(e => function create$1(e) {
7248
7350
  const t = e.name;
7249
- G[t.toLowerCase()] = {
7351
+ Y[t.toLowerCase()] = {
7250
7352
  test: e => toStringTag(e) === t,
7251
7353
  replace: e => (0 === e.byteOffset && e.byteLength === e.buffer.byteLength ? e : e.slice(0)).buffer,
7252
7354
  revive: t => "ArrayBuffer" === toStringTag(t) ? new e(t) : t
7253
7355
  };
7254
7356
  }(e));
7255
- const X = {};
7357
+ const Z = {};
7256
7358
  "function" == typeof Int8Array && [Int8Array, Uint8Array, Uint8ClampedArray, Int16Array, Uint16Array, Int32Array, Uint32Array, Float32Array, Float64Array, ...("function" == typeof BigInt64Array ? [BigInt64Array, BigUint64Array] : []), ...("function" == typeof Float16Array ? [Float16Array] : [])].forEach(e => function create(e) {
7257
7359
  const t = e.name;
7258
- X[t.toLowerCase()] = {
7360
+ Z[t.toLowerCase()] = {
7259
7361
  test: e => toStringTag(e) === t,
7260
7362
  replace({
7261
7363
  buffer: e,
@@ -7263,15 +7365,15 @@ const X = {};
7263
7365
  length: r
7264
7366
  }, n) {
7265
7367
  n.buffers || (n.buffers = []);
7266
- const a = n.buffers.indexOf(e);
7267
- return -1 !== a ? {
7268
- index: a,
7368
+ const o = n.buffers.indexOf(e);
7369
+ return -1 !== o ? {
7370
+ index: o,
7269
7371
  byteOffset: t,
7270
7372
  length: r
7271
7373
  } : (n.buffers.push(e), {
7272
7374
  maxByteLength: e.maxByteLength,
7273
7375
  resizable: e.resizable,
7274
- encoded: y(e),
7376
+ encoded: u(e),
7275
7377
  byteOffset: t,
7276
7378
  length: r
7277
7379
  });
@@ -7280,27 +7382,27 @@ const X = {};
7280
7382
  r.buffers || (r.buffers = []);
7281
7383
  const {
7282
7384
  byteOffset: n,
7283
- length: a,
7284
- encoded: o,
7385
+ length: o,
7386
+ encoded: a,
7285
7387
  index: s,
7286
7388
  maxByteLength: i,
7287
7389
  resizable: c
7288
7390
  } = t;
7289
- let u;
7290
- return "index" in t ? u = r.buffers[s] : (u = l(o, c ? {
7391
+ let l;
7392
+ return "index" in t ? l = r.buffers[s] : (l = p(a, c ? {
7291
7393
  maxByteLength: i
7292
- } : void 0), r.buffers.push(u)), new e(u, n, a);
7394
+ } : void 0), r.buffers.push(l)), new e(l, n, o);
7293
7395
  }
7294
7396
  };
7295
7397
  }(e));
7296
- const Y = {
7398
+ const ee = {
7297
7399
  undef: {
7298
7400
  test: (e, t) => void 0 === e && (t.ownKeys || !("ownKeys" in t)),
7299
7401
  replace: () => 0,
7300
7402
  revive: () => new Undefined()
7301
7403
  }
7302
7404
  },
7303
- Z = {
7405
+ te = {
7304
7406
  userObject: {
7305
7407
  test: e => isUserObject(e),
7306
7408
  replace: e => ({
@@ -7309,7 +7411,7 @@ const Y = {
7309
7411
  revive: e => e
7310
7412
  }
7311
7413
  },
7312
- ee = {
7414
+ re = {
7313
7415
  videoframe: {
7314
7416
  test: e => "VideoFrame" === toStringTag(e),
7315
7417
  replaceAsync: e => new TypesonPromise(async (t, r) => {
@@ -7317,20 +7419,20 @@ const Y = {
7317
7419
  const {
7318
7420
  format: r,
7319
7421
  codedWidth: n,
7320
- codedHeight: a,
7321
- timestamp: o,
7422
+ codedHeight: o,
7423
+ timestamp: a,
7322
7424
  duration: s,
7323
7425
  visibleRect: i,
7324
7426
  displayWidth: c,
7325
- displayHeight: u,
7427
+ displayHeight: l,
7326
7428
  colorSpace: y
7327
7429
  } = e,
7328
- l = new ArrayBuffer(e.allocationSize());
7329
- await e.copyTo(l), t({
7430
+ u = new ArrayBuffer(e.allocationSize());
7431
+ await e.copyTo(u), t({
7330
7432
  format: r,
7331
7433
  codedWidth: n,
7332
- codedHeight: a,
7333
- timestamp: o,
7434
+ codedHeight: o,
7435
+ timestamp: a,
7334
7436
  duration: s,
7335
7437
  visibleRect: {
7336
7438
  x: i.x,
@@ -7339,44 +7441,46 @@ const Y = {
7339
7441
  height: i.height
7340
7442
  },
7341
7443
  displayWidth: c,
7342
- displayHeight: u,
7444
+ displayHeight: l,
7343
7445
  colorSpace: {
7344
7446
  primaries: y.primaries,
7345
7447
  transfer: y.transfer,
7346
7448
  matrix: y.matrix,
7347
7449
  fullRange: y.fullRange
7348
7450
  },
7349
- data: l
7451
+ data: u
7350
7452
  });
7351
7453
  } catch (e) {
7352
7454
  r(e);
7353
7455
  }
7354
7456
  }),
7355
- revive: ({
7457
+ revive({
7356
7458
  format: e,
7357
7459
  codedWidth: t,
7358
7460
  codedHeight: r,
7359
7461
  timestamp: n,
7360
- duration: a,
7361
- visibleRect: o,
7462
+ duration: o,
7463
+ visibleRect: a,
7362
7464
  displayWidth: s,
7363
7465
  displayHeight: i,
7364
7466
  colorSpace: c,
7365
- data: u
7366
- }) => new VideoFrame(new Uint8Array(u), {
7367
- format: e,
7368
- codedWidth: t,
7369
- codedHeight: r,
7370
- timestamp: n,
7371
- duration: a,
7372
- visibleRect: o,
7373
- displayWidth: s,
7374
- displayHeight: i,
7375
- colorSpace: c
7376
- })
7467
+ data: l
7468
+ }) {
7469
+ const y = {
7470
+ format: e,
7471
+ codedWidth: t,
7472
+ codedHeight: r,
7473
+ timestamp: n,
7474
+ visibleRect: a,
7475
+ displayWidth: s,
7476
+ displayHeight: i,
7477
+ colorSpace: c
7478
+ };
7479
+ return null != o && (y.duration = o), new VideoFrame(new Uint8Array(l), y);
7480
+ }
7377
7481
  }
7378
7482
  },
7379
- te = {
7483
+ ne = {
7380
7484
  webtransporterror: {
7381
7485
  test: e => "WebTransportError" === toStringTag(e),
7382
7486
  replace: ({
@@ -7395,7 +7499,7 @@ const Y = {
7395
7499
  })
7396
7500
  }
7397
7501
  },
7398
- re = [{
7502
+ oe = [{
7399
7503
  arrayNonindexKeys: {
7400
7504
  testPlainObjects: true,
7401
7505
  test: (e, t) => !!Array.isArray(e) && (Object.keys(e).some(e => String(Number(e)) !== e) && (t.iterateIn = "object", t.addLength = true), true),
@@ -7415,9 +7519,9 @@ const Y = {
7415
7519
  revive() {}
7416
7520
  }
7417
7521
  }],
7418
- ne = [R, M, L, F],
7419
- ce = [Z, Y, re, K, ne, O, z, U, _, B, I, h, N, C].concat("function" == typeof Map ? D : [], "function" == typeof Set ? H : [], "function" == typeof ArrayBuffer ? p : [], "function" == typeof Uint8Array ? X : [], "function" == typeof DataView ? w : [], "undefined" != typeof crypto ? v : [], "undefined" != typeof BigInt ? [m, d] : [], "undefined" != typeof DOMException ? A : [], "undefined" != typeof QuotaExceededError ? W : [], "undefined" != typeof WebTransportError ? te : [], "undefined" != typeof DOMRect ? x : [], "undefined" != typeof DOMPoint ? S : [], "undefined" != typeof DOMQuad ? P : [], "undefined" != typeof DOMMatrix ? T : [], "undefined" != typeof AudioData ? f : [], "undefined" != typeof EncodedAudioChunk ? E : [], "undefined" != typeof EncodedVideoChunk ? j : [], "undefined" != typeof VideoFrame ? ee : []);
7420
- const ue = ce.concat({
7522
+ ae = [F, M, K, $],
7523
+ ye = [te, ee, oe, W, ae, A, J, k, _, I, U, b, N, C].concat("function" == typeof Map ? L : [], "function" == typeof Set ? G : [], "function" == typeof ArrayBuffer ? f : [], "function" == typeof Uint8Array ? Z : [], "function" == typeof DataView ? O : [], "undefined" != typeof crypto ? w : [], "undefined" != typeof BigInt ? [h, m] : [], "undefined" != typeof DOMException ? T : [], "undefined" != typeof QuotaExceededError ? V : [], "undefined" != typeof WebTransportError ? ne : [], "undefined" != typeof DOMRect ? x : [], "undefined" != typeof DOMPoint ? P : [], "undefined" != typeof DOMQuad ? E : [], "undefined" != typeof DOMMatrix ? S : [], "undefined" != typeof AudioData ? d : [], "undefined" != typeof EncodedAudioChunk ? j : [], "undefined" != typeof EncodedVideoChunk ? B : [], "undefined" != typeof VideoFrame ? re : []);
7524
+ const ue = ye.concat({
7421
7525
  checkDataCloneException: {
7422
7526
  test(e) {
7423
7527
  const t = {}.toString.call(e).slice(8, -1);
@@ -7434,7 +7538,7 @@ const ue = ce.concat({
7434
7538
  }
7435
7539
  }
7436
7540
  }),
7437
- ye = ue.concat({
7541
+ pe = ue.concat({
7438
7542
  checkSharedArrayBufferException: {
7439
7543
  test(e) {
7440
7544
  if ("SharedArrayBuffer" === {}.toString.call(e).slice(8, -1)) throw new DOMException("The object cannot be cloned.", "DataCloneError");
@@ -7448,7 +7552,7 @@ const ue = ce.concat({
7448
7552
  // Although typeson-registry already has a FileList type in its structured cloning presets,
7449
7553
  // we need to override it so it works with our tests
7450
7554
 
7451
- const specSet = ye.flatMap(preset => Array.isArray(preset) ? preset : [preset]).find(preset => preset && !Array.isArray(preset) && 'filelist' in preset);
7555
+ const specSet = pe.flatMap(preset => Array.isArray(preset) ? preset : [preset]).find(preset => preset && !Array.isArray(preset) && 'filelist' in preset);
7452
7556
  const origFileList = specSet && !Array.isArray(specSet) && 'filelist' in specSet ? specSet.filelist : undefined;
7453
7557
  const origTest = origFileList && typeof origFileList === 'object' && 'test' in origFileList && typeof origFileList.test === 'function' ? origFileList.test : undefined;
7454
7558
  const origRevive = origFileList && typeof origFileList === 'object' && 'revive' in origFileList && typeof origFileList.revive === 'function' ? origFileList.revive : undefined;
@@ -7477,7 +7581,7 @@ const customFileList = origFileList ? {
7477
7581
  return typeof origRevive === 'function' ? origRevive(x, state) : undefined;
7478
7582
  }
7479
7583
  } : undefined;
7480
- let typeson = new Typeson().register([ye, customFileList ? {
7584
+ let typeson = new Typeson().register([pe, customFileList ? {
7481
7585
  filelist: customFileList
7482
7586
  } : {}]);
7483
7587
 
@@ -7488,7 +7592,7 @@ let typeson = new Typeson().register([ye, customFileList ? {
7488
7592
  */
7489
7593
  function register(func) {
7490
7594
  // eslint-disable-next-line unicorn/no-top-level-assignment-in-function -- Should be one-time cache
7491
- typeson = new Typeson().register(func(ye));
7595
+ typeson = new Typeson().register(func(pe));
7492
7596
  }
7493
7597
 
7494
7598
  /**