@tanstack/react-query-devtools 4.9.0 → 4.10.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.
@@ -1081,6 +1081,953 @@
1081
1081
  return [value, setter];
1082
1082
  }
1083
1083
 
1084
+ var DoubleIndexedKV = /** @class */ (function () {
1085
+ function DoubleIndexedKV() {
1086
+ this.keyToValue = new Map();
1087
+ this.valueToKey = new Map();
1088
+ }
1089
+ DoubleIndexedKV.prototype.set = function (key, value) {
1090
+ this.keyToValue.set(key, value);
1091
+ this.valueToKey.set(value, key);
1092
+ };
1093
+ DoubleIndexedKV.prototype.getByKey = function (key) {
1094
+ return this.keyToValue.get(key);
1095
+ };
1096
+ DoubleIndexedKV.prototype.getByValue = function (value) {
1097
+ return this.valueToKey.get(value);
1098
+ };
1099
+ DoubleIndexedKV.prototype.clear = function () {
1100
+ this.keyToValue.clear();
1101
+ this.valueToKey.clear();
1102
+ };
1103
+ return DoubleIndexedKV;
1104
+ }());
1105
+
1106
+ var Registry = /** @class */ (function () {
1107
+ function Registry(generateIdentifier) {
1108
+ this.generateIdentifier = generateIdentifier;
1109
+ this.kv = new DoubleIndexedKV();
1110
+ }
1111
+ Registry.prototype.register = function (value, identifier) {
1112
+ if (this.kv.getByValue(value)) {
1113
+ return;
1114
+ }
1115
+ if (!identifier) {
1116
+ identifier = this.generateIdentifier(value);
1117
+ }
1118
+ {
1119
+ var alreadyRegistered = this.kv.getByKey(identifier);
1120
+ if (alreadyRegistered && alreadyRegistered !== value) {
1121
+ console.debug("Ambiguous class \"" + identifier + "\", provide a unique identifier.");
1122
+ }
1123
+ }
1124
+ this.kv.set(identifier, value);
1125
+ };
1126
+ Registry.prototype.clear = function () {
1127
+ this.kv.clear();
1128
+ };
1129
+ Registry.prototype.getIdentifier = function (value) {
1130
+ return this.kv.getByValue(value);
1131
+ };
1132
+ Registry.prototype.getValue = function (identifier) {
1133
+ return this.kv.getByKey(identifier);
1134
+ };
1135
+ return Registry;
1136
+ }());
1137
+
1138
+ var __extends = (undefined && undefined.__extends) || (function () {
1139
+ var extendStatics = function (d, b) {
1140
+ extendStatics = Object.setPrototypeOf ||
1141
+ ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
1142
+ function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
1143
+ return extendStatics(d, b);
1144
+ };
1145
+ return function (d, b) {
1146
+ if (typeof b !== "function" && b !== null)
1147
+ throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
1148
+ extendStatics(d, b);
1149
+ function __() { this.constructor = d; }
1150
+ d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
1151
+ };
1152
+ })();
1153
+ var _ClassRegistry = /** @class */ (function (_super) {
1154
+ __extends(_ClassRegistry, _super);
1155
+ function _ClassRegistry() {
1156
+ var _this = _super.call(this, function (c) { return c.name; }) || this;
1157
+ _this.classToAllowedProps = new Map();
1158
+ return _this;
1159
+ }
1160
+ _ClassRegistry.prototype.register = function (value, options) {
1161
+ if (typeof options === 'object') {
1162
+ if (options.allowProps) {
1163
+ this.classToAllowedProps.set(value, options.allowProps);
1164
+ }
1165
+ _super.prototype.register.call(this, value, options.identifier);
1166
+ }
1167
+ else {
1168
+ _super.prototype.register.call(this, value, options);
1169
+ }
1170
+ };
1171
+ _ClassRegistry.prototype.getAllowedProps = function (value) {
1172
+ return this.classToAllowedProps.get(value);
1173
+ };
1174
+ return _ClassRegistry;
1175
+ }(Registry));
1176
+ var ClassRegistry = new _ClassRegistry();
1177
+
1178
+ var SymbolRegistry = new Registry(function (s) { var _a; return (_a = s.description) !== null && _a !== void 0 ? _a : ''; });
1179
+
1180
+ var __read$3 = (undefined && undefined.__read) || function (o, n) {
1181
+ var m = typeof Symbol === "function" && o[Symbol.iterator];
1182
+ if (!m) return o;
1183
+ var i = m.call(o), r, ar = [], e;
1184
+ try {
1185
+ while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);
1186
+ }
1187
+ catch (error) { e = { error: error }; }
1188
+ finally {
1189
+ try {
1190
+ if (r && !r.done && (m = i["return"])) m.call(i);
1191
+ }
1192
+ finally { if (e) throw e.error; }
1193
+ }
1194
+ return ar;
1195
+ };
1196
+ function valuesOfObj(record) {
1197
+ if ('values' in Object) {
1198
+ // eslint-disable-next-line es5/no-es6-methods
1199
+ return Object.values(record);
1200
+ }
1201
+ var values = [];
1202
+ // eslint-disable-next-line no-restricted-syntax
1203
+ for (var key in record) {
1204
+ if (record.hasOwnProperty(key)) {
1205
+ values.push(record[key]);
1206
+ }
1207
+ }
1208
+ return values;
1209
+ }
1210
+ function find(record, predicate) {
1211
+ var values = valuesOfObj(record);
1212
+ if ('find' in values) {
1213
+ // eslint-disable-next-line es5/no-es6-methods
1214
+ return values.find(predicate);
1215
+ }
1216
+ var valuesNotNever = values;
1217
+ for (var i = 0; i < valuesNotNever.length; i++) {
1218
+ var value = valuesNotNever[i];
1219
+ if (predicate(value)) {
1220
+ return value;
1221
+ }
1222
+ }
1223
+ return undefined;
1224
+ }
1225
+ function forEach(record, run) {
1226
+ Object.entries(record).forEach(function (_a) {
1227
+ var _b = __read$3(_a, 2), key = _b[0], value = _b[1];
1228
+ return run(value, key);
1229
+ });
1230
+ }
1231
+ function includes(arr, value) {
1232
+ return arr.indexOf(value) !== -1;
1233
+ }
1234
+ function findArr(record, predicate) {
1235
+ for (var i = 0; i < record.length; i++) {
1236
+ var value = record[i];
1237
+ if (predicate(value)) {
1238
+ return value;
1239
+ }
1240
+ }
1241
+ return undefined;
1242
+ }
1243
+
1244
+ var transfomers = {};
1245
+ var CustomTransformerRegistry = {
1246
+ register: function (transformer) {
1247
+ transfomers[transformer.name] = transformer;
1248
+ },
1249
+ findApplicable: function (v) {
1250
+ return find(transfomers, function (transformer) { return transformer.isApplicable(v); });
1251
+ },
1252
+ findByName: function (name) {
1253
+ return transfomers[name];
1254
+ }
1255
+ };
1256
+
1257
+ var __read$2 = (undefined && undefined.__read) || function (o, n) {
1258
+ var m = typeof Symbol === "function" && o[Symbol.iterator];
1259
+ if (!m) return o;
1260
+ var i = m.call(o), r, ar = [], e;
1261
+ try {
1262
+ while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);
1263
+ }
1264
+ catch (error) { e = { error: error }; }
1265
+ finally {
1266
+ try {
1267
+ if (r && !r.done && (m = i["return"])) m.call(i);
1268
+ }
1269
+ finally { if (e) throw e.error; }
1270
+ }
1271
+ return ar;
1272
+ };
1273
+ var __spreadArray$2 = (undefined && undefined.__spreadArray) || function (to, from) {
1274
+ for (var i = 0, il = from.length, j = to.length; i < il; i++, j++)
1275
+ to[j] = from[i];
1276
+ return to;
1277
+ };
1278
+ var allowedErrorProps = [];
1279
+ var allowErrorProps = function () {
1280
+ var props = [];
1281
+ for (var _i = 0; _i < arguments.length; _i++) {
1282
+ props[_i] = arguments[_i];
1283
+ }
1284
+ allowedErrorProps.push.apply(allowedErrorProps, __spreadArray$2([], __read$2(props)));
1285
+ };
1286
+
1287
+ var getType$1 = function (payload) {
1288
+ return Object.prototype.toString.call(payload).slice(8, -1);
1289
+ };
1290
+ var isUndefined = function (payload) {
1291
+ return typeof payload === 'undefined';
1292
+ };
1293
+ var isNull = function (payload) { return payload === null; };
1294
+ var isPlainObject$1 = function (payload) {
1295
+ if (getType$1(payload) !== 'Object')
1296
+ return false;
1297
+ if (Object.getPrototypeOf(payload) === null)
1298
+ return true;
1299
+ if (payload === Object.prototype)
1300
+ return false;
1301
+ return (payload.constructor === Object &&
1302
+ Object.getPrototypeOf(payload) === Object.prototype);
1303
+ };
1304
+ var isEmptyObject = function (payload) {
1305
+ return isPlainObject$1(payload) && Object.keys(payload).length === 0;
1306
+ };
1307
+ var isArray$1 = function (payload) {
1308
+ return Array.isArray(payload);
1309
+ };
1310
+ var isString = function (payload) {
1311
+ return typeof payload === 'string';
1312
+ };
1313
+ var isNumber = function (payload) {
1314
+ return typeof payload === 'number' && !isNaN(payload);
1315
+ };
1316
+ var isBoolean = function (payload) {
1317
+ return typeof payload === 'boolean';
1318
+ };
1319
+ var isRegExp = function (payload) {
1320
+ return payload instanceof RegExp;
1321
+ };
1322
+ var isMap = function (payload) {
1323
+ return payload instanceof Map;
1324
+ };
1325
+ var isSet = function (payload) {
1326
+ return payload instanceof Set;
1327
+ };
1328
+ var isSymbol = function (payload) {
1329
+ return getType$1(payload) === 'Symbol';
1330
+ };
1331
+ var isDate = function (payload) {
1332
+ return payload instanceof Date && !isNaN(payload.valueOf());
1333
+ };
1334
+ var isError = function (payload) {
1335
+ return payload instanceof Error;
1336
+ };
1337
+ var isNaNValue = function (payload) {
1338
+ return typeof payload === 'number' && isNaN(payload);
1339
+ };
1340
+ var isPrimitive = function (payload) {
1341
+ return isBoolean(payload) ||
1342
+ isNull(payload) ||
1343
+ isUndefined(payload) ||
1344
+ isNumber(payload) ||
1345
+ isString(payload) ||
1346
+ isSymbol(payload);
1347
+ };
1348
+ var isBigint = function (payload) {
1349
+ return typeof payload === 'bigint';
1350
+ };
1351
+ var isInfinite = function (payload) {
1352
+ return payload === Infinity || payload === -Infinity;
1353
+ };
1354
+ var isTypedArray = function (payload) {
1355
+ return ArrayBuffer.isView(payload) && !(payload instanceof DataView);
1356
+ };
1357
+ var isURL = function (payload) { return payload instanceof URL; };
1358
+
1359
+ var escapeKey = function (key) { return key.replace(/\./g, '\\.'); };
1360
+ var stringifyPath = function (path) {
1361
+ return path
1362
+ .map(String)
1363
+ .map(escapeKey)
1364
+ .join('.');
1365
+ };
1366
+ var parsePath = function (string) {
1367
+ var result = [];
1368
+ var segment = '';
1369
+ for (var i = 0; i < string.length; i++) {
1370
+ var char = string.charAt(i);
1371
+ var isEscapedDot = char === '\\' && string.charAt(i + 1) === '.';
1372
+ if (isEscapedDot) {
1373
+ segment += '.';
1374
+ i++;
1375
+ continue;
1376
+ }
1377
+ var isEndOfSegment = char === '.';
1378
+ if (isEndOfSegment) {
1379
+ result.push(segment);
1380
+ segment = '';
1381
+ continue;
1382
+ }
1383
+ segment += char;
1384
+ }
1385
+ var lastSegment = segment;
1386
+ result.push(lastSegment);
1387
+ return result;
1388
+ };
1389
+
1390
+ var __assign$1 = (undefined && undefined.__assign) || function () {
1391
+ __assign$1 = Object.assign || function(t) {
1392
+ for (var s, i = 1, n = arguments.length; i < n; i++) {
1393
+ s = arguments[i];
1394
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
1395
+ t[p] = s[p];
1396
+ }
1397
+ return t;
1398
+ };
1399
+ return __assign$1.apply(this, arguments);
1400
+ };
1401
+ var __read$1 = (undefined && undefined.__read) || function (o, n) {
1402
+ var m = typeof Symbol === "function" && o[Symbol.iterator];
1403
+ if (!m) return o;
1404
+ var i = m.call(o), r, ar = [], e;
1405
+ try {
1406
+ while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);
1407
+ }
1408
+ catch (error) { e = { error: error }; }
1409
+ finally {
1410
+ try {
1411
+ if (r && !r.done && (m = i["return"])) m.call(i);
1412
+ }
1413
+ finally { if (e) throw e.error; }
1414
+ }
1415
+ return ar;
1416
+ };
1417
+ var __spreadArray$1 = (undefined && undefined.__spreadArray) || function (to, from) {
1418
+ for (var i = 0, il = from.length, j = to.length; i < il; i++, j++)
1419
+ to[j] = from[i];
1420
+ return to;
1421
+ };
1422
+ function simpleTransformation(isApplicable, annotation, transform, untransform) {
1423
+ return {
1424
+ isApplicable: isApplicable,
1425
+ annotation: annotation,
1426
+ transform: transform,
1427
+ untransform: untransform
1428
+ };
1429
+ }
1430
+ var simpleRules = [
1431
+ simpleTransformation(isUndefined, 'undefined', function () { return null; }, function () { return undefined; }),
1432
+ simpleTransformation(isBigint, 'bigint', function (v) { return v.toString(); }, function (v) {
1433
+ if (typeof BigInt !== 'undefined') {
1434
+ return BigInt(v);
1435
+ }
1436
+ console.error('Please add a BigInt polyfill.');
1437
+ return v;
1438
+ }),
1439
+ simpleTransformation(isDate, 'Date', function (v) { return v.toISOString(); }, function (v) { return new Date(v); }),
1440
+ simpleTransformation(isError, 'Error', function (v) {
1441
+ var baseError = {
1442
+ name: v.name,
1443
+ message: v.message
1444
+ };
1445
+ allowedErrorProps.forEach(function (prop) {
1446
+ baseError[prop] = v[prop];
1447
+ });
1448
+ return baseError;
1449
+ }, function (v) {
1450
+ var e = new Error(v.message);
1451
+ e.name = v.name;
1452
+ e.stack = v.stack;
1453
+ allowedErrorProps.forEach(function (prop) {
1454
+ e[prop] = v[prop];
1455
+ });
1456
+ return e;
1457
+ }),
1458
+ simpleTransformation(isRegExp, 'regexp', function (v) { return '' + v; }, function (regex) {
1459
+ var body = regex.slice(1, regex.lastIndexOf('/'));
1460
+ var flags = regex.slice(regex.lastIndexOf('/') + 1);
1461
+ return new RegExp(body, flags);
1462
+ }),
1463
+ simpleTransformation(isSet, 'set',
1464
+ // (sets only exist in es6+)
1465
+ // eslint-disable-next-line es5/no-es6-methods
1466
+ function (v) { return __spreadArray$1([], __read$1(v.values())); }, function (v) { return new Set(v); }),
1467
+ simpleTransformation(isMap, 'map', function (v) { return __spreadArray$1([], __read$1(v.entries())); }, function (v) { return new Map(v); }),
1468
+ simpleTransformation(function (v) { return isNaNValue(v) || isInfinite(v); }, 'number', function (v) {
1469
+ if (isNaNValue(v)) {
1470
+ return 'NaN';
1471
+ }
1472
+ if (v > 0) {
1473
+ return 'Infinity';
1474
+ }
1475
+ else {
1476
+ return '-Infinity';
1477
+ }
1478
+ }, Number),
1479
+ simpleTransformation(function (v) { return v === 0 && 1 / v === -Infinity; }, 'number', function () {
1480
+ return '-0';
1481
+ }, Number),
1482
+ simpleTransformation(isURL, 'URL', function (v) { return v.toString(); }, function (v) { return new URL(v); }),
1483
+ ];
1484
+ function compositeTransformation(isApplicable, annotation, transform, untransform) {
1485
+ return {
1486
+ isApplicable: isApplicable,
1487
+ annotation: annotation,
1488
+ transform: transform,
1489
+ untransform: untransform
1490
+ };
1491
+ }
1492
+ var symbolRule = compositeTransformation(function (s) {
1493
+ if (isSymbol(s)) {
1494
+ var isRegistered = !!SymbolRegistry.getIdentifier(s);
1495
+ return isRegistered;
1496
+ }
1497
+ return false;
1498
+ }, function (s) {
1499
+ var identifier = SymbolRegistry.getIdentifier(s);
1500
+ return ['symbol', identifier];
1501
+ }, function (v) { return v.description; }, function (_, a) {
1502
+ var value = SymbolRegistry.getValue(a[1]);
1503
+ if (!value) {
1504
+ throw new Error('Trying to deserialize unknown symbol');
1505
+ }
1506
+ return value;
1507
+ });
1508
+ var constructorToName = [
1509
+ Int8Array,
1510
+ Uint8Array,
1511
+ Int16Array,
1512
+ Uint16Array,
1513
+ Int32Array,
1514
+ Uint32Array,
1515
+ Float32Array,
1516
+ Float64Array,
1517
+ Uint8ClampedArray,
1518
+ ].reduce(function (obj, ctor) {
1519
+ obj[ctor.name] = ctor;
1520
+ return obj;
1521
+ }, {});
1522
+ var typedArrayRule = compositeTransformation(isTypedArray, function (v) { return ['typed-array', v.constructor.name]; }, function (v) { return __spreadArray$1([], __read$1(v)); }, function (v, a) {
1523
+ var ctor = constructorToName[a[1]];
1524
+ if (!ctor) {
1525
+ throw new Error('Trying to deserialize unknown typed array');
1526
+ }
1527
+ return new ctor(v);
1528
+ });
1529
+ function isInstanceOfRegisteredClass(potentialClass) {
1530
+ if (potentialClass === null || potentialClass === void 0 ? void 0 : potentialClass.constructor) {
1531
+ var isRegistered = !!ClassRegistry.getIdentifier(potentialClass.constructor);
1532
+ return isRegistered;
1533
+ }
1534
+ return false;
1535
+ }
1536
+ var classRule = compositeTransformation(isInstanceOfRegisteredClass, function (clazz) {
1537
+ var identifier = ClassRegistry.getIdentifier(clazz.constructor);
1538
+ return ['class', identifier];
1539
+ }, function (clazz) {
1540
+ var allowedProps = ClassRegistry.getAllowedProps(clazz.constructor);
1541
+ if (!allowedProps) {
1542
+ return __assign$1({}, clazz);
1543
+ }
1544
+ var result = {};
1545
+ allowedProps.forEach(function (prop) {
1546
+ result[prop] = clazz[prop];
1547
+ });
1548
+ return result;
1549
+ }, function (v, a) {
1550
+ var clazz = ClassRegistry.getValue(a[1]);
1551
+ if (!clazz) {
1552
+ throw new Error('Trying to deserialize unknown class - check https://github.com/blitz-js/superjson/issues/116#issuecomment-773996564');
1553
+ }
1554
+ return Object.assign(Object.create(clazz.prototype), v);
1555
+ });
1556
+ var customRule = compositeTransformation(function (value) {
1557
+ return !!CustomTransformerRegistry.findApplicable(value);
1558
+ }, function (value) {
1559
+ var transformer = CustomTransformerRegistry.findApplicable(value);
1560
+ return ['custom', transformer.name];
1561
+ }, function (value) {
1562
+ var transformer = CustomTransformerRegistry.findApplicable(value);
1563
+ return transformer.serialize(value);
1564
+ }, function (v, a) {
1565
+ var transformer = CustomTransformerRegistry.findByName(a[1]);
1566
+ if (!transformer) {
1567
+ throw new Error('Trying to deserialize unknown custom value');
1568
+ }
1569
+ return transformer.deserialize(v);
1570
+ });
1571
+ var compositeRules = [classRule, symbolRule, customRule, typedArrayRule];
1572
+ var transformValue = function (value) {
1573
+ var applicableCompositeRule = findArr(compositeRules, function (rule) {
1574
+ return rule.isApplicable(value);
1575
+ });
1576
+ if (applicableCompositeRule) {
1577
+ return {
1578
+ value: applicableCompositeRule.transform(value),
1579
+ type: applicableCompositeRule.annotation(value)
1580
+ };
1581
+ }
1582
+ var applicableSimpleRule = findArr(simpleRules, function (rule) {
1583
+ return rule.isApplicable(value);
1584
+ });
1585
+ if (applicableSimpleRule) {
1586
+ return {
1587
+ value: applicableSimpleRule.transform(value),
1588
+ type: applicableSimpleRule.annotation
1589
+ };
1590
+ }
1591
+ return undefined;
1592
+ };
1593
+ var simpleRulesByAnnotation = {};
1594
+ simpleRules.forEach(function (rule) {
1595
+ simpleRulesByAnnotation[rule.annotation] = rule;
1596
+ });
1597
+ var untransformValue = function (json, type) {
1598
+ if (isArray$1(type)) {
1599
+ switch (type[0]) {
1600
+ case 'symbol':
1601
+ return symbolRule.untransform(json, type);
1602
+ case 'class':
1603
+ return classRule.untransform(json, type);
1604
+ case 'custom':
1605
+ return customRule.untransform(json, type);
1606
+ case 'typed-array':
1607
+ return typedArrayRule.untransform(json, type);
1608
+ default:
1609
+ throw new Error('Unknown transformation: ' + type);
1610
+ }
1611
+ }
1612
+ else {
1613
+ var transformation = simpleRulesByAnnotation[type];
1614
+ if (!transformation) {
1615
+ throw new Error('Unknown transformation: ' + type);
1616
+ }
1617
+ return transformation.untransform(json);
1618
+ }
1619
+ };
1620
+
1621
+ var getNthKey = function (value, n) {
1622
+ var keys = value.keys();
1623
+ while (n > 0) {
1624
+ keys.next();
1625
+ n--;
1626
+ }
1627
+ return keys.next().value;
1628
+ };
1629
+ function validatePath(path) {
1630
+ if (includes(path, '__proto__')) {
1631
+ throw new Error('__proto__ is not allowed as a property');
1632
+ }
1633
+ if (includes(path, 'prototype')) {
1634
+ throw new Error('prototype is not allowed as a property');
1635
+ }
1636
+ if (includes(path, 'constructor')) {
1637
+ throw new Error('constructor is not allowed as a property');
1638
+ }
1639
+ }
1640
+ var getDeep = function (object, path) {
1641
+ validatePath(path);
1642
+ path.forEach(function (key) {
1643
+ object = object[key];
1644
+ });
1645
+ return object;
1646
+ };
1647
+ var setDeep = function (object, path, mapper) {
1648
+ validatePath(path);
1649
+ if (path.length === 0) {
1650
+ return mapper(object);
1651
+ }
1652
+ var parent = object;
1653
+ for (var i = 0; i < path.length - 1; i++) {
1654
+ var key = path[i];
1655
+ if (isArray$1(parent)) {
1656
+ var index = +key;
1657
+ parent = parent[index];
1658
+ }
1659
+ else if (isPlainObject$1(parent)) {
1660
+ parent = parent[key];
1661
+ }
1662
+ else if (isSet(parent)) {
1663
+ var row = +key;
1664
+ parent = getNthKey(parent, row);
1665
+ }
1666
+ else if (isMap(parent)) {
1667
+ var isEnd = i === path.length - 2;
1668
+ if (isEnd) {
1669
+ break;
1670
+ }
1671
+ var row = +key;
1672
+ var type = +path[++i] === 0 ? 'key' : 'value';
1673
+ var keyOfRow = getNthKey(parent, row);
1674
+ switch (type) {
1675
+ case 'key':
1676
+ parent = keyOfRow;
1677
+ break;
1678
+ case 'value':
1679
+ parent = parent.get(keyOfRow);
1680
+ break;
1681
+ }
1682
+ }
1683
+ }
1684
+ var lastKey = path[path.length - 1];
1685
+ if (isArray$1(parent) || isPlainObject$1(parent)) {
1686
+ parent[lastKey] = mapper(parent[lastKey]);
1687
+ }
1688
+ if (isSet(parent)) {
1689
+ var oldValue = getNthKey(parent, +lastKey);
1690
+ var newValue = mapper(oldValue);
1691
+ if (oldValue !== newValue) {
1692
+ parent["delete"](oldValue);
1693
+ parent.add(newValue);
1694
+ }
1695
+ }
1696
+ if (isMap(parent)) {
1697
+ var row = +path[path.length - 2];
1698
+ var keyToRow = getNthKey(parent, row);
1699
+ var type = +lastKey === 0 ? 'key' : 'value';
1700
+ switch (type) {
1701
+ case 'key': {
1702
+ var newKey = mapper(keyToRow);
1703
+ parent.set(newKey, parent.get(keyToRow));
1704
+ if (newKey !== keyToRow) {
1705
+ parent["delete"](keyToRow);
1706
+ }
1707
+ break;
1708
+ }
1709
+ case 'value': {
1710
+ parent.set(keyToRow, mapper(parent.get(keyToRow)));
1711
+ break;
1712
+ }
1713
+ }
1714
+ }
1715
+ return object;
1716
+ };
1717
+
1718
+ var __read = (undefined && undefined.__read) || function (o, n) {
1719
+ var m = typeof Symbol === "function" && o[Symbol.iterator];
1720
+ if (!m) return o;
1721
+ var i = m.call(o), r, ar = [], e;
1722
+ try {
1723
+ while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);
1724
+ }
1725
+ catch (error) { e = { error: error }; }
1726
+ finally {
1727
+ try {
1728
+ if (r && !r.done && (m = i["return"])) m.call(i);
1729
+ }
1730
+ finally { if (e) throw e.error; }
1731
+ }
1732
+ return ar;
1733
+ };
1734
+ var __spreadArray = (undefined && undefined.__spreadArray) || function (to, from) {
1735
+ for (var i = 0, il = from.length, j = to.length; i < il; i++, j++)
1736
+ to[j] = from[i];
1737
+ return to;
1738
+ };
1739
+ function traverse(tree, walker, origin) {
1740
+ if (origin === void 0) { origin = []; }
1741
+ if (!tree) {
1742
+ return;
1743
+ }
1744
+ if (!isArray$1(tree)) {
1745
+ forEach(tree, function (subtree, key) {
1746
+ return traverse(subtree, walker, __spreadArray(__spreadArray([], __read(origin)), __read(parsePath(key))));
1747
+ });
1748
+ return;
1749
+ }
1750
+ var _a = __read(tree, 2), nodeValue = _a[0], children = _a[1];
1751
+ if (children) {
1752
+ forEach(children, function (child, key) {
1753
+ traverse(child, walker, __spreadArray(__spreadArray([], __read(origin)), __read(parsePath(key))));
1754
+ });
1755
+ }
1756
+ walker(nodeValue, origin);
1757
+ }
1758
+ function applyValueAnnotations(plain, annotations) {
1759
+ traverse(annotations, function (type, path) {
1760
+ plain = setDeep(plain, path, function (v) { return untransformValue(v, type); });
1761
+ });
1762
+ return plain;
1763
+ }
1764
+ function applyReferentialEqualityAnnotations(plain, annotations) {
1765
+ function apply(identicalPaths, path) {
1766
+ var object = getDeep(plain, parsePath(path));
1767
+ identicalPaths.map(parsePath).forEach(function (identicalObjectPath) {
1768
+ plain = setDeep(plain, identicalObjectPath, function () { return object; });
1769
+ });
1770
+ }
1771
+ if (isArray$1(annotations)) {
1772
+ var _a = __read(annotations, 2), root = _a[0], other = _a[1];
1773
+ root.forEach(function (identicalPath) {
1774
+ plain = setDeep(plain, parsePath(identicalPath), function () { return plain; });
1775
+ });
1776
+ if (other) {
1777
+ forEach(other, apply);
1778
+ }
1779
+ }
1780
+ else {
1781
+ forEach(annotations, apply);
1782
+ }
1783
+ return plain;
1784
+ }
1785
+ var isDeep = function (object) {
1786
+ return isPlainObject$1(object) ||
1787
+ isArray$1(object) ||
1788
+ isMap(object) ||
1789
+ isSet(object) ||
1790
+ isInstanceOfRegisteredClass(object);
1791
+ };
1792
+ function addIdentity(object, path, identities) {
1793
+ var existingSet = identities.get(object);
1794
+ if (existingSet) {
1795
+ existingSet.push(path);
1796
+ }
1797
+ else {
1798
+ identities.set(object, [path]);
1799
+ }
1800
+ }
1801
+ function generateReferentialEqualityAnnotations(identitites) {
1802
+ var result = {};
1803
+ var rootEqualityPaths = undefined;
1804
+ identitites.forEach(function (paths) {
1805
+ if (paths.length <= 1) {
1806
+ return;
1807
+ }
1808
+ var _a = __read(paths
1809
+ .map(function (path) { return path.map(String); })
1810
+ .sort(function (a, b) { return a.length - b.length; })), shortestPath = _a[0], identicalPaths = _a.slice(1);
1811
+ if (shortestPath.length === 0) {
1812
+ rootEqualityPaths = identicalPaths.map(stringifyPath);
1813
+ }
1814
+ else {
1815
+ result[stringifyPath(shortestPath)] = identicalPaths.map(stringifyPath);
1816
+ }
1817
+ });
1818
+ if (rootEqualityPaths) {
1819
+ if (isEmptyObject(result)) {
1820
+ return [rootEqualityPaths];
1821
+ }
1822
+ else {
1823
+ return [rootEqualityPaths, result];
1824
+ }
1825
+ }
1826
+ else {
1827
+ return isEmptyObject(result) ? undefined : result;
1828
+ }
1829
+ }
1830
+ var walker = function (object, identities, path, objectsInThisPath) {
1831
+ var _a;
1832
+ if (path === void 0) { path = []; }
1833
+ if (objectsInThisPath === void 0) { objectsInThisPath = []; }
1834
+ if (!isPrimitive(object)) {
1835
+ addIdentity(object, path, identities);
1836
+ }
1837
+ if (!isDeep(object)) {
1838
+ var transformed_1 = transformValue(object);
1839
+ if (transformed_1) {
1840
+ return {
1841
+ transformedValue: transformed_1.value,
1842
+ annotations: [transformed_1.type]
1843
+ };
1844
+ }
1845
+ else {
1846
+ return {
1847
+ transformedValue: object
1848
+ };
1849
+ }
1850
+ }
1851
+ if (includes(objectsInThisPath, object)) {
1852
+ return {
1853
+ transformedValue: null
1854
+ };
1855
+ }
1856
+ var transformationResult = transformValue(object);
1857
+ var transformed = (_a = transformationResult === null || transformationResult === void 0 ? void 0 : transformationResult.value) !== null && _a !== void 0 ? _a : object;
1858
+ if (!isPrimitive(object)) {
1859
+ objectsInThisPath = __spreadArray(__spreadArray([], __read(objectsInThisPath)), [object]);
1860
+ }
1861
+ var transformedValue = isArray$1(transformed) ? [] : {};
1862
+ var innerAnnotations = {};
1863
+ forEach(transformed, function (value, index) {
1864
+ var recursiveResult = walker(value, identities, __spreadArray(__spreadArray([], __read(path)), [index]), objectsInThisPath);
1865
+ transformedValue[index] = recursiveResult.transformedValue;
1866
+ if (isArray$1(recursiveResult.annotations)) {
1867
+ innerAnnotations[index] = recursiveResult.annotations;
1868
+ }
1869
+ else if (isPlainObject$1(recursiveResult.annotations)) {
1870
+ forEach(recursiveResult.annotations, function (tree, key) {
1871
+ innerAnnotations[escapeKey(index) + '.' + key] = tree;
1872
+ });
1873
+ }
1874
+ });
1875
+ if (isEmptyObject(innerAnnotations)) {
1876
+ return {
1877
+ transformedValue: transformedValue,
1878
+ annotations: !!transformationResult
1879
+ ? [transformationResult.type]
1880
+ : undefined
1881
+ };
1882
+ }
1883
+ else {
1884
+ return {
1885
+ transformedValue: transformedValue,
1886
+ annotations: !!transformationResult
1887
+ ? [transformationResult.type, innerAnnotations]
1888
+ : innerAnnotations
1889
+ };
1890
+ }
1891
+ };
1892
+
1893
+ /**
1894
+ * Returns the object type of the given payload
1895
+ *
1896
+ * @param {*} payload
1897
+ * @returns {string}
1898
+ */
1899
+ function getType(payload) {
1900
+ return Object.prototype.toString.call(payload).slice(8, -1);
1901
+ }
1902
+ /**
1903
+ * Returns whether the payload is a plain JavaScript object (excluding special classes or objects with other prototypes)
1904
+ *
1905
+ * @param {*} payload
1906
+ * @returns {payload is PlainObject}
1907
+ */
1908
+ function isPlainObject(payload) {
1909
+ if (getType(payload) !== 'Object')
1910
+ return false;
1911
+ return payload.constructor === Object && Object.getPrototypeOf(payload) === Object.prototype;
1912
+ }
1913
+ /**
1914
+ * Returns whether the payload is an array
1915
+ *
1916
+ * @param {any} payload
1917
+ * @returns {payload is any[]}
1918
+ */
1919
+ function isArray(payload) {
1920
+ return getType(payload) === 'Array';
1921
+ }
1922
+
1923
+ function assignProp(carry, key, newVal, originalObject, includeNonenumerable) {
1924
+ const propType = {}.propertyIsEnumerable.call(originalObject, key)
1925
+ ? 'enumerable'
1926
+ : 'nonenumerable';
1927
+ if (propType === 'enumerable')
1928
+ carry[key] = newVal;
1929
+ if (includeNonenumerable && propType === 'nonenumerable') {
1930
+ Object.defineProperty(carry, key, {
1931
+ value: newVal,
1932
+ enumerable: false,
1933
+ writable: true,
1934
+ configurable: true,
1935
+ });
1936
+ }
1937
+ }
1938
+ /**
1939
+ * Copy (clone) an object and all its props recursively to get rid of any prop referenced of the original object. Arrays are also cloned, however objects inside arrays are still linked.
1940
+ *
1941
+ * @export
1942
+ * @template T
1943
+ * @param {T} target Target can be anything
1944
+ * @param {Options} [options = {}] Options can be `props` or `nonenumerable`
1945
+ * @returns {T} the target with replaced values
1946
+ * @export
1947
+ */
1948
+ function copy(target, options = {}) {
1949
+ if (isArray(target)) {
1950
+ return target.map((item) => copy(item, options));
1951
+ }
1952
+ if (!isPlainObject(target)) {
1953
+ return target;
1954
+ }
1955
+ const props = Object.getOwnPropertyNames(target);
1956
+ const symbols = Object.getOwnPropertySymbols(target);
1957
+ return [...props, ...symbols].reduce((carry, key) => {
1958
+ if (isArray(options.props) && !options.props.includes(key)) {
1959
+ return carry;
1960
+ }
1961
+ const val = target[key];
1962
+ const newVal = copy(val, options);
1963
+ assignProp(carry, key, newVal, target, options.nonenumerable);
1964
+ return carry;
1965
+ }, {});
1966
+ }
1967
+
1968
+ var __assign = (undefined && undefined.__assign) || function () {
1969
+ __assign = Object.assign || function(t) {
1970
+ for (var s, i = 1, n = arguments.length; i < n; i++) {
1971
+ s = arguments[i];
1972
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
1973
+ t[p] = s[p];
1974
+ }
1975
+ return t;
1976
+ };
1977
+ return __assign.apply(this, arguments);
1978
+ };
1979
+ var serialize = function (object) {
1980
+ var identities = new Map();
1981
+ var output = walker(object, identities);
1982
+ var res = {
1983
+ json: output.transformedValue
1984
+ };
1985
+ if (output.annotations) {
1986
+ res.meta = __assign(__assign({}, res.meta), { values: output.annotations });
1987
+ }
1988
+ var equalityAnnotations = generateReferentialEqualityAnnotations(identities);
1989
+ if (equalityAnnotations) {
1990
+ res.meta = __assign(__assign({}, res.meta), { referentialEqualities: equalityAnnotations });
1991
+ }
1992
+ return res;
1993
+ };
1994
+ var deserialize = function (payload) {
1995
+ var json = payload.json, meta = payload.meta;
1996
+ var result = copy(json);
1997
+ if (meta === null || meta === void 0 ? void 0 : meta.values) {
1998
+ result = applyValueAnnotations(result, meta.values);
1999
+ }
2000
+ if (meta === null || meta === void 0 ? void 0 : meta.referentialEqualities) {
2001
+ result = applyReferentialEqualityAnnotations(result, meta.referentialEqualities);
2002
+ }
2003
+ return result;
2004
+ };
2005
+ var stringify = function (object) {
2006
+ return JSON.stringify(serialize(object));
2007
+ };
2008
+ var parse = function (string) {
2009
+ return deserialize(JSON.parse(string));
2010
+ };
2011
+ var registerClass = function (v, options) {
2012
+ return ClassRegistry.register(v, options);
2013
+ };
2014
+ var registerSymbol = function (v, identifier) {
2015
+ return SymbolRegistry.register(v, identifier);
2016
+ };
2017
+ var registerCustom = function (transformer, name) {
2018
+ return CustomTransformerRegistry.register(__assign({ name: name }, transformer));
2019
+ };
2020
+ var SuperJSON = {
2021
+ stringify: stringify,
2022
+ parse: parse,
2023
+ serialize: serialize,
2024
+ deserialize: deserialize,
2025
+ registerClass: registerClass,
2026
+ registerSymbol: registerSymbol,
2027
+ registerCustom: registerCustom,
2028
+ allowErrorProps: allowErrorProps
2029
+ };
2030
+
1084
2031
  const defaultTheme = {
1085
2032
  background: '#0b1521',
1086
2033
  backgroundAlt: '#132337',
@@ -1185,9 +2132,10 @@
1185
2132
  */
1186
2133
 
1187
2134
  const displayValue = value => {
1188
- const name = Object.getOwnPropertyNames(Object(value));
1189
- const newValue = typeof value === 'bigint' ? value.toString() + "n" : value;
1190
- return JSON.stringify(newValue, name);
2135
+ const {
2136
+ json
2137
+ } = SuperJSON.serialize(value);
2138
+ return JSON.stringify(json);
1191
2139
  };
1192
2140
 
1193
2141
  const getStatusRank = q => q.state.fetchStatus !== 'idle' ? 0 : !q.getObserversCount() ? 3 : q.isStale() ? 2 : 1;