@tanstack/react-query-devtools 4.39.0 → 4.39.2

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 (78) hide show
  1. package/build/lib/Explorer.esm.js +264 -0
  2. package/build/lib/Explorer.esm.js.map +1 -0
  3. package/build/lib/Explorer.js +302 -0
  4. package/build/lib/Explorer.js.map +1 -0
  5. package/build/lib/Explorer.mjs +264 -0
  6. package/build/lib/Explorer.mjs.map +1 -0
  7. package/build/lib/Logo.esm.js +32 -0
  8. package/build/lib/Logo.esm.js.map +1 -0
  9. package/build/lib/Logo.js +56 -0
  10. package/build/lib/Logo.js.map +1 -0
  11. package/build/lib/Logo.mjs +32 -0
  12. package/build/lib/Logo.mjs.map +1 -0
  13. package/build/lib/_virtual/_rollupPluginBabelHelpers.esm.js +19 -0
  14. package/build/lib/_virtual/_rollupPluginBabelHelpers.esm.js.map +1 -0
  15. package/build/lib/_virtual/_rollupPluginBabelHelpers.js +23 -0
  16. package/build/lib/_virtual/_rollupPluginBabelHelpers.js.map +1 -0
  17. package/build/lib/_virtual/_rollupPluginBabelHelpers.mjs +19 -0
  18. package/build/lib/_virtual/_rollupPluginBabelHelpers.mjs.map +1 -0
  19. package/build/lib/devtools.esm.js +925 -0
  20. package/build/lib/devtools.esm.js.map +1 -0
  21. package/build/lib/devtools.js +949 -0
  22. package/build/lib/devtools.js.map +1 -0
  23. package/build/lib/devtools.mjs +925 -0
  24. package/build/lib/devtools.mjs.map +1 -0
  25. package/build/lib/index.esm.js +12 -0
  26. package/build/lib/index.esm.js.map +1 -0
  27. package/build/lib/index.js +17 -0
  28. package/build/lib/index.js.map +1 -0
  29. package/build/lib/index.mjs +12 -0
  30. package/build/lib/index.mjs.map +1 -0
  31. package/build/lib/index.prod.d.ts +4 -0
  32. package/build/lib/index.prod.esm.js +1604 -0
  33. package/build/lib/index.prod.esm.js.map +1 -0
  34. package/build/lib/index.prod.js +1631 -0
  35. package/build/lib/index.prod.js.map +1 -0
  36. package/build/lib/index.prod.mjs +1604 -0
  37. package/build/lib/index.prod.mjs.map +1 -0
  38. package/build/lib/screenreader.esm.js +17 -0
  39. package/build/lib/screenreader.esm.js.map +1 -0
  40. package/build/lib/screenreader.js +41 -0
  41. package/build/lib/screenreader.js.map +1 -0
  42. package/build/lib/screenreader.mjs +17 -0
  43. package/build/lib/screenreader.mjs.map +1 -0
  44. package/build/lib/styledComponents.esm.js +94 -0
  45. package/build/lib/styledComponents.esm.js.map +1 -0
  46. package/build/lib/styledComponents.js +105 -0
  47. package/build/lib/styledComponents.js.map +1 -0
  48. package/build/lib/styledComponents.mjs +94 -0
  49. package/build/lib/styledComponents.mjs.map +1 -0
  50. package/build/lib/theme.esm.js +33 -0
  51. package/build/lib/theme.esm.js.map +1 -0
  52. package/build/lib/theme.js +59 -0
  53. package/build/lib/theme.js.map +1 -0
  54. package/build/lib/theme.mjs +33 -0
  55. package/build/lib/theme.mjs.map +1 -0
  56. package/build/lib/useLocalStorage.esm.js +47 -0
  57. package/build/lib/useLocalStorage.esm.js.map +1 -0
  58. package/build/lib/useLocalStorage.js +71 -0
  59. package/build/lib/useLocalStorage.js.map +1 -0
  60. package/build/lib/useLocalStorage.mjs +47 -0
  61. package/build/lib/useLocalStorage.mjs.map +1 -0
  62. package/build/lib/useMediaQuery.esm.js +36 -0
  63. package/build/lib/useMediaQuery.esm.js.map +1 -0
  64. package/build/lib/useMediaQuery.js +60 -0
  65. package/build/lib/useMediaQuery.js.map +1 -0
  66. package/build/lib/useMediaQuery.mjs +36 -0
  67. package/build/lib/useMediaQuery.mjs.map +1 -0
  68. package/build/lib/utils.esm.js +186 -0
  69. package/build/lib/utils.esm.js.map +1 -0
  70. package/build/lib/utils.js +226 -0
  71. package/build/lib/utils.js.map +1 -0
  72. package/build/lib/utils.mjs +186 -0
  73. package/build/lib/utils.mjs.map +1 -0
  74. package/build/umd/index.development.js +3531 -0
  75. package/build/umd/index.development.js.map +1 -0
  76. package/build/umd/index.production.js +2 -0
  77. package/build/umd/index.production.js.map +1 -0
  78. package/package.json +3 -3
