@pdf-viewer/react 1.11.0-beta.2 → 1.11.0-rc.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.
Files changed (82) hide show
  1. package/dist/{ToolbarLayout.module-082ff242.js → ToolbarLayout.module-e774f3e1.js} +979 -973
  2. package/dist/assets/ToolbarLayout.css +1 -1
  3. package/dist/components/RPConfig.js +962 -843
  4. package/dist/components/RPController.js +1 -1
  5. package/dist/components/RPPages.js +1 -1
  6. package/dist/components/layout/LayoutContainer.js +1 -1
  7. package/dist/components/layout/RPDefaultLayout.js +1 -1
  8. package/dist/components/layout/RPLayout.js +1 -1
  9. package/dist/components/layout/sidebar/RPSidebar.js +1 -1
  10. package/dist/components/layout/sidebar/Thumbnail.js +1 -1
  11. package/dist/components/layout/sidebar/Thumbnails.js +1 -1
  12. package/dist/components/layout/toolbar/DocumentDialog.js +1 -1
  13. package/dist/components/layout/toolbar/FileDownloadTool.js +1 -1
  14. package/dist/components/layout/toolbar/MenuItem.js +1 -1
  15. package/dist/components/layout/toolbar/MenuSeparator.js +1 -1
  16. package/dist/components/layout/toolbar/MostPageTool.js +2 -2
  17. package/dist/components/layout/toolbar/OtherTool.js +2 -2
  18. package/dist/components/layout/toolbar/Paginate.js +1 -1
  19. package/dist/components/layout/toolbar/PrintTool.js +1 -1
  20. package/dist/components/layout/toolbar/RPMoreOptions.js +2 -2
  21. package/dist/components/layout/toolbar/RPToolbar.js +1 -1
  22. package/dist/components/layout/toolbar/RPToolbarEnd.js +1 -1
  23. package/dist/components/layout/toolbar/RotateTool.js +1 -1
  24. package/dist/components/layout/toolbar/ScrollModeTool.js +1 -1
  25. package/dist/components/layout/toolbar/SearchResultNavigator.js +1 -1
  26. package/dist/components/layout/toolbar/SearchTool.js +1 -1
  27. package/dist/components/layout/toolbar/SelectionModeTool.js +1 -1
  28. package/dist/components/layout/toolbar/ThumbnailTool.js +1 -1
  29. package/dist/components/layout/toolbar/ToolbarCustom.js +1 -1
  30. package/dist/components/layout/toolbar/ToolbarDefault.js +1 -1
  31. package/dist/components/layout/toolbar/ViewModeTool.js +1 -1
  32. package/dist/components/layout/toolbar/ZoomTool.js +1 -1
  33. package/dist/components/layout/toolbar/tools/DocumentPropertiesTool.js +1 -1
  34. package/dist/components/layout/toolbar/tools/FileDownloadTool.js +1 -1
  35. package/dist/components/layout/toolbar/tools/InputPageTool.js +1 -1
  36. package/dist/components/layout/toolbar/tools/NextPageTool.js +1 -1
  37. package/dist/components/layout/toolbar/tools/PreviousPageTool.js +1 -1
  38. package/dist/components/layout/toolbar/tools/PrintTool.js +1 -1
  39. package/dist/components/layout/toolbar/tools/ThumbnailTool.js +1 -1
  40. package/dist/components/layout/toolbar/tools/ZoomLevelTool.js +1 -1
  41. package/dist/components/layout/toolbar/tools/defaults/RPHorizontalBar.js +1 -1
  42. package/dist/components/layout/toolbar/tools/more-options/FileDownloadTool.js +1 -1
  43. package/dist/components/layout/toolbar/tools/more-options/FileUploadTool.js +1 -1
  44. package/dist/components/layout/toolbar/tools/more-options/MostPageTool.js +2 -2
  45. package/dist/components/layout/toolbar/tools/more-options/PrintTool.js +1 -1
  46. package/dist/components/layout/toolbar/tools/more-options/RotateTool.js +1 -1
  47. package/dist/components/layout/toolbar/tools/more-options/ScrollModeTool.js +1 -1
  48. package/dist/components/layout/toolbar/tools/more-options/SelectionModeTool.js +1 -1
  49. package/dist/components/layout/toolbar/tools/more-options/ViewModeTool.js +1 -1
  50. package/dist/components/page/AnnotationLayer.js +1 -1
  51. package/dist/components/page/CanvasLayer.js +1 -1
  52. package/dist/components/page/DualPage.js +1 -1
  53. package/dist/components/page/RPPage.js +1 -1
  54. package/dist/components/page/SinglePage.js +1 -1
  55. package/dist/components/page/TextHighlightLayer.js +1 -1
  56. package/dist/components/page/TextLayer.js +1 -1
  57. package/dist/components/ui/Checkbox.js +237 -125
  58. package/dist/components/ui/DropDown.js +1 -1
  59. package/dist/components/ui/LoadingIndicator.js +1 -1
  60. package/dist/components/ui/RPTooltip.js +211 -424
  61. package/dist/contexts/PaginationContext.js +1 -1
  62. package/dist/contexts/PrintContext.js +1 -1
  63. package/dist/contexts/RenderQueueProvider.js +1 -1
  64. package/dist/contexts/SearchContext.js +1 -1
  65. package/dist/contexts/ThumbnailsContext.js +1 -1
  66. package/dist/index-808ea7bf.js +1685 -0
  67. package/dist/index-a48ec088.js +1672 -0
  68. package/dist/index-c9a2990a.js +332 -0
  69. package/dist/main.js +1 -1
  70. package/dist/utils/hooks/useFileDownload.js +1 -1
  71. package/dist/utils/hooks/useLicense.js +1 -1
  72. package/dist/utils/hooks/usePaginate.js +1 -1
  73. package/dist/utils/hooks/usePresentPage.js +1 -1
  74. package/dist/utils/hooks/usePrint.js +1 -1
  75. package/dist/utils/hooks/useScrollToPage.js +1 -1
  76. package/dist/utils/hooks/useSearch.js +1 -1
  77. package/dist/utils/hooks/useThumbnail.js +1 -1
  78. package/dist/utils/hooks/useVirtualReactWindow.js +1 -1
  79. package/package.json +1 -1
  80. package/dist/floating-ui.react-dom-88a86594.js +0 -1447
  81. package/dist/index-48ca3f30.js +0 -307
  82. package/dist/index-4ba3ab9a.js +0 -1877
