reactjrx 1.73.0 → 1.74.1

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.
package/dist/index.js CHANGED
@@ -1,26 +1,26 @@
1
- var Ht = Object.defineProperty;
2
- var qt = (s, e, t) => e in s ? Ht(s, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : s[e] = t;
3
- var y = (s, e, t) => (qt(s, typeof e != "symbol" ? e + "" : e, t), t), ot = (s, e, t) => {
1
+ var zt = Object.defineProperty;
2
+ var Lt = (s, e, t) => e in s ? zt(s, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : s[e] = t;
3
+ var y = (s, e, t) => (Lt(s, typeof e != "symbol" ? e + "" : e, t), t), lt = (s, e, t) => {
4
4
  if (!e.has(s))
5
5
  throw TypeError("Cannot " + t);
6
6
  };
7
- var a = (s, e, t) => (ot(s, e, "read from private field"), t ? t.call(s) : e.get(s)), w = (s, e, t) => {
7
+ var a = (s, e, t) => (lt(s, e, "read from private field"), t ? t.call(s) : e.get(s)), w = (s, e, t) => {
8
8
  if (e.has(s))
9
9
  throw TypeError("Cannot add the same private member more than once");
10
10
  e instanceof WeakSet ? e.add(s) : e.set(s, t);
11
- }, M = (s, e, t, r) => (ot(s, e, "write to private field"), r ? r.call(s, t) : e.set(s, t), t);
11
+ }, M = (s, e, t, r) => (lt(s, e, "write to private field"), r ? r.call(s, t) : e.set(s, t), t);
12
12
  import * as We from "react";
13
- import { useRef as ye, useMemo as et, useCallback as le, useSyncExternalStore as zt, useEffect as re, createContext as Lt, memo as _t, useContext as Wt, useState as wt } from "react";
14
- import { distinctUntilChanged as P, tap as F, finalize as Gt, catchError as te, EMPTY as be, isObservable as lt, from as ve, of as v, defer as Qe, Subject as U, BehaviorSubject as G, map as g, zip as Jt, merge as C, throttleTime as Yt, asyncScheduler as Bt, switchMap as Q, throwError as me, timer as Ae, Observable as Xt, takeWhile as Ge, filter as $, concatMap as Zt, last as Ke, mergeMap as q, takeUntil as Y, skip as Ct, identity as Et, scan as tt, shareReplay as Ue, ignoreElements as he, first as st, fromEvent as Ne, noop as H, startWith as oe, pairwise as Ft, NEVER as Oe, interval as es, withLatestFrom as ht, retry as ts, iif as ss, concat as ke, toArray as Te, share as fe, take as He, combineLatest as rs, delay as xt, endWith as ns, lastValueFrom as is } from "rxjs";
15
- import { catchError as ft, mergeMap as Xe, retryWhen as us, concatMap as as, first as cs, tap as Rt } from "rxjs/operators";
16
- import { jsxs as os, jsx as ls } from "react/jsx-runtime";
17
- const k = (s) => {
13
+ import { useRef as ye, useMemo as et, useCallback as le, useSyncExternalStore as _t, useEffect as re, createContext as Wt, memo as Gt, useContext as Jt, useState as Ct } from "react";
14
+ import { distinctUntilChanged as Q, tap as E, finalize as Yt, catchError as te, EMPTY as be, isObservable as ht, from as ve, of as S, defer as Qe, Subject as P, BehaviorSubject as J, map as g, zip as Bt, merge as C, throttleTime as Xt, asyncScheduler as Zt, switchMap as A, throwError as me, timer as Ae, Observable as es, takeWhile as Ge, filter as $, concatMap as ts, last as Ke, mergeMap as H, takeUntil as B, skip as Ft, identity as Et, scan as tt, shareReplay as Ue, ignoreElements as he, first as st, fromEvent as Ne, noop as N, startWith as oe, pairwise as xt, NEVER as Oe, delay as rt, interval as ss, withLatestFrom as ft, retry as rs, iif as ns, concat as Te, toArray as ke, share as fe, take as He, combineLatest as is, endWith as us, lastValueFrom as as } from "rxjs";
15
+ import { catchError as dt, mergeMap as Xe, retryWhen as cs, concatMap as os, first as ls, tap as Rt } from "rxjs/operators";
16
+ import { jsxs as hs, jsx as fs } from "react/jsx-runtime";
17
+ const T = (s) => {
18
18
  const e = ye(s);
19
19
  return et(() => {
20
20
  e.current = s;
21
21
  }, [s]), e;
22
22
  };
23
- function hs(s, e) {
23
+ function ds(s, e) {
24
24
  return typeof s == "string" && s === e || typeof s == "number" && s === e || typeof s == "boolean" && s === e || typeof s == "symbol" && s === e || typeof s == "bigint" && s === e || typeof s > "u" && s === e || s === null && s === e;
25
25
  }
26
26
  function Je(s, e, t) {
@@ -30,51 +30,51 @@ function Je(s, e, t) {
30
30
  unsubscribeOnUnmount: !0
31
31
  }, n = t == null && Array.isArray(e) ? e : typeof s == "function" ? t ?? [] : [s], u = ye(
32
32
  "getValue" in s && typeof s.getValue == "function" ? s.getValue() : r.defaultValue
33
- ), i = k(s), l = k(r), f = le(
33
+ ), i = T(s), l = T(r), f = le(
34
34
  (d) => {
35
- const c = i.current, E = (typeof c == "function" ? c : () => c)().pipe(
35
+ const c = i.current, F = (typeof c == "function" ? c : () => c)().pipe(
36
36
  /**
37
37
  * @important
38
38
  * We only check primitives because underlying subscription might
39
39
  * be using objects and keeping same reference but pushing new
40
40
  * properties values
41
41
  */
42
- P(hs),
43
- F((p) => {
42
+ Q(ds),
43
+ E((p) => {
44
44
  u.current = p;
45
45
  }),
46
- Gt(d),
46
+ Yt(d),
47
47
  te((p) => (console.error(p), u.current = void 0, be))
48
48
  ).subscribe(d);
49
49
  return () => {
50
- l.current.unsubscribeOnUnmount !== !1 && E.unsubscribe();
50
+ l.current.unsubscribeOnUnmount !== !1 && F.unsubscribe();
51
51
  };
52
52
  },
53
53
  // eslint-disable-next-line react-hooks/exhaustive-deps
54
54
  [...n]
55
55
  ), h = le(() => u.current, []);
56
- return zt(f, h, h);
56
+ return _t(f, h, h);
57
57
  }
58
- function dt(s) {
58
+ function pt(s) {
59
59
  return s instanceof Promise || s && typeof s.then == "function" && typeof s.catch == "function";
60
60
  }
61
- function A(s) {
62
- if (lt(s))
61
+ function U(s) {
62
+ if (ht(s))
63
63
  return s;
64
- if (dt(s))
64
+ if (pt(s))
65
65
  return ve(s);
66
66
  if (typeof s != "function")
67
- return v(s);
67
+ return S(s);
68
68
  const e = s;
69
69
  return Qe(() => {
70
70
  const t = e();
71
- return dt(t) ? ve(t) : lt(t) ? t : v(t);
71
+ return pt(t) ? ve(t) : ht(t) ? t : S(t);
72
72
  });
73
73
  }
74
74
  function Mt(s, e = []) {
75
- const t = k(s);
75
+ const t = T(s);
76
76
  re(() => {
77
- const r = A(t.current).subscribe();
77
+ const r = U(t.current).subscribe();
78
78
  return () => {
79
79
  r.unsubscribe();
80
80
  };
@@ -93,16 +93,16 @@ const Ye = (s) => {
93
93
  onBeforeComplete: s,
94
94
  completeOnUnmount: e = !0
95
95
  } = {}) => {
96
- const t = Ye(() => new U()), r = ye(!1), n = k(s), u = k(e);
97
- return re(() => (r.current && (t.current = new U(), r.current = !1), () => {
96
+ const t = Ye(() => new P()), r = ye(!1), n = T(s), u = T(e);
97
+ return re(() => (r.current && (t.current = new P(), r.current = !1), () => {
98
98
  if (!u.current) {
99
99
  r.current = !0;
100
100
  return;
101
101
  }
102
102
  r.current || (n.current != null && n.current(), t.current.complete(), r.current = !0);
103
103
  }), [u, n, t]), t;
104
- }, or = () => {
105
- const s = jt(), e = k(s.current.asObservable()), t = le(
104
+ }, lr = () => {
105
+ const s = jt(), e = T(s.current.asObservable()), t = le(
106
106
  (r) => {
107
107
  s.current.next(r);
108
108
  },
@@ -110,13 +110,13 @@ const Ye = (s) => {
110
110
  []
111
111
  );
112
112
  return [e, t];
113
- }, fs = (s) => {
114
- const e = Ye(() => new G(s)), t = ye(!1), r = ye(s);
115
- return re(() => (t.current && (e.current = new G(r.current), t.current = !1), () => {
113
+ }, ps = (s) => {
114
+ const e = Ye(() => new J(s)), t = ye(!1), r = ye(s);
115
+ return re(() => (t.current && (e.current = new J(r.current), t.current = !1), () => {
116
116
  t.current || (e.current.complete(), t.current = !0);
117
117
  }), [e]), e;
118
- }, lr = (s) => {
119
- const e = fs(s), t = k(e.current.asObservable()), r = le(
118
+ }, hr = (s) => {
119
+ const e = ps(s), t = T(e.current.asObservable()), r = le(
120
120
  (n) => {
121
121
  e.current.next(n);
122
122
  },
@@ -124,9 +124,9 @@ const Ye = (s) => {
124
124
  [e.current]
125
125
  );
126
126
  return [t.current, r, e.current.getValue()];
127
- }, ds = Symbol("SIGNAL_RESET");
128
- function hr(s) {
129
- const { default: e } = s ?? {}, t = new G(e);
127
+ }, ys = Symbol("SIGNAL_RESET");
128
+ function fr(s) {
129
+ const { default: e } = s ?? {}, t = new J(e);
130
130
  return {
131
131
  setValue: (u) => {
132
132
  if (typeof u == "function") {
@@ -136,7 +136,7 @@ function hr(s) {
136
136
  t.next(i);
137
137
  return;
138
138
  }
139
- if (u === ds) {
139
+ if (u === ys) {
140
140
  t.next(e ?? void 0);
141
141
  return;
142
142
  }
@@ -147,12 +147,12 @@ function hr(s) {
147
147
  subject: t
148
148
  };
149
149
  }
150
- function fr(s, e) {
150
+ function dr(s, e) {
151
151
  const t = e ?? ((r) => r);
152
152
  return Je(
153
153
  () => s.subject.pipe(
154
154
  g((r) => t(r)),
155
- P()
155
+ Q()
156
156
  ),
157
157
  {
158
158
  defaultValue: t(s.getValue())
@@ -160,23 +160,23 @@ function fr(s, e) {
160
160
  []
161
161
  );
162
162
  }
163
- const pt = (s) => {
163
+ const yt = (s) => {
164
164
  if (!(!s || typeof s != "object"))
165
165
  return s;
166
- }, dr = ({
166
+ }, pr = ({
167
167
  adapter: s,
168
168
  key: e
169
169
  }) => ({
170
170
  getItem: async (t) => {
171
- const r = await s.getItem(e), n = pt(r) ?? {};
171
+ const r = await s.getItem(e), n = yt(r) ?? {};
172
172
  if (t in n)
173
173
  return n[t];
174
174
  },
175
175
  setItem: async (t, r) => {
176
- const n = await s.getItem(e), u = pt(n) ?? {};
176
+ const n = await s.getItem(e), u = yt(n) ?? {};
177
177
  await s.setItem(e, { ...u, [t]: r });
178
178
  }
179
- }), pr = (s) => ({
179
+ }), yr = (s) => ({
180
180
  getItem: async (e) => {
181
181
  const t = await s.getItem(e);
182
182
  if (t)
@@ -185,7 +185,7 @@ const pt = (s) => {
185
185
  setItem: async (e, t) => {
186
186
  await s.setItem(e, JSON.stringify(t));
187
187
  }
188
- }), ps = (s) => ({
188
+ }), bs = (s) => ({
189
189
  getItem: async (e) => {
190
190
  const t = s.getItem(e);
191
191
  if (t)
@@ -194,10 +194,10 @@ const pt = (s) => {
194
194
  setItem: async (e, t) => {
195
195
  s.setItem(e, JSON.stringify(t));
196
196
  }
197
- }), Se = "__reactjrx", ys = (s) => {
197
+ }), Se = "__reactjrx", gs = (s) => {
198
198
  if (typeof s == "object" && s !== null && Se in s && s[Se] === Se)
199
199
  return s;
200
- }, bs = async ({
200
+ }, ms = async ({
201
201
  adapter: s,
202
202
  signal: e,
203
203
  version: t
@@ -208,33 +208,33 @@ const pt = (s) => {
208
208
  migrationVersion: t
209
209
  };
210
210
  await s.setItem(e.config.key, n);
211
- }, gs = ({
211
+ }, Ss = ({
212
212
  adapter: s,
213
213
  version: e,
214
214
  signal: t
215
215
  }) => ve(s.getItem(t.config.key)).pipe(
216
- Q((r) => {
217
- const n = ys(r);
218
- return n ? n.migrationVersion !== void 0 && e > n.migrationVersion ? v(r) : (t.setValue(r.value), v(r)) : v(r);
216
+ A((r) => {
217
+ const n = gs(r);
218
+ return n ? n.migrationVersion !== void 0 && e > n.migrationVersion ? S(r) : (t.setValue(r.value), S(r)) : S(r);
219
219
  })
220
- ), yr = ({
220
+ ), br = ({
221
221
  entries: s = [],
222
222
  onReady: e,
223
- adapter: t = ps(localStorage)
223
+ adapter: t = bs(localStorage)
224
224
  }) => {
225
- const r = k(s), n = k(e), u = k(t), i = Je(
225
+ const r = T(s), n = T(e), u = T(t), i = Je(
226
226
  () => {
227
227
  const l = r.current;
228
- return (l.length === 0 ? v(!0) : Jt(
228
+ return (l.length === 0 ? S(!0) : Bt(
229
229
  ...l.map(
230
- ({ signal: h, version: o }) => gs({
230
+ ({ signal: h, version: o }) => Ss({
231
231
  adapter: u.current,
232
232
  signal: h,
233
233
  version: o
234
234
  })
235
235
  )
236
236
  ).pipe(g(() => !0))).pipe(
237
- F(() => {
237
+ E(() => {
238
238
  n.current != null && n.current();
239
239
  }),
240
240
  te((h) => (console.error("Unable to hydrate", h), be))
@@ -246,18 +246,18 @@ const pt = (s) => {
246
246
  return Mt(() => i ? C(
247
247
  ...r.current.map(
248
248
  ({ signal: l, version: f }) => l.subject.pipe(
249
- Yt(500, Bt, {
249
+ Xt(500, Zt, {
250
250
  trailing: !0
251
251
  }),
252
- Q(
252
+ A(
253
253
  () => ve(
254
- bs({ adapter: u.current, signal: l, version: f })
254
+ ms({ adapter: u.current, signal: l, version: f })
255
255
  )
256
256
  )
257
257
  )
258
258
  )
259
259
  ) : be, [i, u]), { isHydrated: i };
260
- }, br = () => {
260
+ }, gr = () => {
261
261
  const s = jt({
262
262
  onBeforeComplete: () => {
263
263
  s.current.next();
@@ -265,10 +265,10 @@ const pt = (s) => {
265
265
  });
266
266
  return s;
267
267
  };
268
- function ms(s, e) {
268
+ function vs(s, e) {
269
269
  return Math.min(s, e);
270
270
  }
271
- function Ss(s, e) {
271
+ function Os(s, e) {
272
272
  return Math.pow(2, s) * e;
273
273
  }
274
274
  function Qt(s) {
@@ -276,7 +276,7 @@ function Qt(s) {
276
276
  retry: e,
277
277
  retryDelay: t,
278
278
  retryAfterDelay: r,
279
- retryAfter: n = () => v(!0)
279
+ retryAfter: n = () => S(!0)
280
280
  } = s, u = typeof e != "function" ? e === !1 ? 0 : e === !0 ? 1 / 0 : e ?? 1 / 0 : 1 / 0, i = typeof e == "function" ? (
281
281
  // ? (attempt: number, error: TError) => of(retry(attempt, error))
282
282
  e
@@ -286,47 +286,47 @@ function Qt(s) {
286
286
  }, {
287
287
  maxInterval: h = 1 / 0,
288
288
  resetOnSuccess: o = !1,
289
- backoffDelay: d = Ss
289
+ backoffDelay: d = Os
290
290
  } = f;
291
291
  return (c) => Qe(() => {
292
292
  let b = 0;
293
- const E = (p, S) => p < u ? i(p, S) : !1;
293
+ const F = (p, v) => p < u ? i(p, v) : !1;
294
294
  return c.pipe(
295
- ft((p) => {
295
+ dt((p) => {
296
296
  var O;
297
- if (b++, !E(b - 1, p))
297
+ if (b++, !F(b - 1, p))
298
298
  throw p;
299
- const S = (O = s.caughtError) == null ? void 0 : O.call(s, b, p);
300
- if (!S)
299
+ const v = (O = s.caughtError) == null ? void 0 : O.call(s, b, p);
300
+ if (!v)
301
301
  throw p;
302
- return S.pipe(
302
+ return v.pipe(
303
303
  Xe(
304
- (z) => C(
305
- v(z),
304
+ (q) => C(
305
+ S(q),
306
306
  me(() => p)
307
307
  )
308
308
  )
309
309
  );
310
310
  }),
311
- us((p) => p.pipe(
312
- as((S) => {
311
+ cs((p) => p.pipe(
312
+ os((v) => {
313
313
  const O = b - 1;
314
314
  return n().pipe(
315
- cs(),
315
+ ls(),
316
316
  Xe(
317
- () => E(O, S) ? Ae(
318
- ms(
317
+ () => F(O, v) ? Ae(
318
+ vs(
319
319
  d(O, l),
320
320
  h
321
321
  )
322
322
  ).pipe(
323
- Xe((z) => r && !r(O, S) ? me(() => S) : v(z))
324
- ) : me(() => S)
323
+ Xe((q) => r && !r(O, v) ? me(() => v) : S(q))
324
+ ) : me(() => v)
325
325
  )
326
326
  );
327
327
  })
328
328
  )),
329
- ft((p) => {
329
+ dt((p) => {
330
330
  if (s.catchError)
331
331
  return s.catchError(b, p);
332
332
  throw p;
@@ -337,25 +337,25 @@ function Qt(s) {
337
337
  );
338
338
  });
339
339
  }
340
- function yt(s) {
340
+ function bt(s) {
341
341
  return s != null;
342
342
  }
343
- function bt(s) {
343
+ function gt(s) {
344
344
  return Object.prototype.toString.call(s) === "[object Object]";
345
345
  }
346
346
  function Ze(s) {
347
- if (!bt(s))
347
+ if (!gt(s))
348
348
  return !1;
349
349
  const e = s.constructor;
350
350
  if (typeof e > "u")
351
351
  return !0;
352
352
  const t = e.prototype;
353
- return !(!bt(t) || !t.hasOwnProperty("isPrototypeOf"));
353
+ return !(!gt(t) || !t.hasOwnProperty("isPrototypeOf"));
354
354
  }
355
355
  const ge = (s) => JSON.stringify(
356
356
  s,
357
357
  (e, t) => Ze(t) ? Object.keys(t).sort().reduce((r, n) => (r[n] = t[n], r), {}) : t
358
- ), rt = (s = 21) => crypto.getRandomValues(new Uint8Array(s)).reduce((e, t) => (t &= 63, t < 36 ? e += t.toString(36) : t < 62 ? e += (t - 26).toString(36).toUpperCase() : t > 62 ? e += "-" : e += "_", e), ""), ne = () => ({
358
+ ), nt = (s = 21) => crypto.getRandomValues(new Uint8Array(s)).reduce((e, t) => (t &= 63, t < 36 ? e += t.toString(36) : t < 62 ? e += (t - 26).toString(36).toUpperCase() : t > 62 ? e += "-" : e += "_", e), ""), ne = () => ({
359
359
  context: void 0,
360
360
  data: void 0,
361
361
  error: null,
@@ -366,7 +366,7 @@ const ge = (s) => JSON.stringify(
366
366
  failureReason: null,
367
367
  isPaused: !1
368
368
  });
369
- function D(s, e) {
369
+ function I(s, e) {
370
370
  if (s == null || e === void 0 || typeof s != "object" || typeof e != "object")
371
371
  return s === e;
372
372
  if (s.constructor !== (e == null ? void 0 : e.constructor))
@@ -379,10 +379,10 @@ function D(s, e) {
379
379
  return !1;
380
380
  return !0;
381
381
  }
382
- function nt(s) {
382
+ function it(s) {
383
383
  let e = 0;
384
384
  return function(r) {
385
- return new Xt((n) => {
385
+ return new es((n) => {
386
386
  e++;
387
387
  const u = r.subscribe(n);
388
388
  return s(e), () => {
@@ -398,32 +398,32 @@ const $e = (s) => s.pipe(
398
398
  )
399
399
  );
400
400
  var X;
401
- class vs {
401
+ class $s {
402
402
  constructor({
403
403
  __queryFinalizeHook: e
404
404
  } = {}) {
405
- w(this, X, new U());
405
+ w(this, X, new P());
406
406
  y(this, "state$");
407
- const t = new G(0), r = t.pipe(
407
+ const t = new J(0), r = t.pipe(
408
408
  $((n) => n === 0)
409
409
  );
410
410
  this.state$ = a(this, X).pipe(
411
- Zt(({ args: n, mutation: u, options: i }) => {
411
+ ts(({ args: n, mutation: u, options: i }) => {
412
412
  const l = i.mapOperator ?? "merge", f = a(this, X).pipe(
413
413
  $(() => l === "merge")
414
414
  ), h = a(this, X).pipe(
415
415
  $(() => l === "switch"),
416
- F(() => {
416
+ E(() => {
417
417
  u.cancel();
418
418
  })
419
419
  ), o = Qe(() => (u.execute(n), be)), d = u.state$.pipe(
420
420
  $e,
421
421
  Ke(),
422
- q(() => u.state$),
423
- Y(a(this, X))
422
+ H(() => u.state$),
423
+ B(a(this, X))
424
424
  ), c = u.state$.pipe(
425
425
  $e,
426
- Ct(1)
426
+ Ft(1)
427
427
  ), b = C(
428
428
  r,
429
429
  f,
@@ -440,7 +440,7 @@ class vs {
440
440
  o
441
441
  ).pipe(
442
442
  e ?? Et,
443
- Y(b)
443
+ B(b)
444
444
  );
445
445
  }),
446
446
  tt((n, u) => ({
@@ -453,14 +453,14 @@ class vs {
453
453
  error: u.error ?? n.error
454
454
  }
455
455
  }), ne()),
456
- P(
457
- ({ data: n, ...u }, { data: i, ...l }) => D(u, l) && D(n, i)
456
+ Q(
457
+ ({ data: n, ...u }, { data: i, ...l }) => I(u, l) && I(n, i)
458
458
  ),
459
459
  Ue({
460
460
  refCount: !0,
461
461
  bufferSize: 1
462
462
  }),
463
- nt((n) => {
463
+ it((n) => {
464
464
  t.next(n);
465
465
  })
466
466
  );
@@ -478,11 +478,11 @@ function Be(s, e) {
478
478
  return s === e ? !0 : typeof s != typeof e ? !1 : s && e && typeof s == "object" && typeof e == "object" ? !Object.keys(e).some((t) => !Be(s[t], e[t])) : !1;
479
479
  }
480
480
  const qe = (s, e, { exact: t = !1 } = {}) => t ? ge(s) === ge(e) : Be(s, e);
481
- var ie, _;
482
- class Os {
481
+ var ie, L;
482
+ class ws {
483
483
  constructor(e, t = {}, r) {
484
484
  w(this, ie, void 0);
485
- w(this, _, new G(void 0));
485
+ w(this, L, new J(void 0));
486
486
  /**
487
487
  * @important
488
488
  * Used to maintain persistance to latest mutation. This ensure
@@ -503,24 +503,24 @@ class Os {
503
503
  reset: this.reset
504
504
  }));
505
505
  var n;
506
- this.client = e, this.options = t, this.options.mutationKey = ((n = this.options) == null ? void 0 : n.mutationKey) ?? [rt()], M(this, ie, r ?? new vs(this.options)), this.mutate = this.mutate.bind(this), this.reset = this.reset.bind(this), a(this, _).pipe(
507
- $(yt),
508
- q(
506
+ this.client = e, this.options = t, this.options.mutationKey = ((n = this.options) == null ? void 0 : n.mutationKey) ?? [nt()], M(this, ie, r ?? new $s(this.options)), this.mutate = this.mutate.bind(this), this.reset = this.reset.bind(this), a(this, L).pipe(
507
+ $(bt),
508
+ H(
509
509
  (u) => a(this, ie).state$.pipe(
510
- Y(
510
+ B(
511
511
  u.mutation.state$.pipe($e, Ke())
512
512
  )
513
513
  )
514
514
  )
515
- ).subscribe(), this.observed$ = a(this, _).pipe(
516
- Q((u) => (u == null ? void 0 : u.mutation.state$.pipe(
515
+ ).subscribe(), this.observed$ = a(this, L).pipe(
516
+ A((u) => (u == null ? void 0 : u.mutation.state$.pipe(
517
517
  // last(),
518
518
  g((i) => ({
519
519
  state: i,
520
520
  options: u.options
521
521
  }))
522
522
  )) ?? be),
523
- F(({ state: u, options: i }) => {
523
+ E(({ state: u, options: i }) => {
524
524
  u.status === "error" && (i != null && i.onError && (i == null || i.onError(
525
525
  u.error,
526
526
  u.variables,
@@ -551,7 +551,7 @@ class Os {
551
551
  mutationKey: this.options.mutationKey,
552
552
  ...e
553
553
  });
554
- const r = (n = a(this, _).getValue()) == null ? void 0 : n.mutation;
554
+ const r = (n = a(this, L).getValue()) == null ? void 0 : n.mutation;
555
555
  this.options.mutationKey && t.mutationKey && !qe(this.options.mutationKey, t.mutationKey, {
556
556
  exact: !0
557
557
  }) ? this.reset() : r == null || r.setOptions(this.options);
@@ -559,12 +559,12 @@ class Os {
559
559
  observe() {
560
560
  var u;
561
561
  const e = this.getObserverResultFromState(
562
- ((u = a(this, _).getValue()) == null ? void 0 : u.mutation.state) ?? ne()
562
+ ((u = a(this, L).getValue()) == null ? void 0 : u.mutation.state) ?? ne()
563
563
  ), t = a(this, ie).state$.pipe(
564
564
  g((i) => this.getObserverResultFromState(i))
565
- ), r = a(this, _).pipe(
566
- $(yt),
567
- Q((i) => i.mutation.cancelled$),
565
+ ), r = a(this, L).pipe(
566
+ $(bt),
567
+ A((i) => i.mutation.cancelled$),
568
568
  g(() => this.getObserverResultFromState(ne()))
569
569
  );
570
570
  return { result$: C(
@@ -587,7 +587,7 @@ class Os {
587
587
  }
588
588
  async mutate(e, t = {}) {
589
589
  const r = this.client.getMutationCache().build(this.client, this.options);
590
- return a(this, _).next({ mutation: r, options: t }), a(this, ie).trigger({
590
+ return a(this, L).next({ mutation: r, options: t }), a(this, ie).trigger({
591
591
  args: e,
592
592
  options: this.options,
593
593
  mutation: r
@@ -610,34 +610,34 @@ class Os {
610
610
  );
611
611
  }
612
612
  reset() {
613
- const { mutation: e } = a(this, _).getValue() ?? {};
614
- a(this, _).next(void 0), e == null || e.cancel();
613
+ const { mutation: e } = a(this, L).getValue() ?? {};
614
+ a(this, L).next(void 0), e == null || e.cancel();
615
615
  }
616
616
  }
617
- ie = new WeakMap(), _ = new WeakMap();
618
- const At = Lt(void 0), $s = ({ client: s }) => (re(() => (s.mount(), () => {
617
+ ie = new WeakMap(), L = new WeakMap();
618
+ const At = Wt(void 0), Cs = ({ client: s }) => (re(() => (s.mount(), () => {
619
619
  s.unmount();
620
- }), [s]), null), gr = _t(
620
+ }), [s]), null), mr = Gt(
621
621
  ({ children: s, client: e }) => {
622
622
  const t = et(() => e, [e]);
623
- return /* @__PURE__ */ os(At.Provider, { value: t, children: [
624
- /* @__PURE__ */ ls($s, { client: e }),
623
+ return /* @__PURE__ */ hs(At.Provider, { value: t, children: [
624
+ /* @__PURE__ */ fs(Cs, { client: e }),
625
625
  s
626
626
  ] });
627
627
  }
628
628
  ), Ut = (s) => {
629
- const e = Wt(At);
629
+ const e = Jt(At);
630
630
  if (s)
631
631
  return s;
632
632
  if (!e)
633
633
  throw new Error("No QueryClient set, use QueryClientProvider to set one");
634
634
  return e;
635
635
  };
636
- function ws() {
636
+ function Fs() {
637
637
  }
638
- function mr(s, e) {
639
- const t = Ut(e), r = k(s), n = Ye(() => [rt()]), u = ge(s.mutationKey ?? n.current), [i] = wt(
640
- () => new Os(
638
+ function Sr(s, e) {
639
+ const t = Ut(e), r = T(s), n = Ye(() => [nt()]), u = ge(s.mutationKey ?? n.current), [i] = Ct(
640
+ () => new ws(
641
641
  t,
642
642
  s
643
643
  )
@@ -647,7 +647,7 @@ function mr(s, e) {
647
647
  }, [i, s]);
648
648
  const l = et(() => i.observe(), [u, i]), f = Je(l.result$) ?? l.lastValue, h = le(
649
649
  (o, d) => {
650
- i.mutate(o, d).catch(ws);
650
+ i.mutate(o, d).catch(Fs);
651
651
  },
652
652
  [i]
653
653
  );
@@ -655,17 +655,17 @@ function mr(s, e) {
655
655
  r.current.cancelOnUnMount && i.reset();
656
656
  }, [i, r]), { ...f, mutate: h, mutateAsync: f.mutate };
657
657
  }
658
- function Cs(s) {
658
+ function Es(s) {
659
659
  return (e) => e.pipe(
660
660
  Rt((t) => {
661
661
  s.next(t);
662
662
  })
663
663
  );
664
664
  }
665
- class Es {
665
+ class xs {
666
666
  constructor() {
667
- y(this, "isOnlineSubject", new G(!0));
668
- y(this, "online$", this.isOnlineSubject.pipe(P()));
667
+ y(this, "isOnlineSubject", new J(!0));
668
+ y(this, "online$", this.isOnlineSubject.pipe(Q()));
669
669
  y(this, "backToOnline$", this.online$.pipe(
670
670
  $((e) => e),
671
671
  st()
@@ -673,7 +673,7 @@ class Es {
673
673
  C(
674
674
  Ne(window, "offline").pipe(g(() => !1)),
675
675
  Ne(window, "online").pipe(g(() => !0))
676
- ).pipe(Cs(this.isOnlineSubject)).subscribe();
676
+ ).pipe(Es(this.isOnlineSubject)).subscribe();
677
677
  }
678
678
  isOnline() {
679
679
  return this.isOnlineSubject.getValue();
@@ -682,60 +682,60 @@ class Es {
682
682
  this.isOnlineSubject.getValue() !== e && this.isOnlineSubject.next(e);
683
683
  }
684
684
  }
685
- const se = new Es();
686
- function it(s, e) {
685
+ const se = new xs();
686
+ function ut(s, e) {
687
687
  return s.isStaleByTime(e.staleTime);
688
688
  }
689
- function Fs(s, e) {
690
- return e.enabled !== !1 && !s.state.dataUpdatedAt && !(s.state.status === "error" && e.retryOnMount === !1);
689
+ function Rs(s, e) {
690
+ return e.enabled !== !1 && !s.state.dataUpdatedAt && !(s.state.status === "error" && e.retryOnMount === !1) && s.state.fetchStatus !== "fetching";
691
691
  }
692
- function gt(s, e) {
693
- return Fs(s, e) || s.state.dataUpdatedAt > 0 && It(s, e, e.refetchOnMount);
692
+ function mt(s, e) {
693
+ return Rs(s, e) || s.state.dataUpdatedAt > 0 && Pt(s, e, e.refetchOnMount);
694
694
  }
695
- function mt(s, e, t, r) {
696
- return s.state.fetchStatus !== "fetching" && t.enabled !== !1 && (s !== e || r.enabled === !1) && (!t.suspense || s.state.status !== "error") && it(s, t);
695
+ function St(s, e, t, r) {
696
+ return s.state.fetchStatus !== "fetching" && t.enabled !== !1 && (s !== e || r.enabled === !1) && (!t.suspense || s.state.status !== "error") && ut(s, t);
697
697
  }
698
- function xs(s, e) {
699
- return It(s, e, e.refetchOnWindowFocus);
698
+ function Ms(s, e) {
699
+ return Pt(s, e, e.refetchOnWindowFocus);
700
700
  }
701
- function It(s, e, t) {
701
+ function Pt(s, e, t) {
702
702
  if (e.enabled !== !1) {
703
703
  const r = typeof t == "function" ? t(s) : t;
704
- return r === "always" || r !== !1 && it(s, e);
704
+ return r === "idle" ? s.state.fetchStatus === "idle" : r === "always" || r !== !1 && ut(s, e);
705
705
  }
706
706
  return !1;
707
707
  }
708
- function Rs(s) {
708
+ function js(s) {
709
709
  return (s ?? "online") === "online" ? se.isOnline() : !0;
710
710
  }
711
- function St(s, e) {
711
+ function vt(s, e) {
712
712
  return e.reduce(
713
713
  (t, r) => r in s ? { ...t, [r]: s[r] } : t,
714
714
  {}
715
715
  );
716
716
  }
717
- function vt(s) {
717
+ function Ot(s) {
718
718
  return Array.isArray(s) && s.length === Object.keys(s).length;
719
719
  }
720
- function Pt(s, e) {
720
+ function It(s, e) {
721
721
  if (s === e)
722
722
  return s;
723
- const t = vt(s) && vt(e);
723
+ const t = Ot(s) && Ot(e);
724
724
  if (t || Ze(s) && Ze(e)) {
725
725
  const r = t ? s : Object.keys(s), n = r.length, u = t ? e : Object.keys(e), i = u.length, l = t ? [] : {};
726
726
  let f = 0;
727
727
  for (let h = 0; h < i; h++) {
728
728
  const o = t ? h : u[h];
729
- !t && s[o] === void 0 && e[o] === void 0 && r.includes(o) ? (l[o] = void 0, f++) : (l[o] = Pt(s[o], e[o]), l[o] === s[o] && s[o] !== void 0 && f++);
729
+ !t && s[o] === void 0 && e[o] === void 0 && r.includes(o) ? (l[o] = void 0, f++) : (l[o] = It(s[o], e[o]), l[o] === s[o] && s[o] !== void 0 && f++);
730
730
  }
731
731
  return n === i && f === n ? s : l;
732
732
  }
733
733
  return e;
734
734
  }
735
- function ut(s, e) {
735
+ function at(s, e) {
736
736
  return ((e == null ? void 0 : e.queryKeyHashFn) ?? ge)(s);
737
737
  }
738
- function Ot(s, e) {
738
+ function $t(s, e) {
739
739
  const {
740
740
  type: t = "all",
741
741
  exact: r,
@@ -746,7 +746,7 @@ function Ot(s, e) {
746
746
  } = s;
747
747
  if (i) {
748
748
  if (r) {
749
- if (e.queryHash !== ut(i, e.options))
749
+ if (e.queryHash !== at(i, e.options))
750
750
  return !1;
751
751
  } else if (!Be(e.queryKey, i))
752
752
  return !1;
@@ -758,16 +758,16 @@ function Ot(s, e) {
758
758
  }
759
759
  return !(typeof l == "boolean" && e.isStale() !== l || typeof n < "u" && n !== e.state.fetchStatus || u && !u(e));
760
760
  }
761
- function Ms(s, e) {
761
+ function Qs(s, e) {
762
762
  return Math.max(s + (e ?? 0) - Date.now(), 0);
763
763
  }
764
- function js(s, e) {
764
+ function As(s, e) {
765
765
  return typeof s == "function" ? s(e) : s;
766
766
  }
767
767
  function ze(s, e, t) {
768
- return typeof t.structuralSharing == "function" ? t.structuralSharing(s, e) : t.structuralSharing !== !1 ? Pt(s, e) : e;
768
+ return typeof t.structuralSharing == "function" ? t.structuralSharing(s, e) : t.structuralSharing !== !1 ? It(s, e) : e;
769
769
  }
770
- const Qs = ({
770
+ const Us = ({
771
771
  getOptions: s,
772
772
  getState: e,
773
773
  initialState: t
@@ -779,25 +779,25 @@ const Qs = ({
779
779
  const R = n.status === "pending" ? "pending" : i.status ?? n.status;
780
780
  return { ...n, ...i, status: R };
781
781
  }
782
- const l = i.data, f = l !== void 0 && l !== n.data, h = "data" in i, o = i.status === "success", d = n.data !== void 0, c = n.error !== void 0 || n.error !== null, b = i.status ?? n.status, E = f ? ze(e().data, l, s()) : h ? i.data : n.data, p = n.status === "error" || n.status === "success", S = i.status === "error" && (n.status === "error" && n.fetchStatus === "fetching" || n.status !== "error") ? n.errorUpdateCount + 1 : n.errorUpdateCount, O = f ? n.dataUpdateCount + 1 : i.dataUpdateCount ?? n.dataUpdateCount, z = i.status === "pending" && p && // (dataUpdateCount !== 0 || errorUpdateCount !== 0)
783
- (d || c), I = b === "pending" ? null : i.error ?? n.error;
782
+ const l = i.data, f = l !== void 0 && l !== n.data, h = "data" in i, o = i.status === "success", d = n.data !== void 0, c = n.error !== void 0 || n.error !== null, b = i.status ?? n.status, F = f ? ze(e().data, l, s()) : h ? i.data : n.data, p = n.status === "error" || n.status === "success", v = i.status === "error" && (n.status === "error" && n.fetchStatus === "fetching" || n.status !== "error") ? n.errorUpdateCount + 1 : n.errorUpdateCount, O = f ? n.dataUpdateCount + 1 : i.dataUpdateCount ?? n.dataUpdateCount, q = i.status === "pending" && p && // (dataUpdateCount !== 0 || errorUpdateCount !== 0)
783
+ (d || c), V = b === "pending" ? null : i.error ?? n.error;
784
784
  return {
785
785
  ...n,
786
786
  ...i,
787
787
  status: b,
788
- error: I,
789
- errorUpdateCount: S,
788
+ error: V,
789
+ errorUpdateCount: v,
790
790
  ...o && {
791
791
  isInvalidated: !1
792
792
  },
793
- data: E,
793
+ data: F,
794
794
  dataUpdateCount: O,
795
- ...z && {
795
+ ...q && {
796
796
  status: n.status
797
797
  }
798
798
  };
799
799
  }, t)
800
- ), As = (s) => s.pipe(
800
+ ), Ps = (s) => s.pipe(
801
801
  g(
802
802
  ({ status: e, fetchStatus: t }) => t === "idle" && (e === "success" || e === "error")
803
803
  )
@@ -805,23 +805,23 @@ const Qs = ({
805
805
  Ge((e) => e.fetchStatus !== "idle", !0)
806
806
  );
807
807
  var _e, Z;
808
- class Us {
808
+ class Is {
809
809
  constructor() {
810
810
  w(this, _e, C(
811
811
  Ne(document, "visibilitychange"),
812
812
  Ne(window, "visibilitychange")
813
813
  ).pipe(g(() => document.visibilityState)));
814
- w(this, Z, new G(
814
+ w(this, Z, new J(
815
815
  document.visibilityState === "visible"
816
816
  ));
817
817
  // public readonly focused$ = this.#focusedSubject.pipe(distinctUntilChanged())
818
818
  y(this, "focused$", a(this, Z));
819
819
  y(this, "focusRegained$", this.focused$.pipe(
820
- Ct(1),
820
+ Ft(1),
821
821
  $((e) => e)
822
822
  ));
823
823
  a(this, _e).pipe(
824
- F((e) => {
824
+ E((e) => {
825
825
  a(this, Z).next(e === "visible");
826
826
  })
827
827
  ).subscribe();
@@ -850,19 +850,27 @@ class Us {
850
850
  }
851
851
  }
852
852
  _e = new WeakMap(), Z = new WeakMap();
853
- const Le = new Us();
854
- var J, x, we, ue, V, de, Ce;
855
- class Is {
853
+ const Le = new Is(), Vs = (s) => s.pipe(
854
+ $((e) => e.status === "success"),
855
+ g((e) => ({
856
+ data: e.data,
857
+ status: e.status,
858
+ dataUpdatedAt: e.dataUpdatedAt
859
+ })),
860
+ Q(I)
861
+ );
862
+ var Y, x, we, ue, D, de, Ce;
863
+ class Dt {
856
864
  constructor(e, t) {
857
- w(this, J, void 0);
865
+ w(this, Y, void 0);
858
866
  w(this, x, void 0);
859
- w(this, we, new U());
867
+ w(this, we, new P());
860
868
  /**
861
869
  * Used to subscribe to changes in either query or options (or both).
862
870
  * We need to be able to track change to both of them at the same time
863
871
  * in order to react accordingly and in order (such as refetch on options change)
864
872
  */
865
- y(this, "queryUpdateSubject", new U());
873
+ y(this, "queryUpdateSubject", new P());
866
874
  /**
867
875
  * Mostly used to compare the state before and after mount
868
876
  */
@@ -871,7 +879,7 @@ class Is {
871
879
  * Mostly used for internal optimization such as not
872
880
  * running selectors twice, etc
873
881
  */
874
- w(this, V, void 0);
882
+ w(this, D, void 0);
875
883
  // This property keeps track of the last query with defined data.
876
884
  // It will be used to pass the previous data and query to the placeholder function between renders.
877
885
  w(this, de, void 0);
@@ -891,60 +899,60 @@ class Is {
891
899
  }) => {
892
900
  var De;
893
901
  const o = t.state, d = t.state.status === "pending", c = a(this, x), b = this.options, p = t !== c ? t.state : a(this, ue);
894
- let { errorUpdatedAt: S, fetchStatus: O, error: z } = o;
902
+ let { errorUpdatedAt: v, fetchStatus: O, error: q } = o;
895
903
  if (r) {
896
- const K = !!a(this, Ce), ct = !K && gt(t, e), Nt = K && mt(t, c, e, b);
897
- (ct || Nt) && (O = Rs(t.options.networkMode) ? "fetching" : "paused");
904
+ const k = !!a(this, Ce), ot = !k && mt(t, e), qt = k && St(t, c, e, b);
905
+ (ot || qt) && (O = js(t.options.networkMode) ? "fetching" : "paused");
898
906
  }
899
- const I = d && O === "fetching";
900
- let R, m = f, B = l ?? null, T = h;
907
+ const V = d && O === "fetching";
908
+ let R, m = f, _ = l ?? null, W = h;
901
909
  if (e.select && typeof o.data < "u")
902
910
  if (n && o.data === (i == null ? void 0 : i.data) && e.select === l)
903
911
  R = h;
904
912
  else
905
913
  try {
906
- B = e.select, R = e.select(o.data), R = ze(n == null ? void 0 : n.data, R, e), T = R, m = null;
907
- } catch (K) {
908
- R = h, m = K;
914
+ _ = e.select, R = e.select(o.data), R = ze(n == null ? void 0 : n.data, R, e), W = R, m = null;
915
+ } catch (k) {
916
+ R = h, m = k;
909
917
  }
910
918
  else
911
919
  R = o.data, m = null;
912
- let L = O !== "idle" && !o.dataUpdatedAt ? "pending" : o.status;
913
- m && (z = m, R = h, S = (n == null ? void 0 : n.errorUpdatedAt) ?? S, L = "error");
914
- const Ie = L === "error";
915
- let Pe = !1;
916
- if (typeof e.placeholderData < "u" && typeof R > "u" && L === "pending") {
917
- let K;
920
+ let z = O !== "idle" && !o.dataUpdatedAt ? "pending" : o.status;
921
+ m && (q = m, R = h, v = (n == null ? void 0 : n.errorUpdatedAt) ?? v, z = "error");
922
+ const Pe = z === "error";
923
+ let Ie = !1;
924
+ if (typeof e.placeholderData < "u" && typeof R > "u" && z === "pending") {
925
+ let k;
918
926
  if (n != null && n.isPlaceholderData && e.placeholderData === (u == null ? void 0 : u.placeholderData))
919
- K = n.data;
920
- else if (K = typeof e.placeholderData == "function" ? e.placeholderData(
927
+ k = n.data;
928
+ else if (k = typeof e.placeholderData == "function" ? e.placeholderData(
921
929
  (De = a(this, de)) == null ? void 0 : De.state.data,
922
930
  a(this, de)
923
- ) : e.placeholderData, e.select && typeof K < "u")
931
+ ) : e.placeholderData, e.select && typeof k < "u")
924
932
  try {
925
- K = e.select(K);
933
+ k = e.select(k);
926
934
  } catch {
927
935
  }
928
- typeof K < "u" && (L = "success", R = ze(
936
+ typeof k < "u" && (z = "success", R = ze(
929
937
  n == null ? void 0 : n.data,
930
- K,
938
+ k,
931
939
  e
932
- ), Pe = !0);
940
+ ), Ie = !0);
933
941
  }
934
942
  const Ve = O === "fetching";
935
943
  return {
936
944
  result: {
937
- status: L,
945
+ status: z,
938
946
  fetchStatus: O,
939
947
  isPending: d,
940
- isSuccess: L === "success",
941
- isError: Ie,
942
- isInitialLoading: I,
943
- isLoading: I,
948
+ isSuccess: z === "success",
949
+ isError: Pe,
950
+ isInitialLoading: V,
951
+ isLoading: V,
944
952
  data: R,
945
953
  dataUpdatedAt: o.dataUpdatedAt,
946
- error: z,
947
- errorUpdatedAt: S,
954
+ error: q,
955
+ errorUpdatedAt: v,
948
956
  failureCount: o.fetchFailureCount,
949
957
  failureReason: o.fetchFailureReason,
950
958
  errorUpdateCount: o.errorUpdateCount,
@@ -952,20 +960,20 @@ class Is {
952
960
  isFetchedAfterMount: o.dataUpdateCount > p.dataUpdateCount || o.errorUpdateCount > p.errorUpdateCount,
953
961
  isFetching: Ve,
954
962
  isRefetching: Ve && !d,
955
- isLoadingError: Ie && o.dataUpdatedAt === 0,
963
+ isLoadingError: Pe && o.dataUpdatedAt === 0,
956
964
  isPaused: O === "paused",
957
- isPlaceholderData: Pe,
958
- isRefetchError: Ie && o.dataUpdatedAt !== 0,
959
- isStale: it(t, e),
965
+ isPlaceholderData: Ie,
966
+ isRefetchError: Pe && o.dataUpdatedAt !== 0,
967
+ isStale: ut(t, e),
960
968
  // eslint-disable-next-line @typescript-eslint/unbound-method
961
969
  refetch: this.refetch
962
970
  },
963
971
  selectError: m,
964
- select: B,
965
- selectResult: T
972
+ select: _,
973
+ selectResult: W
966
974
  };
967
975
  });
968
- this.options = t, M(this, J, e), this.bindMethods(), M(this, x, this.setOptions(t));
976
+ this.options = t, M(this, Y, e), this.bindMethods(), M(this, x, this.setOptions(t));
969
977
  const r = a(this, x);
970
978
  M(this, ue, r.state);
971
979
  const { result: n, select: u } = this.getObserverResultFromQuery({
@@ -976,7 +984,7 @@ class Is {
976
984
  state: r.state
977
985
  }
978
986
  });
979
- M(this, V, {
987
+ M(this, D, {
980
988
  state: r.state,
981
989
  options: t,
982
990
  result: n,
@@ -988,7 +996,7 @@ class Is {
988
996
  }
989
997
  setOptions(e) {
990
998
  const t = this.options;
991
- if (this.options = a(this, J).defaultQueryOptions(e), D(this.options, t) || a(this, J).getQueryCache().notify({
999
+ if (this.options = a(this, Y).defaultQueryOptions(e), I(this.options, t) || a(this, Y).getQueryCache().notify({
992
1000
  type: "observerOptionsUpdated",
993
1001
  query: a(this, x),
994
1002
  observer: this
@@ -1001,13 +1009,13 @@ class Is {
1001
1009
  }), r;
1002
1010
  }
1003
1011
  buildQuery(e) {
1004
- const t = a(this, J).getQueryCache().build(a(this, J), e);
1012
+ const t = a(this, Y).getQueryCache().build(a(this, Y), e);
1005
1013
  return !t.options.queryFn && this.options.queryFn && t.setOptions(e), t;
1006
1014
  }
1007
1015
  getCurrentResult() {
1008
1016
  return this.getObserverResultFromQuery({
1009
1017
  options: this.options,
1010
- prevResult: a(this, V),
1018
+ prevResult: a(this, D),
1011
1019
  query: a(this, x)
1012
1020
  }).result;
1013
1021
  }
@@ -1019,9 +1027,9 @@ class Is {
1019
1027
  query: t,
1020
1028
  options: e,
1021
1029
  optimisticResult: !0,
1022
- prevResult: a(this, V)
1030
+ prevResult: a(this, D)
1023
1031
  });
1024
- return Ps(this, r.result) && this.updateResult({ query: t, ...r }), r.result;
1032
+ return Ds(this, r.result) && this.updateResult({ query: t, ...r }), r.result;
1025
1033
  }
1026
1034
  updateResult({
1027
1035
  query: e,
@@ -1030,7 +1038,7 @@ class Is {
1030
1038
  select: n,
1031
1039
  selectResult: u
1032
1040
  }) {
1033
- a(this, V).state = e.state, a(this, V).result = t, a(this, V).selectResult = u, r !== void 0 && (a(this, V).selectError = r), n !== void 0 && (a(this, V).select = n), a(this, V).options = this.options, e.state.data !== void 0 && M(this, de, e), a(this, J).getQueryCache().notify({
1041
+ a(this, D).state = e.state, a(this, D).result = t, a(this, D).selectResult = u, r !== void 0 && (a(this, D).selectError = r), n !== void 0 && (a(this, D).select = n), a(this, D).options = this.options, e.state.data !== void 0 && M(this, de, e), a(this, Y).getQueryCache().notify({
1034
1042
  query: a(this, x),
1035
1043
  type: "observerResultsUpdated"
1036
1044
  });
@@ -1050,14 +1058,14 @@ class Is {
1050
1058
  ...e,
1051
1059
  cancelRefetch: (e == null ? void 0 : e.cancelRefetch) ?? !0
1052
1060
  };
1053
- a(this, x).fetch(this.options, r).catch(H), a(this, we).next({
1061
+ a(this, x).fetch(this.options, r).catch(N), a(this, we).next({
1054
1062
  query: t,
1055
1063
  fetchOptions: r
1056
1064
  }), await t.getFetchResultAsPromise();
1057
1065
  const { result: n } = this.getObserverResultFromQuery({
1058
1066
  query: t,
1059
1067
  options: this.options,
1060
- prevResult: a(this, V)
1068
+ prevResult: a(this, D)
1061
1069
  });
1062
1070
  return n;
1063
1071
  }
@@ -1074,21 +1082,21 @@ class Is {
1074
1082
  const e = a(this, x), t = this.queryUpdateSubject.pipe(
1075
1083
  g(({ query: i }) => i),
1076
1084
  oe(a(this, x)),
1077
- P()
1085
+ Q()
1078
1086
  ), r = this.queryUpdateSubject.pipe(
1079
1087
  oe({
1080
1088
  query: a(this, x),
1081
1089
  options: this.options
1082
1090
  }),
1083
- Ft(),
1084
- F(
1091
+ xt(),
1092
+ E(
1085
1093
  ([{ options: i, query: l }, { options: f, query: h }]) => {
1086
- mt(h, l, f, i) && this.fetch().catch(H);
1094
+ St(h, l, f, i) && this.fetch().catch(N);
1087
1095
  }
1088
1096
  ),
1089
1097
  he()
1090
1098
  ), n = t.pipe(
1091
- Q((i) => i.observe(this)),
1099
+ A((i) => i.observe(this)),
1092
1100
  he()
1093
1101
  );
1094
1102
  return C(
@@ -1099,72 +1107,74 @@ class Is {
1099
1107
  n,
1100
1108
  r,
1101
1109
  t.pipe(
1102
- Q((i) => {
1110
+ A((i) => {
1103
1111
  const l = this.options, f = this.queryUpdateSubject.pipe(
1104
1112
  oe({ query: i, options: l }),
1105
1113
  $((m) => m.query === i),
1106
1114
  g((m) => m.options),
1107
- P(),
1115
+ Q(),
1108
1116
  Ue(1)
1109
1117
  ), h = a(this, we).pipe(
1110
1118
  $((m) => m.query === i)
1111
1119
  ), o = i.state$.pipe(
1112
- $((m) => m.status === "success"),
1113
- Q(
1114
- (m) => this.options.staleTime === 1 / 0 ? Oe : Ae(this.options.staleTime ?? 1).pipe(g(() => m))
1120
+ Vs,
1121
+ A(
1122
+ (m) => this.options.staleTime === 1 / 0 ? Oe : (this.options.staleTime ?? 0) <= 0 ? S(m).pipe(rt(1)) : Ae(this.options.staleTime ?? 1)
1115
1123
  ),
1116
1124
  Ge(() => this.options.enabled ?? !0)
1117
- ), d = (m, B) => {
1118
- const T = l.notifyOnChangeProps, L = typeof T == "function" ? T() : T;
1119
- return (Array.isArray(L) ? L.length === 0 ? () => !0 : (Pe, Ve) => {
1120
- const at = St(
1121
- Pe,
1122
- L
1123
- ), De = St(
1125
+ ), d = (m, _) => {
1126
+ const W = l.notifyOnChangeProps, z = typeof W == "function" ? W() : W;
1127
+ return (Array.isArray(z) ? z.length === 0 ? () => !0 : (Ie, Ve) => {
1128
+ const ct = vt(
1129
+ Ie,
1130
+ z
1131
+ ), De = vt(
1124
1132
  Ve,
1125
- L
1133
+ z
1126
1134
  );
1127
- return D(at, De);
1128
- } : D)(m, B);
1135
+ return I(ct, De);
1136
+ } : I)(m, _);
1129
1137
  }, c = h.pipe(
1130
- Q(() => i.state$),
1138
+ A(() => i.state$),
1131
1139
  Vt
1132
1140
  ), b = f.pipe(
1133
- Q(() => {
1134
- const { refetchInterval: m, refetchIntervalInBackground: B } = this.options, T = (typeof m == "function" ? m(a(this, x)) : m) ?? !1;
1135
- return T ? es(T).pipe(
1136
- F(() => {
1137
- // eslint-disable-next-line @typescript-eslint/prefer-nullish-coalescing
1138
- (B || Le.isFocused()) && this.fetch({ cancelRefetch: !1 }).catch(H);
1139
- })
1140
- ) : Oe;
1141
- }),
1141
+ g(({ refetchInterval: m, refetchIntervalInBackground: _ }) => ({
1142
+ refetchInterval: (typeof m == "function" ? m(a(this, x)) : m) ?? !1,
1143
+ refetchIntervalInBackground: _
1144
+ })),
1145
+ Q(I),
1146
+ A(({ refetchInterval: m, refetchIntervalInBackground: _ }) => m ? ss(m).pipe(
1147
+ E(() => {
1148
+ // eslint-disable-next-line @typescript-eslint/prefer-nullish-coalescing
1149
+ (_ || Le.isFocused()) && this.fetch({ cancelRefetch: !1 }).catch(N);
1150
+ })
1151
+ ) : Oe),
1142
1152
  he()
1143
- ), E = f.pipe(
1153
+ ), F = f.pipe(
1144
1154
  g(({ enabled: m }) => m ?? !0),
1145
- P()
1146
- ), p = E.pipe(
1155
+ Q()
1156
+ ), p = F.pipe(
1147
1157
  $((m) => !m),
1148
1158
  g(() => i.state)
1149
- ), S = E.pipe(
1159
+ ), v = F.pipe(
1150
1160
  $((m) => m),
1151
- Q(() => Le.focusRegained$),
1152
- ht(f),
1153
- F(([, m]) => {
1154
- xs(i, m) && this.fetch({ cancelRefetch: !1 }).catch(H);
1161
+ A(() => Le.focusRegained$),
1162
+ ft(f),
1163
+ E(([, m]) => {
1164
+ Ms(i, m) && this.fetch({ cancelRefetch: !1 }).catch(N);
1155
1165
  }),
1156
1166
  he()
1157
1167
  ), O = p.pipe(
1158
1168
  g(() => i.state)
1159
- ), z = (m) => m.pipe(
1160
- ht(f),
1161
- g(([, B]) => {
1162
- const T = this.getObserverResultFromQuery({
1169
+ ), q = (m) => m.pipe(
1170
+ ft(f),
1171
+ g(([, _]) => {
1172
+ const W = this.getObserverResultFromQuery({
1163
1173
  query: i,
1164
- options: B,
1165
- prevResult: a(this, V)
1174
+ options: _,
1175
+ prevResult: a(this, D)
1166
1176
  });
1167
- return this.updateResult({ query: i, ...T }), T.result;
1177
+ return this.updateResult({ query: i, ...W }), W.result;
1168
1178
  })
1169
1179
  ), R = C(
1170
1180
  O,
@@ -1173,19 +1183,19 @@ class Is {
1173
1183
  // options$,
1174
1184
  o
1175
1185
  ).pipe(
1176
- z,
1186
+ q,
1177
1187
  // This one ensure we don't re-trigger same state
1178
- P(D),
1188
+ Q(I),
1179
1189
  // This one make sure we dispatch based on user preference
1180
- P(d)
1190
+ Q(d)
1181
1191
  );
1182
- return C(b, S, R);
1192
+ return C(b, v, R);
1183
1193
  })
1184
1194
  ).pipe(
1185
- nt((i) => M(this, Ce, i)),
1186
- F({
1195
+ it((i) => M(this, Ce, i)),
1196
+ E({
1187
1197
  subscribe: () => {
1188
- gt(e, this.options) && this.fetch().catch(H);
1198
+ mt(e, this.options) && this.fetch().catch(N);
1189
1199
  }
1190
1200
  })
1191
1201
  )
@@ -1194,13 +1204,13 @@ class Is {
1194
1204
  destroy() {
1195
1205
  }
1196
1206
  }
1197
- J = new WeakMap(), x = new WeakMap(), we = new WeakMap(), ue = new WeakMap(), V = new WeakMap(), de = new WeakMap(), Ce = new WeakMap();
1198
- function Ps(s, e) {
1199
- return !D(s.getCurrentResult(), e);
1207
+ Y = new WeakMap(), x = new WeakMap(), we = new WeakMap(), ue = new WeakMap(), D = new WeakMap(), de = new WeakMap(), Ce = new WeakMap();
1208
+ function Ds(s, e) {
1209
+ return !I(s.getCurrentResult(), e);
1200
1210
  }
1201
- const Dt = We.createContext(!1), Vs = () => We.useContext(Dt);
1202
- Dt.Provider;
1203
- function Ds() {
1211
+ const Tt = We.createContext(!1), Ts = () => We.useContext(Tt);
1212
+ Tt.Provider;
1213
+ function ks() {
1204
1214
  let s = !1;
1205
1215
  return {
1206
1216
  clearReset: () => {
@@ -1212,29 +1222,29 @@ function Ds() {
1212
1222
  isReset: () => s
1213
1223
  };
1214
1224
  }
1215
- const ks = We.createContext(Ds()), Ts = () => We.useContext(ks);
1216
- function Ks(s, e) {
1225
+ const Ks = We.createContext(ks()), Ns = () => We.useContext(Ks);
1226
+ function Hs(s, e) {
1217
1227
  return typeof s == "function" ? s(...e) : !!s;
1218
1228
  }
1219
- const Ns = ({
1229
+ const qs = ({
1220
1230
  result: s,
1221
1231
  errorResetBoundary: e,
1222
1232
  throwOnError: t,
1223
1233
  query: r
1224
- }) => s.isError && !e.isReset() && !s.isFetching && r && Ks(t, [s.error, r]);
1225
- function Hs(s, e, t) {
1234
+ }) => s.isError && !e.isReset() && !s.isFetching && r && Hs(t, [s.error, r]);
1235
+ function kt(s, e, t) {
1226
1236
  if (process.env.NODE_ENV !== "production" && (typeof s != "object" || Array.isArray(s)))
1227
1237
  throw new Error(
1228
1238
  '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'
1229
1239
  );
1230
- const r = Ut(t), n = Vs(), u = Ts(), i = r.defaultQueryOptions(s);
1240
+ const r = Ut(t), n = Ts(), u = Ns(), i = r.defaultQueryOptions(s);
1231
1241
  i._optimisticResults = n ? "isRestoring" : "optimistic";
1232
- const [l] = wt(
1242
+ const [l] = Ct(
1233
1243
  () => new e(
1234
1244
  r,
1235
1245
  i
1236
1246
  )
1237
- ), f = Ye(() => l.observe()), h = k(
1247
+ ), f = Ye(() => l.observe()), h = T(
1238
1248
  l.getOptimisticResult(i)
1239
1249
  ), o = h.current;
1240
1250
  Je(
@@ -1244,14 +1254,14 @@ function Hs(s, e, t) {
1244
1254
  * It's important to not skip the first result (even tho most of the time they are equal).
1245
1255
  * We only skip if they are the same.
1246
1256
  */
1247
- $((c) => !D(c, h.current))
1257
+ $((c) => !I(c, h.current))
1248
1258
  ),
1249
1259
  []
1250
1260
  ), re(() => {
1251
1261
  l.setOptions(i);
1252
1262
  }, [i, l]);
1253
1263
  const d = o.error;
1254
- if (d && Ns({
1264
+ if (d && qs({
1255
1265
  result: o,
1256
1266
  errorResetBoundary: u,
1257
1267
  throwOnError: i.throwOnError,
@@ -1262,41 +1272,54 @@ function Hs(s, e, t) {
1262
1272
  throw d;
1263
1273
  return h.current;
1264
1274
  }
1265
- function Sr(s, e) {
1266
- return Hs(s, Is, e);
1275
+ function vr(s, e) {
1276
+ return kt(s, Dt, e);
1277
+ }
1278
+ function Or(s, e) {
1279
+ return kt(
1280
+ {
1281
+ refetchOnMount: "idle",
1282
+ refetchOnReconnect: !1,
1283
+ refetchInterval: !1,
1284
+ refetchOnWindowFocus: !1,
1285
+ ...s
1286
+ },
1287
+ Dt,
1288
+ e
1289
+ );
1267
1290
  }
1268
- function vr(s, e, t = []) {
1269
- const r = e != null && !Array.isArray(e) ? e : {}, n = r.retry ?? !0, u = k(
1291
+ function $r(s, e, t = []) {
1292
+ const r = e != null && !Array.isArray(e) ? e : {}, n = r.retry ?? !0, u = T(
1270
1293
  r.onError ?? ((f) => {
1271
1294
  console.error(f);
1272
1295
  })
1273
- ), i = le(() => A(s), t), l = le(
1296
+ ), i = le(() => U(s), t), l = le(
1274
1297
  () => i().pipe(
1275
1298
  te((f) => {
1276
1299
  throw u.current(f), f;
1277
1300
  }),
1278
- n ? ts() : Et
1301
+ n ? rs() : Et
1279
1302
  ),
1280
1303
  [i, n, u]
1281
1304
  );
1282
1305
  Mt(l, t);
1283
1306
  }
1284
- const kt = () => (s) => C(
1307
+ const Kt = () => (s) => C(
1285
1308
  // eslint-disable-next-line @typescript-eslint/consistent-type-assertions
1286
- v({ isPaused: !0 }),
1309
+ S({ isPaused: !0 }),
1287
1310
  se.backToOnline$.pipe(
1288
- q(
1311
+ H(
1289
1312
  () => (
1290
1313
  // eslint-disable-next-line @typescript-eslint/consistent-type-assertions
1291
- C(v({ isPaused: !1 }), s)
1314
+ C(S({ isPaused: !1 }), s)
1292
1315
  )
1293
1316
  )
1294
1317
  )
1295
- ), qs = (s) => {
1318
+ ), zs = (s) => {
1296
1319
  let e = 0;
1297
1320
  return s.pipe(
1298
1321
  te((t) => (e++, e <= 1 && !se.isOnline() ? C(
1299
- v({
1322
+ S({
1300
1323
  failureCount: e,
1301
1324
  failureReason: t
1302
1325
  }),
@@ -1305,35 +1328,35 @@ const kt = () => (s) => C(
1305
1328
  * timer needed to be iso RQ, so the state returned by mutation include both previous and next one
1306
1329
  */
1307
1330
  Ae(1).pipe(
1308
- q(() => me(() => t).pipe(kt()))
1331
+ H(() => me(() => t).pipe(Kt()))
1309
1332
  )
1310
1333
  ) : me(() => t)))
1311
1334
  );
1312
- }, zs = ({
1335
+ }, Ls = ({
1313
1336
  variables: s,
1314
1337
  state: e,
1315
1338
  options: t
1316
1339
  }) => {
1317
- const r = e.isPaused, n = async () => await Promise.reject(new Error("No mutationFn found")), u = t.mutationFn ?? n, l = ss(
1340
+ const r = e.isPaused, n = async () => await Promise.reject(new Error("No mutationFn found")), u = t.mutationFn ?? n, l = ns(
1318
1341
  () => r,
1319
- v(e.context),
1320
- A(
1342
+ S(e.context),
1343
+ U(
1321
1344
  // eslint-disable-next-line @typescript-eslint/promise-function-async
1322
1345
  () => {
1323
1346
  var c;
1324
1347
  return ((c = t.onMutate) == null ? void 0 : c.call(t, s)) ?? void 0;
1325
1348
  }
1326
1349
  )
1327
- ).pipe(Ue(1)), f = (c, b, E) => (console.error(c), A(
1350
+ ).pipe(Ue(1)), f = (c, b, F) => (console.error(c), U(
1328
1351
  () => {
1329
- var S;
1330
- return (S = t.onError) == null ? void 0 : S.call(t, c, s, b);
1352
+ var v;
1353
+ return (v = t.onError) == null ? void 0 : v.call(t, c, s, b);
1331
1354
  }
1332
1355
  ).pipe(
1333
- te(() => v(c)),
1356
+ te(() => S(c)),
1334
1357
  g(
1335
1358
  () => ({
1336
- failureCount: E,
1359
+ failureCount: F,
1337
1360
  error: c,
1338
1361
  failureReason: c,
1339
1362
  context: b,
@@ -1341,10 +1364,10 @@ const kt = () => (s) => C(
1341
1364
  })
1342
1365
  )
1343
1366
  )), h = l.pipe(
1344
- Q((c) => {
1345
- const E = (typeof u == "function" ? (
1367
+ A((c) => {
1368
+ const F = (typeof u == "function" ? (
1346
1369
  // eslint-disable-next-line @typescript-eslint/promise-function-async
1347
- A(() => u(s))
1370
+ U(() => u(s))
1348
1371
  ) : u).pipe(
1349
1372
  g(
1350
1373
  (p) => ({
@@ -1355,21 +1378,21 @@ const kt = () => (s) => C(
1355
1378
  context: c
1356
1379
  })
1357
1380
  ),
1358
- qs,
1381
+ zs,
1359
1382
  Qt({
1360
1383
  ...t,
1361
- retry: (p, S) => {
1384
+ retry: (p, v) => {
1362
1385
  const O = t.retry ?? 0;
1363
- return typeof O == "function" ? O(p, S) : typeof O == "boolean" ? O : p < O;
1386
+ return typeof O == "function" ? O(p, v) : typeof O == "boolean" ? O : p < O;
1364
1387
  },
1365
- caughtError: (p, S) => (
1388
+ caughtError: (p, v) => (
1366
1389
  // eslint-disable-next-line @typescript-eslint/consistent-type-assertions
1367
- v({
1390
+ S({
1368
1391
  failureCount: p,
1369
- failureReason: S
1392
+ failureReason: v
1370
1393
  })
1371
1394
  ),
1372
- catchError: (p, S) => f(S, c, p).pipe(
1395
+ catchError: (p, v) => f(v, c, p).pipe(
1373
1396
  g((O) => ({
1374
1397
  ...O,
1375
1398
  result: void 0
@@ -1377,13 +1400,13 @@ const kt = () => (s) => C(
1377
1400
  )
1378
1401
  }),
1379
1402
  Ge(
1380
- ({ result: p, error: S }) => (p == null ? void 0 : p.data) === void 0 && S === void 0,
1403
+ ({ result: p, error: v }) => (p == null ? void 0 : p.data) === void 0 && v === void 0,
1381
1404
  !0
1382
1405
  )
1383
1406
  );
1384
- return se.isOnline() || t.networkMode === "offlineFirst" ? E : E.pipe(kt());
1407
+ return se.isOnline() || t.networkMode === "offlineFirst" ? F : F.pipe(Kt());
1385
1408
  })
1386
- ), o = v({
1409
+ ), o = S({
1387
1410
  ...e,
1388
1411
  variables: s,
1389
1412
  status: "pending",
@@ -1397,43 +1420,43 @@ const kt = () => (s) => C(
1397
1420
  // eslint-disable-next-line @typescript-eslint/consistent-type-assertions
1398
1421
  l.pipe(g((c) => ({ context: c }))),
1399
1422
  h.pipe(
1400
- Q(({ result: c, error: b, ...E }) => {
1423
+ A(({ result: c, error: b, ...F }) => {
1401
1424
  if (!c && !b)
1402
- return v({
1403
- ...E
1425
+ return S({
1426
+ ...F
1404
1427
  });
1405
- const p = b ? v(null) : A(
1428
+ const p = b ? S(null) : U(
1406
1429
  () => {
1407
- var I;
1408
- return (I = t.onSuccess) == null ? void 0 : I.call(
1430
+ var V;
1431
+ return (V = t.onSuccess) == null ? void 0 : V.call(
1409
1432
  t,
1410
1433
  c == null ? void 0 : c.data,
1411
1434
  s,
1412
- E.context
1435
+ F.context
1413
1436
  );
1414
1437
  }
1415
- ), O = A(
1438
+ ), O = U(
1416
1439
  () => {
1417
- var I;
1418
- return (I = t.onSettled) == null ? void 0 : I.call(
1440
+ var V;
1441
+ return (V = t.onSettled) == null ? void 0 : V.call(
1419
1442
  t,
1420
1443
  c == null ? void 0 : c.data,
1421
1444
  b,
1422
1445
  s,
1423
- E.context
1446
+ F.context
1424
1447
  );
1425
1448
  }
1426
1449
  ).pipe(
1427
- te((I) => c ? v(c) : v(I))
1450
+ te((V) => c ? S(c) : S(V))
1428
1451
  );
1429
- return ke(p, O).pipe(
1430
- Te(),
1452
+ return Te(p, O).pipe(
1453
+ ke(),
1431
1454
  g(
1432
1455
  () => b ? {
1433
1456
  error: b,
1434
1457
  data: void 0,
1435
1458
  variables: s,
1436
- ...E
1459
+ ...F
1437
1460
  } : {
1438
1461
  status: "success",
1439
1462
  error: b,
@@ -1441,11 +1464,11 @@ const kt = () => (s) => C(
1441
1464
  variables: s,
1442
1465
  failureCount: 0,
1443
1466
  failureReason: null,
1444
- ...E
1467
+ ...F
1445
1468
  }
1446
1469
  ),
1447
1470
  te(
1448
- (I) => f(I, E.context, 0).pipe(
1471
+ (V) => f(V, F.context, 0).pipe(
1449
1472
  g((R) => ({
1450
1473
  ...R,
1451
1474
  data: void 0
@@ -1462,34 +1485,34 @@ const kt = () => (s) => C(
1462
1485
  data: b.data ?? c.data,
1463
1486
  error: b.error ?? c.error
1464
1487
  }), ne()),
1465
- P(
1466
- ({ data: c, ...b }, { data: E, ...p }) => D(b, p) && D(c, E)
1488
+ Q(
1489
+ ({ data: c, ...b }, { data: F, ...p }) => I(b, p) && I(c, F)
1467
1490
  )
1468
1491
  );
1469
1492
  };
1470
- var Ee, ee, pe;
1471
- class Ls {
1493
+ var Fe, ee, pe;
1494
+ class _s {
1472
1495
  constructor({
1473
1496
  options: e,
1474
1497
  mutationCache: t,
1475
1498
  state: r
1476
1499
  }) {
1477
- w(this, Ee, new G(0));
1478
- w(this, ee, new U());
1479
- w(this, pe, new U());
1500
+ w(this, Fe, new J(0));
1501
+ w(this, ee, new P());
1502
+ w(this, pe, new P());
1480
1503
  y(this, "state", ne());
1481
1504
  y(this, "state$");
1482
1505
  y(this, "options");
1483
- y(this, "observerCount$", a(this, Ee).asObservable());
1506
+ y(this, "observerCount$", a(this, Fe).asObservable());
1484
1507
  y(this, "cancelled$", a(this, ee).asObservable());
1485
1508
  this.options = e, this.state = r ?? this.state;
1486
1509
  const n = a(this, pe).pipe(
1487
- Q(
1488
- (u) => zs({
1510
+ A(
1511
+ (u) => Ls({
1489
1512
  options: {
1490
1513
  ...this.options,
1491
1514
  onMutate: (i) => {
1492
- const l = A(
1515
+ const l = U(
1493
1516
  () => {
1494
1517
  var d, c;
1495
1518
  return (c = (d = t.config).onMutate) == null ? void 0 : c.call(
@@ -1498,16 +1521,16 @@ class Ls {
1498
1521
  this
1499
1522
  );
1500
1523
  }
1501
- ), h = A(() => {
1524
+ ), h = U(() => {
1502
1525
  var d, c;
1503
1526
  return (c = (d = this.options).onMutate) == null ? void 0 : c.call(d, i);
1504
1527
  });
1505
1528
  return l.pipe(
1506
- q(() => h)
1529
+ H(() => h)
1507
1530
  );
1508
1531
  },
1509
1532
  onError: (i, l, f) => {
1510
- const h = A(
1533
+ const h = U(
1511
1534
  () => {
1512
1535
  var d, c;
1513
1536
  return (c = (d = t.config).onError) == null ? void 0 : c.call(
@@ -1518,16 +1541,16 @@ class Ls {
1518
1541
  this
1519
1542
  );
1520
1543
  }
1521
- ), o = A(
1544
+ ), o = U(
1522
1545
  () => {
1523
1546
  var d, c;
1524
1547
  return (c = (d = this.options).onError) == null ? void 0 : c.call(d, i, l, f);
1525
1548
  }
1526
1549
  );
1527
- return ke(h, o).pipe(Te());
1550
+ return Te(h, o).pipe(ke());
1528
1551
  },
1529
1552
  onSettled: (i, l, f, h) => {
1530
- const o = A(
1553
+ const o = U(
1531
1554
  () => {
1532
1555
  var c, b;
1533
1556
  return (b = (c = t.config).onSettled) == null ? void 0 : b.call(
@@ -1539,16 +1562,16 @@ class Ls {
1539
1562
  this
1540
1563
  );
1541
1564
  }
1542
- ), d = A(
1565
+ ), d = U(
1543
1566
  () => {
1544
1567
  var c, b;
1545
1568
  return (b = (c = this.options).onSettled) == null ? void 0 : b.call(c, i, l, f, h);
1546
1569
  }
1547
1570
  );
1548
- return ke(o, d).pipe(Te());
1571
+ return Te(o, d).pipe(ke());
1549
1572
  },
1550
1573
  onSuccess: (i, l, f) => {
1551
- const h = A(
1574
+ const h = U(
1552
1575
  () => {
1553
1576
  var d, c;
1554
1577
  return (c = (d = t.config).onSuccess) == null ? void 0 : c.call(
@@ -1559,18 +1582,18 @@ class Ls {
1559
1582
  this
1560
1583
  );
1561
1584
  }
1562
- ), o = A(
1585
+ ), o = U(
1563
1586
  () => {
1564
1587
  var d, c;
1565
1588
  return (c = (d = this.options).onSuccess) == null ? void 0 : c.call(d, i, l, f);
1566
1589
  }
1567
1590
  );
1568
- return ke(h, o).pipe(Te());
1591
+ return Te(h, o).pipe(ke());
1569
1592
  }
1570
1593
  },
1571
1594
  state: this.state,
1572
1595
  variables: u
1573
- }).pipe(Y(a(this, ee)))
1596
+ }).pipe(B(a(this, ee)))
1574
1597
  )
1575
1598
  );
1576
1599
  this.state$ = C(
@@ -1582,18 +1605,18 @@ class Ls {
1582
1605
  Oe
1583
1606
  ).pipe(
1584
1607
  oe(this.state),
1585
- F((u) => {
1608
+ E((u) => {
1586
1609
  this.state = { ...this.state, ...u };
1587
1610
  }),
1588
- Y(a(this, ee)),
1611
+ B(a(this, ee)),
1589
1612
  /**
1590
1613
  * refCount as true somewhat make NEVER complete when there are
1591
1614
  * no more observers. I thought I should have to complete manually (which is
1592
1615
  * why we still cancel the observable when we remove it from cache)
1593
1616
  */
1594
1617
  Ue({ bufferSize: 1, refCount: !1 }),
1595
- nt((u) => {
1596
- a(this, Ee).next(u);
1618
+ it((u) => {
1619
+ a(this, Fe).next(u);
1597
1620
  })
1598
1621
  );
1599
1622
  }
@@ -1619,21 +1642,21 @@ class Ls {
1619
1642
  a(this, ee).next(), a(this, ee).complete();
1620
1643
  }
1621
1644
  }
1622
- Ee = new WeakMap(), ee = new WeakMap(), pe = new WeakMap();
1623
- const $t = ({
1645
+ Fe = new WeakMap(), ee = new WeakMap(), pe = new WeakMap();
1646
+ const wt = ({
1624
1647
  mutationKey: s,
1625
1648
  status: e,
1626
1649
  predicate: t,
1627
1650
  exact: r = !0
1628
1651
  } = {}) => (u) => r && s !== void 0 && u.options.mutationKey !== void 0 && !qe(u.options.mutationKey, s, { exact: r }) || !r && s !== void 0 && u.options.mutationKey !== void 0 && !qe(u.options.mutationKey, s, { exact: r }) || e && u.state.status !== e ? !1 : t ? t(u) : !0;
1629
- class Tt {
1652
+ class Nt {
1630
1653
  constructor() {
1631
1654
  /**
1632
1655
  * @important
1633
1656
  * Query store. Could be turned into a map for more performance.
1634
1657
  */
1635
- y(this, "entriesSubject", new G([]));
1636
- y(this, "changeSubject", new U());
1658
+ y(this, "entriesSubject", new J([]));
1659
+ y(this, "changeSubject", new P());
1637
1660
  y(this, "entries$", this.entriesSubject.pipe(fe()));
1638
1661
  y(this, "added$", this.changeSubject.pipe(
1639
1662
  $(({ type: e }) => e === "added"),
@@ -1648,14 +1671,14 @@ class Tt {
1648
1671
  y(this, "stateChange$", C(
1649
1672
  this.entriesSubject.pipe(
1650
1673
  st(),
1651
- q((e) => ve(e))
1674
+ H((e) => ve(e))
1652
1675
  ),
1653
1676
  this.added$
1654
1677
  ).pipe(
1655
- q(
1678
+ H(
1656
1679
  (e) => e.state$.pipe(
1657
1680
  g(() => e),
1658
- Y(
1681
+ B(
1659
1682
  this.removed$.pipe(
1660
1683
  $((t) => t === e)
1661
1684
  )
@@ -1680,14 +1703,14 @@ class Tt {
1680
1703
  return this.entriesSubject.getValue().find(e);
1681
1704
  }
1682
1705
  }
1683
- var N;
1684
- class _s {
1706
+ var K;
1707
+ class Ws {
1685
1708
  constructor(e = {}) {
1686
- w(this, N, new Tt());
1709
+ w(this, K, new Nt());
1687
1710
  this.config = e;
1688
1711
  }
1689
1712
  build(e, t, r) {
1690
- const n = new Ls({
1713
+ const n = new _s({
1691
1714
  mutationCache: this,
1692
1715
  options: e.defaultMutationOptions(t),
1693
1716
  state: r
@@ -1698,38 +1721,38 @@ class _s {
1698
1721
  * we start the process of cleaning it up based on gc settings
1699
1722
  */
1700
1723
  $(({ status: u }) => u === "success" || u === "error"),
1701
- Q(
1724
+ A(
1702
1725
  () => n.observerCount$.pipe(
1703
1726
  $((u) => u <= 1),
1704
1727
  He(1)
1705
1728
  )
1706
1729
  ),
1707
1730
  // defaults to 5mn
1708
- Q(() => Ae(n.options.gcTime ?? 5 * 60 * 1e3)),
1731
+ A(() => Ae(n.options.gcTime ?? 5 * 60 * 1e3)),
1709
1732
  He(1)
1710
1733
  ).subscribe({
1711
1734
  complete: () => {
1712
1735
  this.remove(n);
1713
1736
  }
1714
- }), a(this, N).add(n), n;
1737
+ }), a(this, K).add(n), n;
1715
1738
  }
1716
1739
  getAll() {
1717
1740
  return this.findAll();
1718
1741
  }
1719
1742
  remove(e) {
1720
- const t = a(this, N).getValues().find((r) => r === e);
1721
- t == null || t.cancel(), a(this, N).remove(e);
1743
+ const t = a(this, K).getValues().find((r) => r === e);
1744
+ t == null || t.cancel(), a(this, K).remove(e);
1722
1745
  }
1723
1746
  find(e) {
1724
- const t = { exact: !0, ...e }, r = $t(t);
1725
- return a(this, N).getValues().find((n) => r(n));
1747
+ const t = { exact: !0, ...e }, r = wt(t);
1748
+ return a(this, K).getValues().find((n) => r(n));
1726
1749
  }
1727
1750
  findAll(e = {}) {
1728
- const t = { exact: !0, ...e }, r = $t(t);
1729
- return a(this, N).getValues().filter((n) => r(n)).map((n) => n);
1751
+ const t = { exact: !0, ...e }, r = wt(t);
1752
+ return a(this, K).getValues().filter((n) => r(n)).map((n) => n);
1730
1753
  }
1731
1754
  observe() {
1732
- return a(this, N).stateChange$.pipe(oe());
1755
+ return a(this, K).stateChange$.pipe(oe());
1733
1756
  }
1734
1757
  /**
1735
1758
  * @important
@@ -1737,24 +1760,24 @@ class _s {
1737
1760
  */
1738
1761
  subscribe(e) {
1739
1762
  const t = C(
1740
- a(this, N).added$.pipe(
1741
- F((r) => {
1763
+ a(this, K).added$.pipe(
1764
+ E((r) => {
1742
1765
  e({
1743
1766
  type: "added",
1744
1767
  mutation: r
1745
1768
  });
1746
1769
  })
1747
1770
  ),
1748
- a(this, N).removed$.pipe(
1749
- F((r) => {
1771
+ a(this, K).removed$.pipe(
1772
+ E((r) => {
1750
1773
  e({
1751
1774
  type: "removed",
1752
1775
  mutation: r
1753
1776
  });
1754
1777
  })
1755
1778
  ),
1756
- a(this, N).stateChange$.pipe(
1757
- F((r) => {
1779
+ a(this, K).stateChange$.pipe(
1780
+ E((r) => {
1758
1781
  e({
1759
1782
  type: "updated",
1760
1783
  action: {
@@ -1777,7 +1800,7 @@ class _s {
1777
1800
  if (!e.length)
1778
1801
  return be;
1779
1802
  const t = e.map((r) => r.continue());
1780
- return rs(t);
1803
+ return is(t);
1781
1804
  }
1782
1805
  clear() {
1783
1806
  this.getAll().forEach((e) => {
@@ -1785,9 +1808,9 @@ class _s {
1785
1808
  });
1786
1809
  }
1787
1810
  }
1788
- N = new WeakMap();
1789
- const Ws = typeof window > "u" || "Deno" in window;
1790
- function Gs(s) {
1811
+ K = new WeakMap();
1812
+ const Gs = typeof window > "u" || "Deno" in window;
1813
+ function Js(s) {
1791
1814
  const e = typeof s.initialData == "function" ? s.initialData() : s.initialData, t = typeof e < "u", r = t ? typeof s.initialDataUpdatedAt == "function" ? s.initialDataUpdatedAt() : s.initialDataUpdatedAt : 0;
1792
1815
  return {
1793
1816
  data: e,
@@ -1804,42 +1827,42 @@ function Gs(s) {
1804
1827
  fetchStatus: "idle"
1805
1828
  };
1806
1829
  }
1807
- const Js = (s) => Qe(() => Le.isFocused() ? s : Le.focusRegained$.pipe(q(() => s))), Ys = (s) => {
1830
+ const Ys = (s) => Qe(() => Le.isFocused() ? s : Le.focusRegained$.pipe(H(() => s))), Bs = (s) => {
1808
1831
  let e = 0;
1809
1832
  return (t) => {
1810
1833
  const r = se.backToOnline$.pipe(
1811
- q(
1834
+ H(
1812
1835
  () => C(
1813
- v({ fetchStatus: "fetching" }),
1836
+ S({ fetchStatus: "fetching" }),
1814
1837
  t
1815
1838
  )
1816
1839
  )
1817
1840
  );
1818
1841
  return Qe(() => (e++, !se.isOnline() && s.networkMode === "offlineFirst" && e > 1 ? C(
1819
- v({ fetchStatus: "paused" }),
1842
+ S({ fetchStatus: "paused" }),
1820
1843
  r
1821
1844
  ) : !se.isOnline() && s.networkMode !== "always" && s.networkMode !== "offlineFirst" ? C(
1822
- v({ fetchStatus: "paused" }),
1845
+ S({ fetchStatus: "paused" }),
1823
1846
  r
1824
1847
  ) : t));
1825
1848
  };
1826
- }, Bs = (s) => (e) => {
1827
- const t = new U(), r = t.pipe(
1849
+ }, Xs = (s) => (e) => {
1850
+ const t = new P(), r = t.pipe(
1828
1851
  st(),
1829
1852
  /**
1830
1853
  * Since we set hasDataSubject synchronously, we need to wait
1831
1854
  * for the next tick to make sure observable chain received this data at least
1832
1855
  */
1833
- xt(1),
1834
- q(() => s.pipe($((n) => n === 0)))
1856
+ rt(1),
1857
+ H(() => s.pipe($((n) => n === 0)))
1835
1858
  );
1836
1859
  return e.pipe(
1837
- F(() => {
1860
+ E(() => {
1838
1861
  t.next();
1839
1862
  }),
1840
- Y(r)
1863
+ B(r)
1841
1864
  );
1842
- }, Xs = (s) => {
1865
+ }, Zs = (s) => {
1843
1866
  const e = async () => await Promise.reject(new Error("No query found"));
1844
1867
  let t = !1;
1845
1868
  const r = s.queryFn ?? e, n = new AbortController(), u = {
@@ -1854,12 +1877,12 @@ const Js = (s) => Qe(() => Le.isFocused() ? s : Le.focusRegained$.pipe(q(() => s
1854
1877
  })(u);
1855
1878
  const f = (typeof r == "function" ? (
1856
1879
  // eslint-disable-next-line @typescript-eslint/promise-function-async
1857
- A(
1880
+ U(
1858
1881
  () => r(u)
1859
1882
  )
1860
1883
  ) : r).pipe(
1861
- Bs(s.observers$),
1862
- F({
1884
+ Xs(s.observers$),
1885
+ E({
1863
1886
  complete: () => {
1864
1887
  console.log("Query.execution$.complete"), t = !0;
1865
1888
  }
@@ -1870,11 +1893,11 @@ const Js = (s) => Qe(() => Le.isFocused() ? s : Le.focusRegained$.pipe(q(() => s
1870
1893
  })
1871
1894
  ),
1872
1895
  // takeUntil(hasDataAndNoObservers$),
1873
- Ys(s),
1896
+ Bs(s),
1874
1897
  Qt({
1875
1898
  ...s,
1876
- retryAfter: () => v(!0).pipe(Js),
1877
- catchError: (o, d) => v({
1899
+ retryAfter: () => S(!0).pipe(Ys),
1900
+ catchError: (o, d) => S({
1878
1901
  status: "error",
1879
1902
  fetchStatus: "idle",
1880
1903
  fetchFailureCount: o,
@@ -1883,13 +1906,13 @@ const Js = (s) => Qe(() => Le.isFocused() ? s : Le.focusRegained$.pipe(q(() => s
1883
1906
  }),
1884
1907
  caughtError: (o, d) => (
1885
1908
  // eslint-disable-next-line @typescript-eslint/consistent-type-assertions
1886
- v({
1909
+ S({
1887
1910
  fetchFailureCount: o,
1888
1911
  fetchFailureReason: d
1889
1912
  })
1890
1913
  )
1891
1914
  }),
1892
- q((o) => "data" in o ? v({
1915
+ H((o) => "data" in o ? S({
1893
1916
  ...o,
1894
1917
  status: "success",
1895
1918
  fetchStatus: "idle",
@@ -1912,19 +1935,19 @@ const Js = (s) => Qe(() => Le.isFocused() ? s : Le.focusRegained$.pipe(q(() => s
1912
1935
  *
1913
1936
  * There is in theory no problem associated to that.
1914
1937
  */
1915
- xt(1),
1938
+ rt(1),
1916
1939
  g(
1917
1940
  (d) => t ? d : { ...d, fetchStatus: "fetching" }
1918
1941
  )
1919
- ) : v(o)),
1942
+ ) : S(o)),
1920
1943
  /**
1921
1944
  * When the fn complete we can release the fetch status, if it was already released
1922
1945
  * before shallow compare will not update the state, otherwise it's our chance to catch
1923
1946
  * the end of observable fn.
1924
1947
  */
1925
- ns({ fetchStatus: "idle" }),
1948
+ us({ fetchStatus: "idle" }),
1926
1949
  fe()
1927
- ), h = v({
1950
+ ), h = S({
1928
1951
  status: "pending",
1929
1952
  fetchStatus: se.isOnline() ? "fetching" : "paused"
1930
1953
  });
@@ -1937,15 +1960,15 @@ const Js = (s) => Qe(() => Le.isFocused() ? s : Le.focusRegained$.pipe(q(() => s
1937
1960
  abortController: n
1938
1961
  };
1939
1962
  };
1940
- class Zs {
1963
+ class er {
1941
1964
  constructor(e) {
1942
1965
  y(this, "revert");
1943
1966
  y(this, "silent");
1944
1967
  this.revert = e == null ? void 0 : e.revert, this.silent = e == null ? void 0 : e.silent;
1945
1968
  }
1946
1969
  }
1947
- const er = { backgroundColor: "transparent", color: "inherit" };
1948
- function Kt(s) {
1970
+ const tr = { backgroundColor: "transparent", color: "inherit" };
1971
+ function Ht(s) {
1949
1972
  const e = {
1950
1973
  namespaces: [
1951
1974
  {
@@ -1954,10 +1977,10 @@ function Kt(s) {
1954
1977
  }
1955
1978
  ],
1956
1979
  namespace(t, r) {
1957
- const n = Kt(s);
1980
+ const n = Ht(s);
1958
1981
  return n.namespaces.push({
1959
1982
  name: t,
1960
- style: r ?? er
1983
+ style: r ?? tr
1961
1984
  }), n;
1962
1985
  },
1963
1986
  printNamespaces() {
@@ -1996,30 +2019,30 @@ function Kt(s) {
1996
2019
  };
1997
2020
  return e;
1998
2021
  }
1999
- const tr = Kt("production");
2000
- var Fe, ae;
2001
- class sr {
2022
+ const sr = Ht("production");
2023
+ var Ee, ae;
2024
+ class rr {
2002
2025
  constructor(e) {
2003
2026
  y(this, "queryKey");
2004
2027
  y(this, "queryHash");
2005
2028
  y(this, "gcTime");
2006
2029
  y(this, "options");
2007
- w(this, Fe, void 0);
2030
+ w(this, Ee, void 0);
2008
2031
  w(this, ae, void 0);
2009
2032
  y(this, "state");
2010
2033
  // @todo to share with mutation
2011
- y(this, "executeSubject", new U());
2012
- y(this, "cancelSubject", new U());
2013
- y(this, "setDataSubject", new U());
2014
- y(this, "invalidatedSubject", new U());
2015
- y(this, "resetSubject", new U());
2016
- y(this, "destroySubject", new U());
2017
- y(this, "observersSubject", new G([]));
2034
+ y(this, "executeSubject", new P());
2035
+ y(this, "cancelSubject", new P());
2036
+ y(this, "setDataSubject", new P());
2037
+ y(this, "invalidatedSubject", new P());
2038
+ y(this, "resetSubject", new P());
2039
+ y(this, "destroySubject", new P());
2040
+ y(this, "observersSubject", new J([]));
2018
2041
  y(this, "abortSignalConsumed", !1);
2019
2042
  y(this, "observerCount$", this.observersSubject.asObservable().pipe(g((e) => e.length)));
2020
2043
  y(this, "observers$", this.observersSubject.asObservable());
2021
2044
  y(this, "state$");
2022
- M(this, Fe, e.defaultOptions), this.options = this.setOptions(e.options), this.queryKey = e.queryKey, this.queryHash = e.queryHash, M(this, ae, e.state ?? Gs(this.options)), this.state = a(this, ae), this.gcTime = this.updateGcTime(this.options.gcTime), this.state$ = C(
2045
+ M(this, Ee, e.defaultOptions), this.options = this.setOptions(e.options), this.queryKey = e.queryKey, this.queryHash = e.queryHash, M(this, ae, e.state ?? Js(this.options)), this.state = a(this, ae), this.gcTime = this.updateGcTime(this.options.gcTime), this.state$ = C(
2023
2046
  this.resetSubject.pipe(
2024
2047
  g(() => ({ command: "reset", state: a(this, ae) }))
2025
2048
  ),
@@ -2039,24 +2062,24 @@ class sr {
2039
2062
  state: {
2040
2063
  status: t != null && t.revert ? this.state.status : "error",
2041
2064
  fetchStatus: "idle",
2042
- error: new Zs(t)
2065
+ error: new er(t)
2043
2066
  }
2044
2067
  }))
2045
2068
  ),
2046
2069
  this.executeSubject.pipe(
2047
- q(() => {
2070
+ H(() => {
2048
2071
  let t = !1;
2049
2072
  const r = this.executeSubject.pipe(
2050
2073
  // should not be needed since the fetch return current promise
2051
2074
  // in case we don't cancel
2052
2075
  $((h) => (h == null ? void 0 : h.cancelRefetch) !== !1)
2053
2076
  ), n = this.observers$.pipe(
2054
- Ft(),
2055
- F(([h, o]) => {
2077
+ xt(),
2078
+ E(([h, o]) => {
2056
2079
  o.length === 0 && h.length > 0 ? t = !0 : t = !1;
2057
2080
  }),
2058
2081
  he()
2059
- ), { state$: u, abortController: i } = Xs({
2082
+ ), { state$: u, abortController: i } = Zs({
2060
2083
  ...this.options,
2061
2084
  observers$: this.observerCount$,
2062
2085
  queryKey: this.queryKey,
@@ -2070,7 +2093,7 @@ class sr {
2070
2093
  }
2071
2094
  }), l = this.observerCount$.pipe(
2072
2095
  $((h) => h === 0 && this.abortSignalConsumed),
2073
- F(() => {
2096
+ E(() => {
2074
2097
  this.cancelSubject.next({ revert: !0 });
2075
2098
  })
2076
2099
  ), f = C(
@@ -2079,7 +2102,7 @@ class sr {
2079
2102
  this.resetSubject,
2080
2103
  l
2081
2104
  ).pipe(
2082
- F(() => {
2105
+ E(() => {
2083
2106
  this.abortSignalConsumed && i.abort();
2084
2107
  })
2085
2108
  );
@@ -2088,7 +2111,7 @@ class sr {
2088
2111
  command: "execute",
2089
2112
  state: h
2090
2113
  })),
2091
- Y(f)
2114
+ B(f)
2092
2115
  );
2093
2116
  })
2094
2117
  ),
@@ -2103,25 +2126,25 @@ class sr {
2103
2126
  }))
2104
2127
  )
2105
2128
  ).pipe(
2106
- Qs({
2129
+ Us({
2107
2130
  initialState: this.state,
2108
2131
  getOptions: () => this.options,
2109
2132
  getState: () => this.state
2110
2133
  }),
2111
2134
  oe(a(this, ae)),
2112
- P(D),
2113
- F((t) => {
2135
+ Q(I),
2136
+ E((t) => {
2114
2137
  this.state = t;
2115
2138
  }),
2116
2139
  te((t) => {
2117
- throw tr.error(t), t;
2140
+ throw sr.error(t), t;
2118
2141
  }),
2119
- Y(this.destroySubject),
2142
+ B(this.destroySubject),
2120
2143
  Ue({ bufferSize: 1, refCount: !1 })
2121
2144
  );
2122
2145
  }
2123
2146
  setOptions(e) {
2124
- return this.options = { ...a(this, Fe), ...e }, this.updateGcTime(this.options.gcTime), this.options;
2147
+ return this.options = { ...a(this, Ee), ...e }, this.updateGcTime(this.options.gcTime), this.options;
2125
2148
  }
2126
2149
  get meta() {
2127
2150
  return this.options.meta;
@@ -2129,27 +2152,27 @@ class sr {
2129
2152
  get success$() {
2130
2153
  return this.state$.pipe(
2131
2154
  g(({ data: e, status: t }) => ({ data: e, status: t })),
2132
- P(D),
2155
+ Q(I),
2133
2156
  $(({ status: e }) => e === "success")
2134
2157
  );
2135
2158
  }
2136
2159
  get error$() {
2137
2160
  return this.state$.pipe(
2138
2161
  g(({ error: e, status: t }) => ({ error: e, status: t })),
2139
- P(D),
2162
+ Q(I),
2140
2163
  $(({ status: e }) => e === "error")
2141
2164
  );
2142
2165
  }
2143
2166
  get settled$() {
2144
2167
  return this.state$.pipe(
2145
2168
  g(({ status: e }) => ({ status: e })),
2146
- P(D),
2169
+ Q(I),
2147
2170
  $(({ status: e }) => e === "success" || e === "error")
2148
2171
  );
2149
2172
  }
2150
2173
  observe(e) {
2151
2174
  return this.state$.pipe(
2152
- F({
2175
+ E({
2153
2176
  subscribe: () => {
2154
2177
  this.observersSubject.next([
2155
2178
  e,
@@ -2171,7 +2194,7 @@ class sr {
2171
2194
  updateGcTime(e) {
2172
2195
  return this.gcTime = Math.max(
2173
2196
  this.gcTime || 0,
2174
- e ?? (Ws ? 1 / 0 : 5 * 60 * 1e3)
2197
+ e ?? (Gs ? 1 / 0 : 5 * 60 * 1e3)
2175
2198
  ), this.gcTime;
2176
2199
  }
2177
2200
  isActive() {
@@ -2184,7 +2207,7 @@ class sr {
2184
2207
  return this.state.isInvalidated || !this.state.dataUpdatedAt || this.observersSubject.getValue().some((e) => e.getCurrentResult().isStale);
2185
2208
  }
2186
2209
  isStaleByTime(e = 0) {
2187
- return this.state.isInvalidated || !this.state.dataUpdatedAt || !Ms(this.state.dataUpdatedAt, e);
2210
+ return this.state.isInvalidated || !this.state.dataUpdatedAt || !Qs(this.state.dataUpdatedAt, e);
2188
2211
  }
2189
2212
  async getFetchResultAsPromise() {
2190
2213
  return await new Promise((e, t) => {
@@ -2219,14 +2242,14 @@ class sr {
2219
2242
  this.resetSubject.next();
2220
2243
  }
2221
2244
  }
2222
- Fe = new WeakMap(), ae = new WeakMap();
2223
- var xe, W;
2224
- class rr {
2245
+ Ee = new WeakMap(), ae = new WeakMap();
2246
+ var xe, G;
2247
+ class nr {
2225
2248
  // protected mountSubscriptions: Subscription[]
2226
2249
  constructor(e = {}) {
2227
2250
  // readonly #queries: QueryStore = new Map<string, Query>()
2228
- w(this, xe, new U());
2229
- w(this, W, new Tt());
2251
+ w(this, xe, new P());
2252
+ w(this, G, new Nt());
2230
2253
  this.config = e;
2231
2254
  }
2232
2255
  mount() {
@@ -2237,27 +2260,27 @@ class rr {
2237
2260
  a(this, xe).next(e);
2238
2261
  }
2239
2262
  observeIsFetching(e) {
2240
- return a(this, W).stateChange$.pipe(
2263
+ return a(this, G).stateChange$.pipe(
2241
2264
  // we force a first result
2242
2265
  oe(),
2243
2266
  g(() => this.findAll({
2244
2267
  ...e,
2245
2268
  fetchStatus: "fetching"
2246
2269
  }).length),
2247
- P()
2270
+ Q()
2248
2271
  );
2249
2272
  }
2250
2273
  getAll() {
2251
- return [...a(this, W).getValues()];
2274
+ return [...a(this, G).getValues()];
2252
2275
  }
2253
2276
  findAll(e = {}) {
2254
2277
  const t = this.getAll();
2255
- return Object.keys(e).length > 0 ? t.filter((r) => Ot(e, r)) : t;
2278
+ return Object.keys(e).length > 0 ? t.filter((r) => $t(e, r)) : t;
2256
2279
  }
2257
2280
  build(e, t, r) {
2258
- const n = t.queryKey ?? [rt()], u = t.queryHash ?? ut(n, t);
2281
+ const n = t.queryKey ?? [nt()], u = t.queryHash ?? at(n, t);
2259
2282
  let i = this.get(u);
2260
- return i || (i = new sr({
2283
+ return i || (i = new rr({
2261
2284
  cache: this,
2262
2285
  queryKey: n,
2263
2286
  queryHash: u,
@@ -2267,8 +2290,8 @@ class rr {
2267
2290
  }), this.add(i)), i;
2268
2291
  }
2269
2292
  add(e) {
2270
- if (!a(this, W).find((t) => t.queryHash === e.queryHash)) {
2271
- a(this, W).add(e);
2293
+ if (!a(this, G).find((t) => t.queryHash === e.queryHash)) {
2294
+ a(this, G).add(e);
2272
2295
  const t = e.observerCount$.pipe(
2273
2296
  $((r) => r < 1),
2274
2297
  He(1)
@@ -2292,10 +2315,10 @@ class rr {
2292
2315
  * Once a mutation is finished and there are no more observers than us
2293
2316
  * we start the process of cleaning it up based on gc settings
2294
2317
  */
2295
- As,
2296
- Q((r) => r ? t.pipe(
2318
+ Ps,
2319
+ A((r) => r ? t.pipe(
2297
2320
  // defaults to 5mn
2298
- Q(() => e.gcTime === 1 / 0 ? Oe : (setTimeout(H, e.gcTime), Ae(e.gcTime)))
2321
+ A(() => e.gcTime === 1 / 0 ? Oe : (setTimeout(N, e.gcTime), Ae(e.gcTime)))
2299
2322
  ) : Oe),
2300
2323
  He(1)
2301
2324
  ).subscribe({
@@ -2306,17 +2329,17 @@ class rr {
2306
2329
  }
2307
2330
  }
2308
2331
  get(e) {
2309
- return a(this, W).find((t) => t.queryHash === e);
2332
+ return a(this, G).find((t) => t.queryHash === e);
2310
2333
  }
2311
2334
  find(e) {
2312
2335
  const t = { exact: !0, ...e };
2313
2336
  return this.getAll().find(
2314
- (r) => Ot(t, r)
2337
+ (r) => $t(t, r)
2315
2338
  );
2316
2339
  }
2317
2340
  subscribe(e) {
2318
2341
  const t = C(
2319
- a(this, xe).pipe(F(e))
2342
+ a(this, xe).pipe(E(e))
2320
2343
  // this.#store.added$.pipe(
2321
2344
  // mergeMap((query) => {
2322
2345
  // fn({
@@ -2346,15 +2369,15 @@ class rr {
2346
2369
  };
2347
2370
  }
2348
2371
  remove(e) {
2349
- const t = a(this, W).find((r) => r === e);
2350
- t && (e.destroy(), t === e && a(this, W).remove(e));
2372
+ const t = a(this, G).find((r) => r === e);
2373
+ t && (e.destroy(), t === e && a(this, G).remove(e));
2351
2374
  }
2352
2375
  clear() {
2353
2376
  }
2354
2377
  }
2355
- xe = new WeakMap(), W = new WeakMap();
2378
+ xe = new WeakMap(), G = new WeakMap();
2356
2379
  var ce, j, Re, Me, je;
2357
- class Or {
2380
+ class wr {
2358
2381
  // #destroy = () => {}
2359
2382
  constructor({
2360
2383
  mutationCache: e,
@@ -2366,7 +2389,7 @@ class Or {
2366
2389
  w(this, Re, /* @__PURE__ */ new Map());
2367
2390
  w(this, Me, /* @__PURE__ */ new Map());
2368
2391
  w(this, je, void 0);
2369
- M(this, ce, e ?? new _s()), M(this, j, t ?? new rr()), M(this, je, r ?? {});
2392
+ M(this, ce, e ?? new Ws()), M(this, j, t ?? new nr()), M(this, je, r ?? {});
2370
2393
  }
2371
2394
  mount() {
2372
2395
  }
@@ -2393,7 +2416,7 @@ class Or {
2393
2416
  ...e,
2394
2417
  _defaulted: !0
2395
2418
  };
2396
- return t.queryHash || (t.queryHash = ut(
2419
+ return t.queryHash || (t.queryHash = at(
2397
2420
  t.queryKey,
2398
2421
  t
2399
2422
  )), typeof t.refetchOnReconnect > "u" && (t.refetchOnReconnect = t.networkMode !== "always"), typeof t.throwOnError > "u" && (t.throwOnError = !!t.suspense), typeof t.networkMode > "u" && t.persister && (t.networkMode = "offlineFirst"), t;
@@ -2405,7 +2428,7 @@ class Or {
2405
2428
  return r.isStaleByTime(t.staleTime) ? await r.fetch(t) : await Promise.resolve(r.state.data);
2406
2429
  }
2407
2430
  async prefetchQuery(e) {
2408
- await this.fetchQuery(e).then(H).catch(H);
2431
+ await this.fetchQuery(e).then(N).catch(N);
2409
2432
  }
2410
2433
  async resetQueries(e, t) {
2411
2434
  const r = a(this, j), n = {
@@ -2422,9 +2445,9 @@ class Or {
2422
2445
  cancelRefetch: (t == null ? void 0 : t.cancelRefetch) ?? !0
2423
2446
  }, n = a(this, j).findAll(e).filter((u) => !u.isDisabled()).map(async (u) => {
2424
2447
  let i = u.fetch(void 0, r);
2425
- return r.throwOnError || (i = i.catch(H)), u.state.fetchStatus === "paused" ? void 0 : await i;
2448
+ return r.throwOnError || (i = i.catch(N)), u.state.fetchStatus === "paused" ? void 0 : await i;
2426
2449
  });
2427
- await Promise.all(n).then(H);
2450
+ await Promise.all(n).then(N);
2428
2451
  }
2429
2452
  getQueryData(e) {
2430
2453
  var r;
@@ -2432,7 +2455,7 @@ class Or {
2432
2455
  return (r = a(this, j).get(t.queryHash)) == null ? void 0 : r.state.data;
2433
2456
  }
2434
2457
  setQueryData(e, t, r) {
2435
- const n = a(this, j).find({ queryKey: e }), u = n == null ? void 0 : n.state.data, i = js(t, u);
2458
+ const n = a(this, j).find({ queryKey: e }), u = n == null ? void 0 : n.state.data, i = As(t, u);
2436
2459
  if (typeof i > "u")
2437
2460
  return;
2438
2461
  const l = this.defaultQueryOptions({ queryKey: e });
@@ -2478,7 +2501,7 @@ class Or {
2478
2501
  const r = { revert: !0, ...t }, n = a(this, j).findAll(e).map(async (u) => {
2479
2502
  await u.cancel(r);
2480
2503
  });
2481
- await Promise.all(n).then(H).catch(H);
2504
+ await Promise.all(n).then(N).catch(N);
2482
2505
  }
2483
2506
  async invalidateQueries(e = {}, t = {}) {
2484
2507
  if (a(this, j).findAll(e).forEach((n) => {
@@ -2494,7 +2517,7 @@ class Or {
2494
2517
  await this.refetchQueries(r, t);
2495
2518
  }
2496
2519
  async resumePausedMutations() {
2497
- return await is(a(this, ce).resumePausedMutations());
2520
+ return await as(a(this, ce).resumePausedMutations());
2498
2521
  }
2499
2522
  isFetching(e) {
2500
2523
  return a(this, j).findAll({ ...e, fetchStatus: "fetching" }).length;
@@ -2505,29 +2528,30 @@ class Or {
2505
2528
  }
2506
2529
  ce = new WeakMap(), j = new WeakMap(), Re = new WeakMap(), Me = new WeakMap(), je = new WeakMap();
2507
2530
  export {
2508
- _s as MutationCache,
2509
- rr as QueryCache,
2510
- Or as QueryClient,
2511
- gr as QueryClientProvider,
2512
- ds as SIGNAL_RESET,
2513
- pr as createLocalforageAdapter,
2514
- dr as createSharedStoreAdapter,
2515
- Ss as exponentialBackoffDelay,
2516
- ms as getDelay,
2517
- yt as isDefined,
2531
+ Ws as MutationCache,
2532
+ nr as QueryCache,
2533
+ wr as QueryClient,
2534
+ mr as QueryClientProvider,
2535
+ ys as SIGNAL_RESET,
2536
+ yr as createLocalforageAdapter,
2537
+ pr as createSharedStoreAdapter,
2538
+ Os as exponentialBackoffDelay,
2539
+ vs as getDelay,
2540
+ bt as isDefined,
2518
2541
  Qt as retryBackoff,
2519
- hr as signal,
2520
- fs as useBehaviorSubject,
2521
- k as useLiveRef,
2522
- mr as useMutation,
2523
- lr as useObservableState,
2542
+ fr as signal,
2543
+ ps as useBehaviorSubject,
2544
+ Or as useForeverQuery,
2545
+ T as useLiveRef,
2546
+ Sr as useMutation,
2547
+ hr as useObservableState,
2524
2548
  Je as useObserve,
2525
- or as useObserveCallback,
2526
- yr as usePersistSignals,
2527
- Sr as useQuery,
2528
- fr as useSignalValue,
2549
+ lr as useObserveCallback,
2550
+ br as usePersistSignals,
2551
+ vr as useQuery,
2552
+ dr as useSignalValue,
2529
2553
  jt as useSubject,
2530
2554
  Mt as useSubscribe,
2531
- vr as useSubscribeEffect,
2532
- br as useUnmountObservable
2555
+ $r as useSubscribeEffect,
2556
+ gr as useUnmountObservable
2533
2557
  };