zudoku 0.0.0-eb5886a → 0.0.0-f114fe8

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 (131) hide show
  1. package/cli.js +2 -2
  2. package/dist/app/entry.client.js +2 -2
  3. package/dist/app/entry.client.js.map +1 -1
  4. package/dist/app/entry.server.js +0 -3
  5. package/dist/app/entry.server.js.map +1 -1
  6. package/dist/app/main.d.ts +0 -1
  7. package/dist/app/main.js +21 -6
  8. package/dist/app/main.js.map +1 -1
  9. package/dist/app/standalone.js.map +1 -1
  10. package/dist/cli/common/machine-id/lib.js.map +1 -1
  11. package/dist/cli/common/outdated.js.map +1 -1
  12. package/dist/cli/common/utils/box.js.map +1 -1
  13. package/dist/config/config.d.ts +1 -1
  14. package/dist/config/validators/SidebarSchema.d.ts +1 -1
  15. package/dist/config/validators/SidebarSchema.js +9 -5
  16. package/dist/config/validators/SidebarSchema.js.map +1 -1
  17. package/dist/config/validators/validate.d.ts +48 -62
  18. package/dist/config/validators/validate.js +5 -6
  19. package/dist/config/validators/validate.js.map +1 -1
  20. package/dist/index.d.ts +0 -3
  21. package/dist/index.js +1 -1
  22. package/dist/index.js.map +1 -1
  23. package/dist/lib/components/Header.js +1 -5
  24. package/dist/lib/components/Header.js.map +1 -1
  25. package/dist/lib/components/TopNavigation.js +4 -28
  26. package/dist/lib/components/TopNavigation.js.map +1 -1
  27. package/dist/lib/components/context/ZudokuContext.d.ts +12 -5
  28. package/dist/lib/components/context/ZudokuContext.js +20 -26
  29. package/dist/lib/components/context/ZudokuContext.js.map +1 -1
  30. package/dist/lib/components/index.d.ts +1 -1
  31. package/dist/lib/components/navigation/Sidebar.js +3 -3
  32. package/dist/lib/components/navigation/Sidebar.js.map +1 -1
  33. package/dist/lib/components/navigation/SidebarCategory.js +3 -1
  34. package/dist/lib/components/navigation/SidebarCategory.js.map +1 -1
  35. package/dist/lib/components/navigation/SidebarItem.js +3 -1
  36. package/dist/lib/components/navigation/SidebarItem.js.map +1 -1
  37. package/dist/lib/components/navigation/utils.js +14 -10
  38. package/dist/lib/components/navigation/utils.js.map +1 -1
  39. package/dist/lib/core/DevPortalContext.d.ts +6 -3
  40. package/dist/lib/core/DevPortalContext.js.map +1 -1
  41. package/dist/lib/core/plugins.d.ts +0 -1
  42. package/dist/lib/core/plugins.js.map +1 -1
  43. package/dist/lib/plugins/markdown/generateRoutes.d.ts +3 -0
  44. package/dist/lib/plugins/markdown/generateRoutes.js +21 -0
  45. package/dist/lib/plugins/markdown/generateRoutes.js.map +1 -0
  46. package/dist/lib/plugins/markdown/index.d.ts +6 -5
  47. package/dist/lib/plugins/markdown/index.js +3 -31
  48. package/dist/lib/plugins/markdown/index.js.map +1 -1
  49. package/dist/lib/plugins/openapi/Endpoint.js.map +1 -1
  50. package/dist/lib/plugins/openapi/RequestBodySidecarBox.js.map +1 -1
  51. package/dist/lib/plugins/openapi/Sidecar.js.map +1 -1
  52. package/dist/lib/plugins/openapi/client/worker.js.map +1 -1
  53. package/dist/lib/plugins/openapi/index.js.map +1 -1
  54. package/dist/lib/ui/Button.d.ts +1 -1
  55. package/dist/lib/util/MdxComponents.d.ts +1 -1
  56. package/dist/lib/util/useScrollToAnchor.js.map +1 -1
  57. package/dist/vite/plugin-config-reload.js.map +1 -1
  58. package/dist/vite/plugin-docs.js +13 -19
  59. package/dist/vite/plugin-docs.js.map +1 -1
  60. package/dist/vite/plugin-sidebar.js +2 -5
  61. package/dist/vite/plugin-sidebar.js.map +1 -1
  62. package/lib/{AuthenticationPlugin-BFO0iXPa.js → AuthenticationPlugin-Bx9FK124.js} +2 -2
  63. package/lib/{AuthenticationPlugin-BFO0iXPa.js.map → AuthenticationPlugin-Bx9FK124.js.map} +1 -1
  64. package/lib/{Input-B2qMWklW.js → Input-CtVUl3eT.js} +3 -3
  65. package/lib/{Input-B2qMWklW.js.map → Input-CtVUl3eT.js.map} +1 -1
  66. package/lib/{MdxPage-aE7f-Uli.js → MdxPage-BqBWsXZ1.js} +24 -25
  67. package/lib/{MdxPage-aE7f-Uli.js.map → MdxPage-BqBWsXZ1.js.map} +1 -1
  68. package/lib/{OperationList-BcfWM4ir.js → OperationList-CYrmxPa8.js} +4 -4
  69. package/lib/OperationList-CYrmxPa8.js.map +1 -0
  70. package/lib/{Route-DzTbXYJ8.js → Route-Q5mqNQrv.js} +2 -2
  71. package/lib/{Route-DzTbXYJ8.js.map → Route-Q5mqNQrv.js.map} +1 -1
  72. package/lib/{SidebarBadge-1Mv5r_Vo.js → SidebarBadge-Dx7jtnoA.js} +2 -2
  73. package/lib/{SidebarBadge-1Mv5r_Vo.js.map → SidebarBadge-Dx7jtnoA.js.map} +1 -1
  74. package/lib/ZudokuContext-cr-pTRY1.js +1084 -0
  75. package/lib/ZudokuContext-cr-pTRY1.js.map +1 -0
  76. package/lib/assets/worker-Bcj4NA2p.js.map +1 -1
  77. package/lib/{index-DrrYONSc.js → index-BlJ2rj99.js} +419 -416
  78. package/lib/index-BlJ2rj99.js.map +1 -0
  79. package/lib/{index-Bwy2Len1.js → index-BngPzhKn.js} +3 -3
  80. package/lib/{index-Bwy2Len1.js.map → index-BngPzhKn.js.map} +1 -1
  81. package/lib/{index-DtahPCcC.js → index-Dolisrci.js} +2 -2
  82. package/lib/{index-DtahPCcC.js.map → index-Dolisrci.js.map} +1 -1
  83. package/lib/joinPath-B7kNnUX4.js +8 -0
  84. package/lib/joinPath-B7kNnUX4.js.map +1 -0
  85. package/lib/{AnchorLink-CnXSVkGB.js → utils-ByIc_KIM.js} +275 -231
  86. package/lib/utils-ByIc_KIM.js.map +1 -0
  87. package/lib/zudoku.auth-clerk.js +1 -1
  88. package/lib/zudoku.auth-openid.js +1 -1
  89. package/lib/zudoku.components.js +735 -745
  90. package/lib/zudoku.components.js.map +1 -1
  91. package/lib/zudoku.plugin-api-keys.js +3 -3
  92. package/lib/zudoku.plugin-markdown.js +27 -93
  93. package/lib/zudoku.plugin-markdown.js.map +1 -1
  94. package/lib/zudoku.plugin-openapi.js +5 -4
  95. package/lib/zudoku.plugin-openapi.js.map +1 -1
  96. package/package.json +1 -1
  97. package/src/app/entry.client.tsx +2 -4
  98. package/src/app/entry.server.tsx +0 -4
  99. package/src/app/main.tsx +25 -9
  100. package/src/app/standalone.tsx +1 -1
  101. package/src/lib/components/Header.tsx +2 -10
  102. package/src/lib/components/TopNavigation.tsx +15 -47
  103. package/src/lib/components/context/ZudokuContext.ts +20 -34
  104. package/src/lib/components/navigation/Sidebar.tsx +5 -5
  105. package/src/lib/components/navigation/SidebarCategory.tsx +3 -1
  106. package/src/lib/components/navigation/SidebarItem.tsx +3 -1
  107. package/src/lib/components/navigation/utils.ts +16 -11
  108. package/src/lib/core/DevPortalContext.ts +2 -3
  109. package/src/lib/core/plugins.ts +0 -2
  110. package/src/lib/plugins/markdown/generateRoutes.tsx +38 -0
  111. package/src/lib/plugins/markdown/index.tsx +12 -49
  112. package/src/lib/plugins/openapi/Endpoint.tsx +2 -2
  113. package/src/lib/plugins/openapi/RequestBodySidecarBox.tsx +1 -1
  114. package/src/lib/plugins/openapi/Sidecar.tsx +1 -1
  115. package/src/lib/plugins/openapi/client/worker.ts +2 -2
  116. package/src/lib/plugins/openapi/index.tsx +1 -1
  117. package/src/lib/util/useScrollToAnchor.ts +1 -1
  118. package/dist/lib/plugins/markdown/resolver.d.ts +0 -38
  119. package/dist/lib/plugins/markdown/resolver.js +0 -75
  120. package/dist/lib/plugins/markdown/resolver.js.map +0 -1
  121. package/dist/vite/debug.d.ts +0 -1
  122. package/dist/vite/debug.js +0 -10
  123. package/dist/vite/debug.js.map +0 -1
  124. package/lib/AnchorLink-CnXSVkGB.js.map +0 -1
  125. package/lib/OperationList-BcfWM4ir.js.map +0 -1
  126. package/lib/ZudokuContext-CSrx4lfi.js +0 -1134
  127. package/lib/ZudokuContext-CSrx4lfi.js.map +0 -1
  128. package/lib/__vite-browser-external-BYRIRx8p.js +0 -9
  129. package/lib/__vite-browser-external-BYRIRx8p.js.map +0 -1
  130. package/lib/index-DrrYONSc.js.map +0 -1
  131. package/src/lib/plugins/markdown/resolver.ts +0 -92
