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