@camstack/addon-tailscale-client 0.1.12 → 0.1.13

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (42) hide show
  1. package/assets/icon.svg +1 -0
  2. package/dist/tailscale.addon.js +14388 -84
  3. package/dist/tailscale.addon.js.map +1 -1
  4. package/dist/tailscale.addon.mjs +14384 -81
  5. package/dist/tailscale.addon.mjs.map +1 -1
  6. package/package.json +7 -32
  7. package/dist/@mf-types/compiled-types/page/TailscaleClientOverviewPage.d.ts +0 -20
  8. package/dist/@mf-types/compiled-types/page/TailscaleClientOverviewPage.d.ts.map +0 -1
  9. package/dist/@mf-types/compiled-types/page/page.d.ts +0 -8
  10. package/dist/@mf-types/compiled-types/page/page.d.ts.map +0 -1
  11. package/dist/@mf-types/page.d.ts +0 -2
  12. package/dist/@mf-types.d.ts +0 -3
  13. package/dist/@mf-types.zip +0 -0
  14. package/dist/__mfe_internal__addon_tailscale_client_page__loadShare___mf_0_camstack_mf_1_sdk__loadShare__.mjs-bYM9BuS1.mjs +0 -12
  15. package/dist/__mfe_internal__addon_tailscale_client_page__loadShare___mf_0_camstack_mf_1_types__loadShare__.mjs-CtHD1dC0.mjs +0 -12
  16. package/dist/__mfe_internal__addon_tailscale_client_page__loadShare___mf_0_camstack_mf_1_ui_mf_2_library__loadShare__.mjs-fz-lQtUx.mjs +0 -12
  17. package/dist/__mfe_internal__addon_tailscale_client_page__loadShare___mf_0_tanstack_mf_1_react_mf_2_query__loadShare__.mjs-B-3nffMn.mjs +0 -73
  18. package/dist/__mfe_internal__addon_tailscale_client_page__loadShare___mf_0_trpc_mf_1_client__loadShare__.mjs-6CvhJC3f.mjs +0 -42
  19. package/dist/__mfe_internal__addon_tailscale_client_page__loadShare___mf_0_trpc_mf_1_react_mf_2_query__loadShare__.mjs-Sv3rXvki.mjs +0 -46
  20. package/dist/__mfe_internal__addon_tailscale_client_page__loadShare__react__loadShare__.mjs-BBqTAV2L.mjs +0 -56
  21. package/dist/__mfe_internal__addon_tailscale_client_page__loadShare__react_mf_1_jsx_mf_2_runtime__loadShare__.mjs-BK8BTUon.mjs +0 -18
  22. package/dist/__mfe_internal__addon_tailscale_client_page__loadShare__react_mf_2_dom__loadShare__.mjs-B6pR25zU.mjs +0 -28
  23. package/dist/__mfe_internal__addon_tailscale_client_page__loadShare__react_mf_2_dom_mf_1_client__loadShare__.mjs-kyoamNQ7.mjs +0 -18
  24. package/dist/_stub.js +0 -652
  25. package/dist/_virtual_mf-localSharedImportMap___mfe_internal__addon_tailscale_client_page-PXP_-hRW.mjs +0 -156
  26. package/dist/addon-tailscale-client.css +0 -3
  27. package/dist/client-1J4MstR_.mjs +0 -7592
  28. package/dist/dist-C168hexw.mjs +0 -17192
  29. package/dist/dist-CPnIfsyh.mjs +0 -2229
  30. package/dist/dist-CmoRvaEc.mjs +0 -2483
  31. package/dist/dist-CwyDJZhZ.mjs +0 -16329
  32. package/dist/dist-DNrrMIdr.mjs +0 -662
  33. package/dist/dist-i1I4ldIE.mjs +0 -1260
  34. package/dist/getErrorShape-BPSzUA7W-C2H3tqHP.mjs +0 -189
  35. package/dist/hostInit-KpnzzkeJ.mjs +0 -144
  36. package/dist/jsx-runtime-BmcMHbj3.mjs +0 -22
  37. package/dist/modern-CWdms43F.mjs +0 -2184
  38. package/dist/react-BXkW-3WQ.mjs +0 -293
  39. package/dist/react-dom-BcGsvCWU.mjs +0 -131
  40. package/dist/remoteEntry.js +0 -83
  41. package/dist/rolldown-runtime-DC4cgjXG.mjs +0 -20
  42. package/dist/virtualExposes-wANYNTM2.mjs +0 -27