@@ -1,1134 +0,0 @@
1
- var jt = (e) => {
2
- throw TypeError(e);
3
- };
4
- var dt = (e, t, s) => t.has(e) || jt("Cannot " + s);
5
- var i = (e, t, s) => (dt(e, t, "read from private field"), s ? s.call(e) : t.get(e)), f = (e, t, s) => t.has(e) ? jt("Cannot add the same private member more than once") : t instanceof WeakSet ? t.add(e) : t.set(e, s), l = (e, t, s, r) => (dt(e, t, "write to private field"), r ? r.call(e, s) : t.set(e, s), s), v = (e, t, s) => (dt(e, t, "access private method"), s);
6
- import * as I from "react";
7
- import { createContext as oe, useContext as ue } from "react";
8
- import { j as he } from "./jsx-runtime-B6kdoens.js";
9
- import { b as ct } from "./index-BG0g4WW0.js";
10
- var It = class {
11
- constructor() {
12
- this.listeners = /* @__PURE__ */ new Set(), this.subscribe = this.subscribe.bind(this);
13
- }
14
- subscribe(e) {
15
- return this.listeners.add(e), this.onSubscribe(), () => {
16
- this.listeners.delete(e), this.onUnsubscribe();
17
- };
18
- }
19
- hasListeners() {
20
- return this.listeners.size > 0;
21
- }
22
- onSubscribe() {
23
- }
24
- onUnsubscribe() {
25
- }
26
- }, rt = typeof window > "u" || "Deno" in globalThis;
27
- function yt() {
28
- }
29
- function _e(e, t) {
30
- return typeof e == "function" ? e(t) : e;
31
- }
32
- function pt(e) {
33
- return typeof e == "number" && e >= 0 && e !== 1 / 0;
34
- }
35
- function Vt(e, t) {
36
- return Math.max(e + (t || 0) - Date.now(), 0);
37
- }
38
- function ht(e, t) {
39
- return typeof e == "function" ? e(t) : e;
40
- }
41
- function T(e, t) {
42
- return typeof e == "function" ? e(t) : e;
43
- }
44
- function Be(e, t) {
45
- const {
46
- type: s = "all",
47
- exact: r,
48
- fetchStatus: n,
49
- predicate: h,
50
- queryKey: a,
51
- stale: u
52
- } = e;
53
- if (a) {
54
- if (r) {
55
- if (t.queryHash !== ce(a, t.options))
56
- return !1;
57
- } else if (!Ut(t.queryKey, a))
58
- return !1;
59
- }
60
- if (s !== "all") {
61
- const m = t.isActive();
62
- if (s === "active" && !m || s === "inactive" && m)
63
- return !1;
64
- }
65
- return !(typeof u == "boolean" && t.isStale() !== u || n && n !== t.state.fetchStatus || h && !h(t));
66
- }
67
- function Ge(e, t) {
68
- const { exact: s, status: r, predicate: n, mutationKey: h } = e;
69
- if (h) {
70
- if (!t.options.mutationKey)
71
- return !1;
72
- if (s) {
73
- if (vt(t.options.mutationKey) !== vt(h))
74
- return !1;
75
- } else if (!Ut(t.options.mutationKey, h))
76
- return !1;
77
- }
78
- return !(r && t.state.status !== r || n && !n(t));
79
- }
80
- function ce(e, t) {
81
- return ((t == null ? void 0 : t.queryKeyHashFn) || vt)(e);
82
- }
83
- function vt(e) {
84
- return JSON.stringify(
85
- e,
86
- (t, s) => mt(s) ? Object.keys(s).sort().reduce((r, n) => (r[n] = s[n], r), {}) : s
87
- );
88
- }
89
- function Ut(e, t) {
90
- return e === t ? !0 : typeof e != typeof t ? !1 : e && t && typeof e == "object" && typeof t == "object" ? !Object.keys(t).some((s) => !Ut(e[s], t[s])) : !1;
91
- }
92
- function $t(e, t) {
93
- if (e === t)
94
- return e;
95
- const s = xt(e) && xt(t);
96
- if (s || mt(e) && mt(t)) {
97
- const r = s ? e : Object.keys(e), n = r.length, h = s ? t : Object.keys(t), a = h.length, u = s ? [] : {};
98
- let m = 0;
99
- for (let S = 0; S < a; S++) {
100
- const b = s ? S : h[S];
101
- (!s && r.includes(b) || s) && e[b] === void 0 && t[b] === void 0 ? (u[b] = void 0, m++) : (u[b] = $t(e[b], t[b]), u[b] === e[b] && e[b] !== void 0 && m++);
102
- }
103
- return n === a && m === n ? e : u;
104
- }
105
- return t;
106
- }
107
- function bt(e, t) {
108
- if (!t || Object.keys(e).length !== Object.keys(t).length)
109
- return !1;
110
- for (const s in e)
111
- if (e[s] !== t[s])
112
- return !1;
113
- return !0;
114
- }
115
- function xt(e) {
116
- return Array.isArray(e) && e.length === Object.keys(e).length;
117
- }
118
- function mt(e) {
119
- if (!Lt(e))
120
- return !1;
121
- const t = e.constructor;
122
- if (t === void 0)
123
- return !0;
124
- const s = t.prototype;
125
- return !(!Lt(s) || !s.hasOwnProperty("isPrototypeOf") || Object.getPrototypeOf(e) !== Object.prototype);
126
- }
127
- function Lt(e) {
128
- return Object.prototype.toString.call(e) === "[object Object]";
129
- }
130
- function le(e) {
131
- return new Promise((t) => {
132
- setTimeout(t, e);
133
- });
134
- }
135
- function gt(e, t, s) {
136
- return typeof s.structuralSharing == "function" ? s.structuralSharing(e, t) : s.structuralSharing !== !1 ? $t(e, t) : t;
137
- }
138
- function He(e, t, s = 0) {
139
- const r = [...e, t];
140
- return s && r.length > s ? r.slice(1) : r;
141
- }
142
- function Ve(e, t, s = 0) {
143
- const r = [t, ...e];
144
- return s && r.length > s ? r.slice(0, -1) : r;
145
- }
146
- var St = Symbol(), de = (e, t) => (process.env.NODE_ENV !== "production" && e.queryFn === St && console.error(
147
- `Attempted to invoke queryFn when set to skipToken. This is likely a configuration error. Query hash: '${e.queryHash}'`
148
- ), !e.queryFn && (t != null && t.initialPromise) ? () => t.initialPromise : !e.queryFn || e.queryFn === St ? () => Promise.reject(new Error(`Missing queryFn: '${e.queryHash}'`)) : e.queryFn), N, x, z, Kt, fe = (Kt = class extends It {
149
- constructor() {
150
- super();
151
- f(this, N);
152
- f(this, x);
153
- f(this, z);
154
- l(this, z, (t) => {
155
- if (!rt && window.addEventListener) {
156
- const s = () => t();
157
- return window.addEventListener("visibilitychange", s, !1), () => {
158
- window.removeEventListener("visibilitychange", s);
159
- };
160
- }
161
- });
162
- }
163
- onSubscribe() {
164
- i(this, x) || this.setEventListener(i(this, z));
165
- }
166
- onUnsubscribe() {
167
- var t;
168
- this.hasListeners() || ((t = i(this, x)) == null || t.call(this), l(this, x, void 0));
169
- }
170
- setEventListener(t) {
171
- var s;
172
- l(this, z, t), (s = i(this, x)) == null || s.call(this), l(this, x, t((r) => {
173
- typeof r == "boolean" ? this.setFocused(r) : this.onFocus();
174
- }));
175
- }
176
- setFocused(t) {
177
- i(this, N) !== t && (l(this, N, t), this.onFocus());
178
- }
179
- onFocus() {
180
- const t = this.isFocused();
181
- this.listeners.forEach((s) => {
182
- s(t);
183
- });
184
- }
185
- isFocused() {
186
- var t;
187
- return typeof i(this, N) == "boolean" ? i(this, N) : ((t = globalThis.document) == null ? void 0 : t.visibilityState) !== "hidden";
188
- }
189
- }, N = new WeakMap(), x = new WeakMap(), z = new WeakMap(), Kt), zt = new fe(), W, L, Z, _t, ye = (_t = class extends It {
190
- constructor() {
191
- super();
192
- f(this, W, !0);
193
- f(this, L);
194
- f(this, Z);
195
- l(this, Z, (t) => {
196
- if (!rt && window.addEventListener) {
197
- const s = () => t(!0), r = () => t(!1);
198
- return window.addEventListener("online", s, !1), window.addEventListener("offline", r, !1), () => {
199
- window.removeEventListener("online", s), window.removeEventListener("offline", r);
200
- };
201
- }
202
- });
203
- }
204
- onSubscribe() {
205
- i(this, L) || this.setEventListener(i(this, Z));
206
- }
207
- onUnsubscribe() {
208
- var t;
209
- this.hasListeners() || ((t = i(this, L)) == null || t.call(this), l(this, L, void 0));
210
- }
211
- setEventListener(t) {
212
- var s;
213
- l(this, Z, t), (s = i(this, L)) == null || s.call(this), l(this, L, t(this.setOnline.bind(this)));
214
- }
215
- setOnline(t) {
216
- i(this, W) !== t && (l(this, W, t), this.listeners.forEach((r) => {
217
- r(t);
218
- }));
219
- }
220
- isOnline() {
221
- return i(this, W);
222
- }
223
- }, W = new WeakMap(), L = new WeakMap(), Z = new WeakMap(), _t), Wt = new ye();
224
- function pe(e) {
225
- return Math.min(1e3 * 2 ** e, 3e4);
226
- }
227
- function Zt(e) {
228
- return (e ?? "online") === "online" ? Wt.isOnline() : !0;
229
- }
230
- var Jt = class {
231
- constructor(e) {
232
- this.revert = e == null ? void 0 : e.revert, this.silent = e == null ? void 0 : e.silent;
233
- }
234
- };
235
- function ft(e) {
236
- return e instanceof Jt;
237
- }
238
- function ve(e) {
239
- let t = !1, s = 0, r = !1, n, h, a;
240
- const u = new Promise((g, R) => {
241
- h = g, a = R;
242
- }), m = (g) => {
243
- var R;
244
- r || (F(new Jt(g)), (R = e.abort) == null || R.call(e));
245
- }, S = () => {
246
- t = !0;
247
- }, b = () => {
248
- t = !1;
249
- }, o = () => zt.isFocused() && (e.networkMode === "always" || Wt.isOnline()) && e.canRun(), c = () => Zt(e.networkMode) && e.canRun(), p = (g) => {
250
- var R;
251
- r || (r = !0, (R = e.onSuccess) == null || R.call(e, g), n == null || n(), h(g));
252
- }, F = (g) => {
253
- var R;
254
- r || (r = !0, (R = e.onError) == null || R.call(e, g), n == null || n(), a(g));
255
- }, U = () => new Promise((g) => {
256
- var R;
257
- n = (P) => {
258
- (r || o()) && g(P);
259
- }, (R = e.onPause) == null || R.call(e);
260
- }).then(() => {
261
- var g;
262
- n = void 0, r || (g = e.onContinue) == null || g.call(e);
263
- }), A = () => {
264
- if (r)
265
- return;
266
- let g;
267
- const R = s === 0 ? e.initialPromise : void 0;
268
- try {
269
- g = R ?? e.fn();
270
- } catch (P) {
271
- g = Promise.reject(P);
272
- }
273
- Promise.resolve(g).then(p).catch((P) => {
274
- var w;
275
- if (r)
276
- return;
277
- const j = e.retry ?? (rt ? 0 : 3), $ = e.retryDelay ?? pe, qt = typeof $ == "function" ? $(s, P) : $, ut = j === !0 || typeof j == "number" && s < j || typeof j == "function" && j(s, P);
278
- if (t || !ut) {
279
- F(P);
280
- return;
281
- }
282
- s++, (w = e.onFail) == null || w.call(e, s, P), le(qt).then(() => o() ? void 0 : U()).then(() => {
283
- t ? F(P) : A();
284
- });
285
- });
286
- };
287
- return {
288
- promise: u,
289
- cancel: m,
290
- continue: () => (n == null || n(), u),
291
- cancelRetry: S,
292
- continueRetry: b,
293
- canStart: c,
294
- start: () => (c() ? A() : U().then(A), u)
295
- };
296
- }
297
- function be() {
298
- let e = [], t = 0, s = (c) => {
299
- c();
300
- }, r = (c) => {
301
- c();
302
- }, n = (c) => setTimeout(c, 0);
303
- const h = (c) => {
304
- n = c;
305
- }, a = (c) => {
306
- let p;
307
- t++;
308
- try {
309
- p = c();
310
- } finally {
311
- t--, t || S();
312
- }
313
- return p;
314
- }, u = (c) => {
315
- t ? e.push(c) : n(() => {
316
- s(c);
317
- });
318
- }, m = (c) => (...p) => {
319
- u(() => {
320
- c(...p);
321
- });
322
- }, S = () => {
323
- const c = e;
324
- e = [], c.length && n(() => {
325
- r(() => {
326
- c.forEach((p) => {
327
- s(p);
328
- });
329
- });
330
- });
331
- };
332
- return {
333
- batch: a,
334
- batchCalls: m,
335
- schedule: u,
336
- setNotifyFunction: (c) => {
337
- s = c;
338
- },
339
- setBatchNotifyFunction: (c) => {
340
- r = c;
341
- },
342
- setScheduler: h
343
- };
344
- }
345
- var At = be(), K, Bt, me = (Bt = class {
346
- constructor() {
347
- f(this, K);
348
- }
349
- destroy() {
350
- this.clearGcTimeout();
351
- }
352
- scheduleGc() {
353
- this.clearGcTimeout(), pt(this.gcTime) && l(this, K, setTimeout(() => {
354
- this.optionalRemove();
355
- }, this.gcTime));
356
- }
357
- updateGcTime(e) {
358
- this.gcTime = Math.max(
359
- this.gcTime || 0,
360
- e ?? (rt ? 1 / 0 : 5 * 60 * 1e3)
361
- );
362
- }
363
- clearGcTimeout() {
364
- i(this, K) && (clearTimeout(i(this, K)), l(this, K, void 0));
365
- }
366
- }, K = new WeakMap(), Bt), J, X, D, C, nt, _, Q, q, Gt, $e = (Gt = class extends me {
367
- constructor(t) {
368
- super();
369
- f(this, Q);
370
- f(this, J);
371
- f(this, X);
372
- f(this, D);
373
- f(this, C);
374
- f(this, nt);
375
- f(this, _);
376
- l(this, _, !1), l(this, nt, t.defaultOptions), this.setOptions(t.options), this.observers = [], l(this, D, t.cache), this.queryKey = t.queryKey, this.queryHash = t.queryHash, l(this, J, t.state || ge(this.options)), this.state = i(this, J), this.scheduleGc();
377
- }
378
- get meta() {
379
- return this.options.meta;
380
- }
381
- get promise() {
382
- var t;
383
- return (t = i(this, C)) == null ? void 0 : t.promise;
384
- }
385
- setOptions(t) {
386
- this.options = { ...i(this, nt), ...t }, this.updateGcTime(this.options.gcTime);
387
- }
388
- optionalRemove() {
389
- !this.observers.length && this.state.fetchStatus === "idle" && i(this, D).remove(this);
390
- }
391
- setData(t, s) {
392
- const r = gt(this.state.data, t, this.options);
393
- return v(this, Q, q).call(this, {
394
- data: r,
395
- type: "success",
396
- dataUpdatedAt: s == null ? void 0 : s.updatedAt,
397
- manual: s == null ? void 0 : s.manual
398
- }), r;
399
- }
400
- setState(t, s) {
401
- v(this, Q, q).call(this, { type: "setState", state: t, setStateOptions: s });
402
- }
403
- cancel(t) {
404
- var r, n;
405
- const s = (r = i(this, C)) == null ? void 0 : r.promise;
406
- return (n = i(this, C)) == null || n.cancel(t), s ? s.then(yt).catch(yt) : Promise.resolve();
407
- }
408
- destroy() {
409
- super.destroy(), this.cancel({ silent: !0 });
410
- }
411
- reset() {
412
- this.destroy(), this.setState(i(this, J));
413
- }
414
- isActive() {
415
- return this.observers.some(
416
- (t) => T(t.options.enabled, this) !== !1
417
- );
418
- }
419
- isDisabled() {
420
- return this.getObserversCount() > 0 && !this.isActive();
421
- }
422
- isStale() {
423
- return this.state.isInvalidated ? !0 : this.getObserversCount() > 0 ? this.observers.some(
424
- (t) => t.getCurrentResult().isStale
425
- ) : this.state.data === void 0;
426
- }
427
- isStaleByTime(t = 0) {
428
- return this.state.isInvalidated || this.state.data === void 0 || !Vt(this.state.dataUpdatedAt, t);
429
- }
430
- onFocus() {
431
- var s;
432
- const t = this.observers.find((r) => r.shouldFetchOnWindowFocus());
433
- t == null || t.refetch({ cancelRefetch: !1 }), (s = i(this, C)) == null || s.continue();
434
- }
435
- onOnline() {
436
- var s;
437
- const t = this.observers.find((r) => r.shouldFetchOnReconnect());
438
- t == null || t.refetch({ cancelRefetch: !1 }), (s = i(this, C)) == null || s.continue();
439
- }
440
- addObserver(t) {
441
- this.observers.includes(t) || (this.observers.push(t), this.clearGcTimeout(), i(this, D).notify({ type: "observerAdded", query: this, observer: t }));
442
- }
443
- removeObserver(t) {
444
- this.observers.includes(t) && (this.observers = this.observers.filter((s) => s !== t), this.observers.length || (i(this, C) && (i(this, _) ? i(this, C).cancel({ revert: !0 }) : i(this, C).cancelRetry()), this.scheduleGc()), i(this, D).notify({ type: "observerRemoved", query: this, observer: t }));
445
- }
446
- getObserversCount() {
447
- return this.observers.length;
448
- }
449
- invalidate() {
450
- this.state.isInvalidated || v(this, Q, q).call(this, { type: "invalidate" });
451
- }
452
- fetch(t, s) {
453
- var m, S, b;
454
- if (this.state.fetchStatus !== "idle") {
455
- if (this.state.data !== void 0 && (s != null && s.cancelRefetch))
456
- this.cancel({ silent: !0 });
457
- else if (i(this, C))
458
- return i(this, C).continueRetry(), i(this, C).promise;
459
- }
460
- if (t && this.setOptions(t), !this.options.queryFn) {
461
- const o = this.observers.find((c) => c.options.queryFn);
462
- o && this.setOptions(o.options);
463
- }
464
- process.env.NODE_ENV !== "production" && (Array.isArray(this.options.queryKey) || console.error(
465
- "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']"
466
- ));
467
- const r = new AbortController(), n = (o) => {
468
- Object.defineProperty(o, "signal", {
469
- enumerable: !0,
470
- get: () => (l(this, _, !0), r.signal)
471
- });
472
- }, h = () => {
473
- const o = de(this.options, s), c = {
474
- queryKey: this.queryKey,
475
- meta: this.meta
476
- };
477
- return n(c), l(this, _, !1), this.options.persister ? this.options.persister(
478
- o,
479
- c,
480
- this
481
- ) : o(c);
482
- }, a = {
483
- fetchOptions: s,
484
- options: this.options,
485
- queryKey: this.queryKey,
486
- state: this.state,
487
- fetchFn: h
488
- };
489
- n(a), (m = this.options.behavior) == null || m.onFetch(
490
- a,
491
- this
492
- ), l(this, X, this.state), (this.state.fetchStatus === "idle" || this.state.fetchMeta !== ((S = a.fetchOptions) == null ? void 0 : S.meta)) && v(this, Q, q).call(this, { type: "fetch", meta: (b = a.fetchOptions) == null ? void 0 : b.meta });
493
- const u = (o) => {
494
- var c, p, F, U;
495
- ft(o) && o.silent || v(this, Q, q).call(this, {
496
- type: "error",
497
- error: o
498
- }), ft(o) || ((p = (c = i(this, D).config).onError) == null || p.call(
499
- c,
500
- o,
501
- this
502
- ), (U = (F = i(this, D).config).onSettled) == null || U.call(
503
- F,
504
- this.state.data,
505
- o,
506
- this
507
- )), this.isFetchingOptimistic || this.scheduleGc(), this.isFetchingOptimistic = !1;
508
- };
509
- return l(this, C, ve({
510
- initialPromise: s == null ? void 0 : s.initialPromise,
511
- fn: a.fetchFn,
512
- abort: r.abort.bind(r),
513
- onSuccess: (o) => {
514
- var c, p, F, U;
515
- if (o === void 0) {
516
- process.env.NODE_ENV !== "production" && console.error(
517
- `Query data cannot be undefined. Please make sure to return a value other than undefined from your query function. Affected query key: ${this.queryHash}`
518
- ), u(new Error(`${this.queryHash} data is undefined`));
519
- return;
520
- }
521
- this.setData(o), (p = (c = i(this, D).config).onSuccess) == null || p.call(c, o, this), (U = (F = i(this, D).config).onSettled) == null || U.call(
522
- F,
523
- o,
524
- this.state.error,
525
- this
526
- ), this.isFetchingOptimistic || this.scheduleGc(), this.isFetchingOptimistic = !1;
527
- },
528
- onError: u,
529
- onFail: (o, c) => {
530
- v(this, Q, q).call(this, { type: "failed", failureCount: o, error: c });
531
- },
532
- onPause: () => {
533
- v(this, Q, q).call(this, { type: "pause" });
534
- },
535
- onContinue: () => {
536
- v(this, Q, q).call(this, { type: "continue" });
537
- },
538
- retry: a.options.retry,
539
- retryDelay: a.options.retryDelay,
540
- networkMode: a.options.networkMode,
541
- canRun: () => !0
542
- })), i(this, C).start();
543
- }
544
- }, J = new WeakMap(), X = new WeakMap(), D = new WeakMap(), C = new WeakMap(), nt = new WeakMap(), _ = new WeakMap(), Q = new WeakSet(), q = function(t) {
545
- const s = (r) => {
546
- switch (t.type) {
547
- case "failed":
548
- return {
549
- ...r,
550
- fetchFailureCount: t.failureCount,
551
- fetchFailureReason: t.error
552
- };
553
- case "pause":
554
- return {
555
- ...r,
556
- fetchStatus: "paused"
557
- };
558
- case "continue":
559
- return {
560
- ...r,
561
- fetchStatus: "fetching"
562
- };
563
- case "fetch":
564
- return {
565
- ...r,
566
- ...Xt(r.data, this.options),
567
- fetchMeta: t.meta ?? null
568
- };
569
- case "success":
570
- return {
571
- ...r,
572
- data: t.data,
573
- dataUpdateCount: r.dataUpdateCount + 1,
574
- dataUpdatedAt: t.dataUpdatedAt ?? Date.now(),
575
- error: null,
576
- isInvalidated: !1,
577
- status: "success",
578
- ...!t.manual && {
579
- fetchStatus: "idle",
580
- fetchFailureCount: 0,
581
- fetchFailureReason: null
582
- }
583
- };
584
- case "error":
585
- const n = t.error;
586
- return ft(n) && n.revert && i(this, X) ? { ...i(this, X), fetchStatus: "idle" } : {
587
- ...r,
588
- error: n,
589
- errorUpdateCount: r.errorUpdateCount + 1,
590
- errorUpdatedAt: Date.now(),
591
- fetchFailureCount: r.fetchFailureCount + 1,
592
- fetchFailureReason: n,
593
- fetchStatus: "idle",
594
- status: "error"
595
- };
596
- case "invalidate":
597
- return {
598
- ...r,
599
- isInvalidated: !0
600
- };
601
- case "setState":
602
- return {
603
- ...r,
604
- ...t.state
605
- };
606
- }
607
- };
608
- this.state = s(this.state), At.batch(() => {
609
- this.observers.forEach((r) => {
610
- r.onQueryUpdate();
611
- }), i(this, D).notify({ query: this, type: "updated", action: t });
612
- });
613
- }, Gt);
614
- function Xt(e, t) {
615
- return {
616
- fetchFailureCount: 0,
617
- fetchFailureReason: null,
618
- fetchStatus: Zt(t.networkMode) ? "fetching" : "paused",
619
- ...e === void 0 && {
620
- error: null,
621
- status: "pending"
622
- }
623
- };
624
- }
625
- function ge(e) {
626
- 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;
627
- return {
628
- data: t,
629
- dataUpdateCount: 0,
630
- dataUpdatedAt: s ? r ?? Date.now() : 0,
631
- error: null,
632
- errorUpdateCount: 0,
633
- errorUpdatedAt: 0,
634
- fetchFailureCount: 0,
635
- fetchFailureReason: null,
636
- fetchMeta: null,
637
- isInvalidated: !1,
638
- status: s ? "success" : "pending",
639
- fetchStatus: "idle"
640
- };
641
- }
642
- var E, d, at, O, B, Y, k, ot, tt, et, G, H, M, st, y, it, Rt, Ct, wt, Ot, Ft, Et, Pt, te, Ht, Yt = (Ht = class extends It {
643
- constructor(t, s) {
644
- super();
645
- f(this, y);
646
- f(this, E);
647
- f(this, d);
648
- f(this, at);
649
- f(this, O);
650
- f(this, B);
651
- f(this, Y);
652
- f(this, k);
653
- f(this, ot);
654
- f(this, tt);
655
- // This property keeps track of the last query with defined data.
656
- // It will be used to pass the previous data and query to the placeholder function between renders.
657
- f(this, et);
658
- f(this, G);
659
- f(this, H);
660
- f(this, M);
661
- f(this, st, /* @__PURE__ */ new Set());
662
- this.options = s, l(this, E, t), l(this, k, null), this.bindMethods(), this.setOptions(s);
663
- }
664
- bindMethods() {
665
- this.refetch = this.refetch.bind(this);
666
- }
667
- onSubscribe() {
668
- this.listeners.size === 1 && (i(this, d).addObserver(this), Mt(i(this, d), this.options) ? v(this, y, it).call(this) : this.updateResult(), v(this, y, Ot).call(this));
669
- }
670
- onUnsubscribe() {
671
- this.hasListeners() || this.destroy();
672
- }
673
- shouldFetchOnReconnect() {
674
- return Dt(
675
- i(this, d),
676
- this.options,
677
- this.options.refetchOnReconnect
678
- );
679
- }
680
- shouldFetchOnWindowFocus() {
681
- return Dt(
682
- i(this, d),
683
- this.options,
684
- this.options.refetchOnWindowFocus
685
- );
686
- }
687
- destroy() {
688
- this.listeners = /* @__PURE__ */ new Set(), v(this, y, Ft).call(this), v(this, y, Et).call(this), i(this, d).removeObserver(this);
689
- }
690
- setOptions(t, s) {
691
- const r = this.options, n = i(this, d);
692
- if (this.options = i(this, E).defaultQueryOptions(t), this.options.enabled !== void 0 && typeof this.options.enabled != "boolean" && typeof this.options.enabled != "function" && typeof T(this.options.enabled, i(this, d)) != "boolean")
693
- throw new Error(
694
- "Expected enabled to be a boolean or a callback that returns a boolean"
695
- );
696
- v(this, y, Pt).call(this), i(this, d).setOptions(this.options), r._defaulted && !bt(this.options, r) && i(this, E).getQueryCache().notify({
697
- type: "observerOptionsUpdated",
698
- query: i(this, d),
699
- observer: this
700
- });
701
- const h = this.hasListeners();
702
- h && Nt(
703
- i(this, d),
704
- n,
705
- this.options,
706
- r
707
- ) && v(this, y, it).call(this), this.updateResult(s), h && (i(this, d) !== n || T(this.options.enabled, i(this, d)) !== T(r.enabled, i(this, d)) || ht(this.options.staleTime, i(this, d)) !== ht(r.staleTime, i(this, d))) && v(this, y, Rt).call(this);
708
- const a = v(this, y, Ct).call(this);
709
- h && (i(this, d) !== n || T(this.options.enabled, i(this, d)) !== T(r.enabled, i(this, d)) || a !== i(this, M)) && v(this, y, wt).call(this, a);
710
- }
711
- getOptimisticResult(t) {
712
- const s = i(this, E).getQueryCache().build(i(this, E), t), r = this.createResult(s, t);
713
- return Re(this, r) && (l(this, O, r), l(this, Y, this.options), l(this, B, i(this, d).state)), r;
714
- }
715
- getCurrentResult() {
716
- return i(this, O);
717
- }
718
- trackResult(t, s) {
719
- const r = {};
720
- return Object.keys(t).forEach((n) => {
721
- Object.defineProperty(r, n, {
722
- configurable: !1,
723
- enumerable: !0,
724
- get: () => (this.trackProp(n), s == null || s(n), t[n])
725
- });
726
- }), r;
727
- }
728
- trackProp(t) {
729
- i(this, st).add(t);
730
- }
731
- getCurrentQuery() {
732
- return i(this, d);
733
- }
734
- refetch({ ...t } = {}) {
735
- return this.fetch({
736
- ...t
737
- });
738
- }
739
- fetchOptimistic(t) {
740
- const s = i(this, E).defaultQueryOptions(t), r = i(this, E).getQueryCache().build(i(this, E), s);
741
- return r.isFetchingOptimistic = !0, r.fetch().then(() => this.createResult(r, s));
742
- }
743
- fetch(t) {
744
- return v(this, y, it).call(this, {
745
- ...t,
746
- cancelRefetch: t.cancelRefetch ?? !0
747
- }).then(() => (this.updateResult(), i(this, O)));
748
- }
749
- createResult(t, s) {
750
- var ut;
751
- const r = i(this, d), n = this.options, h = i(this, O), a = i(this, B), u = i(this, Y), S = t !== r ? t.state : i(this, at), { state: b } = t;
752
- let o = { ...b }, c = !1, p;
753
- if (s._optimisticResults) {
754
- const w = this.hasListeners(), lt = !w && Mt(t, s), ae = w && Nt(t, r, s, n);
755
- (lt || ae) && (o = {
756
- ...o,
757
- ...Xt(b.data, t.options)
758
- }), s._optimisticResults === "isRestoring" && (o.fetchStatus = "idle");
759
- }
760
- let { error: F, errorUpdatedAt: U, status: A } = o;
761
- if (s.select && o.data !== void 0)
762
- if (h && o.data === (a == null ? void 0 : a.data) && s.select === i(this, ot))
763
- p = i(this, tt);
764
- else
765
- try {
766
- l(this, ot, s.select), p = s.select(o.data), p = gt(h == null ? void 0 : h.data, p, s), l(this, tt, p), l(this, k, null);
767
- } catch (w) {
768
- l(this, k, w);
769
- }
770
- else
771
- p = o.data;
772
- if (s.placeholderData !== void 0 && p === void 0 && A === "pending") {
773
- let w;
774
- if (h != null && h.isPlaceholderData && s.placeholderData === (u == null ? void 0 : u.placeholderData))
775
- w = h.data;
776
- else if (w = typeof s.placeholderData == "function" ? s.placeholderData(
777
- (ut = i(this, et)) == null ? void 0 : ut.state.data,
778
- i(this, et)
779
- ) : s.placeholderData, s.select && w !== void 0)
780
- try {
781
- w = s.select(w), l(this, k, null);
782
- } catch (lt) {
783
- l(this, k, lt);
784
- }
785
- w !== void 0 && (A = "success", p = gt(
786
- h == null ? void 0 : h.data,
787
- w,
788
- s
789
- ), c = !0);
790
- }
791
- i(this, k) && (F = i(this, k), p = i(this, tt), U = Date.now(), A = "error");
792
- const g = o.fetchStatus === "fetching", R = A === "pending", P = A === "error", j = R && g, $ = p !== void 0;
793
- return {
794
- status: A,
795
- fetchStatus: o.fetchStatus,
796
- isPending: R,
797
- isSuccess: A === "success",
798
- isError: P,
799
- isInitialLoading: j,
800
- isLoading: j,
801
- data: p,
802
- dataUpdatedAt: o.dataUpdatedAt,
803
- error: F,
804
- errorUpdatedAt: U,
805
- failureCount: o.fetchFailureCount,
806
- failureReason: o.fetchFailureReason,
807
- errorUpdateCount: o.errorUpdateCount,
808
- isFetched: o.dataUpdateCount > 0 || o.errorUpdateCount > 0,
809
- isFetchedAfterMount: o.dataUpdateCount > S.dataUpdateCount || o.errorUpdateCount > S.errorUpdateCount,
810
- isFetching: g,
811
- isRefetching: g && !R,
812
- isLoadingError: P && !$,
813
- isPaused: o.fetchStatus === "paused",
814
- isPlaceholderData: c,
815
- isRefetchError: P && $,
816
- isStale: Qt(t, s),
817
- refetch: this.refetch
818
- };
819
- }
820
- updateResult(t) {
821
- const s = i(this, O), r = this.createResult(i(this, d), this.options);
822
- if (l(this, B, i(this, d).state), l(this, Y, this.options), i(this, B).data !== void 0 && l(this, et, i(this, d)), bt(r, s))
823
- return;
824
- l(this, O, r);
825
- const n = {}, h = () => {
826
- if (!s)
827
- return !0;
828
- const { notifyOnChangeProps: a } = this.options, u = typeof a == "function" ? a() : a;
829
- if (u === "all" || !u && !i(this, st).size)
830
- return !0;
831
- const m = new Set(
832
- u ?? i(this, st)
833
- );
834
- return this.options.throwOnError && m.add("error"), Object.keys(i(this, O)).some((S) => {
835
- const b = S;
836
- return i(this, O)[b] !== s[b] && m.has(b);
837
- });
838
- };
839
- (t == null ? void 0 : t.listeners) !== !1 && h() && (n.listeners = !0), v(this, y, te).call(this, { ...n, ...t });
840
- }
841
- onQueryUpdate() {
842
- this.updateResult(), this.hasListeners() && v(this, y, Ot).call(this);
843
- }
844
- }, E = new WeakMap(), d = new WeakMap(), at = new WeakMap(), O = new WeakMap(), B = new WeakMap(), Y = new WeakMap(), k = new WeakMap(), ot = new WeakMap(), tt = new WeakMap(), et = new WeakMap(), G = new WeakMap(), H = new WeakMap(), M = new WeakMap(), st = new WeakMap(), y = new WeakSet(), it = function(t) {
845
- v(this, y, Pt).call(this);
846
- let s = i(this, d).fetch(
847
- this.options,
848
- t
849
- );
850
- return t != null && t.throwOnError || (s = s.catch(yt)), s;
851
- }, Rt = function() {
852
- v(this, y, Ft).call(this);
853
- const t = ht(
854
- this.options.staleTime,
855
- i(this, d)
856
- );
857
- if (rt || i(this, O).isStale || !pt(t))
858
- return;
859
- const r = Vt(i(this, O).dataUpdatedAt, t) + 1;
860
- l(this, G, setTimeout(() => {
861
- i(this, O).isStale || this.updateResult();
862
- }, r));
863
- }, Ct = function() {
864
- return (typeof this.options.refetchInterval == "function" ? this.options.refetchInterval(i(this, d)) : this.options.refetchInterval) ?? !1;
865
- }, wt = function(t) {
866
- v(this, y, Et).call(this), l(this, M, t), !(rt || T(this.options.enabled, i(this, d)) === !1 || !pt(i(this, M)) || i(this, M) === 0) && l(this, H, setInterval(() => {
867
- (this.options.refetchIntervalInBackground || zt.isFocused()) && v(this, y, it).call(this);
868
- }, i(this, M)));
869
- }, Ot = function() {
870
- v(this, y, Rt).call(this), v(this, y, wt).call(this, v(this, y, Ct).call(this));
871
- }, Ft = function() {
872
- i(this, G) && (clearTimeout(i(this, G)), l(this, G, void 0));
873
- }, Et = function() {
874
- i(this, H) && (clearInterval(i(this, H)), l(this, H, void 0));
875
- }, Pt = function() {
876
- const t = i(this, E).getQueryCache().build(i(this, E), this.options);
877
- if (t === i(this, d))
878
- return;
879
- const s = i(this, d);
880
- l(this, d, t), l(this, at, t.state), this.hasListeners() && (s == null || s.removeObserver(this), t.addObserver(this));
881
- }, te = function(t) {
882
- At.batch(() => {
883
- t.listeners && this.listeners.forEach((s) => {
884
- s(i(this, O));
885
- }), i(this, E).getQueryCache().notify({
886
- query: i(this, d),
887
- type: "observerResultsUpdated"
888
- });
889
- });
890
- }, Ht);
891
- function Se(e, t) {
892
- return T(t.enabled, e) !== !1 && e.state.data === void 0 && !(e.state.status === "error" && t.retryOnMount === !1);
893
- }
894
- function Mt(e, t) {
895
- return Se(e, t) || e.state.data !== void 0 && Dt(e, t, t.refetchOnMount);
896
- }
897
- function Dt(e, t, s) {
898
- if (T(t.enabled, e) !== !1) {
899
- const r = typeof s == "function" ? s(e) : s;
900
- return r === "always" || r !== !1 && Qt(e, t);
901
- }
902
- return !1;
903
- }
904
- function Nt(e, t, s, r) {
905
- return (e !== t || T(r.enabled, e) === !1) && (!s.suspense || e.state.status !== "error") && Qt(e, s);
906
- }
907
- function Qt(e, t) {
908
- return T(t.enabled, e) !== !1 && e.isStaleByTime(ht(t.staleTime, e));
909
- }
910
- function Re(e, t) {
911
- return !bt(e.getCurrentResult(), t);
912
- }
913
- var ee = I.createContext(
914
- void 0
915
- ), Ce = (e) => {
916
- const t = I.useContext(ee);
917
- if (!t)
918
- throw new Error("No QueryClient set, use QueryClientProvider to set one");
919
- return t;
920
- }, ze = ({
921
- client: e,
922
- children: t
923
- }) => (I.useEffect(() => (e.mount(), () => {
924
- e.unmount();
925
- }), [e]), /* @__PURE__ */ he.jsx(ee.Provider, { value: e, children: t })), se = I.createContext(!1), we = () => I.useContext(se);
926
- se.Provider;
927
- function Oe() {
928
- let e = !1;
929
- return {
930
- clearReset: () => {
931
- e = !1;
932
- },
933
- reset: () => {
934
- e = !0;
935
- },
936
- isReset: () => e
937
- };
938
- }
939
- var Fe = I.createContext(Oe()), Ee = () => I.useContext(Fe);
940
- function Pe(e, t) {
941
- return typeof e == "function" ? e(...t) : !!e;
942
- }
943
- function We() {
944
- }
945
- var De = (e, t) => {
946
- (e.suspense || e.throwOnError) && (t.isReset() || (e.retryOnMount = !1));
947
- }, Ie = (e) => {
948
- I.useEffect(() => {
949
- e.clearReset();
950
- }, [e]);
951
- }, Ue = ({
952
- result: e,
953
- errorResetBoundary: t,
954
- throwOnError: s,
955
- query: r
956
- }) => e.isError && !t.isReset() && !e.isFetching && r && Pe(s, [e.error, r]), Ae = (e, t) => t.state.data === void 0, Qe = (e) => {
957
- e.suspense && typeof e.staleTime != "number" && (e.staleTime = 1e3);
958
- }, Te = (e, t) => (e == null ? void 0 : e.suspense) && t.isPending, ke = (e, t, s) => t.fetchOptimistic(e).catch(() => {
959
- s.clearReset();
960
- });
961
- function re(e, t, s) {
962
- var S, b, o, c;
963
- if (process.env.NODE_ENV !== "production" && (typeof e != "object" || Array.isArray(e)))
964
- throw new Error(
965
- 'Bad argument type. Starting with v5, only the "Object" form is allowed when calling query related functions. Please use the error stack to find the culprit call. More info here: https://tanstack.com/query/latest/docs/react/guides/migrating-to-v5#supports-a-single-signature-one-object'
966
- );
967
- const r = Ce(), n = we(), h = Ee(), a = r.defaultQueryOptions(e);
968
- (b = (S = r.getDefaultOptions().queries) == null ? void 0 : S._experimental_beforeQuery) == null || b.call(
969
- S,
970
- a
971
- ), a._optimisticResults = n ? "isRestoring" : "optimistic", Qe(a), De(a, h), Ie(h);
972
- const [u] = I.useState(
973
- () => new t(
974
- r,
975
- a
976
- )
977
- ), m = u.getOptimisticResult(a);
978
- if (I.useSyncExternalStore(
979
- I.useCallback(
980
- (p) => {
981
- const F = n ? () => {
982
- } : u.subscribe(At.batchCalls(p));
983
- return u.updateResult(), F;
984
- },
985
- [u, n]
986
- ),
987
- () => u.getCurrentResult(),
988
- () => u.getCurrentResult()
989
- ), I.useEffect(() => {
990
- u.setOptions(a, { listeners: !1 });
991
- }, [a, u]), Te(a, m))
992
- throw ke(a, u, h);
993
- if (Ue({
994
- result: m,
995
- errorResetBoundary: h,
996
- throwOnError: a.throwOnError,
997
- query: r.getQueryCache().get(a.queryHash)
998
- }))
999
- throw m.error;
1000
- return (c = (o = r.getDefaultOptions().queries) == null ? void 0 : o._experimental_afterQuery) == null || c.call(
1001
- o,
1002
- a,
1003
- m
1004
- ), a.notifyOnChangeProps ? m : u.trackResult(m);
1005
- }
1006
- function qe(e, t) {
1007
- return re(e, Yt);
1008
- }
1009
- function je(e, t) {
1010
- return process.env.NODE_ENV !== "production" && e.queryFn === St && console.error("skipToken is not allowed for useSuspenseQuery"), re(
1011
- {
1012
- ...e,
1013
- enabled: !0,
1014
- suspense: !0,
1015
- throwOnError: Ae,
1016
- placeholderData: void 0
1017
- },
1018
- Yt
1019
- );
1020
- }
1021
- const V = (...e) => {
1022
- const t = e.filter((s) => !!s).map((s) => s.replace(/(^\/+|\/+$)/g, "")).join("/").replace(/(^\/+|\/+$)/g, "");
1023
- return t ? `/${t}` : "/";
1024
- }, Tt = (e, t) => {
1025
- for (const s of e) {
1026
- const r = kt(s, t);
1027
- if (r !== void 0) return r;
1028
- }
1029
- }, kt = (e, t, s = []) => {
1030
- const r = t(e, s);
1031
- if (r !== void 0) return r;
1032
- if (e.type === "category")
1033
- for (const n of e.items) {
1034
- const h = kt(n, t, [
1035
- ...s,
1036
- e
1037
- ]);
1038
- if (h !== void 0) return h;
1039
- }
1040
- }, Ze = () => {
1041
- const e = ct(), s = ne().data.sidebar;
1042
- return Tt(s, (r) => {
1043
- if (r.type === "doc" && V(r.id) === e.pathname)
1044
- return r;
1045
- });
1046
- }, Je = (e) => {
1047
- const t = ct();
1048
- return kt(e, (s) => {
1049
- if (s.type === "category" && s.link && V(s.link.id) === t.pathname || s.type === "doc" && V(s.id) === t.pathname)
1050
- return !0;
1051
- });
1052
- }, Xe = () => {
1053
- const e = ct().pathname, s = ne().data.sidebar;
1054
- let r, n, h = !1;
1055
- return Tt(s, (a) => {
1056
- const u = a.type === "doc" ? V(a.id) : a.type === "category" && a.link ? V(a.link.id) : void 0;
1057
- if (u) {
1058
- if (h)
1059
- return n = { label: a.label, id: u }, !0;
1060
- e === u ? h = !0 : r = { label: a.label, id: u };
1061
- }
1062
- }), { prev: r, next: n };
1063
- }, xe = oe(
1064
- void 0
1065
- ), ie = () => {
1066
- const e = ue(xe);
1067
- if (!e)
1068
- throw new Error("useDevPortal must be used within a DevPortalProvider.");
1069
- return e;
1070
- }, Ye = () => {
1071
- const { getApiIdentities: e } = ie();
1072
- return qe({
1073
- queryFn: e,
1074
- queryKey: ["api-identities"]
1075
- });
1076
- }, ne = () => {
1077
- const { getPluginSidebar: e, sidebars: t, topNavigation: s } = ie(), r = ct(), n = Object.entries(t).find(([, a]) => Tt(a, (u) => {
1078
- if ((u.type === "doc" ? V(u.id) : u.type === "category" && u.link ? V(u.link.id) : void 0) === r.pathname)
1079
- return u;
1080
- })), h = s.find(
1081
- (a) => a.id === (n == null ? void 0 : n[0])
1082
- );
1083
- return je({
1084
- queryFn: async () => {
1085
- const a = await e(r.pathname);
1086
- return {
1087
- sidebar: [
1088
- ...n ? n[1] : [],
1089
- ...a
1090
- ],
1091
- topNavItem: h
1092
- };
1093
- },
1094
- queryKey: ["navigation", r.pathname]
1095
- });
1096
- };
1097
- export {
1098
- ze as A,
1099
- Je as B,
1100
- ve as C,
1101
- Ye as D,
1102
- qe as E,
1103
- $e as Q,
1104
- me as R,
1105
- It as S,
1106
- xe as Z,
1107
- Xe as a,
1108
- ie as b,
1109
- Ce as c,
1110
- je as d,
1111
- We as e,
1112
- Pe as f,
1113
- ce as g,
1114
- vt as h,
1115
- Ge as i,
1116
- yt as j,
1117
- de as k,
1118
- Ve as l,
1119
- Be as m,
1120
- At as n,
1121
- He as o,
1122
- zt as p,
1123
- Wt as q,
1124
- ht as r,
1125
- bt as s,
1126
- _e as t,
1127
- Ze as u,
1128
- Ut as v,
1129
- St as w,
1130
- V as x,
1131
- ne as y,
1132
- Tt as z
1133
- };
1134
- //# sourceMappingURL=ZudokuContext-CSrx4lfi.js.map