@@ -1,33 +1,33 @@
1
- var we = (t, e, s) => {
2
- if (!e.has(t))
1
+ var St = (e, t, s) => {
2
+ if (!t.has(e))
3
3
  throw TypeError("Cannot " + s);
4
4
  };
5
- var i = (t, e, s) => (we(t, e, "read from private field"), s ? s.call(t) : e.get(t)), l = (t, e, s) => {
6
- if (e.has(t))
5
+ var i = (e, t, s) => (St(e, t, "read from private field"), s ? s.call(e) : t.get(e)), c = (e, t, s) => {
6
+ if (t.has(e))
7
7
  throw TypeError("Cannot add the same private member more than once");
8
- e instanceof WeakSet ? e.add(t) : e.set(t, s);
9
- }, o = (t, e, s, r) => (we(t, e, "write to private field"), r ? r.call(t, s) : e.set(t, s), s);
10
- var ye = (t, e, s, r) => ({
8
+ t instanceof WeakSet ? t.add(e) : t.set(e, s);
9
+ }, o = (e, t, s, r) => (St(e, t, "write to private field"), r ? r.call(e, s) : t.set(e, s), s);
10
+ var bt = (e, t, s, r) => ({
11
11
  set _(n) {
12
- o(t, e, n, s);
12
+ o(e, t, n, s);
13
13
  },
14
14
  get _() {
15
- return i(t, e, r);
16
- }
17
- }), P = (t, e, s) => (we(t, e, "access private method"), s);
18
- import { jsx as oe } from "react/jsx-runtime";
19
- import { RPTheme as ze } from "./RPTheme.js";
20
- import { ConfigContextProvider as Be } from "../contexts/ConfigContext.js";
21
- import { useLoadWorker as Je } from "../utils/hooks/useLoadWorker.js";
22
- import * as He from "react";
23
- import { LicenseProvider as We } from "../contexts/LicenseContext.js";
24
- var ge = class {
15
+ return i(e, t, r);
16
+ }
17
+ }), F = (e, t, s) => (St(e, t, "access private method"), s);
18
+ import { jsx as dt } from "react/jsx-runtime";
19
+ import { RPTheme as te } from "./RPTheme.js";
20
+ import { ConfigContextProvider as ee } from "../contexts/ConfigContext.js";
21
+ import { useLoadWorker as se } from "../utils/hooks/useLoadWorker.js";
22
+ import * as Bt from "react";
23
+ import { LicenseProvider as re } from "../contexts/LicenseContext.js";
24
+ var Ct = class {
25
25
  constructor() {
26
26
  this.listeners = /* @__PURE__ */ new Set(), this.subscribe = this.subscribe.bind(this);
27
27
  }
28
- subscribe(t) {
29
- return this.listeners.add(t), this.onSubscribe(), () => {
30
- this.listeners.delete(t), this.onUnsubscribe();
28
+ subscribe(e) {
29
+ return this.listeners.add(e), this.onSubscribe(), () => {
30
+ this.listeners.delete(e), this.onUnsubscribe();
31
31
  };
32
32
  }
33
33
  hasListeners() {
@@ -37,146 +37,203 @@ var ge = class {
37
37
  }
38
38
  onUnsubscribe() {
39
39
  }
40
- }, be = typeof window > "u" || "Deno" in globalThis;
41
- function Q() {
40
+ }, ie = {
41
+ // We need the wrapper function syntax below instead of direct references to
42
+ // global setTimeout etc.
43
+ //
44
+ // BAD: `setTimeout: setTimeout`
45
+ // GOOD: `setTimeout: (cb, delay) => setTimeout(cb, delay)`
46
+ //
47
+ // If we use direct references here, then anything that wants to spy on or
48
+ // replace the global setTimeout (like tests) won't work since we'll already
49
+ // have a hard reference to the original implementation at the time when this
50
+ // file was imported.
51
+ setTimeout: (e, t) => setTimeout(e, t),
52
+ clearTimeout: (e) => clearTimeout(e),
53
+ setInterval: (e, t) => setInterval(e, t),
54
+ clearInterval: (e) => clearInterval(e)
55
+ }, x, W, Ut, ne = (Ut = class {
56
+ constructor() {
57
+ // We cannot have TimeoutManager<T> as we must instantiate it with a concrete
58
+ // type at app boot; and if we leave that type, then any new timer provider
59
+ // would need to support ReturnType<typeof setTimeout>, which is infeasible.
60
+ //
61
+ // We settle for type safety for the TimeoutProvider type, and accept that
62
+ // this class is unsafe internally to allow for extension.
63
+ c(this, x, ie);
64
+ c(this, W, !1);
65
+ }
66
+ setTimeoutProvider(e) {
67
+ process.env.NODE_ENV !== "production" && i(this, W) && e !== i(this, x) && console.error(
68
+ "[timeoutManager]: Switching provider after calls to previous provider might result in unexpected behavior.",
69
+ { previous: i(this, x), provider: e }
70
+ ), o(this, x, e), process.env.NODE_ENV !== "production" && o(this, W, !1);
71
+ }
72
+ setTimeout(e, t) {
73
+ return process.env.NODE_ENV !== "production" && o(this, W, !0), i(this, x).setTimeout(e, t);
74
+ }
75
+ clearTimeout(e) {
76
+ i(this, x).clearTimeout(e);
77
+ }
78
+ setInterval(e, t) {
79
+ return process.env.NODE_ENV !== "production" && o(this, W, !0), i(this, x).setInterval(e, t);
80
+ }
81
+ clearInterval(e) {
82
+ i(this, x).clearInterval(e);
83
+ }
84
+ }, x = new WeakMap(), W = new WeakMap(), Ut), Et = new ne();
85
+ function ae(e) {
86
+ setTimeout(e, 0);
87
+ }
88
+ var Ft = typeof window > "u" || "Deno" in globalThis;
89
+ function R() {
42
90
  }
43
- function Xe(t, e) {
44
- return typeof t == "function" ? t(e) : t;
91
+ function oe(e, t) {
92
+ return typeof e == "function" ? e(t) : e;
45
93
  }
46
- function Ye(t) {
47
- return typeof t == "number" && t >= 0 && t !== 1 / 0;
94
+ function ue(e) {
95
+ return typeof e == "number" && e >= 0 && e !== 1 / 0;
48
96
  }
49
- function Ze(t, e) {
50
- return Math.max(t + (e || 0) - Date.now(), 0);
97
+ function he(e, t) {
98
+ return Math.max(e + (t || 0) - Date.now(), 0);
51
99
  }
52
- function Ce(t, e) {
53
- return typeof t == "function" ? t(e) : t;
100
+ function Dt(e, t) {
101
+ return typeof e == "function" ? e(t) : e;
54
102
  }
55
- function et(t, e) {
56
- return typeof t == "function" ? t(e) : t;
103
+ function ce(e, t) {
104
+ return typeof e == "function" ? e(t) : e;
57
105
  }
58
- function qe(t, e) {
106
+ function Tt(e, t) {
59
107
  const {
60
108
  type: s = "all",
61
109
  exact: r,
62
110
  fetchStatus: n,
63
- predicate: u,
64
- queryKey: h,
65
- stale: a
66
- } = t;
67
- if (h) {
111
+ predicate: a,
112
+ queryKey: l,
113
+ stale: u
114
+ } = e;
115
+ if (l) {
68
116
  if (r) {
69
- if (e.queryHash !== Fe(h, e.options))
117
+ if (t.queryHash !== Mt(l, t.options))
70
118
  return !1;
71
- } else if (!ce(e.queryKey, h))
119
+ } else if (!yt(t.queryKey, l))
72
120
  return !1;
73
121
  }
74
122
  if (s !== "all") {
75
- const f = e.isActive();
123
+ const f = t.isActive();
76
124
  if (s === "active" && !f || s === "inactive" && f)
77
125
  return !1;
78
126
  }
79
- return !(typeof a == "boolean" && e.isStale() !== a || n && n !== e.state.fetchStatus || u && !u(e));
127
+ return !(typeof u == "boolean" && t.isStale() !== u || n && n !== t.state.fetchStatus || a && !a(t));
80
128
  }
81
- function Ee(t, e) {
82
- const { exact: s, status: r, predicate: n, mutationKey: u } = t;
83
- if (u) {
84
- if (!e.options.mutationKey)
129
+ function Rt(e, t) {
130
+ const { exact: s, status: r, predicate: n, mutationKey: a } = e;
131
+ if (a) {
132
+ if (!t.options.mutationKey)
85
133
  return !1;
86
134
  if (s) {
87
- if (he(e.options.mutationKey) !== he(u))
135
+ if (ft(t.options.mutationKey) !== ft(a))
88
136
  return !1;
89
- } else if (!ce(e.options.mutationKey, u))
137
+ } else if (!yt(t.options.mutationKey, a))
90
138
  return !1;
91
139
  }
92
- return !(r && e.state.status !== r || n && !n(e));
140
+ return !(r && t.state.status !== r || n && !n(t));
93
141
  }
94
- function Fe(t, e) {
95
- return ((e == null ? void 0 : e.queryKeyHashFn) || he)(t);
142
+ function Mt(e, t) {
143
+ return ((t == null ? void 0 : t.queryKeyHashFn) || ft)(e);
96
144
  }
97
- function he(t) {
145
+ function ft(e) {
98
146
  return JSON.stringify(
99
- t,
100
- (e, s) => Se(s) ? Object.keys(s).sort().reduce((r, n) => (r[n] = s[n], r), {}) : s
147
+ e,
148
+ (t, s) => At(s) ? Object.keys(s).sort().reduce((r, n) => (r[n] = s[n], r), {}) : s
101
149
  );
102
150
  }
103
- function ce(t, e) {
104
- return t === e ? !0 : typeof t != typeof e ? !1 : t && e && typeof t == "object" && typeof e == "object" ? !Object.keys(e).some((s) => !ce(t[s], e[s])) : !1;
151
+ function yt(e, t) {
152
+ return e === t ? !0 : typeof e != typeof t ? !1 : e && t && typeof e == "object" && typeof t == "object" ? Object.keys(t).every((s) => yt(e[s], t[s])) : !1;
105
153
  }
106
- function Oe(t, e) {
107
- if (t === e)
154
+ var le = Object.prototype.hasOwnProperty;
155
+ function qt(e, t) {
156
+ if (e === t)
157
+ return e;
158
+ const s = It(e) && It(t);
159
+ if (!s && !(At(e) && At(t)))
108
160
  return t;
109
- const s = De(t) && De(e);
110
- if (s || Se(t) && Se(e)) {
111
- const r = s ? t : Object.keys(t), n = r.length, u = s ? e : Object.keys(e), h = u.length, a = s ? [] : {};
112
- let f = 0;
113
- for (let w = 0; w < h; w++) {
114
- const m = s ? w : u[w];
115
- (!s && r.includes(m) || s) && t[m] === void 0 && e[m] === void 0 ? (a[m] = void 0, f++) : (a[m] = Oe(t[m], e[m]), a[m] === t[m] && t[m] !== void 0 && f++);
161
+ const n = (s ? e : Object.keys(e)).length, a = s ? t : Object.keys(t), l = a.length, u = s ? new Array(l) : {};
162
+ let f = 0;
163
+ for (let O = 0; O < l; O++) {
164
+ const v = s ? O : a[O], C = e[v], g = t[v];
165
+ if (C === g) {
166
+ u[v] = C, (s ? O < n : le.call(e, v)) && f++;
167
+ continue;
168
+ }
169
+ if (C === null || g === null || typeof C != "object" || typeof g != "object") {
170
+ u[v] = g;
171
+ continue;
116
172
  }
117
- return n === h && f === n ? t : a;
173
+ const q = qt(C, g);
174
+ u[v] = q, q === C && f++;
118
175
  }
119
- return e;
176
+ return n === l && f === n ? e : u;
120
177
  }
121
- function De(t) {
122
- return Array.isArray(t) && t.length === Object.keys(t).length;
178
+ function It(e) {
179
+ return Array.isArray(e) && e.length === Object.keys(e).length;
123
180
  }
124
- function Se(t) {
125
- if (!Ae(t))
181
+ function At(e) {
182
+ if (!jt(e))
126
183
  return !1;
127
- const e = t.constructor;
128
- if (e === void 0)
184
+ const t = e.constructor;
185
+ if (t === void 0)
129
186
  return !0;
130
- const s = e.prototype;
131
- return !(!Ae(s) || !s.hasOwnProperty("isPrototypeOf") || Object.getPrototypeOf(t) !== Object.prototype);
187
+ const s = t.prototype;
188
+ return !(!jt(s) || !s.hasOwnProperty("isPrototypeOf") || Object.getPrototypeOf(e) !== Object.prototype);
132
189
  }
133
- function Ae(t) {
134
- return Object.prototype.toString.call(t) === "[object Object]";
190
+ function jt(e) {
191
+ return Object.prototype.toString.call(e) === "[object Object]";
135
192
  }
136
- function tt(t) {
137
- return new Promise((e) => {
138
- setTimeout(e, t);
193
+ function de(e) {
194
+ return new Promise((t) => {
195
+ Et.setTimeout(t, e);
139
196
  });
140
197
  }
141
- function st(t, e, s) {
198
+ function fe(e, t, s) {
142
199
  if (typeof s.structuralSharing == "function")
143
- return s.structuralSharing(t, e);
200
+ return s.structuralSharing(e, t);
144
201
  if (s.structuralSharing !== !1) {
145
202
  if (process.env.NODE_ENV !== "production")
146
203
  try {
147
- return Oe(t, e);
204
+ return qt(e, t);
148
205
  } catch (r) {
149
- console.error(
206
+ throw console.error(
150
207
  `Structural sharing requires data to be JSON serializable. To fix this, turn off structuralSharing or return JSON-serializable data from your queryFn. [${s.queryHash}]: ${r}`
151
- );
208
+ ), r;
152
209
  }
153
- return Oe(t, e);
210
+ return qt(e, t);
154
211
  }
155
- return e;
212
+ return t;
156
213
  }
157
- function rt(t, e, s = 0) {
158
- const r = [...t, e];
214
+ function ye(e, t, s = 0) {
215
+ const r = [...e, t];
159
216
  return s && r.length > s ? r.slice(1) : r;
160
217
  }
161
- function it(t, e, s = 0) {
162
- const r = [e, ...t];
218
+ function pe(e, t, s = 0) {
219
+ const r = [t, ...e];
163
220
  return s && r.length > s ? r.slice(0, -1) : r;
164
221
  }
165
- var me = Symbol();
166
- function Le(t, e) {
167
- return process.env.NODE_ENV !== "production" && t.queryFn === me && console.error(
168
- `Attempted to invoke queryFn when set to skipToken. This is likely a configuration error. Query hash: '${t.queryHash}'`
169
- ), !t.queryFn && (e != null && e.initialPromise) ? () => e.initialPromise : !t.queryFn || t.queryFn === me ? () => Promise.reject(new Error(`Missing queryFn: '${t.queryHash}'`)) : t.queryFn;
222
+ var Pt = Symbol();
223
+ function Jt(e, t) {
224
+ return process.env.NODE_ENV !== "production" && e.queryFn === Pt && console.error(
225
+ `Attempted to invoke queryFn when set to skipToken. This is likely a configuration error. Query hash: '${e.queryHash}'`
226
+ ), !e.queryFn && (t != null && t.initialPromise) ? () => t.initialPromise : !e.queryFn || e.queryFn === Pt ? () => Promise.reject(new Error(`Missing queryFn: '${e.queryHash}'`)) : e.queryFn;
170
227
  }
171
- var B, N, Z, Re, nt = (Re = class extends ge {
228
+ var Z, G, rt, Nt, me = (Nt = class extends Ct {
172
229
  constructor() {
173
230
  super();
174
- l(this, B, void 0);
175
- l(this, N, void 0);
176
- l(this, Z, void 0);
177
- o(this, Z, (e) => {
178
- if (!be && window.addEventListener) {
179
- const s = () => e();
231
+ c(this, Z, void 0);
232
+ c(this, G, void 0);
233
+ c(this, rt, void 0);
234
+ o(this, rt, (t) => {
235
+ if (!Ft && window.addEventListener) {
236
+ const s = () => t();
180
237
  return window.addEventListener("visibilitychange", s, !1), () => {
181
238
  window.removeEventListener("visibilitychange", s);
182
239
  };
@@ -184,70 +241,36 @@ var B, N, Z, Re, nt = (Re = class extends ge {
184
241
  });
185
242
  }
186
243
  onSubscribe() {
187
- i(this, N) || this.setEventListener(i(this, Z));
244
+ i(this, G) || this.setEventListener(i(this, rt));
188
245
  }
189
246
  onUnsubscribe() {
190
- var e;
191
- this.hasListeners() || ((e = i(this, N)) == null || e.call(this), o(this, N, void 0));
247
+ var t;
248
+ this.hasListeners() || ((t = i(this, G)) == null || t.call(this), o(this, G, void 0));
192
249
  }
193
- setEventListener(e) {
250
+ setEventListener(t) {
194
251
  var s;
195
- o(this, Z, e), (s = i(this, N)) == null || s.call(this), o(this, N, e((r) => {
252
+ o(this, rt, t), (s = i(this, G)) == null || s.call(this), o(this, G, t((r) => {
196
253
  typeof r == "boolean" ? this.setFocused(r) : this.onFocus();
197
254
  }));
198
255
  }
199
- setFocused(e) {
200
- i(this, B) !== e && (o(this, B, e), this.onFocus());
256
+ setFocused(t) {
257
+ i(this, Z) !== t && (o(this, Z, t), this.onFocus());
201
258
  }
202
259
  onFocus() {
203
- const e = this.isFocused();
260
+ const t = this.isFocused();
204
261
  this.listeners.forEach((s) => {
205
- s(e);
262
+ s(t);
206
263
  });
207
264
  }
208
265
  isFocused() {
209
- var e;
210
- return typeof i(this, B) == "boolean" ? i(this, B) : ((e = globalThis.document) == null ? void 0 : e.visibilityState) !== "hidden";
211
- }
212
- }, B = new WeakMap(), N = new WeakMap(), Z = new WeakMap(), Re), Ne = new nt(), ee, G, te, Te, at = (Te = class extends ge {
213
- constructor() {
214
- super();
215
- l(this, ee, !0);
216
- l(this, G, void 0);
217
- l(this, te, void 0);
218
- o(this, te, (e) => {
219
- if (!be && window.addEventListener) {
220
- const s = () => e(!0), r = () => e(!1);
221
- return window.addEventListener("online", s, !1), window.addEventListener("offline", r, !1), () => {
222
- window.removeEventListener("online", s), window.removeEventListener("offline", r);
223
- };
224
- }
225
- });
226
- }
227
- onSubscribe() {
228
- i(this, G) || this.setEventListener(i(this, te));
229
- }
230
- onUnsubscribe() {
231
- var e;
232
- this.hasListeners() || ((e = i(this, G)) == null || e.call(this), o(this, G, void 0));
233
- }
234
- setEventListener(e) {
235
- var s;
236
- o(this, te, e), (s = i(this, G)) == null || s.call(this), o(this, G, e(this.setOnline.bind(this)));
237
- }
238
- setOnline(e) {
239
- i(this, ee) !== e && (o(this, ee, e), this.listeners.forEach((r) => {
240
- r(e);
241
- }));
242
- }
243
- isOnline() {
244
- return i(this, ee);
245
- }
246
- }, ee = new WeakMap(), G = new WeakMap(), te = new WeakMap(), Te), ve = new at();
247
- function ut() {
248
- let t, e;
249
- const s = new Promise((n, u) => {
250
- t = n, e = u;
266
+ var t;
267
+ return typeof i(this, Z) == "boolean" ? i(this, Z) : ((t = globalThis.document) == null ? void 0 : t.visibilityState) !== "hidden";
268
+ }
269
+ }, Z = new WeakMap(), G = new WeakMap(), rt = new WeakMap(), Nt), Wt = new me();
270
+ function ve() {
271
+ let e, t;
272
+ const s = new Promise((n, a) => {
273
+ e = n, t = a;
251
274
  });
252
275
  s.status = "pending", s.catch(() => {
253
276
  });
@@ -258,360 +281,416 @@ function ut() {
258
281
  r({
259
282
  status: "fulfilled",
260
283
  value: n
261
- }), t(n);
284
+ }), e(n);
262
285
  }, s.reject = (n) => {
263
286
  r({
264
287
  status: "rejected",
265
288
  reason: n
266
- }), e(n);
289
+ }), t(n);
267
290
  }, s;
268
291
  }
269
- function ot(t) {
270
- return Math.min(1e3 * 2 ** t, 3e4);
271
- }
272
- function Ge(t) {
273
- return (t ?? "online") === "online" ? ve.isOnline() : !0;
274
- }
275
- var _e = class extends Error {
276
- constructor(t) {
277
- super("CancelledError"), this.revert = t == null ? void 0 : t.revert, this.silent = t == null ? void 0 : t.silent;
278
- }
279
- };
280
- function Pe(t) {
281
- return t instanceof _e;
282
- }
283
- function Ve(t) {
284
- let e = !1, s = 0, r = !1, n;
285
- const u = ut(), h = (c) => {
286
- var p;
287
- r || (y(new _e(c)), (p = t.abort) == null || p.call(t));
288
- }, a = () => {
289
- e = !0;
290
- }, f = () => {
291
- e = !1;
292
- }, w = () => Ne.isFocused() && (t.networkMode === "always" || ve.isOnline()) && t.canRun(), m = () => Ge(t.networkMode) && t.canRun(), d = (c) => {
293
- var p;
294
- r || (r = !0, (p = t.onSuccess) == null || p.call(t, c), n == null || n(), u.resolve(c));
295
- }, y = (c) => {
296
- var p;
297
- r || (r = !0, (p = t.onError) == null || p.call(t, c), n == null || n(), u.reject(c));
298
- }, q = () => new Promise((c) => {
299
- var p;
300
- n = (E) => {
301
- (r || w()) && c(E);
302
- }, (p = t.onPause) == null || p.call(t);
303
- }).then(() => {
304
- var c;
305
- n = void 0, r || (c = t.onContinue) == null || c.call(t);
306
- }), S = () => {
307
- if (r)
308
- return;
309
- let c;
310
- const p = s === 0 ? t.initialPromise : void 0;
311
- try {
312
- c = p ?? t.fn();
313
- } catch (E) {
314
- c = Promise.reject(E);
315
- }
316
- Promise.resolve(c).then(d).catch((E) => {
317
- var k;
318
- if (r)
319
- return;
320
- const M = t.retry ?? (be ? 0 : 3), g = t.retryDelay ?? ot, D = typeof g == "function" ? g(s, E) : g, j = M === !0 || typeof M == "number" && s < M || typeof M == "function" && M(s, E);
321
- if (e || !j) {
322
- y(E);
323
- return;
324
- }
325
- s++, (k = t.onFail) == null || k.call(t, s, E), tt(D).then(() => w() ? void 0 : q()).then(() => {
326
- e ? y(E) : S();
327
- });
292
+ var ge = ae;
293
+ function be() {
294
+ let e = [], t = 0, s = (u) => {
295
+ u();
296
+ }, r = (u) => {
297
+ u();
298
+ }, n = ge;
299
+ const a = (u) => {
300
+ t ? e.push(u) : n(() => {
301
+ s(u);
328
302
  });
329
- };
330
- return {
331
- promise: u,
332
- cancel: h,
333
- continue: () => (n == null || n(), u),
334
- cancelRetry: a,
335
- continueRetry: f,
336
- canStart: m,
337
- start: () => (m() ? S() : q().then(S), u)
338
- };
339
- }
340
- function ht() {
341
- let t = [], e = 0, s = (a) => {
342
- a();
343
- }, r = (a) => {
344
- a();
345
- }, n = (a) => setTimeout(a, 0);
346
- const u = (a) => {
347
- e ? t.push(a) : n(() => {
348
- s(a);
349
- });
350
- }, h = () => {
351
- const a = t;
352
- t = [], a.length && n(() => {
303
+ }, l = () => {
304
+ const u = e;
305
+ e = [], u.length && n(() => {
353
306
  r(() => {
354
- a.forEach((f) => {
307
+ u.forEach((f) => {
355
308
  s(f);
356
309
  });
357
310
  });
358
311
  });
359
312
  };
360
313
  return {
361
- batch: (a) => {
314
+ batch: (u) => {
362
315
  let f;
363
- e++;
316
+ t++;
364
317
  try {
365
- f = a();
318
+ f = u();
366
319
  } finally {
367
- e--, e || h();
320
+ t--, t || l();
368
321
  }
369
322
  return f;
370
323
  },
371
324
  /**
372
325
  * All calls to the wrapped function will be batched.
373
326
  */
374
- batchCalls: (a) => (...f) => {
375
- u(() => {
376
- a(...f);
327
+ batchCalls: (u) => (...f) => {
328
+ a(() => {
329
+ u(...f);
377
330
  });
378
331
  },
379
- schedule: u,
332
+ schedule: a,
380
333
  /**
381
334
  * Use this method to set a custom notify function.
382
335
  * This can be used to for example wrap notifications with `React.act` while running tests.
383
336
  */
384
- setNotifyFunction: (a) => {
385
- s = a;
337
+ setNotifyFunction: (u) => {
338
+ s = u;
386
339
  },
387
340
  /**
388
341
  * Use this method to set a custom function to batch notifications together into a single tick.
389
342
  * By default React Query will use the batch function provided by ReactDOM or React Native.
390
343
  */
391
- setBatchNotifyFunction: (a) => {
392
- r = a;
344
+ setBatchNotifyFunction: (u) => {
345
+ r = u;
393
346
  },
394
- setScheduler: (a) => {
395
- n = a;
347
+ setScheduler: (u) => {
348
+ n = u;
396
349
  }
397
350
  };
398
351
  }
399
- var C = ht(), J, je, $e = (je = class {
352
+ var D = be(), it, _, nt, Ht, we = (Ht = class extends Ct {
400
353
  constructor() {
401
- l(this, J, void 0);
354
+ super();
355
+ c(this, it, !0);
356
+ c(this, _, void 0);
357
+ c(this, nt, void 0);
358
+ o(this, nt, (t) => {
359
+ if (!Ft && window.addEventListener) {
360
+ const s = () => t(!0), r = () => t(!1);
361
+ return window.addEventListener("online", s, !1), window.addEventListener("offline", r, !1), () => {
362
+ window.removeEventListener("online", s), window.removeEventListener("offline", r);
363
+ };
364
+ }
365
+ });
366
+ }
367
+ onSubscribe() {
368
+ i(this, _) || this.setEventListener(i(this, nt));
369
+ }
370
+ onUnsubscribe() {
371
+ var t;
372
+ this.hasListeners() || ((t = i(this, _)) == null || t.call(this), o(this, _, void 0));
373
+ }
374
+ setEventListener(t) {
375
+ var s;
376
+ o(this, nt, t), (s = i(this, _)) == null || s.call(this), o(this, _, t(this.setOnline.bind(this)));
377
+ }
378
+ setOnline(t) {
379
+ i(this, it) !== t && (o(this, it, t), this.listeners.forEach((r) => {
380
+ r(t);
381
+ }));
382
+ }
383
+ isOnline() {
384
+ return i(this, it);
385
+ }
386
+ }, it = new WeakMap(), _ = new WeakMap(), nt = new WeakMap(), Ht), Ot = new we();
387
+ function Pe(e) {
388
+ return Math.min(1e3 * 2 ** e, 3e4);
389
+ }
390
+ function Zt(e) {
391
+ return (e ?? "online") === "online" ? Ot.isOnline() : !0;
392
+ }
393
+ var Qt = class extends Error {
394
+ constructor(e) {
395
+ super("CancelledError"), this.revert = e == null ? void 0 : e.revert, this.silent = e == null ? void 0 : e.silent;
396
+ }
397
+ };
398
+ function Xt(e) {
399
+ let t = !1, s = 0, r;
400
+ const n = ve(), a = () => n.status !== "pending", l = (d) => {
401
+ var b;
402
+ if (!a()) {
403
+ const m = new Qt(d);
404
+ g(m), (b = e.onCancel) == null || b.call(e, m);
405
+ }
406
+ }, u = () => {
407
+ t = !0;
408
+ }, f = () => {
409
+ t = !1;
410
+ }, O = () => Wt.isFocused() && (e.networkMode === "always" || Ot.isOnline()) && e.canRun(), v = () => Zt(e.networkMode) && e.canRun(), C = (d) => {
411
+ a() || (r == null || r(), n.resolve(d));
412
+ }, g = (d) => {
413
+ a() || (r == null || r(), n.reject(d));
414
+ }, q = () => new Promise((d) => {
415
+ var b;
416
+ r = (m) => {
417
+ (a() || O()) && d(m);
418
+ }, (b = e.onPause) == null || b.call(e);
419
+ }).then(() => {
420
+ var d;
421
+ r = void 0, a() || (d = e.onContinue) == null || d.call(e);
422
+ }), Q = () => {
423
+ if (a())
424
+ return;
425
+ let d;
426
+ const b = s === 0 ? e.initialPromise : void 0;
427
+ try {
428
+ d = b ?? e.fn();
429
+ } catch (m) {
430
+ d = Promise.reject(m);
431
+ }
432
+ Promise.resolve(d).then(C).catch((m) => {
433
+ var T;
434
+ if (a())
435
+ return;
436
+ const A = e.retry ?? (Ft ? 0 : 3), p = e.retryDelay ?? Pe, h = typeof p == "function" ? p(s, m) : p, S = A === !0 || typeof A == "number" && s < A || typeof A == "function" && A(s, m);
437
+ if (t || !S) {
438
+ g(m);
439
+ return;
440
+ }
441
+ s++, (T = e.onFail) == null || T.call(e, s, m), de(h).then(() => O() ? void 0 : q()).then(() => {
442
+ t ? g(m) : Q();
443
+ });
444
+ });
445
+ };
446
+ return {
447
+ promise: n,
448
+ status: () => n.status,
449
+ cancel: l,
450
+ continue: () => (r == null || r(), n),
451
+ cancelRetry: u,
452
+ continueRetry: f,
453
+ canStart: v,
454
+ start: () => (v() ? Q() : q().then(Q), n)
455
+ };
456
+ }
457
+ var X, Lt, Yt = (Lt = class {
458
+ constructor() {
459
+ c(this, X, void 0);
402
460
  }
403
461
  destroy() {
404
462
  this.clearGcTimeout();
405
463
  }
406
464
  scheduleGc() {
407
- this.clearGcTimeout(), Ye(this.gcTime) && o(this, J, setTimeout(() => {
465
+ this.clearGcTimeout(), ue(this.gcTime) && o(this, X, Et.setTimeout(() => {
408
466
  this.optionalRemove();
409
467
  }, this.gcTime));
410
468
  }
411
- updateGcTime(t) {
469
+ updateGcTime(e) {
412
470
  this.gcTime = Math.max(
413
471
  this.gcTime || 0,
414
- t ?? (be ? 1 / 0 : 5 * 60 * 1e3)
472
+ e ?? (Ft ? 1 / 0 : 5 * 60 * 1e3)
415
473
  );
416
474
  }
417
475
  clearGcTimeout() {
418
- i(this, J) && (clearTimeout(i(this, J)), o(this, J, void 0));
476
+ i(this, X) && (Et.clearTimeout(i(this, X)), o(this, X, void 0));
419
477
  }
420
- }, J = new WeakMap(), je), se, re, A, W, O, le, X, R, x, ke, ct = (ke = class extends $e {
421
- constructor(e) {
478
+ }, X = new WeakMap(), Lt), Y, at, M, tt, P, pt, et, I, N, Gt, Oe = (Gt = class extends Yt {
479
+ constructor(t) {
422
480
  super();
423
- l(this, R);
424
- l(this, se, void 0);
425
- l(this, re, void 0);
426
- l(this, A, void 0);
427
- l(this, W, void 0);
428
- l(this, O, void 0);
429
- l(this, le, void 0);
430
- l(this, X, void 0);
431
- o(this, X, !1), o(this, le, e.defaultOptions), this.setOptions(e.options), this.observers = [], o(this, W, e.client), o(this, A, i(this, W).getQueryCache()), this.queryKey = e.queryKey, this.queryHash = e.queryHash, o(this, se, dt(this.options)), this.state = e.state ?? i(this, se), this.scheduleGc();
481
+ c(this, I);
482
+ c(this, Y, void 0);
483
+ c(this, at, void 0);
484
+ c(this, M, void 0);
485
+ c(this, tt, void 0);
486
+ c(this, P, void 0);
487
+ c(this, pt, void 0);
488
+ c(this, et, void 0);
489
+ o(this, et, !1), o(this, pt, t.defaultOptions), this.setOptions(t.options), this.observers = [], o(this, tt, t.client), o(this, M, i(this, tt).getQueryCache()), this.queryKey = t.queryKey, this.queryHash = t.queryHash, o(this, Y, xt(this.options)), this.state = t.state ?? i(this, Y), this.scheduleGc();
432
490
  }
433
491
  get meta() {
434
492
  return this.options.meta;
435
493
  }
436
494
  get promise() {
437
- var e;
438
- return (e = i(this, O)) == null ? void 0 : e.promise;
439
- }
440
- setOptions(e) {
441
- this.options = { ...i(this, le), ...e }, this.updateGcTime(this.options.gcTime);
495
+ var t;
496
+ return (t = i(this, P)) == null ? void 0 : t.promise;
497
+ }
498
+ setOptions(t) {
499
+ if (this.options = { ...i(this, pt), ...t }, this.updateGcTime(this.options.gcTime), this.state && this.state.data === void 0) {
500
+ const s = xt(this.options);
501
+ s.data !== void 0 && (this.setData(s.data, {
502
+ updatedAt: s.dataUpdatedAt,
503
+ manual: !0
504
+ }), o(this, Y, s));
505
+ }
442
506
  }
443
507
  optionalRemove() {
444
- !this.observers.length && this.state.fetchStatus === "idle" && i(this, A).remove(this);
508
+ !this.observers.length && this.state.fetchStatus === "idle" && i(this, M).remove(this);
445
509
  }
446
- setData(e, s) {
447
- const r = st(this.state.data, e, this.options);
448
- return P(this, R, x).call(this, {
510
+ setData(t, s) {
511
+ const r = fe(this.state.data, t, this.options);
512
+ return F(this, I, N).call(this, {
449
513
  data: r,
450
514
  type: "success",
451
515
  dataUpdatedAt: s == null ? void 0 : s.updatedAt,
452
516
  manual: s == null ? void 0 : s.manual
453
517
  }), r;
454
518
  }
455
- setState(e, s) {
456
- P(this, R, x).call(this, { type: "setState", state: e, setStateOptions: s });
519
+ setState(t, s) {
520
+ F(this, I, N).call(this, { type: "setState", state: t, setStateOptions: s });
457
521
  }
458
- cancel(e) {
522
+ cancel(t) {
459
523
  var r, n;
460
- const s = (r = i(this, O)) == null ? void 0 : r.promise;
461
- return (n = i(this, O)) == null || n.cancel(e), s ? s.then(Q).catch(Q) : Promise.resolve();
524
+ const s = (r = i(this, P)) == null ? void 0 : r.promise;
525
+ return (n = i(this, P)) == null || n.cancel(t), s ? s.then(R).catch(R) : Promise.resolve();
462
526
  }
463
527
  destroy() {
464
528
  super.destroy(), this.cancel({ silent: !0 });
465
529
  }
466
530
  reset() {
467
- this.destroy(), this.setState(i(this, se));
531
+ this.destroy(), this.setState(i(this, Y));
468
532
  }
469
533
  isActive() {
470
534
  return this.observers.some(
471
- (e) => et(e.options.enabled, this) !== !1
535
+ (t) => ce(t.options.enabled, this) !== !1
472
536
  );
473
537
  }
474
538
  isDisabled() {
475
- return this.getObserversCount() > 0 ? !this.isActive() : this.options.queryFn === me || this.state.dataUpdateCount + this.state.errorUpdateCount === 0;
539
+ return this.getObserversCount() > 0 ? !this.isActive() : this.options.queryFn === Pt || this.state.dataUpdateCount + this.state.errorUpdateCount === 0;
540
+ }
541
+ isStatic() {
542
+ return this.getObserversCount() > 0 ? this.observers.some(
543
+ (t) => Dt(t.options.staleTime, this) === "static"
544
+ ) : !1;
476
545
  }
477
546
  isStale() {
478
- return this.state.isInvalidated ? !0 : this.getObserversCount() > 0 ? this.observers.some(
479
- (e) => e.getCurrentResult().isStale
480
- ) : this.state.data === void 0;
547
+ return this.getObserversCount() > 0 ? this.observers.some(
548
+ (t) => t.getCurrentResult().isStale
549
+ ) : this.state.data === void 0 || this.state.isInvalidated;
481
550
  }
482
- isStaleByTime(e = 0) {
483
- return this.state.isInvalidated || this.state.data === void 0 || !Ze(this.state.dataUpdatedAt, e);
551
+ isStaleByTime(t = 0) {
552
+ return this.state.data === void 0 ? !0 : t === "static" ? !1 : this.state.isInvalidated ? !0 : !he(this.state.dataUpdatedAt, t);
484
553
  }
485
554
  onFocus() {
486
555
  var s;
487
- const e = this.observers.find((r) => r.shouldFetchOnWindowFocus());
488
- e == null || e.refetch({ cancelRefetch: !1 }), (s = i(this, O)) == null || s.continue();
556
+ const t = this.observers.find((r) => r.shouldFetchOnWindowFocus());
557
+ t == null || t.refetch({ cancelRefetch: !1 }), (s = i(this, P)) == null || s.continue();
489
558
  }
490
559
  onOnline() {
491
560
  var s;
492
- const e = this.observers.find((r) => r.shouldFetchOnReconnect());
493
- e == null || e.refetch({ cancelRefetch: !1 }), (s = i(this, O)) == null || s.continue();
561
+ const t = this.observers.find((r) => r.shouldFetchOnReconnect());
562
+ t == null || t.refetch({ cancelRefetch: !1 }), (s = i(this, P)) == null || s.continue();
494
563
  }
495
- addObserver(e) {
496
- this.observers.includes(e) || (this.observers.push(e), this.clearGcTimeout(), i(this, A).notify({ type: "observerAdded", query: this, observer: e }));
564
+ addObserver(t) {
565
+ this.observers.includes(t) || (this.observers.push(t), this.clearGcTimeout(), i(this, M).notify({ type: "observerAdded", query: this, observer: t }));
497
566
  }
498
- removeObserver(e) {
499
- this.observers.includes(e) && (this.observers = this.observers.filter((s) => s !== e), this.observers.length || (i(this, O) && (i(this, X) ? i(this, O).cancel({ revert: !0 }) : i(this, O).cancelRetry()), this.scheduleGc()), i(this, A).notify({ type: "observerRemoved", query: this, observer: e }));
567
+ removeObserver(t) {
568
+ this.observers.includes(t) && (this.observers = this.observers.filter((s) => s !== t), this.observers.length || (i(this, P) && (i(this, et) ? i(this, P).cancel({ revert: !0 }) : i(this, P).cancelRetry()), this.scheduleGc()), i(this, M).notify({ type: "observerRemoved", query: this, observer: t }));
500
569
  }
501
570
  getObserversCount() {
502
571
  return this.observers.length;
503
572
  }
504
573
  invalidate() {
505
- this.state.isInvalidated || P(this, R, x).call(this, { type: "invalidate" });
506
- }
507
- fetch(e, s) {
508
- var f, w, m;
509
- if (this.state.fetchStatus !== "idle") {
574
+ this.state.isInvalidated || F(this, I, N).call(this, { type: "invalidate" });
575
+ }
576
+ async fetch(t, s) {
577
+ var f, O, v, C, g, q, Q, d, b, m, A, p;
578
+ if (this.state.fetchStatus !== "idle" && // If the promise in the retyer is already rejected, we have to definitely
579
+ // re-start the fetch; there is a chance that the query is still in a
580
+ // pending state when that happens
581
+ ((f = i(this, P)) == null ? void 0 : f.status()) !== "rejected") {
510
582
  if (this.state.data !== void 0 && (s != null && s.cancelRefetch))
511
583
  this.cancel({ silent: !0 });
512
- else if (i(this, O))
513
- return i(this, O).continueRetry(), i(this, O).promise;
584
+ else if (i(this, P))
585
+ return i(this, P).continueRetry(), i(this, P).promise;
514
586
  }
515
- if (e && this.setOptions(e), !this.options.queryFn) {
516
- const d = this.observers.find((y) => y.options.queryFn);
517
- d && this.setOptions(d.options);
587
+ if (t && this.setOptions(t), !this.options.queryFn) {
588
+ const h = this.observers.find((S) => S.options.queryFn);
589
+ h && this.setOptions(h.options);
518
590
  }
519
591
  process.env.NODE_ENV !== "production" && (Array.isArray(this.options.queryKey) || console.error(
520
592
  "As of v4, queryKey needs to be an Array. If you are using a string like 'repoData', please change it to an Array, e.g. ['repoData']"
521
593
  ));
522
- const r = new AbortController(), n = (d) => {
523
- Object.defineProperty(d, "signal", {
594
+ const r = new AbortController(), n = (h) => {
595
+ Object.defineProperty(h, "signal", {
524
596
  enumerable: !0,
525
- get: () => (o(this, X, !0), r.signal)
597
+ get: () => (o(this, et, !0), r.signal)
526
598
  });
527
- }, u = () => {
528
- const d = Le(this.options, s), y = {
529
- client: i(this, W),
599
+ }, a = () => {
600
+ const h = Jt(this.options, s), T = (() => {
601
+ const B = {
602
+ client: i(this, tt),
603
+ queryKey: this.queryKey,
604
+ meta: this.meta
605
+ };
606
+ return n(B), B;
607
+ })();
608
+ return o(this, et, !1), this.options.persister ? this.options.persister(
609
+ h,
610
+ T,
611
+ this
612
+ ) : h(T);
613
+ }, u = (() => {
614
+ const h = {
615
+ fetchOptions: s,
616
+ options: this.options,
530
617
  queryKey: this.queryKey,
531
- meta: this.meta
618
+ client: i(this, tt),
619
+ state: this.state,
620
+ fetchFn: a
532
621
  };
533
- return n(y), o(this, X, !1), this.options.persister ? this.options.persister(
534
- d,
535
- y,
536
- this
537
- ) : d(y);
538
- }, h = {
539
- fetchOptions: s,
540
- options: this.options,
541
- queryKey: this.queryKey,
542
- client: i(this, W),
543
- state: this.state,
544
- fetchFn: u
545
- };
546
- n(h), (f = this.options.behavior) == null || f.onFetch(
547
- h,
548
- this
549
- ), o(this, re, this.state), (this.state.fetchStatus === "idle" || this.state.fetchMeta !== ((w = h.fetchOptions) == null ? void 0 : w.meta)) && P(this, R, x).call(this, { type: "fetch", meta: (m = h.fetchOptions) == null ? void 0 : m.meta });
550
- const a = (d) => {
551
- var y, q, S, c;
552
- Pe(d) && d.silent || P(this, R, x).call(this, {
553
- type: "error",
554
- error: d
555
- }), Pe(d) || ((q = (y = i(this, A).config).onError) == null || q.call(
556
- y,
557
- d,
558
- this
559
- ), (c = (S = i(this, A).config).onSettled) == null || c.call(
560
- S,
561
- this.state.data,
562
- d,
563
- this
564
- )), this.scheduleGc();
565
- };
566
- return o(this, O, Ve({
622
+ return n(h), h;
623
+ })();
624
+ (O = this.options.behavior) == null || O.onFetch(u, this), o(this, at, this.state), (this.state.fetchStatus === "idle" || this.state.fetchMeta !== ((v = u.fetchOptions) == null ? void 0 : v.meta)) && F(this, I, N).call(this, { type: "fetch", meta: (C = u.fetchOptions) == null ? void 0 : C.meta }), o(this, P, Xt({
567
625
  initialPromise: s == null ? void 0 : s.initialPromise,
568
- fn: h.fetchFn,
569
- abort: r.abort.bind(r),
570
- onSuccess: (d) => {
571
- var y, q, S, c;
572
- if (d === void 0) {
573
- process.env.NODE_ENV !== "production" && console.error(
574
- `Query data cannot be undefined. Please make sure to return a value other than undefined from your query function. Affected query key: ${this.queryHash}`
575
- ), a(new Error(`${this.queryHash} data is undefined`));
576
- return;
577
- }
578
- try {
579
- this.setData(d);
580
- } catch (p) {
581
- a(p);
582
- return;
583
- }
584
- (q = (y = i(this, A).config).onSuccess) == null || q.call(y, d, this), (c = (S = i(this, A).config).onSettled) == null || c.call(
585
- S,
586
- d,
587
- this.state.error,
588
- this
589
- ), this.scheduleGc();
626
+ fn: u.fetchFn,
627
+ onCancel: (h) => {
628
+ h instanceof Qt && h.revert && this.setState({
629
+ ...i(this, at),
630
+ fetchStatus: "idle"
631
+ }), r.abort();
590
632
  },
591
- onError: a,
592
- onFail: (d, y) => {
593
- P(this, R, x).call(this, { type: "failed", failureCount: d, error: y });
633
+ onFail: (h, S) => {
634
+ F(this, I, N).call(this, { type: "failed", failureCount: h, error: S });
594
635
  },
595
636
  onPause: () => {
596
- P(this, R, x).call(this, { type: "pause" });
637
+ F(this, I, N).call(this, { type: "pause" });
597
638
  },
598
639
  onContinue: () => {
599
- P(this, R, x).call(this, { type: "continue" });
640
+ F(this, I, N).call(this, { type: "continue" });
600
641
  },
601
- retry: h.options.retry,
602
- retryDelay: h.options.retryDelay,
603
- networkMode: h.options.networkMode,
642
+ retry: u.options.retry,
643
+ retryDelay: u.options.retryDelay,
644
+ networkMode: u.options.networkMode,
604
645
  canRun: () => !0
605
- })), i(this, O).start();
646
+ }));
647
+ try {
648
+ const h = await i(this, P).start();
649
+ if (h === void 0)
650
+ throw process.env.NODE_ENV !== "production" && console.error(
651
+ `Query data cannot be undefined. Please make sure to return a value other than undefined from your query function. Affected query key: ${this.queryHash}`
652
+ ), new Error(`${this.queryHash} data is undefined`);
653
+ return this.setData(h), (q = (g = i(this, M).config).onSuccess) == null || q.call(g, h, this), (d = (Q = i(this, M).config).onSettled) == null || d.call(
654
+ Q,
655
+ h,
656
+ this.state.error,
657
+ this
658
+ ), h;
659
+ } catch (h) {
660
+ if (h instanceof Qt) {
661
+ if (h.silent)
662
+ return i(this, P).promise;
663
+ if (h.revert) {
664
+ if (this.state.data === void 0)
665
+ throw h;
666
+ return this.state.data;
667
+ }
668
+ }
669
+ throw F(this, I, N).call(this, {
670
+ type: "error",
671
+ error: h
672
+ }), (m = (b = i(this, M).config).onError) == null || m.call(
673
+ b,
674
+ h,
675
+ this
676
+ ), (p = (A = i(this, M).config).onSettled) == null || p.call(
677
+ A,
678
+ this.state.data,
679
+ h,
680
+ this
681
+ ), h;
682
+ } finally {
683
+ this.scheduleGc();
684
+ }
606
685
  }
607
- }, se = new WeakMap(), re = new WeakMap(), A = new WeakMap(), W = new WeakMap(), O = new WeakMap(), le = new WeakMap(), X = new WeakMap(), R = new WeakSet(), x = function(e) {
686
+ }, Y = new WeakMap(), at = new WeakMap(), M = new WeakMap(), tt = new WeakMap(), P = new WeakMap(), pt = new WeakMap(), et = new WeakMap(), I = new WeakSet(), N = function(t) {
608
687
  const s = (r) => {
609
- switch (e.type) {
688
+ switch (t.type) {
610
689
  case "failed":
611
690
  return {
612
691
  ...r,
613
- fetchFailureCount: e.failureCount,
614
- fetchFailureReason: e.error
692
+ fetchFailureCount: t.failureCount,
693
+ fetchFailureReason: t.error
615
694
  };
616
695
  case "pause":
617
696
  return {
@@ -626,33 +705,34 @@ var C = ht(), J, je, $e = (je = class {
626
705
  case "fetch":
627
706
  return {
628
707
  ...r,
629
- ...lt(r.data, this.options),
630
- fetchMeta: e.meta ?? null
708
+ ...Ce(r.data, this.options),
709
+ fetchMeta: t.meta ?? null
631
710
  };
632
711
  case "success":
633
- return {
712
+ const n = {
634
713
  ...r,
635
- data: e.data,
714
+ data: t.data,
636
715
  dataUpdateCount: r.dataUpdateCount + 1,
637
- dataUpdatedAt: e.dataUpdatedAt ?? Date.now(),
716
+ dataUpdatedAt: t.dataUpdatedAt ?? Date.now(),
638
717
  error: null,
639
718
  isInvalidated: !1,
640
719
  status: "success",
641
- ...!e.manual && {
720
+ ...!t.manual && {
642
721
  fetchStatus: "idle",
643
722
  fetchFailureCount: 0,
644
723
  fetchFailureReason: null
645
724
  }
646
725
  };
726
+ return o(this, at, t.manual ? n : void 0), n;
647
727
  case "error":
648
- const n = e.error;
649
- return Pe(n) && n.revert && i(this, re) ? { ...i(this, re), fetchStatus: "idle" } : {
728
+ const a = t.error;
729
+ return {
650
730
  ...r,
651
- error: n,
731
+ error: a,
652
732
  errorUpdateCount: r.errorUpdateCount + 1,
653
733
  errorUpdatedAt: Date.now(),
654
734
  fetchFailureCount: r.fetchFailureCount + 1,
655
- fetchFailureReason: n,
735
+ fetchFailureReason: a,
656
736
  fetchStatus: "idle",
657
737
  status: "error"
658
738
  };
@@ -664,31 +744,31 @@ var C = ht(), J, je, $e = (je = class {
664
744
  case "setState":
665
745
  return {
666
746
  ...r,
667
- ...e.state
747
+ ...t.state
668
748
  };
669
749
  }
670
750
  };
671
- this.state = s(this.state), C.batch(() => {
751
+ this.state = s(this.state), D.batch(() => {
672
752
  this.observers.forEach((r) => {
673
753
  r.onQueryUpdate();
674
- }), i(this, A).notify({ query: this, type: "updated", action: e });
754
+ }), i(this, M).notify({ query: this, type: "updated", action: t });
675
755
  });
676
- }, ke);
677
- function lt(t, e) {
756
+ }, Gt);
757
+ function Ce(e, t) {
678
758
  return {
679
759
  fetchFailureCount: 0,
680
760
  fetchFailureReason: null,
681
- fetchStatus: Ge(e.networkMode) ? "fetching" : "paused",
682
- ...t === void 0 && {
761
+ fetchStatus: Zt(t.networkMode) ? "fetching" : "paused",
762
+ ...e === void 0 && {
683
763
  error: null,
684
764
  status: "pending"
685
765
  }
686
766
  };
687
767
  }
688
- function dt(t) {
689
- const e = typeof t.initialData == "function" ? t.initialData() : t.initialData, s = e !== void 0, r = s ? typeof t.initialDataUpdatedAt == "function" ? t.initialDataUpdatedAt() : t.initialDataUpdatedAt : 0;
768
+ function xt(e) {
769
+ const t = typeof e.initialData == "function" ? e.initialData() : e.initialData, s = t !== void 0, r = s ? typeof e.initialDataUpdatedAt == "function" ? e.initialDataUpdatedAt() : e.initialDataUpdatedAt : 0;
690
770
  return {
691
- data: e,
771
+ data: t,
692
772
  dataUpdateCount: 0,
693
773
  dataUpdatedAt: s ? r ?? Date.now() : 0,
694
774
  error: null,
@@ -702,206 +782,248 @@ function dt(t) {
702
782
  fetchStatus: "idle"
703
783
  };
704
784
  }
705
- var U, Ue, ft = (Ue = class extends ge {
706
- constructor(e = {}) {
707
- super();
708
- l(this, U, void 0);
709
- this.config = e, o(this, U, /* @__PURE__ */ new Map());
710
- }
711
- build(e, s, r) {
712
- const n = s.queryKey, u = s.queryHash ?? Fe(n, s);
713
- let h = this.get(u);
714
- return h || (h = new ct({
715
- client: e,
716
- queryKey: n,
717
- queryHash: u,
718
- options: e.defaultQueryOptions(s),
719
- state: r,
720
- defaultOptions: e.getQueryDefaults(n)
721
- }), this.add(h)), h;
722
- }
723
- add(e) {
724
- i(this, U).has(e.queryHash) || (i(this, U).set(e.queryHash, e), this.notify({
725
- type: "added",
726
- query: e
727
- }));
728
- }
729
- remove(e) {
730
- const s = i(this, U).get(e.queryHash);
731
- s && (e.destroy(), s === e && i(this, U).delete(e.queryHash), this.notify({ type: "removed", query: e }));
732
- }
733
- clear() {
734
- C.batch(() => {
735
- this.getAll().forEach((e) => {
736
- this.remove(e);
737
- });
738
- });
739
- }
740
- get(e) {
741
- return i(this, U).get(e);
742
- }
743
- getAll() {
744
- return [...i(this, U).values()];
745
- }
746
- find(e) {
747
- const s = { exact: !0, ...e };
748
- return this.getAll().find(
749
- (r) => qe(s, r)
750
- );
751
- }
752
- findAll(e = {}) {
753
- const s = this.getAll();
754
- return Object.keys(e).length > 0 ? s.filter((r) => qe(e, r)) : s;
755
- }
756
- notify(e) {
757
- C.batch(() => {
758
- this.listeners.forEach((s) => {
759
- s(e);
760
- });
761
- });
762
- }
763
- onFocus() {
764
- C.batch(() => {
765
- this.getAll().forEach((e) => {
766
- e.onFocus();
767
- });
768
- });
769
- }
770
- onOnline() {
771
- C.batch(() => {
772
- this.getAll().forEach((e) => {
773
- e.onOnline();
774
- });
775
- });
776
- }
777
- }, U = new WeakMap(), Ue), K, F, Y, I, L, Ke, yt = (Ke = class extends $e {
778
- constructor(e) {
785
+ function kt(e) {
786
+ return {
787
+ onFetch: (t, s) => {
788
+ var v, C, g, q, Q;
789
+ const r = t.options, n = (g = (C = (v = t.fetchOptions) == null ? void 0 : v.meta) == null ? void 0 : C.fetchMore) == null ? void 0 : g.direction, a = ((q = t.state.data) == null ? void 0 : q.pages) || [], l = ((Q = t.state.data) == null ? void 0 : Q.pageParams) || [];
790
+ let u = { pages: [], pageParams: [] }, f = 0;
791
+ const O = async () => {
792
+ let d = !1;
793
+ const b = (p) => {
794
+ Object.defineProperty(p, "signal", {
795
+ enumerable: !0,
796
+ get: () => (t.signal.aborted ? d = !0 : t.signal.addEventListener("abort", () => {
797
+ d = !0;
798
+ }), t.signal)
799
+ });
800
+ }, m = Jt(t.options, t.fetchOptions), A = async (p, h, S) => {
801
+ if (d)
802
+ return Promise.reject();
803
+ if (h == null && p.pages.length)
804
+ return Promise.resolve(p);
805
+ const B = (() => {
806
+ const J = {
807
+ client: t.client,
808
+ queryKey: t.queryKey,
809
+ pageParam: h,
810
+ direction: S ? "backward" : "forward",
811
+ meta: t.options.meta
812
+ };
813
+ return b(J), J;
814
+ })(), gt = await m(B), { maxPages: lt } = t.options, w = S ? pe : ye;
815
+ return {
816
+ pages: w(p.pages, gt, lt),
817
+ pageParams: w(p.pageParams, h, lt)
818
+ };
819
+ };
820
+ if (n && a.length) {
821
+ const p = n === "backward", h = p ? Fe : Kt, S = {
822
+ pages: a,
823
+ pageParams: l
824
+ }, T = h(r, S);
825
+ u = await A(S, T, p);
826
+ } else {
827
+ const p = e ?? a.length;
828
+ do {
829
+ const h = f === 0 ? l[0] ?? r.initialPageParam : Kt(r, u);
830
+ if (f > 0 && h == null)
831
+ break;
832
+ u = await A(u, h), f++;
833
+ } while (f < p);
834
+ }
835
+ return u;
836
+ };
837
+ t.options.persister ? t.fetchFn = () => {
838
+ var d, b;
839
+ return (b = (d = t.options).persister) == null ? void 0 : b.call(
840
+ d,
841
+ O,
842
+ {
843
+ client: t.client,
844
+ queryKey: t.queryKey,
845
+ meta: t.options.meta,
846
+ signal: t.signal
847
+ },
848
+ s
849
+ );
850
+ } : t.fetchFn = O;
851
+ }
852
+ };
853
+ }
854
+ function Kt(e, { pages: t, pageParams: s }) {
855
+ const r = t.length - 1;
856
+ return t.length > 0 ? e.getNextPageParam(
857
+ t[r],
858
+ t,
859
+ s[r],
860
+ s
861
+ ) : void 0;
862
+ }
863
+ function Fe(e, { pages: t, pageParams: s }) {
864
+ var r;
865
+ return t.length > 0 ? (r = e.getPreviousPageParam) == null ? void 0 : r.call(e, t[0], t, s[0], s) : void 0;
866
+ }
867
+ var mt, k, E, st, K, L, _t, Se = (_t = class extends Yt {
868
+ constructor(t) {
779
869
  super();
780
- l(this, I);
781
- l(this, K, void 0);
782
- l(this, F, void 0);
783
- l(this, Y, void 0);
784
- this.mutationId = e.mutationId, o(this, F, e.mutationCache), o(this, K, []), this.state = e.state || pt(), this.setOptions(e.options), this.scheduleGc();
870
+ c(this, K);
871
+ c(this, mt, void 0);
872
+ c(this, k, void 0);
873
+ c(this, E, void 0);
874
+ c(this, st, void 0);
875
+ o(this, mt, t.client), this.mutationId = t.mutationId, o(this, E, t.mutationCache), o(this, k, []), this.state = t.state || Ee(), this.setOptions(t.options), this.scheduleGc();
785
876
  }
786
- setOptions(e) {
787
- this.options = e, this.updateGcTime(this.options.gcTime);
877
+ setOptions(t) {
878
+ this.options = t, this.updateGcTime(this.options.gcTime);
788
879
  }
789
880
  get meta() {
790
881
  return this.options.meta;
791
882
  }
792
- addObserver(e) {
793
- i(this, K).includes(e) || (i(this, K).push(e), this.clearGcTimeout(), i(this, F).notify({
883
+ addObserver(t) {
884
+ i(this, k).includes(t) || (i(this, k).push(t), this.clearGcTimeout(), i(this, E).notify({
794
885
  type: "observerAdded",
795
886
  mutation: this,
796
- observer: e
887
+ observer: t
797
888
  }));
798
889
  }
799
- removeObserver(e) {
800
- o(this, K, i(this, K).filter((s) => s !== e)), this.scheduleGc(), i(this, F).notify({
890
+ removeObserver(t) {
891
+ o(this, k, i(this, k).filter((s) => s !== t)), this.scheduleGc(), i(this, E).notify({
801
892
  type: "observerRemoved",
802
893
  mutation: this,
803
- observer: e
894
+ observer: t
804
895
  });
805
896
  }
806
897
  optionalRemove() {
807
- i(this, K).length || (this.state.status === "pending" ? this.scheduleGc() : i(this, F).remove(this));
898
+ i(this, k).length || (this.state.status === "pending" ? this.scheduleGc() : i(this, E).remove(this));
808
899
  }
809
900
  continue() {
810
- var e;
811
- return ((e = i(this, Y)) == null ? void 0 : e.continue()) ?? // continuing a mutation assumes that variables are set, mutation must have been dehydrated before
901
+ var t;
902
+ return ((t = i(this, st)) == null ? void 0 : t.continue()) ?? // continuing a mutation assumes that variables are set, mutation must have been dehydrated before
812
903
  this.execute(this.state.variables);
813
904
  }
814
- async execute(e) {
815
- var n, u, h, a, f, w, m, d, y, q, S, c, p, E, M, g, D, j, k, fe;
816
- o(this, Y, Ve({
817
- fn: () => this.options.mutationFn ? this.options.mutationFn(e) : Promise.reject(new Error("No mutationFn found")),
818
- onFail: (b, z) => {
819
- P(this, I, L).call(this, { type: "failed", failureCount: b, error: z });
905
+ async execute(t) {
906
+ var l, u, f, O, v, C, g, q, Q, d, b, m, A, p, h, S, T, B, gt, lt;
907
+ const s = () => {
908
+ F(this, K, L).call(this, { type: "continue" });
909
+ }, r = {
910
+ client: i(this, mt),
911
+ meta: this.options.meta,
912
+ mutationKey: this.options.mutationKey
913
+ };
914
+ o(this, st, Xt({
915
+ fn: () => this.options.mutationFn ? this.options.mutationFn(t, r) : Promise.reject(new Error("No mutationFn found")),
916
+ onFail: (w, J) => {
917
+ F(this, K, L).call(this, { type: "failed", failureCount: w, error: J });
820
918
  },
821
919
  onPause: () => {
822
- P(this, I, L).call(this, { type: "pause" });
823
- },
824
- onContinue: () => {
825
- P(this, I, L).call(this, { type: "continue" });
920
+ F(this, K, L).call(this, { type: "pause" });
826
921
  },
922
+ onContinue: s,
827
923
  retry: this.options.retry ?? 0,
828
924
  retryDelay: this.options.retryDelay,
829
925
  networkMode: this.options.networkMode,
830
- canRun: () => i(this, F).canRun(this)
926
+ canRun: () => i(this, E).canRun(this)
831
927
  }));
832
- const s = this.state.status === "pending", r = !i(this, Y).canStart();
928
+ const n = this.state.status === "pending", a = !i(this, st).canStart();
833
929
  try {
834
- if (!s) {
835
- P(this, I, L).call(this, { type: "pending", variables: e, isPaused: r }), await ((u = (n = i(this, F).config).onMutate) == null ? void 0 : u.call(
836
- n,
837
- e,
838
- this
930
+ if (n)
931
+ s();
932
+ else {
933
+ F(this, K, L).call(this, { type: "pending", variables: t, isPaused: a }), await ((u = (l = i(this, E).config).onMutate) == null ? void 0 : u.call(
934
+ l,
935
+ t,
936
+ this,
937
+ r
938
+ ));
939
+ const J = await ((O = (f = this.options).onMutate) == null ? void 0 : O.call(
940
+ f,
941
+ t,
942
+ r
839
943
  ));
840
- const z = await ((a = (h = this.options).onMutate) == null ? void 0 : a.call(h, e));
841
- z !== this.state.context && P(this, I, L).call(this, {
944
+ J !== this.state.context && F(this, K, L).call(this, {
842
945
  type: "pending",
843
- context: z,
844
- variables: e,
845
- isPaused: r
946
+ context: J,
947
+ variables: t,
948
+ isPaused: a
846
949
  });
847
950
  }
848
- const b = await i(this, Y).start();
849
- return await ((w = (f = i(this, F).config).onSuccess) == null ? void 0 : w.call(
850
- f,
851
- b,
852
- e,
951
+ const w = await i(this, st).start();
952
+ return await ((C = (v = i(this, E).config).onSuccess) == null ? void 0 : C.call(
953
+ v,
954
+ w,
955
+ t,
853
956
  this.state.context,
854
- this
855
- )), await ((d = (m = this.options).onSuccess) == null ? void 0 : d.call(m, b, e, this.state.context)), await ((q = (y = i(this, F).config).onSettled) == null ? void 0 : q.call(
856
- y,
857
- b,
957
+ this,
958
+ r
959
+ )), await ((q = (g = this.options).onSuccess) == null ? void 0 : q.call(
960
+ g,
961
+ w,
962
+ t,
963
+ this.state.context,
964
+ r
965
+ )), await ((d = (Q = i(this, E).config).onSettled) == null ? void 0 : d.call(
966
+ Q,
967
+ w,
858
968
  null,
859
969
  this.state.variables,
860
970
  this.state.context,
861
- this
862
- )), await ((c = (S = this.options).onSettled) == null ? void 0 : c.call(S, b, null, e, this.state.context)), P(this, I, L).call(this, { type: "success", data: b }), b;
863
- } catch (b) {
971
+ this,
972
+ r
973
+ )), await ((m = (b = this.options).onSettled) == null ? void 0 : m.call(
974
+ b,
975
+ w,
976
+ null,
977
+ t,
978
+ this.state.context,
979
+ r
980
+ )), F(this, K, L).call(this, { type: "success", data: w }), w;
981
+ } catch (w) {
864
982
  try {
865
- throw await ((E = (p = i(this, F).config).onError) == null ? void 0 : E.call(
866
- p,
867
- b,
868
- e,
983
+ throw await ((p = (A = i(this, E).config).onError) == null ? void 0 : p.call(
984
+ A,
985
+ w,
986
+ t,
869
987
  this.state.context,
870
- this
871
- )), await ((g = (M = this.options).onError) == null ? void 0 : g.call(
872
- M,
873
- b,
874
- e,
875
- this.state.context
876
- )), await ((j = (D = i(this, F).config).onSettled) == null ? void 0 : j.call(
877
- D,
988
+ this,
989
+ r
990
+ )), await ((S = (h = this.options).onError) == null ? void 0 : S.call(
991
+ h,
992
+ w,
993
+ t,
994
+ this.state.context,
995
+ r
996
+ )), await ((B = (T = i(this, E).config).onSettled) == null ? void 0 : B.call(
997
+ T,
878
998
  void 0,
879
- b,
999
+ w,
880
1000
  this.state.variables,
881
1001
  this.state.context,
882
- this
883
- )), await ((fe = (k = this.options).onSettled) == null ? void 0 : fe.call(
884
- k,
1002
+ this,
1003
+ r
1004
+ )), await ((lt = (gt = this.options).onSettled) == null ? void 0 : lt.call(
1005
+ gt,
885
1006
  void 0,
886
- b,
887
- e,
888
- this.state.context
889
- )), b;
1007
+ w,
1008
+ t,
1009
+ this.state.context,
1010
+ r
1011
+ )), w;
890
1012
  } finally {
891
- P(this, I, L).call(this, { type: "error", error: b });
1013
+ F(this, K, L).call(this, { type: "error", error: w });
892
1014
  }
893
1015
  } finally {
894
- i(this, F).runNext(this);
1016
+ i(this, E).runNext(this);
895
1017
  }
896
1018
  }
897
- }, K = new WeakMap(), F = new WeakMap(), Y = new WeakMap(), I = new WeakSet(), L = function(e) {
1019
+ }, mt = new WeakMap(), k = new WeakMap(), E = new WeakMap(), st = new WeakMap(), K = new WeakSet(), L = function(t) {
898
1020
  const s = (r) => {
899
- switch (e.type) {
1021
+ switch (t.type) {
900
1022
  case "failed":
901
1023
  return {
902
1024
  ...r,
903
- failureCount: e.failureCount,
904
- failureReason: e.error
1025
+ failureCount: t.failureCount,
1026
+ failureReason: t.error
905
1027
  };
906
1028
  case "pause":
907
1029
  return {
@@ -916,20 +1038,20 @@ var U, Ue, ft = (Ue = class extends ge {
916
1038
  case "pending":
917
1039
  return {
918
1040
  ...r,
919
- context: e.context,
1041
+ context: t.context,
920
1042
  data: void 0,
921
1043
  failureCount: 0,
922
1044
  failureReason: null,
923
1045
  error: null,
924
- isPaused: e.isPaused,
1046
+ isPaused: t.isPaused,
925
1047
  status: "pending",
926
- variables: e.variables,
1048
+ variables: t.variables,
927
1049
  submittedAt: Date.now()
928
1050
  };
929
1051
  case "success":
930
1052
  return {
931
1053
  ...r,
932
- data: e.data,
1054
+ data: t.data,
933
1055
  failureCount: 0,
934
1056
  failureReason: null,
935
1057
  error: null,
@@ -940,25 +1062,25 @@ var U, Ue, ft = (Ue = class extends ge {
940
1062
  return {
941
1063
  ...r,
942
1064
  data: void 0,
943
- error: e.error,
1065
+ error: t.error,
944
1066
  failureCount: r.failureCount + 1,
945
- failureReason: e.error,
1067
+ failureReason: t.error,
946
1068
  isPaused: !1,
947
1069
  status: "error"
948
1070
  };
949
1071
  }
950
1072
  };
951
- this.state = s(this.state), C.batch(() => {
952
- i(this, K).forEach((r) => {
953
- r.onMutationUpdate(e);
954
- }), i(this, F).notify({
1073
+ this.state = s(this.state), D.batch(() => {
1074
+ i(this, k).forEach((r) => {
1075
+ r.onMutationUpdate(t);
1076
+ }), i(this, E).notify({
955
1077
  mutation: this,
956
1078
  type: "updated",
957
- action: e
1079
+ action: t
958
1080
  });
959
1081
  });
960
- }, Ke);
961
- function pt() {
1082
+ }, _t);
1083
+ function Ee() {
962
1084
  return {
963
1085
  context: void 0,
964
1086
  data: void 0,
@@ -971,399 +1093,396 @@ function pt() {
971
1093
  submittedAt: 0
972
1094
  };
973
1095
  }
974
- var H, T, de, Ie, mt = (Ie = class extends ge {
975
- constructor(e = {}) {
1096
+ var H, j, vt, Vt, De = (Vt = class extends Ct {
1097
+ constructor(t = {}) {
976
1098
  super();
977
- l(this, H, void 0);
978
- l(this, T, void 0);
979
- l(this, de, void 0);
980
- this.config = e, o(this, H, /* @__PURE__ */ new Set()), o(this, T, /* @__PURE__ */ new Map()), o(this, de, 0);
981
- }
982
- build(e, s, r) {
983
- const n = new yt({
1099
+ c(this, H, void 0);
1100
+ c(this, j, void 0);
1101
+ c(this, vt, void 0);
1102
+ this.config = t, o(this, H, /* @__PURE__ */ new Set()), o(this, j, /* @__PURE__ */ new Map()), o(this, vt, 0);
1103
+ }
1104
+ build(t, s, r) {
1105
+ const n = new Se({
1106
+ client: t,
984
1107
  mutationCache: this,
985
- mutationId: ++ye(this, de)._,
986
- options: e.defaultMutationOptions(s),
1108
+ mutationId: ++bt(this, vt)._,
1109
+ options: t.defaultMutationOptions(s),
987
1110
  state: r
988
1111
  });
989
1112
  return this.add(n), n;
990
1113
  }
991
- add(e) {
992
- i(this, H).add(e);
993
- const s = pe(e);
1114
+ add(t) {
1115
+ i(this, H).add(t);
1116
+ const s = wt(t);
994
1117
  if (typeof s == "string") {
995
- const r = i(this, T).get(s);
996
- r ? r.push(e) : i(this, T).set(s, [e]);
1118
+ const r = i(this, j).get(s);
1119
+ r ? r.push(t) : i(this, j).set(s, [t]);
997
1120
  }
998
- this.notify({ type: "added", mutation: e });
1121
+ this.notify({ type: "added", mutation: t });
999
1122
  }
1000
- remove(e) {
1001
- if (i(this, H).delete(e)) {
1002
- const s = pe(e);
1123
+ remove(t) {
1124
+ if (i(this, H).delete(t)) {
1125
+ const s = wt(t);
1003
1126
  if (typeof s == "string") {
1004
- const r = i(this, T).get(s);
1127
+ const r = i(this, j).get(s);
1005
1128
  if (r)
1006
1129
  if (r.length > 1) {
1007
- const n = r.indexOf(e);
1130
+ const n = r.indexOf(t);
1008
1131
  n !== -1 && r.splice(n, 1);
1009
1132
  } else
1010
- r[0] === e && i(this, T).delete(s);
1133
+ r[0] === t && i(this, j).delete(s);
1011
1134
  }
1012
1135
  }
1013
- this.notify({ type: "removed", mutation: e });
1136
+ this.notify({ type: "removed", mutation: t });
1014
1137
  }
1015
- canRun(e) {
1016
- const s = pe(e);
1138
+ canRun(t) {
1139
+ const s = wt(t);
1017
1140
  if (typeof s == "string") {
1018
- const r = i(this, T).get(s), n = r == null ? void 0 : r.find(
1019
- (u) => u.state.status === "pending"
1141
+ const r = i(this, j).get(s), n = r == null ? void 0 : r.find(
1142
+ (a) => a.state.status === "pending"
1020
1143
  );
1021
- return !n || n === e;
1144
+ return !n || n === t;
1022
1145
  } else
1023
1146
  return !0;
1024
1147
  }
1025
- runNext(e) {
1148
+ runNext(t) {
1026
1149
  var r;
1027
- const s = pe(e);
1150
+ const s = wt(t);
1028
1151
  if (typeof s == "string") {
1029
- const n = (r = i(this, T).get(s)) == null ? void 0 : r.find((u) => u !== e && u.state.isPaused);
1152
+ const n = (r = i(this, j).get(s)) == null ? void 0 : r.find((a) => a !== t && a.state.isPaused);
1030
1153
  return (n == null ? void 0 : n.continue()) ?? Promise.resolve();
1031
1154
  } else
1032
1155
  return Promise.resolve();
1033
1156
  }
1034
1157
  clear() {
1035
- C.batch(() => {
1036
- i(this, H).forEach((e) => {
1037
- this.notify({ type: "removed", mutation: e });
1038
- }), i(this, H).clear(), i(this, T).clear();
1158
+ D.batch(() => {
1159
+ i(this, H).forEach((t) => {
1160
+ this.notify({ type: "removed", mutation: t });
1161
+ }), i(this, H).clear(), i(this, j).clear();
1039
1162
  });
1040
1163
  }
1041
1164
  getAll() {
1042
1165
  return Array.from(i(this, H));
1043
1166
  }
1044
- find(e) {
1045
- const s = { exact: !0, ...e };
1167
+ find(t) {
1168
+ const s = { exact: !0, ...t };
1046
1169
  return this.getAll().find(
1047
- (r) => Ee(s, r)
1170
+ (r) => Rt(s, r)
1048
1171
  );
1049
1172
  }
1050
- findAll(e = {}) {
1051
- return this.getAll().filter((s) => Ee(e, s));
1173
+ findAll(t = {}) {
1174
+ return this.getAll().filter((s) => Rt(t, s));
1052
1175
  }
1053
- notify(e) {
1054
- C.batch(() => {
1176
+ notify(t) {
1177
+ D.batch(() => {
1055
1178
  this.listeners.forEach((s) => {
1056
- s(e);
1179
+ s(t);
1057
1180
  });
1058
1181
  });
1059
1182
  }
1060
1183
  resumePausedMutations() {
1061
- const e = this.getAll().filter((s) => s.state.isPaused);
1062
- return C.batch(
1184
+ const t = this.getAll().filter((s) => s.state.isPaused);
1185
+ return D.batch(
1063
1186
  () => Promise.all(
1064
- e.map((s) => s.continue().catch(Q))
1187
+ t.map((s) => s.continue().catch(R))
1065
1188
  )
1066
1189
  );
1067
1190
  }
1068
- }, H = new WeakMap(), T = new WeakMap(), de = new WeakMap(), Ie);
1069
- function pe(t) {
1070
- var e;
1071
- return (e = t.options.scope) == null ? void 0 : e.id;
1191
+ }, H = new WeakMap(), j = new WeakMap(), vt = new WeakMap(), Vt);
1192
+ function wt(e) {
1193
+ var t;
1194
+ return (t = e.options.scope) == null ? void 0 : t.id;
1072
1195
  }
1073
- function Me(t) {
1074
- return {
1075
- onFetch: (e, s) => {
1076
- var m, d, y, q, S;
1077
- const r = e.options, n = (y = (d = (m = e.fetchOptions) == null ? void 0 : m.meta) == null ? void 0 : d.fetchMore) == null ? void 0 : y.direction, u = ((q = e.state.data) == null ? void 0 : q.pages) || [], h = ((S = e.state.data) == null ? void 0 : S.pageParams) || [];
1078
- let a = { pages: [], pageParams: [] }, f = 0;
1079
- const w = async () => {
1080
- let c = !1;
1081
- const p = (g) => {
1082
- Object.defineProperty(g, "signal", {
1083
- enumerable: !0,
1084
- get: () => (e.signal.aborted ? c = !0 : e.signal.addEventListener("abort", () => {
1085
- c = !0;
1086
- }), e.signal)
1087
- });
1088
- }, E = Le(e.options, e.fetchOptions), M = async (g, D, j) => {
1089
- if (c)
1090
- return Promise.reject();
1091
- if (D == null && g.pages.length)
1092
- return Promise.resolve(g);
1093
- const k = {
1094
- client: e.client,
1095
- queryKey: e.queryKey,
1096
- pageParam: D,
1097
- direction: j ? "backward" : "forward",
1098
- meta: e.options.meta
1099
- };
1100
- p(k);
1101
- const fe = await E(
1102
- k
1103
- ), { maxPages: b } = e.options, z = j ? it : rt;
1104
- return {
1105
- pages: z(g.pages, fe, b),
1106
- pageParams: z(g.pageParams, D, b)
1107
- };
1108
- };
1109
- if (n && u.length) {
1110
- const g = n === "backward", D = g ? vt : Qe, j = {
1111
- pages: u,
1112
- pageParams: h
1113
- }, k = D(r, j);
1114
- a = await M(j, k, g);
1115
- } else {
1116
- const g = t ?? u.length;
1117
- do {
1118
- const D = f === 0 ? h[0] ?? r.initialPageParam : Qe(r, a);
1119
- if (f > 0 && D == null)
1120
- break;
1121
- a = await M(a, D), f++;
1122
- } while (f < g);
1123
- }
1124
- return a;
1125
- };
1126
- e.options.persister ? e.fetchFn = () => {
1127
- var c, p;
1128
- return (p = (c = e.options).persister) == null ? void 0 : p.call(
1129
- c,
1130
- w,
1131
- {
1132
- client: e.client,
1133
- queryKey: e.queryKey,
1134
- meta: e.options.meta,
1135
- signal: e.signal
1136
- },
1137
- s
1138
- );
1139
- } : e.fetchFn = w;
1140
- }
1141
- };
1142
- }
1143
- function Qe(t, { pages: e, pageParams: s }) {
1144
- const r = e.length - 1;
1145
- return e.length > 0 ? t.getNextPageParam(
1146
- e[r],
1147
- e,
1148
- s[r],
1149
- s
1150
- ) : void 0;
1151
- }
1152
- function vt(t, { pages: e, pageParams: s }) {
1153
- var r;
1154
- return e.length > 0 ? (r = t.getPreviousPageParam) == null ? void 0 : r.call(t, e[0], e, s[0], s) : void 0;
1155
- }
1156
- var v, _, V, ie, ne, $, ae, ue, xe, gt = (xe = class {
1196
+ var U, $t, qe = ($t = class extends Ct {
1157
1197
  constructor(t = {}) {
1158
- l(this, v, void 0);
1159
- l(this, _, void 0);
1160
- l(this, V, void 0);
1161
- l(this, ie, void 0);
1162
- l(this, ne, void 0);
1163
- l(this, $, void 0);
1164
- l(this, ae, void 0);
1165
- l(this, ue, void 0);
1166
- o(this, v, t.queryCache || new ft()), o(this, _, t.mutationCache || new mt()), o(this, V, t.defaultOptions || {}), o(this, ie, /* @__PURE__ */ new Map()), o(this, ne, /* @__PURE__ */ new Map()), o(this, $, 0);
1198
+ super();
1199
+ c(this, U, void 0);
1200
+ this.config = t, o(this, U, /* @__PURE__ */ new Map());
1201
+ }
1202
+ build(t, s, r) {
1203
+ const n = s.queryKey, a = s.queryHash ?? Mt(n, s);
1204
+ let l = this.get(a);
1205
+ return l || (l = new Oe({
1206
+ client: t,
1207
+ queryKey: n,
1208
+ queryHash: a,
1209
+ options: t.defaultQueryOptions(s),
1210
+ state: r,
1211
+ defaultOptions: t.getQueryDefaults(n)
1212
+ }), this.add(l)), l;
1167
1213
  }
1168
- mount() {
1169
- ye(this, $)._++, i(this, $) === 1 && (o(this, ae, Ne.subscribe(async (t) => {
1170
- t && (await this.resumePausedMutations(), i(this, v).onFocus());
1171
- })), o(this, ue, ve.subscribe(async (t) => {
1172
- t && (await this.resumePausedMutations(), i(this, v).onOnline());
1173
- })));
1214
+ add(t) {
1215
+ i(this, U).has(t.queryHash) || (i(this, U).set(t.queryHash, t), this.notify({
1216
+ type: "added",
1217
+ query: t
1218
+ }));
1174
1219
  }
1175
- unmount() {
1176
- var t, e;
1177
- ye(this, $)._--, i(this, $) === 0 && ((t = i(this, ae)) == null || t.call(this), o(this, ae, void 0), (e = i(this, ue)) == null || e.call(this), o(this, ue, void 0));
1220
+ remove(t) {
1221
+ const s = i(this, U).get(t.queryHash);
1222
+ s && (t.destroy(), s === t && i(this, U).delete(t.queryHash), this.notify({ type: "removed", query: t }));
1178
1223
  }
1179
- isFetching(t) {
1180
- return i(this, v).findAll({ ...t, fetchStatus: "fetching" }).length;
1224
+ clear() {
1225
+ D.batch(() => {
1226
+ this.getAll().forEach((t) => {
1227
+ this.remove(t);
1228
+ });
1229
+ });
1181
1230
  }
1182
- isMutating(t) {
1183
- return i(this, _).findAll({ ...t, status: "pending" }).length;
1231
+ get(t) {
1232
+ return i(this, U).get(t);
1184
1233
  }
1185
- getQueryData(t) {
1234
+ getAll() {
1235
+ return [...i(this, U).values()];
1236
+ }
1237
+ find(t) {
1238
+ const s = { exact: !0, ...t };
1239
+ return this.getAll().find(
1240
+ (r) => Tt(s, r)
1241
+ );
1242
+ }
1243
+ findAll(t = {}) {
1244
+ const s = this.getAll();
1245
+ return Object.keys(t).length > 0 ? s.filter((r) => Tt(t, r)) : s;
1246
+ }
1247
+ notify(t) {
1248
+ D.batch(() => {
1249
+ this.listeners.forEach((s) => {
1250
+ s(t);
1251
+ });
1252
+ });
1253
+ }
1254
+ onFocus() {
1255
+ D.batch(() => {
1256
+ this.getAll().forEach((t) => {
1257
+ t.onFocus();
1258
+ });
1259
+ });
1260
+ }
1261
+ onOnline() {
1262
+ D.batch(() => {
1263
+ this.getAll().forEach((t) => {
1264
+ t.onOnline();
1265
+ });
1266
+ });
1267
+ }
1268
+ }, U = new WeakMap(), $t), y, V, $, ot, ut, z, ht, ct, zt, Ae = (zt = class {
1269
+ constructor(e = {}) {
1270
+ c(this, y, void 0);
1271
+ c(this, V, void 0);
1272
+ c(this, $, void 0);
1273
+ c(this, ot, void 0);
1274
+ c(this, ut, void 0);
1275
+ c(this, z, void 0);
1276
+ c(this, ht, void 0);
1277
+ c(this, ct, void 0);
1278
+ o(this, y, e.queryCache || new qe()), o(this, V, e.mutationCache || new De()), o(this, $, e.defaultOptions || {}), o(this, ot, /* @__PURE__ */ new Map()), o(this, ut, /* @__PURE__ */ new Map()), o(this, z, 0);
1279
+ }
1280
+ mount() {
1281
+ bt(this, z)._++, i(this, z) === 1 && (o(this, ht, Wt.subscribe(async (e) => {
1282
+ e && (await this.resumePausedMutations(), i(this, y).onFocus());
1283
+ })), o(this, ct, Ot.subscribe(async (e) => {
1284
+ e && (await this.resumePausedMutations(), i(this, y).onOnline());
1285
+ })));
1286
+ }
1287
+ unmount() {
1288
+ var e, t;
1289
+ bt(this, z)._--, i(this, z) === 0 && ((e = i(this, ht)) == null || e.call(this), o(this, ht, void 0), (t = i(this, ct)) == null || t.call(this), o(this, ct, void 0));
1290
+ }
1291
+ isFetching(e) {
1292
+ return i(this, y).findAll({ ...e, fetchStatus: "fetching" }).length;
1293
+ }
1294
+ isMutating(e) {
1295
+ return i(this, V).findAll({ ...e, status: "pending" }).length;
1296
+ }
1297
+ /**
1298
+ * Imperative (non-reactive) way to retrieve data for a QueryKey.
1299
+ * Should only be used in callbacks or functions where reading the latest data is necessary, e.g. for optimistic updates.
1300
+ *
1301
+ * Hint: Do not use this function inside a component, because it won't receive updates.
1302
+ * Use `useQuery` to create a `QueryObserver` that subscribes to changes.
1303
+ */
1304
+ getQueryData(e) {
1186
1305
  var s;
1187
- const e = this.defaultQueryOptions({ queryKey: t });
1188
- return (s = i(this, v).get(e.queryHash)) == null ? void 0 : s.state.data;
1306
+ const t = this.defaultQueryOptions({ queryKey: e });
1307
+ return (s = i(this, y).get(t.queryHash)) == null ? void 0 : s.state.data;
1189
1308
  }
1190
- ensureQueryData(t) {
1191
- const e = this.defaultQueryOptions(t), s = i(this, v).build(this, e), r = s.state.data;
1192
- return r === void 0 ? this.fetchQuery(t) : (t.revalidateIfStale && s.isStaleByTime(Ce(e.staleTime, s)) && this.prefetchQuery(e), Promise.resolve(r));
1309
+ ensureQueryData(e) {
1310
+ const t = this.defaultQueryOptions(e), s = i(this, y).build(this, t), r = s.state.data;
1311
+ return r === void 0 ? this.fetchQuery(e) : (e.revalidateIfStale && s.isStaleByTime(Dt(t.staleTime, s)) && this.prefetchQuery(t), Promise.resolve(r));
1193
1312
  }
1194
- getQueriesData(t) {
1195
- return i(this, v).findAll(t).map(({ queryKey: e, state: s }) => {
1313
+ getQueriesData(e) {
1314
+ return i(this, y).findAll(e).map(({ queryKey: t, state: s }) => {
1196
1315
  const r = s.data;
1197
- return [e, r];
1316
+ return [t, r];
1198
1317
  });
1199
1318
  }
1200
- setQueryData(t, e, s) {
1201
- const r = this.defaultQueryOptions({ queryKey: t }), n = i(this, v).get(
1319
+ setQueryData(e, t, s) {
1320
+ const r = this.defaultQueryOptions({ queryKey: e }), n = i(this, y).get(
1202
1321
  r.queryHash
1203
- ), u = n == null ? void 0 : n.state.data, h = Xe(e, u);
1204
- if (h !== void 0)
1205
- return i(this, v).build(this, r).setData(h, { ...s, manual: !0 });
1322
+ ), a = n == null ? void 0 : n.state.data, l = oe(t, a);
1323
+ if (l !== void 0)
1324
+ return i(this, y).build(this, r).setData(l, { ...s, manual: !0 });
1206
1325
  }
1207
- setQueriesData(t, e, s) {
1208
- return C.batch(
1209
- () => i(this, v).findAll(t).map(({ queryKey: r }) => [
1326
+ setQueriesData(e, t, s) {
1327
+ return D.batch(
1328
+ () => i(this, y).findAll(e).map(({ queryKey: r }) => [
1210
1329
  r,
1211
- this.setQueryData(r, e, s)
1330
+ this.setQueryData(r, t, s)
1212
1331
  ])
1213
1332
  );
1214
1333
  }
1215
- getQueryState(t) {
1334
+ getQueryState(e) {
1216
1335
  var s;
1217
- const e = this.defaultQueryOptions({ queryKey: t });
1218
- return (s = i(this, v).get(
1219
- e.queryHash
1336
+ const t = this.defaultQueryOptions({ queryKey: e });
1337
+ return (s = i(this, y).get(
1338
+ t.queryHash
1220
1339
  )) == null ? void 0 : s.state;
1221
1340
  }
1222
- removeQueries(t) {
1223
- const e = i(this, v);
1224
- C.batch(() => {
1225
- e.findAll(t).forEach((s) => {
1226
- e.remove(s);
1341
+ removeQueries(e) {
1342
+ const t = i(this, y);
1343
+ D.batch(() => {
1344
+ t.findAll(e).forEach((s) => {
1345
+ t.remove(s);
1227
1346
  });
1228
1347
  });
1229
1348
  }
1230
- resetQueries(t, e) {
1231
- const s = i(this, v);
1232
- return C.batch(() => (s.findAll(t).forEach((r) => {
1349
+ resetQueries(e, t) {
1350
+ const s = i(this, y);
1351
+ return D.batch(() => (s.findAll(e).forEach((r) => {
1233
1352
  r.reset();
1234
1353
  }), this.refetchQueries(
1235
1354
  {
1236
1355
  type: "active",
1237
- ...t
1356
+ ...e
1238
1357
  },
1239
- e
1358
+ t
1240
1359
  )));
1241
1360
  }
1242
- cancelQueries(t, e = {}) {
1243
- const s = { revert: !0, ...e }, r = C.batch(
1244
- () => i(this, v).findAll(t).map((n) => n.cancel(s))
1361
+ cancelQueries(e, t = {}) {
1362
+ const s = { revert: !0, ...t }, r = D.batch(
1363
+ () => i(this, y).findAll(e).map((n) => n.cancel(s))
1245
1364
  );
1246
- return Promise.all(r).then(Q).catch(Q);
1365
+ return Promise.all(r).then(R).catch(R);
1247
1366
  }
1248
- invalidateQueries(t, e = {}) {
1249
- return C.batch(() => (i(this, v).findAll(t).forEach((s) => {
1367
+ invalidateQueries(e, t = {}) {
1368
+ return D.batch(() => (i(this, y).findAll(e).forEach((s) => {
1250
1369
  s.invalidate();
1251
- }), (t == null ? void 0 : t.refetchType) === "none" ? Promise.resolve() : this.refetchQueries(
1370
+ }), (e == null ? void 0 : e.refetchType) === "none" ? Promise.resolve() : this.refetchQueries(
1252
1371
  {
1253
- ...t,
1254
- type: (t == null ? void 0 : t.refetchType) ?? (t == null ? void 0 : t.type) ?? "active"
1372
+ ...e,
1373
+ type: (e == null ? void 0 : e.refetchType) ?? (e == null ? void 0 : e.type) ?? "active"
1255
1374
  },
1256
- e
1375
+ t
1257
1376
  )));
1258
1377
  }
1259
- refetchQueries(t, e = {}) {
1378
+ refetchQueries(e, t = {}) {
1260
1379
  const s = {
1261
- ...e,
1262
- cancelRefetch: e.cancelRefetch ?? !0
1263
- }, r = C.batch(
1264
- () => i(this, v).findAll(t).filter((n) => !n.isDisabled()).map((n) => {
1265
- let u = n.fetch(void 0, s);
1266
- return s.throwOnError || (u = u.catch(Q)), n.state.fetchStatus === "paused" ? Promise.resolve() : u;
1380
+ ...t,
1381
+ cancelRefetch: t.cancelRefetch ?? !0
1382
+ }, r = D.batch(
1383
+ () => i(this, y).findAll(e).filter((n) => !n.isDisabled() && !n.isStatic()).map((n) => {
1384
+ let a = n.fetch(void 0, s);
1385
+ return s.throwOnError || (a = a.catch(R)), n.state.fetchStatus === "paused" ? Promise.resolve() : a;
1267
1386
  })
1268
1387
  );
1269
- return Promise.all(r).then(Q);
1388
+ return Promise.all(r).then(R);
1270
1389
  }
1271
- fetchQuery(t) {
1272
- const e = this.defaultQueryOptions(t);
1273
- e.retry === void 0 && (e.retry = !1);
1274
- const s = i(this, v).build(this, e);
1390
+ fetchQuery(e) {
1391
+ const t = this.defaultQueryOptions(e);
1392
+ t.retry === void 0 && (t.retry = !1);
1393
+ const s = i(this, y).build(this, t);
1275
1394
  return s.isStaleByTime(
1276
- Ce(e.staleTime, s)
1277
- ) ? s.fetch(e) : Promise.resolve(s.state.data);
1395
+ Dt(t.staleTime, s)
1396
+ ) ? s.fetch(t) : Promise.resolve(s.state.data);
1278
1397
  }
1279
- prefetchQuery(t) {
1280
- return this.fetchQuery(t).then(Q).catch(Q);
1398
+ prefetchQuery(e) {
1399
+ return this.fetchQuery(e).then(R).catch(R);
1281
1400
  }
1282
- fetchInfiniteQuery(t) {
1283
- return t.behavior = Me(t.pages), this.fetchQuery(t);
1401
+ fetchInfiniteQuery(e) {
1402
+ return e.behavior = kt(e.pages), this.fetchQuery(e);
1284
1403
  }
1285
- prefetchInfiniteQuery(t) {
1286
- return this.fetchInfiniteQuery(t).then(Q).catch(Q);
1404
+ prefetchInfiniteQuery(e) {
1405
+ return this.fetchInfiniteQuery(e).then(R).catch(R);
1287
1406
  }
1288
- ensureInfiniteQueryData(t) {
1289
- return t.behavior = Me(t.pages), this.ensureQueryData(t);
1407
+ ensureInfiniteQueryData(e) {
1408
+ return e.behavior = kt(e.pages), this.ensureQueryData(e);
1290
1409
  }
1291
1410
  resumePausedMutations() {
1292
- return ve.isOnline() ? i(this, _).resumePausedMutations() : Promise.resolve();
1411
+ return Ot.isOnline() ? i(this, V).resumePausedMutations() : Promise.resolve();
1293
1412
  }
1294
1413
  getQueryCache() {
1295
- return i(this, v);
1414
+ return i(this, y);
1296
1415
  }
1297
1416
  getMutationCache() {
1298
- return i(this, _);
1417
+ return i(this, V);
1299
1418
  }
1300
1419
  getDefaultOptions() {
1301
- return i(this, V);
1420
+ return i(this, $);
1302
1421
  }
1303
- setDefaultOptions(t) {
1304
- o(this, V, t);
1422
+ setDefaultOptions(e) {
1423
+ o(this, $, e);
1305
1424
  }
1306
- setQueryDefaults(t, e) {
1307
- i(this, ie).set(he(t), {
1308
- queryKey: t,
1309
- defaultOptions: e
1425
+ setQueryDefaults(e, t) {
1426
+ i(this, ot).set(ft(e), {
1427
+ queryKey: e,
1428
+ defaultOptions: t
1310
1429
  });
1311
1430
  }
1312
- getQueryDefaults(t) {
1313
- const e = [...i(this, ie).values()], s = {};
1314
- return e.forEach((r) => {
1315
- ce(t, r.queryKey) && Object.assign(s, r.defaultOptions);
1431
+ getQueryDefaults(e) {
1432
+ const t = [...i(this, ot).values()], s = {};
1433
+ return t.forEach((r) => {
1434
+ yt(e, r.queryKey) && Object.assign(s, r.defaultOptions);
1316
1435
  }), s;
1317
1436
  }
1318
- setMutationDefaults(t, e) {
1319
- i(this, ne).set(he(t), {
1320
- mutationKey: t,
1321
- defaultOptions: e
1437
+ setMutationDefaults(e, t) {
1438
+ i(this, ut).set(ft(e), {
1439
+ mutationKey: e,
1440
+ defaultOptions: t
1322
1441
  });
1323
1442
  }
1324
- getMutationDefaults(t) {
1325
- const e = [...i(this, ne).values()], s = {};
1326
- return e.forEach((r) => {
1327
- ce(t, r.mutationKey) && Object.assign(s, r.defaultOptions);
1443
+ getMutationDefaults(e) {
1444
+ const t = [...i(this, ut).values()], s = {};
1445
+ return t.forEach((r) => {
1446
+ yt(e, r.mutationKey) && Object.assign(s, r.defaultOptions);
1328
1447
  }), s;
1329
1448
  }
1330
- defaultQueryOptions(t) {
1331
- if (t._defaulted)
1332
- return t;
1333
- const e = {
1334
- ...i(this, V).queries,
1335
- ...this.getQueryDefaults(t.queryKey),
1336
- ...t,
1449
+ defaultQueryOptions(e) {
1450
+ if (e._defaulted)
1451
+ return e;
1452
+ const t = {
1453
+ ...i(this, $).queries,
1454
+ ...this.getQueryDefaults(e.queryKey),
1455
+ ...e,
1337
1456
  _defaulted: !0
1338
1457
  };
1339
- return e.queryHash || (e.queryHash = Fe(
1340
- e.queryKey,
1341
- e
1342
- )), e.refetchOnReconnect === void 0 && (e.refetchOnReconnect = e.networkMode !== "always"), e.throwOnError === void 0 && (e.throwOnError = !!e.suspense), !e.networkMode && e.persister && (e.networkMode = "offlineFirst"), e.queryFn === me && (e.enabled = !1), e;
1343
- }
1344
- defaultMutationOptions(t) {
1345
- return t != null && t._defaulted ? t : {
1346
- ...i(this, V).mutations,
1347
- ...(t == null ? void 0 : t.mutationKey) && this.getMutationDefaults(t.mutationKey),
1348
- ...t,
1458
+ return t.queryHash || (t.queryHash = Mt(
1459
+ t.queryKey,
1460
+ t
1461
+ )), 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 === Pt && (t.enabled = !1), t;
1462
+ }
1463
+ defaultMutationOptions(e) {
1464
+ return e != null && e._defaulted ? e : {
1465
+ ...i(this, $).mutations,
1466
+ ...(e == null ? void 0 : e.mutationKey) && this.getMutationDefaults(e.mutationKey),
1467
+ ...e,
1349
1468
  _defaulted: !0
1350
1469
  };
1351
1470
  }
1352
1471
  clear() {
1353
- i(this, v).clear(), i(this, _).clear();
1472
+ i(this, y).clear(), i(this, V).clear();
1354
1473
  }
1355
- }, v = new WeakMap(), _ = new WeakMap(), V = new WeakMap(), ie = new WeakMap(), ne = new WeakMap(), $ = new WeakMap(), ae = new WeakMap(), ue = new WeakMap(), xe), bt = He.createContext(
1474
+ }, y = new WeakMap(), V = new WeakMap(), $ = new WeakMap(), ot = new WeakMap(), ut = new WeakMap(), z = new WeakMap(), ht = new WeakMap(), ct = new WeakMap(), zt), Qe = Bt.createContext(
1356
1475
  void 0
1357
- ), wt = ({
1358
- client: t,
1359
- children: e
1360
- }) => (He.useEffect(() => (t.mount(), () => {
1361
- t.unmount();
1362
- }), [t]), /* @__PURE__ */ oe(bt.Provider, { value: t, children: e }));
1363
- const Pt = new gt(), Dt = (t) => {
1364
- const { children: e, customVariables: s, customDarkVariables: r, workerUrl: n, licenseKey: u, ...h } = t, { workerUrlAdded: a } = Je(n);
1365
- return /* @__PURE__ */ oe(wt, { client: Pt, children: /* @__PURE__ */ oe(We, { licenseKey: u, children: /* @__PURE__ */ oe(Be, { workerUrlAdded: a, ...h, children: /* @__PURE__ */ oe(ze, { customDarkVariables: r, customVariables: s, children: e }) }) }) });
1476
+ ), Me = ({
1477
+ client: e,
1478
+ children: t
1479
+ }) => (Bt.useEffect(() => (e.mount(), () => {
1480
+ e.unmount();
1481
+ }), [e]), /* @__PURE__ */ dt(Qe.Provider, { value: e, children: t }));
1482
+ const Te = new Ae(), Ue = (e) => {
1483
+ const { children: t, customVariables: s, customDarkVariables: r, workerUrl: n, licenseKey: a, ...l } = e, { workerUrlAdded: u } = se(n);
1484
+ return /* @__PURE__ */ dt(Me, { client: Te, children: /* @__PURE__ */ dt(re, { licenseKey: a, children: /* @__PURE__ */ dt(ee, { workerUrlAdded: u, ...l, children: /* @__PURE__ */ dt(te, { customDarkVariables: r, customVariables: s, children: t }) }) }) });
1366
1485
  };
1367
1486
  export {
1368
- Dt as RPConfig
1487
+ Ue as RPConfig
1369
1488
  };