@pdf-viewer/react 1.0.1 → 1.1.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.
- package/dist/RPDefaultLayout-62e0f668.js +2754 -0
- package/dist/assets/RPDefaultLayout.css +1 -1
- package/dist/components/RPConfig.js +340 -318
- package/dist/components/RPController.js +1 -1
- package/dist/components/RPPages.js +3 -2
- package/dist/components/RPProvider.js +1 -1
- package/dist/components/layout/RPDefaultLayout.js +4 -2
- package/dist/components/layout/sidebar/RPSidebar.js +1 -1
- package/dist/components/layout/sidebar/Thumbnail.js +1 -1
- package/dist/components/layout/sidebar/Thumbnails.js +1 -1
- package/dist/components/layout/toolbar/DocumentDialog.js +1 -1
- package/dist/components/layout/toolbar/FileDownloadTool.js +1 -1
- package/dist/components/layout/toolbar/MenuItem.js +1 -1
- package/dist/components/layout/toolbar/MenuSeparator.js +1 -1
- package/dist/components/layout/toolbar/MostPageTool.js +2 -2
- package/dist/components/layout/toolbar/OtherTool.js +2 -2
- package/dist/components/layout/toolbar/Paginate.js +1 -1
- package/dist/components/layout/toolbar/PrintTool.js +1 -1
- package/dist/components/layout/toolbar/RPToolbar.js +1 -1
- package/dist/components/layout/toolbar/RPToolbarEnd.js +1 -1
- package/dist/components/layout/toolbar/RotateTool.js +1 -1
- package/dist/components/layout/toolbar/ScrollModeTool.js +1 -1
- package/dist/components/layout/toolbar/SearchTool.js +1 -1
- package/dist/components/layout/toolbar/SelectionModeTool.js +1 -1
- package/dist/components/layout/toolbar/ViewModeTool.js +1 -1
- package/dist/components/layout/toolbar/ZoomTool.js +2 -2
- package/dist/components/page/AnnotationLayer.js +1 -1
- package/dist/components/page/CanvasLayer.js +1 -1
- package/dist/components/page/DualPage.js +1 -1
- package/dist/components/page/RPPage.js +1 -1
- package/dist/components/page/SinglePage.js +1 -1
- package/dist/components/page/TextLayer.js +1 -1
- package/dist/components/ui/Checkbox.js +92 -252
- package/dist/components/ui/DropDown.js +1 -1
- package/dist/components/ui/LoadingIndicator.js +1 -1
- package/dist/components/ui/RPTooltip.js +224 -961
- package/dist/contexts/DarkModeContext.js +9 -9
- package/dist/contexts/PaginationContext.js +1 -1
- package/dist/contexts/PrintContext.js +1 -1
- package/dist/contexts/RPDocumentContext.js +24 -37
- package/dist/contexts/RotationContext.js +8 -8
- package/dist/contexts/ScrollModeContext.js +5 -5
- package/dist/contexts/SearchContext.js +1 -1
- package/dist/contexts/SelectionModeContext.js +1 -1
- package/dist/contexts/ThumbnailsContext.js +1 -1
- package/dist/contexts/ViewModeContext.js +9 -9
- package/dist/contexts/ZoomContext.js +11 -11
- package/dist/index-1db49c1a.js +1664 -0
- package/dist/index-3dff3fa8.js +307 -0
- package/dist/index-4f17fe4d.js +1657 -0
- package/dist/main.js +1 -1
- package/dist/utils/hooks/useFileDownload.js +1 -1
- package/dist/utils/hooks/useLicense.js +37 -40
- package/dist/utils/hooks/usePaginate.js +1 -1
- package/dist/utils/hooks/usePrint.js +1 -1
- package/dist/utils/hooks/useScrollToPage.js +1 -1
- package/dist/utils/hooks/useSearch.js +1 -1
- package/dist/utils/hooks/useThumbnail.js +1 -1
- package/dist/utils/hooks/useVirtualReactWindow.js +1 -1
- package/package.json +1 -1
- package/dist/RPDefaultLayout-adbb0836.js +0 -2707
- package/dist/floating-ui.react-dom-e6d5fe8f.js +0 -1327
- package/dist/index-316854c1.js +0 -2299
- package/dist/index-71898eb9.js +0 -139
|
@@ -1,27 +1,27 @@
|
|
|
1
|
-
var
|
|
1
|
+
var we = (t, e, s) => {
|
|
2
2
|
if (!e.has(t))
|
|
3
3
|
throw TypeError("Cannot " + s);
|
|
4
4
|
};
|
|
5
|
-
var i = (t, e, s) => (
|
|
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
6
|
if (e.has(t))
|
|
7
7
|
throw TypeError("Cannot add the same private member more than once");
|
|
8
8
|
e instanceof WeakSet ? e.add(t) : e.set(t, s);
|
|
9
|
-
}, o = (t, e, s, r) => (
|
|
10
|
-
var
|
|
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) => ({
|
|
11
11
|
set _(n) {
|
|
12
12
|
o(t, e, n, s);
|
|
13
13
|
},
|
|
14
14
|
get _() {
|
|
15
15
|
return i(t, e, r);
|
|
16
16
|
}
|
|
17
|
-
}), P = (t, e, s) => (
|
|
18
|
-
import { jsx as
|
|
19
|
-
import { RPTheme as
|
|
20
|
-
import { ConfigContextProvider as
|
|
21
|
-
import { useLoadWorker as
|
|
22
|
-
import * as
|
|
23
|
-
import { LicenseProvider as
|
|
24
|
-
var
|
|
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 {
|
|
25
25
|
constructor() {
|
|
26
26
|
this.listeners = /* @__PURE__ */ new Set(), this.subscribe = this.subscribe.bind(this);
|
|
27
27
|
}
|
|
@@ -37,25 +37,25 @@ var me = class {
|
|
|
37
37
|
}
|
|
38
38
|
onUnsubscribe() {
|
|
39
39
|
}
|
|
40
|
-
},
|
|
41
|
-
function
|
|
40
|
+
}, be = typeof window > "u" || "Deno" in globalThis;
|
|
41
|
+
function Q() {
|
|
42
42
|
}
|
|
43
|
-
function
|
|
43
|
+
function Xe(t, e) {
|
|
44
44
|
return typeof t == "function" ? t(e) : t;
|
|
45
45
|
}
|
|
46
|
-
function
|
|
46
|
+
function Ye(t) {
|
|
47
47
|
return typeof t == "number" && t >= 0 && t !== 1 / 0;
|
|
48
48
|
}
|
|
49
|
-
function
|
|
49
|
+
function Ze(t, e) {
|
|
50
50
|
return Math.max(t + (e || 0) - Date.now(), 0);
|
|
51
51
|
}
|
|
52
|
-
function
|
|
52
|
+
function Ce(t, e) {
|
|
53
53
|
return typeof t == "function" ? t(e) : t;
|
|
54
54
|
}
|
|
55
|
-
function
|
|
55
|
+
function et(t, e) {
|
|
56
56
|
return typeof t == "function" ? t(e) : t;
|
|
57
57
|
}
|
|
58
|
-
function
|
|
58
|
+
function qe(t, e) {
|
|
59
59
|
const {
|
|
60
60
|
type: s = "all",
|
|
61
61
|
exact: r,
|
|
@@ -66,9 +66,9 @@ function Fe(t, e) {
|
|
|
66
66
|
} = t;
|
|
67
67
|
if (h) {
|
|
68
68
|
if (r) {
|
|
69
|
-
if (e.queryHash !==
|
|
69
|
+
if (e.queryHash !== Se(h, e.options))
|
|
70
70
|
return !1;
|
|
71
|
-
} else if (!
|
|
71
|
+
} else if (!ce(e.queryKey, h))
|
|
72
72
|
return !1;
|
|
73
73
|
}
|
|
74
74
|
if (s !== "all") {
|
|
@@ -78,104 +78,104 @@ function Fe(t, e) {
|
|
|
78
78
|
}
|
|
79
79
|
return !(typeof a == "boolean" && e.isStale() !== a || n && n !== e.state.fetchStatus || u && !u(e));
|
|
80
80
|
}
|
|
81
|
-
function
|
|
81
|
+
function Ee(t, e) {
|
|
82
82
|
const { exact: s, status: r, predicate: n, mutationKey: u } = t;
|
|
83
83
|
if (u) {
|
|
84
84
|
if (!e.options.mutationKey)
|
|
85
85
|
return !1;
|
|
86
86
|
if (s) {
|
|
87
|
-
if (
|
|
87
|
+
if (he(e.options.mutationKey) !== he(u))
|
|
88
88
|
return !1;
|
|
89
|
-
} else if (!
|
|
89
|
+
} else if (!ce(e.options.mutationKey, u))
|
|
90
90
|
return !1;
|
|
91
91
|
}
|
|
92
92
|
return !(r && e.state.status !== r || n && !n(e));
|
|
93
93
|
}
|
|
94
|
-
function
|
|
95
|
-
return ((e == null ? void 0 : e.queryKeyHashFn) ||
|
|
94
|
+
function Se(t, e) {
|
|
95
|
+
return ((e == null ? void 0 : e.queryKeyHashFn) || he)(t);
|
|
96
96
|
}
|
|
97
|
-
function
|
|
97
|
+
function he(t) {
|
|
98
98
|
return JSON.stringify(
|
|
99
99
|
t,
|
|
100
|
-
(e, s) =>
|
|
100
|
+
(e, s) => Fe(s) ? Object.keys(s).sort().reduce((r, n) => (r[n] = s[n], r), {}) : s
|
|
101
101
|
);
|
|
102
102
|
}
|
|
103
|
-
function
|
|
104
|
-
return t === e ? !0 : typeof t != typeof e ? !1 : t && e && typeof t == "object" && typeof e == "object" ? !Object.keys(e).some((s) => !
|
|
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;
|
|
105
105
|
}
|
|
106
|
-
function
|
|
106
|
+
function Oe(t, e) {
|
|
107
107
|
if (t === e)
|
|
108
108
|
return t;
|
|
109
|
-
const s =
|
|
110
|
-
if (s ||
|
|
109
|
+
const s = De(t) && De(e);
|
|
110
|
+
if (s || Fe(t) && Fe(e)) {
|
|
111
111
|
const r = s ? t : Object.keys(t), n = r.length, u = s ? e : Object.keys(e), h = u.length, a = s ? [] : {};
|
|
112
112
|
let f = 0;
|
|
113
113
|
for (let w = 0; w < h; w++) {
|
|
114
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] =
|
|
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++);
|
|
116
116
|
}
|
|
117
117
|
return n === h && f === n ? t : a;
|
|
118
118
|
}
|
|
119
119
|
return e;
|
|
120
120
|
}
|
|
121
|
-
function
|
|
121
|
+
function De(t) {
|
|
122
122
|
return Array.isArray(t) && t.length === Object.keys(t).length;
|
|
123
123
|
}
|
|
124
|
-
function
|
|
125
|
-
if (!
|
|
124
|
+
function Fe(t) {
|
|
125
|
+
if (!Ae(t))
|
|
126
126
|
return !1;
|
|
127
127
|
const e = t.constructor;
|
|
128
128
|
if (e === void 0)
|
|
129
129
|
return !0;
|
|
130
130
|
const s = e.prototype;
|
|
131
|
-
return !(!
|
|
131
|
+
return !(!Ae(s) || !s.hasOwnProperty("isPrototypeOf") || Object.getPrototypeOf(t) !== Object.prototype);
|
|
132
132
|
}
|
|
133
|
-
function
|
|
133
|
+
function Ae(t) {
|
|
134
134
|
return Object.prototype.toString.call(t) === "[object Object]";
|
|
135
135
|
}
|
|
136
|
-
function
|
|
136
|
+
function tt(t) {
|
|
137
137
|
return new Promise((e) => {
|
|
138
138
|
setTimeout(e, t);
|
|
139
139
|
});
|
|
140
140
|
}
|
|
141
|
-
function
|
|
141
|
+
function st(t, e, s) {
|
|
142
142
|
if (typeof s.structuralSharing == "function")
|
|
143
143
|
return s.structuralSharing(t, e);
|
|
144
144
|
if (s.structuralSharing !== !1) {
|
|
145
145
|
if (process.env.NODE_ENV !== "production")
|
|
146
146
|
try {
|
|
147
|
-
return
|
|
147
|
+
return Oe(t, e);
|
|
148
148
|
} catch (r) {
|
|
149
149
|
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
|
);
|
|
152
152
|
}
|
|
153
|
-
return
|
|
153
|
+
return Oe(t, e);
|
|
154
154
|
}
|
|
155
155
|
return e;
|
|
156
156
|
}
|
|
157
|
-
function
|
|
157
|
+
function rt(t, e, s = 0) {
|
|
158
158
|
const r = [...t, e];
|
|
159
159
|
return s && r.length > s ? r.slice(1) : r;
|
|
160
160
|
}
|
|
161
|
-
function
|
|
161
|
+
function it(t, e, s = 0) {
|
|
162
162
|
const r = [e, ...t];
|
|
163
163
|
return s && r.length > s ? r.slice(0, -1) : r;
|
|
164
164
|
}
|
|
165
|
-
var
|
|
166
|
-
function
|
|
167
|
-
return process.env.NODE_ENV !== "production" && t.queryFn ===
|
|
165
|
+
var me = Symbol();
|
|
166
|
+
function Le(t, e) {
|
|
167
|
+
return process.env.NODE_ENV !== "production" && t.queryFn === me && console.error(
|
|
168
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 ===
|
|
169
|
+
), !t.queryFn && (e != null && e.initialPromise) ? () => e.initialPromise : !t.queryFn || t.queryFn === me ? () => Promise.reject(new Error(`Missing queryFn: '${t.queryHash}'`)) : t.queryFn;
|
|
170
170
|
}
|
|
171
|
-
var
|
|
171
|
+
var B, N, Z, Re, nt = (Re = class extends ge {
|
|
172
172
|
constructor() {
|
|
173
173
|
super();
|
|
174
|
-
l(this,
|
|
175
|
-
l(this,
|
|
176
|
-
l(this,
|
|
177
|
-
o(this,
|
|
178
|
-
if (!
|
|
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
179
|
const s = () => e();
|
|
180
180
|
return window.addEventListener("visibilitychange", s, !1), () => {
|
|
181
181
|
window.removeEventListener("visibilitychange", s);
|
|
@@ -184,20 +184,20 @@ var z, L, X, Qe, rt = (Qe = class extends me {
|
|
|
184
184
|
});
|
|
185
185
|
}
|
|
186
186
|
onSubscribe() {
|
|
187
|
-
i(this,
|
|
187
|
+
i(this, N) || this.setEventListener(i(this, Z));
|
|
188
188
|
}
|
|
189
189
|
onUnsubscribe() {
|
|
190
190
|
var e;
|
|
191
|
-
this.hasListeners() || ((e = i(this,
|
|
191
|
+
this.hasListeners() || ((e = i(this, N)) == null || e.call(this), o(this, N, void 0));
|
|
192
192
|
}
|
|
193
193
|
setEventListener(e) {
|
|
194
194
|
var s;
|
|
195
|
-
o(this,
|
|
195
|
+
o(this, Z, e), (s = i(this, N)) == null || s.call(this), o(this, N, e((r) => {
|
|
196
196
|
typeof r == "boolean" ? this.setFocused(r) : this.onFocus();
|
|
197
197
|
}));
|
|
198
198
|
}
|
|
199
199
|
setFocused(e) {
|
|
200
|
-
i(this,
|
|
200
|
+
i(this, B) !== e && (o(this, B, e), this.onFocus());
|
|
201
201
|
}
|
|
202
202
|
onFocus() {
|
|
203
203
|
const e = this.isFocused();
|
|
@@ -207,16 +207,16 @@ var z, L, X, Qe, rt = (Qe = class extends me {
|
|
|
207
207
|
}
|
|
208
208
|
isFocused() {
|
|
209
209
|
var e;
|
|
210
|
-
return typeof i(this,
|
|
210
|
+
return typeof i(this, B) == "boolean" ? i(this, B) : ((e = globalThis.document) == null ? void 0 : e.visibilityState) !== "hidden";
|
|
211
211
|
}
|
|
212
|
-
},
|
|
212
|
+
}, B = new WeakMap(), N = new WeakMap(), Z = new WeakMap(), Re), Ne = new nt(), ee, G, te, Te, at = (Te = class extends ge {
|
|
213
213
|
constructor() {
|
|
214
214
|
super();
|
|
215
|
-
l(this,
|
|
216
|
-
l(this,
|
|
217
|
-
l(this,
|
|
218
|
-
o(this,
|
|
219
|
-
if (!
|
|
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
220
|
const s = () => e(!0), r = () => e(!1);
|
|
221
221
|
return window.addEventListener("online", s, !1), window.addEventListener("offline", r, !1), () => {
|
|
222
222
|
window.removeEventListener("online", s), window.removeEventListener("offline", r);
|
|
@@ -225,26 +225,26 @@ var z, L, X, Qe, rt = (Qe = class extends me {
|
|
|
225
225
|
});
|
|
226
226
|
}
|
|
227
227
|
onSubscribe() {
|
|
228
|
-
i(this,
|
|
228
|
+
i(this, G) || this.setEventListener(i(this, te));
|
|
229
229
|
}
|
|
230
230
|
onUnsubscribe() {
|
|
231
231
|
var e;
|
|
232
|
-
this.hasListeners() || ((e = i(this,
|
|
232
|
+
this.hasListeners() || ((e = i(this, G)) == null || e.call(this), o(this, G, void 0));
|
|
233
233
|
}
|
|
234
234
|
setEventListener(e) {
|
|
235
235
|
var s;
|
|
236
|
-
o(this,
|
|
236
|
+
o(this, te, e), (s = i(this, G)) == null || s.call(this), o(this, G, e(this.setOnline.bind(this)));
|
|
237
237
|
}
|
|
238
238
|
setOnline(e) {
|
|
239
|
-
i(this,
|
|
239
|
+
i(this, ee) !== e && (o(this, ee, e), this.listeners.forEach((r) => {
|
|
240
240
|
r(e);
|
|
241
241
|
}));
|
|
242
242
|
}
|
|
243
243
|
isOnline() {
|
|
244
|
-
return i(this,
|
|
244
|
+
return i(this, ee);
|
|
245
245
|
}
|
|
246
|
-
},
|
|
247
|
-
function
|
|
246
|
+
}, ee = new WeakMap(), G = new WeakMap(), te = new WeakMap(), Te), ve = new at();
|
|
247
|
+
function ut() {
|
|
248
248
|
let t, e;
|
|
249
249
|
const s = new Promise((n, u) => {
|
|
250
250
|
t = n, e = u;
|
|
@@ -266,30 +266,30 @@ function nt() {
|
|
|
266
266
|
}), e(n);
|
|
267
267
|
}, s;
|
|
268
268
|
}
|
|
269
|
-
function
|
|
269
|
+
function ot(t) {
|
|
270
270
|
return Math.min(1e3 * 2 ** t, 3e4);
|
|
271
271
|
}
|
|
272
|
-
function
|
|
273
|
-
return (t ?? "online") === "online" ?
|
|
272
|
+
function Ge(t) {
|
|
273
|
+
return (t ?? "online") === "online" ? ve.isOnline() : !0;
|
|
274
274
|
}
|
|
275
|
-
var
|
|
275
|
+
var _e = class extends Error {
|
|
276
276
|
constructor(t) {
|
|
277
277
|
super("CancelledError"), this.revert = t == null ? void 0 : t.revert, this.silent = t == null ? void 0 : t.silent;
|
|
278
278
|
}
|
|
279
279
|
};
|
|
280
|
-
function
|
|
281
|
-
return t instanceof
|
|
280
|
+
function Pe(t) {
|
|
281
|
+
return t instanceof _e;
|
|
282
282
|
}
|
|
283
|
-
function
|
|
283
|
+
function Ve(t) {
|
|
284
284
|
let e = !1, s = 0, r = !1, n;
|
|
285
|
-
const u =
|
|
285
|
+
const u = ut(), h = (c) => {
|
|
286
286
|
var p;
|
|
287
|
-
r || (y(new
|
|
287
|
+
r || (y(new _e(c)), (p = t.abort) == null || p.call(t));
|
|
288
288
|
}, a = () => {
|
|
289
289
|
e = !0;
|
|
290
290
|
}, f = () => {
|
|
291
291
|
e = !1;
|
|
292
|
-
}, w = () =>
|
|
292
|
+
}, w = () => Ne.isFocused() && (t.networkMode === "always" || ve.isOnline()) && t.canRun(), m = () => Ge(t.networkMode) && t.canRun(), d = (c) => {
|
|
293
293
|
var p;
|
|
294
294
|
r || (r = !0, (p = t.onSuccess) == null || p.call(t, c), n == null || n(), u.resolve(c));
|
|
295
295
|
}, y = (c) => {
|
|
@@ -297,33 +297,33 @@ function Ge(t) {
|
|
|
297
297
|
r || (r = !0, (p = t.onError) == null || p.call(t, c), n == null || n(), u.reject(c));
|
|
298
298
|
}, q = () => new Promise((c) => {
|
|
299
299
|
var p;
|
|
300
|
-
n = (
|
|
301
|
-
(r || w()) && c(
|
|
300
|
+
n = (E) => {
|
|
301
|
+
(r || w()) && c(E);
|
|
302
302
|
}, (p = t.onPause) == null || p.call(t);
|
|
303
303
|
}).then(() => {
|
|
304
304
|
var c;
|
|
305
305
|
n = void 0, r || (c = t.onContinue) == null || c.call(t);
|
|
306
|
-
}),
|
|
306
|
+
}), F = () => {
|
|
307
307
|
if (r)
|
|
308
308
|
return;
|
|
309
309
|
let c;
|
|
310
310
|
const p = s === 0 ? t.initialPromise : void 0;
|
|
311
311
|
try {
|
|
312
312
|
c = p ?? t.fn();
|
|
313
|
-
} catch (
|
|
314
|
-
c = Promise.reject(
|
|
313
|
+
} catch (E) {
|
|
314
|
+
c = Promise.reject(E);
|
|
315
315
|
}
|
|
316
|
-
Promise.resolve(c).then(d).catch((
|
|
317
|
-
var
|
|
316
|
+
Promise.resolve(c).then(d).catch((E) => {
|
|
317
|
+
var k;
|
|
318
318
|
if (r)
|
|
319
319
|
return;
|
|
320
|
-
const M = t.retry ?? (
|
|
321
|
-
if (e || !
|
|
322
|
-
y(
|
|
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
323
|
return;
|
|
324
324
|
}
|
|
325
|
-
s++, (
|
|
326
|
-
e ? y(
|
|
325
|
+
s++, (k = t.onFail) == null || k.call(t, s, E), tt(D).then(() => w() ? void 0 : q()).then(() => {
|
|
326
|
+
e ? y(E) : F();
|
|
327
327
|
});
|
|
328
328
|
});
|
|
329
329
|
};
|
|
@@ -334,10 +334,10 @@ function Ge(t) {
|
|
|
334
334
|
cancelRetry: a,
|
|
335
335
|
continueRetry: f,
|
|
336
336
|
canStart: m,
|
|
337
|
-
start: () => (m() ?
|
|
337
|
+
start: () => (m() ? F() : q().then(F), u)
|
|
338
338
|
};
|
|
339
339
|
}
|
|
340
|
-
function
|
|
340
|
+
function ht() {
|
|
341
341
|
let t = [], e = 0, s = (a) => {
|
|
342
342
|
a();
|
|
343
343
|
}, r = (a) => {
|
|
@@ -396,38 +396,39 @@ function ut() {
|
|
|
396
396
|
}
|
|
397
397
|
};
|
|
398
398
|
}
|
|
399
|
-
var C =
|
|
399
|
+
var C = ht(), J, je, $e = (je = class {
|
|
400
400
|
constructor() {
|
|
401
|
-
l(this,
|
|
401
|
+
l(this, J, void 0);
|
|
402
402
|
}
|
|
403
403
|
destroy() {
|
|
404
404
|
this.clearGcTimeout();
|
|
405
405
|
}
|
|
406
406
|
scheduleGc() {
|
|
407
|
-
this.clearGcTimeout(),
|
|
407
|
+
this.clearGcTimeout(), Ye(this.gcTime) && o(this, J, setTimeout(() => {
|
|
408
408
|
this.optionalRemove();
|
|
409
409
|
}, this.gcTime));
|
|
410
410
|
}
|
|
411
411
|
updateGcTime(t) {
|
|
412
412
|
this.gcTime = Math.max(
|
|
413
413
|
this.gcTime || 0,
|
|
414
|
-
t ?? (
|
|
414
|
+
t ?? (be ? 1 / 0 : 5 * 60 * 1e3)
|
|
415
415
|
);
|
|
416
416
|
}
|
|
417
417
|
clearGcTimeout() {
|
|
418
|
-
i(this,
|
|
418
|
+
i(this, J) && (clearTimeout(i(this, J)), o(this, J, void 0));
|
|
419
419
|
}
|
|
420
|
-
},
|
|
420
|
+
}, J = new WeakMap(), je), se, re, A, W, O, le, X, R, x, ke, ct = (ke = class extends $e {
|
|
421
421
|
constructor(e) {
|
|
422
422
|
super();
|
|
423
|
-
l(this,
|
|
424
|
-
l(this,
|
|
425
|
-
l(this,
|
|
426
|
-
l(this,
|
|
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);
|
|
427
428
|
l(this, O, void 0);
|
|
428
|
-
l(this,
|
|
429
|
-
l(this,
|
|
430
|
-
o(this,
|
|
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();
|
|
431
432
|
}
|
|
432
433
|
get meta() {
|
|
433
434
|
return this.options.meta;
|
|
@@ -437,14 +438,14 @@ var C = ut(), B, Re, _e = (Re = class {
|
|
|
437
438
|
return (e = i(this, O)) == null ? void 0 : e.promise;
|
|
438
439
|
}
|
|
439
440
|
setOptions(e) {
|
|
440
|
-
this.options = { ...i(this,
|
|
441
|
+
this.options = { ...i(this, le), ...e }, this.updateGcTime(this.options.gcTime);
|
|
441
442
|
}
|
|
442
443
|
optionalRemove() {
|
|
443
|
-
!this.observers.length && this.state.fetchStatus === "idle" && i(this,
|
|
444
|
+
!this.observers.length && this.state.fetchStatus === "idle" && i(this, A).remove(this);
|
|
444
445
|
}
|
|
445
446
|
setData(e, s) {
|
|
446
|
-
const r =
|
|
447
|
-
return P(this,
|
|
447
|
+
const r = st(this.state.data, e, this.options);
|
|
448
|
+
return P(this, R, x).call(this, {
|
|
448
449
|
data: r,
|
|
449
450
|
type: "success",
|
|
450
451
|
dataUpdatedAt: s == null ? void 0 : s.updatedAt,
|
|
@@ -452,26 +453,26 @@ var C = ut(), B, Re, _e = (Re = class {
|
|
|
452
453
|
}), r;
|
|
453
454
|
}
|
|
454
455
|
setState(e, s) {
|
|
455
|
-
P(this,
|
|
456
|
+
P(this, R, x).call(this, { type: "setState", state: e, setStateOptions: s });
|
|
456
457
|
}
|
|
457
458
|
cancel(e) {
|
|
458
459
|
var r, n;
|
|
459
460
|
const s = (r = i(this, O)) == null ? void 0 : r.promise;
|
|
460
|
-
return (n = i(this, O)) == null || n.cancel(e), s ? s.then(
|
|
461
|
+
return (n = i(this, O)) == null || n.cancel(e), s ? s.then(Q).catch(Q) : Promise.resolve();
|
|
461
462
|
}
|
|
462
463
|
destroy() {
|
|
463
464
|
super.destroy(), this.cancel({ silent: !0 });
|
|
464
465
|
}
|
|
465
466
|
reset() {
|
|
466
|
-
this.destroy(), this.setState(i(this,
|
|
467
|
+
this.destroy(), this.setState(i(this, se));
|
|
467
468
|
}
|
|
468
469
|
isActive() {
|
|
469
470
|
return this.observers.some(
|
|
470
|
-
(e) =>
|
|
471
|
+
(e) => et(e.options.enabled, this) !== !1
|
|
471
472
|
);
|
|
472
473
|
}
|
|
473
474
|
isDisabled() {
|
|
474
|
-
return this.getObserversCount() > 0 ? !this.isActive() : this.options.queryFn ===
|
|
475
|
+
return this.getObserversCount() > 0 ? !this.isActive() : this.options.queryFn === me || this.state.dataUpdateCount + this.state.errorUpdateCount === 0;
|
|
475
476
|
}
|
|
476
477
|
isStale() {
|
|
477
478
|
return this.state.isInvalidated ? !0 : this.getObserversCount() > 0 ? this.observers.some(
|
|
@@ -479,7 +480,7 @@ var C = ut(), B, Re, _e = (Re = class {
|
|
|
479
480
|
) : this.state.data === void 0;
|
|
480
481
|
}
|
|
481
482
|
isStaleByTime(e = 0) {
|
|
482
|
-
return this.state.isInvalidated || this.state.data === void 0 || !
|
|
483
|
+
return this.state.isInvalidated || this.state.data === void 0 || !Ze(this.state.dataUpdatedAt, e);
|
|
483
484
|
}
|
|
484
485
|
onFocus() {
|
|
485
486
|
var s;
|
|
@@ -492,16 +493,16 @@ var C = ut(), B, Re, _e = (Re = class {
|
|
|
492
493
|
e == null || e.refetch({ cancelRefetch: !1 }), (s = i(this, O)) == null || s.continue();
|
|
493
494
|
}
|
|
494
495
|
addObserver(e) {
|
|
495
|
-
this.observers.includes(e) || (this.observers.push(e), this.clearGcTimeout(), i(this,
|
|
496
|
+
this.observers.includes(e) || (this.observers.push(e), this.clearGcTimeout(), i(this, A).notify({ type: "observerAdded", query: this, observer: e }));
|
|
496
497
|
}
|
|
497
498
|
removeObserver(e) {
|
|
498
|
-
this.observers.includes(e) && (this.observers = this.observers.filter((s) => s !== e), this.observers.length || (i(this, O) && (i(this,
|
|
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 }));
|
|
499
500
|
}
|
|
500
501
|
getObserversCount() {
|
|
501
502
|
return this.observers.length;
|
|
502
503
|
}
|
|
503
504
|
invalidate() {
|
|
504
|
-
this.state.isInvalidated || P(this,
|
|
505
|
+
this.state.isInvalidated || P(this, R, x).call(this, { type: "invalidate" });
|
|
505
506
|
}
|
|
506
507
|
fetch(e, s) {
|
|
507
508
|
var f, w, m;
|
|
@@ -521,14 +522,15 @@ var C = ut(), B, Re, _e = (Re = class {
|
|
|
521
522
|
const r = new AbortController(), n = (d) => {
|
|
522
523
|
Object.defineProperty(d, "signal", {
|
|
523
524
|
enumerable: !0,
|
|
524
|
-
get: () => (o(this,
|
|
525
|
+
get: () => (o(this, X, !0), r.signal)
|
|
525
526
|
});
|
|
526
527
|
}, u = () => {
|
|
527
|
-
const d =
|
|
528
|
+
const d = Le(this.options, s), y = {
|
|
529
|
+
client: i(this, W),
|
|
528
530
|
queryKey: this.queryKey,
|
|
529
531
|
meta: this.meta
|
|
530
532
|
};
|
|
531
|
-
return n(y), o(this,
|
|
533
|
+
return n(y), o(this, X, !1), this.options.persister ? this.options.persister(
|
|
532
534
|
d,
|
|
533
535
|
y,
|
|
534
536
|
this
|
|
@@ -537,35 +539,36 @@ var C = ut(), B, Re, _e = (Re = class {
|
|
|
537
539
|
fetchOptions: s,
|
|
538
540
|
options: this.options,
|
|
539
541
|
queryKey: this.queryKey,
|
|
542
|
+
client: i(this, W),
|
|
540
543
|
state: this.state,
|
|
541
544
|
fetchFn: u
|
|
542
545
|
};
|
|
543
546
|
n(h), (f = this.options.behavior) == null || f.onFetch(
|
|
544
547
|
h,
|
|
545
548
|
this
|
|
546
|
-
), o(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 });
|
|
547
550
|
const a = (d) => {
|
|
548
|
-
var y, q,
|
|
549
|
-
|
|
551
|
+
var y, q, F, c;
|
|
552
|
+
Pe(d) && d.silent || P(this, R, x).call(this, {
|
|
550
553
|
type: "error",
|
|
551
554
|
error: d
|
|
552
|
-
}),
|
|
555
|
+
}), Pe(d) || ((q = (y = i(this, A).config).onError) == null || q.call(
|
|
553
556
|
y,
|
|
554
557
|
d,
|
|
555
558
|
this
|
|
556
|
-
), (c = (
|
|
557
|
-
|
|
559
|
+
), (c = (F = i(this, A).config).onSettled) == null || c.call(
|
|
560
|
+
F,
|
|
558
561
|
this.state.data,
|
|
559
562
|
d,
|
|
560
563
|
this
|
|
561
564
|
)), this.scheduleGc();
|
|
562
565
|
};
|
|
563
|
-
return o(this, O,
|
|
566
|
+
return o(this, O, Ve({
|
|
564
567
|
initialPromise: s == null ? void 0 : s.initialPromise,
|
|
565
568
|
fn: h.fetchFn,
|
|
566
569
|
abort: r.abort.bind(r),
|
|
567
570
|
onSuccess: (d) => {
|
|
568
|
-
var y, q,
|
|
571
|
+
var y, q, F, c;
|
|
569
572
|
if (d === void 0) {
|
|
570
573
|
process.env.NODE_ENV !== "production" && console.error(
|
|
571
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}`
|
|
@@ -578,8 +581,8 @@ var C = ut(), B, Re, _e = (Re = class {
|
|
|
578
581
|
a(p);
|
|
579
582
|
return;
|
|
580
583
|
}
|
|
581
|
-
(q = (y = i(this,
|
|
582
|
-
|
|
584
|
+
(q = (y = i(this, A).config).onSuccess) == null || q.call(y, d, this), (c = (F = i(this, A).config).onSettled) == null || c.call(
|
|
585
|
+
F,
|
|
583
586
|
d,
|
|
584
587
|
this.state.error,
|
|
585
588
|
this
|
|
@@ -587,13 +590,13 @@ var C = ut(), B, Re, _e = (Re = class {
|
|
|
587
590
|
},
|
|
588
591
|
onError: a,
|
|
589
592
|
onFail: (d, y) => {
|
|
590
|
-
P(this,
|
|
593
|
+
P(this, R, x).call(this, { type: "failed", failureCount: d, error: y });
|
|
591
594
|
},
|
|
592
595
|
onPause: () => {
|
|
593
|
-
P(this,
|
|
596
|
+
P(this, R, x).call(this, { type: "pause" });
|
|
594
597
|
},
|
|
595
598
|
onContinue: () => {
|
|
596
|
-
P(this,
|
|
599
|
+
P(this, R, x).call(this, { type: "continue" });
|
|
597
600
|
},
|
|
598
601
|
retry: h.options.retry,
|
|
599
602
|
retryDelay: h.options.retryDelay,
|
|
@@ -601,7 +604,7 @@ var C = ut(), B, Re, _e = (Re = class {
|
|
|
601
604
|
canRun: () => !0
|
|
602
605
|
})), i(this, O).start();
|
|
603
606
|
}
|
|
604
|
-
},
|
|
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) {
|
|
605
608
|
const s = (r) => {
|
|
606
609
|
switch (e.type) {
|
|
607
610
|
case "failed":
|
|
@@ -623,7 +626,7 @@ var C = ut(), B, Re, _e = (Re = class {
|
|
|
623
626
|
case "fetch":
|
|
624
627
|
return {
|
|
625
628
|
...r,
|
|
626
|
-
...
|
|
629
|
+
...lt(r.data, this.options),
|
|
627
630
|
fetchMeta: e.meta ?? null
|
|
628
631
|
};
|
|
629
632
|
case "success":
|
|
@@ -643,7 +646,7 @@ var C = ut(), B, Re, _e = (Re = class {
|
|
|
643
646
|
};
|
|
644
647
|
case "error":
|
|
645
648
|
const n = e.error;
|
|
646
|
-
return
|
|
649
|
+
return Pe(n) && n.revert && i(this, re) ? { ...i(this, re), fetchStatus: "idle" } : {
|
|
647
650
|
...r,
|
|
648
651
|
error: n,
|
|
649
652
|
errorUpdateCount: r.errorUpdateCount + 1,
|
|
@@ -668,21 +671,21 @@ var C = ut(), B, Re, _e = (Re = class {
|
|
|
668
671
|
this.state = s(this.state), C.batch(() => {
|
|
669
672
|
this.observers.forEach((r) => {
|
|
670
673
|
r.onQueryUpdate();
|
|
671
|
-
}), i(this,
|
|
674
|
+
}), i(this, A).notify({ query: this, type: "updated", action: e });
|
|
672
675
|
});
|
|
673
|
-
},
|
|
674
|
-
function
|
|
676
|
+
}, ke);
|
|
677
|
+
function lt(t, e) {
|
|
675
678
|
return {
|
|
676
679
|
fetchFailureCount: 0,
|
|
677
680
|
fetchFailureReason: null,
|
|
678
|
-
fetchStatus:
|
|
681
|
+
fetchStatus: Ge(e.networkMode) ? "fetching" : "paused",
|
|
679
682
|
...t === void 0 && {
|
|
680
683
|
error: null,
|
|
681
684
|
status: "pending"
|
|
682
685
|
}
|
|
683
686
|
};
|
|
684
687
|
}
|
|
685
|
-
function
|
|
688
|
+
function dt(t) {
|
|
686
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;
|
|
687
690
|
return {
|
|
688
691
|
data: e,
|
|
@@ -699,17 +702,17 @@ function ct(t) {
|
|
|
699
702
|
fetchStatus: "idle"
|
|
700
703
|
};
|
|
701
704
|
}
|
|
702
|
-
var
|
|
705
|
+
var U, Ue, ft = (Ue = class extends ge {
|
|
703
706
|
constructor(e = {}) {
|
|
704
707
|
super();
|
|
705
|
-
l(this,
|
|
706
|
-
this.config = e, o(this,
|
|
708
|
+
l(this, U, void 0);
|
|
709
|
+
this.config = e, o(this, U, /* @__PURE__ */ new Map());
|
|
707
710
|
}
|
|
708
711
|
build(e, s, r) {
|
|
709
|
-
const n = s.queryKey, u = s.queryHash ??
|
|
712
|
+
const n = s.queryKey, u = s.queryHash ?? Se(n, s);
|
|
710
713
|
let h = this.get(u);
|
|
711
|
-
return h || (h = new
|
|
712
|
-
|
|
714
|
+
return h || (h = new ct({
|
|
715
|
+
client: e,
|
|
713
716
|
queryKey: n,
|
|
714
717
|
queryHash: u,
|
|
715
718
|
options: e.defaultQueryOptions(s),
|
|
@@ -718,14 +721,14 @@ var K, ke, lt = (ke = class extends me {
|
|
|
718
721
|
}), this.add(h)), h;
|
|
719
722
|
}
|
|
720
723
|
add(e) {
|
|
721
|
-
i(this,
|
|
724
|
+
i(this, U).has(e.queryHash) || (i(this, U).set(e.queryHash, e), this.notify({
|
|
722
725
|
type: "added",
|
|
723
726
|
query: e
|
|
724
727
|
}));
|
|
725
728
|
}
|
|
726
729
|
remove(e) {
|
|
727
|
-
const s = i(this,
|
|
728
|
-
s && (e.destroy(), s === e && i(this,
|
|
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 }));
|
|
729
732
|
}
|
|
730
733
|
clear() {
|
|
731
734
|
C.batch(() => {
|
|
@@ -735,20 +738,20 @@ var K, ke, lt = (ke = class extends me {
|
|
|
735
738
|
});
|
|
736
739
|
}
|
|
737
740
|
get(e) {
|
|
738
|
-
return i(this,
|
|
741
|
+
return i(this, U).get(e);
|
|
739
742
|
}
|
|
740
743
|
getAll() {
|
|
741
|
-
return [...i(this,
|
|
744
|
+
return [...i(this, U).values()];
|
|
742
745
|
}
|
|
743
746
|
find(e) {
|
|
744
747
|
const s = { exact: !0, ...e };
|
|
745
748
|
return this.getAll().find(
|
|
746
|
-
(r) =>
|
|
749
|
+
(r) => qe(s, r)
|
|
747
750
|
);
|
|
748
751
|
}
|
|
749
752
|
findAll(e = {}) {
|
|
750
753
|
const s = this.getAll();
|
|
751
|
-
return Object.keys(e).length > 0 ? s.filter((r) =>
|
|
754
|
+
return Object.keys(e).length > 0 ? s.filter((r) => qe(e, r)) : s;
|
|
752
755
|
}
|
|
753
756
|
notify(e) {
|
|
754
757
|
C.batch(() => {
|
|
@@ -771,14 +774,14 @@ var K, ke, lt = (ke = class extends me {
|
|
|
771
774
|
});
|
|
772
775
|
});
|
|
773
776
|
}
|
|
774
|
-
},
|
|
777
|
+
}, U = new WeakMap(), Ue), K, S, Y, I, L, Ke, yt = (Ke = class extends $e {
|
|
775
778
|
constructor(e) {
|
|
776
779
|
super();
|
|
777
780
|
l(this, I);
|
|
778
|
-
l(this,
|
|
779
|
-
l(this,
|
|
780
|
-
l(this,
|
|
781
|
-
this.mutationId = e.mutationId, o(this,
|
|
781
|
+
l(this, K, void 0);
|
|
782
|
+
l(this, S, void 0);
|
|
783
|
+
l(this, Y, void 0);
|
|
784
|
+
this.mutationId = e.mutationId, o(this, S, e.mutationCache), o(this, K, []), this.state = e.state || pt(), this.setOptions(e.options), this.scheduleGc();
|
|
782
785
|
}
|
|
783
786
|
setOptions(e) {
|
|
784
787
|
this.options = e, this.updateGcTime(this.options.gcTime);
|
|
@@ -787,111 +790,111 @@ var K, ke, lt = (ke = class extends me {
|
|
|
787
790
|
return this.options.meta;
|
|
788
791
|
}
|
|
789
792
|
addObserver(e) {
|
|
790
|
-
i(this,
|
|
793
|
+
i(this, K).includes(e) || (i(this, K).push(e), this.clearGcTimeout(), i(this, S).notify({
|
|
791
794
|
type: "observerAdded",
|
|
792
795
|
mutation: this,
|
|
793
796
|
observer: e
|
|
794
797
|
}));
|
|
795
798
|
}
|
|
796
799
|
removeObserver(e) {
|
|
797
|
-
o(this,
|
|
800
|
+
o(this, K, i(this, K).filter((s) => s !== e)), this.scheduleGc(), i(this, S).notify({
|
|
798
801
|
type: "observerRemoved",
|
|
799
802
|
mutation: this,
|
|
800
803
|
observer: e
|
|
801
804
|
});
|
|
802
805
|
}
|
|
803
806
|
optionalRemove() {
|
|
804
|
-
i(this,
|
|
807
|
+
i(this, K).length || (this.state.status === "pending" ? this.scheduleGc() : i(this, S).remove(this));
|
|
805
808
|
}
|
|
806
809
|
continue() {
|
|
807
810
|
var e;
|
|
808
|
-
return ((e = i(this,
|
|
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
|
|
809
812
|
this.execute(this.state.variables);
|
|
810
813
|
}
|
|
811
814
|
async execute(e) {
|
|
812
|
-
var n, u, h, a, f, w, m, d, y, q,
|
|
813
|
-
o(this,
|
|
815
|
+
var n, u, h, a, f, w, m, d, y, q, F, c, p, E, M, g, D, j, k, fe;
|
|
816
|
+
o(this, Y, Ve({
|
|
814
817
|
fn: () => this.options.mutationFn ? this.options.mutationFn(e) : Promise.reject(new Error("No mutationFn found")),
|
|
815
|
-
onFail: (
|
|
816
|
-
P(this, I,
|
|
818
|
+
onFail: (b, z) => {
|
|
819
|
+
P(this, I, L).call(this, { type: "failed", failureCount: b, error: z });
|
|
817
820
|
},
|
|
818
821
|
onPause: () => {
|
|
819
|
-
P(this, I,
|
|
822
|
+
P(this, I, L).call(this, { type: "pause" });
|
|
820
823
|
},
|
|
821
824
|
onContinue: () => {
|
|
822
|
-
P(this, I,
|
|
825
|
+
P(this, I, L).call(this, { type: "continue" });
|
|
823
826
|
},
|
|
824
827
|
retry: this.options.retry ?? 0,
|
|
825
828
|
retryDelay: this.options.retryDelay,
|
|
826
829
|
networkMode: this.options.networkMode,
|
|
827
|
-
canRun: () => i(this,
|
|
830
|
+
canRun: () => i(this, S).canRun(this)
|
|
828
831
|
}));
|
|
829
|
-
const s = this.state.status === "pending", r = !i(this,
|
|
832
|
+
const s = this.state.status === "pending", r = !i(this, Y).canStart();
|
|
830
833
|
try {
|
|
831
834
|
if (!s) {
|
|
832
|
-
P(this, I,
|
|
835
|
+
P(this, I, L).call(this, { type: "pending", variables: e, isPaused: r }), await ((u = (n = i(this, S).config).onMutate) == null ? void 0 : u.call(
|
|
833
836
|
n,
|
|
834
837
|
e,
|
|
835
838
|
this
|
|
836
839
|
));
|
|
837
|
-
const
|
|
838
|
-
|
|
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, {
|
|
839
842
|
type: "pending",
|
|
840
|
-
context:
|
|
843
|
+
context: z,
|
|
841
844
|
variables: e,
|
|
842
845
|
isPaused: r
|
|
843
846
|
});
|
|
844
847
|
}
|
|
845
|
-
const
|
|
846
|
-
return await ((w = (f = i(this,
|
|
848
|
+
const b = await i(this, Y).start();
|
|
849
|
+
return await ((w = (f = i(this, S).config).onSuccess) == null ? void 0 : w.call(
|
|
847
850
|
f,
|
|
848
|
-
|
|
851
|
+
b,
|
|
849
852
|
e,
|
|
850
853
|
this.state.context,
|
|
851
854
|
this
|
|
852
|
-
)), await ((d = (m = this.options).onSuccess) == null ? void 0 : d.call(m,
|
|
855
|
+
)), await ((d = (m = this.options).onSuccess) == null ? void 0 : d.call(m, b, e, this.state.context)), await ((q = (y = i(this, S).config).onSettled) == null ? void 0 : q.call(
|
|
853
856
|
y,
|
|
854
|
-
|
|
857
|
+
b,
|
|
855
858
|
null,
|
|
856
859
|
this.state.variables,
|
|
857
860
|
this.state.context,
|
|
858
861
|
this
|
|
859
|
-
)), await ((c = (
|
|
860
|
-
} catch (
|
|
862
|
+
)), await ((c = (F = this.options).onSettled) == null ? void 0 : c.call(F, b, null, e, this.state.context)), P(this, I, L).call(this, { type: "success", data: b }), b;
|
|
863
|
+
} catch (b) {
|
|
861
864
|
try {
|
|
862
|
-
throw await ((
|
|
865
|
+
throw await ((E = (p = i(this, S).config).onError) == null ? void 0 : E.call(
|
|
863
866
|
p,
|
|
864
|
-
|
|
867
|
+
b,
|
|
865
868
|
e,
|
|
866
869
|
this.state.context,
|
|
867
870
|
this
|
|
868
|
-
)), await ((
|
|
871
|
+
)), await ((g = (M = this.options).onError) == null ? void 0 : g.call(
|
|
869
872
|
M,
|
|
870
|
-
|
|
873
|
+
b,
|
|
871
874
|
e,
|
|
872
875
|
this.state.context
|
|
873
|
-
)), await ((
|
|
874
|
-
|
|
876
|
+
)), await ((j = (D = i(this, S).config).onSettled) == null ? void 0 : j.call(
|
|
877
|
+
D,
|
|
875
878
|
void 0,
|
|
876
|
-
|
|
879
|
+
b,
|
|
877
880
|
this.state.variables,
|
|
878
881
|
this.state.context,
|
|
879
882
|
this
|
|
880
|
-
)), await ((
|
|
881
|
-
|
|
883
|
+
)), await ((fe = (k = this.options).onSettled) == null ? void 0 : fe.call(
|
|
884
|
+
k,
|
|
882
885
|
void 0,
|
|
883
|
-
|
|
886
|
+
b,
|
|
884
887
|
e,
|
|
885
888
|
this.state.context
|
|
886
|
-
)),
|
|
889
|
+
)), b;
|
|
887
890
|
} finally {
|
|
888
|
-
P(this, I,
|
|
891
|
+
P(this, I, L).call(this, { type: "error", error: b });
|
|
889
892
|
}
|
|
890
893
|
} finally {
|
|
891
|
-
i(this,
|
|
894
|
+
i(this, S).runNext(this);
|
|
892
895
|
}
|
|
893
896
|
}
|
|
894
|
-
},
|
|
897
|
+
}, K = new WeakMap(), S = new WeakMap(), Y = new WeakMap(), I = new WeakSet(), L = function(e) {
|
|
895
898
|
const s = (r) => {
|
|
896
899
|
switch (e.type) {
|
|
897
900
|
case "failed":
|
|
@@ -946,16 +949,16 @@ var K, ke, lt = (ke = class extends me {
|
|
|
946
949
|
}
|
|
947
950
|
};
|
|
948
951
|
this.state = s(this.state), C.batch(() => {
|
|
949
|
-
i(this,
|
|
952
|
+
i(this, K).forEach((r) => {
|
|
950
953
|
r.onMutationUpdate(e);
|
|
951
|
-
}), i(this,
|
|
954
|
+
}), i(this, S).notify({
|
|
952
955
|
mutation: this,
|
|
953
956
|
type: "updated",
|
|
954
957
|
action: e
|
|
955
958
|
});
|
|
956
959
|
});
|
|
957
|
-
},
|
|
958
|
-
function
|
|
960
|
+
}, Ke);
|
|
961
|
+
function pt() {
|
|
959
962
|
return {
|
|
960
963
|
context: void 0,
|
|
961
964
|
data: void 0,
|
|
@@ -968,63 +971,84 @@ function ft() {
|
|
|
968
971
|
submittedAt: 0
|
|
969
972
|
};
|
|
970
973
|
}
|
|
971
|
-
var
|
|
974
|
+
var H, T, de, Ie, mt = (Ie = class extends ge {
|
|
972
975
|
constructor(e = {}) {
|
|
973
976
|
super();
|
|
974
|
-
l(this,
|
|
975
|
-
l(this,
|
|
976
|
-
|
|
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);
|
|
977
981
|
}
|
|
978
982
|
build(e, s, r) {
|
|
979
|
-
const n = new
|
|
983
|
+
const n = new yt({
|
|
980
984
|
mutationCache: this,
|
|
981
|
-
mutationId: ++
|
|
985
|
+
mutationId: ++ye(this, de)._,
|
|
982
986
|
options: e.defaultMutationOptions(s),
|
|
983
987
|
state: r
|
|
984
988
|
});
|
|
985
989
|
return this.add(n), n;
|
|
986
990
|
}
|
|
987
991
|
add(e) {
|
|
988
|
-
|
|
989
|
-
|
|
992
|
+
i(this, H).add(e);
|
|
993
|
+
const s = pe(e);
|
|
994
|
+
if (typeof s == "string") {
|
|
995
|
+
const r = i(this, T).get(s);
|
|
996
|
+
r ? r.push(e) : i(this, T).set(s, [e]);
|
|
997
|
+
}
|
|
998
|
+
this.notify({ type: "added", mutation: e });
|
|
990
999
|
}
|
|
991
1000
|
remove(e) {
|
|
992
|
-
|
|
993
|
-
|
|
994
|
-
|
|
995
|
-
|
|
996
|
-
|
|
1001
|
+
if (i(this, H).delete(e)) {
|
|
1002
|
+
const s = pe(e);
|
|
1003
|
+
if (typeof s == "string") {
|
|
1004
|
+
const r = i(this, T).get(s);
|
|
1005
|
+
if (r)
|
|
1006
|
+
if (r.length > 1) {
|
|
1007
|
+
const n = r.indexOf(e);
|
|
1008
|
+
n !== -1 && r.splice(n, 1);
|
|
1009
|
+
} else
|
|
1010
|
+
r[0] === e && i(this, T).delete(s);
|
|
1011
|
+
}
|
|
997
1012
|
}
|
|
998
1013
|
this.notify({ type: "removed", mutation: e });
|
|
999
1014
|
}
|
|
1000
1015
|
canRun(e) {
|
|
1001
|
-
|
|
1002
|
-
|
|
1003
|
-
|
|
1016
|
+
const s = pe(e);
|
|
1017
|
+
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"
|
|
1020
|
+
);
|
|
1021
|
+
return !n || n === e;
|
|
1022
|
+
} else
|
|
1023
|
+
return !0;
|
|
1004
1024
|
}
|
|
1005
1025
|
runNext(e) {
|
|
1006
1026
|
var r;
|
|
1007
|
-
const s = (
|
|
1008
|
-
|
|
1027
|
+
const s = pe(e);
|
|
1028
|
+
if (typeof s == "string") {
|
|
1029
|
+
const n = (r = i(this, T).get(s)) == null ? void 0 : r.find((u) => u !== e && u.state.isPaused);
|
|
1030
|
+
return (n == null ? void 0 : n.continue()) ?? Promise.resolve();
|
|
1031
|
+
} else
|
|
1032
|
+
return Promise.resolve();
|
|
1009
1033
|
}
|
|
1010
1034
|
clear() {
|
|
1011
1035
|
C.batch(() => {
|
|
1012
|
-
this
|
|
1013
|
-
this.
|
|
1014
|
-
});
|
|
1036
|
+
i(this, H).forEach((e) => {
|
|
1037
|
+
this.notify({ type: "removed", mutation: e });
|
|
1038
|
+
}), i(this, H).clear(), i(this, T).clear();
|
|
1015
1039
|
});
|
|
1016
1040
|
}
|
|
1017
1041
|
getAll() {
|
|
1018
|
-
return
|
|
1042
|
+
return Array.from(i(this, H));
|
|
1019
1043
|
}
|
|
1020
1044
|
find(e) {
|
|
1021
1045
|
const s = { exact: !0, ...e };
|
|
1022
1046
|
return this.getAll().find(
|
|
1023
|
-
(r) =>
|
|
1047
|
+
(r) => Ee(s, r)
|
|
1024
1048
|
);
|
|
1025
1049
|
}
|
|
1026
1050
|
findAll(e = {}) {
|
|
1027
|
-
return this.getAll().filter((s) =>
|
|
1051
|
+
return this.getAll().filter((s) => Ee(e, s));
|
|
1028
1052
|
}
|
|
1029
1053
|
notify(e) {
|
|
1030
1054
|
C.batch(() => {
|
|
@@ -1037,64 +1061,65 @@ var A, ce, Ke, yt = (Ke = class extends me {
|
|
|
1037
1061
|
const e = this.getAll().filter((s) => s.state.isPaused);
|
|
1038
1062
|
return C.batch(
|
|
1039
1063
|
() => Promise.all(
|
|
1040
|
-
e.map((s) => s.continue().catch(
|
|
1064
|
+
e.map((s) => s.continue().catch(Q))
|
|
1041
1065
|
)
|
|
1042
1066
|
);
|
|
1043
1067
|
}
|
|
1044
|
-
},
|
|
1045
|
-
function
|
|
1068
|
+
}, H = new WeakMap(), T = new WeakMap(), de = new WeakMap(), Ie);
|
|
1069
|
+
function pe(t) {
|
|
1046
1070
|
var e;
|
|
1047
|
-
return (
|
|
1071
|
+
return (e = t.options.scope) == null ? void 0 : e.id;
|
|
1048
1072
|
}
|
|
1049
|
-
function
|
|
1073
|
+
function Me(t) {
|
|
1050
1074
|
return {
|
|
1051
1075
|
onFetch: (e, s) => {
|
|
1052
|
-
var m, d, y, q,
|
|
1053
|
-
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 = ((
|
|
1076
|
+
var m, d, y, q, F;
|
|
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 = ((F = e.state.data) == null ? void 0 : F.pageParams) || [];
|
|
1054
1078
|
let a = { pages: [], pageParams: [] }, f = 0;
|
|
1055
1079
|
const w = async () => {
|
|
1056
1080
|
let c = !1;
|
|
1057
|
-
const p = (
|
|
1058
|
-
Object.defineProperty(
|
|
1081
|
+
const p = (g) => {
|
|
1082
|
+
Object.defineProperty(g, "signal", {
|
|
1059
1083
|
enumerable: !0,
|
|
1060
1084
|
get: () => (e.signal.aborted ? c = !0 : e.signal.addEventListener("abort", () => {
|
|
1061
1085
|
c = !0;
|
|
1062
1086
|
}), e.signal)
|
|
1063
1087
|
});
|
|
1064
|
-
},
|
|
1088
|
+
}, E = Le(e.options, e.fetchOptions), M = async (g, D, j) => {
|
|
1065
1089
|
if (c)
|
|
1066
1090
|
return Promise.reject();
|
|
1067
|
-
if (
|
|
1068
|
-
return Promise.resolve(
|
|
1069
|
-
const
|
|
1091
|
+
if (D == null && g.pages.length)
|
|
1092
|
+
return Promise.resolve(g);
|
|
1093
|
+
const k = {
|
|
1094
|
+
client: e.client,
|
|
1070
1095
|
queryKey: e.queryKey,
|
|
1071
|
-
pageParam:
|
|
1072
|
-
direction:
|
|
1096
|
+
pageParam: D,
|
|
1097
|
+
direction: j ? "backward" : "forward",
|
|
1073
1098
|
meta: e.options.meta
|
|
1074
1099
|
};
|
|
1075
|
-
p(
|
|
1076
|
-
const
|
|
1077
|
-
|
|
1078
|
-
), { maxPages:
|
|
1100
|
+
p(k);
|
|
1101
|
+
const fe = await E(
|
|
1102
|
+
k
|
|
1103
|
+
), { maxPages: b } = e.options, z = j ? it : rt;
|
|
1079
1104
|
return {
|
|
1080
|
-
pages:
|
|
1081
|
-
pageParams:
|
|
1105
|
+
pages: z(g.pages, fe, b),
|
|
1106
|
+
pageParams: z(g.pageParams, D, b)
|
|
1082
1107
|
};
|
|
1083
1108
|
};
|
|
1084
1109
|
if (n && u.length) {
|
|
1085
|
-
const
|
|
1110
|
+
const g = n === "backward", D = g ? vt : Qe, j = {
|
|
1086
1111
|
pages: u,
|
|
1087
1112
|
pageParams: h
|
|
1088
|
-
},
|
|
1089
|
-
a = await M(
|
|
1113
|
+
}, k = D(r, j);
|
|
1114
|
+
a = await M(j, k, g);
|
|
1090
1115
|
} else {
|
|
1091
|
-
const
|
|
1116
|
+
const g = t ?? u.length;
|
|
1092
1117
|
do {
|
|
1093
|
-
const
|
|
1094
|
-
if (f > 0 &&
|
|
1118
|
+
const D = f === 0 ? h[0] ?? r.initialPageParam : Qe(r, a);
|
|
1119
|
+
if (f > 0 && D == null)
|
|
1095
1120
|
break;
|
|
1096
|
-
a = await M(a,
|
|
1097
|
-
} while (f <
|
|
1121
|
+
a = await M(a, D), f++;
|
|
1122
|
+
} while (f < g);
|
|
1098
1123
|
}
|
|
1099
1124
|
return a;
|
|
1100
1125
|
};
|
|
@@ -1104,6 +1129,7 @@ function Ee(t) {
|
|
|
1104
1129
|
c,
|
|
1105
1130
|
w,
|
|
1106
1131
|
{
|
|
1132
|
+
client: e.client,
|
|
1107
1133
|
queryKey: e.queryKey,
|
|
1108
1134
|
meta: e.options.meta,
|
|
1109
1135
|
signal: e.signal
|
|
@@ -1114,7 +1140,7 @@ function Ee(t) {
|
|
|
1114
1140
|
}
|
|
1115
1141
|
};
|
|
1116
1142
|
}
|
|
1117
|
-
function
|
|
1143
|
+
function Qe(t, { pages: e, pageParams: s }) {
|
|
1118
1144
|
const r = e.length - 1;
|
|
1119
1145
|
return e.length > 0 ? t.getNextPageParam(
|
|
1120
1146
|
e[r],
|
|
@@ -1123,38 +1149,38 @@ function Ae(t, { pages: e, pageParams: s }) {
|
|
|
1123
1149
|
s
|
|
1124
1150
|
) : void 0;
|
|
1125
1151
|
}
|
|
1126
|
-
function
|
|
1152
|
+
function vt(t, { pages: e, pageParams: s }) {
|
|
1127
1153
|
var r;
|
|
1128
1154
|
return e.length > 0 ? (r = t.getPreviousPageParam) == null ? void 0 : r.call(t, e[0], e, s[0], s) : void 0;
|
|
1129
1155
|
}
|
|
1130
|
-
var v,
|
|
1156
|
+
var v, _, V, ie, ne, $, ae, ue, xe, gt = (xe = class {
|
|
1131
1157
|
constructor(t = {}) {
|
|
1132
1158
|
l(this, v, void 0);
|
|
1133
|
-
l(this, G, void 0);
|
|
1134
1159
|
l(this, _, void 0);
|
|
1135
|
-
l(this, se, void 0);
|
|
1136
|
-
l(this, re, void 0);
|
|
1137
1160
|
l(this, V, void 0);
|
|
1138
1161
|
l(this, ie, void 0);
|
|
1139
1162
|
l(this, ne, void 0);
|
|
1140
|
-
|
|
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);
|
|
1141
1167
|
}
|
|
1142
1168
|
mount() {
|
|
1143
|
-
|
|
1169
|
+
ye(this, $)._++, i(this, $) === 1 && (o(this, ae, Ne.subscribe(async (t) => {
|
|
1144
1170
|
t && (await this.resumePausedMutations(), i(this, v).onFocus());
|
|
1145
|
-
})), o(this,
|
|
1171
|
+
})), o(this, ue, ve.subscribe(async (t) => {
|
|
1146
1172
|
t && (await this.resumePausedMutations(), i(this, v).onOnline());
|
|
1147
1173
|
})));
|
|
1148
1174
|
}
|
|
1149
1175
|
unmount() {
|
|
1150
1176
|
var t, e;
|
|
1151
|
-
|
|
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));
|
|
1152
1178
|
}
|
|
1153
1179
|
isFetching(t) {
|
|
1154
1180
|
return i(this, v).findAll({ ...t, fetchStatus: "fetching" }).length;
|
|
1155
1181
|
}
|
|
1156
1182
|
isMutating(t) {
|
|
1157
|
-
return i(this,
|
|
1183
|
+
return i(this, _).findAll({ ...t, status: "pending" }).length;
|
|
1158
1184
|
}
|
|
1159
1185
|
getQueryData(t) {
|
|
1160
1186
|
var s;
|
|
@@ -1162,13 +1188,8 @@ var v, G, _, se, re, V, ie, ne, Ue, mt = (Ue = class {
|
|
|
1162
1188
|
return (s = i(this, v).get(e.queryHash)) == null ? void 0 : s.state.data;
|
|
1163
1189
|
}
|
|
1164
1190
|
ensureQueryData(t) {
|
|
1165
|
-
const e = this.
|
|
1166
|
-
|
|
1167
|
-
return this.fetchQuery(t);
|
|
1168
|
-
{
|
|
1169
|
-
const s = this.defaultQueryOptions(t), r = i(this, v).build(this, s);
|
|
1170
|
-
return t.revalidateIfStale && r.isStaleByTime(Se(s.staleTime, r)) && this.prefetchQuery(s), Promise.resolve(e);
|
|
1171
|
-
}
|
|
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));
|
|
1172
1193
|
}
|
|
1173
1194
|
getQueriesData(t) {
|
|
1174
1195
|
return i(this, v).findAll(t).map(({ queryKey: e, state: s }) => {
|
|
@@ -1179,7 +1200,7 @@ var v, G, _, se, re, V, ie, ne, Ue, mt = (Ue = class {
|
|
|
1179
1200
|
setQueryData(t, e, s) {
|
|
1180
1201
|
const r = this.defaultQueryOptions({ queryKey: t }), n = i(this, v).get(
|
|
1181
1202
|
r.queryHash
|
|
1182
|
-
), u = n == null ? void 0 : n.state.data, h =
|
|
1203
|
+
), u = n == null ? void 0 : n.state.data, h = Xe(e, u);
|
|
1183
1204
|
if (h !== void 0)
|
|
1184
1205
|
return i(this, v).build(this, r).setData(h, { ...s, manual: !0 });
|
|
1185
1206
|
}
|
|
@@ -1194,7 +1215,9 @@ var v, G, _, se, re, V, ie, ne, Ue, mt = (Ue = class {
|
|
|
1194
1215
|
getQueryState(t) {
|
|
1195
1216
|
var s;
|
|
1196
1217
|
const e = this.defaultQueryOptions({ queryKey: t });
|
|
1197
|
-
return (s = i(this, v).get(
|
|
1218
|
+
return (s = i(this, v).get(
|
|
1219
|
+
e.queryHash
|
|
1220
|
+
)) == null ? void 0 : s.state;
|
|
1198
1221
|
}
|
|
1199
1222
|
removeQueries(t) {
|
|
1200
1223
|
const e = i(this, v);
|
|
@@ -1213,135 +1236,134 @@ var v, G, _, se, re, V, ie, ne, Ue, mt = (Ue = class {
|
|
|
1213
1236
|
n.reset();
|
|
1214
1237
|
}), this.refetchQueries(r, e)));
|
|
1215
1238
|
}
|
|
1216
|
-
cancelQueries(t
|
|
1239
|
+
cancelQueries(t, e = {}) {
|
|
1217
1240
|
const s = { revert: !0, ...e }, r = C.batch(
|
|
1218
1241
|
() => i(this, v).findAll(t).map((n) => n.cancel(s))
|
|
1219
1242
|
);
|
|
1220
|
-
return Promise.all(r).then(
|
|
1243
|
+
return Promise.all(r).then(Q).catch(Q);
|
|
1221
1244
|
}
|
|
1222
|
-
invalidateQueries(t
|
|
1245
|
+
invalidateQueries(t, e = {}) {
|
|
1223
1246
|
return C.batch(() => {
|
|
1224
1247
|
if (i(this, v).findAll(t).forEach((r) => {
|
|
1225
1248
|
r.invalidate();
|
|
1226
|
-
}), t.refetchType === "none")
|
|
1249
|
+
}), (t == null ? void 0 : t.refetchType) === "none")
|
|
1227
1250
|
return Promise.resolve();
|
|
1228
1251
|
const s = {
|
|
1229
1252
|
...t,
|
|
1230
|
-
type: t.refetchType ?? t.type ?? "active"
|
|
1253
|
+
type: (t == null ? void 0 : t.refetchType) ?? (t == null ? void 0 : t.type) ?? "active"
|
|
1231
1254
|
};
|
|
1232
1255
|
return this.refetchQueries(s, e);
|
|
1233
1256
|
});
|
|
1234
1257
|
}
|
|
1235
|
-
refetchQueries(t = {}
|
|
1258
|
+
refetchQueries(t, e = {}) {
|
|
1236
1259
|
const s = {
|
|
1237
1260
|
...e,
|
|
1238
|
-
cancelRefetch:
|
|
1261
|
+
cancelRefetch: e.cancelRefetch ?? !0
|
|
1239
1262
|
}, r = C.batch(
|
|
1240
1263
|
() => i(this, v).findAll(t).filter((n) => !n.isDisabled()).map((n) => {
|
|
1241
1264
|
let u = n.fetch(void 0, s);
|
|
1242
|
-
return s.throwOnError || (u = u.catch(
|
|
1265
|
+
return s.throwOnError || (u = u.catch(Q)), n.state.fetchStatus === "paused" ? Promise.resolve() : u;
|
|
1243
1266
|
})
|
|
1244
1267
|
);
|
|
1245
|
-
return Promise.all(r).then(
|
|
1268
|
+
return Promise.all(r).then(Q);
|
|
1246
1269
|
}
|
|
1247
1270
|
fetchQuery(t) {
|
|
1248
1271
|
const e = this.defaultQueryOptions(t);
|
|
1249
1272
|
e.retry === void 0 && (e.retry = !1);
|
|
1250
1273
|
const s = i(this, v).build(this, e);
|
|
1251
1274
|
return s.isStaleByTime(
|
|
1252
|
-
|
|
1275
|
+
Ce(e.staleTime, s)
|
|
1253
1276
|
) ? s.fetch(e) : Promise.resolve(s.state.data);
|
|
1254
1277
|
}
|
|
1255
1278
|
prefetchQuery(t) {
|
|
1256
|
-
return this.fetchQuery(t).then(
|
|
1279
|
+
return this.fetchQuery(t).then(Q).catch(Q);
|
|
1257
1280
|
}
|
|
1258
1281
|
fetchInfiniteQuery(t) {
|
|
1259
|
-
return t.behavior =
|
|
1282
|
+
return t.behavior = Me(t.pages), this.fetchQuery(t);
|
|
1260
1283
|
}
|
|
1261
1284
|
prefetchInfiniteQuery(t) {
|
|
1262
|
-
return this.fetchInfiniteQuery(t).then(
|
|
1285
|
+
return this.fetchInfiniteQuery(t).then(Q).catch(Q);
|
|
1263
1286
|
}
|
|
1264
1287
|
ensureInfiniteQueryData(t) {
|
|
1265
|
-
return t.behavior =
|
|
1288
|
+
return t.behavior = Me(t.pages), this.ensureQueryData(t);
|
|
1266
1289
|
}
|
|
1267
1290
|
resumePausedMutations() {
|
|
1268
|
-
return
|
|
1291
|
+
return ve.isOnline() ? i(this, _).resumePausedMutations() : Promise.resolve();
|
|
1269
1292
|
}
|
|
1270
1293
|
getQueryCache() {
|
|
1271
1294
|
return i(this, v);
|
|
1272
1295
|
}
|
|
1273
1296
|
getMutationCache() {
|
|
1274
|
-
return i(this,
|
|
1297
|
+
return i(this, _);
|
|
1275
1298
|
}
|
|
1276
1299
|
getDefaultOptions() {
|
|
1277
|
-
return i(this,
|
|
1300
|
+
return i(this, V);
|
|
1278
1301
|
}
|
|
1279
1302
|
setDefaultOptions(t) {
|
|
1280
|
-
o(this,
|
|
1303
|
+
o(this, V, t);
|
|
1281
1304
|
}
|
|
1282
1305
|
setQueryDefaults(t, e) {
|
|
1283
|
-
i(this,
|
|
1306
|
+
i(this, ie).set(he(t), {
|
|
1284
1307
|
queryKey: t,
|
|
1285
1308
|
defaultOptions: e
|
|
1286
1309
|
});
|
|
1287
1310
|
}
|
|
1288
1311
|
getQueryDefaults(t) {
|
|
1289
|
-
const e = [...i(this,
|
|
1290
|
-
let s = {};
|
|
1312
|
+
const e = [...i(this, ie).values()], s = {};
|
|
1291
1313
|
return e.forEach((r) => {
|
|
1292
|
-
|
|
1314
|
+
ce(t, r.queryKey) && Object.assign(s, r.defaultOptions);
|
|
1293
1315
|
}), s;
|
|
1294
1316
|
}
|
|
1295
1317
|
setMutationDefaults(t, e) {
|
|
1296
|
-
i(this,
|
|
1318
|
+
i(this, ne).set(he(t), {
|
|
1297
1319
|
mutationKey: t,
|
|
1298
1320
|
defaultOptions: e
|
|
1299
1321
|
});
|
|
1300
1322
|
}
|
|
1301
1323
|
getMutationDefaults(t) {
|
|
1302
|
-
const e = [...i(this,
|
|
1324
|
+
const e = [...i(this, ne).values()];
|
|
1303
1325
|
let s = {};
|
|
1304
1326
|
return e.forEach((r) => {
|
|
1305
|
-
|
|
1327
|
+
ce(t, r.mutationKey) && (s = { ...s, ...r.defaultOptions });
|
|
1306
1328
|
}), s;
|
|
1307
1329
|
}
|
|
1308
1330
|
defaultQueryOptions(t) {
|
|
1309
1331
|
if (t._defaulted)
|
|
1310
1332
|
return t;
|
|
1311
1333
|
const e = {
|
|
1312
|
-
...i(this,
|
|
1334
|
+
...i(this, V).queries,
|
|
1313
1335
|
...this.getQueryDefaults(t.queryKey),
|
|
1314
1336
|
...t,
|
|
1315
1337
|
_defaulted: !0
|
|
1316
1338
|
};
|
|
1317
|
-
return e.queryHash || (e.queryHash =
|
|
1339
|
+
return e.queryHash || (e.queryHash = Se(
|
|
1318
1340
|
e.queryKey,
|
|
1319
1341
|
e
|
|
1320
|
-
)), 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.
|
|
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;
|
|
1321
1343
|
}
|
|
1322
1344
|
defaultMutationOptions(t) {
|
|
1323
1345
|
return t != null && t._defaulted ? t : {
|
|
1324
|
-
...i(this,
|
|
1346
|
+
...i(this, V).mutations,
|
|
1325
1347
|
...(t == null ? void 0 : t.mutationKey) && this.getMutationDefaults(t.mutationKey),
|
|
1326
1348
|
...t,
|
|
1327
1349
|
_defaulted: !0
|
|
1328
1350
|
};
|
|
1329
1351
|
}
|
|
1330
1352
|
clear() {
|
|
1331
|
-
i(this, v).clear(), i(this,
|
|
1353
|
+
i(this, v).clear(), i(this, _).clear();
|
|
1332
1354
|
}
|
|
1333
|
-
}, v = new WeakMap(),
|
|
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(
|
|
1334
1356
|
void 0
|
|
1335
|
-
),
|
|
1357
|
+
), wt = ({
|
|
1336
1358
|
client: t,
|
|
1337
1359
|
children: e
|
|
1338
|
-
}) => (
|
|
1360
|
+
}) => (He.useEffect(() => (t.mount(), () => {
|
|
1339
1361
|
t.unmount();
|
|
1340
|
-
}), [t]), /* @__PURE__ */
|
|
1341
|
-
const
|
|
1342
|
-
const { children: e, customVariables: s, customDarkVariables: r, workerUrl: n, licenseKey: u, ...h } = t, { workerUrlAdded: a } =
|
|
1343
|
-
return /* @__PURE__ */
|
|
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 }) }) }) });
|
|
1344
1366
|
};
|
|
1345
1367
|
export {
|
|
1346
|
-
|
|
1368
|
+
Dt as RPConfig
|
|
1347
1369
|
};
|