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