@@ -0,0 +1,3531 @@
1
+ (function (global, factory) {
2
+ typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('react'), require('@tanstack/react-query')) :
3
+ typeof define === 'function' && define.amd ? define(['exports', 'react', '@tanstack/react-query'], factory) :
4
+ (global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory(global.ReactQueryDevtools = {}, global.React, global.ReactQuery));
5
+ })(this, (function (exports, React, reactQuery) { 'use strict';
6
+
7
+ function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
8
+
9
+ function _interopNamespace(e) {
10
+ if (e && e.__esModule) return e;
11
+ var n = Object.create(null);
12
+ if (e) {
13
+ Object.keys(e).forEach(function (k) {
14
+ if (k !== 'default') {
15
+ var d = Object.getOwnPropertyDescriptor(e, k);
16
+ Object.defineProperty(n, k, d.get ? d : {
17
+ enumerable: true,
18
+ get: function () { return e[k]; }
19
+ });
20
+ }
21
+ });
22
+ }
23
+ n["default"] = e;
24
+ return Object.freeze(n);
25
+ }
26
+
27
+ var React__default = /*#__PURE__*/_interopDefaultLegacy(React);
28
+ var React__namespace = /*#__PURE__*/_interopNamespace(React);
29
+
30
+ function _extends() {
31
+ _extends = Object.assign ? Object.assign.bind() : function (target) {
32
+ for (var i = 1; i < arguments.length; i++) {
33
+ var source = arguments[i];
34
+
35
+ for (var key in source) {
36
+ if (Object.prototype.hasOwnProperty.call(source, key)) {
37
+ target[key] = source[key];
38
+ }
39
+ }
40
+ }
41
+
42
+ return target;
43
+ };
44
+ return _extends.apply(this, arguments);
45
+ }
46
+
47
+ /**
48
+ * match-sorter-utils
49
+ *
50
+ * Copyright (c) TanStack
51
+ *
52
+ * This source code is licensed under the MIT license found in the
53
+ * LICENSE.md file in the root directory of this source tree.
54
+ *
55
+ * @license MIT
56
+ */
57
+ const characterMap = {
58
+ À: 'A',
59
+ Á: 'A',
60
+ Â: 'A',
61
+ Ã: 'A',
62
+ Ä: 'A',
63
+ Å: 'A',
64
+ Ấ: 'A',
65
+ Ắ: 'A',
66
+ Ẳ: 'A',
67
+ Ẵ: 'A',
68
+ Ặ: 'A',
69
+ Æ: 'AE',
70
+ Ầ: 'A',
71
+ Ằ: 'A',
72
+ Ȃ: 'A',
73
+ Ç: 'C',
74
+ Ḉ: 'C',
75
+ È: 'E',
76
+ É: 'E',
77
+ Ê: 'E',
78
+ Ë: 'E',
79
+ Ế: 'E',
80
+ Ḗ: 'E',
81
+ Ề: 'E',
82
+ Ḕ: 'E',
83
+ Ḝ: 'E',
84
+ Ȇ: 'E',
85
+ Ì: 'I',
86
+ Í: 'I',
87
+ Î: 'I',
88
+ Ï: 'I',
89
+ Ḯ: 'I',
90
+ Ȋ: 'I',
91
+ Ð: 'D',
92
+ Ñ: 'N',
93
+ Ò: 'O',
94
+ Ó: 'O',
95
+ Ô: 'O',
96
+ Õ: 'O',
97
+ Ö: 'O',
98
+ Ø: 'O',
99
+ Ố: 'O',
100
+ Ṍ: 'O',
101
+ Ṓ: 'O',
102
+ Ȏ: 'O',
103
+ Ù: 'U',
104
+ Ú: 'U',
105
+ Û: 'U',
106
+ Ü: 'U',
107
+ Ý: 'Y',
108
+ à: 'a',
109
+ á: 'a',
110
+ â: 'a',
111
+ ã: 'a',
112
+ ä: 'a',
113
+ å: 'a',
114
+ ấ: 'a',
115
+ ắ: 'a',
116
+ ẳ: 'a',
117
+ ẵ: 'a',
118
+ ặ: 'a',
119
+ æ: 'ae',
120
+ ầ: 'a',
121
+ ằ: 'a',
122
+ ȃ: 'a',
123
+ ç: 'c',
124
+ ḉ: 'c',
125
+ è: 'e',
126
+ é: 'e',
127
+ ê: 'e',
128
+ ë: 'e',
129
+ ế: 'e',
130
+ ḗ: 'e',
131
+ ề: 'e',
132
+ ḕ: 'e',
133
+ ḝ: 'e',
134
+ ȇ: 'e',
135
+ ì: 'i',
136
+ í: 'i',
137
+ î: 'i',
138
+ ï: 'i',
139
+ ḯ: 'i',
140
+ ȋ: 'i',
141
+ ð: 'd',
142
+ ñ: 'n',
143
+ ò: 'o',
144
+ ó: 'o',
145
+ ô: 'o',
146
+ õ: 'o',
147
+ ö: 'o',
148
+ ø: 'o',
149
+ ố: 'o',
150
+ ṍ: 'o',
151
+ ṓ: 'o',
152
+ ȏ: 'o',
153
+ ù: 'u',
154
+ ú: 'u',
155
+ û: 'u',
156
+ ü: 'u',
157
+ ý: 'y',
158
+ ÿ: 'y',
159
+ Ā: 'A',
160
+ ā: 'a',
161
+ Ă: 'A',
162
+ ă: 'a',
163
+ Ą: 'A',
164
+ ą: 'a',
165
+ Ć: 'C',
166
+ ć: 'c',
167
+ Ĉ: 'C',
168
+ ĉ: 'c',
169
+ Ċ: 'C',
170
+ ċ: 'c',
171
+ Č: 'C',
172
+ č: 'c',
173
+ C̆: 'C',
174
+ c̆: 'c',
175
+ Ď: 'D',
176
+ ď: 'd',
177
+ Đ: 'D',
178
+ đ: 'd',
179
+ Ē: 'E',
180
+ ē: 'e',
181
+ Ĕ: 'E',
182
+ ĕ: 'e',
183
+ Ė: 'E',
184
+ ė: 'e',
185
+ Ę: 'E',
186
+ ę: 'e',
187
+ Ě: 'E',
188
+ ě: 'e',
189
+ Ĝ: 'G',
190
+ Ǵ: 'G',
191
+ ĝ: 'g',
192
+ ǵ: 'g',
193
+ Ğ: 'G',
194
+ ğ: 'g',
195
+ Ġ: 'G',
196
+ ġ: 'g',
197
+ Ģ: 'G',
198
+ ģ: 'g',
199
+ Ĥ: 'H',
200
+ ĥ: 'h',
201
+ Ħ: 'H',
202
+ ħ: 'h',
203
+ Ḫ: 'H',
204
+ ḫ: 'h',
205
+ Ĩ: 'I',
206
+ ĩ: 'i',
207
+ Ī: 'I',
208
+ ī: 'i',
209
+ Ĭ: 'I',
210
+ ĭ: 'i',
211
+ Į: 'I',
212
+ į: 'i',
213
+ İ: 'I',
214
+ ı: 'i',
215
+ IJ: 'IJ',
216
+ ij: 'ij',
217
+ Ĵ: 'J',
218
+ ĵ: 'j',
219
+ Ķ: 'K',
220
+ ķ: 'k',
221
+ Ḱ: 'K',
222
+ ḱ: 'k',
223
+ K̆: 'K',
224
+ k̆: 'k',
225
+ Ĺ: 'L',
226
+ ĺ: 'l',
227
+ Ļ: 'L',
228
+ ļ: 'l',
229
+ Ľ: 'L',
230
+ ľ: 'l',
231
+ Ŀ: 'L',
232
+ ŀ: 'l',
233
+ Ł: 'l',
234
+ ł: 'l',
235
+ Ḿ: 'M',
236
+ ḿ: 'm',
237
+ M̆: 'M',
238
+ m̆: 'm',
239
+ Ń: 'N',
240
+ ń: 'n',
241
+ Ņ: 'N',
242
+ ņ: 'n',
243
+ Ň: 'N',
244
+ ň: 'n',
245
+ ʼn: 'n',
246
+ N̆: 'N',
247
+ n̆: 'n',
248
+ Ō: 'O',
249
+ ō: 'o',
250
+ Ŏ: 'O',
251
+ ŏ: 'o',
252
+ Ő: 'O',
253
+ ő: 'o',
254
+ Œ: 'OE',
255
+ œ: 'oe',
256
+ P̆: 'P',
257
+ p̆: 'p',
258
+ Ŕ: 'R',
259
+ ŕ: 'r',
260
+ Ŗ: 'R',
261
+ ŗ: 'r',
262
+ Ř: 'R',
263
+ ř: 'r',
264
+ R̆: 'R',
265
+ r̆: 'r',
266
+ Ȓ: 'R',
267
+ ȓ: 'r',
268
+ Ś: 'S',
269
+ ś: 's',
270
+ Ŝ: 'S',
271
+ ŝ: 's',
272
+ Ş: 'S',
273
+ Ș: 'S',
274
+ ș: 's',
275
+ ş: 's',
276
+ Š: 'S',
277
+ š: 's',
278
+ Ţ: 'T',
279
+ ţ: 't',
280
+ ț: 't',
281
+ Ț: 'T',
282
+ Ť: 'T',
283
+ ť: 't',
284
+ Ŧ: 'T',
285
+ ŧ: 't',
286
+ T̆: 'T',
287
+ t̆: 't',
288
+ Ũ: 'U',
289
+ ũ: 'u',
290
+ Ū: 'U',
291
+ ū: 'u',
292
+ Ŭ: 'U',
293
+ ŭ: 'u',
294
+ Ů: 'U',
295
+ ů: 'u',
296
+ Ű: 'U',
297
+ ű: 'u',
298
+ Ų: 'U',
299
+ ų: 'u',
300
+ Ȗ: 'U',
301
+ ȗ: 'u',
302
+ V̆: 'V',
303
+ v̆: 'v',
304
+ Ŵ: 'W',
305
+ ŵ: 'w',
306
+ Ẃ: 'W',
307
+ ẃ: 'w',
308
+ X̆: 'X',
309
+ x̆: 'x',
310
+ Ŷ: 'Y',
311
+ ŷ: 'y',
312
+ Ÿ: 'Y',
313
+ Y̆: 'Y',
314
+ y̆: 'y',
315
+ Ź: 'Z',
316
+ ź: 'z',
317
+ Ż: 'Z',
318
+ ż: 'z',
319
+ Ž: 'Z',
320
+ ž: 'z',
321
+ ſ: 's',
322
+ ƒ: 'f',
323
+ Ơ: 'O',
324
+ ơ: 'o',
325
+ Ư: 'U',
326
+ ư: 'u',
327
+ Ǎ: 'A',
328
+ ǎ: 'a',
329
+ Ǐ: 'I',
330
+ ǐ: 'i',
331
+ Ǒ: 'O',
332
+ ǒ: 'o',
333
+ Ǔ: 'U',
334
+ ǔ: 'u',
335
+ Ǖ: 'U',
336
+ ǖ: 'u',
337
+ Ǘ: 'U',
338
+ ǘ: 'u',
339
+ Ǚ: 'U',
340
+ ǚ: 'u',
341
+ Ǜ: 'U',
342
+ ǜ: 'u',
343
+ Ứ: 'U',
344
+ ứ: 'u',
345
+ Ṹ: 'U',
346
+ ṹ: 'u',
347
+ Ǻ: 'A',
348
+ ǻ: 'a',
349
+ Ǽ: 'AE',
350
+ ǽ: 'ae',
351
+ Ǿ: 'O',
352
+ ǿ: 'o',
353
+ Þ: 'TH',
354
+ þ: 'th',
355
+ Ṕ: 'P',
356
+ ṕ: 'p',
357
+ Ṥ: 'S',
358
+ ṥ: 's',
359
+ X́: 'X',
360
+ x́: 'x',
361
+ Ѓ: 'Г',
362
+ ѓ: 'г',
363
+ Ќ: 'К',
364
+ ќ: 'к',
365
+ A̋: 'A',
366
+ a̋: 'a',
367
+ E̋: 'E',
368
+ e̋: 'e',
369
+ I̋: 'I',
370
+ i̋: 'i',
371
+ Ǹ: 'N',
372
+ ǹ: 'n',
373
+ Ồ: 'O',
374
+ ồ: 'o',
375
+ Ṑ: 'O',
376
+ ṑ: 'o',
377
+ Ừ: 'U',
378
+ ừ: 'u',
379
+ Ẁ: 'W',
380
+ ẁ: 'w',
381
+ Ỳ: 'Y',
382
+ ỳ: 'y',
383
+ Ȁ: 'A',
384
+ ȁ: 'a',
385
+ Ȅ: 'E',
386
+ ȅ: 'e',
387
+ Ȉ: 'I',
388
+ ȉ: 'i',
389
+ Ȍ: 'O',
390
+ ȍ: 'o',
391
+ Ȑ: 'R',
392
+ ȑ: 'r',
393
+ Ȕ: 'U',
394
+ ȕ: 'u',
395
+ B̌: 'B',
396
+ b̌: 'b',
397
+ Č̣: 'C',
398
+ č̣: 'c',
399
+ Ê̌: 'E',
400
+ ê̌: 'e',
401
+ F̌: 'F',
402
+ f̌: 'f',
403
+ Ǧ: 'G',
404
+ ǧ: 'g',
405
+ Ȟ: 'H',
406
+ ȟ: 'h',
407
+ J̌: 'J',
408
+ ǰ: 'j',
409
+ Ǩ: 'K',
410
+ ǩ: 'k',
411
+ M̌: 'M',
412
+ m̌: 'm',
413
+ P̌: 'P',
414
+ p̌: 'p',
415
+ Q̌: 'Q',
416
+ q̌: 'q',
417
+ Ř̩: 'R',
418
+ ř̩: 'r',
419
+ Ṧ: 'S',
420
+ ṧ: 's',
421
+ V̌: 'V',
422
+ v̌: 'v',
423
+ W̌: 'W',
424
+ w̌: 'w',
425
+ X̌: 'X',
426
+ x̌: 'x',
427
+ Y̌: 'Y',
428
+ y̌: 'y',
429
+ A̧: 'A',
430
+ a̧: 'a',
431
+ B̧: 'B',
432
+ b̧: 'b',
433
+ Ḑ: 'D',
434
+ ḑ: 'd',
435
+ Ȩ: 'E',
436
+ ȩ: 'e',
437
+ Ɛ̧: 'E',
438
+ ɛ̧: 'e',
439
+ Ḩ: 'H',
440
+ ḩ: 'h',
441
+ I̧: 'I',
442
+ i̧: 'i',
443
+ Ɨ̧: 'I',
444
+ ɨ̧: 'i',
445
+ M̧: 'M',
446
+ m̧: 'm',
447
+ O̧: 'O',
448
+ o̧: 'o',
449
+ Q̧: 'Q',
450
+ q̧: 'q',
451
+ U̧: 'U',
452
+ u̧: 'u',
453
+ X̧: 'X',
454
+ x̧: 'x',
455
+ Z̧: 'Z',
456
+ z̧: 'z'
457
+ };
458
+ const chars = Object.keys(characterMap).join('|');
459
+ const allAccents = new RegExp(chars, 'g');
460
+ function removeAccents(str) {
461
+ return str.replace(allAccents, match => {
462
+ return characterMap[match];
463
+ });
464
+ }
465
+
466
+ /**
467
+ * @name match-sorter
468
+ * @license MIT license.
469
+ * @copyright (c) 2099 Kent C. Dodds
470
+ * @author Kent C. Dodds <me@kentcdodds.com> (https://kentcdodds.com)
471
+ */
472
+ const rankings = {
473
+ CASE_SENSITIVE_EQUAL: 7,
474
+ EQUAL: 6,
475
+ STARTS_WITH: 5,
476
+ WORD_STARTS_WITH: 4,
477
+ CONTAINS: 3,
478
+ ACRONYM: 2,
479
+ MATCHES: 1,
480
+ NO_MATCH: 0
481
+ };
482
+ /**
483
+ * Gets the highest ranking for value for the given item based on its values for the given keys
484
+ * @param {*} item - the item to rank
485
+ * @param {Array} keys - the keys to get values from the item for the ranking
486
+ * @param {String} value - the value to rank against
487
+ * @param {Object} options - options to control the ranking
488
+ * @return {{rank: Number, accessorIndex: Number, accessorThreshold: Number}} - the highest ranking
489
+ */
490
+ function rankItem(item, value, options) {
491
+ var _options$threshold;
492
+ options = options || {};
493
+ options.threshold = (_options$threshold = options.threshold) != null ? _options$threshold : rankings.MATCHES;
494
+ if (!options.accessors) {
495
+ // if keys is not specified, then we assume the item given is ready to be matched
496
+ const rank = getMatchRanking(item, value, options);
497
+ return {
498
+ // ends up being duplicate of 'item' in matches but consistent
499
+ rankedValue: item,
500
+ rank,
501
+ accessorIndex: -1,
502
+ accessorThreshold: options.threshold,
503
+ passed: rank >= options.threshold
504
+ };
505
+ }
506
+ const valuesToRank = getAllValuesToRank(item, options.accessors);
507
+ const rankingInfo = {
508
+ rankedValue: item,
509
+ rank: rankings.NO_MATCH,
510
+ accessorIndex: -1,
511
+ accessorThreshold: options.threshold,
512
+ passed: false
513
+ };
514
+ for (let i = 0; i < valuesToRank.length; i++) {
515
+ const rankValue = valuesToRank[i];
516
+ let newRank = getMatchRanking(rankValue.itemValue, value, options);
517
+ const {
518
+ minRanking,
519
+ maxRanking,
520
+ threshold = options.threshold
521
+ } = rankValue.attributes;
522
+ if (newRank < minRanking && newRank >= rankings.MATCHES) {
523
+ newRank = minRanking;
524
+ } else if (newRank > maxRanking) {
525
+ newRank = maxRanking;
526
+ }
527
+ newRank = Math.min(newRank, maxRanking);
528
+ if (newRank >= threshold && newRank > rankingInfo.rank) {
529
+ rankingInfo.rank = newRank;
530
+ rankingInfo.passed = true;
531
+ rankingInfo.accessorIndex = i;
532
+ rankingInfo.accessorThreshold = threshold;
533
+ rankingInfo.rankedValue = rankValue.itemValue;
534
+ }
535
+ }
536
+ return rankingInfo;
537
+ }
538
+
539
+ /**
540
+ * Gives a rankings score based on how well the two strings match.
541
+ * @param {String} testString - the string to test against
542
+ * @param {String} stringToRank - the string to rank
543
+ * @param {Object} options - options for the match (like keepDiacritics for comparison)
544
+ * @returns {Number} the ranking for how well stringToRank matches testString
545
+ */
546
+ function getMatchRanking(testString, stringToRank, options) {
547
+ testString = prepareValueForComparison(testString, options);
548
+ stringToRank = prepareValueForComparison(stringToRank, options);
549
+
550
+ // too long
551
+ if (stringToRank.length > testString.length) {
552
+ return rankings.NO_MATCH;
553
+ }
554
+
555
+ // case sensitive equals
556
+ if (testString === stringToRank) {
557
+ return rankings.CASE_SENSITIVE_EQUAL;
558
+ }
559
+
560
+ // Lower casing before further comparison
561
+ testString = testString.toLowerCase();
562
+ stringToRank = stringToRank.toLowerCase();
563
+
564
+ // case insensitive equals
565
+ if (testString === stringToRank) {
566
+ return rankings.EQUAL;
567
+ }
568
+
569
+ // starts with
570
+ if (testString.startsWith(stringToRank)) {
571
+ return rankings.STARTS_WITH;
572
+ }
573
+
574
+ // word starts with
575
+ if (testString.includes(` ${stringToRank}`)) {
576
+ return rankings.WORD_STARTS_WITH;
577
+ }
578
+
579
+ // contains
580
+ if (testString.includes(stringToRank)) {
581
+ return rankings.CONTAINS;
582
+ } else if (stringToRank.length === 1) {
583
+ // If the only character in the given stringToRank
584
+ // isn't even contained in the testString, then
585
+ // it's definitely not a match.
586
+ return rankings.NO_MATCH;
587
+ }
588
+
589
+ // acronym
590
+ if (getAcronym(testString).includes(stringToRank)) {
591
+ return rankings.ACRONYM;
592
+ }
593
+
594
+ // will return a number between rankings.MATCHES and
595
+ // rankings.MATCHES + 1 depending on how close of a match it is.
596
+ return getClosenessRanking(testString, stringToRank);
597
+ }
598
+
599
+ /**
600
+ * Generates an acronym for a string.
601
+ *
602
+ * @param {String} string the string for which to produce the acronym
603
+ * @returns {String} the acronym
604
+ */
605
+ function getAcronym(string) {
606
+ let acronym = '';
607
+ const wordsInString = string.split(' ');
608
+ wordsInString.forEach(wordInString => {
609
+ const splitByHyphenWords = wordInString.split('-');
610
+ splitByHyphenWords.forEach(splitByHyphenWord => {
611
+ acronym += splitByHyphenWord.substr(0, 1);
612
+ });
613
+ });
614
+ return acronym;
615
+ }
616
+
617
+ /**
618
+ * Returns a score based on how spread apart the
619
+ * characters from the stringToRank are within the testString.
620
+ * A number close to rankings.MATCHES represents a loose match. A number close
621
+ * to rankings.MATCHES + 1 represents a tighter match.
622
+ * @param {String} testString - the string to test against
623
+ * @param {String} stringToRank - the string to rank
624
+ * @returns {Number} the number between rankings.MATCHES and
625
+ * rankings.MATCHES + 1 for how well stringToRank matches testString
626
+ */
627
+ function getClosenessRanking(testString, stringToRank) {
628
+ let matchingInOrderCharCount = 0;
629
+ let charNumber = 0;
630
+ function findMatchingCharacter(matchChar, string, index) {
631
+ for (let j = index, J = string.length; j < J; j++) {
632
+ const stringChar = string[j];
633
+ if (stringChar === matchChar) {
634
+ matchingInOrderCharCount += 1;
635
+ return j + 1;
636
+ }
637
+ }
638
+ return -1;
639
+ }
640
+ function getRanking(spread) {
641
+ const spreadPercentage = 1 / spread;
642
+ const inOrderPercentage = matchingInOrderCharCount / stringToRank.length;
643
+ const ranking = rankings.MATCHES + inOrderPercentage * spreadPercentage;
644
+ return ranking;
645
+ }
646
+ const firstIndex = findMatchingCharacter(stringToRank[0], testString, 0);
647
+ if (firstIndex < 0) {
648
+ return rankings.NO_MATCH;
649
+ }
650
+ charNumber = firstIndex;
651
+ for (let i = 1, I = stringToRank.length; i < I; i++) {
652
+ const matchChar = stringToRank[i];
653
+ charNumber = findMatchingCharacter(matchChar, testString, charNumber);
654
+ const found = charNumber > -1;
655
+ if (!found) {
656
+ return rankings.NO_MATCH;
657
+ }
658
+ }
659
+ const spread = charNumber - firstIndex;
660
+ return getRanking(spread);
661
+ }
662
+
663
+ /**
664
+ * Prepares value for comparison by stringifying it, removing diacritics (if specified)
665
+ * @param {String} value - the value to clean
666
+ * @param {Object} options - {keepDiacritics: whether to remove diacritics}
667
+ * @return {String} the prepared value
668
+ */
669
+ function prepareValueForComparison(value, _ref) {
670
+ let {
671
+ keepDiacritics
672
+ } = _ref;
673
+ // value might not actually be a string at this point (we don't get to choose)
674
+ // so part of preparing the value for comparison is ensure that it is a string
675
+ value = `${value}`; // toString
676
+ if (!keepDiacritics) {
677
+ value = removeAccents(value);
678
+ }
679
+ return value;
680
+ }
681
+
682
+ /**
683
+ * Gets value for key in item at arbitrarily nested keypath
684
+ * @param {Object} item - the item
685
+ * @param {Object|Function} key - the potentially nested keypath or property callback
686
+ * @return {Array} - an array containing the value(s) at the nested keypath
687
+ */
688
+ function getItemValues(item, accessor) {
689
+ let accessorFn = accessor;
690
+ if (typeof accessor === 'object') {
691
+ accessorFn = accessor.accessor;
692
+ }
693
+ const value = accessorFn(item);
694
+
695
+ // because `value` can also be undefined
696
+ if (value == null) {
697
+ return [];
698
+ }
699
+ if (Array.isArray(value)) {
700
+ return value;
701
+ }
702
+ return [String(value)];
703
+ }
704
+
705
+ /**
706
+ * Gets all the values for the given keys in the given item and returns an array of those values
707
+ * @param item - the item from which the values will be retrieved
708
+ * @param keys - the keys to use to retrieve the values
709
+ * @return objects with {itemValue, attributes}
710
+ */
711
+ function getAllValuesToRank(item, accessors) {
712
+ const allValues = [];
713
+ for (let j = 0, J = accessors.length; j < J; j++) {
714
+ const accessor = accessors[j];
715
+ const attributes = getAccessorAttributes(accessor);
716
+ const itemValues = getItemValues(item, accessor);
717
+ for (let i = 0, I = itemValues.length; i < I; i++) {
718
+ allValues.push({
719
+ itemValue: itemValues[i],
720
+ attributes
721
+ });
722
+ }
723
+ }
724
+ return allValues;
725
+ }
726
+ const defaultKeyAttributes = {
727
+ maxRanking: Infinity,
728
+ minRanking: -Infinity
729
+ };
730
+ /**
731
+ * Gets all the attributes for the given accessor
732
+ * @param accessor - the accessor from which the attributes will be retrieved
733
+ * @return object containing the accessor's attributes
734
+ */
735
+ function getAccessorAttributes(accessor) {
736
+ if (typeof accessor === 'function') {
737
+ return defaultKeyAttributes;
738
+ }
739
+ return {
740
+ ...defaultKeyAttributes,
741
+ ...accessor
742
+ };
743
+ }
744
+
745
+ var shim = {exports: {}};
746
+
747
+ var useSyncExternalStoreShim_development = {};
748
+
749
+ /**
750
+ * @license React
751
+ * use-sync-external-store-shim.development.js
752
+ *
753
+ * Copyright (c) Facebook, Inc. and its affiliates.
754
+ *
755
+ * This source code is licensed under the MIT license found in the
756
+ * LICENSE file in the root directory of this source tree.
757
+ */
758
+
759
+ var hasRequiredUseSyncExternalStoreShim_development;
760
+
761
+ function requireUseSyncExternalStoreShim_development () {
762
+ if (hasRequiredUseSyncExternalStoreShim_development) return useSyncExternalStoreShim_development;
763
+ hasRequiredUseSyncExternalStoreShim_development = 1;
764
+
765
+ {
766
+ (function() {
767
+
768
+ /* global __REACT_DEVTOOLS_GLOBAL_HOOK__ */
769
+ if (
770
+ typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ !== 'undefined' &&
771
+ typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart ===
772
+ 'function'
773
+ ) {
774
+ __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart(new Error());
775
+ }
776
+ var React = React__default["default"];
777
+
778
+ var ReactSharedInternals = React.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED;
779
+
780
+ function error(format) {
781
+ {
782
+ {
783
+ for (var _len2 = arguments.length, args = new Array(_len2 > 1 ? _len2 - 1 : 0), _key2 = 1; _key2 < _len2; _key2++) {
784
+ args[_key2 - 1] = arguments[_key2];
785
+ }
786
+
787
+ printWarning('error', format, args);
788
+ }
789
+ }
790
+ }
791
+
792
+ function printWarning(level, format, args) {
793
+ // When changing this logic, you might want to also
794
+ // update consoleWithStackDev.www.js as well.
795
+ {
796
+ var ReactDebugCurrentFrame = ReactSharedInternals.ReactDebugCurrentFrame;
797
+ var stack = ReactDebugCurrentFrame.getStackAddendum();
798
+
799
+ if (stack !== '') {
800
+ format += '%s';
801
+ args = args.concat([stack]);
802
+ } // eslint-disable-next-line react-internal/safe-string-coercion
803
+
804
+
805
+ var argsWithFormat = args.map(function (item) {
806
+ return String(item);
807
+ }); // Careful: RN currently depends on this prefix
808
+
809
+ argsWithFormat.unshift('Warning: ' + format); // We intentionally don't use spread (or .apply) directly because it
810
+ // breaks IE9: https://github.com/facebook/react/issues/13610
811
+ // eslint-disable-next-line react-internal/no-production-logging
812
+
813
+ Function.prototype.apply.call(console[level], console, argsWithFormat);
814
+ }
815
+ }
816
+
817
+ /**
818
+ * inlined Object.is polyfill to avoid requiring consumers ship their own
819
+ * https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/is
820
+ */
821
+ function is(x, y) {
822
+ return x === y && (x !== 0 || 1 / x === 1 / y) || x !== x && y !== y // eslint-disable-line no-self-compare
823
+ ;
824
+ }
825
+
826
+ var objectIs = typeof Object.is === 'function' ? Object.is : is;
827
+
828
+ // dispatch for CommonJS interop named imports.
829
+
830
+ var useState = React.useState,
831
+ useEffect = React.useEffect,
832
+ useLayoutEffect = React.useLayoutEffect,
833
+ useDebugValue = React.useDebugValue;
834
+ var didWarnOld18Alpha = false;
835
+ var didWarnUncachedGetSnapshot = false; // Disclaimer: This shim breaks many of the rules of React, and only works
836
+ // because of a very particular set of implementation details and assumptions
837
+ // -- change any one of them and it will break. The most important assumption
838
+ // is that updates are always synchronous, because concurrent rendering is
839
+ // only available in versions of React that also have a built-in
840
+ // useSyncExternalStore API. And we only use this shim when the built-in API
841
+ // does not exist.
842
+ //
843
+ // Do not assume that the clever hacks used by this hook also work in general.
844
+ // The point of this shim is to replace the need for hacks by other libraries.
845
+
846
+ function useSyncExternalStore(subscribe, getSnapshot, // Note: The shim does not use getServerSnapshot, because pre-18 versions of
847
+ // React do not expose a way to check if we're hydrating. So users of the shim
848
+ // will need to track that themselves and return the correct value
849
+ // from `getSnapshot`.
850
+ getServerSnapshot) {
851
+ {
852
+ if (!didWarnOld18Alpha) {
853
+ if (React.startTransition !== undefined) {
854
+ didWarnOld18Alpha = true;
855
+
856
+ error('You are using an outdated, pre-release alpha of React 18 that ' + 'does not support useSyncExternalStore. The ' + 'use-sync-external-store shim will not work correctly. Upgrade ' + 'to a newer pre-release.');
857
+ }
858
+ }
859
+ } // Read the current snapshot from the store on every render. Again, this
860
+ // breaks the rules of React, and only works here because of specific
861
+ // implementation details, most importantly that updates are
862
+ // always synchronous.
863
+
864
+
865
+ var value = getSnapshot();
866
+
867
+ {
868
+ if (!didWarnUncachedGetSnapshot) {
869
+ var cachedValue = getSnapshot();
870
+
871
+ if (!objectIs(value, cachedValue)) {
872
+ error('The result of getSnapshot should be cached to avoid an infinite loop');
873
+
874
+ didWarnUncachedGetSnapshot = true;
875
+ }
876
+ }
877
+ } // Because updates are synchronous, we don't queue them. Instead we force a
878
+ // re-render whenever the subscribed state changes by updating an some
879
+ // arbitrary useState hook. Then, during render, we call getSnapshot to read
880
+ // the current value.
881
+ //
882
+ // Because we don't actually use the state returned by the useState hook, we
883
+ // can save a bit of memory by storing other stuff in that slot.
884
+ //
885
+ // To implement the early bailout, we need to track some things on a mutable
886
+ // object. Usually, we would put that in a useRef hook, but we can stash it in
887
+ // our useState hook instead.
888
+ //
889
+ // To force a re-render, we call forceUpdate({inst}). That works because the
890
+ // new object always fails an equality check.
891
+
892
+
893
+ var _useState = useState({
894
+ inst: {
895
+ value: value,
896
+ getSnapshot: getSnapshot
897
+ }
898
+ }),
899
+ inst = _useState[0].inst,
900
+ forceUpdate = _useState[1]; // Track the latest getSnapshot function with a ref. This needs to be updated
901
+ // in the layout phase so we can access it during the tearing check that
902
+ // happens on subscribe.
903
+
904
+
905
+ useLayoutEffect(function () {
906
+ inst.value = value;
907
+ inst.getSnapshot = getSnapshot; // Whenever getSnapshot or subscribe changes, we need to check in the
908
+ // commit phase if there was an interleaved mutation. In concurrent mode
909
+ // this can happen all the time, but even in synchronous mode, an earlier
910
+ // effect may have mutated the store.
911
+
912
+ if (checkIfSnapshotChanged(inst)) {
913
+ // Force a re-render.
914
+ forceUpdate({
915
+ inst: inst
916
+ });
917
+ }
918
+ }, [subscribe, value, getSnapshot]);
919
+ useEffect(function () {
920
+ // Check for changes right before subscribing. Subsequent changes will be
921
+ // detected in the subscription handler.
922
+ if (checkIfSnapshotChanged(inst)) {
923
+ // Force a re-render.
924
+ forceUpdate({
925
+ inst: inst
926
+ });
927
+ }
928
+
929
+ var handleStoreChange = function () {
930
+ // TODO: Because there is no cross-renderer API for batching updates, it's
931
+ // up to the consumer of this library to wrap their subscription event
932
+ // with unstable_batchedUpdates. Should we try to detect when this isn't
933
+ // the case and print a warning in development?
934
+ // The store changed. Check if the snapshot changed since the last time we
935
+ // read from the store.
936
+ if (checkIfSnapshotChanged(inst)) {
937
+ // Force a re-render.
938
+ forceUpdate({
939
+ inst: inst
940
+ });
941
+ }
942
+ }; // Subscribe to the store and return a clean-up function.
943
+
944
+
945
+ return subscribe(handleStoreChange);
946
+ }, [subscribe]);
947
+ useDebugValue(value);
948
+ return value;
949
+ }
950
+
951
+ function checkIfSnapshotChanged(inst) {
952
+ var latestGetSnapshot = inst.getSnapshot;
953
+ var prevValue = inst.value;
954
+
955
+ try {
956
+ var nextValue = latestGetSnapshot();
957
+ return !objectIs(prevValue, nextValue);
958
+ } catch (error) {
959
+ return true;
960
+ }
961
+ }
962
+
963
+ function useSyncExternalStore$1(subscribe, getSnapshot, getServerSnapshot) {
964
+ // Note: The shim does not use getServerSnapshot, because pre-18 versions of
965
+ // React do not expose a way to check if we're hydrating. So users of the shim
966
+ // will need to track that themselves and return the correct value
967
+ // from `getSnapshot`.
968
+ return getSnapshot();
969
+ }
970
+
971
+ var canUseDOM = !!(typeof window !== 'undefined' && typeof window.document !== 'undefined' && typeof window.document.createElement !== 'undefined');
972
+
973
+ var isServerEnvironment = !canUseDOM;
974
+
975
+ var shim = isServerEnvironment ? useSyncExternalStore$1 : useSyncExternalStore;
976
+ var useSyncExternalStore$2 = React.useSyncExternalStore !== undefined ? React.useSyncExternalStore : shim;
977
+
978
+ useSyncExternalStoreShim_development.useSyncExternalStore = useSyncExternalStore$2;
979
+ /* global __REACT_DEVTOOLS_GLOBAL_HOOK__ */
980
+ if (
981
+ typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ !== 'undefined' &&
982
+ typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop ===
983
+ 'function'
984
+ ) {
985
+ __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop(new Error());
986
+ }
987
+
988
+ })();
989
+ }
990
+ return useSyncExternalStoreShim_development;
991
+ }
992
+
993
+ (function (module) {
994
+
995
+ {
996
+ module.exports = requireUseSyncExternalStoreShim_development();
997
+ }
998
+ } (shim));
999
+
1000
+ const getItem = key => {
1001
+ try {
1002
+ const itemValue = localStorage.getItem(key);
1003
+
1004
+ if (typeof itemValue === 'string') {
1005
+ return JSON.parse(itemValue);
1006
+ }
1007
+
1008
+ return undefined;
1009
+ } catch {
1010
+ return undefined;
1011
+ }
1012
+ };
1013
+
1014
+ function useLocalStorage(key, defaultValue) {
1015
+ const [value, setValue] = React__namespace.useState();
1016
+ React__namespace.useEffect(() => {
1017
+ const initialValue = getItem(key);
1018
+
1019
+ if (typeof initialValue === 'undefined' || initialValue === null) {
1020
+ setValue(typeof defaultValue === 'function' ? defaultValue() : defaultValue);
1021
+ } else {
1022
+ setValue(initialValue);
1023
+ }
1024
+ }, [defaultValue, key]);
1025
+ const setter = React__namespace.useCallback(updater => {
1026
+ setValue(old => {
1027
+ let newVal = updater;
1028
+
1029
+ if (typeof updater == 'function') {
1030
+ newVal = updater(old);
1031
+ }
1032
+
1033
+ try {
1034
+ localStorage.setItem(key, JSON.stringify(newVal));
1035
+ } catch {}
1036
+
1037
+ return newVal;
1038
+ });
1039
+ }, [key]);
1040
+ return [value, setter];
1041
+ }
1042
+
1043
+ var DoubleIndexedKV = /** @class */ (function () {
1044
+ function DoubleIndexedKV() {
1045
+ this.keyToValue = new Map();
1046
+ this.valueToKey = new Map();
1047
+ }
1048
+ DoubleIndexedKV.prototype.set = function (key, value) {
1049
+ this.keyToValue.set(key, value);
1050
+ this.valueToKey.set(value, key);
1051
+ };
1052
+ DoubleIndexedKV.prototype.getByKey = function (key) {
1053
+ return this.keyToValue.get(key);
1054
+ };
1055
+ DoubleIndexedKV.prototype.getByValue = function (value) {
1056
+ return this.valueToKey.get(value);
1057
+ };
1058
+ DoubleIndexedKV.prototype.clear = function () {
1059
+ this.keyToValue.clear();
1060
+ this.valueToKey.clear();
1061
+ };
1062
+ return DoubleIndexedKV;
1063
+ }());
1064
+
1065
+ var Registry = /** @class */ (function () {
1066
+ function Registry(generateIdentifier) {
1067
+ this.generateIdentifier = generateIdentifier;
1068
+ this.kv = new DoubleIndexedKV();
1069
+ }
1070
+ Registry.prototype.register = function (value, identifier) {
1071
+ if (this.kv.getByValue(value)) {
1072
+ return;
1073
+ }
1074
+ if (!identifier) {
1075
+ identifier = this.generateIdentifier(value);
1076
+ }
1077
+ {
1078
+ var alreadyRegistered = this.kv.getByKey(identifier);
1079
+ if (alreadyRegistered && alreadyRegistered !== value) {
1080
+ console.debug("Ambiguous class \"" + identifier + "\", provide a unique identifier.");
1081
+ }
1082
+ }
1083
+ this.kv.set(identifier, value);
1084
+ };
1085
+ Registry.prototype.clear = function () {
1086
+ this.kv.clear();
1087
+ };
1088
+ Registry.prototype.getIdentifier = function (value) {
1089
+ return this.kv.getByValue(value);
1090
+ };
1091
+ Registry.prototype.getValue = function (identifier) {
1092
+ return this.kv.getByKey(identifier);
1093
+ };
1094
+ return Registry;
1095
+ }());
1096
+
1097
+ var __extends = (undefined && undefined.__extends) || (function () {
1098
+ var extendStatics = function (d, b) {
1099
+ extendStatics = Object.setPrototypeOf ||
1100
+ ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
1101
+ function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
1102
+ return extendStatics(d, b);
1103
+ };
1104
+ return function (d, b) {
1105
+ if (typeof b !== "function" && b !== null)
1106
+ throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
1107
+ extendStatics(d, b);
1108
+ function __() { this.constructor = d; }
1109
+ d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
1110
+ };
1111
+ })();
1112
+ var _ClassRegistry = /** @class */ (function (_super) {
1113
+ __extends(_ClassRegistry, _super);
1114
+ function _ClassRegistry() {
1115
+ var _this = _super.call(this, function (c) { return c.name; }) || this;
1116
+ _this.classToAllowedProps = new Map();
1117
+ return _this;
1118
+ }
1119
+ _ClassRegistry.prototype.register = function (value, options) {
1120
+ if (typeof options === 'object') {
1121
+ if (options.allowProps) {
1122
+ this.classToAllowedProps.set(value, options.allowProps);
1123
+ }
1124
+ _super.prototype.register.call(this, value, options.identifier);
1125
+ }
1126
+ else {
1127
+ _super.prototype.register.call(this, value, options);
1128
+ }
1129
+ };
1130
+ _ClassRegistry.prototype.getAllowedProps = function (value) {
1131
+ return this.classToAllowedProps.get(value);
1132
+ };
1133
+ return _ClassRegistry;
1134
+ }(Registry));
1135
+ var ClassRegistry = new _ClassRegistry();
1136
+
1137
+ var SymbolRegistry = new Registry(function (s) { var _a; return (_a = s.description) !== null && _a !== void 0 ? _a : ''; });
1138
+
1139
+ var __read$3 = (undefined && undefined.__read) || function (o, n) {
1140
+ var m = typeof Symbol === "function" && o[Symbol.iterator];
1141
+ if (!m) return o;
1142
+ var i = m.call(o), r, ar = [], e;
1143
+ try {
1144
+ while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);
1145
+ }
1146
+ catch (error) { e = { error: error }; }
1147
+ finally {
1148
+ try {
1149
+ if (r && !r.done && (m = i["return"])) m.call(i);
1150
+ }
1151
+ finally { if (e) throw e.error; }
1152
+ }
1153
+ return ar;
1154
+ };
1155
+ function valuesOfObj(record) {
1156
+ if ('values' in Object) {
1157
+ // eslint-disable-next-line es5/no-es6-methods
1158
+ return Object.values(record);
1159
+ }
1160
+ var values = [];
1161
+ // eslint-disable-next-line no-restricted-syntax
1162
+ for (var key in record) {
1163
+ if (record.hasOwnProperty(key)) {
1164
+ values.push(record[key]);
1165
+ }
1166
+ }
1167
+ return values;
1168
+ }
1169
+ function find(record, predicate) {
1170
+ var values = valuesOfObj(record);
1171
+ if ('find' in values) {
1172
+ // eslint-disable-next-line es5/no-es6-methods
1173
+ return values.find(predicate);
1174
+ }
1175
+ var valuesNotNever = values;
1176
+ for (var i = 0; i < valuesNotNever.length; i++) {
1177
+ var value = valuesNotNever[i];
1178
+ if (predicate(value)) {
1179
+ return value;
1180
+ }
1181
+ }
1182
+ return undefined;
1183
+ }
1184
+ function forEach(record, run) {
1185
+ Object.entries(record).forEach(function (_a) {
1186
+ var _b = __read$3(_a, 2), key = _b[0], value = _b[1];
1187
+ return run(value, key);
1188
+ });
1189
+ }
1190
+ function includes(arr, value) {
1191
+ return arr.indexOf(value) !== -1;
1192
+ }
1193
+ function findArr(record, predicate) {
1194
+ for (var i = 0; i < record.length; i++) {
1195
+ var value = record[i];
1196
+ if (predicate(value)) {
1197
+ return value;
1198
+ }
1199
+ }
1200
+ return undefined;
1201
+ }
1202
+
1203
+ var transfomers = {};
1204
+ var CustomTransformerRegistry = {
1205
+ register: function (transformer) {
1206
+ transfomers[transformer.name] = transformer;
1207
+ },
1208
+ findApplicable: function (v) {
1209
+ return find(transfomers, function (transformer) { return transformer.isApplicable(v); });
1210
+ },
1211
+ findByName: function (name) {
1212
+ return transfomers[name];
1213
+ }
1214
+ };
1215
+
1216
+ var __read$2 = (undefined && undefined.__read) || function (o, n) {
1217
+ var m = typeof Symbol === "function" && o[Symbol.iterator];
1218
+ if (!m) return o;
1219
+ var i = m.call(o), r, ar = [], e;
1220
+ try {
1221
+ while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);
1222
+ }
1223
+ catch (error) { e = { error: error }; }
1224
+ finally {
1225
+ try {
1226
+ if (r && !r.done && (m = i["return"])) m.call(i);
1227
+ }
1228
+ finally { if (e) throw e.error; }
1229
+ }
1230
+ return ar;
1231
+ };
1232
+ var __spreadArray$2 = (undefined && undefined.__spreadArray) || function (to, from) {
1233
+ for (var i = 0, il = from.length, j = to.length; i < il; i++, j++)
1234
+ to[j] = from[i];
1235
+ return to;
1236
+ };
1237
+ var allowedErrorProps = [];
1238
+ var allowErrorProps = function () {
1239
+ var props = [];
1240
+ for (var _i = 0; _i < arguments.length; _i++) {
1241
+ props[_i] = arguments[_i];
1242
+ }
1243
+ allowedErrorProps.push.apply(allowedErrorProps, __spreadArray$2([], __read$2(props)));
1244
+ };
1245
+
1246
+ var getType$1 = function (payload) {
1247
+ return Object.prototype.toString.call(payload).slice(8, -1);
1248
+ };
1249
+ var isUndefined = function (payload) {
1250
+ return typeof payload === 'undefined';
1251
+ };
1252
+ var isNull = function (payload) { return payload === null; };
1253
+ var isPlainObject$1 = function (payload) {
1254
+ if (getType$1(payload) !== 'Object')
1255
+ return false;
1256
+ if (Object.getPrototypeOf(payload) === null)
1257
+ return true;
1258
+ if (payload === Object.prototype)
1259
+ return false;
1260
+ return (payload.constructor === Object &&
1261
+ Object.getPrototypeOf(payload) === Object.prototype);
1262
+ };
1263
+ var isEmptyObject = function (payload) {
1264
+ return isPlainObject$1(payload) && Object.keys(payload).length === 0;
1265
+ };
1266
+ var isArray$1 = function (payload) {
1267
+ return Array.isArray(payload);
1268
+ };
1269
+ var isString = function (payload) {
1270
+ return typeof payload === 'string';
1271
+ };
1272
+ var isNumber = function (payload) {
1273
+ return typeof payload === 'number' && !isNaN(payload);
1274
+ };
1275
+ var isBoolean = function (payload) {
1276
+ return typeof payload === 'boolean';
1277
+ };
1278
+ var isRegExp = function (payload) {
1279
+ return payload instanceof RegExp;
1280
+ };
1281
+ var isMap = function (payload) {
1282
+ return payload instanceof Map;
1283
+ };
1284
+ var isSet = function (payload) {
1285
+ return payload instanceof Set;
1286
+ };
1287
+ var isSymbol = function (payload) {
1288
+ return getType$1(payload) === 'Symbol';
1289
+ };
1290
+ var isDate = function (payload) {
1291
+ return payload instanceof Date && !isNaN(payload.valueOf());
1292
+ };
1293
+ var isError = function (payload) {
1294
+ return payload instanceof Error;
1295
+ };
1296
+ var isNaNValue = function (payload) {
1297
+ return typeof payload === 'number' && isNaN(payload);
1298
+ };
1299
+ var isPrimitive = function (payload) {
1300
+ return isBoolean(payload) ||
1301
+ isNull(payload) ||
1302
+ isUndefined(payload) ||
1303
+ isNumber(payload) ||
1304
+ isString(payload) ||
1305
+ isSymbol(payload);
1306
+ };
1307
+ var isBigint = function (payload) {
1308
+ return typeof payload === 'bigint';
1309
+ };
1310
+ var isInfinite = function (payload) {
1311
+ return payload === Infinity || payload === -Infinity;
1312
+ };
1313
+ var isTypedArray = function (payload) {
1314
+ return ArrayBuffer.isView(payload) && !(payload instanceof DataView);
1315
+ };
1316
+ var isURL = function (payload) { return payload instanceof URL; };
1317
+
1318
+ var escapeKey = function (key) { return key.replace(/\./g, '\\.'); };
1319
+ var stringifyPath = function (path) {
1320
+ return path
1321
+ .map(String)
1322
+ .map(escapeKey)
1323
+ .join('.');
1324
+ };
1325
+ var parsePath = function (string) {
1326
+ var result = [];
1327
+ var segment = '';
1328
+ for (var i = 0; i < string.length; i++) {
1329
+ var char = string.charAt(i);
1330
+ var isEscapedDot = char === '\\' && string.charAt(i + 1) === '.';
1331
+ if (isEscapedDot) {
1332
+ segment += '.';
1333
+ i++;
1334
+ continue;
1335
+ }
1336
+ var isEndOfSegment = char === '.';
1337
+ if (isEndOfSegment) {
1338
+ result.push(segment);
1339
+ segment = '';
1340
+ continue;
1341
+ }
1342
+ segment += char;
1343
+ }
1344
+ var lastSegment = segment;
1345
+ result.push(lastSegment);
1346
+ return result;
1347
+ };
1348
+
1349
+ var __assign$1 = (undefined && undefined.__assign) || function () {
1350
+ __assign$1 = Object.assign || function(t) {
1351
+ for (var s, i = 1, n = arguments.length; i < n; i++) {
1352
+ s = arguments[i];
1353
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
1354
+ t[p] = s[p];
1355
+ }
1356
+ return t;
1357
+ };
1358
+ return __assign$1.apply(this, arguments);
1359
+ };
1360
+ var __read$1 = (undefined && undefined.__read) || function (o, n) {
1361
+ var m = typeof Symbol === "function" && o[Symbol.iterator];
1362
+ if (!m) return o;
1363
+ var i = m.call(o), r, ar = [], e;
1364
+ try {
1365
+ while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);
1366
+ }
1367
+ catch (error) { e = { error: error }; }
1368
+ finally {
1369
+ try {
1370
+ if (r && !r.done && (m = i["return"])) m.call(i);
1371
+ }
1372
+ finally { if (e) throw e.error; }
1373
+ }
1374
+ return ar;
1375
+ };
1376
+ var __spreadArray$1 = (undefined && undefined.__spreadArray) || function (to, from) {
1377
+ for (var i = 0, il = from.length, j = to.length; i < il; i++, j++)
1378
+ to[j] = from[i];
1379
+ return to;
1380
+ };
1381
+ function simpleTransformation(isApplicable, annotation, transform, untransform) {
1382
+ return {
1383
+ isApplicable: isApplicable,
1384
+ annotation: annotation,
1385
+ transform: transform,
1386
+ untransform: untransform
1387
+ };
1388
+ }
1389
+ var simpleRules = [
1390
+ simpleTransformation(isUndefined, 'undefined', function () { return null; }, function () { return undefined; }),
1391
+ simpleTransformation(isBigint, 'bigint', function (v) { return v.toString(); }, function (v) {
1392
+ if (typeof BigInt !== 'undefined') {
1393
+ return BigInt(v);
1394
+ }
1395
+ console.error('Please add a BigInt polyfill.');
1396
+ return v;
1397
+ }),
1398
+ simpleTransformation(isDate, 'Date', function (v) { return v.toISOString(); }, function (v) { return new Date(v); }),
1399
+ simpleTransformation(isError, 'Error', function (v) {
1400
+ var baseError = {
1401
+ name: v.name,
1402
+ message: v.message
1403
+ };
1404
+ allowedErrorProps.forEach(function (prop) {
1405
+ baseError[prop] = v[prop];
1406
+ });
1407
+ return baseError;
1408
+ }, function (v) {
1409
+ var e = new Error(v.message);
1410
+ e.name = v.name;
1411
+ e.stack = v.stack;
1412
+ allowedErrorProps.forEach(function (prop) {
1413
+ e[prop] = v[prop];
1414
+ });
1415
+ return e;
1416
+ }),
1417
+ simpleTransformation(isRegExp, 'regexp', function (v) { return '' + v; }, function (regex) {
1418
+ var body = regex.slice(1, regex.lastIndexOf('/'));
1419
+ var flags = regex.slice(regex.lastIndexOf('/') + 1);
1420
+ return new RegExp(body, flags);
1421
+ }),
1422
+ simpleTransformation(isSet, 'set',
1423
+ // (sets only exist in es6+)
1424
+ // eslint-disable-next-line es5/no-es6-methods
1425
+ function (v) { return __spreadArray$1([], __read$1(v.values())); }, function (v) { return new Set(v); }),
1426
+ simpleTransformation(isMap, 'map', function (v) { return __spreadArray$1([], __read$1(v.entries())); }, function (v) { return new Map(v); }),
1427
+ simpleTransformation(function (v) { return isNaNValue(v) || isInfinite(v); }, 'number', function (v) {
1428
+ if (isNaNValue(v)) {
1429
+ return 'NaN';
1430
+ }
1431
+ if (v > 0) {
1432
+ return 'Infinity';
1433
+ }
1434
+ else {
1435
+ return '-Infinity';
1436
+ }
1437
+ }, Number),
1438
+ simpleTransformation(function (v) { return v === 0 && 1 / v === -Infinity; }, 'number', function () {
1439
+ return '-0';
1440
+ }, Number),
1441
+ simpleTransformation(isURL, 'URL', function (v) { return v.toString(); }, function (v) { return new URL(v); }),
1442
+ ];
1443
+ function compositeTransformation(isApplicable, annotation, transform, untransform) {
1444
+ return {
1445
+ isApplicable: isApplicable,
1446
+ annotation: annotation,
1447
+ transform: transform,
1448
+ untransform: untransform
1449
+ };
1450
+ }
1451
+ var symbolRule = compositeTransformation(function (s) {
1452
+ if (isSymbol(s)) {
1453
+ var isRegistered = !!SymbolRegistry.getIdentifier(s);
1454
+ return isRegistered;
1455
+ }
1456
+ return false;
1457
+ }, function (s) {
1458
+ var identifier = SymbolRegistry.getIdentifier(s);
1459
+ return ['symbol', identifier];
1460
+ }, function (v) { return v.description; }, function (_, a) {
1461
+ var value = SymbolRegistry.getValue(a[1]);
1462
+ if (!value) {
1463
+ throw new Error('Trying to deserialize unknown symbol');
1464
+ }
1465
+ return value;
1466
+ });
1467
+ var constructorToName = [
1468
+ Int8Array,
1469
+ Uint8Array,
1470
+ Int16Array,
1471
+ Uint16Array,
1472
+ Int32Array,
1473
+ Uint32Array,
1474
+ Float32Array,
1475
+ Float64Array,
1476
+ Uint8ClampedArray,
1477
+ ].reduce(function (obj, ctor) {
1478
+ obj[ctor.name] = ctor;
1479
+ return obj;
1480
+ }, {});
1481
+ var typedArrayRule = compositeTransformation(isTypedArray, function (v) { return ['typed-array', v.constructor.name]; }, function (v) { return __spreadArray$1([], __read$1(v)); }, function (v, a) {
1482
+ var ctor = constructorToName[a[1]];
1483
+ if (!ctor) {
1484
+ throw new Error('Trying to deserialize unknown typed array');
1485
+ }
1486
+ return new ctor(v);
1487
+ });
1488
+ function isInstanceOfRegisteredClass(potentialClass) {
1489
+ if (potentialClass === null || potentialClass === void 0 ? void 0 : potentialClass.constructor) {
1490
+ var isRegistered = !!ClassRegistry.getIdentifier(potentialClass.constructor);
1491
+ return isRegistered;
1492
+ }
1493
+ return false;
1494
+ }
1495
+ var classRule = compositeTransformation(isInstanceOfRegisteredClass, function (clazz) {
1496
+ var identifier = ClassRegistry.getIdentifier(clazz.constructor);
1497
+ return ['class', identifier];
1498
+ }, function (clazz) {
1499
+ var allowedProps = ClassRegistry.getAllowedProps(clazz.constructor);
1500
+ if (!allowedProps) {
1501
+ return __assign$1({}, clazz);
1502
+ }
1503
+ var result = {};
1504
+ allowedProps.forEach(function (prop) {
1505
+ result[prop] = clazz[prop];
1506
+ });
1507
+ return result;
1508
+ }, function (v, a) {
1509
+ var clazz = ClassRegistry.getValue(a[1]);
1510
+ if (!clazz) {
1511
+ throw new Error('Trying to deserialize unknown class - check https://github.com/blitz-js/superjson/issues/116#issuecomment-773996564');
1512
+ }
1513
+ return Object.assign(Object.create(clazz.prototype), v);
1514
+ });
1515
+ var customRule = compositeTransformation(function (value) {
1516
+ return !!CustomTransformerRegistry.findApplicable(value);
1517
+ }, function (value) {
1518
+ var transformer = CustomTransformerRegistry.findApplicable(value);
1519
+ return ['custom', transformer.name];
1520
+ }, function (value) {
1521
+ var transformer = CustomTransformerRegistry.findApplicable(value);
1522
+ return transformer.serialize(value);
1523
+ }, function (v, a) {
1524
+ var transformer = CustomTransformerRegistry.findByName(a[1]);
1525
+ if (!transformer) {
1526
+ throw new Error('Trying to deserialize unknown custom value');
1527
+ }
1528
+ return transformer.deserialize(v);
1529
+ });
1530
+ var compositeRules = [classRule, symbolRule, customRule, typedArrayRule];
1531
+ var transformValue = function (value) {
1532
+ var applicableCompositeRule = findArr(compositeRules, function (rule) {
1533
+ return rule.isApplicable(value);
1534
+ });
1535
+ if (applicableCompositeRule) {
1536
+ return {
1537
+ value: applicableCompositeRule.transform(value),
1538
+ type: applicableCompositeRule.annotation(value)
1539
+ };
1540
+ }
1541
+ var applicableSimpleRule = findArr(simpleRules, function (rule) {
1542
+ return rule.isApplicable(value);
1543
+ });
1544
+ if (applicableSimpleRule) {
1545
+ return {
1546
+ value: applicableSimpleRule.transform(value),
1547
+ type: applicableSimpleRule.annotation
1548
+ };
1549
+ }
1550
+ return undefined;
1551
+ };
1552
+ var simpleRulesByAnnotation = {};
1553
+ simpleRules.forEach(function (rule) {
1554
+ simpleRulesByAnnotation[rule.annotation] = rule;
1555
+ });
1556
+ var untransformValue = function (json, type) {
1557
+ if (isArray$1(type)) {
1558
+ switch (type[0]) {
1559
+ case 'symbol':
1560
+ return symbolRule.untransform(json, type);
1561
+ case 'class':
1562
+ return classRule.untransform(json, type);
1563
+ case 'custom':
1564
+ return customRule.untransform(json, type);
1565
+ case 'typed-array':
1566
+ return typedArrayRule.untransform(json, type);
1567
+ default:
1568
+ throw new Error('Unknown transformation: ' + type);
1569
+ }
1570
+ }
1571
+ else {
1572
+ var transformation = simpleRulesByAnnotation[type];
1573
+ if (!transformation) {
1574
+ throw new Error('Unknown transformation: ' + type);
1575
+ }
1576
+ return transformation.untransform(json);
1577
+ }
1578
+ };
1579
+
1580
+ var getNthKey = function (value, n) {
1581
+ var keys = value.keys();
1582
+ while (n > 0) {
1583
+ keys.next();
1584
+ n--;
1585
+ }
1586
+ return keys.next().value;
1587
+ };
1588
+ function validatePath(path) {
1589
+ if (includes(path, '__proto__')) {
1590
+ throw new Error('__proto__ is not allowed as a property');
1591
+ }
1592
+ if (includes(path, 'prototype')) {
1593
+ throw new Error('prototype is not allowed as a property');
1594
+ }
1595
+ if (includes(path, 'constructor')) {
1596
+ throw new Error('constructor is not allowed as a property');
1597
+ }
1598
+ }
1599
+ var getDeep = function (object, path) {
1600
+ validatePath(path);
1601
+ path.forEach(function (key) {
1602
+ object = object[key];
1603
+ });
1604
+ return object;
1605
+ };
1606
+ var setDeep = function (object, path, mapper) {
1607
+ validatePath(path);
1608
+ if (path.length === 0) {
1609
+ return mapper(object);
1610
+ }
1611
+ var parent = object;
1612
+ for (var i = 0; i < path.length - 1; i++) {
1613
+ var key = path[i];
1614
+ if (isArray$1(parent)) {
1615
+ var index = +key;
1616
+ parent = parent[index];
1617
+ }
1618
+ else if (isPlainObject$1(parent)) {
1619
+ parent = parent[key];
1620
+ }
1621
+ else if (isSet(parent)) {
1622
+ var row = +key;
1623
+ parent = getNthKey(parent, row);
1624
+ }
1625
+ else if (isMap(parent)) {
1626
+ var isEnd = i === path.length - 2;
1627
+ if (isEnd) {
1628
+ break;
1629
+ }
1630
+ var row = +key;
1631
+ var type = +path[++i] === 0 ? 'key' : 'value';
1632
+ var keyOfRow = getNthKey(parent, row);
1633
+ switch (type) {
1634
+ case 'key':
1635
+ parent = keyOfRow;
1636
+ break;
1637
+ case 'value':
1638
+ parent = parent.get(keyOfRow);
1639
+ break;
1640
+ }
1641
+ }
1642
+ }
1643
+ var lastKey = path[path.length - 1];
1644
+ if (isArray$1(parent) || isPlainObject$1(parent)) {
1645
+ parent[lastKey] = mapper(parent[lastKey]);
1646
+ }
1647
+ if (isSet(parent)) {
1648
+ var oldValue = getNthKey(parent, +lastKey);
1649
+ var newValue = mapper(oldValue);
1650
+ if (oldValue !== newValue) {
1651
+ parent["delete"](oldValue);
1652
+ parent.add(newValue);
1653
+ }
1654
+ }
1655
+ if (isMap(parent)) {
1656
+ var row = +path[path.length - 2];
1657
+ var keyToRow = getNthKey(parent, row);
1658
+ var type = +lastKey === 0 ? 'key' : 'value';
1659
+ switch (type) {
1660
+ case 'key': {
1661
+ var newKey = mapper(keyToRow);
1662
+ parent.set(newKey, parent.get(keyToRow));
1663
+ if (newKey !== keyToRow) {
1664
+ parent["delete"](keyToRow);
1665
+ }
1666
+ break;
1667
+ }
1668
+ case 'value': {
1669
+ parent.set(keyToRow, mapper(parent.get(keyToRow)));
1670
+ break;
1671
+ }
1672
+ }
1673
+ }
1674
+ return object;
1675
+ };
1676
+
1677
+ var __read = (undefined && undefined.__read) || function (o, n) {
1678
+ var m = typeof Symbol === "function" && o[Symbol.iterator];
1679
+ if (!m) return o;
1680
+ var i = m.call(o), r, ar = [], e;
1681
+ try {
1682
+ while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);
1683
+ }
1684
+ catch (error) { e = { error: error }; }
1685
+ finally {
1686
+ try {
1687
+ if (r && !r.done && (m = i["return"])) m.call(i);
1688
+ }
1689
+ finally { if (e) throw e.error; }
1690
+ }
1691
+ return ar;
1692
+ };
1693
+ var __spreadArray = (undefined && undefined.__spreadArray) || function (to, from) {
1694
+ for (var i = 0, il = from.length, j = to.length; i < il; i++, j++)
1695
+ to[j] = from[i];
1696
+ return to;
1697
+ };
1698
+ function traverse(tree, walker, origin) {
1699
+ if (origin === void 0) { origin = []; }
1700
+ if (!tree) {
1701
+ return;
1702
+ }
1703
+ if (!isArray$1(tree)) {
1704
+ forEach(tree, function (subtree, key) {
1705
+ return traverse(subtree, walker, __spreadArray(__spreadArray([], __read(origin)), __read(parsePath(key))));
1706
+ });
1707
+ return;
1708
+ }
1709
+ var _a = __read(tree, 2), nodeValue = _a[0], children = _a[1];
1710
+ if (children) {
1711
+ forEach(children, function (child, key) {
1712
+ traverse(child, walker, __spreadArray(__spreadArray([], __read(origin)), __read(parsePath(key))));
1713
+ });
1714
+ }
1715
+ walker(nodeValue, origin);
1716
+ }
1717
+ function applyValueAnnotations(plain, annotations) {
1718
+ traverse(annotations, function (type, path) {
1719
+ plain = setDeep(plain, path, function (v) { return untransformValue(v, type); });
1720
+ });
1721
+ return plain;
1722
+ }
1723
+ function applyReferentialEqualityAnnotations(plain, annotations) {
1724
+ function apply(identicalPaths, path) {
1725
+ var object = getDeep(plain, parsePath(path));
1726
+ identicalPaths.map(parsePath).forEach(function (identicalObjectPath) {
1727
+ plain = setDeep(plain, identicalObjectPath, function () { return object; });
1728
+ });
1729
+ }
1730
+ if (isArray$1(annotations)) {
1731
+ var _a = __read(annotations, 2), root = _a[0], other = _a[1];
1732
+ root.forEach(function (identicalPath) {
1733
+ plain = setDeep(plain, parsePath(identicalPath), function () { return plain; });
1734
+ });
1735
+ if (other) {
1736
+ forEach(other, apply);
1737
+ }
1738
+ }
1739
+ else {
1740
+ forEach(annotations, apply);
1741
+ }
1742
+ return plain;
1743
+ }
1744
+ var isDeep = function (object) {
1745
+ return isPlainObject$1(object) ||
1746
+ isArray$1(object) ||
1747
+ isMap(object) ||
1748
+ isSet(object) ||
1749
+ isInstanceOfRegisteredClass(object);
1750
+ };
1751
+ function addIdentity(object, path, identities) {
1752
+ var existingSet = identities.get(object);
1753
+ if (existingSet) {
1754
+ existingSet.push(path);
1755
+ }
1756
+ else {
1757
+ identities.set(object, [path]);
1758
+ }
1759
+ }
1760
+ function generateReferentialEqualityAnnotations(identitites) {
1761
+ var result = {};
1762
+ var rootEqualityPaths = undefined;
1763
+ identitites.forEach(function (paths) {
1764
+ if (paths.length <= 1) {
1765
+ return;
1766
+ }
1767
+ var _a = __read(paths
1768
+ .map(function (path) { return path.map(String); })
1769
+ .sort(function (a, b) { return a.length - b.length; })), shortestPath = _a[0], identicalPaths = _a.slice(1);
1770
+ if (shortestPath.length === 0) {
1771
+ rootEqualityPaths = identicalPaths.map(stringifyPath);
1772
+ }
1773
+ else {
1774
+ result[stringifyPath(shortestPath)] = identicalPaths.map(stringifyPath);
1775
+ }
1776
+ });
1777
+ if (rootEqualityPaths) {
1778
+ if (isEmptyObject(result)) {
1779
+ return [rootEqualityPaths];
1780
+ }
1781
+ else {
1782
+ return [rootEqualityPaths, result];
1783
+ }
1784
+ }
1785
+ else {
1786
+ return isEmptyObject(result) ? undefined : result;
1787
+ }
1788
+ }
1789
+ var walker = function (object, identities, path, objectsInThisPath) {
1790
+ var _a;
1791
+ if (path === void 0) { path = []; }
1792
+ if (objectsInThisPath === void 0) { objectsInThisPath = []; }
1793
+ if (!isPrimitive(object)) {
1794
+ addIdentity(object, path, identities);
1795
+ }
1796
+ if (!isDeep(object)) {
1797
+ var transformed_1 = transformValue(object);
1798
+ if (transformed_1) {
1799
+ return {
1800
+ transformedValue: transformed_1.value,
1801
+ annotations: [transformed_1.type]
1802
+ };
1803
+ }
1804
+ else {
1805
+ return {
1806
+ transformedValue: object
1807
+ };
1808
+ }
1809
+ }
1810
+ if (includes(objectsInThisPath, object)) {
1811
+ return {
1812
+ transformedValue: null
1813
+ };
1814
+ }
1815
+ var transformationResult = transformValue(object);
1816
+ var transformed = (_a = transformationResult === null || transformationResult === void 0 ? void 0 : transformationResult.value) !== null && _a !== void 0 ? _a : object;
1817
+ if (!isPrimitive(object)) {
1818
+ objectsInThisPath = __spreadArray(__spreadArray([], __read(objectsInThisPath)), [object]);
1819
+ }
1820
+ var transformedValue = isArray$1(transformed) ? [] : {};
1821
+ var innerAnnotations = {};
1822
+ forEach(transformed, function (value, index) {
1823
+ var recursiveResult = walker(value, identities, __spreadArray(__spreadArray([], __read(path)), [index]), objectsInThisPath);
1824
+ transformedValue[index] = recursiveResult.transformedValue;
1825
+ if (isArray$1(recursiveResult.annotations)) {
1826
+ innerAnnotations[index] = recursiveResult.annotations;
1827
+ }
1828
+ else if (isPlainObject$1(recursiveResult.annotations)) {
1829
+ forEach(recursiveResult.annotations, function (tree, key) {
1830
+ innerAnnotations[escapeKey(index) + '.' + key] = tree;
1831
+ });
1832
+ }
1833
+ });
1834
+ if (isEmptyObject(innerAnnotations)) {
1835
+ return {
1836
+ transformedValue: transformedValue,
1837
+ annotations: !!transformationResult
1838
+ ? [transformationResult.type]
1839
+ : undefined
1840
+ };
1841
+ }
1842
+ else {
1843
+ return {
1844
+ transformedValue: transformedValue,
1845
+ annotations: !!transformationResult
1846
+ ? [transformationResult.type, innerAnnotations]
1847
+ : innerAnnotations
1848
+ };
1849
+ }
1850
+ };
1851
+
1852
+ /**
1853
+ * Returns the object type of the given payload
1854
+ *
1855
+ * @param {*} payload
1856
+ * @returns {string}
1857
+ */
1858
+ function getType(payload) {
1859
+ return Object.prototype.toString.call(payload).slice(8, -1);
1860
+ }
1861
+ /**
1862
+ * Returns whether the payload is a plain JavaScript object (excluding special classes or objects with other prototypes)
1863
+ *
1864
+ * @param {*} payload
1865
+ * @returns {payload is PlainObject}
1866
+ */
1867
+ function isPlainObject(payload) {
1868
+ if (getType(payload) !== 'Object')
1869
+ return false;
1870
+ return payload.constructor === Object && Object.getPrototypeOf(payload) === Object.prototype;
1871
+ }
1872
+ /**
1873
+ * Returns whether the payload is an array
1874
+ *
1875
+ * @param {any} payload
1876
+ * @returns {payload is any[]}
1877
+ */
1878
+ function isArray(payload) {
1879
+ return getType(payload) === 'Array';
1880
+ }
1881
+
1882
+ function assignProp(carry, key, newVal, originalObject, includeNonenumerable) {
1883
+ const propType = {}.propertyIsEnumerable.call(originalObject, key)
1884
+ ? 'enumerable'
1885
+ : 'nonenumerable';
1886
+ if (propType === 'enumerable')
1887
+ carry[key] = newVal;
1888
+ if (includeNonenumerable && propType === 'nonenumerable') {
1889
+ Object.defineProperty(carry, key, {
1890
+ value: newVal,
1891
+ enumerable: false,
1892
+ writable: true,
1893
+ configurable: true,
1894
+ });
1895
+ }
1896
+ }
1897
+ /**
1898
+ * 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.
1899
+ *
1900
+ * @export
1901
+ * @template T
1902
+ * @param {T} target Target can be anything
1903
+ * @param {Options} [options = {}] Options can be `props` or `nonenumerable`
1904
+ * @returns {T} the target with replaced values
1905
+ * @export
1906
+ */
1907
+ function copy(target, options = {}) {
1908
+ if (isArray(target)) {
1909
+ return target.map((item) => copy(item, options));
1910
+ }
1911
+ if (!isPlainObject(target)) {
1912
+ return target;
1913
+ }
1914
+ const props = Object.getOwnPropertyNames(target);
1915
+ const symbols = Object.getOwnPropertySymbols(target);
1916
+ return [...props, ...symbols].reduce((carry, key) => {
1917
+ if (isArray(options.props) && !options.props.includes(key)) {
1918
+ return carry;
1919
+ }
1920
+ const val = target[key];
1921
+ const newVal = copy(val, options);
1922
+ assignProp(carry, key, newVal, target, options.nonenumerable);
1923
+ return carry;
1924
+ }, {});
1925
+ }
1926
+
1927
+ var __assign = (undefined && undefined.__assign) || function () {
1928
+ __assign = Object.assign || function(t) {
1929
+ for (var s, i = 1, n = arguments.length; i < n; i++) {
1930
+ s = arguments[i];
1931
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
1932
+ t[p] = s[p];
1933
+ }
1934
+ return t;
1935
+ };
1936
+ return __assign.apply(this, arguments);
1937
+ };
1938
+ var serialize = function (object) {
1939
+ var identities = new Map();
1940
+ var output = walker(object, identities);
1941
+ var res = {
1942
+ json: output.transformedValue
1943
+ };
1944
+ if (output.annotations) {
1945
+ res.meta = __assign(__assign({}, res.meta), { values: output.annotations });
1946
+ }
1947
+ var equalityAnnotations = generateReferentialEqualityAnnotations(identities);
1948
+ if (equalityAnnotations) {
1949
+ res.meta = __assign(__assign({}, res.meta), { referentialEqualities: equalityAnnotations });
1950
+ }
1951
+ return res;
1952
+ };
1953
+ var deserialize = function (payload) {
1954
+ var json = payload.json, meta = payload.meta;
1955
+ var result = copy(json);
1956
+ if (meta === null || meta === void 0 ? void 0 : meta.values) {
1957
+ result = applyValueAnnotations(result, meta.values);
1958
+ }
1959
+ if (meta === null || meta === void 0 ? void 0 : meta.referentialEqualities) {
1960
+ result = applyReferentialEqualityAnnotations(result, meta.referentialEqualities);
1961
+ }
1962
+ return result;
1963
+ };
1964
+ var stringify = function (object) {
1965
+ return JSON.stringify(serialize(object));
1966
+ };
1967
+ var parse = function (string) {
1968
+ return deserialize(JSON.parse(string));
1969
+ };
1970
+ var registerClass = function (v, options) {
1971
+ return ClassRegistry.register(v, options);
1972
+ };
1973
+ var registerSymbol = function (v, identifier) {
1974
+ return SymbolRegistry.register(v, identifier);
1975
+ };
1976
+ var registerCustom = function (transformer, name) {
1977
+ return CustomTransformerRegistry.register(__assign({ name: name }, transformer));
1978
+ };
1979
+ var superjson = {
1980
+ stringify: stringify,
1981
+ parse: parse,
1982
+ serialize: serialize,
1983
+ deserialize: deserialize,
1984
+ registerClass: registerClass,
1985
+ registerSymbol: registerSymbol,
1986
+ registerCustom: registerCustom,
1987
+ allowErrorProps: allowErrorProps
1988
+ };
1989
+
1990
+ const defaultTheme = {
1991
+ background: '#0b1521',
1992
+ backgroundAlt: '#132337',
1993
+ foreground: 'white',
1994
+ gray: '#3f4e60',
1995
+ grayAlt: '#222e3e',
1996
+ inputBackgroundColor: '#fff',
1997
+ inputTextColor: '#000',
1998
+ success: '#00ab52',
1999
+ danger: '#ff0085',
2000
+ active: '#006bff',
2001
+ paused: '#8c49eb',
2002
+ warning: '#ffb200'
2003
+ };
2004
+ const ThemeContext = /*#__PURE__*/React__namespace.createContext(defaultTheme);
2005
+ function ThemeProvider({
2006
+ theme,
2007
+ ...rest
2008
+ }) {
2009
+ return /*#__PURE__*/React__namespace.createElement(ThemeContext.Provider, _extends({
2010
+ value: theme
2011
+ }, rest));
2012
+ }
2013
+ function useTheme() {
2014
+ return React__namespace.useContext(ThemeContext);
2015
+ }
2016
+
2017
+ function useMediaQuery(query) {
2018
+ // Keep track of the preference in state, start with the current match
2019
+ const [isMatch, setIsMatch] = React__namespace.useState(() => {
2020
+ if (typeof window !== 'undefined') {
2021
+ return window.matchMedia(query).matches;
2022
+ }
2023
+
2024
+ return;
2025
+ }); // Watch for changes
2026
+
2027
+ React__namespace.useEffect(() => {
2028
+ if (typeof window !== 'undefined') {
2029
+ // Create a matcher
2030
+ const matcher = window.matchMedia(query); // Create our handler
2031
+
2032
+ const onChange = ({
2033
+ matches
2034
+ }) => setIsMatch(matches); // Listen for changes
2035
+
2036
+
2037
+ matcher.addListener(onChange);
2038
+ return () => {
2039
+ // Stop listening for changes
2040
+ matcher.removeListener(onChange);
2041
+ };
2042
+ }
2043
+
2044
+ return;
2045
+ }, [isMatch, query, setIsMatch]);
2046
+ return isMatch;
2047
+ }
2048
+
2049
+ function getQueryStatusColor({
2050
+ queryState,
2051
+ observerCount,
2052
+ isStale,
2053
+ theme
2054
+ }) {
2055
+ return queryState.fetchStatus === 'fetching' ? theme.active : !observerCount ? theme.gray : queryState.fetchStatus === 'paused' ? theme.paused : isStale ? theme.warning : theme.success;
2056
+ }
2057
+ function getQueryStatusLabel(query) {
2058
+ return query.state.fetchStatus === 'fetching' ? 'fetching' : !query.getObserversCount() ? 'inactive' : query.state.fetchStatus === 'paused' ? 'paused' : query.isStale() ? 'stale' : 'fresh';
2059
+ }
2060
+ function styled(type, newStyles, queries = {}) {
2061
+ return /*#__PURE__*/React__namespace.forwardRef(({
2062
+ style,
2063
+ ...rest
2064
+ }, ref) => {
2065
+ const theme = useTheme();
2066
+ const mediaStyles = Object.entries(queries).reduce((current, [key, value]) => {
2067
+ // eslint-disable-next-line react-hooks/rules-of-hooks
2068
+ return useMediaQuery(key) ? { ...current,
2069
+ ...(typeof value === 'function' ? value(rest, theme) : value)
2070
+ } : current;
2071
+ }, {});
2072
+ return /*#__PURE__*/React__namespace.createElement(type, { ...rest,
2073
+ style: { ...(typeof newStyles === 'function' ? newStyles(rest, theme) : newStyles),
2074
+ ...style,
2075
+ ...mediaStyles
2076
+ },
2077
+ ref
2078
+ });
2079
+ });
2080
+ }
2081
+ function useIsMounted() {
2082
+ const mountedRef = React__namespace.useRef(false);
2083
+ const isMounted = React__namespace.useCallback(() => mountedRef.current, []);
2084
+ React__namespace.useEffect(() => {
2085
+ mountedRef.current = true;
2086
+ return () => {
2087
+ mountedRef.current = false;
2088
+ };
2089
+ }, []);
2090
+ return isMounted;
2091
+ }
2092
+ /**
2093
+ * Displays a string regardless the type of the data
2094
+ * @param {unknown} value Value to be stringified
2095
+ * @param {boolean} beautify Formats json to multiline
2096
+ */
2097
+
2098
+ const displayValue = (value, beautify = false) => {
2099
+ const {
2100
+ json
2101
+ } = superjson.serialize(value);
2102
+ return JSON.stringify(json, null, beautify ? 2 : undefined);
2103
+ }; // Sorting functions
2104
+
2105
+ const getStatusRank = q => q.state.fetchStatus !== 'idle' ? 0 : !q.getObserversCount() ? 3 : q.isStale() ? 2 : 1;
2106
+
2107
+ const queryHashSort = (a, b) => a.queryHash.localeCompare(b.queryHash);
2108
+
2109
+ const dateSort = (a, b) => a.state.dataUpdatedAt < b.state.dataUpdatedAt ? 1 : -1;
2110
+
2111
+ const statusAndDateSort = (a, b) => {
2112
+ if (getStatusRank(a) === getStatusRank(b)) {
2113
+ return dateSort(a, b);
2114
+ }
2115
+
2116
+ return getStatusRank(a) > getStatusRank(b) ? 1 : -1;
2117
+ };
2118
+
2119
+ const sortFns = {
2120
+ 'Status > Last Updated': statusAndDateSort,
2121
+ 'Query Hash': queryHashSort,
2122
+ 'Last Updated': dateSort
2123
+ };
2124
+ const minPanelSize = 70;
2125
+ const defaultPanelSize = 500;
2126
+ const sides = {
2127
+ top: 'bottom',
2128
+ bottom: 'top',
2129
+ left: 'right',
2130
+ right: 'left'
2131
+ };
2132
+
2133
+ /**
2134
+ * Check if the given side is vertical (left/right)
2135
+ */
2136
+ function isVerticalSide(side) {
2137
+ return ['left', 'right'].includes(side);
2138
+ }
2139
+ /**
2140
+ * Get the opposite side, eg 'left' => 'right'. 'top' => 'bottom', etc
2141
+ */
2142
+
2143
+ function getOppositeSide(side) {
2144
+ return sides[side];
2145
+ }
2146
+ /**
2147
+ * Given as css prop it will return a sided css prop based on a given side
2148
+ * Example given `border` and `right` it return `borderRight`
2149
+ */
2150
+
2151
+ function getSidedProp(prop, side) {
2152
+ return "" + prop + (side.charAt(0).toUpperCase() + side.slice(1));
2153
+ }
2154
+ function getSidePanelStyle({
2155
+ position = 'bottom',
2156
+ height,
2157
+ width,
2158
+ devtoolsTheme,
2159
+ isOpen,
2160
+ isResizing,
2161
+ panelStyle
2162
+ }) {
2163
+ const oppositeSide = getOppositeSide(position);
2164
+ const borderSide = getSidedProp('border', oppositeSide);
2165
+ const isVertical = isVerticalSide(position);
2166
+ return { ...panelStyle,
2167
+ direction: 'ltr',
2168
+ position: 'fixed',
2169
+ [position]: 0,
2170
+ [borderSide]: "1px solid " + devtoolsTheme.gray,
2171
+ transformOrigin: oppositeSide,
2172
+ boxShadow: '0 0 20px rgba(0,0,0,.3)',
2173
+ zIndex: 99999,
2174
+ // visibility will be toggled after transitions, but set initial state here
2175
+ visibility: isOpen ? 'visible' : 'hidden',
2176
+ ...(isResizing ? {
2177
+ transition: "none"
2178
+ } : {
2179
+ transition: "all .2s ease"
2180
+ }),
2181
+ ...(isOpen ? {
2182
+ opacity: 1,
2183
+ pointerEvents: 'all',
2184
+ transform: isVertical ? "translateX(0) scale(1)" : "translateY(0) scale(1)"
2185
+ } : {
2186
+ opacity: 0,
2187
+ pointerEvents: 'none',
2188
+ transform: isVertical ? "translateX(15px) scale(1.02)" : "translateY(15px) scale(1.02)"
2189
+ }),
2190
+ ...(isVertical ? {
2191
+ top: 0,
2192
+ height: '100vh',
2193
+ maxWidth: '90%',
2194
+ width: typeof width === 'number' && width >= minPanelSize ? width : defaultPanelSize
2195
+ } : {
2196
+ left: 0,
2197
+ width: '100%',
2198
+ maxHeight: '90%',
2199
+ height: typeof height === 'number' && height >= minPanelSize ? height : defaultPanelSize
2200
+ })
2201
+ };
2202
+ }
2203
+ /**
2204
+ * Get resize handle style based on a given side
2205
+ */
2206
+
2207
+ function getResizeHandleStyle(position = 'bottom') {
2208
+ const isVertical = isVerticalSide(position);
2209
+ const oppositeSide = getOppositeSide(position);
2210
+ const marginSide = getSidedProp('margin', oppositeSide);
2211
+ return {
2212
+ position: 'absolute',
2213
+ cursor: isVertical ? 'col-resize' : 'row-resize',
2214
+ zIndex: 100000,
2215
+ [oppositeSide]: 0,
2216
+ [marginSide]: "-4px",
2217
+ ...(isVertical ? {
2218
+ top: 0,
2219
+ height: '100%',
2220
+ width: '4px'
2221
+ } : {
2222
+ width: '100%',
2223
+ height: '4px'
2224
+ })
2225
+ };
2226
+ }
2227
+
2228
+ const Panel = styled('div', (_props, theme) => ({
2229
+ fontSize: 'clamp(12px, 1.5vw, 14px)',
2230
+ fontFamily: "sans-serif",
2231
+ display: 'flex',
2232
+ backgroundColor: theme.background,
2233
+ color: theme.foreground
2234
+ }), {
2235
+ '(max-width: 700px)': {
2236
+ flexDirection: 'column'
2237
+ },
2238
+ '(max-width: 600px)': {
2239
+ fontSize: '.9em' // flexDirection: 'column',
2240
+
2241
+ }
2242
+ });
2243
+ const ActiveQueryPanel = styled('div', () => ({
2244
+ flex: '1 1 500px',
2245
+ display: 'flex',
2246
+ flexDirection: 'column',
2247
+ overflow: 'auto',
2248
+ height: '100%'
2249
+ }), {
2250
+ '(max-width: 700px)': (_props, theme) => ({
2251
+ borderTop: "2px solid " + theme.gray
2252
+ })
2253
+ });
2254
+ const Button = styled('button', (props, theme) => ({
2255
+ appearance: 'none',
2256
+ fontSize: '.9em',
2257
+ fontWeight: 'bold',
2258
+ background: theme.gray,
2259
+ border: '0',
2260
+ borderRadius: '.3em',
2261
+ color: 'white',
2262
+ padding: '.5em',
2263
+ opacity: props.disabled ? '.5' : undefined,
2264
+ cursor: 'pointer'
2265
+ }));
2266
+ const QueryKeys = styled('span', {
2267
+ display: 'flex',
2268
+ flexWrap: 'wrap',
2269
+ gap: '0.5em',
2270
+ fontSize: '0.9em'
2271
+ });
2272
+ const QueryKey = styled('span', {
2273
+ display: 'inline-flex',
2274
+ alignItems: 'center',
2275
+ padding: '.2em .4em',
2276
+ fontWeight: 'bold',
2277
+ textShadow: '0 0 10px black',
2278
+ borderRadius: '.2em'
2279
+ });
2280
+ const Code = styled('code', {
2281
+ fontSize: '.9em',
2282
+ color: 'inherit',
2283
+ background: 'inherit'
2284
+ });
2285
+ const Input = styled('input', (_props, theme) => ({
2286
+ backgroundColor: theme.inputBackgroundColor,
2287
+ border: 0,
2288
+ borderRadius: '.2em',
2289
+ color: theme.inputTextColor,
2290
+ fontSize: '.9em',
2291
+ lineHeight: "1.3",
2292
+ padding: '.3em .4em'
2293
+ }));
2294
+ const Select = styled('select', (_props, theme) => ({
2295
+ display: "inline-block",
2296
+ fontSize: ".9em",
2297
+ fontFamily: "sans-serif",
2298
+ fontWeight: 'normal',
2299
+ lineHeight: "1.3",
2300
+ padding: ".3em 1.5em .3em .5em",
2301
+ height: 'auto',
2302
+ border: 0,
2303
+ borderRadius: ".2em",
2304
+ appearance: "none",
2305
+ WebkitAppearance: 'none',
2306
+ backgroundColor: theme.inputBackgroundColor,
2307
+ backgroundImage: "url(\"data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='100' height='100' fill='%23444444'><polygon points='0,25 100,25 50,75'/></svg>\")",
2308
+ backgroundRepeat: "no-repeat",
2309
+ backgroundPosition: "right .55em center",
2310
+ backgroundSize: ".65em auto, 100%",
2311
+ color: theme.inputTextColor
2312
+ }), {
2313
+ '(max-width: 500px)': {
2314
+ display: 'none'
2315
+ }
2316
+ });
2317
+
2318
+ function ScreenReader({
2319
+ text
2320
+ }) {
2321
+ return /*#__PURE__*/React__namespace.createElement("span", {
2322
+ style: {
2323
+ position: 'absolute',
2324
+ width: '0.1px',
2325
+ height: '0.1px',
2326
+ overflow: 'hidden'
2327
+ }
2328
+ }, text);
2329
+ }
2330
+
2331
+ const Entry = styled('div', {
2332
+ fontFamily: 'Menlo, monospace',
2333
+ fontSize: '1em',
2334
+ lineHeight: '1.7',
2335
+ outline: 'none',
2336
+ wordBreak: 'break-word'
2337
+ });
2338
+ const Label = styled('span', {
2339
+ color: 'white'
2340
+ });
2341
+ const LabelButton = styled('button', {
2342
+ cursor: 'pointer',
2343
+ color: 'white'
2344
+ });
2345
+ const ExpandButton = styled('button', {
2346
+ cursor: 'pointer',
2347
+ color: 'inherit',
2348
+ font: 'inherit',
2349
+ outline: 'inherit',
2350
+ background: 'transparent',
2351
+ border: 'none',
2352
+ padding: 0
2353
+ });
2354
+ const CopyButton = ({
2355
+ value
2356
+ }) => {
2357
+ const [copyState, setCopyState] = React__namespace.useState('NoCopy');
2358
+ return /*#__PURE__*/React__namespace.createElement("button", {
2359
+ onClick: copyState === 'NoCopy' ? () => {
2360
+ navigator.clipboard.writeText(superjson.stringify(value)).then(() => {
2361
+ setCopyState('SuccessCopy');
2362
+ setTimeout(() => {
2363
+ setCopyState('NoCopy');
2364
+ }, 1500);
2365
+ }, err => {
2366
+ console.error('Failed to copy: ', err);
2367
+ setCopyState('ErrorCopy');
2368
+ setTimeout(() => {
2369
+ setCopyState('NoCopy');
2370
+ }, 1500);
2371
+ });
2372
+ } : undefined,
2373
+ style: {
2374
+ cursor: 'pointer',
2375
+ color: 'inherit',
2376
+ font: 'inherit',
2377
+ outline: 'inherit',
2378
+ background: 'transparent',
2379
+ border: 'none',
2380
+ padding: 0
2381
+ }
2382
+ }, copyState === 'NoCopy' ? /*#__PURE__*/React__namespace.createElement(Copier, null) : copyState === 'SuccessCopy' ? /*#__PURE__*/React__namespace.createElement(CopiedCopier, null) : /*#__PURE__*/React__namespace.createElement(ErrorCopier, null));
2383
+ };
2384
+ const Value = styled('span', (_props, theme) => ({
2385
+ color: theme.danger
2386
+ }));
2387
+ const SubEntries = styled('div', {
2388
+ marginLeft: '.1em',
2389
+ paddingLeft: '1em',
2390
+ borderLeft: '2px solid rgba(0,0,0,.15)'
2391
+ });
2392
+ const Info = styled('span', {
2393
+ color: 'grey',
2394
+ fontSize: '.7em'
2395
+ });
2396
+ const Expander = ({
2397
+ expanded,
2398
+ style = {}
2399
+ }) => /*#__PURE__*/React__namespace.createElement("span", {
2400
+ style: {
2401
+ display: 'inline-block',
2402
+ transition: 'all .1s ease',
2403
+ transform: "rotate(" + (expanded ? 90 : 0) + "deg) " + (style.transform || ''),
2404
+ ...style
2405
+ }
2406
+ }, "\u25B6");
2407
+
2408
+ const Copier = () => /*#__PURE__*/React__namespace.createElement("span", {
2409
+ "aria-label": "Copy object to clipboard",
2410
+ title: "Copy object to clipboard",
2411
+ style: {
2412
+ paddingLeft: '1em'
2413
+ }
2414
+ }, /*#__PURE__*/React__namespace.createElement("svg", {
2415
+ height: "12",
2416
+ viewBox: "0 0 16 12",
2417
+ width: "10"
2418
+ }, /*#__PURE__*/React__namespace.createElement("path", {
2419
+ fill: "currentColor",
2420
+ d: "M0 6.75C0 5.784.784 5 1.75 5h1.5a.75.75 0 010 1.5h-1.5a.25.25 0 00-.25.25v7.5c0 .138.112.25.25.25h7.5a.25.25 0 00.25-.25v-1.5a.75.75 0 011.5 0v1.5A1.75 1.75 0 019.25 16h-7.5A1.75 1.75 0 010 14.25v-7.5z"
2421
+ }), /*#__PURE__*/React__namespace.createElement("path", {
2422
+ fill: "currentColor",
2423
+ d: "M5 1.75C5 .784 5.784 0 6.75 0h7.5C15.216 0 16 .784 16 1.75v7.5A1.75 1.75 0 0114.25 11h-7.5A1.75 1.75 0 015 9.25v-7.5zm1.75-.25a.25.25 0 00-.25.25v7.5c0 .138.112.25.25.25h7.5a.25.25 0 00.25-.25v-7.5a.25.25 0 00-.25-.25h-7.5z"
2424
+ })));
2425
+
2426
+ const ErrorCopier = () => /*#__PURE__*/React__namespace.createElement("span", {
2427
+ "aria-label": "Failed copying to clipboard",
2428
+ title: "Failed copying to clipboard",
2429
+ style: {
2430
+ paddingLeft: '1em',
2431
+ display: 'flex',
2432
+ alignItems: 'center'
2433
+ }
2434
+ }, /*#__PURE__*/React__namespace.createElement("svg", {
2435
+ height: "12",
2436
+ viewBox: "0 0 16 12",
2437
+ width: "10",
2438
+ display: "block"
2439
+ }, /*#__PURE__*/React__namespace.createElement("path", {
2440
+ fill: "red",
2441
+ d: "M3.72 3.72a.75.75 0 011.06 0L8 6.94l3.22-3.22a.75.75 0 111.06 1.06L9.06 8l3.22 3.22a.75.75 0 11-1.06 1.06L8 9.06l-3.22 3.22a.75.75 0 01-1.06-1.06L6.94 8 3.72 4.78a.75.75 0 010-1.06z"
2442
+ })), /*#__PURE__*/React__namespace.createElement("span", {
2443
+ style: {
2444
+ color: 'red',
2445
+ fontSize: '12px',
2446
+ paddingLeft: '4px',
2447
+ position: 'relative',
2448
+ top: '2px'
2449
+ }
2450
+ }, "See console"));
2451
+
2452
+ const CopiedCopier = () => /*#__PURE__*/React__namespace.createElement("span", {
2453
+ "aria-label": "Object copied to clipboard",
2454
+ title: "Object copied to clipboard",
2455
+ style: {
2456
+ paddingLeft: '1em',
2457
+ display: 'inline-block',
2458
+ verticalAlign: 'middle'
2459
+ }
2460
+ }, /*#__PURE__*/React__namespace.createElement("svg", {
2461
+ height: "16",
2462
+ viewBox: "0 0 16 16",
2463
+ width: "16",
2464
+ display: "block"
2465
+ }, /*#__PURE__*/React__namespace.createElement("path", {
2466
+ fill: "green",
2467
+ d: "M13.78 4.22a.75.75 0 010 1.06l-7.25 7.25a.75.75 0 01-1.06 0L2.22 9.28a.75.75 0 011.06-1.06L6 10.94l6.72-6.72a.75.75 0 011.06 0z"
2468
+ })));
2469
+
2470
+ /**
2471
+ * Chunk elements in the array by size
2472
+ *
2473
+ * when the array cannot be chunked evenly by size, the last chunk will be
2474
+ * filled with the remaining elements
2475
+ *
2476
+ * @example
2477
+ * chunkArray(['a','b', 'c', 'd', 'e'], 2) // returns [['a','b'], ['c', 'd'], ['e']]
2478
+ */
2479
+ function chunkArray(array, size) {
2480
+ if (size < 1) return [];
2481
+ let i = 0;
2482
+ const result = [];
2483
+
2484
+ while (i < array.length) {
2485
+ result.push(array.slice(i, i + size));
2486
+ i = i + size;
2487
+ }
2488
+
2489
+ return result;
2490
+ }
2491
+ const DefaultRenderer = ({
2492
+ handleEntry,
2493
+ label,
2494
+ value,
2495
+ subEntries = [],
2496
+ subEntryPages = [],
2497
+ type,
2498
+ expanded = false,
2499
+ copyable = false,
2500
+ toggleExpanded,
2501
+ pageSize
2502
+ }) => {
2503
+ const [expandedPages, setExpandedPages] = React__namespace.useState([]);
2504
+ return /*#__PURE__*/React__namespace.createElement(Entry, {
2505
+ key: label
2506
+ }, subEntryPages.length ? /*#__PURE__*/React__namespace.createElement(React__namespace.Fragment, null, /*#__PURE__*/React__namespace.createElement(ExpandButton, {
2507
+ onClick: () => toggleExpanded()
2508
+ }, /*#__PURE__*/React__namespace.createElement(Expander, {
2509
+ expanded: expanded
2510
+ }), " ", label, ' ', /*#__PURE__*/React__namespace.createElement(Info, null, String(type).toLowerCase() === 'iterable' ? '(Iterable) ' : '', subEntries.length, " ", subEntries.length > 1 ? "items" : "item")), copyable ? /*#__PURE__*/React__namespace.createElement(CopyButton, {
2511
+ value: value
2512
+ }) : null, expanded ? subEntryPages.length === 1 ? /*#__PURE__*/React__namespace.createElement(SubEntries, null, subEntries.map(handleEntry)) : /*#__PURE__*/React__namespace.createElement(SubEntries, null, subEntryPages.map((entries, index) => /*#__PURE__*/React__namespace.createElement("div", {
2513
+ key: index
2514
+ }, /*#__PURE__*/React__namespace.createElement(Entry, null, /*#__PURE__*/React__namespace.createElement(LabelButton, {
2515
+ onClick: () => setExpandedPages(old => old.includes(index) ? old.filter(d => d !== index) : [...old, index])
2516
+ }, /*#__PURE__*/React__namespace.createElement(Expander, {
2517
+ expanded: expanded
2518
+ }), " [", index * pageSize, " ...", ' ', index * pageSize + pageSize - 1, "]"), expandedPages.includes(index) ? /*#__PURE__*/React__namespace.createElement(SubEntries, null, entries.map(handleEntry)) : null)))) : null) : /*#__PURE__*/React__namespace.createElement(React__namespace.Fragment, null, /*#__PURE__*/React__namespace.createElement(Label, null, label, ":"), " ", /*#__PURE__*/React__namespace.createElement(Value, null, displayValue(value))));
2519
+ };
2520
+
2521
+ function isIterable(x) {
2522
+ return Symbol.iterator in x;
2523
+ }
2524
+
2525
+ function Explorer({
2526
+ value,
2527
+ defaultExpanded,
2528
+ renderer = DefaultRenderer,
2529
+ pageSize = 100,
2530
+ copyable = false,
2531
+ ...rest
2532
+ }) {
2533
+ const [expanded, setExpanded] = React__namespace.useState(Boolean(defaultExpanded));
2534
+ const toggleExpanded = React__namespace.useCallback(() => setExpanded(old => !old), []);
2535
+ let type = typeof value;
2536
+ let subEntries = [];
2537
+
2538
+ const makeProperty = sub => {
2539
+ const subDefaultExpanded = defaultExpanded === true ? {
2540
+ [sub.label]: true
2541
+ } : defaultExpanded == null ? void 0 : defaultExpanded[sub.label];
2542
+ return { ...sub,
2543
+ defaultExpanded: subDefaultExpanded
2544
+ };
2545
+ };
2546
+
2547
+ if (Array.isArray(value)) {
2548
+ type = 'array';
2549
+ subEntries = value.map((d, i) => makeProperty({
2550
+ label: i.toString(),
2551
+ value: d
2552
+ }));
2553
+ } else if (value !== null && typeof value === 'object' && isIterable(value) && typeof value[Symbol.iterator] === 'function') {
2554
+ type = 'Iterable';
2555
+ subEntries = Array.from(value, (val, i) => makeProperty({
2556
+ label: i.toString(),
2557
+ value: val
2558
+ }));
2559
+ } else if (typeof value === 'object' && value !== null) {
2560
+ type = 'object';
2561
+ subEntries = Object.entries(value).map(([key, val]) => makeProperty({
2562
+ label: key,
2563
+ value: val
2564
+ }));
2565
+ }
2566
+
2567
+ const subEntryPages = chunkArray(subEntries, pageSize);
2568
+ return renderer({
2569
+ handleEntry: entry => /*#__PURE__*/React__namespace.createElement(Explorer, _extends({
2570
+ key: entry.label,
2571
+ value: value,
2572
+ renderer: renderer,
2573
+ copyable: copyable
2574
+ }, rest, entry)),
2575
+ type,
2576
+ subEntries,
2577
+ subEntryPages,
2578
+ value,
2579
+ expanded,
2580
+ copyable,
2581
+ toggleExpanded,
2582
+ pageSize,
2583
+ ...rest
2584
+ });
2585
+ }
2586
+
2587
+ function Logo(props) {
2588
+ return /*#__PURE__*/React__namespace.createElement("svg", _extends({
2589
+ width: "40px",
2590
+ height: "40px",
2591
+ viewBox: "0 0 190 190",
2592
+ version: "1.1"
2593
+ }, props), /*#__PURE__*/React__namespace.createElement("g", {
2594
+ stroke: "none",
2595
+ strokeWidth: "1",
2596
+ fill: "none",
2597
+ fillRule: "evenodd"
2598
+ }, /*#__PURE__*/React__namespace.createElement("g", {
2599
+ transform: "translate(-33.000000, 0.000000)"
2600
+ }, /*#__PURE__*/React__namespace.createElement("path", {
2601
+ d: "M72.7239712,61.3436237 C69.631224,46.362877 68.9675112,34.8727722 70.9666331,26.5293551 C72.1555965,21.5671678 74.3293088,17.5190846 77.6346064,14.5984631 C81.1241394,11.5150478 85.5360327,10.0020122 90.493257,10.0020122 C98.6712013,10.0020122 107.26826,13.7273214 116.455725,20.8044264 C120.20312,23.6910458 124.092437,27.170411 128.131651,31.2444746 C128.45314,30.8310265 128.816542,30.4410453 129.22143,30.0806152 C140.64098,19.9149716 150.255245,13.5989272 158.478408,11.1636507 C163.367899,9.715636 167.958526,9.57768202 172.138936,10.983031 C176.551631,12.4664684 180.06766,15.5329489 182.548314,19.8281091 C186.642288,26.9166735 187.721918,36.2310983 186.195595,47.7320243 C185.573451,52.4199112 184.50985,57.5263831 183.007094,63.0593153 C183.574045,63.1277086 184.142416,63.2532808 184.705041,63.4395297 C199.193932,68.2358678 209.453582,73.3937462 215.665021,79.2882839 C219.360669,82.7953831 221.773972,86.6998434 222.646365,91.0218204 C223.567176,95.5836746 222.669313,100.159332 220.191548,104.451297 C216.105211,111.529614 208.591643,117.11221 197.887587,121.534031 C193.589552,123.309539 188.726579,124.917559 183.293259,126.363748 C183.541176,126.92292 183.733521,127.516759 183.862138,128.139758 C186.954886,143.120505 187.618598,154.61061 185.619477,162.954027 C184.430513,167.916214 182.256801,171.964297 178.951503,174.884919 C175.46197,177.968334 171.050077,179.48137 166.092853,179.48137 C157.914908,179.48137 149.31785,175.756061 140.130385,168.678956 C136.343104,165.761613 132.410866,162.238839 128.325434,158.108619 C127.905075,158.765474 127.388968,159.376011 126.77857,159.919385 C115.35902,170.085028 105.744755,176.401073 97.5215915,178.836349 C92.6321009,180.284364 88.0414736,180.422318 83.8610636,179.016969 C79.4483686,177.533532 75.9323404,174.467051 73.4516862,170.171891 C69.3577116,163.083327 68.2780823,153.768902 69.8044053,142.267976 C70.449038,137.410634 71.56762,132.103898 73.1575891,126.339009 C72.5361041,126.276104 71.9120754,126.144816 71.2949591,125.940529 C56.8060684,121.144191 46.5464184,115.986312 40.3349789,110.091775 C36.6393312,106.584675 34.2260275,102.680215 33.3536352,98.3582381 C32.4328237,93.7963839 33.3306866,89.2207269 35.8084524,84.9287618 C39.8947886,77.8504443 47.4083565,72.2678481 58.1124133,67.8460273 C62.5385143,66.0176154 67.5637208,64.366822 73.1939394,62.8874674 C72.9933393,62.3969171 72.8349374,61.8811235 72.7239712,61.3436237 Z",
2602
+ fill: "#002C4B",
2603
+ fillRule: "nonzero",
2604
+ transform: "translate(128.000000, 95.000000) scale(-1, 1) translate(-128.000000, -95.000000) "
2605
+ }), /*#__PURE__*/React__namespace.createElement("path", {
2606
+ d: "M113.396882,64 L142.608177,64 C144.399254,64 146.053521,64.958025 146.944933,66.5115174 L161.577138,92.0115174 C162.461464,93.5526583 162.461464,95.4473417 161.577138,96.9884826 L146.944933,122.488483 C146.053521,124.041975 144.399254,125 142.608177,125 L113.396882,125 C111.605806,125 109.951539,124.041975 109.060126,122.488483 L94.4279211,96.9884826 C93.543596,95.4473417 93.543596,93.5526583 94.4279211,92.0115174 L109.060126,66.5115174 C109.951539,64.958025 111.605806,64 113.396882,64 Z M138.987827,70.2765273 C140.779849,70.2765273 142.434839,71.2355558 143.325899,72.7903404 L154.343038,92.0138131 C155.225607,93.5537825 155.225607,95.4462175 154.343038,96.9861869 L143.325899,116.20966 C142.434839,117.764444 140.779849,118.723473 138.987827,118.723473 L117.017233,118.723473 C115.225211,118.723473 113.570221,117.764444 112.67916,116.20966 L101.662022,96.9861869 C100.779452,95.4462175 100.779452,93.5537825 101.662022,92.0138131 L112.67916,72.7903404 C113.570221,71.2355558 115.225211,70.2765273 117.017233,70.2765273 L138.987827,70.2765273 Z M135.080648,77.1414791 L120.924411,77.1414791 C119.134228,77.1414791 117.480644,78.0985567 116.5889,79.6508285 L116.5889,79.6508285 L109.489217,92.0093494 C108.603232,93.5515958 108.603232,95.4484042 109.489217,96.9906506 L109.489217,96.9906506 L116.5889,109.349172 C117.480644,110.901443 119.134228,111.858521 120.924411,111.858521 L120.924411,111.858521 L135.080648,111.858521 C136.870831,111.858521 138.524416,110.901443 139.41616,109.349172 L139.41616,109.349172 L146.515843,96.9906506 C147.401828,95.4484042 147.401828,93.5515958 146.515843,92.0093494 L146.515843,92.0093494 L139.41616,79.6508285 C138.524416,78.0985567 136.870831,77.1414791 135.080648,77.1414791 L135.080648,77.1414791 Z M131.319186,83.7122186 C133.108028,83.7122186 134.760587,84.6678753 135.652827,86.2183156 L138.983552,92.0060969 C139.87203,93.5500005 139.87203,95.4499995 138.983552,96.9939031 L135.652827,102.781684 C134.760587,104.332125 133.108028,105.287781 131.319186,105.287781 L124.685874,105.287781 C122.897032,105.287781 121.244473,104.332125 120.352233,102.781684 L117.021508,96.9939031 C116.13303,95.4499995 116.13303,93.5500005 117.021508,92.0060969 L120.352233,86.2183156 C121.244473,84.6678753 122.897032,83.7122186 124.685874,83.7122186 L131.319186,83.7122186 Z M128.003794,90.1848875 C126.459294,90.1848875 125.034382,91.0072828 124.263005,92.3424437 C123.491732,93.6774232 123.491732,95.3225768 124.263005,96.6575563 C125.034382,97.9927172 126.459294,98.8151125 128.001266,98.8151125 L128.001266,98.8151125 C129.545766,98.8151125 130.970678,97.9927172 131.742055,96.6575563 C132.513327,95.3225768 132.513327,93.6774232 131.742055,92.3424437 C130.970678,91.0072828 129.545766,90.1848875 128.003794,90.1848875 L128.003794,90.1848875 Z M93,94.5009646 L100.767764,94.5009646",
2607
+ fill: "#FFD94C"
2608
+ }), /*#__PURE__*/React__namespace.createElement("path", {
2609
+ d: "M87.8601729,108.357758 C89.1715224,107.608286 90.8360246,108.074601 91.5779424,109.399303 L91.5779424,109.399303 L92.0525843,110.24352 C95.8563392,116.982993 99.8190116,123.380176 103.940602,129.435068 C108.807881,136.585427 114.28184,143.82411 120.362479,151.151115 C121.316878,152.30114 121.184944,154.011176 120.065686,154.997937 L120.065686,154.997937 L119.454208,155.534625 C99.3465389,173.103314 86.2778188,176.612552 80.2480482,166.062341 C74.3500652,155.742717 76.4844915,136.982888 86.6513274,109.782853 C86.876818,109.179582 87.3045861,108.675291 87.8601729,108.357758 Z M173.534177,129.041504 C174.986131,128.785177 176.375496,129.742138 176.65963,131.194242 L176.65963,131.194242 L176.812815,131.986376 C181.782365,157.995459 178.283348,171 166.315764,171 C154.609745,171 139.708724,159.909007 121.612702,137.727022 C121.211349,137.235047 120.994572,136.617371 121,135.981509 C121.013158,134.480686 122.235785,133.274651 123.730918,133.287756 L123.730918,133.287756 L124.684654,133.294531 C132.305698,133.335994 139.714387,133.071591 146.910723,132.501323 C155.409039,131.82788 164.283523,130.674607 173.534177,129.041504 Z M180.408726,73.8119663 C180.932139,72.4026903 182.508386,71.6634537 183.954581,72.149012 L183.954581,72.149012 L184.742552,72.4154854 C210.583763,81.217922 220.402356,90.8916805 214.198332,101.436761 C208.129904,111.751366 190.484347,119.260339 161.26166,123.963678 C160.613529,124.067994 159.948643,123.945969 159.382735,123.618843 C158.047025,122.846729 157.602046,121.158214 158.388848,119.847438 L158.388848,119.847438 L158.889328,119.0105 C162.877183,112.31633 166.481358,105.654262 169.701854,99.0242957 C173.50501,91.1948179 177.073967,82.7907081 180.408726,73.8119663 Z M94.7383398,66.0363218 C95.3864708,65.9320063 96.0513565,66.0540315 96.6172646,66.3811573 C97.9529754,67.153271 98.3979538,68.8417862 97.6111517,70.1525615 L97.6111517,70.1525615 L97.1106718,70.9895001 C93.1228168,77.6836699 89.5186416,84.3457379 86.2981462,90.9757043 C82.49499,98.8051821 78.9260328,107.209292 75.5912744,116.188034 C75.0678608,117.59731 73.4916142,118.336546 72.045419,117.850988 L72.045419,117.850988 L71.2574475,117.584515 C45.4162372,108.782078 35.597644,99.1083195 41.8016679,88.5632391 C47.8700957,78.2486335 65.515653,70.7396611 94.7383398,66.0363218 Z M136.545792,34.4653746 C156.653461,16.8966864 169.722181,13.3874478 175.751952,23.9376587 C181.649935,34.2572826 179.515508,53.0171122 169.348673,80.2171474 C169.123182,80.8204179 168.695414,81.324709 168.139827,81.6422422 C166.828478,82.3917144 165.163975,81.9253986 164.422058,80.6006966 L164.422058,80.6006966 L163.947416,79.7564798 C160.143661,73.0170065 156.180988,66.6198239 152.059398,60.564932 C147.192119,53.4145727 141.71816,46.1758903 135.637521,38.8488847 C134.683122,37.6988602 134.815056,35.9888243 135.934314,35.0020629 L135.934314,35.0020629 Z M90.6842361,18 C102.390255,18 117.291276,29.0909926 135.387298,51.2729777 C135.788651,51.7649527 136.005428,52.3826288 136,53.0184911 C135.986842,54.5193144 134.764215,55.7253489 133.269082,55.7122445 L133.269082,55.7122445 L132.315346,55.7054689 C124.694302,55.6640063 117.285613,55.9284091 110.089277,56.4986773 C101.590961,57.17212 92.7164767,58.325393 83.4658235,59.9584962 C82.0138691,60.2148231 80.6245044,59.2578618 80.3403697,57.805758 L80.3403697,57.805758 L80.1871846,57.0136235 C75.2176347,31.0045412 78.7166519,18 90.6842361,18 Z",
2610
+ fill: "#FF4154"
2611
+ }))));
2612
+ }
2613
+
2614
+ function ReactQueryDevtools$1({
2615
+ initialIsOpen,
2616
+ panelProps = {},
2617
+ closeButtonProps = {},
2618
+ toggleButtonProps = {},
2619
+ position = 'bottom-left',
2620
+ containerElement: Container = 'aside',
2621
+ context,
2622
+ styleNonce,
2623
+ panelPosition: initialPanelPosition = 'bottom',
2624
+ errorTypes = []
2625
+ }) {
2626
+ const rootRef = React__namespace.useRef(null);
2627
+ const panelRef = React__namespace.useRef(null);
2628
+ const [isOpen, setIsOpen] = useLocalStorage('reactQueryDevtoolsOpen', initialIsOpen);
2629
+ const [devtoolsHeight, setDevtoolsHeight] = useLocalStorage('reactQueryDevtoolsHeight', defaultPanelSize);
2630
+ const [devtoolsWidth, setDevtoolsWidth] = useLocalStorage('reactQueryDevtoolsWidth', defaultPanelSize);
2631
+ const [panelPosition = 'bottom', setPanelPosition] = useLocalStorage('reactQueryDevtoolsPanelPosition', initialPanelPosition);
2632
+ const [isResolvedOpen, setIsResolvedOpen] = React__namespace.useState(false);
2633
+ const [isResizing, setIsResizing] = React__namespace.useState(false);
2634
+ const isMounted = useIsMounted();
2635
+
2636
+ const handleDragStart = (panelElement, startEvent) => {
2637
+ if (!panelElement) return;
2638
+ if (startEvent.button !== 0) return; // Only allow left click for drag
2639
+
2640
+ const isVertical = isVerticalSide(panelPosition);
2641
+ setIsResizing(true);
2642
+ const {
2643
+ height,
2644
+ width
2645
+ } = panelElement.getBoundingClientRect();
2646
+ const startX = startEvent.clientX;
2647
+ const startY = startEvent.clientY;
2648
+ let newSize = 0;
2649
+
2650
+ const run = moveEvent => {
2651
+ // prevent mouse selecting stuff with mouse drag
2652
+ moveEvent.preventDefault(); // calculate the correct size based on mouse position and current panel position
2653
+ // hint: it is different formula for the opposite sides
2654
+
2655
+ if (isVertical) {
2656
+ newSize = width + (panelPosition === 'right' ? startX - moveEvent.clientX : moveEvent.clientX - startX);
2657
+ setDevtoolsWidth(newSize);
2658
+ } else {
2659
+ newSize = height + (panelPosition === 'bottom' ? startY - moveEvent.clientY : moveEvent.clientY - startY);
2660
+ setDevtoolsHeight(newSize);
2661
+ }
2662
+
2663
+ if (newSize < minPanelSize) {
2664
+ setIsOpen(false);
2665
+ } else {
2666
+ setIsOpen(true);
2667
+ }
2668
+ };
2669
+
2670
+ const unsub = () => {
2671
+ if (isResizing) {
2672
+ setIsResizing(false);
2673
+ }
2674
+
2675
+ document.removeEventListener('mousemove', run, false);
2676
+ document.removeEventListener('mouseUp', unsub, false);
2677
+ };
2678
+
2679
+ document.addEventListener('mousemove', run, false);
2680
+ document.addEventListener('mouseup', unsub, false);
2681
+ };
2682
+
2683
+ React__namespace.useEffect(() => {
2684
+ setIsResolvedOpen(isOpen != null ? isOpen : false);
2685
+ }, [isOpen, isResolvedOpen, setIsResolvedOpen]); // Toggle panel visibility before/after transition (depending on direction).
2686
+ // Prevents focusing in a closed panel.
2687
+
2688
+ React__namespace.useEffect(() => {
2689
+ const ref = panelRef.current;
2690
+
2691
+ if (ref) {
2692
+ const handlePanelTransitionStart = () => {
2693
+ if (isResolvedOpen) {
2694
+ ref.style.visibility = 'visible';
2695
+ }
2696
+ };
2697
+
2698
+ const handlePanelTransitionEnd = () => {
2699
+ if (!isResolvedOpen) {
2700
+ ref.style.visibility = 'hidden';
2701
+ }
2702
+ };
2703
+
2704
+ ref.addEventListener('transitionstart', handlePanelTransitionStart);
2705
+ ref.addEventListener('transitionend', handlePanelTransitionEnd);
2706
+ return () => {
2707
+ ref.removeEventListener('transitionstart', handlePanelTransitionStart);
2708
+ ref.removeEventListener('transitionend', handlePanelTransitionEnd);
2709
+ };
2710
+ }
2711
+
2712
+ return;
2713
+ }, [isResolvedOpen]);
2714
+ React__namespace.useEffect(() => {
2715
+ var _rootRef$current;
2716
+
2717
+ if (isResolvedOpen && (_rootRef$current = rootRef.current) != null && _rootRef$current.parentElement) {
2718
+ const {
2719
+ parentElement
2720
+ } = rootRef.current;
2721
+ const styleProp = getSidedProp('padding', panelPosition);
2722
+ const isVertical = isVerticalSide(panelPosition);
2723
+
2724
+ const previousPaddings = (({
2725
+ padding,
2726
+ paddingTop,
2727
+ paddingBottom,
2728
+ paddingLeft,
2729
+ paddingRight
2730
+ }) => ({
2731
+ padding,
2732
+ paddingTop,
2733
+ paddingBottom,
2734
+ paddingLeft,
2735
+ paddingRight
2736
+ }))(parentElement.style);
2737
+
2738
+ const run = () => {
2739
+ // reset the padding
2740
+ parentElement.style.padding = '0px';
2741
+ parentElement.style.paddingTop = '0px';
2742
+ parentElement.style.paddingBottom = '0px';
2743
+ parentElement.style.paddingLeft = '0px';
2744
+ parentElement.style.paddingRight = '0px'; // set the new padding based on the new panel position
2745
+
2746
+ parentElement.style[styleProp] = (isVertical ? devtoolsWidth : devtoolsHeight) + "px";
2747
+ };
2748
+
2749
+ run();
2750
+
2751
+ if (typeof window !== 'undefined') {
2752
+ window.addEventListener('resize', run);
2753
+ return () => {
2754
+ window.removeEventListener('resize', run);
2755
+ Object.entries(previousPaddings).forEach(([property, previousValue]) => {
2756
+ parentElement.style[property] = previousValue;
2757
+ });
2758
+ };
2759
+ }
2760
+ }
2761
+
2762
+ return;
2763
+ }, [isResolvedOpen, panelPosition, devtoolsHeight, devtoolsWidth]);
2764
+ const {
2765
+ style: panelStyle = {},
2766
+ ...otherPanelProps
2767
+ } = panelProps;
2768
+ const {
2769
+ style: toggleButtonStyle = {},
2770
+ onClick: onToggleClick,
2771
+ ...otherToggleButtonProps
2772
+ } = toggleButtonProps; // get computed style based on panel position
2773
+
2774
+ const style = getSidePanelStyle({
2775
+ position: panelPosition,
2776
+ devtoolsTheme: defaultTheme,
2777
+ isOpen: isResolvedOpen,
2778
+ height: devtoolsHeight,
2779
+ width: devtoolsWidth,
2780
+ isResizing,
2781
+ panelStyle
2782
+ }); // Do not render on the server
2783
+
2784
+ if (!isMounted()) return null;
2785
+ return /*#__PURE__*/React__namespace.createElement(Container, {
2786
+ ref: rootRef,
2787
+ className: "ReactQueryDevtools",
2788
+ "aria-label": "React Query Devtools"
2789
+ }, /*#__PURE__*/React__namespace.createElement(ThemeProvider, {
2790
+ theme: defaultTheme
2791
+ }, /*#__PURE__*/React__namespace.createElement(ReactQueryDevtoolsPanel$1, _extends({
2792
+ ref: panelRef,
2793
+ context: context,
2794
+ styleNonce: styleNonce,
2795
+ position: panelPosition,
2796
+ onPositionChange: setPanelPosition,
2797
+ showCloseButton: true,
2798
+ closeButtonProps: closeButtonProps
2799
+ }, otherPanelProps, {
2800
+ style: style,
2801
+ isOpen: isResolvedOpen,
2802
+ setIsOpen: setIsOpen,
2803
+ onDragStart: e => handleDragStart(panelRef.current, e),
2804
+ errorTypes: errorTypes
2805
+ }))), !isResolvedOpen ? /*#__PURE__*/React__namespace.createElement("button", _extends({
2806
+ type: "button"
2807
+ }, otherToggleButtonProps, {
2808
+ "aria-label": "Open React Query Devtools",
2809
+ "aria-controls": "ReactQueryDevtoolsPanel",
2810
+ "aria-haspopup": "true",
2811
+ "aria-expanded": "false",
2812
+ onClick: e => {
2813
+ setIsOpen(true);
2814
+ onToggleClick == null ? void 0 : onToggleClick(e);
2815
+ },
2816
+ style: {
2817
+ background: 'none',
2818
+ border: 0,
2819
+ padding: 0,
2820
+ position: 'fixed',
2821
+ zIndex: 99999,
2822
+ display: 'inline-flex',
2823
+ fontSize: '1.5em',
2824
+ margin: '.5em',
2825
+ cursor: 'pointer',
2826
+ width: 'fit-content',
2827
+ ...(position === 'top-right' ? {
2828
+ top: '0',
2829
+ right: '0'
2830
+ } : position === 'top-left' ? {
2831
+ top: '0',
2832
+ left: '0'
2833
+ } : position === 'bottom-right' ? {
2834
+ bottom: '0',
2835
+ right: '0'
2836
+ } : {
2837
+ bottom: '0',
2838
+ left: '0'
2839
+ }),
2840
+ ...toggleButtonStyle
2841
+ }
2842
+ }), /*#__PURE__*/React__namespace.createElement(Logo, {
2843
+ "aria-hidden": true
2844
+ }), /*#__PURE__*/React__namespace.createElement(ScreenReader, {
2845
+ text: "Open React Query Devtools"
2846
+ })) : null);
2847
+ }
2848
+
2849
+ const useSubscribeToQueryCache = (queryCache, getSnapshot, skip = false) => {
2850
+ return shim.exports.useSyncExternalStore(React__namespace.useCallback(onStoreChange => {
2851
+ if (!skip) return queryCache.subscribe(reactQuery.notifyManager.batchCalls(onStoreChange));
2852
+ return () => {
2853
+ return;
2854
+ };
2855
+ }, [queryCache, skip]), getSnapshot, getSnapshot);
2856
+ };
2857
+
2858
+ const ReactQueryDevtoolsPanel$1 = /*#__PURE__*/React__namespace.forwardRef(function ReactQueryDevtoolsPanel(props, ref) {
2859
+ const {
2860
+ isOpen = true,
2861
+ styleNonce,
2862
+ setIsOpen,
2863
+ context,
2864
+ onDragStart,
2865
+ onPositionChange,
2866
+ showCloseButton,
2867
+ position,
2868
+ closeButtonProps = {},
2869
+ errorTypes = [],
2870
+ ...panelProps
2871
+ } = props;
2872
+ const {
2873
+ onClick: onCloseClick,
2874
+ ...otherCloseButtonProps
2875
+ } = closeButtonProps;
2876
+ const queryClient = reactQuery.useQueryClient({
2877
+ context
2878
+ });
2879
+ const queryCache = queryClient.getQueryCache();
2880
+ const [sort, setSort] = useLocalStorage('reactQueryDevtoolsSortFn', Object.keys(sortFns)[0]);
2881
+ const [filter, setFilter] = useLocalStorage('reactQueryDevtoolsFilter', '');
2882
+ const [baseSort, setBaseSort] = useLocalStorage('reactQueryDevtoolsBaseSort', 1);
2883
+ const sortFn = React__namespace.useMemo(() => sortFns[sort], [sort]);
2884
+ const queriesCount = useSubscribeToQueryCache(queryCache, () => queryCache.getAll().length, !isOpen);
2885
+ const [activeQueryHash, setActiveQueryHash] = useLocalStorage('reactQueryDevtoolsActiveQueryHash', '');
2886
+ const queries = React__namespace.useMemo(() => {
2887
+ const unsortedQueries = queryCache.getAll();
2888
+
2889
+ if (queriesCount === 0) {
2890
+ return [];
2891
+ }
2892
+
2893
+ const filtered = filter ? unsortedQueries.filter(item => rankItem(item.queryHash, filter).passed) : [...unsortedQueries];
2894
+ const sorted = sortFn ? filtered.sort((a, b) => sortFn(a, b) * baseSort) : filtered;
2895
+ return sorted;
2896
+ }, [baseSort, sortFn, filter, queriesCount, queryCache]);
2897
+ const [isMockOffline, setMockOffline] = React__namespace.useState(false);
2898
+ return /*#__PURE__*/React__namespace.createElement(ThemeProvider, {
2899
+ theme: defaultTheme
2900
+ }, /*#__PURE__*/React__namespace.createElement(Panel, _extends({
2901
+ ref: ref,
2902
+ className: "ReactQueryDevtoolsPanel",
2903
+ "aria-label": "React Query Devtools Panel",
2904
+ id: "ReactQueryDevtoolsPanel"
2905
+ }, panelProps, {
2906
+ style: {
2907
+ height: defaultPanelSize,
2908
+ position: 'relative',
2909
+ ...panelProps.style
2910
+ }
2911
+ }), /*#__PURE__*/React__namespace.createElement("style", {
2912
+ nonce: styleNonce,
2913
+ dangerouslySetInnerHTML: {
2914
+ __html: "\n .ReactQueryDevtoolsPanel * {\n scrollbar-color: " + defaultTheme.backgroundAlt + " " + defaultTheme.gray + ";\n }\n\n .ReactQueryDevtoolsPanel *::-webkit-scrollbar, .ReactQueryDevtoolsPanel scrollbar {\n width: 1em;\n height: 1em;\n }\n\n .ReactQueryDevtoolsPanel *::-webkit-scrollbar-track, .ReactQueryDevtoolsPanel scrollbar-track {\n background: " + defaultTheme.backgroundAlt + ";\n }\n\n .ReactQueryDevtoolsPanel *::-webkit-scrollbar-thumb, .ReactQueryDevtoolsPanel scrollbar-thumb {\n background: " + defaultTheme.gray + ";\n border-radius: .5em;\n border: 3px solid " + defaultTheme.backgroundAlt + ";\n }\n "
2915
+ }
2916
+ }), /*#__PURE__*/React__namespace.createElement("div", {
2917
+ style: getResizeHandleStyle(position),
2918
+ onMouseDown: onDragStart
2919
+ }), isOpen && /*#__PURE__*/React__namespace.createElement("div", {
2920
+ style: {
2921
+ flex: '1 1 500px',
2922
+ minHeight: '40%',
2923
+ maxHeight: '100%',
2924
+ overflow: 'auto',
2925
+ borderRight: "1px solid " + defaultTheme.grayAlt,
2926
+ display: 'flex',
2927
+ flexDirection: 'column'
2928
+ }
2929
+ }, /*#__PURE__*/React__namespace.createElement("div", {
2930
+ style: {
2931
+ padding: '.5em',
2932
+ background: defaultTheme.backgroundAlt,
2933
+ display: 'flex',
2934
+ justifyContent: 'space-between',
2935
+ alignItems: 'center'
2936
+ }
2937
+ }, /*#__PURE__*/React__namespace.createElement("button", {
2938
+ type: "button",
2939
+ "aria-label": "Close React Query Devtools",
2940
+ "aria-controls": "ReactQueryDevtoolsPanel",
2941
+ "aria-haspopup": "true",
2942
+ "aria-expanded": "true",
2943
+ onClick: () => setIsOpen(false),
2944
+ style: {
2945
+ display: 'inline-flex',
2946
+ background: 'none',
2947
+ border: 0,
2948
+ padding: 0,
2949
+ marginRight: '.5em',
2950
+ cursor: 'pointer'
2951
+ }
2952
+ }, /*#__PURE__*/React__namespace.createElement(Logo, {
2953
+ "aria-hidden": true
2954
+ }), /*#__PURE__*/React__namespace.createElement(ScreenReader, {
2955
+ text: "Close React Query Devtools"
2956
+ })), /*#__PURE__*/React__namespace.createElement("div", {
2957
+ style: {
2958
+ display: 'flex',
2959
+ flexDirection: 'column'
2960
+ }
2961
+ }, /*#__PURE__*/React__namespace.createElement("div", {
2962
+ style: {
2963
+ display: 'flex',
2964
+ justifyContent: 'space-between',
2965
+ alignItems: 'center',
2966
+ marginBottom: '.5em'
2967
+ }
2968
+ }, /*#__PURE__*/React__namespace.createElement(QueryStatusCount, {
2969
+ queryCache: queryCache
2970
+ }), position && onPositionChange ? /*#__PURE__*/React__namespace.createElement(Select, {
2971
+ "aria-label": "Panel position",
2972
+ value: position,
2973
+ style: {
2974
+ marginInlineStart: '.5em'
2975
+ },
2976
+ onChange: e => onPositionChange(e.target.value)
2977
+ }, /*#__PURE__*/React__namespace.createElement("option", {
2978
+ value: "left"
2979
+ }, "Left"), /*#__PURE__*/React__namespace.createElement("option", {
2980
+ value: "right"
2981
+ }, "Right"), /*#__PURE__*/React__namespace.createElement("option", {
2982
+ value: "top"
2983
+ }, "Top"), /*#__PURE__*/React__namespace.createElement("option", {
2984
+ value: "bottom"
2985
+ }, "Bottom")) : null), /*#__PURE__*/React__namespace.createElement("div", {
2986
+ style: {
2987
+ display: 'flex',
2988
+ alignItems: 'center',
2989
+ flexWrap: 'wrap',
2990
+ gap: '0.5em'
2991
+ }
2992
+ }, /*#__PURE__*/React__namespace.createElement(Input, {
2993
+ placeholder: "Filter",
2994
+ "aria-label": "Filter by queryhash",
2995
+ value: filter != null ? filter : '',
2996
+ onChange: e => setFilter(e.target.value),
2997
+ onKeyDown: e => {
2998
+ if (e.key === 'Escape') setFilter('');
2999
+ },
3000
+ style: {
3001
+ flex: '1',
3002
+ width: '100%'
3003
+ }
3004
+ }), /*#__PURE__*/React__namespace.createElement(Select, {
3005
+ "aria-label": "Sort queries",
3006
+ value: sort,
3007
+ onChange: e => setSort(e.target.value),
3008
+ style: {
3009
+ flex: '1',
3010
+ minWidth: 75,
3011
+ marginRight: '.5em'
3012
+ }
3013
+ }, Object.keys(sortFns).map(key => /*#__PURE__*/React__namespace.createElement("option", {
3014
+ key: key,
3015
+ value: key
3016
+ }, "Sort by ", key))), /*#__PURE__*/React__namespace.createElement(Button, {
3017
+ type: "button",
3018
+ onClick: () => setBaseSort(old => old * -1),
3019
+ style: {
3020
+ padding: '.3em .4em',
3021
+ marginRight: '.5em'
3022
+ }
3023
+ }, baseSort === 1 ? '⬆ Asc' : '⬇ Desc'), /*#__PURE__*/React__namespace.createElement(Button, {
3024
+ title: "Clear cache",
3025
+ "aria-label": "Clear cache",
3026
+ type: "button",
3027
+ onClick: () => queryCache.clear(),
3028
+ style: {
3029
+ padding: '.3em .4em',
3030
+ marginRight: '.5em'
3031
+ }
3032
+ }, "Clear"), /*#__PURE__*/React__namespace.createElement(Button, {
3033
+ type: "button",
3034
+ onClick: () => {
3035
+ if (isMockOffline) {
3036
+ reactQuery.onlineManager.setOnline(undefined);
3037
+ setMockOffline(false);
3038
+ window.dispatchEvent(new Event('online'));
3039
+ } else {
3040
+ reactQuery.onlineManager.setOnline(false);
3041
+ setMockOffline(true);
3042
+ }
3043
+ },
3044
+ "aria-label": isMockOffline ? 'Restore offline mock' : 'Mock offline behavior',
3045
+ title: isMockOffline ? 'Restore offline mock' : 'Mock offline behavior',
3046
+ style: {
3047
+ padding: '0',
3048
+ height: '2em'
3049
+ }
3050
+ }, /*#__PURE__*/React__namespace.createElement("svg", {
3051
+ xmlns: "http://www.w3.org/2000/svg",
3052
+ width: "2em",
3053
+ height: "2em",
3054
+ viewBox: "0 0 24 24",
3055
+ stroke: isMockOffline ? defaultTheme.danger : 'currentColor',
3056
+ fill: "none"
3057
+ }, isMockOffline ? /*#__PURE__*/React__namespace.createElement(React__namespace.Fragment, null, /*#__PURE__*/React__namespace.createElement("path", {
3058
+ stroke: "none",
3059
+ d: "M0 0h24v24H0z",
3060
+ fill: "none"
3061
+ }), /*#__PURE__*/React__namespace.createElement("line", {
3062
+ x1: "12",
3063
+ y1: "18",
3064
+ x2: "12.01",
3065
+ y2: "18"
3066
+ }), /*#__PURE__*/React__namespace.createElement("path", {
3067
+ d: "M9.172 15.172a4 4 0 0 1 5.656 0"
3068
+ }), /*#__PURE__*/React__namespace.createElement("path", {
3069
+ d: "M6.343 12.343a7.963 7.963 0 0 1 3.864 -2.14m4.163 .155a7.965 7.965 0 0 1 3.287 2"
3070
+ }), /*#__PURE__*/React__namespace.createElement("path", {
3071
+ d: "M3.515 9.515a12 12 0 0 1 3.544 -2.455m3.101 -.92a12 12 0 0 1 10.325 3.374"
3072
+ }), /*#__PURE__*/React__namespace.createElement("line", {
3073
+ x1: "3",
3074
+ y1: "3",
3075
+ x2: "21",
3076
+ y2: "21"
3077
+ })) : /*#__PURE__*/React__namespace.createElement(React__namespace.Fragment, null, /*#__PURE__*/React__namespace.createElement("path", {
3078
+ stroke: "none",
3079
+ d: "M0 0h24v24H0z",
3080
+ fill: "none"
3081
+ }), /*#__PURE__*/React__namespace.createElement("line", {
3082
+ x1: "12",
3083
+ y1: "18",
3084
+ x2: "12.01",
3085
+ y2: "18"
3086
+ }), /*#__PURE__*/React__namespace.createElement("path", {
3087
+ d: "M9.172 15.172a4 4 0 0 1 5.656 0"
3088
+ }), /*#__PURE__*/React__namespace.createElement("path", {
3089
+ d: "M6.343 12.343a8 8 0 0 1 11.314 0"
3090
+ }), /*#__PURE__*/React__namespace.createElement("path", {
3091
+ d: "M3.515 9.515c4.686 -4.687 12.284 -4.687 17 0"
3092
+ }))), /*#__PURE__*/React__namespace.createElement(ScreenReader, {
3093
+ text: isMockOffline ? 'Restore offline mock' : 'Mock offline behavior'
3094
+ }))))), /*#__PURE__*/React__namespace.createElement("div", {
3095
+ style: {
3096
+ overflowY: 'auto',
3097
+ flex: '1'
3098
+ }
3099
+ }, queries.map(query => {
3100
+ return /*#__PURE__*/React__namespace.createElement(QueryRow, {
3101
+ queryKey: query.queryKey,
3102
+ activeQueryHash: activeQueryHash,
3103
+ setActiveQueryHash: setActiveQueryHash,
3104
+ key: query.queryHash,
3105
+ queryCache: queryCache
3106
+ });
3107
+ }))), activeQueryHash && isOpen ? /*#__PURE__*/React__namespace.createElement(ActiveQuery, {
3108
+ activeQueryHash: activeQueryHash,
3109
+ queryCache: queryCache,
3110
+ queryClient: queryClient,
3111
+ errorTypes: errorTypes
3112
+ }) : null, showCloseButton ? /*#__PURE__*/React__namespace.createElement(Button, _extends({
3113
+ type: "button",
3114
+ "aria-controls": "ReactQueryDevtoolsPanel",
3115
+ "aria-haspopup": "true",
3116
+ "aria-expanded": "true"
3117
+ }, otherCloseButtonProps, {
3118
+ style: {
3119
+ position: 'absolute',
3120
+ zIndex: 99999,
3121
+ margin: '.5em',
3122
+ bottom: 0,
3123
+ left: 0,
3124
+ ...otherCloseButtonProps.style
3125
+ },
3126
+ onClick: e => {
3127
+ setIsOpen(false);
3128
+ onCloseClick == null ? void 0 : onCloseClick(e);
3129
+ }
3130
+ }), "Close") : null));
3131
+ });
3132
+
3133
+ const ActiveQuery = ({
3134
+ queryCache,
3135
+ activeQueryHash,
3136
+ queryClient,
3137
+ errorTypes
3138
+ }) => {
3139
+ var _useSubscribeToQueryC, _useSubscribeToQueryC2;
3140
+
3141
+ const activeQuery = useSubscribeToQueryCache(queryCache, () => queryCache.getAll().find(query => query.queryHash === activeQueryHash));
3142
+ const activeQueryState = useSubscribeToQueryCache(queryCache, () => {
3143
+ var _queryCache$getAll$fi;
3144
+
3145
+ return (_queryCache$getAll$fi = queryCache.getAll().find(query => query.queryHash === activeQueryHash)) == null ? void 0 : _queryCache$getAll$fi.state;
3146
+ });
3147
+ const isStale = (_useSubscribeToQueryC = useSubscribeToQueryCache(queryCache, () => {
3148
+ var _queryCache$getAll$fi2;
3149
+
3150
+ return (_queryCache$getAll$fi2 = queryCache.getAll().find(query => query.queryHash === activeQueryHash)) == null ? void 0 : _queryCache$getAll$fi2.isStale();
3151
+ })) != null ? _useSubscribeToQueryC : false;
3152
+ const observerCount = (_useSubscribeToQueryC2 = useSubscribeToQueryCache(queryCache, () => {
3153
+ var _queryCache$getAll$fi3;
3154
+
3155
+ return (_queryCache$getAll$fi3 = queryCache.getAll().find(query => query.queryHash === activeQueryHash)) == null ? void 0 : _queryCache$getAll$fi3.getObserversCount();
3156
+ })) != null ? _useSubscribeToQueryC2 : 0;
3157
+
3158
+ const handleRefetch = () => {
3159
+ const promise = activeQuery == null ? void 0 : activeQuery.fetch();
3160
+ promise == null ? void 0 : promise.catch(noop);
3161
+ };
3162
+
3163
+ const currentErrorTypeName = React.useMemo(() => {
3164
+ if (activeQuery && activeQueryState != null && activeQueryState.error) {
3165
+ const errorType = errorTypes.find(type => {
3166
+ var _activeQueryState$err;
3167
+
3168
+ return type.initializer(activeQuery).toString() === ((_activeQueryState$err = activeQueryState.error) == null ? void 0 : _activeQueryState$err.toString());
3169
+ });
3170
+ return errorType == null ? void 0 : errorType.name;
3171
+ }
3172
+
3173
+ return undefined;
3174
+ }, [activeQuery, activeQueryState == null ? void 0 : activeQueryState.error, errorTypes]);
3175
+
3176
+ if (!activeQuery || !activeQueryState) {
3177
+ return null;
3178
+ }
3179
+
3180
+ const triggerError = errorType => {
3181
+ var _errorType$initialize;
3182
+
3183
+ const error = (_errorType$initialize = errorType == null ? void 0 : errorType.initializer(activeQuery)) != null ? _errorType$initialize : new Error('Unknown error from devtools');
3184
+ const __previousQueryOptions = activeQuery.options;
3185
+ activeQuery.setState({
3186
+ status: 'error',
3187
+ error,
3188
+ fetchMeta: { ...activeQuery.state.fetchMeta,
3189
+ __previousQueryOptions
3190
+ }
3191
+ });
3192
+ };
3193
+
3194
+ const restoreQueryAfterLoadingOrError = () => {
3195
+ activeQuery.fetch(activeQuery.state.fetchMeta.__previousQueryOptions, {
3196
+ // Make sure this fetch will cancel the previous one
3197
+ cancelRefetch: true
3198
+ });
3199
+ };
3200
+
3201
+ return /*#__PURE__*/React__namespace.createElement(ActiveQueryPanel, null, /*#__PURE__*/React__namespace.createElement("div", {
3202
+ style: {
3203
+ padding: '.5em',
3204
+ background: defaultTheme.backgroundAlt,
3205
+ position: 'sticky',
3206
+ top: 0,
3207
+ zIndex: 1
3208
+ }
3209
+ }, "Query Details"), /*#__PURE__*/React__namespace.createElement("div", {
3210
+ style: {
3211
+ padding: '.5em'
3212
+ }
3213
+ }, /*#__PURE__*/React__namespace.createElement("div", {
3214
+ style: {
3215
+ marginBottom: '.5em',
3216
+ display: 'flex',
3217
+ alignItems: 'flex-start',
3218
+ justifyContent: 'space-between'
3219
+ }
3220
+ }, /*#__PURE__*/React__namespace.createElement(Code, {
3221
+ style: {
3222
+ lineHeight: '1.8em'
3223
+ }
3224
+ }, /*#__PURE__*/React__namespace.createElement("pre", {
3225
+ style: {
3226
+ margin: 0,
3227
+ padding: 0,
3228
+ overflow: 'auto'
3229
+ }
3230
+ }, displayValue(activeQuery.queryKey, true))), /*#__PURE__*/React__namespace.createElement("span", {
3231
+ style: {
3232
+ padding: '0.3em .6em',
3233
+ borderRadius: '0.4em',
3234
+ fontWeight: 'bold',
3235
+ textShadow: '0 2px 10px black',
3236
+ background: getQueryStatusColor({
3237
+ queryState: activeQueryState,
3238
+ isStale: isStale,
3239
+ observerCount: observerCount,
3240
+ theme: defaultTheme
3241
+ }),
3242
+ flexShrink: 0
3243
+ }
3244
+ }, getQueryStatusLabel(activeQuery))), /*#__PURE__*/React__namespace.createElement("div", {
3245
+ style: {
3246
+ marginBottom: '.5em',
3247
+ display: 'flex',
3248
+ alignItems: 'center',
3249
+ justifyContent: 'space-between'
3250
+ }
3251
+ }, "Observers: ", /*#__PURE__*/React__namespace.createElement(Code, null, observerCount)), /*#__PURE__*/React__namespace.createElement("div", {
3252
+ style: {
3253
+ display: 'flex',
3254
+ alignItems: 'center',
3255
+ justifyContent: 'space-between'
3256
+ }
3257
+ }, "Last Updated:", ' ', /*#__PURE__*/React__namespace.createElement(Code, null, new Date(activeQueryState.dataUpdatedAt).toLocaleTimeString()))), /*#__PURE__*/React__namespace.createElement("div", {
3258
+ style: {
3259
+ background: defaultTheme.backgroundAlt,
3260
+ padding: '.5em',
3261
+ position: 'sticky',
3262
+ top: 0,
3263
+ zIndex: 1
3264
+ }
3265
+ }, "Actions"), /*#__PURE__*/React__namespace.createElement("div", {
3266
+ style: {
3267
+ padding: '0.5em',
3268
+ display: 'flex',
3269
+ flexWrap: 'wrap',
3270
+ gap: '0.5em',
3271
+ alignItems: 'flex-end'
3272
+ }
3273
+ }, /*#__PURE__*/React__namespace.createElement(Button, {
3274
+ type: "button",
3275
+ onClick: handleRefetch,
3276
+ disabled: activeQueryState.fetchStatus === 'fetching',
3277
+ style: {
3278
+ background: defaultTheme.active
3279
+ }
3280
+ }, "Refetch"), ' ', /*#__PURE__*/React__namespace.createElement(Button, {
3281
+ type: "button",
3282
+ onClick: () => queryClient.invalidateQueries(activeQuery),
3283
+ style: {
3284
+ background: defaultTheme.warning,
3285
+ color: defaultTheme.inputTextColor
3286
+ }
3287
+ }, "Invalidate"), ' ', /*#__PURE__*/React__namespace.createElement(Button, {
3288
+ type: "button",
3289
+ onClick: () => queryClient.resetQueries(activeQuery),
3290
+ style: {
3291
+ background: defaultTheme.gray
3292
+ }
3293
+ }, "Reset"), ' ', /*#__PURE__*/React__namespace.createElement(Button, {
3294
+ type: "button",
3295
+ onClick: () => queryClient.removeQueries(activeQuery),
3296
+ style: {
3297
+ background: defaultTheme.danger
3298
+ }
3299
+ }, "Remove"), ' ', /*#__PURE__*/React__namespace.createElement(Button, {
3300
+ type: "button",
3301
+ onClick: () => {
3302
+ var _activeQuery$state$fe;
3303
+
3304
+ // Return early if the query is already restoring
3305
+ if (activeQuery.state.fetchStatus === 'fetching' && typeof ((_activeQuery$state$fe = activeQuery.state.fetchMeta) == null ? void 0 : _activeQuery$state$fe.__previousQueryOptions) === 'undefined') {
3306
+ return;
3307
+ }
3308
+
3309
+ if (activeQuery.state.data === undefined) {
3310
+ restoreQueryAfterLoadingOrError();
3311
+ } else {
3312
+ const __previousQueryOptions = activeQuery.options; // Trigger a fetch in order to trigger suspense as well.
3313
+
3314
+ activeQuery.fetch({ ...__previousQueryOptions,
3315
+ queryFn: () => {
3316
+ return new Promise(() => {// Never resolve
3317
+ });
3318
+ },
3319
+ cacheTime: -1
3320
+ });
3321
+ activeQuery.setState({
3322
+ data: undefined,
3323
+ status: 'loading',
3324
+ fetchMeta: { ...activeQuery.state.fetchMeta,
3325
+ __previousQueryOptions
3326
+ }
3327
+ });
3328
+ }
3329
+ },
3330
+ style: {
3331
+ background: defaultTheme.paused
3332
+ }
3333
+ }, activeQuery.state.status === 'loading' ? 'Restore' : 'Trigger', ' ', "loading"), ' ', errorTypes.length === 0 || activeQuery.state.status === 'error' ? /*#__PURE__*/React__namespace.createElement(Button, {
3334
+ type: "button",
3335
+ onClick: () => {
3336
+ if (!activeQuery.state.error) {
3337
+ triggerError();
3338
+ } else {
3339
+ queryClient.resetQueries(activeQuery);
3340
+ }
3341
+ },
3342
+ style: {
3343
+ background: defaultTheme.danger
3344
+ }
3345
+ }, activeQuery.state.status === 'error' ? 'Restore' : 'Trigger', " error") : /*#__PURE__*/React__namespace.createElement("label", null, "Trigger error:", /*#__PURE__*/React__namespace.createElement(Select, {
3346
+ value: currentErrorTypeName != null ? currentErrorTypeName : '',
3347
+ style: {
3348
+ marginInlineStart: '.5em'
3349
+ },
3350
+ onChange: e => {
3351
+ const errorType = errorTypes.find(t => t.name === e.target.value);
3352
+ triggerError(errorType);
3353
+ }
3354
+ }, /*#__PURE__*/React__namespace.createElement("option", {
3355
+ key: "",
3356
+ value: ""
3357
+ }), errorTypes.map(errorType => /*#__PURE__*/React__namespace.createElement("option", {
3358
+ key: errorType.name,
3359
+ value: errorType.name
3360
+ }, errorType.name))))), /*#__PURE__*/React__namespace.createElement("div", {
3361
+ style: {
3362
+ background: defaultTheme.backgroundAlt,
3363
+ padding: '.5em',
3364
+ position: 'sticky',
3365
+ top: 0,
3366
+ zIndex: 1
3367
+ }
3368
+ }, "Data Explorer"), /*#__PURE__*/React__namespace.createElement("div", {
3369
+ style: {
3370
+ padding: '.5em'
3371
+ }
3372
+ }, /*#__PURE__*/React__namespace.createElement(Explorer, {
3373
+ label: "Data",
3374
+ value: activeQueryState.data,
3375
+ defaultExpanded: {},
3376
+ copyable: true
3377
+ })), /*#__PURE__*/React__namespace.createElement("div", {
3378
+ style: {
3379
+ background: defaultTheme.backgroundAlt,
3380
+ padding: '.5em',
3381
+ position: 'sticky',
3382
+ top: 0,
3383
+ zIndex: 1
3384
+ }
3385
+ }, "Query Explorer"), /*#__PURE__*/React__namespace.createElement("div", {
3386
+ style: {
3387
+ padding: '.5em'
3388
+ }
3389
+ }, /*#__PURE__*/React__namespace.createElement(Explorer, {
3390
+ label: "Query",
3391
+ value: activeQuery,
3392
+ defaultExpanded: {
3393
+ queryKey: true
3394
+ }
3395
+ })));
3396
+ };
3397
+
3398
+ const QueryStatusCount = ({
3399
+ queryCache
3400
+ }) => {
3401
+ const hasFresh = useSubscribeToQueryCache(queryCache, () => queryCache.getAll().filter(q => getQueryStatusLabel(q) === 'fresh').length);
3402
+ const hasFetching = useSubscribeToQueryCache(queryCache, () => queryCache.getAll().filter(q => getQueryStatusLabel(q) === 'fetching').length);
3403
+ const hasPaused = useSubscribeToQueryCache(queryCache, () => queryCache.getAll().filter(q => getQueryStatusLabel(q) === 'paused').length);
3404
+ const hasStale = useSubscribeToQueryCache(queryCache, () => queryCache.getAll().filter(q => getQueryStatusLabel(q) === 'stale').length);
3405
+ const hasInactive = useSubscribeToQueryCache(queryCache, () => queryCache.getAll().filter(q => getQueryStatusLabel(q) === 'inactive').length);
3406
+ return /*#__PURE__*/React__namespace.createElement(QueryKeys, null, /*#__PURE__*/React__namespace.createElement(QueryKey, {
3407
+ style: {
3408
+ background: defaultTheme.success,
3409
+ opacity: hasFresh ? 1 : 0.3
3410
+ }
3411
+ }, "fresh ", /*#__PURE__*/React__namespace.createElement(Code, null, "(", hasFresh, ")")), ' ', /*#__PURE__*/React__namespace.createElement(QueryKey, {
3412
+ style: {
3413
+ background: defaultTheme.active,
3414
+ opacity: hasFetching ? 1 : 0.3
3415
+ }
3416
+ }, "fetching ", /*#__PURE__*/React__namespace.createElement(Code, null, "(", hasFetching, ")")), ' ', /*#__PURE__*/React__namespace.createElement(QueryKey, {
3417
+ style: {
3418
+ background: defaultTheme.paused,
3419
+ opacity: hasPaused ? 1 : 0.3
3420
+ }
3421
+ }, "paused ", /*#__PURE__*/React__namespace.createElement(Code, null, "(", hasPaused, ")")), ' ', /*#__PURE__*/React__namespace.createElement(QueryKey, {
3422
+ style: {
3423
+ background: defaultTheme.warning,
3424
+ color: 'black',
3425
+ textShadow: '0',
3426
+ opacity: hasStale ? 1 : 0.3
3427
+ }
3428
+ }, "stale ", /*#__PURE__*/React__namespace.createElement(Code, null, "(", hasStale, ")")), ' ', /*#__PURE__*/React__namespace.createElement(QueryKey, {
3429
+ style: {
3430
+ background: defaultTheme.gray,
3431
+ opacity: hasInactive ? 1 : 0.3
3432
+ }
3433
+ }, "inactive ", /*#__PURE__*/React__namespace.createElement(Code, null, "(", hasInactive, ")")));
3434
+ };
3435
+
3436
+ const QueryRow = /*#__PURE__*/React__namespace.memo(({
3437
+ queryKey,
3438
+ setActiveQueryHash,
3439
+ activeQueryHash,
3440
+ queryCache
3441
+ }) => {
3442
+ var _useSubscribeToQueryC3, _useSubscribeToQueryC4, _useSubscribeToQueryC5, _useSubscribeToQueryC6;
3443
+
3444
+ const queryHash = (_useSubscribeToQueryC3 = useSubscribeToQueryCache(queryCache, () => {
3445
+ var _queryCache$find;
3446
+
3447
+ return (_queryCache$find = queryCache.find(queryKey)) == null ? void 0 : _queryCache$find.queryHash;
3448
+ })) != null ? _useSubscribeToQueryC3 : '';
3449
+ const queryState = useSubscribeToQueryCache(queryCache, () => {
3450
+ var _queryCache$find2;
3451
+
3452
+ return (_queryCache$find2 = queryCache.find(queryKey)) == null ? void 0 : _queryCache$find2.state;
3453
+ });
3454
+ const isStale = (_useSubscribeToQueryC4 = useSubscribeToQueryCache(queryCache, () => {
3455
+ var _queryCache$find3;
3456
+
3457
+ return (_queryCache$find3 = queryCache.find(queryKey)) == null ? void 0 : _queryCache$find3.isStale();
3458
+ })) != null ? _useSubscribeToQueryC4 : false;
3459
+ const isDisabled = (_useSubscribeToQueryC5 = useSubscribeToQueryCache(queryCache, () => {
3460
+ var _queryCache$find4;
3461
+
3462
+ return (_queryCache$find4 = queryCache.find(queryKey)) == null ? void 0 : _queryCache$find4.isDisabled();
3463
+ })) != null ? _useSubscribeToQueryC5 : false;
3464
+ const observerCount = (_useSubscribeToQueryC6 = useSubscribeToQueryCache(queryCache, () => {
3465
+ var _queryCache$find5;
3466
+
3467
+ return (_queryCache$find5 = queryCache.find(queryKey)) == null ? void 0 : _queryCache$find5.getObserversCount();
3468
+ })) != null ? _useSubscribeToQueryC6 : 0;
3469
+
3470
+ if (!queryState) {
3471
+ return null;
3472
+ }
3473
+
3474
+ return /*#__PURE__*/React__namespace.createElement("div", {
3475
+ role: "button",
3476
+ "aria-label": "Open query details for " + queryHash,
3477
+ onClick: () => setActiveQueryHash(activeQueryHash === queryHash ? '' : queryHash),
3478
+ style: {
3479
+ display: 'flex',
3480
+ borderBottom: "solid 1px " + defaultTheme.grayAlt,
3481
+ cursor: 'pointer',
3482
+ background: queryHash === activeQueryHash ? 'rgba(255,255,255,.1)' : undefined
3483
+ }
3484
+ }, /*#__PURE__*/React__namespace.createElement("div", {
3485
+ style: {
3486
+ flex: '0 0 auto',
3487
+ width: '2em',
3488
+ height: '2em',
3489
+ background: getQueryStatusColor({
3490
+ queryState,
3491
+ isStale,
3492
+ observerCount,
3493
+ theme: defaultTheme
3494
+ }),
3495
+ display: 'flex',
3496
+ alignItems: 'center',
3497
+ justifyContent: 'center',
3498
+ fontWeight: 'bold',
3499
+ textShadow: isStale ? '0' : '0 0 10px black',
3500
+ color: isStale ? 'black' : 'white'
3501
+ }
3502
+ }, observerCount), isDisabled ? /*#__PURE__*/React__namespace.createElement("div", {
3503
+ style: {
3504
+ flex: '0 0 auto',
3505
+ height: '2em',
3506
+ background: defaultTheme.gray,
3507
+ display: 'flex',
3508
+ alignItems: 'center',
3509
+ fontWeight: 'bold',
3510
+ padding: '0 0.5em'
3511
+ }
3512
+ }, "disabled") : null, /*#__PURE__*/React__namespace.createElement(Code, {
3513
+ style: {
3514
+ padding: '.5em'
3515
+ }
3516
+ }, "" + queryHash));
3517
+ });
3518
+ QueryRow.displayName = 'QueryRow'; // eslint-disable-next-line @typescript-eslint/no-empty-function
3519
+
3520
+ function noop() {}
3521
+
3522
+ const ReactQueryDevtools = ReactQueryDevtools$1;
3523
+ const ReactQueryDevtoolsPanel = ReactQueryDevtoolsPanel$1;
3524
+
3525
+ exports.ReactQueryDevtools = ReactQueryDevtools;
3526
+ exports.ReactQueryDevtoolsPanel = ReactQueryDevtoolsPanel;
3527
+
3528
+ Object.defineProperty(exports, '__esModule', { value: true });
3529
+
3530
+ }));
3531
+ //# sourceMappingURL=index.development.js.map