@@ -1,2184 +0,0 @@
1
- import { a as e, d as t, f as n, h as r, i, l as a, o, t as s, u as c } from "./__mfe_internal__addon_tailscale_client_page__loadShare__react__loadShare__.mjs-BBqTAV2L.mjs";
2
- import { n as l } from "./__mfe_internal__addon_tailscale_client_page__loadShare__react_mf_1_jsx_mf_2_runtime__loadShare__.mjs-BK8BTUon.mjs";
3
- //#region ../../node_modules/@tanstack/query-core/build/modern/subscribable.js
4
- var u = class {
5
- constructor() {
6
- this.listeners = /* @__PURE__ */ new Set(), this.subscribe = this.subscribe.bind(this);
7
- }
8
- subscribe(e) {
9
- return this.listeners.add(e), this.onSubscribe(), () => {
10
- this.listeners.delete(e), this.onUnsubscribe();
11
- };
12
- }
13
- hasListeners() {
14
- return this.listeners.size > 0;
15
- }
16
- onSubscribe() {}
17
- onUnsubscribe() {}
18
- }, d = new class extends u {
19
- #e;
20
- #t;
21
- #n;
22
- constructor() {
23
- super(), this.#n = (e) => {
24
- if (typeof window < "u" && window.addEventListener) {
25
- let t = () => e();
26
- return window.addEventListener("visibilitychange", t, !1), () => {
27
- window.removeEventListener("visibilitychange", t);
28
- };
29
- }
30
- };
31
- }
32
- onSubscribe() {
33
- this.#t || this.setEventListener(this.#n);
34
- }
35
- onUnsubscribe() {
36
- this.hasListeners() || (this.#t?.(), this.#t = void 0);
37
- }
38
- setEventListener(e) {
39
- this.#n = e, this.#t?.(), this.#t = e((e) => {
40
- typeof e == "boolean" ? this.setFocused(e) : this.onFocus();
41
- });
42
- }
43
- setFocused(e) {
44
- this.#e !== e && (this.#e = e, this.onFocus());
45
- }
46
- onFocus() {
47
- let e = this.isFocused();
48
- this.listeners.forEach((t) => {
49
- t(e);
50
- });
51
- }
52
- isFocused() {
53
- return typeof this.#e == "boolean" ? this.#e : globalThis.document?.visibilityState !== "hidden";
54
- }
55
- }(), f = {
56
- setTimeout: (e, t) => setTimeout(e, t),
57
- clearTimeout: (e) => clearTimeout(e),
58
- setInterval: (e, t) => setInterval(e, t),
59
- clearInterval: (e) => clearInterval(e)
60
- }, p = new class {
61
- #e = f;
62
- setTimeoutProvider(e) {
63
- this.#e = e;
64
- }
65
- setTimeout(e, t) {
66
- return this.#e.setTimeout(e, t);
67
- }
68
- clearTimeout(e) {
69
- this.#e.clearTimeout(e);
70
- }
71
- setInterval(e, t) {
72
- return this.#e.setInterval(e, t);
73
- }
74
- clearInterval(e) {
75
- this.#e.clearInterval(e);
76
- }
77
- }();
78
- function m(e) {
79
- setTimeout(e, 0);
80
- }
81
- //#endregion
82
- //#region ../../node_modules/@tanstack/query-core/build/modern/utils.js
83
- var h = typeof window > "u" || "Deno" in globalThis;
84
- function g() {}
85
- function _(e, t) {
86
- return typeof e == "function" ? e(t) : e;
87
- }
88
- function v(e) {
89
- return typeof e == "number" && e >= 0 && e !== Infinity;
90
- }
91
- function y(e, t) {
92
- return Math.max(e + (t || 0) - Date.now(), 0);
93
- }
94
- function b(e, t) {
95
- return typeof e == "function" ? e(t) : e;
96
- }
97
- function x(e, t) {
98
- return typeof e == "function" ? e(t) : e;
99
- }
100
- function S(e, t) {
101
- let { type: n = "all", exact: r, fetchStatus: i, predicate: a, queryKey: o, stale: s } = e;
102
- if (o) {
103
- if (r) {
104
- if (t.queryHash !== w(o, t.options)) return !1;
105
- } else if (!E(t.queryKey, o)) return !1;
106
- }
107
- if (n !== "all") {
108
- let e = t.isActive();
109
- if (n === "active" && !e || n === "inactive" && e) return !1;
110
- }
111
- return !(typeof s == "boolean" && t.isStale() !== s || i && i !== t.state.fetchStatus || a && !a(t));
112
- }
113
- function C(e, t) {
114
- let { exact: n, status: r, predicate: i, mutationKey: a } = e;
115
- if (a) {
116
- if (!t.options.mutationKey) return !1;
117
- if (n) {
118
- if (T(t.options.mutationKey) !== T(a)) return !1;
119
- } else if (!E(t.options.mutationKey, a)) return !1;
120
- }
121
- return !(r && t.state.status !== r || i && !i(t));
122
- }
123
- function w(e, t) {
124
- return (t?.queryKeyHashFn || T)(e);
125
- }
126
- function T(e) {
127
- return JSON.stringify(e, (e, t) => k(t) ? Object.keys(t).sort().reduce((e, n) => (e[n] = t[n], e), {}) : t);
128
- }
129
- function E(e, t) {
130
- return e === t ? !0 : typeof e == typeof t && e && t && typeof e == "object" && typeof t == "object" ? Object.keys(t).every((n) => E(e[n], t[n])) : !1;
131
- }
132
- var ee = Object.prototype.hasOwnProperty;
133
- function D(e, t, n = 0) {
134
- if (e === t) return e;
135
- if (n > 500) return t;
136
- let r = te(e) && te(t);
137
- if (!r && !(k(e) && k(t))) return t;
138
- let i = (r ? e : Object.keys(e)).length, a = r ? t : Object.keys(t), o = a.length, s = r ? Array(o) : {}, c = 0;
139
- for (let l = 0; l < o; l++) {
140
- let o = r ? l : a[l], u = e[o], d = t[o];
141
- if (u === d) {
142
- s[o] = u, (r ? l < i : ee.call(e, o)) && c++;
143
- continue;
144
- }
145
- if (u === null || d === null || typeof u != "object" || typeof d != "object") {
146
- s[o] = d;
147
- continue;
148
- }
149
- let f = D(u, d, n + 1);
150
- s[o] = f, f === u && c++;
151
- }
152
- return i === o && c === i ? e : s;
153
- }
154
- function O(e, t) {
155
- if (!t || Object.keys(e).length !== Object.keys(t).length) return !1;
156
- for (let n in e) if (e[n] !== t[n]) return !1;
157
- return !0;
158
- }
159
- function te(e) {
160
- return Array.isArray(e) && e.length === Object.keys(e).length;
161
- }
162
- function k(e) {
163
- if (!ne(e)) return !1;
164
- let t = e.constructor;
165
- if (t === void 0) return !0;
166
- let n = t.prototype;
167
- return !(!ne(n) || !n.hasOwnProperty("isPrototypeOf") || Object.getPrototypeOf(e) !== Object.prototype);
168
- }
169
- function ne(e) {
170
- return Object.prototype.toString.call(e) === "[object Object]";
171
- }
172
- function re(e) {
173
- return new Promise((t) => {
174
- p.setTimeout(t, e);
175
- });
176
- }
177
- function A(e, t, n) {
178
- return typeof n.structuralSharing == "function" ? n.structuralSharing(e, t) : n.structuralSharing === !1 ? t : D(e, t);
179
- }
180
- function ie(e) {
181
- return e;
182
- }
183
- function ae(e, t, n = 0) {
184
- let r = [...e, t];
185
- return n && r.length > n ? r.slice(1) : r;
186
- }
187
- function oe(e, t, n = 0) {
188
- let r = [t, ...e];
189
- return n && r.length > n ? r.slice(0, -1) : r;
190
- }
191
- var j = /* @__PURE__ */ Symbol();
192
- function se(e, t) {
193
- return !e.queryFn && t?.initialPromise ? () => t.initialPromise : !e.queryFn || e.queryFn === j ? () => Promise.reject(/* @__PURE__ */ Error(`Missing queryFn: '${e.queryHash}'`)) : e.queryFn;
194
- }
195
- function M(e, t) {
196
- return typeof e == "function" ? e(...t) : !!e;
197
- }
198
- function ce(e, t, n) {
199
- let r = !1, i;
200
- return Object.defineProperty(e, "signal", {
201
- enumerable: !0,
202
- get: () => (i ??= t(), r ? i : (r = !0, i.aborted ? n() : i.addEventListener("abort", n, { once: !0 }), i))
203
- }), e;
204
- }
205
- //#endregion
206
- //#region ../../node_modules/@tanstack/query-core/build/modern/environmentManager.js
207
- var N = /* @__PURE__ */ (() => {
208
- let e = () => h;
209
- return {
210
- isServer() {
211
- return e();
212
- },
213
- setIsServer(t) {
214
- e = t;
215
- }
216
- };
217
- })();
218
- //#endregion
219
- //#region ../../node_modules/@tanstack/query-core/build/modern/thenable.js
220
- function P() {
221
- let e, t, n = new Promise((n, r) => {
222
- e = n, t = r;
223
- });
224
- n.status = "pending", n.catch(() => {});
225
- function r(e) {
226
- Object.assign(n, e), delete n.resolve, delete n.reject;
227
- }
228
- return n.resolve = (t) => {
229
- r({
230
- status: "fulfilled",
231
- value: t
232
- }), e(t);
233
- }, n.reject = (e) => {
234
- r({
235
- status: "rejected",
236
- reason: e
237
- }), t(e);
238
- }, n;
239
- }
240
- function le(e) {
241
- let t;
242
- if (e.then((e) => (t = e, e), g)?.catch(g), t !== void 0) return { data: t };
243
- }
244
- //#endregion
245
- //#region ../../node_modules/@tanstack/query-core/build/modern/hydration.js
246
- function ue(e) {
247
- return e;
248
- }
249
- function de(e) {
250
- return {
251
- mutationKey: e.options.mutationKey,
252
- state: e.state,
253
- ...e.options.scope && { scope: e.options.scope },
254
- ...e.meta && { meta: e.meta }
255
- };
256
- }
257
- function fe(e, t, n) {
258
- let r = () => {
259
- let r = e.promise?.then(t).catch((e) => n(e) ? Promise.reject(/* @__PURE__ */ Error("redacted")) : Promise.reject(e));
260
- return r?.catch(g), r;
261
- };
262
- return {
263
- dehydratedAt: Date.now(),
264
- state: {
265
- ...e.state,
266
- ...e.state.data !== void 0 && { data: t(e.state.data) }
267
- },
268
- queryKey: e.queryKey,
269
- queryHash: e.queryHash,
270
- ...e.state.status === "pending" && { promise: r() },
271
- ...e.meta && { meta: e.meta },
272
- ...e.queryType && { queryType: e.queryType }
273
- };
274
- }
275
- function pe(e) {
276
- return e.state.isPaused;
277
- }
278
- function me(e) {
279
- return e.state.status === "success";
280
- }
281
- function he(e) {
282
- return !0;
283
- }
284
- function ge(e, t = {}) {
285
- let n = t.shouldDehydrateMutation ?? e.getDefaultOptions().dehydrate?.shouldDehydrateMutation ?? pe, r = e.getMutationCache().getAll().flatMap((e) => n(e) ? [de(e)] : []), i = t.shouldDehydrateQuery ?? e.getDefaultOptions().dehydrate?.shouldDehydrateQuery ?? me, a = t.shouldRedactErrors ?? e.getDefaultOptions().dehydrate?.shouldRedactErrors ?? he, o = t.serializeData ?? e.getDefaultOptions().dehydrate?.serializeData ?? ue;
286
- return {
287
- mutations: r,
288
- queries: e.getQueryCache().getAll().flatMap((e) => i(e) ? [fe(e, o, a)] : [])
289
- };
290
- }
291
- function F(e, t, n) {
292
- if (typeof t != "object" || !t) return;
293
- let r = e.getMutationCache(), i = e.getQueryCache(), a = n?.defaultOptions?.deserializeData ?? e.getDefaultOptions().hydrate?.deserializeData ?? ue, o = t.mutations || [], s = t.queries || [];
294
- o.forEach(({ state: t, ...i }) => {
295
- r.build(e, {
296
- ...e.getDefaultOptions().hydrate?.mutations,
297
- ...n?.defaultOptions?.mutations,
298
- ...i
299
- }, t);
300
- }), s.forEach(({ queryKey: t, state: r, queryHash: o, meta: s, promise: c, dehydratedAt: l, queryType: u }) => {
301
- let d = c ? le(c) : void 0, f = r.data === void 0 ? d?.data : r.data, p = f === void 0 ? f : a(f), m = i.get(o), h = m?.state.status === "pending", _ = m?.state.fetchStatus === "fetching";
302
- if (m) {
303
- let e = d && l !== void 0 && l > m.state.dataUpdatedAt;
304
- if (r.dataUpdatedAt > m.state.dataUpdatedAt || e) {
305
- let { fetchStatus: e, ...t } = r;
306
- m.setState({
307
- ...t,
308
- data: p,
309
- ...r.status === "pending" && p !== void 0 && {
310
- status: "success",
311
- ...!_ && { fetchStatus: "idle" }
312
- }
313
- });
314
- }
315
- } else m = i.build(e, {
316
- ...e.getDefaultOptions().hydrate?.queries,
317
- ...n?.defaultOptions?.queries,
318
- queryKey: t,
319
- queryHash: o,
320
- meta: s,
321
- _type: u
322
- }, {
323
- ...r,
324
- data: p,
325
- fetchStatus: "idle",
326
- status: r.status === "pending" && p !== void 0 ? "success" : r.status
327
- });
328
- c && !d && !h && !_ && (l === void 0 || l > m.state.dataUpdatedAt) && m.fetch(void 0, { initialPromise: Promise.resolve(c).then(a) }).catch(g);
329
- });
330
- }
331
- //#endregion
332
- //#region ../../node_modules/@tanstack/query-core/build/modern/notifyManager.js
333
- var _e = m;
334
- function ve() {
335
- let e = [], t = 0, n = (e) => {
336
- e();
337
- }, r = (e) => {
338
- e();
339
- }, i = _e, a = (r) => {
340
- t ? e.push(r) : i(() => {
341
- n(r);
342
- });
343
- }, o = () => {
344
- let t = e;
345
- e = [], t.length && i(() => {
346
- r(() => {
347
- t.forEach((e) => {
348
- n(e);
349
- });
350
- });
351
- });
352
- };
353
- return {
354
- batch: (e) => {
355
- let n;
356
- t++;
357
- try {
358
- n = e();
359
- } finally {
360
- t--, t || o();
361
- }
362
- return n;
363
- },
364
- batchCalls: (e) => (...t) => {
365
- a(() => {
366
- e(...t);
367
- });
368
- },
369
- schedule: a,
370
- setNotifyFunction: (e) => {
371
- n = e;
372
- },
373
- setBatchNotifyFunction: (e) => {
374
- r = e;
375
- },
376
- setScheduler: (e) => {
377
- i = e;
378
- }
379
- };
380
- }
381
- var I = ve(), L = new class extends u {
382
- #e = !0;
383
- #t;
384
- #n;
385
- constructor() {
386
- super(), this.#n = (e) => {
387
- if (typeof window < "u" && window.addEventListener) {
388
- let t = () => e(!0), n = () => e(!1);
389
- return window.addEventListener("online", t, !1), window.addEventListener("offline", n, !1), () => {
390
- window.removeEventListener("online", t), window.removeEventListener("offline", n);
391
- };
392
- }
393
- };
394
- }
395
- onSubscribe() {
396
- this.#t || this.setEventListener(this.#n);
397
- }
398
- onUnsubscribe() {
399
- this.hasListeners() || (this.#t?.(), this.#t = void 0);
400
- }
401
- setEventListener(e) {
402
- this.#n = e, this.#t?.(), this.#t = e(this.setOnline.bind(this));
403
- }
404
- setOnline(e) {
405
- this.#e !== e && (this.#e = e, this.listeners.forEach((t) => {
406
- t(e);
407
- }));
408
- }
409
- isOnline() {
410
- return this.#e;
411
- }
412
- }();
413
- //#endregion
414
- //#region ../../node_modules/@tanstack/query-core/build/modern/retryer.js
415
- function ye(e) {
416
- return Math.min(1e3 * 2 ** e, 3e4);
417
- }
418
- function be(e) {
419
- return (e ?? "online") === "online" ? L.isOnline() : !0;
420
- }
421
- var R = class extends Error {
422
- constructor(e) {
423
- super("CancelledError"), this.revert = e?.revert, this.silent = e?.silent;
424
- }
425
- };
426
- function xe(e) {
427
- return e instanceof R;
428
- }
429
- function Se(e) {
430
- let t = !1, n = 0, r, i = P(), a = () => i.status !== "pending", o = (t) => {
431
- if (!a()) {
432
- let n = new R(t);
433
- p(n), e.onCancel?.(n);
434
- }
435
- }, s = () => {
436
- t = !0;
437
- }, c = () => {
438
- t = !1;
439
- }, l = () => d.isFocused() && (e.networkMode === "always" || L.isOnline()) && e.canRun(), u = () => be(e.networkMode) && e.canRun(), f = (e) => {
440
- a() || (r?.(), i.resolve(e));
441
- }, p = (e) => {
442
- a() || (r?.(), i.reject(e));
443
- }, m = () => new Promise((t) => {
444
- r = (e) => {
445
- (a() || l()) && t(e);
446
- }, e.onPause?.();
447
- }).then(() => {
448
- r = void 0, a() || e.onContinue?.();
449
- }), h = () => {
450
- if (a()) return;
451
- let r, i = n === 0 ? e.initialPromise : void 0;
452
- try {
453
- r = i ?? e.fn();
454
- } catch (e) {
455
- r = Promise.reject(e);
456
- }
457
- Promise.resolve(r).then(f).catch((r) => {
458
- if (a()) return;
459
- let i = e.retry ?? (N.isServer() ? 0 : 3), o = e.retryDelay ?? ye, s = typeof o == "function" ? o(n, r) : o, c = i === !0 || typeof i == "number" && n < i || typeof i == "function" && i(n, r);
460
- if (t || !c) {
461
- p(r);
462
- return;
463
- }
464
- n++, e.onFail?.(n, r), re(s).then(() => l() ? void 0 : m()).then(() => {
465
- t ? p(r) : h();
466
- });
467
- });
468
- };
469
- return {
470
- promise: i,
471
- status: () => i.status,
472
- cancel: o,
473
- continue: () => (r?.(), i),
474
- cancelRetry: s,
475
- continueRetry: c,
476
- canStart: u,
477
- start: () => (u() ? h() : m().then(h), i)
478
- };
479
- }
480
- //#endregion
481
- //#region ../../node_modules/@tanstack/query-core/build/modern/removable.js
482
- var Ce = class {
483
- #e;
484
- destroy() {
485
- this.clearGcTimeout();
486
- }
487
- scheduleGc() {
488
- this.clearGcTimeout(), v(this.gcTime) && (this.#e = p.setTimeout(() => {
489
- this.optionalRemove();
490
- }, this.gcTime));
491
- }
492
- updateGcTime(e) {
493
- this.gcTime = Math.max(this.gcTime || 0, e ?? (N.isServer() ? Infinity : 300 * 1e3));
494
- }
495
- clearGcTimeout() {
496
- this.#e !== void 0 && (p.clearTimeout(this.#e), this.#e = void 0);
497
- }
498
- };
499
- //#endregion
500
- //#region ../../node_modules/@tanstack/query-core/build/modern/infiniteQueryBehavior.js
501
- function we(e) {
502
- return { onFetch: (t, n) => {
503
- let r = t.options, i = t.fetchOptions?.meta?.fetchMore?.direction, a = t.state.data?.pages || [], o = t.state.data?.pageParams || [], s = {
504
- pages: [],
505
- pageParams: []
506
- }, c = 0, l = async () => {
507
- let n = !1, l = (e) => {
508
- ce(e, () => t.signal, () => n = !0);
509
- }, u = se(t.options, t.fetchOptions), d = async (e, r, i) => {
510
- if (n) return Promise.reject(t.signal.reason);
511
- if (r == null && e.pages.length) return Promise.resolve(e);
512
- let a = await u((() => {
513
- let e = {
514
- client: t.client,
515
- queryKey: t.queryKey,
516
- pageParam: r,
517
- direction: i ? "backward" : "forward",
518
- meta: t.options.meta
519
- };
520
- return l(e), e;
521
- })()), { maxPages: o } = t.options, s = i ? oe : ae;
522
- return {
523
- pages: s(e.pages, a, o),
524
- pageParams: s(e.pageParams, r, o)
525
- };
526
- };
527
- if (i && a.length) {
528
- let e = i === "backward", t = e ? Te : z, n = {
529
- pages: a,
530
- pageParams: o
531
- };
532
- s = await d(n, t(r, n), e);
533
- } else {
534
- let t = e ?? a.length;
535
- do {
536
- let e = c === 0 ? o[0] ?? r.initialPageParam : z(r, s);
537
- if (c > 0 && e == null) break;
538
- s = await d(s, e), c++;
539
- } while (c < t);
540
- }
541
- return s;
542
- };
543
- t.options.persister ? t.fetchFn = () => t.options.persister?.(l, {
544
- client: t.client,
545
- queryKey: t.queryKey,
546
- meta: t.options.meta,
547
- signal: t.signal
548
- }, n) : t.fetchFn = l;
549
- } };
550
- }
551
- function z(e, { pages: t, pageParams: n }) {
552
- let r = t.length - 1;
553
- return t.length > 0 ? e.getNextPageParam(t[r], t, n[r], n) : void 0;
554
- }
555
- function Te(e, { pages: t, pageParams: n }) {
556
- return t.length > 0 ? e.getPreviousPageParam?.(t[0], t, n[0], n) : void 0;
557
- }
558
- function Ee(e, t) {
559
- return t ? z(e, t) != null : !1;
560
- }
561
- function De(e, t) {
562
- return !t || !e.getPreviousPageParam ? !1 : Te(e, t) != null;
563
- }
564
- //#endregion
565
- //#region ../../node_modules/@tanstack/query-core/build/modern/query.js
566
- var Oe = class extends Ce {
567
- #e;
568
- #t;
569
- #n;
570
- #r;
571
- #i;
572
- #a;
573
- #o;
574
- #s;
575
- constructor(e) {
576
- super(), this.#s = !1, this.#o = e.defaultOptions, this.setOptions(e.options), this.observers = [], this.#i = e.client, this.#r = this.#i.getQueryCache(), this.queryKey = e.queryKey, this.queryHash = e.queryHash, this.#t = je(this.options), this.state = e.state ?? this.#t, this.scheduleGc();
577
- }
578
- get meta() {
579
- return this.options.meta;
580
- }
581
- get queryType() {
582
- return this.#e;
583
- }
584
- get promise() {
585
- return this.#a?.promise;
586
- }
587
- setOptions(e) {
588
- if (this.options = {
589
- ...this.#o,
590
- ...e
591
- }, e?._type && (this.#e = e._type), this.updateGcTime(this.options.gcTime), this.state && this.state.data === void 0) {
592
- let e = je(this.options);
593
- e.data !== void 0 && (this.setState(Ae(e.data, e.dataUpdatedAt)), this.#t = e);
594
- }
595
- }
596
- optionalRemove() {
597
- !this.observers.length && this.state.fetchStatus === "idle" && this.#r.remove(this);
598
- }
599
- setData(e, t) {
600
- let n = A(this.state.data, e, this.options);
601
- return this.#l({
602
- data: n,
603
- type: "success",
604
- dataUpdatedAt: t?.updatedAt,
605
- manual: t?.manual
606
- }), n;
607
- }
608
- setState(e) {
609
- this.#l({
610
- type: "setState",
611
- state: e
612
- });
613
- }
614
- cancel(e) {
615
- let t = this.#a?.promise;
616
- return this.#a?.cancel(e), t ? t.then(g).catch(g) : Promise.resolve();
617
- }
618
- destroy() {
619
- super.destroy(), this.cancel({ silent: !0 });
620
- }
621
- get resetState() {
622
- return this.#t;
623
- }
624
- reset() {
625
- this.destroy(), this.setState(this.resetState);
626
- }
627
- isActive() {
628
- return this.observers.some((e) => x(e.options.enabled, this) !== !1);
629
- }
630
- isDisabled() {
631
- return this.getObserversCount() > 0 ? !this.isActive() : this.options.queryFn === j || !this.isFetched();
632
- }
633
- isFetched() {
634
- return this.state.dataUpdateCount + this.state.errorUpdateCount > 0;
635
- }
636
- isStatic() {
637
- return this.getObserversCount() > 0 ? this.observers.some((e) => b(e.options.staleTime, this) === "static") : !1;
638
- }
639
- isStale() {
640
- return this.getObserversCount() > 0 ? this.observers.some((e) => e.getCurrentResult().isStale) : this.state.data === void 0 || this.state.isInvalidated;
641
- }
642
- isStaleByTime(e = 0) {
643
- return this.state.data === void 0 ? !0 : e === "static" ? !1 : this.state.isInvalidated ? !0 : !y(this.state.dataUpdatedAt, e);
644
- }
645
- onFocus() {
646
- this.observers.find((e) => e.shouldFetchOnWindowFocus())?.refetch({ cancelRefetch: !1 }), this.#a?.continue();
647
- }
648
- onOnline() {
649
- this.observers.find((e) => e.shouldFetchOnReconnect())?.refetch({ cancelRefetch: !1 }), this.#a?.continue();
650
- }
651
- addObserver(e) {
652
- this.observers.includes(e) || (this.observers.push(e), this.clearGcTimeout(), this.#r.notify({
653
- type: "observerAdded",
654
- query: this,
655
- observer: e
656
- }));
657
- }
658
- removeObserver(e) {
659
- this.observers.includes(e) && (this.observers = this.observers.filter((t) => t !== e), this.observers.length || (this.#a && (this.#s || this.#c() ? this.#a.cancel({ revert: !0 }) : this.#a.cancelRetry()), this.scheduleGc()), this.#r.notify({
660
- type: "observerRemoved",
661
- query: this,
662
- observer: e
663
- }));
664
- }
665
- getObserversCount() {
666
- return this.observers.length;
667
- }
668
- #c() {
669
- return this.state.fetchStatus === "paused" && this.state.status === "pending";
670
- }
671
- invalidate() {
672
- this.state.isInvalidated || this.#l({ type: "invalidate" });
673
- }
674
- async fetch(e, t) {
675
- if (this.state.fetchStatus !== "idle" && this.#a?.status() !== "rejected") {
676
- if (this.state.data !== void 0 && t?.cancelRefetch) this.cancel({ silent: !0 });
677
- else if (this.#a) return this.#a.continueRetry(), this.#a.promise;
678
- }
679
- if (e && this.setOptions(e), !this.options.queryFn) {
680
- let e = this.observers.find((e) => e.options.queryFn);
681
- e && this.setOptions(e.options);
682
- }
683
- let n = new AbortController(), r = (e) => {
684
- Object.defineProperty(e, "signal", {
685
- enumerable: !0,
686
- get: () => (this.#s = !0, n.signal)
687
- });
688
- }, i = () => {
689
- let e = se(this.options, t), n = (() => {
690
- let e = {
691
- client: this.#i,
692
- queryKey: this.queryKey,
693
- meta: this.meta
694
- };
695
- return r(e), e;
696
- })();
697
- return this.#s = !1, this.options.persister ? this.options.persister(e, n, this) : e(n);
698
- }, a = (() => {
699
- let e = {
700
- fetchOptions: t,
701
- options: this.options,
702
- queryKey: this.queryKey,
703
- client: this.#i,
704
- state: this.state,
705
- fetchFn: i
706
- };
707
- return r(e), e;
708
- })();
709
- (this.#e === "infinite" ? we(this.options.pages) : this.options.behavior)?.onFetch(a, this), this.#n = this.state, (this.state.fetchStatus === "idle" || this.state.fetchMeta !== a.fetchOptions?.meta) && this.#l({
710
- type: "fetch",
711
- meta: a.fetchOptions?.meta
712
- }), this.#a = Se({
713
- initialPromise: t?.initialPromise,
714
- fn: a.fetchFn,
715
- onCancel: (e) => {
716
- e instanceof R && e.revert && this.setState({
717
- ...this.#n,
718
- fetchStatus: "idle"
719
- }), n.abort();
720
- },
721
- onFail: (e, t) => {
722
- this.#l({
723
- type: "failed",
724
- failureCount: e,
725
- error: t
726
- });
727
- },
728
- onPause: () => {
729
- this.#l({ type: "pause" });
730
- },
731
- onContinue: () => {
732
- this.#l({ type: "continue" });
733
- },
734
- retry: a.options.retry,
735
- retryDelay: a.options.retryDelay,
736
- networkMode: a.options.networkMode,
737
- canRun: () => !0
738
- });
739
- try {
740
- let e = await this.#a.start();
741
- if (e === void 0) throw Error(`${this.queryHash} data is undefined`);
742
- return this.setData(e), this.#r.config.onSuccess?.(e, this), this.#r.config.onSettled?.(e, this.state.error, this), e;
743
- } catch (e) {
744
- if (e instanceof R) {
745
- if (e.silent) return this.#a.promise;
746
- if (e.revert) {
747
- if (this.state.data === void 0) throw e;
748
- return this.state.data;
749
- }
750
- }
751
- throw this.#l({
752
- type: "error",
753
- error: e
754
- }), this.#r.config.onError?.(e, this), this.#r.config.onSettled?.(this.state.data, e, this), e;
755
- } finally {
756
- this.scheduleGc();
757
- }
758
- }
759
- #l(e) {
760
- let t = (t) => {
761
- switch (e.type) {
762
- case "failed": return {
763
- ...t,
764
- fetchFailureCount: e.failureCount,
765
- fetchFailureReason: e.error
766
- };
767
- case "pause": return {
768
- ...t,
769
- fetchStatus: "paused"
770
- };
771
- case "continue": return {
772
- ...t,
773
- fetchStatus: "fetching"
774
- };
775
- case "fetch": return {
776
- ...t,
777
- ...ke(t.data, this.options),
778
- fetchMeta: e.meta ?? null
779
- };
780
- case "success":
781
- let n = {
782
- ...t,
783
- ...Ae(e.data, e.dataUpdatedAt),
784
- dataUpdateCount: t.dataUpdateCount + 1,
785
- ...!e.manual && {
786
- fetchStatus: "idle",
787
- fetchFailureCount: 0,
788
- fetchFailureReason: null
789
- }
790
- };
791
- return this.#n = e.manual ? n : void 0, n;
792
- case "error":
793
- let r = e.error;
794
- return {
795
- ...t,
796
- error: r,
797
- errorUpdateCount: t.errorUpdateCount + 1,
798
- errorUpdatedAt: Date.now(),
799
- fetchFailureCount: t.fetchFailureCount + 1,
800
- fetchFailureReason: r,
801
- fetchStatus: "idle",
802
- status: "error",
803
- isInvalidated: !0
804
- };
805
- case "invalidate": return {
806
- ...t,
807
- isInvalidated: !0
808
- };
809
- case "setState": return {
810
- ...t,
811
- ...e.state
812
- };
813
- }
814
- };
815
- this.state = t(this.state), I.batch(() => {
816
- this.observers.forEach((e) => {
817
- e.onQueryUpdate();
818
- }), this.#r.notify({
819
- query: this,
820
- type: "updated",
821
- action: e
822
- });
823
- });
824
- }
825
- };
826
- function ke(e, t) {
827
- return {
828
- fetchFailureCount: 0,
829
- fetchFailureReason: null,
830
- fetchStatus: be(t.networkMode) ? "fetching" : "paused",
831
- ...e === void 0 && {
832
- error: null,
833
- status: "pending"
834
- }
835
- };
836
- }
837
- function Ae(e, t) {
838
- return {
839
- data: e,
840
- dataUpdatedAt: t ?? Date.now(),
841
- error: null,
842
- isInvalidated: !1,
843
- status: "success"
844
- };
845
- }
846
- function je(e) {
847
- let t = typeof e.initialData == "function" ? e.initialData() : e.initialData, n = t !== void 0, r = n ? typeof e.initialDataUpdatedAt == "function" ? e.initialDataUpdatedAt() : e.initialDataUpdatedAt : 0;
848
- return {
849
- data: t,
850
- dataUpdateCount: 0,
851
- dataUpdatedAt: n ? r ?? Date.now() : 0,
852
- error: null,
853
- errorUpdateCount: 0,
854
- errorUpdatedAt: 0,
855
- fetchFailureCount: 0,
856
- fetchFailureReason: null,
857
- fetchMeta: null,
858
- isInvalidated: !1,
859
- status: n ? "success" : "pending",
860
- fetchStatus: "idle"
861
- };
862
- }
863
- //#endregion
864
- //#region ../../node_modules/@tanstack/query-core/build/modern/queryObserver.js
865
- var B = class extends u {
866
- constructor(e, t) {
867
- super(), this.options = t, this.#e = e, this.#s = null, this.#o = P(), this.bindMethods(), this.setOptions(t);
868
- }
869
- #e;
870
- #t = void 0;
871
- #n = void 0;
872
- #r = void 0;
873
- #i;
874
- #a;
875
- #o;
876
- #s;
877
- #c;
878
- #l;
879
- #u;
880
- #d;
881
- #f;
882
- #p;
883
- #m = /* @__PURE__ */ new Set();
884
- bindMethods() {
885
- this.refetch = this.refetch.bind(this);
886
- }
887
- onSubscribe() {
888
- this.listeners.size === 1 && (this.#t.addObserver(this), Ne(this.#t, this.options) ? this.#h() : this.updateResult(), this.#y());
889
- }
890
- onUnsubscribe() {
891
- this.hasListeners() || this.destroy();
892
- }
893
- shouldFetchOnReconnect() {
894
- return V(this.#t, this.options, this.options.refetchOnReconnect);
895
- }
896
- shouldFetchOnWindowFocus() {
897
- return V(this.#t, this.options, this.options.refetchOnWindowFocus);
898
- }
899
- destroy() {
900
- this.listeners = /* @__PURE__ */ new Set(), this.#b(), this.#x(), this.#t.removeObserver(this);
901
- }
902
- setOptions(e) {
903
- let t = this.options, n = this.#t;
904
- if (this.options = this.#e.defaultQueryOptions(e), this.options.enabled !== void 0 && typeof this.options.enabled != "boolean" && typeof this.options.enabled != "function" && typeof x(this.options.enabled, this.#t) != "boolean") throw Error("Expected enabled to be a boolean or a callback that returns a boolean");
905
- this.#S(), this.#t.setOptions(this.options), t._defaulted && !O(this.options, t) && this.#e.getQueryCache().notify({
906
- type: "observerOptionsUpdated",
907
- query: this.#t,
908
- observer: this
909
- });
910
- let r = this.hasListeners();
911
- r && H(this.#t, n, this.options, t) && this.#h(), this.updateResult(), r && (this.#t !== n || x(this.options.enabled, this.#t) !== x(t.enabled, this.#t) || b(this.options.staleTime, this.#t) !== b(t.staleTime, this.#t)) && this.#g();
912
- let i = this.#_();
913
- r && (this.#t !== n || x(this.options.enabled, this.#t) !== x(t.enabled, this.#t) || i !== this.#p) && this.#v(i);
914
- }
915
- getOptimisticResult(e) {
916
- let t = this.#e.getQueryCache().build(this.#e, e), n = this.createResult(t, e);
917
- return Pe(this, n) && (this.#r = n, this.#a = this.options, this.#i = this.#t.state), n;
918
- }
919
- getCurrentResult() {
920
- return this.#r;
921
- }
922
- trackResult(e, t) {
923
- return new Proxy(e, { get: (e, n) => (this.trackProp(n), t?.(n), n === "promise" && (this.trackProp("data"), !this.options.experimental_prefetchInRender && this.#o.status === "pending" && this.#o.reject(/* @__PURE__ */ Error("experimental_prefetchInRender feature flag is not enabled"))), Reflect.get(e, n)) });
924
- }
925
- trackProp(e) {
926
- this.#m.add(e);
927
- }
928
- getCurrentQuery() {
929
- return this.#t;
930
- }
931
- refetch({ ...e } = {}) {
932
- return this.fetch({ ...e });
933
- }
934
- fetchOptimistic(e) {
935
- let t = this.#e.defaultQueryOptions(e), n = this.#e.getQueryCache().build(this.#e, t);
936
- return n.fetch().then(() => this.createResult(n, t));
937
- }
938
- fetch(e) {
939
- return this.#h({
940
- ...e,
941
- cancelRefetch: e.cancelRefetch ?? !0
942
- }).then(() => (this.updateResult(), this.#r));
943
- }
944
- #h(e) {
945
- this.#S();
946
- let t = this.#t.fetch(this.options, e);
947
- return e?.throwOnError || (t = t.catch(g)), t;
948
- }
949
- #g() {
950
- this.#b();
951
- let e = b(this.options.staleTime, this.#t);
952
- if (N.isServer() || this.#r.isStale || !v(e)) return;
953
- let t = y(this.#r.dataUpdatedAt, e) + 1;
954
- this.#d = p.setTimeout(() => {
955
- this.#r.isStale || this.updateResult();
956
- }, t);
957
- }
958
- #_() {
959
- return (typeof this.options.refetchInterval == "function" ? this.options.refetchInterval(this.#t) : this.options.refetchInterval) ?? !1;
960
- }
961
- #v(e) {
962
- this.#x(), this.#p = e, !(N.isServer() || x(this.options.enabled, this.#t) === !1 || !v(this.#p) || this.#p === 0) && (this.#f = p.setInterval(() => {
963
- (this.options.refetchIntervalInBackground || d.isFocused()) && this.#h();
964
- }, this.#p));
965
- }
966
- #y() {
967
- this.#g(), this.#v(this.#_());
968
- }
969
- #b() {
970
- this.#d !== void 0 && (p.clearTimeout(this.#d), this.#d = void 0);
971
- }
972
- #x() {
973
- this.#f !== void 0 && (p.clearInterval(this.#f), this.#f = void 0);
974
- }
975
- createResult(e, t) {
976
- let n = this.#t, r = this.options, i = this.#r, a = this.#i, o = this.#a, s = e === n ? this.#n : e.state, { state: c } = e, l = { ...c }, u = !1, d;
977
- if (t._optimisticResults) {
978
- let i = this.hasListeners(), a = !i && Ne(e, t), o = i && H(e, n, t, r);
979
- (a || o) && (l = {
980
- ...l,
981
- ...ke(c.data, e.options)
982
- }), t._optimisticResults === "isRestoring" && (l.fetchStatus = "idle");
983
- }
984
- let { error: f, errorUpdatedAt: p, status: m } = l;
985
- d = l.data;
986
- let h = !1;
987
- if (t.placeholderData !== void 0 && d === void 0 && m === "pending") {
988
- let e;
989
- i?.isPlaceholderData && t.placeholderData === o?.placeholderData ? (e = i.data, h = !0) : e = typeof t.placeholderData == "function" ? t.placeholderData(this.#u?.state.data, this.#u) : t.placeholderData, e !== void 0 && (m = "success", d = A(i?.data, e, t), u = !0);
990
- }
991
- if (t.select && d !== void 0 && !h) if (i && d === a?.data && t.select === this.#c) d = this.#l;
992
- else try {
993
- this.#c = t.select, d = t.select(d), d = A(i?.data, d, t), this.#l = d, this.#s = null;
994
- } catch (e) {
995
- this.#s = e;
996
- }
997
- this.#s && (f = this.#s, d = this.#l, p = Date.now(), m = "error");
998
- let g = l.fetchStatus === "fetching", _ = m === "pending", v = m === "error", y = _ && g, b = d !== void 0, S = {
999
- status: m,
1000
- fetchStatus: l.fetchStatus,
1001
- isPending: _,
1002
- isSuccess: m === "success",
1003
- isError: v,
1004
- isInitialLoading: y,
1005
- isLoading: y,
1006
- data: d,
1007
- dataUpdatedAt: l.dataUpdatedAt,
1008
- error: f,
1009
- errorUpdatedAt: p,
1010
- failureCount: l.fetchFailureCount,
1011
- failureReason: l.fetchFailureReason,
1012
- errorUpdateCount: l.errorUpdateCount,
1013
- isFetched: e.isFetched(),
1014
- isFetchedAfterMount: l.dataUpdateCount > s.dataUpdateCount || l.errorUpdateCount > s.errorUpdateCount,
1015
- isFetching: g,
1016
- isRefetching: g && !_,
1017
- isLoadingError: v && !b,
1018
- isPaused: l.fetchStatus === "paused",
1019
- isPlaceholderData: u,
1020
- isRefetchError: v && b,
1021
- isStale: U(e, t),
1022
- refetch: this.refetch,
1023
- promise: this.#o,
1024
- isEnabled: x(t.enabled, e) !== !1
1025
- };
1026
- if (this.options.experimental_prefetchInRender) {
1027
- let t = S.data !== void 0, r = S.status === "error" && !t, i = (e) => {
1028
- r ? e.reject(S.error) : t && e.resolve(S.data);
1029
- }, a = () => {
1030
- i(this.#o = S.promise = P());
1031
- }, o = this.#o;
1032
- switch (o.status) {
1033
- case "pending":
1034
- e.queryHash === n.queryHash && i(o);
1035
- break;
1036
- case "fulfilled":
1037
- (r || S.data !== o.value) && a();
1038
- break;
1039
- case "rejected":
1040
- (!r || S.error !== o.reason) && a();
1041
- break;
1042
- }
1043
- }
1044
- return S;
1045
- }
1046
- updateResult() {
1047
- let e = this.#r, t = this.createResult(this.#t, this.options);
1048
- this.#i = this.#t.state, this.#a = this.options, this.#i.data !== void 0 && (this.#u = this.#t), !O(t, e) && (this.#r = t, this.#C({ listeners: (() => {
1049
- if (!e) return !0;
1050
- let { notifyOnChangeProps: t } = this.options, n = typeof t == "function" ? t() : t;
1051
- if (n === "all" || !n && !this.#m.size) return !0;
1052
- let r = new Set(n ?? this.#m);
1053
- return this.options.throwOnError && r.add("error"), Object.keys(this.#r).some((t) => {
1054
- let n = t;
1055
- return this.#r[n] !== e[n] && r.has(n);
1056
- });
1057
- })() }));
1058
- }
1059
- #S() {
1060
- let e = this.#e.getQueryCache().build(this.#e, this.options);
1061
- if (e === this.#t) return;
1062
- let t = this.#t;
1063
- this.#t = e, this.#n = e.state, this.hasListeners() && (t?.removeObserver(this), e.addObserver(this));
1064
- }
1065
- onQueryUpdate() {
1066
- this.updateResult(), this.hasListeners() && this.#y();
1067
- }
1068
- #C(e) {
1069
- I.batch(() => {
1070
- e.listeners && this.listeners.forEach((e) => {
1071
- e(this.#r);
1072
- }), this.#e.getQueryCache().notify({
1073
- query: this.#t,
1074
- type: "observerResultsUpdated"
1075
- });
1076
- });
1077
- }
1078
- };
1079
- function Me(e, t) {
1080
- return x(t.enabled, e) !== !1 && e.state.data === void 0 && !(e.state.status === "error" && x(t.retryOnMount, e) === !1);
1081
- }
1082
- function Ne(e, t) {
1083
- return Me(e, t) || e.state.data !== void 0 && V(e, t, t.refetchOnMount);
1084
- }
1085
- function V(e, t, n) {
1086
- if (x(t.enabled, e) !== !1 && b(t.staleTime, e) !== "static") {
1087
- let r = typeof n == "function" ? n(e) : n;
1088
- return r === "always" || r !== !1 && U(e, t);
1089
- }
1090
- return !1;
1091
- }
1092
- function H(e, t, n, r) {
1093
- return (e !== t || x(r.enabled, e) === !1) && (!n.suspense || e.state.status !== "error") && U(e, n);
1094
- }
1095
- function U(e, t) {
1096
- return x(t.enabled, e) !== !1 && e.isStaleByTime(b(t.staleTime, e));
1097
- }
1098
- function Pe(e, t) {
1099
- return !O(e.getCurrentResult(), t);
1100
- }
1101
- //#endregion
1102
- //#region ../../node_modules/@tanstack/query-core/build/modern/infiniteQueryObserver.js
1103
- var W = class extends B {
1104
- constructor(e, t) {
1105
- super(e, t);
1106
- }
1107
- bindMethods() {
1108
- super.bindMethods(), this.fetchNextPage = this.fetchNextPage.bind(this), this.fetchPreviousPage = this.fetchPreviousPage.bind(this);
1109
- }
1110
- setOptions(e) {
1111
- e._type = "infinite", super.setOptions(e);
1112
- }
1113
- getOptimisticResult(e) {
1114
- return e._type = "infinite", super.getOptimisticResult(e);
1115
- }
1116
- fetchNextPage(e) {
1117
- return this.fetch({
1118
- ...e,
1119
- meta: { fetchMore: { direction: "forward" } }
1120
- });
1121
- }
1122
- fetchPreviousPage(e) {
1123
- return this.fetch({
1124
- ...e,
1125
- meta: { fetchMore: { direction: "backward" } }
1126
- });
1127
- }
1128
- createResult(e, t) {
1129
- let { state: n } = e, r = super.createResult(e, t), { isFetching: i, isRefetching: a, isError: o, isRefetchError: s } = r, c = n.fetchMeta?.fetchMore?.direction, l = o && c === "forward", u = i && c === "forward", d = o && c === "backward", f = i && c === "backward";
1130
- return {
1131
- ...r,
1132
- fetchNextPage: this.fetchNextPage,
1133
- fetchPreviousPage: this.fetchPreviousPage,
1134
- hasNextPage: Ee(t, n.data),
1135
- hasPreviousPage: De(t, n.data),
1136
- isFetchNextPageError: l,
1137
- isFetchingNextPage: u,
1138
- isFetchPreviousPageError: d,
1139
- isFetchingPreviousPage: f,
1140
- isRefetchError: s && !l && !d,
1141
- isRefetching: a && !u && !f
1142
- };
1143
- }
1144
- }, Fe = class extends Ce {
1145
- #e;
1146
- #t;
1147
- #n;
1148
- #r;
1149
- constructor(e) {
1150
- super(), this.#e = e.client, this.mutationId = e.mutationId, this.#n = e.mutationCache, this.#t = [], this.state = e.state || Ie(), this.setOptions(e.options), this.scheduleGc();
1151
- }
1152
- setOptions(e) {
1153
- this.options = e, this.updateGcTime(this.options.gcTime);
1154
- }
1155
- get meta() {
1156
- return this.options.meta;
1157
- }
1158
- addObserver(e) {
1159
- this.#t.includes(e) || (this.#t.push(e), this.clearGcTimeout(), this.#n.notify({
1160
- type: "observerAdded",
1161
- mutation: this,
1162
- observer: e
1163
- }));
1164
- }
1165
- removeObserver(e) {
1166
- this.#t = this.#t.filter((t) => t !== e), this.scheduleGc(), this.#n.notify({
1167
- type: "observerRemoved",
1168
- mutation: this,
1169
- observer: e
1170
- });
1171
- }
1172
- optionalRemove() {
1173
- this.#t.length || (this.state.status === "pending" ? this.scheduleGc() : this.#n.remove(this));
1174
- }
1175
- continue() {
1176
- return this.#r?.continue() ?? this.execute(this.state.variables);
1177
- }
1178
- async execute(e) {
1179
- let t = () => {
1180
- this.#i({ type: "continue" });
1181
- }, n = {
1182
- client: this.#e,
1183
- meta: this.options.meta,
1184
- mutationKey: this.options.mutationKey
1185
- };
1186
- this.#r = Se({
1187
- fn: () => this.options.mutationFn ? this.options.mutationFn(e, n) : Promise.reject(/* @__PURE__ */ Error("No mutationFn found")),
1188
- onFail: (e, t) => {
1189
- this.#i({
1190
- type: "failed",
1191
- failureCount: e,
1192
- error: t
1193
- });
1194
- },
1195
- onPause: () => {
1196
- this.#i({ type: "pause" });
1197
- },
1198
- onContinue: t,
1199
- retry: this.options.retry ?? 0,
1200
- retryDelay: this.options.retryDelay,
1201
- networkMode: this.options.networkMode,
1202
- canRun: () => this.#n.canRun(this)
1203
- });
1204
- let r = this.state.status === "pending", i = !this.#r.canStart();
1205
- try {
1206
- if (r) t();
1207
- else {
1208
- this.#i({
1209
- type: "pending",
1210
- variables: e,
1211
- isPaused: i
1212
- }), this.#n.config.onMutate && await this.#n.config.onMutate(e, this, n);
1213
- let t = await this.options.onMutate?.(e, n);
1214
- t !== this.state.context && this.#i({
1215
- type: "pending",
1216
- context: t,
1217
- variables: e,
1218
- isPaused: i
1219
- });
1220
- }
1221
- let a = await this.#r.start();
1222
- return await this.#n.config.onSuccess?.(a, e, this.state.context, this, n), await this.options.onSuccess?.(a, e, this.state.context, n), await this.#n.config.onSettled?.(a, null, this.state.variables, this.state.context, this, n), await this.options.onSettled?.(a, null, e, this.state.context, n), this.#i({
1223
- type: "success",
1224
- data: a
1225
- }), a;
1226
- } catch (t) {
1227
- try {
1228
- await this.#n.config.onError?.(t, e, this.state.context, this, n);
1229
- } catch (e) {
1230
- Promise.reject(e);
1231
- }
1232
- try {
1233
- await this.options.onError?.(t, e, this.state.context, n);
1234
- } catch (e) {
1235
- Promise.reject(e);
1236
- }
1237
- try {
1238
- await this.#n.config.onSettled?.(void 0, t, this.state.variables, this.state.context, this, n);
1239
- } catch (e) {
1240
- Promise.reject(e);
1241
- }
1242
- try {
1243
- await this.options.onSettled?.(void 0, t, e, this.state.context, n);
1244
- } catch (e) {
1245
- Promise.reject(e);
1246
- }
1247
- throw this.#i({
1248
- type: "error",
1249
- error: t
1250
- }), t;
1251
- } finally {
1252
- this.#n.runNext(this);
1253
- }
1254
- }
1255
- #i(e) {
1256
- let t = (t) => {
1257
- switch (e.type) {
1258
- case "failed": return {
1259
- ...t,
1260
- failureCount: e.failureCount,
1261
- failureReason: e.error
1262
- };
1263
- case "pause": return {
1264
- ...t,
1265
- isPaused: !0
1266
- };
1267
- case "continue": return {
1268
- ...t,
1269
- isPaused: !1
1270
- };
1271
- case "pending": return {
1272
- ...t,
1273
- context: e.context,
1274
- data: void 0,
1275
- failureCount: 0,
1276
- failureReason: null,
1277
- error: null,
1278
- isPaused: e.isPaused,
1279
- status: "pending",
1280
- variables: e.variables,
1281
- submittedAt: Date.now()
1282
- };
1283
- case "success": return {
1284
- ...t,
1285
- data: e.data,
1286
- failureCount: 0,
1287
- failureReason: null,
1288
- error: null,
1289
- status: "success",
1290
- isPaused: !1
1291
- };
1292
- case "error": return {
1293
- ...t,
1294
- data: void 0,
1295
- error: e.error,
1296
- failureCount: t.failureCount + 1,
1297
- failureReason: e.error,
1298
- isPaused: !1,
1299
- status: "error"
1300
- };
1301
- }
1302
- };
1303
- this.state = t(this.state), I.batch(() => {
1304
- this.#t.forEach((t) => {
1305
- t.onMutationUpdate(e);
1306
- }), this.#n.notify({
1307
- mutation: this,
1308
- type: "updated",
1309
- action: e
1310
- });
1311
- });
1312
- }
1313
- };
1314
- function Ie() {
1315
- return {
1316
- context: void 0,
1317
- data: void 0,
1318
- error: null,
1319
- failureCount: 0,
1320
- failureReason: null,
1321
- isPaused: !1,
1322
- status: "idle",
1323
- variables: void 0,
1324
- submittedAt: 0
1325
- };
1326
- }
1327
- //#endregion
1328
- //#region ../../node_modules/@tanstack/query-core/build/modern/mutationCache.js
1329
- var Le = class extends u {
1330
- constructor(e = {}) {
1331
- super(), this.config = e, this.#e = /* @__PURE__ */ new Set(), this.#t = /* @__PURE__ */ new Map(), this.#n = 0;
1332
- }
1333
- #e;
1334
- #t;
1335
- #n;
1336
- build(e, t, n) {
1337
- let r = new Fe({
1338
- client: e,
1339
- mutationCache: this,
1340
- mutationId: ++this.#n,
1341
- options: e.defaultMutationOptions(t),
1342
- state: n
1343
- });
1344
- return this.add(r), r;
1345
- }
1346
- add(e) {
1347
- this.#e.add(e);
1348
- let t = G(e);
1349
- if (typeof t == "string") {
1350
- let n = this.#t.get(t);
1351
- n ? n.push(e) : this.#t.set(t, [e]);
1352
- }
1353
- this.notify({
1354
- type: "added",
1355
- mutation: e
1356
- });
1357
- }
1358
- remove(e) {
1359
- if (this.#e.delete(e)) {
1360
- let t = G(e);
1361
- if (typeof t == "string") {
1362
- let n = this.#t.get(t);
1363
- if (n) if (n.length > 1) {
1364
- let t = n.indexOf(e);
1365
- t !== -1 && n.splice(t, 1);
1366
- } else n[0] === e && this.#t.delete(t);
1367
- }
1368
- }
1369
- this.notify({
1370
- type: "removed",
1371
- mutation: e
1372
- });
1373
- }
1374
- canRun(e) {
1375
- let t = G(e);
1376
- if (typeof t == "string") {
1377
- let n = this.#t.get(t)?.find((e) => e.state.status === "pending");
1378
- return !n || n === e;
1379
- } else return !0;
1380
- }
1381
- runNext(e) {
1382
- let t = G(e);
1383
- return typeof t == "string" ? (this.#t.get(t)?.find((t) => t !== e && t.state.isPaused))?.continue() ?? Promise.resolve() : Promise.resolve();
1384
- }
1385
- clear() {
1386
- I.batch(() => {
1387
- this.#e.forEach((e) => {
1388
- this.notify({
1389
- type: "removed",
1390
- mutation: e
1391
- });
1392
- }), this.#e.clear(), this.#t.clear();
1393
- });
1394
- }
1395
- getAll() {
1396
- return Array.from(this.#e);
1397
- }
1398
- find(e) {
1399
- let t = {
1400
- exact: !0,
1401
- ...e
1402
- };
1403
- return this.getAll().find((e) => C(t, e));
1404
- }
1405
- findAll(e = {}) {
1406
- return this.getAll().filter((t) => C(e, t));
1407
- }
1408
- notify(e) {
1409
- I.batch(() => {
1410
- this.listeners.forEach((t) => {
1411
- t(e);
1412
- });
1413
- });
1414
- }
1415
- resumePausedMutations() {
1416
- let e = this.getAll().filter((e) => e.state.isPaused);
1417
- return I.batch(() => Promise.all(e.map((e) => e.continue().catch(g))));
1418
- }
1419
- };
1420
- function G(e) {
1421
- return e.options.scope?.id;
1422
- }
1423
- //#endregion
1424
- //#region ../../node_modules/@tanstack/query-core/build/modern/mutationObserver.js
1425
- var Re = class extends u {
1426
- #e;
1427
- #t = void 0;
1428
- #n;
1429
- #r;
1430
- constructor(e, t) {
1431
- super(), this.#e = e, this.setOptions(t), this.bindMethods(), this.#i();
1432
- }
1433
- bindMethods() {
1434
- this.mutate = this.mutate.bind(this), this.reset = this.reset.bind(this);
1435
- }
1436
- setOptions(e) {
1437
- let t = this.options;
1438
- this.options = this.#e.defaultMutationOptions(e), O(this.options, t) || this.#e.getMutationCache().notify({
1439
- type: "observerOptionsUpdated",
1440
- mutation: this.#n,
1441
- observer: this
1442
- }), t?.mutationKey && this.options.mutationKey && T(t.mutationKey) !== T(this.options.mutationKey) ? this.reset() : this.#n?.state.status === "pending" && this.#n.setOptions(this.options);
1443
- }
1444
- onUnsubscribe() {
1445
- this.hasListeners() || this.#n?.removeObserver(this);
1446
- }
1447
- onMutationUpdate(e) {
1448
- this.#i(), this.#a(e);
1449
- }
1450
- getCurrentResult() {
1451
- return this.#t;
1452
- }
1453
- reset() {
1454
- this.#n?.removeObserver(this), this.#n = void 0, this.#i(), this.#a();
1455
- }
1456
- mutate(e, t) {
1457
- return this.#r = t, this.#n?.removeObserver(this), this.#n = this.#e.getMutationCache().build(this.#e, this.options), this.#n.addObserver(this), this.#n.execute(e);
1458
- }
1459
- #i() {
1460
- let e = this.#n?.state ?? Ie();
1461
- this.#t = {
1462
- ...e,
1463
- isPending: e.status === "pending",
1464
- isSuccess: e.status === "success",
1465
- isError: e.status === "error",
1466
- isIdle: e.status === "idle",
1467
- mutate: this.mutate,
1468
- reset: this.reset
1469
- };
1470
- }
1471
- #a(e) {
1472
- I.batch(() => {
1473
- if (this.#r && this.hasListeners()) {
1474
- let t = this.#t.variables, n = this.#t.context, r = {
1475
- client: this.#e,
1476
- meta: this.options.meta,
1477
- mutationKey: this.options.mutationKey
1478
- };
1479
- if (e?.type === "success") {
1480
- try {
1481
- this.#r.onSuccess?.(e.data, t, n, r);
1482
- } catch (e) {
1483
- Promise.reject(e);
1484
- }
1485
- try {
1486
- this.#r.onSettled?.(e.data, null, t, n, r);
1487
- } catch (e) {
1488
- Promise.reject(e);
1489
- }
1490
- } else if (e?.type === "error") {
1491
- try {
1492
- this.#r.onError?.(e.error, t, n, r);
1493
- } catch (e) {
1494
- Promise.reject(e);
1495
- }
1496
- try {
1497
- this.#r.onSettled?.(void 0, e.error, t, n, r);
1498
- } catch (e) {
1499
- Promise.reject(e);
1500
- }
1501
- }
1502
- }
1503
- this.listeners.forEach((e) => {
1504
- e(this.#t);
1505
- });
1506
- });
1507
- }
1508
- };
1509
- //#endregion
1510
- //#region ../../node_modules/@tanstack/query-core/build/modern/queriesObserver.js
1511
- function ze(e, t) {
1512
- let n = new Set(t);
1513
- return e.filter((e) => !n.has(e));
1514
- }
1515
- function Be(e, t, n) {
1516
- let r = e.slice(0);
1517
- return r[t] = n, r;
1518
- }
1519
- var Ve = class extends u {
1520
- #e;
1521
- #t;
1522
- #n;
1523
- #r;
1524
- #i;
1525
- #a;
1526
- #o;
1527
- #s;
1528
- #c;
1529
- #l = [];
1530
- constructor(e, t, n) {
1531
- super(), this.#e = e, this.#r = n, this.#n = [], this.#i = [], this.#t = [], this.setQueries(t);
1532
- }
1533
- onSubscribe() {
1534
- this.listeners.size === 1 && this.#i.forEach((e) => {
1535
- e.subscribe((t) => {
1536
- this.#m(e, t);
1537
- });
1538
- });
1539
- }
1540
- onUnsubscribe() {
1541
- this.listeners.size || this.destroy();
1542
- }
1543
- destroy() {
1544
- this.listeners = /* @__PURE__ */ new Set(), this.#i.forEach((e) => {
1545
- e.destroy();
1546
- });
1547
- }
1548
- setQueries(e, t) {
1549
- this.#n = e, this.#r = t, I.batch(() => {
1550
- let e = this.#i, t = this.#p(this.#n);
1551
- t.forEach((e) => e.observer.setOptions(e.defaultedQueryOptions));
1552
- let n = t.map((e) => e.observer), r = n.map((e) => e.getCurrentResult()), i = e.length !== n.length, a = n.some((t, n) => t !== e[n]), o = i || a, s = o ? !0 : r.some((e, t) => {
1553
- let n = this.#t[t];
1554
- return !n || !O(e, n);
1555
- });
1556
- !o && !s || (o && (this.#l = t, this.#i = n), this.#t = r, this.hasListeners() && (o && (ze(e, n).forEach((e) => {
1557
- e.destroy();
1558
- }), ze(n, e).forEach((e) => {
1559
- e.subscribe((t) => {
1560
- this.#m(e, t);
1561
- });
1562
- })), this.#h()));
1563
- });
1564
- }
1565
- getCurrentResult() {
1566
- return this.#t;
1567
- }
1568
- getQueries() {
1569
- return this.#i.map((e) => e.getCurrentQuery());
1570
- }
1571
- getObservers() {
1572
- return this.#i;
1573
- }
1574
- getOptimisticResult(e, t) {
1575
- let n = this.#p(e), r = n.map((e) => e.observer.getOptimisticResult(e.defaultedQueryOptions)), i = n.map((e) => e.defaultedQueryOptions.queryHash);
1576
- return [
1577
- r,
1578
- (e) => this.#d(e ?? r, t, i),
1579
- () => this.#u(r, n)
1580
- ];
1581
- }
1582
- #u(e, t) {
1583
- return t.map((n, r) => {
1584
- let i = e[r];
1585
- return n.defaultedQueryOptions.notifyOnChangeProps ? i : n.observer.trackResult(i, (e) => {
1586
- t.forEach((t) => {
1587
- t.observer.trackProp(e);
1588
- });
1589
- });
1590
- });
1591
- }
1592
- #d(e, t, n) {
1593
- if (t) {
1594
- let r = this.#c, i = n !== void 0 && r !== void 0 && (r.length !== n.length || n.some((e, t) => e !== r[t]));
1595
- return (!this.#a || this.#t !== this.#s || i || t !== this.#o) && (this.#o = t, this.#s = this.#t, n !== void 0 && (this.#c = n), this.#a = D(this.#a, t(e))), this.#a;
1596
- }
1597
- return e;
1598
- }
1599
- #f() {
1600
- return this.#r?.combine !== void 0 && this.#i.some((e, t) => e.options.suspense && this.#t[t]?.data === void 0);
1601
- }
1602
- #p(e) {
1603
- let t = /* @__PURE__ */ new Map();
1604
- this.#i.forEach((e) => {
1605
- let n = e.options.queryHash;
1606
- if (!n) return;
1607
- let r = t.get(n);
1608
- r ? r.push(e) : t.set(n, [e]);
1609
- });
1610
- let n = [];
1611
- return e.forEach((e) => {
1612
- let r = this.#e.defaultQueryOptions(e), i = t.get(r.queryHash)?.shift() ?? new B(this.#e, r);
1613
- n.push({
1614
- defaultedQueryOptions: r,
1615
- observer: i
1616
- });
1617
- }), n;
1618
- }
1619
- #m(e, t) {
1620
- let n = this.#i.indexOf(e);
1621
- n !== -1 && (this.#t = Be(this.#t, n, t), this.#h());
1622
- }
1623
- #h() {
1624
- if (this.hasListeners()) {
1625
- let e = this.#u(this.#t, this.#l), t = this.#f(), n = this.#a, r = t ? n : this.#d(e, this.#r?.combine);
1626
- (t || n !== r) && I.batch(() => {
1627
- this.listeners.forEach((e) => {
1628
- e(this.#t);
1629
- });
1630
- });
1631
- }
1632
- }
1633
- }, He = class extends u {
1634
- constructor(e = {}) {
1635
- super(), this.config = e, this.#e = /* @__PURE__ */ new Map();
1636
- }
1637
- #e;
1638
- build(e, t, n) {
1639
- let r = t.queryKey, i = t.queryHash ?? w(r, t), a = this.get(i);
1640
- return a || (a = new Oe({
1641
- client: e,
1642
- queryKey: r,
1643
- queryHash: i,
1644
- options: e.defaultQueryOptions(t),
1645
- state: n,
1646
- defaultOptions: e.getQueryDefaults(r)
1647
- }), this.add(a)), a;
1648
- }
1649
- add(e) {
1650
- this.#e.has(e.queryHash) || (this.#e.set(e.queryHash, e), this.notify({
1651
- type: "added",
1652
- query: e
1653
- }));
1654
- }
1655
- remove(e) {
1656
- let t = this.#e.get(e.queryHash);
1657
- t && (e.destroy(), t === e && this.#e.delete(e.queryHash), this.notify({
1658
- type: "removed",
1659
- query: e
1660
- }));
1661
- }
1662
- clear() {
1663
- I.batch(() => {
1664
- this.getAll().forEach((e) => {
1665
- this.remove(e);
1666
- });
1667
- });
1668
- }
1669
- get(e) {
1670
- return this.#e.get(e);
1671
- }
1672
- getAll() {
1673
- return [...this.#e.values()];
1674
- }
1675
- find(e) {
1676
- let t = {
1677
- exact: !0,
1678
- ...e
1679
- };
1680
- return this.getAll().find((e) => S(t, e));
1681
- }
1682
- findAll(e = {}) {
1683
- let t = this.getAll();
1684
- return Object.keys(e).length > 0 ? t.filter((t) => S(e, t)) : t;
1685
- }
1686
- notify(e) {
1687
- I.batch(() => {
1688
- this.listeners.forEach((t) => {
1689
- t(e);
1690
- });
1691
- });
1692
- }
1693
- onFocus() {
1694
- I.batch(() => {
1695
- this.getAll().forEach((e) => {
1696
- e.onFocus();
1697
- });
1698
- });
1699
- }
1700
- onOnline() {
1701
- I.batch(() => {
1702
- this.getAll().forEach((e) => {
1703
- e.onOnline();
1704
- });
1705
- });
1706
- }
1707
- }, Ue = class {
1708
- #e;
1709
- #t;
1710
- #n;
1711
- #r;
1712
- #i;
1713
- #a;
1714
- #o;
1715
- #s;
1716
- constructor(e = {}) {
1717
- this.#e = e.queryCache || new He(), this.#t = e.mutationCache || new Le(), this.#n = e.defaultOptions || {}, this.#r = /* @__PURE__ */ new Map(), this.#i = /* @__PURE__ */ new Map(), this.#a = 0;
1718
- }
1719
- mount() {
1720
- this.#a++, this.#a === 1 && (this.#o = d.subscribe(async (e) => {
1721
- e && (await this.resumePausedMutations(), this.#e.onFocus());
1722
- }), this.#s = L.subscribe(async (e) => {
1723
- e && (await this.resumePausedMutations(), this.#e.onOnline());
1724
- }));
1725
- }
1726
- unmount() {
1727
- this.#a--, this.#a === 0 && (this.#o?.(), this.#o = void 0, this.#s?.(), this.#s = void 0);
1728
- }
1729
- isFetching(e) {
1730
- return this.#e.findAll({
1731
- ...e,
1732
- fetchStatus: "fetching"
1733
- }).length;
1734
- }
1735
- isMutating(e) {
1736
- return this.#t.findAll({
1737
- ...e,
1738
- status: "pending"
1739
- }).length;
1740
- }
1741
- getQueryData(e) {
1742
- let t = this.defaultQueryOptions({ queryKey: e });
1743
- return this.#e.get(t.queryHash)?.state.data;
1744
- }
1745
- ensureQueryData(e) {
1746
- let t = this.defaultQueryOptions(e), n = this.#e.build(this, t), r = n.state.data;
1747
- return r === void 0 ? this.fetchQuery(e) : (e.revalidateIfStale && n.isStaleByTime(b(t.staleTime, n)) && this.prefetchQuery(t), Promise.resolve(r));
1748
- }
1749
- getQueriesData(e) {
1750
- return this.#e.findAll(e).map(({ queryKey: e, state: t }) => [e, t.data]);
1751
- }
1752
- setQueryData(e, t, n) {
1753
- let r = this.defaultQueryOptions({ queryKey: e }), i = this.#e.get(r.queryHash)?.state.data, a = _(t, i);
1754
- if (a !== void 0) return this.#e.build(this, r).setData(a, {
1755
- ...n,
1756
- manual: !0
1757
- });
1758
- }
1759
- setQueriesData(e, t, n) {
1760
- return I.batch(() => this.#e.findAll(e).map(({ queryKey: e }) => [e, this.setQueryData(e, t, n)]));
1761
- }
1762
- getQueryState(e) {
1763
- let t = this.defaultQueryOptions({ queryKey: e });
1764
- return this.#e.get(t.queryHash)?.state;
1765
- }
1766
- removeQueries(e) {
1767
- let t = this.#e;
1768
- I.batch(() => {
1769
- t.findAll(e).forEach((e) => {
1770
- t.remove(e);
1771
- });
1772
- });
1773
- }
1774
- resetQueries(e, t) {
1775
- let n = this.#e;
1776
- return I.batch(() => (n.findAll(e).forEach((e) => {
1777
- e.reset();
1778
- }), this.refetchQueries({
1779
- type: "active",
1780
- ...e
1781
- }, t)));
1782
- }
1783
- cancelQueries(e, t = {}) {
1784
- let n = {
1785
- revert: !0,
1786
- ...t
1787
- }, r = I.batch(() => this.#e.findAll(e).map((e) => e.cancel(n)));
1788
- return Promise.all(r).then(g).catch(g);
1789
- }
1790
- invalidateQueries(e, t = {}) {
1791
- return I.batch(() => (this.#e.findAll(e).forEach((e) => {
1792
- e.invalidate();
1793
- }), e?.refetchType === "none" ? Promise.resolve() : this.refetchQueries({
1794
- ...e,
1795
- type: e?.refetchType ?? e?.type ?? "active"
1796
- }, t)));
1797
- }
1798
- refetchQueries(e, t = {}) {
1799
- let n = {
1800
- ...t,
1801
- cancelRefetch: t.cancelRefetch ?? !0
1802
- }, r = I.batch(() => this.#e.findAll(e).filter((e) => !e.isDisabled() && !e.isStatic()).map((e) => {
1803
- let t = e.fetch(void 0, n);
1804
- return n.throwOnError || (t = t.catch(g)), e.state.fetchStatus === "paused" ? Promise.resolve() : t;
1805
- }));
1806
- return Promise.all(r).then(g);
1807
- }
1808
- fetchQuery(e) {
1809
- let t = this.defaultQueryOptions(e);
1810
- t.retry === void 0 && (t.retry = !1);
1811
- let n = this.#e.build(this, t);
1812
- return n.isStaleByTime(b(t.staleTime, n)) ? n.fetch(t) : Promise.resolve(n.state.data);
1813
- }
1814
- prefetchQuery(e) {
1815
- return this.fetchQuery(e).then(g).catch(g);
1816
- }
1817
- fetchInfiniteQuery(e) {
1818
- return e._type = "infinite", this.fetchQuery(e);
1819
- }
1820
- prefetchInfiniteQuery(e) {
1821
- return this.fetchInfiniteQuery(e).then(g).catch(g);
1822
- }
1823
- ensureInfiniteQueryData(e) {
1824
- return e._type = "infinite", this.ensureQueryData(e);
1825
- }
1826
- resumePausedMutations() {
1827
- return L.isOnline() ? this.#t.resumePausedMutations() : Promise.resolve();
1828
- }
1829
- getQueryCache() {
1830
- return this.#e;
1831
- }
1832
- getMutationCache() {
1833
- return this.#t;
1834
- }
1835
- getDefaultOptions() {
1836
- return this.#n;
1837
- }
1838
- setDefaultOptions(e) {
1839
- this.#n = e;
1840
- }
1841
- setQueryDefaults(e, t) {
1842
- this.#r.set(T(e), {
1843
- queryKey: e,
1844
- defaultOptions: t
1845
- });
1846
- }
1847
- getQueryDefaults(e) {
1848
- let t = [...this.#r.values()], n = {};
1849
- return t.forEach((t) => {
1850
- E(e, t.queryKey) && Object.assign(n, t.defaultOptions);
1851
- }), n;
1852
- }
1853
- setMutationDefaults(e, t) {
1854
- this.#i.set(T(e), {
1855
- mutationKey: e,
1856
- defaultOptions: t
1857
- });
1858
- }
1859
- getMutationDefaults(e) {
1860
- let t = [...this.#i.values()], n = {};
1861
- return t.forEach((t) => {
1862
- E(e, t.mutationKey) && Object.assign(n, t.defaultOptions);
1863
- }), n;
1864
- }
1865
- defaultQueryOptions(e) {
1866
- if (e._defaulted) return e;
1867
- let t = {
1868
- ...this.#n.queries,
1869
- ...this.getQueryDefaults(e.queryKey),
1870
- ...e,
1871
- _defaulted: !0
1872
- };
1873
- return t.queryHash ||= w(t.queryKey, t), 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 === j && (t.enabled = !1), t;
1874
- }
1875
- defaultMutationOptions(e) {
1876
- return e?._defaulted ? e : {
1877
- ...this.#n.mutations,
1878
- ...e?.mutationKey && this.getMutationDefaults(e.mutationKey),
1879
- ...e,
1880
- _defaulted: !0
1881
- };
1882
- }
1883
- clear() {
1884
- this.#e.clear(), this.#t.clear();
1885
- }
1886
- };
1887
- //#endregion
1888
- //#region ../../node_modules/@tanstack/query-core/build/modern/streamedQuery.js
1889
- function We({ streamFn: e, refetchMode: t = "reset", reducer: n = (e, t) => ae(e, t), initialValue: r = [] }) {
1890
- return async (i) => {
1891
- let a = i.client.getQueryCache().find({
1892
- queryKey: i.queryKey,
1893
- exact: !0
1894
- }), o = !!a && a.isFetched();
1895
- o && t === "reset" && a.setState({
1896
- ...a.resetState,
1897
- fetchStatus: "fetching"
1898
- });
1899
- let s = r, c = !1, l = await e(ce({
1900
- client: i.client,
1901
- meta: i.meta,
1902
- queryKey: i.queryKey,
1903
- pageParam: i.pageParam,
1904
- direction: i.direction
1905
- }, () => i.signal, () => c = !0)), u = o && t === "replace";
1906
- for await (let e of l) {
1907
- if (c) break;
1908
- u ? s = n(s, e) : i.client.setQueryData(i.queryKey, (t) => n(t === void 0 ? r : t, e));
1909
- }
1910
- return u && !c && i.client.setQueryData(i.queryKey, s), i.client.getQueryData(i.queryKey) ?? r;
1911
- };
1912
- }
1913
- //#endregion
1914
- //#region ../../node_modules/@tanstack/query-core/build/modern/types.js
1915
- var Ge = /* @__PURE__ */ Symbol("dataTagSymbol"), Ke = /* @__PURE__ */ Symbol("dataTagErrorSymbol"), qe = /* @__PURE__ */ Symbol("unsetMarker");
1916
- //#endregion
1917
- //#region ../../node_modules/@tanstack/react-query/build/modern/QueryClientProvider.js
1918
- r();
1919
- var K = s(void 0), q = (t) => {
1920
- let n = e(K);
1921
- if (t) return t;
1922
- if (!n) throw Error("No QueryClient set, use QueryClientProvider to set one");
1923
- return n;
1924
- }, Je = ({ client: e, children: t }) => (o(() => (e.mount(), () => {
1925
- e.unmount();
1926
- }), [e]), /* @__PURE__ */ l(K.Provider, {
1927
- value: e,
1928
- children: t
1929
- }));
1930
- //#endregion
1931
- //#region ../../node_modules/@tanstack/react-query/build/modern/IsRestoringProvider.js
1932
- r();
1933
- var Ye = s(!1), J = () => e(Ye), Xe = Ye.Provider;
1934
- //#endregion
1935
- //#region ../../node_modules/@tanstack/react-query/build/modern/QueryErrorResetBoundary.js
1936
- r();
1937
- function Ze() {
1938
- let e = !1;
1939
- return {
1940
- clearReset: () => {
1941
- e = !1;
1942
- },
1943
- reset: () => {
1944
- e = !0;
1945
- },
1946
- isReset: () => e
1947
- };
1948
- }
1949
- var Qe = s(Ze()), Y = () => e(Qe), $e = ({ children: e }) => {
1950
- let [n] = t(() => Ze());
1951
- return /* @__PURE__ */ l(Qe.Provider, {
1952
- value: n,
1953
- children: typeof e == "function" ? e(n) : e
1954
- });
1955
- };
1956
- //#endregion
1957
- //#region ../../node_modules/@tanstack/react-query/build/modern/errorBoundaryUtils.js
1958
- r();
1959
- var et = (e, t, n) => {
1960
- let r = n?.state.error && typeof e.throwOnError == "function" ? M(e.throwOnError, [n.state.error, n]) : e.throwOnError;
1961
- (e.suspense || e.experimental_prefetchInRender || r) && (t.isReset() || (e.retryOnMount = !1));
1962
- }, tt = (e) => {
1963
- o(() => {
1964
- e.clearReset();
1965
- }, [e]);
1966
- }, nt = ({ result: e, errorResetBoundary: t, throwOnError: n, query: r, suspense: i }) => e.isError && !t.isReset() && !e.isFetching && r && (i && e.data === void 0 || M(n, [e.error, r])), X = (e, t) => t.state.data === void 0, rt = (e) => {
1967
- if (e.suspense) {
1968
- let t = 1e3, n = (e) => e === "static" ? e : Math.max(e ?? t, t), r = e.staleTime;
1969
- e.staleTime = typeof r == "function" ? (...e) => n(r(...e)) : n(r), typeof e.gcTime == "number" && (e.gcTime = Math.max(e.gcTime, t));
1970
- }
1971
- }, it = (e, t) => e.isLoading && e.isFetching && !t, Z = (e, t) => e?.suspense && t.isPending, Q = (e, t, n) => t.fetchOptimistic(e).catch(() => {
1972
- n.clearReset();
1973
- });
1974
- //#endregion
1975
- //#region ../../node_modules/@tanstack/react-query/build/modern/useQueries.js
1976
- r();
1977
- function at({ queries: e, ...r }, s) {
1978
- let c = q(s), l = J(), u = Y(), d = a(() => e.map((e) => {
1979
- let t = c.defaultQueryOptions(e);
1980
- return t._optimisticResults = l ? "isRestoring" : "optimistic", t;
1981
- }), [
1982
- e,
1983
- c,
1984
- l
1985
- ]);
1986
- d.forEach((e) => {
1987
- rt(e), et(e, u, c.getQueryCache().get(e.queryHash));
1988
- }), tt(u);
1989
- let [f] = t(() => new Ve(c, d, r)), [p, m, h] = f.getOptimisticResult(d, r.combine), _ = !l && r.subscribed !== !1;
1990
- n(i((e) => _ ? f.subscribe(I.batchCalls(e)) : g, [f, _]), () => f.getCurrentResult(), () => f.getCurrentResult()), o(() => {
1991
- f.setQueries(d, r);
1992
- }, [
1993
- d,
1994
- r,
1995
- f
1996
- ]);
1997
- let v = p.some((e, t) => Z(d[t], e)) ? p.flatMap((e, t) => {
1998
- let n = d[t];
1999
- return n && Z(n, e) ? Q(n, new B(c, n), u) : [];
2000
- }) : [];
2001
- if (v.length > 0) throw Promise.all(v);
2002
- let y = p.find((e, t) => {
2003
- let n = d[t];
2004
- return n && nt({
2005
- result: e,
2006
- errorResetBoundary: u,
2007
- throwOnError: n.throwOnError,
2008
- query: c.getQueryCache().get(n.queryHash),
2009
- suspense: n.suspense
2010
- });
2011
- });
2012
- if (y?.error) throw y.error;
2013
- return m(h());
2014
- }
2015
- //#endregion
2016
- //#region ../../node_modules/@tanstack/react-query/build/modern/useBaseQuery.js
2017
- r();
2018
- function $(e, r, a) {
2019
- let s = J(), c = Y(), l = q(a), u = l.defaultQueryOptions(e);
2020
- l.getDefaultOptions().queries?._experimental_beforeQuery?.(u);
2021
- let d = l.getQueryCache().get(u.queryHash);
2022
- u._optimisticResults = s ? "isRestoring" : "optimistic", rt(u), et(u, c, d), tt(c);
2023
- let f = !l.getQueryCache().get(u.queryHash), [p] = t(() => new r(l, u)), m = p.getOptimisticResult(u), h = !s && e.subscribed !== !1;
2024
- if (n(i((e) => {
2025
- let t = h ? p.subscribe(I.batchCalls(e)) : g;
2026
- return p.updateResult(), t;
2027
- }, [p, h]), () => p.getCurrentResult(), () => p.getCurrentResult()), o(() => {
2028
- p.setOptions(u);
2029
- }, [u, p]), Z(u, m)) throw Q(u, p, c);
2030
- if (nt({
2031
- result: m,
2032
- errorResetBoundary: c,
2033
- throwOnError: u.throwOnError,
2034
- query: d,
2035
- suspense: u.suspense
2036
- })) throw m.error;
2037
- return l.getDefaultOptions().queries?._experimental_afterQuery?.(u, m), u.experimental_prefetchInRender && !N.isServer() && it(m, s) && (f ? Q(u, p, c) : d?.promise)?.catch(g).finally(() => {
2038
- p.updateResult();
2039
- }), u.notifyOnChangeProps ? m : p.trackResult(m);
2040
- }
2041
- //#endregion
2042
- //#region ../../node_modules/@tanstack/react-query/build/modern/useQuery.js
2043
- function ot(e, t) {
2044
- return $(e, B, t);
2045
- }
2046
- //#endregion
2047
- //#region ../../node_modules/@tanstack/react-query/build/modern/useSuspenseQuery.js
2048
- function st(e, t) {
2049
- return $({
2050
- ...e,
2051
- enabled: !0,
2052
- suspense: !0,
2053
- throwOnError: X,
2054
- placeholderData: void 0
2055
- }, B, t);
2056
- }
2057
- //#endregion
2058
- //#region ../../node_modules/@tanstack/react-query/build/modern/useSuspenseInfiniteQuery.js
2059
- function ct(e, t) {
2060
- return $({
2061
- ...e,
2062
- enabled: !0,
2063
- suspense: !0,
2064
- throwOnError: X
2065
- }, W, t);
2066
- }
2067
- //#endregion
2068
- //#region ../../node_modules/@tanstack/react-query/build/modern/useSuspenseQueries.js
2069
- function lt(e, t) {
2070
- return at({
2071
- ...e,
2072
- queries: e.queries.map((e) => ({
2073
- ...e,
2074
- suspense: !0,
2075
- throwOnError: X,
2076
- enabled: !0,
2077
- placeholderData: void 0
2078
- }))
2079
- }, t);
2080
- }
2081
- //#endregion
2082
- //#region ../../node_modules/@tanstack/react-query/build/modern/usePrefetchQuery.js
2083
- function ut(e, t) {
2084
- let n = q(t);
2085
- n.getQueryState(e.queryKey) || n.prefetchQuery(e);
2086
- }
2087
- //#endregion
2088
- //#region ../../node_modules/@tanstack/react-query/build/modern/usePrefetchInfiniteQuery.js
2089
- function dt(e, t) {
2090
- let n = q(t);
2091
- n.getQueryState(e.queryKey) || n.prefetchInfiniteQuery(e);
2092
- }
2093
- //#endregion
2094
- //#region ../../node_modules/@tanstack/react-query/build/modern/queryOptions.js
2095
- function ft(e) {
2096
- return e;
2097
- }
2098
- //#endregion
2099
- //#region ../../node_modules/@tanstack/react-query/build/modern/infiniteQueryOptions.js
2100
- function pt(e) {
2101
- return e;
2102
- }
2103
- //#endregion
2104
- //#region ../../node_modules/@tanstack/react-query/build/modern/HydrationBoundary.js
2105
- r();
2106
- var mt = ({ children: e, options: t = {}, state: n, queryClient: r }) => {
2107
- let i = q(r), s = c(t);
2108
- o(() => {
2109
- s.current = t;
2110
- });
2111
- let l = a(() => {
2112
- if (n) {
2113
- if (typeof n != "object") return;
2114
- let e = i.getQueryCache(), t = n.queries || [], r = [], a = [];
2115
- for (let n of t) {
2116
- let t = e.get(n.queryHash);
2117
- t ? (n.state.dataUpdatedAt > t.state.dataUpdatedAt || n.promise && t.state.status !== "pending" && t.state.fetchStatus !== "fetching" && n.dehydratedAt !== void 0 && n.dehydratedAt > t.state.dataUpdatedAt) && a.push(n) : r.push(n);
2118
- }
2119
- if (r.length > 0 && F(i, { queries: r }, s.current), a.length > 0) return a;
2120
- }
2121
- }, [i, n]);
2122
- return o(() => {
2123
- l && F(i, { queries: l }, s.current);
2124
- }, [i, l]), e;
2125
- };
2126
- //#endregion
2127
- //#region ../../node_modules/@tanstack/react-query/build/modern/useIsFetching.js
2128
- r();
2129
- function ht(e, t) {
2130
- let r = q(t), a = r.getQueryCache();
2131
- return n(i((e) => a.subscribe(I.batchCalls(e)), [a]), () => r.isFetching(e), () => r.isFetching(e));
2132
- }
2133
- //#endregion
2134
- //#region ../../node_modules/@tanstack/react-query/build/modern/useMutationState.js
2135
- r();
2136
- function gt(e, t) {
2137
- let n = q(t);
2138
- return vt({ filters: {
2139
- ...e,
2140
- status: "pending"
2141
- } }, n).length;
2142
- }
2143
- function _t(e, t) {
2144
- return e.findAll(t.filters).map((e) => t.select ? t.select(e) : e.state);
2145
- }
2146
- function vt(e = {}, t) {
2147
- let r = q(t).getMutationCache(), a = c(e), s = c(null);
2148
- return s.current === null && (s.current = _t(r, e)), o(() => {
2149
- a.current = e;
2150
- }), n(i((e) => r.subscribe(() => {
2151
- let t = D(s.current, _t(r, a.current));
2152
- s.current !== t && (s.current = t, I.schedule(e));
2153
- }), [r]), () => s.current, () => s.current);
2154
- }
2155
- //#endregion
2156
- //#region ../../node_modules/@tanstack/react-query/build/modern/useMutation.js
2157
- r();
2158
- function yt(e, r) {
2159
- let a = q(r), [s] = t(() => new Re(a, e));
2160
- o(() => {
2161
- s.setOptions(e);
2162
- }, [s, e]);
2163
- let c = n(i((e) => s.subscribe(I.batchCalls(e)), [s]), () => s.getCurrentResult(), () => s.getCurrentResult()), l = i((e, t) => {
2164
- s.mutate(e, t).catch(g);
2165
- }, [s]);
2166
- if (c.error && M(s.options.throwOnError, [c.error])) throw c.error;
2167
- return {
2168
- ...c,
2169
- mutate: l,
2170
- mutateAsync: c.mutate
2171
- };
2172
- }
2173
- //#endregion
2174
- //#region ../../node_modules/@tanstack/react-query/build/modern/mutationOptions.js
2175
- function bt(e) {
2176
- return e;
2177
- }
2178
- //#endregion
2179
- //#region ../../node_modules/@tanstack/react-query/build/modern/useInfiniteQuery.js
2180
- function xt(e, t) {
2181
- return $(e, W, t);
2182
- }
2183
- //#endregion
2184
- export { R as CancelledError, mt as HydrationBoundary, W as InfiniteQueryObserver, Xe as IsRestoringProvider, Fe as Mutation, Le as MutationCache, Re as MutationObserver, Ve as QueriesObserver, Oe as Query, He as QueryCache, Ue as QueryClient, K as QueryClientContext, Je as QueryClientProvider, $e as QueryErrorResetBoundary, B as QueryObserver, Ke as dataTagErrorSymbol, Ge as dataTagSymbol, _e as defaultScheduler, pe as defaultShouldDehydrateMutation, me as defaultShouldDehydrateQuery, ge as dehydrate, N as environmentManager, We as experimental_streamedQuery, d as focusManager, T as hashKey, F as hydrate, pt as infiniteQueryOptions, xe as isCancelledError, h as isServer, ie as keepPreviousData, C as matchMutation, S as matchQuery, bt as mutationOptions, g as noop, I as notifyManager, L as onlineManager, E as partialMatchKey, ft as queryOptions, D as replaceEqualDeep, M as shouldThrowError, j as skipToken, p as timeoutManager, qe as unsetMarker, xt as useInfiniteQuery, ht as useIsFetching, gt as useIsMutating, J as useIsRestoring, yt as useMutation, vt as useMutationState, dt as usePrefetchInfiniteQuery, ut as usePrefetchQuery, at as useQueries, ot as useQuery, q as useQueryClient, Y as useQueryErrorResetBoundary, ct as useSuspenseInfiniteQuery, lt as useSuspenseQueries, st as useSuspenseQuery };