@scrippsproduct/networks-ui-library 1.1.1 → 1.1.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.
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
var pe = (e) => {
|
|
2
2
|
throw TypeError(e);
|
|
3
3
|
};
|
|
4
|
-
var
|
|
5
|
-
var r = (e, t, s) => (
|
|
6
|
-
var
|
|
4
|
+
var Wt = (e, t, s) => t.has(e) || pe("Cannot " + s);
|
|
5
|
+
var r = (e, t, s) => (Wt(e, t, "read from private field"), s ? s.call(e) : t.get(e)), c = (e, t, s) => t.has(e) ? pe("Cannot add the same private member more than once") : t instanceof WeakSet ? t.add(e) : t.set(e, s), o = (e, t, s, i) => (Wt(e, t, "write to private field"), i ? i.call(e, s) : t.set(e, s), s), v = (e, t, s) => (Wt(e, t, "access private method"), s);
|
|
6
|
+
var Ht = (e, t, s, i) => ({
|
|
7
7
|
set _(n) {
|
|
8
8
|
o(e, t, n, s);
|
|
9
9
|
},
|
|
@@ -11,11 +11,11 @@ var Gt = (e, t, s, i) => ({
|
|
|
11
11
|
return r(e, t, i);
|
|
12
12
|
}
|
|
13
13
|
});
|
|
14
|
-
import { jsx as
|
|
15
|
-
import * as
|
|
14
|
+
import { jsx as Vt } from "react/jsx-runtime";
|
|
15
|
+
import * as K from "react";
|
|
16
16
|
import { createContext as $e, useState as me, useRef as We, useCallback as Je, useEffect as ve, useMemo as Ze } from "react";
|
|
17
|
-
import { f as
|
|
18
|
-
import { l as
|
|
17
|
+
import { f as Jt } from "../../format-YhWt2D8M.mjs";
|
|
18
|
+
import { l as Gt } from "../../logger-C0N7U0YY.mjs";
|
|
19
19
|
var Kt = class {
|
|
20
20
|
constructor() {
|
|
21
21
|
this.listeners = /* @__PURE__ */ new Set(), this.subscribe = this.subscribe.bind(this);
|
|
@@ -47,7 +47,7 @@ var Kt = class {
|
|
|
47
47
|
clearTimeout: (e) => clearTimeout(e),
|
|
48
48
|
setInterval: (e, t) => setInterval(e, t),
|
|
49
49
|
clearInterval: (e) => clearInterval(e)
|
|
50
|
-
}, G,
|
|
50
|
+
}, G, ht, Qe, Ye = (Qe = class {
|
|
51
51
|
constructor() {
|
|
52
52
|
// We cannot have TimeoutManager<T> as we must instantiate it with a concrete
|
|
53
53
|
// type at app boot; and if we leave that type, then any new timer provider
|
|
@@ -56,31 +56,31 @@ var Kt = class {
|
|
|
56
56
|
// We settle for type safety for the TimeoutProvider type, and accept that
|
|
57
57
|
// this class is unsafe internally to allow for extension.
|
|
58
58
|
c(this, G, Xe);
|
|
59
|
-
c(this,
|
|
59
|
+
c(this, ht, !1);
|
|
60
60
|
}
|
|
61
61
|
setTimeoutProvider(e) {
|
|
62
|
-
process.env.NODE_ENV !== "production" && r(this,
|
|
62
|
+
process.env.NODE_ENV !== "production" && r(this, ht) && e !== r(this, G) && console.error(
|
|
63
63
|
"[timeoutManager]: Switching provider after calls to previous provider might result in unexpected behavior.",
|
|
64
64
|
{ previous: r(this, G), provider: e }
|
|
65
|
-
), o(this, G, e), process.env.NODE_ENV !== "production" && o(this,
|
|
65
|
+
), o(this, G, e), process.env.NODE_ENV !== "production" && o(this, ht, !1);
|
|
66
66
|
}
|
|
67
67
|
setTimeout(e, t) {
|
|
68
|
-
return process.env.NODE_ENV !== "production" && o(this,
|
|
68
|
+
return process.env.NODE_ENV !== "production" && o(this, ht, !0), r(this, G).setTimeout(e, t);
|
|
69
69
|
}
|
|
70
70
|
clearTimeout(e) {
|
|
71
71
|
r(this, G).clearTimeout(e);
|
|
72
72
|
}
|
|
73
73
|
setInterval(e, t) {
|
|
74
|
-
return process.env.NODE_ENV !== "production" && o(this,
|
|
74
|
+
return process.env.NODE_ENV !== "production" && o(this, ht, !0), r(this, G).setInterval(e, t);
|
|
75
75
|
}
|
|
76
76
|
clearInterval(e) {
|
|
77
77
|
r(this, G).clearInterval(e);
|
|
78
78
|
}
|
|
79
|
-
}, G = new WeakMap(),
|
|
79
|
+
}, G = new WeakMap(), ht = new WeakMap(), Qe), ut = new Ye();
|
|
80
80
|
function ts(e) {
|
|
81
81
|
setTimeout(e, 0);
|
|
82
82
|
}
|
|
83
|
-
var
|
|
83
|
+
var bt = typeof window > "u" || "Deno" in globalThis;
|
|
84
84
|
function j() {
|
|
85
85
|
}
|
|
86
86
|
function es(e, t) {
|
|
@@ -92,7 +92,7 @@ function Zt(e) {
|
|
|
92
92
|
function _e(e, t) {
|
|
93
93
|
return Math.max(e + (t || 0) - Date.now(), 0);
|
|
94
94
|
}
|
|
95
|
-
function
|
|
95
|
+
function ot(e, t) {
|
|
96
96
|
return typeof e == "function" ? e(t) : e;
|
|
97
97
|
}
|
|
98
98
|
function k(e, t) {
|
|
@@ -111,7 +111,7 @@ function ge(e, t) {
|
|
|
111
111
|
if (i) {
|
|
112
112
|
if (t.queryHash !== de(h, t.options))
|
|
113
113
|
return !1;
|
|
114
|
-
} else if (!
|
|
114
|
+
} else if (!xt(t.queryKey, h))
|
|
115
115
|
return !1;
|
|
116
116
|
}
|
|
117
117
|
if (s !== "all") {
|
|
@@ -127,24 +127,24 @@ function be(e, t) {
|
|
|
127
127
|
if (!t.options.mutationKey)
|
|
128
128
|
return !1;
|
|
129
129
|
if (s) {
|
|
130
|
-
if (
|
|
130
|
+
if (At(t.options.mutationKey) !== At(a))
|
|
131
131
|
return !1;
|
|
132
|
-
} else if (!
|
|
132
|
+
} else if (!xt(t.options.mutationKey, a))
|
|
133
133
|
return !1;
|
|
134
134
|
}
|
|
135
135
|
return !(i && t.state.status !== i || n && !n(t));
|
|
136
136
|
}
|
|
137
137
|
function de(e, t) {
|
|
138
|
-
return ((t == null ? void 0 : t.queryKeyHashFn) ||
|
|
138
|
+
return ((t == null ? void 0 : t.queryKeyHashFn) || At)(e);
|
|
139
139
|
}
|
|
140
|
-
function
|
|
140
|
+
function At(e) {
|
|
141
141
|
return JSON.stringify(
|
|
142
142
|
e,
|
|
143
143
|
(t, s) => te(s) ? Object.keys(s).sort().reduce((i, n) => (i[n] = s[n], i), {}) : s
|
|
144
144
|
);
|
|
145
145
|
}
|
|
146
|
-
function
|
|
147
|
-
return e === t ? !0 : typeof e != typeof t ? !1 : e && t && typeof e == "object" && typeof t == "object" ? Object.keys(t).every((s) =>
|
|
146
|
+
function xt(e, t) {
|
|
147
|
+
return e === t ? !0 : typeof e != typeof t ? !1 : e && t && typeof e == "object" && typeof t == "object" ? Object.keys(t).every((s) => xt(e[s], t[s])) : !1;
|
|
148
148
|
}
|
|
149
149
|
var ss = Object.prototype.hasOwnProperty;
|
|
150
150
|
function Xt(e, t) {
|
|
@@ -155,17 +155,17 @@ function Xt(e, t) {
|
|
|
155
155
|
const n = (s ? e : Object.keys(e)).length, a = s ? t : Object.keys(t), h = a.length, u = s ? new Array(h) : {};
|
|
156
156
|
let d = 0;
|
|
157
157
|
for (let b = 0; b < h; b++) {
|
|
158
|
-
const
|
|
159
|
-
if (f ===
|
|
160
|
-
u[
|
|
158
|
+
const O = s ? b : a[b], f = e[O], P = t[O];
|
|
159
|
+
if (f === P) {
|
|
160
|
+
u[O] = f, (s ? b < n : ss.call(e, O)) && d++;
|
|
161
161
|
continue;
|
|
162
162
|
}
|
|
163
|
-
if (f === null ||
|
|
164
|
-
u[
|
|
163
|
+
if (f === null || P === null || typeof f != "object" || typeof P != "object") {
|
|
164
|
+
u[O] = P;
|
|
165
165
|
continue;
|
|
166
166
|
}
|
|
167
|
-
const y = Xt(f,
|
|
168
|
-
u[
|
|
167
|
+
const y = Xt(f, P);
|
|
168
|
+
u[O] = y, y === f && d++;
|
|
169
169
|
}
|
|
170
170
|
return n === h && d === n ? e : u;
|
|
171
171
|
}
|
|
@@ -194,7 +194,7 @@ function Se(e) {
|
|
|
194
194
|
}
|
|
195
195
|
function rs(e) {
|
|
196
196
|
return new Promise((t) => {
|
|
197
|
-
|
|
197
|
+
ut.setTimeout(t, e);
|
|
198
198
|
});
|
|
199
199
|
}
|
|
200
200
|
function ee(e, t, s) {
|
|
@@ -221,23 +221,23 @@ function ns(e, t, s = 0) {
|
|
|
221
221
|
const i = [t, ...e];
|
|
222
222
|
return s && i.length > s ? i.slice(0, -1) : i;
|
|
223
223
|
}
|
|
224
|
-
var
|
|
224
|
+
var zt = Symbol();
|
|
225
225
|
function ke(e, t) {
|
|
226
|
-
return process.env.NODE_ENV !== "production" && e.queryFn ===
|
|
226
|
+
return process.env.NODE_ENV !== "production" && e.queryFn === zt && console.error(
|
|
227
227
|
`Attempted to invoke queryFn when set to skipToken. This is likely a configuration error. Query hash: '${e.queryHash}'`
|
|
228
|
-
), !e.queryFn && (t != null && t.initialPromise) ? () => t.initialPromise : !e.queryFn || e.queryFn ===
|
|
228
|
+
), !e.queryFn && (t != null && t.initialPromise) ? () => t.initialPromise : !e.queryFn || e.queryFn === zt ? () => Promise.reject(new Error(`Missing queryFn: '${e.queryHash}'`)) : e.queryFn;
|
|
229
229
|
}
|
|
230
230
|
function as(e, t) {
|
|
231
231
|
return typeof e == "function" ? e(...t) : !!e;
|
|
232
232
|
}
|
|
233
|
-
var
|
|
233
|
+
var ct, tt, St, De, os = (De = class extends Kt {
|
|
234
234
|
constructor() {
|
|
235
235
|
super();
|
|
236
|
-
c(this,
|
|
237
|
-
c(this,
|
|
238
|
-
c(this,
|
|
239
|
-
o(this,
|
|
240
|
-
if (!
|
|
236
|
+
c(this, ct);
|
|
237
|
+
c(this, tt);
|
|
238
|
+
c(this, St);
|
|
239
|
+
o(this, St, (t) => {
|
|
240
|
+
if (!bt && window.addEventListener) {
|
|
241
241
|
const s = () => t();
|
|
242
242
|
return window.addEventListener("visibilitychange", s, !1), () => {
|
|
243
243
|
window.removeEventListener("visibilitychange", s);
|
|
@@ -246,20 +246,20 @@ var lt, et, Ct, De, os = (De = class extends Kt {
|
|
|
246
246
|
});
|
|
247
247
|
}
|
|
248
248
|
onSubscribe() {
|
|
249
|
-
r(this,
|
|
249
|
+
r(this, tt) || this.setEventListener(r(this, St));
|
|
250
250
|
}
|
|
251
251
|
onUnsubscribe() {
|
|
252
252
|
var t;
|
|
253
|
-
this.hasListeners() || ((t = r(this,
|
|
253
|
+
this.hasListeners() || ((t = r(this, tt)) == null || t.call(this), o(this, tt, void 0));
|
|
254
254
|
}
|
|
255
255
|
setEventListener(t) {
|
|
256
256
|
var s;
|
|
257
|
-
o(this,
|
|
257
|
+
o(this, St, t), (s = r(this, tt)) == null || s.call(this), o(this, tt, t((i) => {
|
|
258
258
|
typeof i == "boolean" ? this.setFocused(i) : this.onFocus();
|
|
259
259
|
}));
|
|
260
260
|
}
|
|
261
261
|
setFocused(t) {
|
|
262
|
-
r(this,
|
|
262
|
+
r(this, ct) !== t && (o(this, ct, t), this.onFocus());
|
|
263
263
|
}
|
|
264
264
|
onFocus() {
|
|
265
265
|
const t = this.isFocused();
|
|
@@ -269,9 +269,9 @@ var lt, et, Ct, De, os = (De = class extends Kt {
|
|
|
269
269
|
}
|
|
270
270
|
isFocused() {
|
|
271
271
|
var t;
|
|
272
|
-
return typeof r(this,
|
|
272
|
+
return typeof r(this, ct) == "boolean" ? r(this, ct) : ((t = globalThis.document) == null ? void 0 : t.visibilityState) !== "hidden";
|
|
273
273
|
}
|
|
274
|
-
},
|
|
274
|
+
}, ct = new WeakMap(), tt = new WeakMap(), St = new WeakMap(), De), fe = new os();
|
|
275
275
|
function se() {
|
|
276
276
|
let e, t;
|
|
277
277
|
const s = new Promise((n, a) => {
|
|
@@ -354,14 +354,14 @@ function hs() {
|
|
|
354
354
|
}
|
|
355
355
|
};
|
|
356
356
|
}
|
|
357
|
-
var T = hs(),
|
|
357
|
+
var T = hs(), Ct, et, Ot, Te, cs = (Te = class extends Kt {
|
|
358
358
|
constructor() {
|
|
359
359
|
super();
|
|
360
|
-
c(this,
|
|
361
|
-
c(this,
|
|
362
|
-
c(this,
|
|
363
|
-
o(this,
|
|
364
|
-
if (!
|
|
360
|
+
c(this, Ct, !0);
|
|
361
|
+
c(this, et);
|
|
362
|
+
c(this, Ot);
|
|
363
|
+
o(this, Ot, (t) => {
|
|
364
|
+
if (!bt && window.addEventListener) {
|
|
365
365
|
const s = () => t(!0), i = () => t(!1);
|
|
366
366
|
return window.addEventListener("online", s, !1), window.addEventListener("offline", i, !1), () => {
|
|
367
367
|
window.removeEventListener("online", s), window.removeEventListener("offline", i);
|
|
@@ -370,56 +370,56 @@ var T = hs(), Ot, st, Et, Te, cs = (Te = class extends Kt {
|
|
|
370
370
|
});
|
|
371
371
|
}
|
|
372
372
|
onSubscribe() {
|
|
373
|
-
r(this,
|
|
373
|
+
r(this, et) || this.setEventListener(r(this, Ot));
|
|
374
374
|
}
|
|
375
375
|
onUnsubscribe() {
|
|
376
376
|
var t;
|
|
377
|
-
this.hasListeners() || ((t = r(this,
|
|
377
|
+
this.hasListeners() || ((t = r(this, et)) == null || t.call(this), o(this, et, void 0));
|
|
378
378
|
}
|
|
379
379
|
setEventListener(t) {
|
|
380
380
|
var s;
|
|
381
|
-
o(this,
|
|
381
|
+
o(this, Ot, t), (s = r(this, et)) == null || s.call(this), o(this, et, t(this.setOnline.bind(this)));
|
|
382
382
|
}
|
|
383
383
|
setOnline(t) {
|
|
384
|
-
r(this,
|
|
384
|
+
r(this, Ct) !== t && (o(this, Ct, t), this.listeners.forEach((i) => {
|
|
385
385
|
i(t);
|
|
386
386
|
}));
|
|
387
387
|
}
|
|
388
388
|
isOnline() {
|
|
389
|
-
return r(this,
|
|
389
|
+
return r(this, Ct);
|
|
390
390
|
}
|
|
391
|
-
},
|
|
391
|
+
}, Ct = new WeakMap(), et = new WeakMap(), Ot = new WeakMap(), Te), $t = new cs();
|
|
392
392
|
function ls(e) {
|
|
393
393
|
return Math.min(1e3 * 2 ** e, 3e4);
|
|
394
394
|
}
|
|
395
|
-
function
|
|
396
|
-
return (e ?? "online") === "online" ?
|
|
395
|
+
function Ke(e) {
|
|
396
|
+
return (e ?? "online") === "online" ? $t.isOnline() : !0;
|
|
397
397
|
}
|
|
398
398
|
var re = class extends Error {
|
|
399
399
|
constructor(e) {
|
|
400
400
|
super("CancelledError"), this.revert = e == null ? void 0 : e.revert, this.silent = e == null ? void 0 : e.silent;
|
|
401
401
|
}
|
|
402
402
|
};
|
|
403
|
-
function
|
|
403
|
+
function Le(e) {
|
|
404
404
|
let t = !1, s = 0, i;
|
|
405
405
|
const n = se(), a = () => n.status !== "pending", h = (m) => {
|
|
406
406
|
var p;
|
|
407
407
|
if (!a()) {
|
|
408
|
-
const
|
|
409
|
-
C
|
|
408
|
+
const C = new re(m);
|
|
409
|
+
P(C), (p = e.onCancel) == null || p.call(e, C);
|
|
410
410
|
}
|
|
411
411
|
}, u = () => {
|
|
412
412
|
t = !0;
|
|
413
413
|
}, d = () => {
|
|
414
414
|
t = !1;
|
|
415
|
-
}, b = () => fe.isFocused() && (e.networkMode === "always" ||
|
|
415
|
+
}, b = () => fe.isFocused() && (e.networkMode === "always" || $t.isOnline()) && e.canRun(), O = () => Ke(e.networkMode) && e.canRun(), f = (m) => {
|
|
416
416
|
a() || (i == null || i(), n.resolve(m));
|
|
417
|
-
},
|
|
417
|
+
}, P = (m) => {
|
|
418
418
|
a() || (i == null || i(), n.reject(m));
|
|
419
419
|
}, y = () => new Promise((m) => {
|
|
420
420
|
var p;
|
|
421
|
-
i = (
|
|
422
|
-
(a() || b()) && m(
|
|
421
|
+
i = (C) => {
|
|
422
|
+
(a() || b()) && m(C);
|
|
423
423
|
}, (p = e.onPause) == null || p.call(e);
|
|
424
424
|
}).then(() => {
|
|
425
425
|
var m;
|
|
@@ -431,20 +431,20 @@ function Ke(e) {
|
|
|
431
431
|
const p = s === 0 ? e.initialPromise : void 0;
|
|
432
432
|
try {
|
|
433
433
|
m = p ?? e.fn();
|
|
434
|
-
} catch (
|
|
435
|
-
m = Promise.reject(
|
|
434
|
+
} catch (C) {
|
|
435
|
+
m = Promise.reject(C);
|
|
436
436
|
}
|
|
437
|
-
Promise.resolve(m).then(f).catch((
|
|
437
|
+
Promise.resolve(m).then(f).catch((C) => {
|
|
438
438
|
var x;
|
|
439
439
|
if (a())
|
|
440
440
|
return;
|
|
441
|
-
const M = e.retry ?? (
|
|
441
|
+
const M = e.retry ?? (bt ? 0 : 3), E = e.retryDelay ?? ls, l = typeof E == "function" ? E(s, C) : E, Q = M === !0 || typeof M == "number" && s < M || typeof M == "function" && M(s, C);
|
|
442
442
|
if (t || !Q) {
|
|
443
|
-
C
|
|
443
|
+
P(C);
|
|
444
444
|
return;
|
|
445
445
|
}
|
|
446
|
-
s++, (x = e.onFail) == null || x.call(e, s,
|
|
447
|
-
t ? C
|
|
446
|
+
s++, (x = e.onFail) == null || x.call(e, s, C), rs(l).then(() => b() ? void 0 : y()).then(() => {
|
|
447
|
+
t ? P(C) : R();
|
|
448
448
|
});
|
|
449
449
|
});
|
|
450
450
|
};
|
|
@@ -455,43 +455,43 @@ function Ke(e) {
|
|
|
455
455
|
continue: () => (i == null || i(), n),
|
|
456
456
|
cancelRetry: u,
|
|
457
457
|
continueRetry: d,
|
|
458
|
-
canStart:
|
|
459
|
-
start: () => (
|
|
458
|
+
canStart: O,
|
|
459
|
+
start: () => (O() ? R() : y().then(R), n)
|
|
460
460
|
};
|
|
461
461
|
}
|
|
462
|
-
var
|
|
462
|
+
var lt, Ie, He = (Ie = class {
|
|
463
463
|
constructor() {
|
|
464
|
-
c(this,
|
|
464
|
+
c(this, lt);
|
|
465
465
|
}
|
|
466
466
|
destroy() {
|
|
467
467
|
this.clearGcTimeout();
|
|
468
468
|
}
|
|
469
469
|
scheduleGc() {
|
|
470
|
-
this.clearGcTimeout(), Zt(this.gcTime) && o(this,
|
|
470
|
+
this.clearGcTimeout(), Zt(this.gcTime) && o(this, lt, ut.setTimeout(() => {
|
|
471
471
|
this.optionalRemove();
|
|
472
472
|
}, this.gcTime));
|
|
473
473
|
}
|
|
474
474
|
updateGcTime(e) {
|
|
475
475
|
this.gcTime = Math.max(
|
|
476
476
|
this.gcTime || 0,
|
|
477
|
-
e ?? (
|
|
477
|
+
e ?? (bt ? 1 / 0 : 300 * 1e3)
|
|
478
478
|
);
|
|
479
479
|
}
|
|
480
480
|
clearGcTimeout() {
|
|
481
|
-
r(this,
|
|
481
|
+
r(this, lt) && (ut.clearTimeout(r(this, lt)), o(this, lt, void 0));
|
|
482
482
|
}
|
|
483
|
-
},
|
|
483
|
+
}, lt = new WeakMap(), Ie), dt, Pt, _, ft, D, Ut, yt, L, $, qe, ds = (qe = class extends He {
|
|
484
484
|
constructor(t) {
|
|
485
485
|
super();
|
|
486
|
-
c(this,
|
|
487
|
-
c(this,
|
|
486
|
+
c(this, L);
|
|
487
|
+
c(this, dt);
|
|
488
488
|
c(this, Pt);
|
|
489
489
|
c(this, _);
|
|
490
|
-
c(this,
|
|
490
|
+
c(this, ft);
|
|
491
491
|
c(this, D);
|
|
492
|
-
c(this,
|
|
493
|
-
c(this,
|
|
494
|
-
o(this,
|
|
492
|
+
c(this, Ut);
|
|
493
|
+
c(this, yt);
|
|
494
|
+
o(this, yt, !1), o(this, Ut, t.defaultOptions), this.setOptions(t.options), this.observers = [], o(this, ft, t.client), o(this, _, r(this, ft).getQueryCache()), this.queryKey = t.queryKey, this.queryHash = t.queryHash, o(this, dt, Oe(this.options)), this.state = t.state ?? r(this, dt), this.scheduleGc();
|
|
495
495
|
}
|
|
496
496
|
get meta() {
|
|
497
497
|
return this.options.meta;
|
|
@@ -501,11 +501,11 @@ var dt, Ie, He = (Ie = class {
|
|
|
501
501
|
return (t = r(this, D)) == null ? void 0 : t.promise;
|
|
502
502
|
}
|
|
503
503
|
setOptions(t) {
|
|
504
|
-
if (this.options = { ...r(this,
|
|
504
|
+
if (this.options = { ...r(this, Ut), ...t }, this.updateGcTime(this.options.gcTime), this.state && this.state.data === void 0) {
|
|
505
505
|
const s = Oe(this.options);
|
|
506
506
|
s.data !== void 0 && (this.setState(
|
|
507
507
|
Ce(s.data, s.dataUpdatedAt)
|
|
508
|
-
), o(this,
|
|
508
|
+
), o(this, dt, s));
|
|
509
509
|
}
|
|
510
510
|
}
|
|
511
511
|
optionalRemove() {
|
|
@@ -513,7 +513,7 @@ var dt, Ie, He = (Ie = class {
|
|
|
513
513
|
}
|
|
514
514
|
setData(t, s) {
|
|
515
515
|
const i = ee(this.state.data, t, this.options);
|
|
516
|
-
return v(this,
|
|
516
|
+
return v(this, L, $).call(this, {
|
|
517
517
|
data: i,
|
|
518
518
|
type: "success",
|
|
519
519
|
dataUpdatedAt: s == null ? void 0 : s.updatedAt,
|
|
@@ -521,7 +521,7 @@ var dt, Ie, He = (Ie = class {
|
|
|
521
521
|
}), i;
|
|
522
522
|
}
|
|
523
523
|
setState(t, s) {
|
|
524
|
-
v(this,
|
|
524
|
+
v(this, L, $).call(this, { type: "setState", state: t, setStateOptions: s });
|
|
525
525
|
}
|
|
526
526
|
cancel(t) {
|
|
527
527
|
var i, n;
|
|
@@ -532,7 +532,7 @@ var dt, Ie, He = (Ie = class {
|
|
|
532
532
|
super.destroy(), this.cancel({ silent: !0 });
|
|
533
533
|
}
|
|
534
534
|
reset() {
|
|
535
|
-
this.destroy(), this.setState(r(this,
|
|
535
|
+
this.destroy(), this.setState(r(this, dt));
|
|
536
536
|
}
|
|
537
537
|
isActive() {
|
|
538
538
|
return this.observers.some(
|
|
@@ -540,11 +540,11 @@ var dt, Ie, He = (Ie = class {
|
|
|
540
540
|
);
|
|
541
541
|
}
|
|
542
542
|
isDisabled() {
|
|
543
|
-
return this.getObserversCount() > 0 ? !this.isActive() : this.options.queryFn ===
|
|
543
|
+
return this.getObserversCount() > 0 ? !this.isActive() : this.options.queryFn === zt || this.state.dataUpdateCount + this.state.errorUpdateCount === 0;
|
|
544
544
|
}
|
|
545
545
|
isStatic() {
|
|
546
546
|
return this.getObserversCount() > 0 ? this.observers.some(
|
|
547
|
-
(t) =>
|
|
547
|
+
(t) => ot(t.options.staleTime, this) === "static"
|
|
548
548
|
) : !1;
|
|
549
549
|
}
|
|
550
550
|
isStale() {
|
|
@@ -569,16 +569,16 @@ var dt, Ie, He = (Ie = class {
|
|
|
569
569
|
this.observers.includes(t) || (this.observers.push(t), this.clearGcTimeout(), r(this, _).notify({ type: "observerAdded", query: this, observer: t }));
|
|
570
570
|
}
|
|
571
571
|
removeObserver(t) {
|
|
572
|
-
this.observers.includes(t) && (this.observers = this.observers.filter((s) => s !== t), this.observers.length || (r(this, D) && (r(this,
|
|
572
|
+
this.observers.includes(t) && (this.observers = this.observers.filter((s) => s !== t), this.observers.length || (r(this, D) && (r(this, yt) ? r(this, D).cancel({ revert: !0 }) : r(this, D).cancelRetry()), this.scheduleGc()), r(this, _).notify({ type: "observerRemoved", query: this, observer: t }));
|
|
573
573
|
}
|
|
574
574
|
getObserversCount() {
|
|
575
575
|
return this.observers.length;
|
|
576
576
|
}
|
|
577
577
|
invalidate() {
|
|
578
|
-
this.state.isInvalidated || v(this,
|
|
578
|
+
this.state.isInvalidated || v(this, L, $).call(this, { type: "invalidate" });
|
|
579
579
|
}
|
|
580
580
|
async fetch(t, s) {
|
|
581
|
-
var d, b,
|
|
581
|
+
var d, b, O, f, P, y, R, m, p, C, M, E;
|
|
582
582
|
if (this.state.fetchStatus !== "idle" && // If the promise in the retyer is already rejected, we have to definitely
|
|
583
583
|
// re-start the fetch; there is a chance that the query is still in a
|
|
584
584
|
// pending state when that happens
|
|
@@ -598,18 +598,18 @@ var dt, Ie, He = (Ie = class {
|
|
|
598
598
|
const i = new AbortController(), n = (l) => {
|
|
599
599
|
Object.defineProperty(l, "signal", {
|
|
600
600
|
enumerable: !0,
|
|
601
|
-
get: () => (o(this,
|
|
601
|
+
get: () => (o(this, yt, !0), i.signal)
|
|
602
602
|
});
|
|
603
603
|
}, a = () => {
|
|
604
604
|
const l = ke(this.options, s), x = (() => {
|
|
605
605
|
const Z = {
|
|
606
|
-
client: r(this,
|
|
606
|
+
client: r(this, ft),
|
|
607
607
|
queryKey: this.queryKey,
|
|
608
608
|
meta: this.meta
|
|
609
609
|
};
|
|
610
610
|
return n(Z), Z;
|
|
611
611
|
})();
|
|
612
|
-
return o(this,
|
|
612
|
+
return o(this, yt, !1), this.options.persister ? this.options.persister(
|
|
613
613
|
l,
|
|
614
614
|
x,
|
|
615
615
|
this
|
|
@@ -619,13 +619,13 @@ var dt, Ie, He = (Ie = class {
|
|
|
619
619
|
fetchOptions: s,
|
|
620
620
|
options: this.options,
|
|
621
621
|
queryKey: this.queryKey,
|
|
622
|
-
client: r(this,
|
|
622
|
+
client: r(this, ft),
|
|
623
623
|
state: this.state,
|
|
624
624
|
fetchFn: a
|
|
625
625
|
};
|
|
626
626
|
return n(l), l;
|
|
627
627
|
})();
|
|
628
|
-
(b = this.options.behavior) == null || b.onFetch(u, this), o(this, Pt, this.state), (this.state.fetchStatus === "idle" || this.state.fetchMeta !== ((
|
|
628
|
+
(b = this.options.behavior) == null || b.onFetch(u, this), o(this, Pt, this.state), (this.state.fetchStatus === "idle" || this.state.fetchMeta !== ((O = u.fetchOptions) == null ? void 0 : O.meta)) && v(this, L, $).call(this, { type: "fetch", meta: (f = u.fetchOptions) == null ? void 0 : f.meta }), o(this, D, Le({
|
|
629
629
|
initialPromise: s == null ? void 0 : s.initialPromise,
|
|
630
630
|
fn: u.fetchFn,
|
|
631
631
|
onCancel: (l) => {
|
|
@@ -635,13 +635,13 @@ var dt, Ie, He = (Ie = class {
|
|
|
635
635
|
}), i.abort();
|
|
636
636
|
},
|
|
637
637
|
onFail: (l, Q) => {
|
|
638
|
-
v(this,
|
|
638
|
+
v(this, L, $).call(this, { type: "failed", failureCount: l, error: Q });
|
|
639
639
|
},
|
|
640
640
|
onPause: () => {
|
|
641
|
-
v(this,
|
|
641
|
+
v(this, L, $).call(this, { type: "pause" });
|
|
642
642
|
},
|
|
643
643
|
onContinue: () => {
|
|
644
|
-
v(this,
|
|
644
|
+
v(this, L, $).call(this, { type: "continue" });
|
|
645
645
|
},
|
|
646
646
|
retry: u.options.retry,
|
|
647
647
|
retryDelay: u.options.retryDelay,
|
|
@@ -654,7 +654,7 @@ var dt, Ie, He = (Ie = class {
|
|
|
654
654
|
throw process.env.NODE_ENV !== "production" && console.error(
|
|
655
655
|
`Query data cannot be undefined. Please make sure to return a value other than undefined from your query function. Affected query key: ${this.queryHash}`
|
|
656
656
|
), new Error(`${this.queryHash} data is undefined`);
|
|
657
|
-
return this.setData(l), (y = (
|
|
657
|
+
return this.setData(l), (y = (P = r(this, _).config).onSuccess) == null || y.call(P, l, this), (m = (R = r(this, _).config).onSettled) == null || m.call(
|
|
658
658
|
R,
|
|
659
659
|
l,
|
|
660
660
|
this.state.error,
|
|
@@ -670,14 +670,14 @@ var dt, Ie, He = (Ie = class {
|
|
|
670
670
|
return this.state.data;
|
|
671
671
|
}
|
|
672
672
|
}
|
|
673
|
-
throw v(this,
|
|
673
|
+
throw v(this, L, $).call(this, {
|
|
674
674
|
type: "error",
|
|
675
675
|
error: l
|
|
676
|
-
}), (
|
|
676
|
+
}), (C = (p = r(this, _).config).onError) == null || C.call(
|
|
677
677
|
p,
|
|
678
678
|
l,
|
|
679
679
|
this
|
|
680
|
-
), (
|
|
680
|
+
), (E = (M = r(this, _).config).onSettled) == null || E.call(
|
|
681
681
|
M,
|
|
682
682
|
this.state.data,
|
|
683
683
|
l,
|
|
@@ -687,7 +687,7 @@ var dt, Ie, He = (Ie = class {
|
|
|
687
687
|
this.scheduleGc();
|
|
688
688
|
}
|
|
689
689
|
}
|
|
690
|
-
},
|
|
690
|
+
}, dt = new WeakMap(), Pt = new WeakMap(), _ = new WeakMap(), ft = new WeakMap(), D = new WeakMap(), Ut = new WeakMap(), yt = new WeakMap(), L = new WeakSet(), $ = function(t) {
|
|
691
691
|
const s = (i) => {
|
|
692
692
|
switch (t.type) {
|
|
693
693
|
case "failed":
|
|
@@ -758,7 +758,7 @@ function Ge(e, t) {
|
|
|
758
758
|
return {
|
|
759
759
|
fetchFailureCount: 0,
|
|
760
760
|
fetchFailureReason: null,
|
|
761
|
-
fetchStatus:
|
|
761
|
+
fetchStatus: Ke(t.networkMode) ? "fetching" : "paused",
|
|
762
762
|
...e === void 0 && {
|
|
763
763
|
error: null,
|
|
764
764
|
status: "pending"
|
|
@@ -791,34 +791,34 @@ function Oe(e) {
|
|
|
791
791
|
fetchStatus: "idle"
|
|
792
792
|
};
|
|
793
793
|
}
|
|
794
|
-
var U, g,
|
|
794
|
+
var U, g, jt, q, pt, Et, W, st, Nt, Ft, Rt, mt, vt, rt, Mt, S, qt, ie, ne, ae, oe, ue, he, ce, Be, Ae, fs = (Ae = class extends Kt {
|
|
795
795
|
constructor(t, s) {
|
|
796
796
|
super();
|
|
797
797
|
c(this, S);
|
|
798
798
|
c(this, U);
|
|
799
799
|
c(this, g);
|
|
800
|
-
c(this,
|
|
800
|
+
c(this, jt);
|
|
801
801
|
c(this, q);
|
|
802
|
-
c(this,
|
|
803
|
-
c(this,
|
|
802
|
+
c(this, pt);
|
|
803
|
+
c(this, Et);
|
|
804
804
|
c(this, W);
|
|
805
|
-
c(this,
|
|
806
|
-
c(this,
|
|
807
|
-
c(this,
|
|
805
|
+
c(this, st);
|
|
806
|
+
c(this, Nt);
|
|
807
|
+
c(this, Ft);
|
|
808
808
|
// This property keeps track of the last query with defined data.
|
|
809
809
|
// It will be used to pass the previous data and query to the placeholder function between renders.
|
|
810
|
-
c(this,
|
|
810
|
+
c(this, Rt);
|
|
811
|
+
c(this, mt);
|
|
811
812
|
c(this, vt);
|
|
812
|
-
c(this,
|
|
813
|
-
c(this,
|
|
814
|
-
|
|
815
|
-
this.options = s, o(this, U, t), o(this, rt, null), o(this, W, se()), this.bindMethods(), this.setOptions(s);
|
|
813
|
+
c(this, rt);
|
|
814
|
+
c(this, Mt, /* @__PURE__ */ new Set());
|
|
815
|
+
this.options = s, o(this, U, t), o(this, st, null), o(this, W, se()), this.bindMethods(), this.setOptions(s);
|
|
816
816
|
}
|
|
817
817
|
bindMethods() {
|
|
818
818
|
this.refetch = this.refetch.bind(this);
|
|
819
819
|
}
|
|
820
820
|
onSubscribe() {
|
|
821
|
-
this.listeners.size === 1 && (r(this, g).addObserver(this),
|
|
821
|
+
this.listeners.size === 1 && (r(this, g).addObserver(this), Pe(r(this, g), this.options) ? v(this, S, qt).call(this) : this.updateResult(), v(this, S, oe).call(this));
|
|
822
822
|
}
|
|
823
823
|
onUnsubscribe() {
|
|
824
824
|
this.hasListeners() || this.destroy();
|
|
@@ -852,18 +852,18 @@ var U, g, Nt, q, mt, Ft, W, rt, _t, Rt, Mt, vt, gt, it, Qt, S, At, ie, ne, ae, o
|
|
|
852
852
|
observer: this
|
|
853
853
|
});
|
|
854
854
|
const n = this.hasListeners();
|
|
855
|
-
n &&
|
|
855
|
+
n && Ee(
|
|
856
856
|
r(this, g),
|
|
857
857
|
i,
|
|
858
858
|
this.options,
|
|
859
859
|
s
|
|
860
|
-
) && v(this, S,
|
|
860
|
+
) && v(this, S, qt).call(this), this.updateResult(), n && (r(this, g) !== i || k(this.options.enabled, r(this, g)) !== k(s.enabled, r(this, g)) || ot(this.options.staleTime, r(this, g)) !== ot(s.staleTime, r(this, g))) && v(this, S, ie).call(this);
|
|
861
861
|
const a = v(this, S, ne).call(this);
|
|
862
|
-
n && (r(this, g) !== i || k(this.options.enabled, r(this, g)) !== k(s.enabled, r(this, g)) || a !== r(this,
|
|
862
|
+
n && (r(this, g) !== i || k(this.options.enabled, r(this, g)) !== k(s.enabled, r(this, g)) || a !== r(this, rt)) && v(this, S, ae).call(this, a);
|
|
863
863
|
}
|
|
864
864
|
getOptimisticResult(t) {
|
|
865
865
|
const s = r(this, U).getQueryCache().build(r(this, U), t), i = this.createResult(s, t);
|
|
866
|
-
return ps(this, i) && (o(this, q, i), o(this,
|
|
866
|
+
return ps(this, i) && (o(this, q, i), o(this, Et, this.options), o(this, pt, r(this, g).state)), i;
|
|
867
867
|
}
|
|
868
868
|
getCurrentResult() {
|
|
869
869
|
return r(this, q);
|
|
@@ -878,7 +878,7 @@ var U, g, Nt, q, mt, Ft, W, rt, _t, Rt, Mt, vt, gt, it, Qt, S, At, ie, ne, ae, o
|
|
|
878
878
|
});
|
|
879
879
|
}
|
|
880
880
|
trackProp(t) {
|
|
881
|
-
r(this,
|
|
881
|
+
r(this, Mt).add(t);
|
|
882
882
|
}
|
|
883
883
|
getCurrentQuery() {
|
|
884
884
|
return r(this, g);
|
|
@@ -893,50 +893,50 @@ var U, g, Nt, q, mt, Ft, W, rt, _t, Rt, Mt, vt, gt, it, Qt, S, At, ie, ne, ae, o
|
|
|
893
893
|
return i.fetch().then(() => this.createResult(i, s));
|
|
894
894
|
}
|
|
895
895
|
fetch(t) {
|
|
896
|
-
return v(this, S,
|
|
896
|
+
return v(this, S, qt).call(this, {
|
|
897
897
|
...t,
|
|
898
898
|
cancelRefetch: t.cancelRefetch ?? !0
|
|
899
899
|
}).then(() => (this.updateResult(), r(this, q)));
|
|
900
900
|
}
|
|
901
901
|
createResult(t, s) {
|
|
902
902
|
var X;
|
|
903
|
-
const i = r(this, g), n = this.options, a = r(this, q), h = r(this,
|
|
904
|
-
let f = { ...
|
|
903
|
+
const i = r(this, g), n = this.options, a = r(this, q), h = r(this, pt), u = r(this, Et), b = t !== i ? t.state : r(this, jt), { state: O } = t;
|
|
904
|
+
let f = { ...O }, P = !1, y;
|
|
905
905
|
if (s._optimisticResults) {
|
|
906
|
-
const w = this.hasListeners(), N = !w &&
|
|
907
|
-
(N ||
|
|
906
|
+
const w = this.hasListeners(), N = !w && Pe(t, s), wt = w && Ee(t, i, s, n);
|
|
907
|
+
(N || wt) && (f = {
|
|
908
908
|
...f,
|
|
909
|
-
...Ge(
|
|
909
|
+
...Ge(O.data, t.options)
|
|
910
910
|
}), s._optimisticResults === "isRestoring" && (f.fetchStatus = "idle");
|
|
911
911
|
}
|
|
912
912
|
let { error: R, errorUpdatedAt: m, status: p } = f;
|
|
913
913
|
y = f.data;
|
|
914
|
-
let
|
|
914
|
+
let C = !1;
|
|
915
915
|
if (s.placeholderData !== void 0 && y === void 0 && p === "pending") {
|
|
916
916
|
let w;
|
|
917
|
-
a != null && a.isPlaceholderData && s.placeholderData === (u == null ? void 0 : u.placeholderData) ? (w = a.data,
|
|
918
|
-
(X = r(this,
|
|
919
|
-
r(this,
|
|
917
|
+
a != null && a.isPlaceholderData && s.placeholderData === (u == null ? void 0 : u.placeholderData) ? (w = a.data, C = !0) : w = typeof s.placeholderData == "function" ? s.placeholderData(
|
|
918
|
+
(X = r(this, Rt)) == null ? void 0 : X.state.data,
|
|
919
|
+
r(this, Rt)
|
|
920
920
|
) : s.placeholderData, w !== void 0 && (p = "success", y = ee(
|
|
921
921
|
a == null ? void 0 : a.data,
|
|
922
922
|
w,
|
|
923
923
|
s
|
|
924
|
-
),
|
|
924
|
+
), P = !0);
|
|
925
925
|
}
|
|
926
|
-
if (s.select && y !== void 0 && !
|
|
927
|
-
if (a && y === (h == null ? void 0 : h.data) && s.select === r(this,
|
|
928
|
-
y = r(this,
|
|
926
|
+
if (s.select && y !== void 0 && !C)
|
|
927
|
+
if (a && y === (h == null ? void 0 : h.data) && s.select === r(this, Nt))
|
|
928
|
+
y = r(this, Ft);
|
|
929
929
|
else
|
|
930
930
|
try {
|
|
931
|
-
o(this,
|
|
931
|
+
o(this, Nt, s.select), y = s.select(y), y = ee(a == null ? void 0 : a.data, y, s), o(this, Ft, y), o(this, st, null);
|
|
932
932
|
} catch (w) {
|
|
933
|
-
o(this,
|
|
933
|
+
o(this, st, w);
|
|
934
934
|
}
|
|
935
|
-
r(this,
|
|
936
|
-
const M = f.fetchStatus === "fetching",
|
|
935
|
+
r(this, st) && (R = r(this, st), y = r(this, Ft), m = Date.now(), p = "error");
|
|
936
|
+
const M = f.fetchStatus === "fetching", E = p === "pending", l = p === "error", Q = E && M, x = y !== void 0, I = {
|
|
937
937
|
status: p,
|
|
938
938
|
fetchStatus: f.fetchStatus,
|
|
939
|
-
isPending:
|
|
939
|
+
isPending: E,
|
|
940
940
|
isSuccess: p === "success",
|
|
941
941
|
isError: l,
|
|
942
942
|
isInitialLoading: Q,
|
|
@@ -951,10 +951,10 @@ var U, g, Nt, q, mt, Ft, W, rt, _t, Rt, Mt, vt, gt, it, Qt, S, At, ie, ne, ae, o
|
|
|
951
951
|
isFetched: f.dataUpdateCount > 0 || f.errorUpdateCount > 0,
|
|
952
952
|
isFetchedAfterMount: f.dataUpdateCount > b.dataUpdateCount || f.errorUpdateCount > b.errorUpdateCount,
|
|
953
953
|
isFetching: M,
|
|
954
|
-
isRefetching: M && !
|
|
954
|
+
isRefetching: M && !E,
|
|
955
955
|
isLoadingError: l && !x,
|
|
956
956
|
isPaused: f.fetchStatus === "paused",
|
|
957
|
-
isPlaceholderData:
|
|
957
|
+
isPlaceholderData: P,
|
|
958
958
|
isRefetchError: l && x,
|
|
959
959
|
isStale: ye(t, s),
|
|
960
960
|
refetch: this.refetch,
|
|
@@ -962,21 +962,21 @@ var U, g, Nt, q, mt, Ft, W, rt, _t, Rt, Mt, vt, gt, it, Qt, S, At, ie, ne, ae, o
|
|
|
962
962
|
isEnabled: k(s.enabled, t) !== !1
|
|
963
963
|
};
|
|
964
964
|
if (this.options.experimental_prefetchInRender) {
|
|
965
|
-
const w = (
|
|
966
|
-
I.status === "error" ?
|
|
965
|
+
const w = (Lt) => {
|
|
966
|
+
I.status === "error" ? Lt.reject(I.error) : I.data !== void 0 && Lt.resolve(I.data);
|
|
967
967
|
}, N = () => {
|
|
968
|
-
const
|
|
969
|
-
w(
|
|
970
|
-
},
|
|
971
|
-
switch (
|
|
968
|
+
const Lt = o(this, W, I.promise = se());
|
|
969
|
+
w(Lt);
|
|
970
|
+
}, wt = r(this, W);
|
|
971
|
+
switch (wt.status) {
|
|
972
972
|
case "pending":
|
|
973
|
-
t.queryHash === i.queryHash && w(
|
|
973
|
+
t.queryHash === i.queryHash && w(wt);
|
|
974
974
|
break;
|
|
975
975
|
case "fulfilled":
|
|
976
|
-
(I.status === "error" || I.data !==
|
|
976
|
+
(I.status === "error" || I.data !== wt.value) && N();
|
|
977
977
|
break;
|
|
978
978
|
case "rejected":
|
|
979
|
-
(I.status !== "error" || I.error !==
|
|
979
|
+
(I.status !== "error" || I.error !== wt.reason) && N();
|
|
980
980
|
break;
|
|
981
981
|
}
|
|
982
982
|
}
|
|
@@ -984,17 +984,17 @@ var U, g, Nt, q, mt, Ft, W, rt, _t, Rt, Mt, vt, gt, it, Qt, S, At, ie, ne, ae, o
|
|
|
984
984
|
}
|
|
985
985
|
updateResult() {
|
|
986
986
|
const t = r(this, q), s = this.createResult(r(this, g), this.options);
|
|
987
|
-
if (o(this,
|
|
987
|
+
if (o(this, pt, r(this, g).state), o(this, Et, this.options), r(this, pt).data !== void 0 && o(this, Rt, r(this, g)), Yt(s, t))
|
|
988
988
|
return;
|
|
989
989
|
o(this, q, s);
|
|
990
990
|
const i = () => {
|
|
991
991
|
if (!t)
|
|
992
992
|
return !0;
|
|
993
993
|
const { notifyOnChangeProps: n } = this.options, a = typeof n == "function" ? n() : n;
|
|
994
|
-
if (a === "all" || !a && !r(this,
|
|
994
|
+
if (a === "all" || !a && !r(this, Mt).size)
|
|
995
995
|
return !0;
|
|
996
996
|
const h = new Set(
|
|
997
|
-
a ?? r(this,
|
|
997
|
+
a ?? r(this, Mt)
|
|
998
998
|
);
|
|
999
999
|
return this.options.throwOnError && h.add("error"), Object.keys(r(this, q)).some((u) => {
|
|
1000
1000
|
const d = u;
|
|
@@ -1006,7 +1006,7 @@ var U, g, Nt, q, mt, Ft, W, rt, _t, Rt, Mt, vt, gt, it, Qt, S, At, ie, ne, ae, o
|
|
|
1006
1006
|
onQueryUpdate() {
|
|
1007
1007
|
this.updateResult(), this.hasListeners() && v(this, S, oe).call(this);
|
|
1008
1008
|
}
|
|
1009
|
-
}, U = new WeakMap(), g = new WeakMap(),
|
|
1009
|
+
}, U = new WeakMap(), g = new WeakMap(), jt = new WeakMap(), q = new WeakMap(), pt = new WeakMap(), Et = new WeakMap(), W = new WeakMap(), st = new WeakMap(), Nt = new WeakMap(), Ft = new WeakMap(), Rt = new WeakMap(), mt = new WeakMap(), vt = new WeakMap(), rt = new WeakMap(), Mt = new WeakMap(), S = new WeakSet(), qt = function(t) {
|
|
1010
1010
|
v(this, S, ce).call(this);
|
|
1011
1011
|
let s = r(this, g).fetch(
|
|
1012
1012
|
this.options,
|
|
@@ -1015,34 +1015,34 @@ var U, g, Nt, q, mt, Ft, W, rt, _t, Rt, Mt, vt, gt, it, Qt, S, At, ie, ne, ae, o
|
|
|
1015
1015
|
return t != null && t.throwOnError || (s = s.catch(j)), s;
|
|
1016
1016
|
}, ie = function() {
|
|
1017
1017
|
v(this, S, ue).call(this);
|
|
1018
|
-
const t =
|
|
1018
|
+
const t = ot(
|
|
1019
1019
|
this.options.staleTime,
|
|
1020
1020
|
r(this, g)
|
|
1021
1021
|
);
|
|
1022
|
-
if (
|
|
1022
|
+
if (bt || r(this, q).isStale || !Zt(t))
|
|
1023
1023
|
return;
|
|
1024
1024
|
const i = _e(r(this, q).dataUpdatedAt, t) + 1;
|
|
1025
|
-
o(this,
|
|
1025
|
+
o(this, mt, ut.setTimeout(() => {
|
|
1026
1026
|
r(this, q).isStale || this.updateResult();
|
|
1027
1027
|
}, i));
|
|
1028
1028
|
}, ne = function() {
|
|
1029
1029
|
return (typeof this.options.refetchInterval == "function" ? this.options.refetchInterval(r(this, g)) : this.options.refetchInterval) ?? !1;
|
|
1030
1030
|
}, ae = function(t) {
|
|
1031
|
-
v(this, S, he).call(this), o(this,
|
|
1032
|
-
(this.options.refetchIntervalInBackground || fe.isFocused()) && v(this, S,
|
|
1033
|
-
}, r(this,
|
|
1031
|
+
v(this, S, he).call(this), o(this, rt, t), !(bt || k(this.options.enabled, r(this, g)) === !1 || !Zt(r(this, rt)) || r(this, rt) === 0) && o(this, vt, ut.setInterval(() => {
|
|
1032
|
+
(this.options.refetchIntervalInBackground || fe.isFocused()) && v(this, S, qt).call(this);
|
|
1033
|
+
}, r(this, rt)));
|
|
1034
1034
|
}, oe = function() {
|
|
1035
1035
|
v(this, S, ie).call(this), v(this, S, ae).call(this, v(this, S, ne).call(this));
|
|
1036
1036
|
}, ue = function() {
|
|
1037
|
-
r(this,
|
|
1037
|
+
r(this, mt) && (ut.clearTimeout(r(this, mt)), o(this, mt, void 0));
|
|
1038
1038
|
}, he = function() {
|
|
1039
|
-
r(this,
|
|
1039
|
+
r(this, vt) && (ut.clearInterval(r(this, vt)), o(this, vt, void 0));
|
|
1040
1040
|
}, ce = function() {
|
|
1041
1041
|
const t = r(this, U).getQueryCache().build(r(this, U), this.options);
|
|
1042
1042
|
if (t === r(this, g))
|
|
1043
1043
|
return;
|
|
1044
1044
|
const s = r(this, g);
|
|
1045
|
-
o(this, g, t), o(this,
|
|
1045
|
+
o(this, g, t), o(this, jt, t.state), this.hasListeners() && (s == null || s.removeObserver(this), t.addObserver(this));
|
|
1046
1046
|
}, Be = function(t) {
|
|
1047
1047
|
T.batch(() => {
|
|
1048
1048
|
t.listeners && this.listeners.forEach((s) => {
|
|
@@ -1056,21 +1056,21 @@ var U, g, Nt, q, mt, Ft, W, rt, _t, Rt, Mt, vt, gt, it, Qt, S, At, ie, ne, ae, o
|
|
|
1056
1056
|
function ys(e, t) {
|
|
1057
1057
|
return k(t.enabled, e) !== !1 && e.state.data === void 0 && !(e.state.status === "error" && t.retryOnMount === !1);
|
|
1058
1058
|
}
|
|
1059
|
-
function
|
|
1059
|
+
function Pe(e, t) {
|
|
1060
1060
|
return ys(e, t) || e.state.data !== void 0 && le(e, t, t.refetchOnMount);
|
|
1061
1061
|
}
|
|
1062
1062
|
function le(e, t, s) {
|
|
1063
|
-
if (k(t.enabled, e) !== !1 &&
|
|
1063
|
+
if (k(t.enabled, e) !== !1 && ot(t.staleTime, e) !== "static") {
|
|
1064
1064
|
const i = typeof s == "function" ? s(e) : s;
|
|
1065
1065
|
return i === "always" || i !== !1 && ye(e, t);
|
|
1066
1066
|
}
|
|
1067
1067
|
return !1;
|
|
1068
1068
|
}
|
|
1069
|
-
function
|
|
1069
|
+
function Ee(e, t, s, i) {
|
|
1070
1070
|
return (e !== t || k(i.enabled, e) === !1) && (!s.suspense || e.state.status !== "error") && ye(e, s);
|
|
1071
1071
|
}
|
|
1072
1072
|
function ye(e, t) {
|
|
1073
|
-
return k(t.enabled, e) !== !1 && e.isStaleByTime(
|
|
1073
|
+
return k(t.enabled, e) !== !1 && e.isStaleByTime(ot(t.staleTime, e));
|
|
1074
1074
|
}
|
|
1075
1075
|
function ps(e, t) {
|
|
1076
1076
|
return !Yt(e.getCurrentResult(), t);
|
|
@@ -1078,23 +1078,23 @@ function ps(e, t) {
|
|
|
1078
1078
|
function Fe(e) {
|
|
1079
1079
|
return {
|
|
1080
1080
|
onFetch: (t, s) => {
|
|
1081
|
-
var
|
|
1082
|
-
const i = t.options, n = (
|
|
1081
|
+
var O, f, P, y, R;
|
|
1082
|
+
const i = t.options, n = (P = (f = (O = t.fetchOptions) == null ? void 0 : O.meta) == null ? void 0 : f.fetchMore) == null ? void 0 : P.direction, a = ((y = t.state.data) == null ? void 0 : y.pages) || [], h = ((R = t.state.data) == null ? void 0 : R.pageParams) || [];
|
|
1083
1083
|
let u = { pages: [], pageParams: [] }, d = 0;
|
|
1084
1084
|
const b = async () => {
|
|
1085
1085
|
let m = !1;
|
|
1086
|
-
const p = (
|
|
1087
|
-
Object.defineProperty(
|
|
1086
|
+
const p = (E) => {
|
|
1087
|
+
Object.defineProperty(E, "signal", {
|
|
1088
1088
|
enumerable: !0,
|
|
1089
1089
|
get: () => (t.signal.aborted ? m = !0 : t.signal.addEventListener("abort", () => {
|
|
1090
1090
|
m = !0;
|
|
1091
1091
|
}), t.signal)
|
|
1092
1092
|
});
|
|
1093
|
-
},
|
|
1093
|
+
}, C = ke(t.options, t.fetchOptions), M = async (E, l, Q) => {
|
|
1094
1094
|
if (m)
|
|
1095
1095
|
return Promise.reject();
|
|
1096
|
-
if (l == null &&
|
|
1097
|
-
return Promise.resolve(
|
|
1096
|
+
if (l == null && E.pages.length)
|
|
1097
|
+
return Promise.resolve(E);
|
|
1098
1098
|
const Z = (() => {
|
|
1099
1099
|
const N = {
|
|
1100
1100
|
client: t.client,
|
|
@@ -1104,26 +1104,26 @@ function Fe(e) {
|
|
|
1104
1104
|
meta: t.options.meta
|
|
1105
1105
|
};
|
|
1106
1106
|
return p(N), N;
|
|
1107
|
-
})(), I = await
|
|
1107
|
+
})(), I = await C(Z), { maxPages: X } = t.options, w = Q ? ns : is;
|
|
1108
1108
|
return {
|
|
1109
|
-
pages: w(
|
|
1110
|
-
pageParams: w(
|
|
1109
|
+
pages: w(E.pages, I, X),
|
|
1110
|
+
pageParams: w(E.pageParams, l, X)
|
|
1111
1111
|
};
|
|
1112
1112
|
};
|
|
1113
1113
|
if (n && a.length) {
|
|
1114
|
-
const
|
|
1114
|
+
const E = n === "backward", l = E ? ms : Re, Q = {
|
|
1115
1115
|
pages: a,
|
|
1116
1116
|
pageParams: h
|
|
1117
1117
|
}, x = l(i, Q);
|
|
1118
|
-
u = await M(Q, x,
|
|
1118
|
+
u = await M(Q, x, E);
|
|
1119
1119
|
} else {
|
|
1120
|
-
const
|
|
1120
|
+
const E = e ?? a.length;
|
|
1121
1121
|
do {
|
|
1122
1122
|
const l = d === 0 ? h[0] ?? i.initialPageParam : Re(i, u);
|
|
1123
1123
|
if (d > 0 && l == null)
|
|
1124
1124
|
break;
|
|
1125
1125
|
u = await M(u, l), d++;
|
|
1126
|
-
} while (d <
|
|
1126
|
+
} while (d < E);
|
|
1127
1127
|
}
|
|
1128
1128
|
return u;
|
|
1129
1129
|
};
|
|
@@ -1157,15 +1157,15 @@ function ms(e, { pages: t, pageParams: s }) {
|
|
|
1157
1157
|
var i;
|
|
1158
1158
|
return t.length > 0 ? (i = e.getPreviousPageParam) == null ? void 0 : i.call(e, t[0], t, s[0], s) : void 0;
|
|
1159
1159
|
}
|
|
1160
|
-
var
|
|
1160
|
+
var _t, B, A, gt, V, Y, xe, vs = (xe = class extends He {
|
|
1161
1161
|
constructor(t) {
|
|
1162
1162
|
super();
|
|
1163
1163
|
c(this, V);
|
|
1164
|
-
c(this,
|
|
1164
|
+
c(this, _t);
|
|
1165
1165
|
c(this, B);
|
|
1166
1166
|
c(this, A);
|
|
1167
|
-
c(this,
|
|
1168
|
-
o(this,
|
|
1167
|
+
c(this, gt);
|
|
1168
|
+
o(this, _t, t.client), this.mutationId = t.mutationId, o(this, A, t.mutationCache), o(this, B, []), this.state = t.state || gs(), this.setOptions(t.options), this.scheduleGc();
|
|
1169
1169
|
}
|
|
1170
1170
|
setOptions(t) {
|
|
1171
1171
|
this.options = t, this.updateGcTime(this.options.gcTime);
|
|
@@ -1192,25 +1192,25 @@ var kt, B, A, bt, V, tt, xe, vs = (xe = class extends He {
|
|
|
1192
1192
|
}
|
|
1193
1193
|
continue() {
|
|
1194
1194
|
var t;
|
|
1195
|
-
return ((t = r(this,
|
|
1195
|
+
return ((t = r(this, gt)) == null ? void 0 : t.continue()) ?? // continuing a mutation assumes that variables are set, mutation must have been dehydrated before
|
|
1196
1196
|
this.execute(this.state.variables);
|
|
1197
1197
|
}
|
|
1198
1198
|
async execute(t) {
|
|
1199
|
-
var h, u, d, b,
|
|
1199
|
+
var h, u, d, b, O, f, P, y, R, m, p, C, M, E, l, Q, x, Z, I, X;
|
|
1200
1200
|
const s = () => {
|
|
1201
|
-
v(this, V,
|
|
1201
|
+
v(this, V, Y).call(this, { type: "continue" });
|
|
1202
1202
|
}, i = {
|
|
1203
|
-
client: r(this,
|
|
1203
|
+
client: r(this, _t),
|
|
1204
1204
|
meta: this.options.meta,
|
|
1205
1205
|
mutationKey: this.options.mutationKey
|
|
1206
1206
|
};
|
|
1207
|
-
o(this,
|
|
1207
|
+
o(this, gt, Le({
|
|
1208
1208
|
fn: () => this.options.mutationFn ? this.options.mutationFn(t, i) : Promise.reject(new Error("No mutationFn found")),
|
|
1209
1209
|
onFail: (w, N) => {
|
|
1210
|
-
v(this, V,
|
|
1210
|
+
v(this, V, Y).call(this, { type: "failed", failureCount: w, error: N });
|
|
1211
1211
|
},
|
|
1212
1212
|
onPause: () => {
|
|
1213
|
-
v(this, V,
|
|
1213
|
+
v(this, V, Y).call(this, { type: "pause" });
|
|
1214
1214
|
},
|
|
1215
1215
|
onContinue: s,
|
|
1216
1216
|
retry: this.options.retry ?? 0,
|
|
@@ -1218,12 +1218,12 @@ var kt, B, A, bt, V, tt, xe, vs = (xe = class extends He {
|
|
|
1218
1218
|
networkMode: this.options.networkMode,
|
|
1219
1219
|
canRun: () => r(this, A).canRun(this)
|
|
1220
1220
|
}));
|
|
1221
|
-
const n = this.state.status === "pending", a = !r(this,
|
|
1221
|
+
const n = this.state.status === "pending", a = !r(this, gt).canStart();
|
|
1222
1222
|
try {
|
|
1223
1223
|
if (n)
|
|
1224
1224
|
s();
|
|
1225
1225
|
else {
|
|
1226
|
-
v(this, V,
|
|
1226
|
+
v(this, V, Y).call(this, { type: "pending", variables: t, isPaused: a }), await ((u = (h = r(this, A).config).onMutate) == null ? void 0 : u.call(
|
|
1227
1227
|
h,
|
|
1228
1228
|
t,
|
|
1229
1229
|
this,
|
|
@@ -1234,23 +1234,23 @@ var kt, B, A, bt, V, tt, xe, vs = (xe = class extends He {
|
|
|
1234
1234
|
t,
|
|
1235
1235
|
i
|
|
1236
1236
|
));
|
|
1237
|
-
N !== this.state.context && v(this, V,
|
|
1237
|
+
N !== this.state.context && v(this, V, Y).call(this, {
|
|
1238
1238
|
type: "pending",
|
|
1239
1239
|
context: N,
|
|
1240
1240
|
variables: t,
|
|
1241
1241
|
isPaused: a
|
|
1242
1242
|
});
|
|
1243
1243
|
}
|
|
1244
|
-
const w = await r(this,
|
|
1245
|
-
return await ((f = (
|
|
1246
|
-
|
|
1244
|
+
const w = await r(this, gt).start();
|
|
1245
|
+
return await ((f = (O = r(this, A).config).onSuccess) == null ? void 0 : f.call(
|
|
1246
|
+
O,
|
|
1247
1247
|
w,
|
|
1248
1248
|
t,
|
|
1249
1249
|
this.state.context,
|
|
1250
1250
|
this,
|
|
1251
1251
|
i
|
|
1252
|
-
)), await ((y = (
|
|
1253
|
-
|
|
1252
|
+
)), await ((y = (P = this.options).onSuccess) == null ? void 0 : y.call(
|
|
1253
|
+
P,
|
|
1254
1254
|
w,
|
|
1255
1255
|
t,
|
|
1256
1256
|
this.state.context,
|
|
@@ -1263,17 +1263,17 @@ var kt, B, A, bt, V, tt, xe, vs = (xe = class extends He {
|
|
|
1263
1263
|
this.state.context,
|
|
1264
1264
|
this,
|
|
1265
1265
|
i
|
|
1266
|
-
)), await ((
|
|
1266
|
+
)), await ((C = (p = this.options).onSettled) == null ? void 0 : C.call(
|
|
1267
1267
|
p,
|
|
1268
1268
|
w,
|
|
1269
1269
|
null,
|
|
1270
1270
|
t,
|
|
1271
1271
|
this.state.context,
|
|
1272
1272
|
i
|
|
1273
|
-
)), v(this, V,
|
|
1273
|
+
)), v(this, V, Y).call(this, { type: "success", data: w }), w;
|
|
1274
1274
|
} catch (w) {
|
|
1275
1275
|
try {
|
|
1276
|
-
throw await ((
|
|
1276
|
+
throw await ((E = (M = r(this, A).config).onError) == null ? void 0 : E.call(
|
|
1277
1277
|
M,
|
|
1278
1278
|
w,
|
|
1279
1279
|
t,
|
|
@@ -1303,13 +1303,13 @@ var kt, B, A, bt, V, tt, xe, vs = (xe = class extends He {
|
|
|
1303
1303
|
i
|
|
1304
1304
|
)), w;
|
|
1305
1305
|
} finally {
|
|
1306
|
-
v(this, V,
|
|
1306
|
+
v(this, V, Y).call(this, { type: "error", error: w });
|
|
1307
1307
|
}
|
|
1308
1308
|
} finally {
|
|
1309
1309
|
r(this, A).runNext(this);
|
|
1310
1310
|
}
|
|
1311
1311
|
}
|
|
1312
|
-
},
|
|
1312
|
+
}, _t = new WeakMap(), B = new WeakMap(), A = new WeakMap(), gt = new WeakMap(), V = new WeakSet(), Y = function(t) {
|
|
1313
1313
|
const s = (i) => {
|
|
1314
1314
|
switch (t.type) {
|
|
1315
1315
|
case "failed":
|
|
@@ -1386,19 +1386,19 @@ function gs() {
|
|
|
1386
1386
|
submittedAt: 0
|
|
1387
1387
|
};
|
|
1388
1388
|
}
|
|
1389
|
-
var J, H,
|
|
1389
|
+
var J, H, kt, Ue, bs = (Ue = class extends Kt {
|
|
1390
1390
|
constructor(t = {}) {
|
|
1391
1391
|
super();
|
|
1392
1392
|
c(this, J);
|
|
1393
1393
|
c(this, H);
|
|
1394
|
-
c(this,
|
|
1395
|
-
this.config = t, o(this, J, /* @__PURE__ */ new Set()), o(this, H, /* @__PURE__ */ new Map()), o(this,
|
|
1394
|
+
c(this, kt);
|
|
1395
|
+
this.config = t, o(this, J, /* @__PURE__ */ new Set()), o(this, H, /* @__PURE__ */ new Map()), o(this, kt, 0);
|
|
1396
1396
|
}
|
|
1397
1397
|
build(t, s, i) {
|
|
1398
1398
|
const n = new vs({
|
|
1399
1399
|
client: t,
|
|
1400
1400
|
mutationCache: this,
|
|
1401
|
-
mutationId: ++
|
|
1401
|
+
mutationId: ++Ht(this, kt)._,
|
|
1402
1402
|
options: t.defaultMutationOptions(s),
|
|
1403
1403
|
state: i
|
|
1404
1404
|
});
|
|
@@ -1406,7 +1406,7 @@ var J, H, Lt, Ue, bs = (Ue = class extends Kt {
|
|
|
1406
1406
|
}
|
|
1407
1407
|
add(t) {
|
|
1408
1408
|
r(this, J).add(t);
|
|
1409
|
-
const s =
|
|
1409
|
+
const s = Bt(t);
|
|
1410
1410
|
if (typeof s == "string") {
|
|
1411
1411
|
const i = r(this, H).get(s);
|
|
1412
1412
|
i ? i.push(t) : r(this, H).set(s, [t]);
|
|
@@ -1415,7 +1415,7 @@ var J, H, Lt, Ue, bs = (Ue = class extends Kt {
|
|
|
1415
1415
|
}
|
|
1416
1416
|
remove(t) {
|
|
1417
1417
|
if (r(this, J).delete(t)) {
|
|
1418
|
-
const s =
|
|
1418
|
+
const s = Bt(t);
|
|
1419
1419
|
if (typeof s == "string") {
|
|
1420
1420
|
const i = r(this, H).get(s);
|
|
1421
1421
|
if (i)
|
|
@@ -1428,7 +1428,7 @@ var J, H, Lt, Ue, bs = (Ue = class extends Kt {
|
|
|
1428
1428
|
this.notify({ type: "removed", mutation: t });
|
|
1429
1429
|
}
|
|
1430
1430
|
canRun(t) {
|
|
1431
|
-
const s =
|
|
1431
|
+
const s = Bt(t);
|
|
1432
1432
|
if (typeof s == "string") {
|
|
1433
1433
|
const i = r(this, H).get(s), n = i == null ? void 0 : i.find(
|
|
1434
1434
|
(a) => a.state.status === "pending"
|
|
@@ -1439,7 +1439,7 @@ var J, H, Lt, Ue, bs = (Ue = class extends Kt {
|
|
|
1439
1439
|
}
|
|
1440
1440
|
runNext(t) {
|
|
1441
1441
|
var i;
|
|
1442
|
-
const s =
|
|
1442
|
+
const s = Bt(t);
|
|
1443
1443
|
if (typeof s == "string") {
|
|
1444
1444
|
const n = (i = r(this, H).get(s)) == null ? void 0 : i.find((a) => a !== t && a.state.isPaused);
|
|
1445
1445
|
return (n == null ? void 0 : n.continue()) ?? Promise.resolve();
|
|
@@ -1480,8 +1480,8 @@ var J, H, Lt, Ue, bs = (Ue = class extends Kt {
|
|
|
1480
1480
|
)
|
|
1481
1481
|
);
|
|
1482
1482
|
}
|
|
1483
|
-
}, J = new WeakMap(), H = new WeakMap(),
|
|
1484
|
-
function
|
|
1483
|
+
}, J = new WeakMap(), H = new WeakMap(), kt = new WeakMap(), Ue);
|
|
1484
|
+
function Bt(e) {
|
|
1485
1485
|
var t;
|
|
1486
1486
|
return (t = e.options.scope) == null ? void 0 : t.id;
|
|
1487
1487
|
}
|
|
@@ -1557,34 +1557,34 @@ var z, je, ws = (je = class extends Kt {
|
|
|
1557
1557
|
});
|
|
1558
1558
|
});
|
|
1559
1559
|
}
|
|
1560
|
-
}, z = new WeakMap(), je), F, nt,
|
|
1560
|
+
}, z = new WeakMap(), je), F, it, nt, Qt, Dt, at, Tt, It, Ne, Ss = (Ne = class {
|
|
1561
1561
|
constructor(e = {}) {
|
|
1562
1562
|
c(this, F);
|
|
1563
|
+
c(this, it);
|
|
1563
1564
|
c(this, nt);
|
|
1564
|
-
c(this,
|
|
1565
|
+
c(this, Qt);
|
|
1565
1566
|
c(this, Dt);
|
|
1567
|
+
c(this, at);
|
|
1566
1568
|
c(this, Tt);
|
|
1567
|
-
c(this, ot);
|
|
1568
1569
|
c(this, It);
|
|
1569
|
-
|
|
1570
|
-
o(this, F, e.queryCache || new ws()), o(this, nt, e.mutationCache || new bs()), o(this, at, e.defaultOptions || {}), o(this, Dt, /* @__PURE__ */ new Map()), o(this, Tt, /* @__PURE__ */ new Map()), o(this, ot, 0);
|
|
1570
|
+
o(this, F, e.queryCache || new ws()), o(this, it, e.mutationCache || new bs()), o(this, nt, e.defaultOptions || {}), o(this, Qt, /* @__PURE__ */ new Map()), o(this, Dt, /* @__PURE__ */ new Map()), o(this, at, 0);
|
|
1571
1571
|
}
|
|
1572
1572
|
mount() {
|
|
1573
|
-
|
|
1573
|
+
Ht(this, at)._++, r(this, at) === 1 && (o(this, Tt, fe.subscribe(async (e) => {
|
|
1574
1574
|
e && (await this.resumePausedMutations(), r(this, F).onFocus());
|
|
1575
|
-
})), o(this,
|
|
1575
|
+
})), o(this, It, $t.subscribe(async (e) => {
|
|
1576
1576
|
e && (await this.resumePausedMutations(), r(this, F).onOnline());
|
|
1577
1577
|
})));
|
|
1578
1578
|
}
|
|
1579
1579
|
unmount() {
|
|
1580
1580
|
var e, t;
|
|
1581
|
-
|
|
1581
|
+
Ht(this, at)._--, r(this, at) === 0 && ((e = r(this, Tt)) == null || e.call(this), o(this, Tt, void 0), (t = r(this, It)) == null || t.call(this), o(this, It, void 0));
|
|
1582
1582
|
}
|
|
1583
1583
|
isFetching(e) {
|
|
1584
1584
|
return r(this, F).findAll({ ...e, fetchStatus: "fetching" }).length;
|
|
1585
1585
|
}
|
|
1586
1586
|
isMutating(e) {
|
|
1587
|
-
return r(this,
|
|
1587
|
+
return r(this, it).findAll({ ...e, status: "pending" }).length;
|
|
1588
1588
|
}
|
|
1589
1589
|
/**
|
|
1590
1590
|
* Imperative (non-reactive) way to retrieve data for a QueryKey.
|
|
@@ -1600,7 +1600,7 @@ var z, je, ws = (je = class extends Kt {
|
|
|
1600
1600
|
}
|
|
1601
1601
|
ensureQueryData(e) {
|
|
1602
1602
|
const t = this.defaultQueryOptions(e), s = r(this, F).build(this, t), i = s.state.data;
|
|
1603
|
-
return i === void 0 ? this.fetchQuery(e) : (e.revalidateIfStale && s.isStaleByTime(
|
|
1603
|
+
return i === void 0 ? this.fetchQuery(e) : (e.revalidateIfStale && s.isStaleByTime(ot(t.staleTime, s)) && this.prefetchQuery(t), Promise.resolve(i));
|
|
1604
1604
|
}
|
|
1605
1605
|
getQueriesData(e) {
|
|
1606
1606
|
return r(this, F).findAll(e).map(({ queryKey: t, state: s }) => {
|
|
@@ -1684,7 +1684,7 @@ var z, je, ws = (je = class extends Kt {
|
|
|
1684
1684
|
t.retry === void 0 && (t.retry = !1);
|
|
1685
1685
|
const s = r(this, F).build(this, t);
|
|
1686
1686
|
return s.isStaleByTime(
|
|
1687
|
-
|
|
1687
|
+
ot(t.staleTime, s)
|
|
1688
1688
|
) ? s.fetch(t) : Promise.resolve(s.state.data);
|
|
1689
1689
|
}
|
|
1690
1690
|
prefetchQuery(e) {
|
|
@@ -1700,49 +1700,49 @@ var z, je, ws = (je = class extends Kt {
|
|
|
1700
1700
|
return e.behavior = Fe(e.pages), this.ensureQueryData(e);
|
|
1701
1701
|
}
|
|
1702
1702
|
resumePausedMutations() {
|
|
1703
|
-
return
|
|
1703
|
+
return $t.isOnline() ? r(this, it).resumePausedMutations() : Promise.resolve();
|
|
1704
1704
|
}
|
|
1705
1705
|
getQueryCache() {
|
|
1706
1706
|
return r(this, F);
|
|
1707
1707
|
}
|
|
1708
1708
|
getMutationCache() {
|
|
1709
|
-
return r(this,
|
|
1709
|
+
return r(this, it);
|
|
1710
1710
|
}
|
|
1711
1711
|
getDefaultOptions() {
|
|
1712
|
-
return r(this,
|
|
1712
|
+
return r(this, nt);
|
|
1713
1713
|
}
|
|
1714
1714
|
setDefaultOptions(e) {
|
|
1715
|
-
o(this,
|
|
1715
|
+
o(this, nt, e);
|
|
1716
1716
|
}
|
|
1717
1717
|
setQueryDefaults(e, t) {
|
|
1718
|
-
r(this,
|
|
1718
|
+
r(this, Qt).set(At(e), {
|
|
1719
1719
|
queryKey: e,
|
|
1720
1720
|
defaultOptions: t
|
|
1721
1721
|
});
|
|
1722
1722
|
}
|
|
1723
1723
|
getQueryDefaults(e) {
|
|
1724
|
-
const t = [...r(this,
|
|
1724
|
+
const t = [...r(this, Qt).values()], s = {};
|
|
1725
1725
|
return t.forEach((i) => {
|
|
1726
|
-
|
|
1726
|
+
xt(e, i.queryKey) && Object.assign(s, i.defaultOptions);
|
|
1727
1727
|
}), s;
|
|
1728
1728
|
}
|
|
1729
1729
|
setMutationDefaults(e, t) {
|
|
1730
|
-
r(this,
|
|
1730
|
+
r(this, Dt).set(At(e), {
|
|
1731
1731
|
mutationKey: e,
|
|
1732
1732
|
defaultOptions: t
|
|
1733
1733
|
});
|
|
1734
1734
|
}
|
|
1735
1735
|
getMutationDefaults(e) {
|
|
1736
|
-
const t = [...r(this,
|
|
1736
|
+
const t = [...r(this, Dt).values()], s = {};
|
|
1737
1737
|
return t.forEach((i) => {
|
|
1738
|
-
|
|
1738
|
+
xt(e, i.mutationKey) && Object.assign(s, i.defaultOptions);
|
|
1739
1739
|
}), s;
|
|
1740
1740
|
}
|
|
1741
1741
|
defaultQueryOptions(e) {
|
|
1742
1742
|
if (e._defaulted)
|
|
1743
1743
|
return e;
|
|
1744
1744
|
const t = {
|
|
1745
|
-
...r(this,
|
|
1745
|
+
...r(this, nt).queries,
|
|
1746
1746
|
...this.getQueryDefaults(e.queryKey),
|
|
1747
1747
|
...e,
|
|
1748
1748
|
_defaulted: !0
|
|
@@ -1750,34 +1750,34 @@ var z, je, ws = (je = class extends Kt {
|
|
|
1750
1750
|
return t.queryHash || (t.queryHash = de(
|
|
1751
1751
|
t.queryKey,
|
|
1752
1752
|
t
|
|
1753
|
-
)), t.refetchOnReconnect === void 0 && (t.refetchOnReconnect = t.networkMode !== "always"), t.throwOnError === void 0 && (t.throwOnError = !!t.suspense), !t.networkMode && t.persister && (t.networkMode = "offlineFirst"), t.queryFn ===
|
|
1753
|
+
)), t.refetchOnReconnect === void 0 && (t.refetchOnReconnect = t.networkMode !== "always"), t.throwOnError === void 0 && (t.throwOnError = !!t.suspense), !t.networkMode && t.persister && (t.networkMode = "offlineFirst"), t.queryFn === zt && (t.enabled = !1), t;
|
|
1754
1754
|
}
|
|
1755
1755
|
defaultMutationOptions(e) {
|
|
1756
1756
|
return e != null && e._defaulted ? e : {
|
|
1757
|
-
...r(this,
|
|
1757
|
+
...r(this, nt).mutations,
|
|
1758
1758
|
...(e == null ? void 0 : e.mutationKey) && this.getMutationDefaults(e.mutationKey),
|
|
1759
1759
|
...e,
|
|
1760
1760
|
_defaulted: !0
|
|
1761
1761
|
};
|
|
1762
1762
|
}
|
|
1763
1763
|
clear() {
|
|
1764
|
-
r(this, F).clear(), r(this,
|
|
1764
|
+
r(this, F).clear(), r(this, it).clear();
|
|
1765
1765
|
}
|
|
1766
|
-
}, F = new WeakMap(),
|
|
1766
|
+
}, F = new WeakMap(), it = new WeakMap(), nt = new WeakMap(), Qt = new WeakMap(), Dt = new WeakMap(), at = new WeakMap(), Tt = new WeakMap(), It = new WeakMap(), Ne), Ve = K.createContext(
|
|
1767
1767
|
void 0
|
|
1768
1768
|
), Cs = (e) => {
|
|
1769
|
-
const t =
|
|
1769
|
+
const t = K.useContext(Ve);
|
|
1770
1770
|
if (!t)
|
|
1771
1771
|
throw new Error("No QueryClient set, use QueryClientProvider to set one");
|
|
1772
1772
|
return t;
|
|
1773
1773
|
}, Os = ({
|
|
1774
1774
|
client: e,
|
|
1775
1775
|
children: t
|
|
1776
|
-
}) => (
|
|
1776
|
+
}) => (K.useEffect(() => (e.mount(), () => {
|
|
1777
1777
|
e.unmount();
|
|
1778
|
-
}), [e]), /* @__PURE__ */
|
|
1778
|
+
}), [e]), /* @__PURE__ */ Vt(Ve.Provider, { value: e, children: t })), ze = K.createContext(!1), Ps = () => K.useContext(ze);
|
|
1779
1779
|
ze.Provider;
|
|
1780
|
-
function
|
|
1780
|
+
function Es() {
|
|
1781
1781
|
let e = !1;
|
|
1782
1782
|
return {
|
|
1783
1783
|
clearReset: () => {
|
|
@@ -1789,10 +1789,10 @@ function Ps() {
|
|
|
1789
1789
|
isReset: () => e
|
|
1790
1790
|
};
|
|
1791
1791
|
}
|
|
1792
|
-
var Fs =
|
|
1792
|
+
var Fs = K.createContext(Es()), Rs = () => K.useContext(Fs), Ms = (e, t) => {
|
|
1793
1793
|
(e.suspense || e.throwOnError || e.experimental_prefetchInRender) && (t.isReset() || (e.retryOnMount = !1));
|
|
1794
1794
|
}, Qs = (e) => {
|
|
1795
|
-
|
|
1795
|
+
K.useEffect(() => {
|
|
1796
1796
|
e.clearReset();
|
|
1797
1797
|
}, [e]);
|
|
1798
1798
|
}, Ds = ({
|
|
@@ -1813,35 +1813,35 @@ var Fs = L.createContext(Ps()), Rs = () => L.useContext(Fs), Ms = (e, t) => {
|
|
|
1813
1813
|
s.clearReset();
|
|
1814
1814
|
});
|
|
1815
1815
|
function As(e, t, s) {
|
|
1816
|
-
var f,
|
|
1816
|
+
var f, P, y, R, m;
|
|
1817
1817
|
if (process.env.NODE_ENV !== "production" && (typeof e != "object" || Array.isArray(e)))
|
|
1818
1818
|
throw new Error(
|
|
1819
1819
|
'Bad argument type. Starting with v5, only the "Object" form is allowed when calling query related functions. Please use the error stack to find the culprit call. More info here: https://tanstack.com/query/latest/docs/react/guides/migrating-to-v5#supports-a-single-signature-one-object'
|
|
1820
1820
|
);
|
|
1821
|
-
const i =
|
|
1822
|
-
(
|
|
1821
|
+
const i = Ps(), n = Rs(), a = Cs(), h = a.defaultQueryOptions(e);
|
|
1822
|
+
(P = (f = a.getDefaultOptions().queries) == null ? void 0 : f._experimental_beforeQuery) == null || P.call(
|
|
1823
1823
|
f,
|
|
1824
1824
|
h
|
|
1825
1825
|
), process.env.NODE_ENV !== "production" && (h.queryFn || console.error(
|
|
1826
1826
|
`[${h.queryHash}]: No queryFn was passed as an option, and no default queryFn was found. The queryFn parameter is only optional when using a default queryFn. More info here: https://tanstack.com/query/latest/docs/framework/react/guides/default-query-function`
|
|
1827
1827
|
)), h._optimisticResults = i ? "isRestoring" : "optimistic", Ts(h), Ms(h, n), Qs(n);
|
|
1828
|
-
const u = !a.getQueryCache().get(h.queryHash), [d] =
|
|
1828
|
+
const u = !a.getQueryCache().get(h.queryHash), [d] = K.useState(
|
|
1829
1829
|
() => new t(
|
|
1830
1830
|
a,
|
|
1831
1831
|
h
|
|
1832
1832
|
)
|
|
1833
|
-
), b = d.getOptimisticResult(h),
|
|
1834
|
-
if (
|
|
1835
|
-
|
|
1833
|
+
), b = d.getOptimisticResult(h), O = !i && e.subscribed !== !1;
|
|
1834
|
+
if (K.useSyncExternalStore(
|
|
1835
|
+
K.useCallback(
|
|
1836
1836
|
(p) => {
|
|
1837
|
-
const
|
|
1838
|
-
return d.updateResult(),
|
|
1837
|
+
const C = O ? d.subscribe(T.batchCalls(p)) : j;
|
|
1838
|
+
return d.updateResult(), C;
|
|
1839
1839
|
},
|
|
1840
|
-
[d,
|
|
1840
|
+
[d, O]
|
|
1841
1841
|
),
|
|
1842
1842
|
() => d.getCurrentResult(),
|
|
1843
1843
|
() => d.getCurrentResult()
|
|
1844
|
-
),
|
|
1844
|
+
), K.useEffect(() => {
|
|
1845
1845
|
d.setOptions(h);
|
|
1846
1846
|
}, [h, d]), qs(h, b))
|
|
1847
1847
|
throw Me(h, d, n);
|
|
@@ -1857,7 +1857,7 @@ function As(e, t, s) {
|
|
|
1857
1857
|
y,
|
|
1858
1858
|
h,
|
|
1859
1859
|
b
|
|
1860
|
-
), h.experimental_prefetchInRender && !
|
|
1860
|
+
), h.experimental_prefetchInRender && !bt && Is(b, i)) {
|
|
1861
1861
|
const p = u ? (
|
|
1862
1862
|
// Fetch immediately on render in order to ensure `.promise` is resolved even if the component is unmounted
|
|
1863
1863
|
Me(h, d, n)
|
|
@@ -1891,38 +1891,35 @@ function Ns({
|
|
|
1891
1891
|
handleDateChanged: i = () => !0,
|
|
1892
1892
|
children: n
|
|
1893
1893
|
}) {
|
|
1894
|
-
const [a, h] = me(s[0][0].date), [u, d] = me(!1), b = We(
|
|
1895
|
-
|
|
1896
|
-
const
|
|
1897
|
-
const
|
|
1898
|
-
|
|
1899
|
-
}, [i]), { data: f, isLoading:
|
|
1900
|
-
queryKey: ["schedule",
|
|
1894
|
+
const [a, h] = me(s[0][0].date), [u, d] = me(!1), b = We(Jt(s[0][0].date, "yyyy-MM-dd"));
|
|
1895
|
+
Gt.setComponent("ScheduleContext"), Gt.log("ScheduleProvider initialized with date: ", a);
|
|
1896
|
+
const O = Je((p) => {
|
|
1897
|
+
const C = Jt(p, "yyyy-MM-dd");
|
|
1898
|
+
C !== b.current && (d(!0), b.current = C), h(p), i(p);
|
|
1899
|
+
}, [i]), { data: f, isLoading: P, isError: y, error: R } = xs({
|
|
1900
|
+
queryKey: ["schedule", Jt(a, "yyyy-MM-dd")],
|
|
1901
1901
|
queryFn: () => e(a),
|
|
1902
1902
|
staleTime: 1e3 * 60 * 15,
|
|
1903
1903
|
// 15 minutes
|
|
1904
1904
|
retry: 1
|
|
1905
1905
|
});
|
|
1906
|
-
|
|
1907
|
-
f !== void 0 && u &&
|
|
1906
|
+
ve(() => {
|
|
1907
|
+
f !== void 0 && u && d(!1);
|
|
1908
1908
|
}, [f, u]), ve(() => {
|
|
1909
|
-
y && (
|
|
1909
|
+
y && (Gt.log("Error fetching schedule for date:", a), Gt.log("Error detials: ", R));
|
|
1910
1910
|
}, [a, y, R]);
|
|
1911
|
-
const m = Ze(() => {
|
|
1912
|
-
|
|
1913
|
-
|
|
1914
|
-
|
|
1915
|
-
|
|
1916
|
-
|
|
1917
|
-
|
|
1918
|
-
|
|
1919
|
-
|
|
1920
|
-
};
|
|
1921
|
-
}, [f, t, s, a, C, u, y, E]);
|
|
1922
|
-
return /* @__PURE__ */ zt(Us.Provider, { value: m, children: n });
|
|
1911
|
+
const m = Ze(() => ({
|
|
1912
|
+
schedule: f ?? t,
|
|
1913
|
+
weeks: s,
|
|
1914
|
+
currentDate: a,
|
|
1915
|
+
isLoading: P || u,
|
|
1916
|
+
isError: y,
|
|
1917
|
+
setCurrentDate: O
|
|
1918
|
+
}), [f, t, s, a, P, u, y, O]);
|
|
1919
|
+
return /* @__PURE__ */ Vt(Us.Provider, { value: m, children: n });
|
|
1923
1920
|
}
|
|
1924
1921
|
function Gs(e) {
|
|
1925
|
-
return /* @__PURE__ */
|
|
1922
|
+
return /* @__PURE__ */ Vt(Os, { client: js, children: /* @__PURE__ */ Vt(Ns, { ...e }) });
|
|
1926
1923
|
}
|
|
1927
1924
|
export {
|
|
1928
1925
|
Us as ScheduleContext,
|