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