@nside/wefa 0.4.4 → 0.4.5

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 (139) hide show
  1. package/README.md +1 -1
  2. package/dist/LegalConsent-BxOWAO0s.js +126 -0
  3. package/dist/LegalConsent-ChW-GYBv.cjs +1 -0
  4. package/dist/LegalDocument-BM4HLw9A.js +1580 -0
  5. package/dist/LegalDocument-hhYW9BBO.cjs +114 -0
  6. package/dist/LoginView-BpDNpbMQ.cjs +1 -0
  7. package/dist/LoginView-bUKvV6JV.js +17 -0
  8. package/dist/LogoutView-BrAt0b2J.js +16 -0
  9. package/dist/LogoutView-D7D3LcfL.cjs +1 -0
  10. package/dist/angledown-DgMf_Vjv.cjs +2 -0
  11. package/dist/angledown-igq2UW-u.js +46 -0
  12. package/dist/badge-2r_VjcsG.js +102 -0
  13. package/dist/badge-DPwocFJ8.cjs +76 -0
  14. package/dist/basecomponent-CGerMr_k.cjs +146 -0
  15. package/dist/basecomponent-CRTLSsqZ.js +1278 -0
  16. package/dist/baseeditableholder-BEn83TQE.js +126 -0
  17. package/dist/baseeditableholder-Q1_XheNU.cjs +1 -0
  18. package/dist/baseicon-Ct8wtBEp.cjs +34 -0
  19. package/dist/baseicon-DdvhP0UT.js +90 -0
  20. package/dist/baseinput-B6KUYtrd.js +37 -0
  21. package/dist/baseinput-D8710HSg.cjs +1 -0
  22. package/dist/bff/openapi.yaml +7 -0
  23. package/dist/button-M3QREAcT.cjs +651 -0
  24. package/dist/button-xI3Wu15Z.js +311 -0
  25. package/dist/calendar-B8nJAQne.js +2891 -0
  26. package/dist/calendar-CW9WbT3C.cjs +477 -0
  27. package/dist/card-BXosepCe.js +57 -0
  28. package/dist/card-Db30JagR.cjs +32 -0
  29. package/dist/check-BYTdkWQh.js +46 -0
  30. package/dist/check-D4kxzECF.cjs +2 -0
  31. package/dist/checkbox-BIDoCr_X.cjs +142 -0
  32. package/dist/checkbox-TAWN7HJG.js +323 -0
  33. package/dist/chevrondown-DLIH6sRy.cjs +2 -0
  34. package/dist/chevrondown-v3qKRLEG.js +46 -0
  35. package/dist/chevronleft-DMbyAEgw.cjs +2 -0
  36. package/dist/chevronleft-dQlHS1Vs.js +46 -0
  37. package/dist/chevronright-B3qtGWZb.js +46 -0
  38. package/dist/chevronright-BisalZVe.cjs +2 -0
  39. package/dist/chip-CBoKYRL5.js +107 -0
  40. package/dist/chip-CLwNi1p_.cjs +54 -0
  41. package/dist/chunk-BK-Lzi7j.cjs +1 -0
  42. package/dist/chunk-DgQ9yJBH.js +17 -0
  43. package/dist/classnames-4RuV7Ryo.js +19 -0
  44. package/dist/classnames-DqVQ5xbt.cjs +1 -0
  45. package/dist/containers.cjs +23 -26
  46. package/dist/containers.d.ts +0 -116
  47. package/dist/containers.js +4476 -5541
  48. package/dist/focustrap-BhHF6zvb.js +558 -0
  49. package/dist/focustrap-C_v0dFmU.cjs +152 -0
  50. package/dist/inputnumber-CvuB8fHc.cjs +195 -0
  51. package/dist/inputnumber-UfGZdwk2.js +983 -0
  52. package/dist/inputtext-B-iUN1cV.js +108 -0
  53. package/dist/inputtext-D2Ay4aYr.cjs +79 -0
  54. package/dist/legalConsent-B3erdrHX.cjs +1 -0
  55. package/dist/legalConsent-kc_KWyR6.js +66 -0
  56. package/dist/lib.cjs +1331 -1
  57. package/dist/lib.d.ts +0 -728
  58. package/dist/lib.js +22977 -35
  59. package/dist/locales-4eL4-K7f.js +3168 -0
  60. package/dist/locales-DzyBr_JU.cjs +5 -0
  61. package/dist/markdown-Cb6J3R4j.js +28 -0
  62. package/dist/markdown-Dxqg6Ggd.cjs +1 -0
  63. package/dist/network-DD_yGfK6.js +2404 -0
  64. package/dist/network-uPe9-HeS.cjs +9 -0
  65. package/dist/network.cjs +1 -1
  66. package/dist/network.d.ts +0 -103
  67. package/dist/network.js +2 -48
  68. package/dist/portal-BbZw4bN9.js +265 -0
  69. package/dist/portal-pIcEXWz1.cjs +2 -0
  70. package/dist/{index-EDm9-cRY.cjs → progressbar-BPR5tRX7.cjs} +2 -2
  71. package/dist/progressbar-CzckKCUr.js +96 -0
  72. package/dist/rating-DsIxcJXU.js +332 -0
  73. package/dist/rating-HfRWRXuI.cjs +61 -0
  74. package/dist/ripple-CoTE8rF8.js +501 -0
  75. package/dist/ripple-UYfqtU0m.cjs +24 -0
  76. package/dist/router-CR-sxf1q.js +34 -0
  77. package/dist/router-qXH6kffG.cjs +1 -0
  78. package/dist/router.cjs +1 -1
  79. package/dist/router.d.ts +0 -54
  80. package/dist/router.js +2 -16
  81. package/dist/select-C05BBcmi.js +2357 -0
  82. package/dist/select-CZouTpLB.cjs +360 -0
  83. package/dist/stores-BAbCgIKW.cjs +1 -0
  84. package/dist/stores-C5CUNzM_.js +203 -0
  85. package/dist/textarea-DUmMHVXf.cjs +84 -0
  86. package/dist/textarea-f6-j7m1N.js +131 -0
  87. package/dist/times--t6-zeg6.js +46 -0
  88. package/dist/times-GcOHYs3E.cjs +2 -0
  89. package/dist/timescircle-CHGzPrwL.cjs +2 -0
  90. package/dist/timescircle-_NJIsGD1.js +48 -0
  91. package/dist/wefa.css +2 -1
  92. package/package.json +36 -34
  93. package/src/components/DashboardComponent/DashboardGroupComponent.vue +1 -1
  94. package/src/components/NetworkButton/__tests__/ApiMutationButton.test.ts +12 -3
  95. package/src/components/NetworkButton/__tests__/ApiQueryButton.test.ts +12 -3
  96. package/src/containers/LayoutContainer/SideNavigationComponent/MainComponent/NavigationLinkComponent.vue +1 -1
  97. package/src/containers/SideMenuContainer/SideMenuContainer.vue +14 -3
  98. package/src/containers/helpers.ts +1 -1
  99. package/src/router/guards.ts +2 -2
  100. package/src/stores/__tests__/backend/jwt.test.ts +6 -6
  101. package/src/stores/__tests__/backend/oauth.test.ts +1 -1
  102. package/src/stores/__tests__/backend/token.test.ts +5 -5
  103. package/src/stores/backend/schemes/jwt.ts +3 -3
  104. package/src/stores/backend/schemes/token.ts +6 -7
  105. package/dist/LegalConsent-DQ7fkgVc.cjs +0 -1
  106. package/dist/LegalConsent-OLyvuzRY.js +0 -151
  107. package/dist/LegalDocument-B-nntRW7.cjs +0 -109
  108. package/dist/LegalDocument-BKebNzIK.js +0 -1330
  109. package/dist/LoginView-DUPa_PsC.js +0 -24
  110. package/dist/LoginView-Dihs8n_X.cjs +0 -1
  111. package/dist/LogoutView-DAh7MrFi.js +0 -19
  112. package/dist/LogoutView-Fl3nfeJ0.cjs +0 -1
  113. package/dist/apiClient-BHDjT0dU.js +0 -928
  114. package/dist/apiClient-Cr0IvG5Z.cjs +0 -1
  115. package/dist/axios-CZvsFspN.js +0 -1887
  116. package/dist/axios-DMqeKDaq.cjs +0 -6
  117. package/dist/index--_rUTrqU.js +0 -1414
  118. package/dist/index-05ASaj7N.cjs +0 -477
  119. package/dist/index-B7hJ2pku.cjs +0 -61
  120. package/dist/index-BHSxFTgZ.js +0 -49
  121. package/dist/index-BaA_oL1s.cjs +0 -32
  122. package/dist/index-Be5h48vc.js +0 -3530
  123. package/dist/index-Becfy0pF.cjs +0 -2
  124. package/dist/index-CPv4agmV.js +0 -400
  125. package/dist/index-CgAb-gZi.js +0 -89
  126. package/dist/index-DFSkcsx-.cjs +0 -943
  127. package/dist/index-DGUVQqZw.js +0 -208
  128. package/dist/index-DRozw3P8.js +0 -167
  129. package/dist/index-DfCQoHSf.cjs +0 -146
  130. package/dist/index-DkuJMEY1.js +0 -6731
  131. package/dist/index-Dv6jyKbT.js +0 -47
  132. package/dist/index-IGN7_cyg.cjs +0 -2
  133. package/dist/index-lFl6UsTa.js +0 -212
  134. package/dist/index-lQmq7gxp.cjs +0 -54
  135. package/dist/index-t0sdL3f2.cjs +0 -84
  136. package/dist/lib-DZzubLGt.js +0 -26376
  137. package/dist/lib-lTzD7ltX.cjs +0 -2104
  138. package/dist/libRoutes-B-H3e9wZ.js +0 -22
  139. package/dist/libRoutes-Cl3TklhN.cjs +0 -1
@@ -1,928 +0,0 @@
1
- import { isRef as X, unref as ht, hasInjectionContext as lt, inject as ft, getCurrentScope as G, computed as tt, shallowReactive as et, reactive as st, watch as w, onScopeDispose as it, shallowReadonly as nt, readonly as rt, toRefs as ot } from "vue";
2
- import { a as at } from "./axios-CZvsFspN.js";
3
- var M = class {
4
- constructor() {
5
- this.listeners = /* @__PURE__ */ new Set(), this.subscribe = this.subscribe.bind(this);
6
- }
7
- subscribe(t) {
8
- return this.listeners.add(t), this.onSubscribe(), () => {
9
- this.listeners.delete(t), this.onUnsubscribe();
10
- };
11
- }
12
- hasListeners() {
13
- return this.listeners.size > 0;
14
- }
15
- onSubscribe() {
16
- }
17
- onUnsubscribe() {
18
- }
19
- }, dt = class extends M {
20
- #e;
21
- #t;
22
- #s;
23
- constructor() {
24
- super(), this.#s = (t) => {
25
- if (typeof window < "u" && window.addEventListener) {
26
- const e = () => t();
27
- return window.addEventListener("visibilitychange", e, !1), () => {
28
- window.removeEventListener("visibilitychange", e);
29
- };
30
- }
31
- };
32
- }
33
- onSubscribe() {
34
- this.#t || this.setEventListener(this.#s);
35
- }
36
- onUnsubscribe() {
37
- this.hasListeners() || (this.#t?.(), this.#t = void 0);
38
- }
39
- setEventListener(t) {
40
- this.#s = t, this.#t?.(), this.#t = t((e) => {
41
- typeof e == "boolean" ? this.setFocused(e) : this.onFocus();
42
- });
43
- }
44
- setFocused(t) {
45
- this.#e !== t && (this.#e = t, this.onFocus());
46
- }
47
- onFocus() {
48
- const t = this.isFocused();
49
- this.listeners.forEach((e) => {
50
- e(t);
51
- });
52
- }
53
- isFocused() {
54
- return typeof this.#e == "boolean" ? this.#e : globalThis.document?.visibilityState !== "hidden";
55
- }
56
- }, pt = new dt(), vt = {
57
- // We need the wrapper function syntax below instead of direct references to
58
- // global setTimeout etc.
59
- //
60
- // BAD: `setTimeout: setTimeout`
61
- // GOOD: `setTimeout: (cb, delay) => setTimeout(cb, delay)`
62
- //
63
- // If we use direct references here, then anything that wants to spy on or
64
- // replace the global setTimeout (like tests) won't work since we'll already
65
- // have a hard reference to the original implementation at the time when this
66
- // file was imported.
67
- setTimeout: (t, e) => setTimeout(t, e),
68
- clearTimeout: (t) => clearTimeout(t),
69
- setInterval: (t, e) => setInterval(t, e),
70
- clearInterval: (t) => clearInterval(t)
71
- }, bt = class {
72
- // We cannot have TimeoutManager<T> as we must instantiate it with a concrete
73
- // type at app boot; and if we leave that type, then any new timer provider
74
- // would need to support the default provider's concrete timer ID, which is
75
- // infeasible across environments.
76
- //
77
- // We settle for type safety for the TimeoutProvider type, and accept that
78
- // this class is unsafe internally to allow for extension.
79
- #e = vt;
80
- #t = !1;
81
- setTimeoutProvider(t) {
82
- process.env.NODE_ENV !== "production" && this.#t && t !== this.#e && console.error(
83
- "[timeoutManager]: Switching provider after calls to previous provider might result in unexpected behavior.",
84
- { previous: this.#e, provider: t }
85
- ), this.#e = t, process.env.NODE_ENV !== "production" && (this.#t = !1);
86
- }
87
- setTimeout(t, e) {
88
- return process.env.NODE_ENV !== "production" && (this.#t = !0), this.#e.setTimeout(t, e);
89
- }
90
- clearTimeout(t) {
91
- this.#e.clearTimeout(t);
92
- }
93
- setInterval(t, e) {
94
- return process.env.NODE_ENV !== "production" && (this.#t = !0), this.#e.setInterval(t, e);
95
- }
96
- clearInterval(t) {
97
- this.#e.clearInterval(t);
98
- }
99
- }, T = new bt();
100
- function yt(t) {
101
- setTimeout(t, 0);
102
- }
103
- var mt = typeof window > "u" || "Deno" in globalThis;
104
- function gt() {
105
- }
106
- function q(t) {
107
- return typeof t == "number" && t >= 0 && t !== 1 / 0;
108
- }
109
- function Ot(t, e) {
110
- return Math.max(t + (e || 0) - Date.now(), 0);
111
- }
112
- function E(t, e) {
113
- return typeof t == "function" ? t(e) : t;
114
- }
115
- function b(t, e) {
116
- return typeof t == "function" ? t(e) : t;
117
- }
118
- function z(t) {
119
- return JSON.stringify(
120
- t,
121
- (e, s) => Q(s) ? Object.keys(s).sort().reduce((n, i) => (n[i] = s[i], n), {}) : s
122
- );
123
- }
124
- var wt = Object.prototype.hasOwnProperty;
125
- function L(t, e, s = 0) {
126
- if (t === e)
127
- return t;
128
- if (s > 500) return e;
129
- const n = $(t) && $(e);
130
- if (!n && !(Q(t) && Q(e))) return e;
131
- const r = (n ? t : Object.keys(t)).length, h = n ? e : Object.keys(e), o = h.length, l = n ? new Array(o) : {};
132
- let y = 0;
133
- for (let a = 0; a < o; a++) {
134
- const p = n ? a : h[a], c = t[p], u = e[p];
135
- if (c === u) {
136
- l[p] = c, (n ? a < r : wt.call(t, p)) && y++;
137
- continue;
138
- }
139
- if (c === null || u === null || typeof c != "object" || typeof u != "object") {
140
- l[p] = u;
141
- continue;
142
- }
143
- const f = L(c, u, s + 1);
144
- l[p] = f, f === c && y++;
145
- }
146
- return r === o && y === r ? t : l;
147
- }
148
- function P(t, e) {
149
- if (!e || Object.keys(t).length !== Object.keys(e).length)
150
- return !1;
151
- for (const s in t)
152
- if (t[s] !== e[s])
153
- return !1;
154
- return !0;
155
- }
156
- function $(t) {
157
- return Array.isArray(t) && t.length === Object.keys(t).length;
158
- }
159
- function Q(t) {
160
- if (!W(t))
161
- return !1;
162
- const e = t.constructor;
163
- if (e === void 0)
164
- return !0;
165
- const s = e.prototype;
166
- return !(!W(s) || !s.hasOwnProperty("isPrototypeOf") || Object.getPrototypeOf(t) !== Object.prototype);
167
- }
168
- function W(t) {
169
- return Object.prototype.toString.call(t) === "[object Object]";
170
- }
171
- function B(t, e, s) {
172
- if (typeof s.structuralSharing == "function")
173
- return s.structuralSharing(t, e);
174
- if (s.structuralSharing !== !1) {
175
- if (process.env.NODE_ENV !== "production")
176
- try {
177
- return L(t, e);
178
- } catch (n) {
179
- throw console.error(
180
- `Structural sharing requires data to be JSON serializable. To fix this, turn off structuralSharing or return JSON-serializable data from your queryFn. [${s.queryHash}]: ${n}`
181
- ), n;
182
- }
183
- return L(t, e);
184
- }
185
- return e;
186
- }
187
- function U(t, e) {
188
- return typeof t == "function" ? t(...e) : !!t;
189
- }
190
- var H = /* @__PURE__ */ (() => {
191
- let t = () => mt;
192
- return {
193
- /**
194
- * Returns whether the current runtime should be treated as a server environment.
195
- */
196
- isServer() {
197
- return t();
198
- },
199
- /**
200
- * Overrides the server check globally.
201
- */
202
- setIsServer(e) {
203
- t = e;
204
- }
205
- };
206
- })();
207
- function J() {
208
- let t, e;
209
- const s = new Promise((i, r) => {
210
- t = i, e = r;
211
- });
212
- s.status = "pending", s.catch(() => {
213
- });
214
- function n(i) {
215
- Object.assign(s, i), delete s.resolve, delete s.reject;
216
- }
217
- return s.resolve = (i) => {
218
- n({
219
- status: "fulfilled",
220
- value: i
221
- }), t(i);
222
- }, s.reject = (i) => {
223
- n({
224
- status: "rejected",
225
- reason: i
226
- }), e(i);
227
- }, s;
228
- }
229
- var Rt = yt;
230
- function St() {
231
- let t = [], e = 0, s = (o) => {
232
- o();
233
- }, n = (o) => {
234
- o();
235
- }, i = Rt;
236
- const r = (o) => {
237
- e ? t.push(o) : i(() => {
238
- s(o);
239
- });
240
- }, h = () => {
241
- const o = t;
242
- t = [], o.length && i(() => {
243
- n(() => {
244
- o.forEach((l) => {
245
- s(l);
246
- });
247
- });
248
- });
249
- };
250
- return {
251
- batch: (o) => {
252
- let l;
253
- e++;
254
- try {
255
- l = o();
256
- } finally {
257
- e--, e || h();
258
- }
259
- return l;
260
- },
261
- /**
262
- * All calls to the wrapped function will be batched.
263
- */
264
- batchCalls: (o) => (...l) => {
265
- r(() => {
266
- o(...l);
267
- });
268
- },
269
- schedule: r,
270
- /**
271
- * Use this method to set a custom notify function.
272
- * This can be used to for example wrap notifications with `React.act` while running tests.
273
- */
274
- setNotifyFunction: (o) => {
275
- s = o;
276
- },
277
- /**
278
- * Use this method to set a custom function to batch notifications together into a single tick.
279
- * By default React Query will use the batch function provided by ReactDOM or React Native.
280
- */
281
- setBatchNotifyFunction: (o) => {
282
- n = o;
283
- },
284
- setScheduler: (o) => {
285
- i = o;
286
- }
287
- };
288
- }
289
- var ut = St(), Et = class extends M {
290
- #e = !0;
291
- #t;
292
- #s;
293
- constructor() {
294
- super(), this.#s = (t) => {
295
- if (typeof window < "u" && window.addEventListener) {
296
- const e = () => t(!0), s = () => t(!1);
297
- return window.addEventListener("online", e, !1), window.addEventListener("offline", s, !1), () => {
298
- window.removeEventListener("online", e), window.removeEventListener("offline", s);
299
- };
300
- }
301
- };
302
- }
303
- onSubscribe() {
304
- this.#t || this.setEventListener(this.#s);
305
- }
306
- onUnsubscribe() {
307
- this.hasListeners() || (this.#t?.(), this.#t = void 0);
308
- }
309
- setEventListener(t) {
310
- this.#s = t, this.#t?.(), this.#t = t(this.setOnline.bind(this));
311
- }
312
- setOnline(t) {
313
- this.#e !== t && (this.#e = t, this.listeners.forEach((s) => {
314
- s(t);
315
- }));
316
- }
317
- isOnline() {
318
- return this.#e;
319
- }
320
- }, Ct = new Et();
321
- function jt(t) {
322
- return (t ?? "online") === "online" ? Ct.isOnline() : !0;
323
- }
324
- function It(t, e) {
325
- return {
326
- fetchFailureCount: 0,
327
- fetchFailureReason: null,
328
- fetchStatus: jt(e.networkMode) ? "fetching" : "paused",
329
- ...t === void 0 && {
330
- error: null,
331
- status: "pending"
332
- }
333
- };
334
- }
335
- var Ft = class extends M {
336
- constructor(t, e) {
337
- super(), this.options = e, this.#e = t, this.#a = null, this.#o = J(), this.bindMethods(), this.setOptions(e);
338
- }
339
- #e;
340
- #t = void 0;
341
- #s = void 0;
342
- #i = void 0;
343
- #n;
344
- #r;
345
- #o;
346
- #a;
347
- #v;
348
- #f;
349
- // This property keeps track of the last query with defined data.
350
- // It will be used to pass the previous data and query to the placeholder function between renders.
351
- #d;
352
- #c;
353
- #h;
354
- #u;
355
- #p = /* @__PURE__ */ new Set();
356
- bindMethods() {
357
- this.refetch = this.refetch.bind(this);
358
- }
359
- onSubscribe() {
360
- this.listeners.size === 1 && (this.#t.addObserver(this), Y(this.#t, this.options) ? this.#l() : this.updateResult(), this.#g());
361
- }
362
- onUnsubscribe() {
363
- this.hasListeners() || this.destroy();
364
- }
365
- shouldFetchOnReconnect() {
366
- return x(
367
- this.#t,
368
- this.options,
369
- this.options.refetchOnReconnect
370
- );
371
- }
372
- shouldFetchOnWindowFocus() {
373
- return x(
374
- this.#t,
375
- this.options,
376
- this.options.refetchOnWindowFocus
377
- );
378
- }
379
- destroy() {
380
- this.listeners = /* @__PURE__ */ new Set(), this.#O(), this.#w(), this.#t.removeObserver(this);
381
- }
382
- setOptions(t) {
383
- const e = this.options, s = this.#t;
384
- if (this.options = this.#e.defaultQueryOptions(t), this.options.enabled !== void 0 && typeof this.options.enabled != "boolean" && typeof this.options.enabled != "function" && typeof b(this.options.enabled, this.#t) != "boolean")
385
- throw new Error(
386
- "Expected enabled to be a boolean or a callback that returns a boolean"
387
- );
388
- this.#R(), this.#t.setOptions(this.options), e._defaulted && !P(this.options, e) && this.#e.getQueryCache().notify({
389
- type: "observerOptionsUpdated",
390
- query: this.#t,
391
- observer: this
392
- });
393
- const n = this.hasListeners();
394
- n && Z(
395
- this.#t,
396
- s,
397
- this.options,
398
- e
399
- ) && this.#l(), this.updateResult(), n && (this.#t !== s || b(this.options.enabled, this.#t) !== b(e.enabled, this.#t) || E(this.options.staleTime, this.#t) !== E(e.staleTime, this.#t)) && this.#b();
400
- const i = this.#y();
401
- n && (this.#t !== s || b(this.options.enabled, this.#t) !== b(e.enabled, this.#t) || i !== this.#u) && this.#m(i);
402
- }
403
- getOptimisticResult(t) {
404
- const e = this.#e.getQueryCache().build(this.#e, t), s = this.createResult(e, t);
405
- return Pt(this, s) && (this.#i = s, this.#r = this.options, this.#n = this.#t.state), s;
406
- }
407
- getCurrentResult() {
408
- return this.#i;
409
- }
410
- trackResult(t, e) {
411
- return new Proxy(t, {
412
- get: (s, n) => (this.trackProp(n), e?.(n), n === "promise" && (this.trackProp("data"), !this.options.experimental_prefetchInRender && this.#o.status === "pending" && this.#o.reject(
413
- new Error(
414
- "experimental_prefetchInRender feature flag is not enabled"
415
- )
416
- )), Reflect.get(s, n))
417
- });
418
- }
419
- trackProp(t) {
420
- this.#p.add(t);
421
- }
422
- getCurrentQuery() {
423
- return this.#t;
424
- }
425
- refetch({ ...t } = {}) {
426
- return this.fetch({
427
- ...t
428
- });
429
- }
430
- fetchOptimistic(t) {
431
- const e = this.#e.defaultQueryOptions(t), s = this.#e.getQueryCache().build(this.#e, e);
432
- return s.fetch().then(() => this.createResult(s, e));
433
- }
434
- fetch(t) {
435
- return this.#l({
436
- ...t,
437
- cancelRefetch: t.cancelRefetch ?? !0
438
- }).then(() => (this.updateResult(), this.#i));
439
- }
440
- #l(t) {
441
- this.#R();
442
- let e = this.#t.fetch(
443
- this.options,
444
- t
445
- );
446
- return t?.throwOnError || (e = e.catch(gt)), e;
447
- }
448
- #b() {
449
- this.#O();
450
- const t = E(
451
- this.options.staleTime,
452
- this.#t
453
- );
454
- if (H.isServer() || this.#i.isStale || !q(t))
455
- return;
456
- const s = Ot(this.#i.dataUpdatedAt, t) + 1;
457
- this.#c = T.setTimeout(() => {
458
- this.#i.isStale || this.updateResult();
459
- }, s);
460
- }
461
- #y() {
462
- return (typeof this.options.refetchInterval == "function" ? this.options.refetchInterval(this.#t) : this.options.refetchInterval) ?? !1;
463
- }
464
- #m(t) {
465
- this.#w(), this.#u = t, !(H.isServer() || b(this.options.enabled, this.#t) === !1 || !q(this.#u) || this.#u === 0) && (this.#h = T.setInterval(() => {
466
- (this.options.refetchIntervalInBackground || pt.isFocused()) && this.#l();
467
- }, this.#u));
468
- }
469
- #g() {
470
- this.#b(), this.#m(this.#y());
471
- }
472
- #O() {
473
- this.#c && (T.clearTimeout(this.#c), this.#c = void 0);
474
- }
475
- #w() {
476
- this.#h && (T.clearInterval(this.#h), this.#h = void 0);
477
- }
478
- createResult(t, e) {
479
- const s = this.#t, n = this.options, i = this.#i, r = this.#n, h = this.#r, l = t !== s ? t.state : this.#s, { state: y } = t;
480
- let a = { ...y }, p = !1, c;
481
- if (e._optimisticResults) {
482
- const v = this.hasListeners(), S = !v && Y(t, e), j = v && Z(t, s, e, n);
483
- (S || j) && (a = {
484
- ...a,
485
- ...It(y.data, t.options)
486
- }), e._optimisticResults === "isRestoring" && (a.fetchStatus = "idle");
487
- }
488
- let { error: u, errorUpdatedAt: f, status: d } = a;
489
- c = a.data;
490
- let R = !1;
491
- if (e.placeholderData !== void 0 && c === void 0 && d === "pending") {
492
- let v;
493
- i?.isPlaceholderData && e.placeholderData === h?.placeholderData ? (v = i.data, R = !0) : v = typeof e.placeholderData == "function" ? e.placeholderData(
494
- this.#d?.state.data,
495
- this.#d
496
- ) : e.placeholderData, v !== void 0 && (d = "success", c = B(
497
- i?.data,
498
- v,
499
- e
500
- ), p = !0);
501
- }
502
- if (e.select && c !== void 0 && !R)
503
- if (i && c === r?.data && e.select === this.#v)
504
- c = this.#f;
505
- else
506
- try {
507
- this.#v = e.select, c = e.select(c), c = B(i?.data, c, e), this.#f = c, this.#a = null;
508
- } catch (v) {
509
- this.#a = v;
510
- }
511
- this.#a && (u = this.#a, c = this.#f, f = Date.now(), d = "error");
512
- const g = a.fetchStatus === "fetching", O = d === "pending", D = d === "error", A = O && g, V = c !== void 0, m = {
513
- status: d,
514
- fetchStatus: a.fetchStatus,
515
- isPending: O,
516
- isSuccess: d === "success",
517
- isError: D,
518
- isInitialLoading: A,
519
- isLoading: A,
520
- data: c,
521
- dataUpdatedAt: a.dataUpdatedAt,
522
- error: u,
523
- errorUpdatedAt: f,
524
- failureCount: a.fetchFailureCount,
525
- failureReason: a.fetchFailureReason,
526
- errorUpdateCount: a.errorUpdateCount,
527
- isFetched: t.isFetched(),
528
- isFetchedAfterMount: a.dataUpdateCount > l.dataUpdateCount || a.errorUpdateCount > l.errorUpdateCount,
529
- isFetching: g,
530
- isRefetching: g && !O,
531
- isLoadingError: D && !V,
532
- isPaused: a.fetchStatus === "paused",
533
- isPlaceholderData: p,
534
- isRefetchError: D && V,
535
- isStale: _(t, e),
536
- refetch: this.refetch,
537
- promise: this.#o,
538
- isEnabled: b(e.enabled, t) !== !1
539
- };
540
- if (this.options.experimental_prefetchInRender) {
541
- const v = m.data !== void 0, S = m.status === "error" && !v, j = (F) => {
542
- S ? F.reject(m.error) : v && F.resolve(m.data);
543
- }, K = () => {
544
- const F = this.#o = m.promise = J();
545
- j(F);
546
- }, I = this.#o;
547
- switch (I.status) {
548
- case "pending":
549
- t.queryHash === s.queryHash && j(I);
550
- break;
551
- case "fulfilled":
552
- (S || m.data !== I.value) && K();
553
- break;
554
- case "rejected":
555
- (!S || m.error !== I.reason) && K();
556
- break;
557
- }
558
- }
559
- return m;
560
- }
561
- updateResult() {
562
- const t = this.#i, e = this.createResult(this.#t, this.options);
563
- if (this.#n = this.#t.state, this.#r = this.options, this.#n.data !== void 0 && (this.#d = this.#t), P(e, t))
564
- return;
565
- this.#i = e;
566
- const s = () => {
567
- if (!t)
568
- return !0;
569
- const { notifyOnChangeProps: n } = this.options, i = typeof n == "function" ? n() : n;
570
- if (i === "all" || !i && !this.#p.size)
571
- return !0;
572
- const r = new Set(
573
- i ?? this.#p
574
- );
575
- return this.options.throwOnError && r.add("error"), Object.keys(this.#i).some((h) => {
576
- const o = h;
577
- return this.#i[o] !== t[o] && r.has(o);
578
- });
579
- };
580
- this.#S({ listeners: s() });
581
- }
582
- #R() {
583
- const t = this.#e.getQueryCache().build(this.#e, this.options);
584
- if (t === this.#t)
585
- return;
586
- const e = this.#t;
587
- this.#t = t, this.#s = t.state, this.hasListeners() && (e?.removeObserver(this), t.addObserver(this));
588
- }
589
- onQueryUpdate() {
590
- this.updateResult(), this.hasListeners() && this.#g();
591
- }
592
- #S(t) {
593
- ut.batch(() => {
594
- t.listeners && this.listeners.forEach((e) => {
595
- e(this.#i);
596
- }), this.#e.getQueryCache().notify({
597
- query: this.#t,
598
- type: "observerResultsUpdated"
599
- });
600
- });
601
- }
602
- };
603
- function Tt(t, e) {
604
- return b(e.enabled, t) !== !1 && t.state.data === void 0 && !(t.state.status === "error" && e.retryOnMount === !1);
605
- }
606
- function Y(t, e) {
607
- return Tt(t, e) || t.state.data !== void 0 && x(t, e, e.refetchOnMount);
608
- }
609
- function x(t, e, s) {
610
- if (b(e.enabled, t) !== !1 && E(e.staleTime, t) !== "static") {
611
- const n = typeof s == "function" ? s(t) : s;
612
- return n === "always" || n !== !1 && _(t, e);
613
- }
614
- return !1;
615
- }
616
- function Z(t, e, s, n) {
617
- return (t !== e || b(n.enabled, t) === !1) && (!s.suspense || t.state.status !== "error") && _(t, s);
618
- }
619
- function _(t, e) {
620
- return b(e.enabled, t) !== !1 && t.isStaleByTime(E(e.staleTime, t));
621
- }
622
- function Pt(t, e) {
623
- return !P(t.getCurrentResult(), e);
624
- }
625
- function Mt() {
626
- return {
627
- context: void 0,
628
- data: void 0,
629
- error: null,
630
- failureCount: 0,
631
- failureReason: null,
632
- isPaused: !1,
633
- status: "idle",
634
- variables: void 0,
635
- submittedAt: 0
636
- };
637
- }
638
- var Dt = class extends M {
639
- #e;
640
- #t = void 0;
641
- #s;
642
- #i;
643
- constructor(t, e) {
644
- super(), this.#e = t, this.setOptions(e), this.bindMethods(), this.#n();
645
- }
646
- bindMethods() {
647
- this.mutate = this.mutate.bind(this), this.reset = this.reset.bind(this);
648
- }
649
- setOptions(t) {
650
- const e = this.options;
651
- this.options = this.#e.defaultMutationOptions(t), P(this.options, e) || this.#e.getMutationCache().notify({
652
- type: "observerOptionsUpdated",
653
- mutation: this.#s,
654
- observer: this
655
- }), e?.mutationKey && this.options.mutationKey && z(e.mutationKey) !== z(this.options.mutationKey) ? this.reset() : this.#s?.state.status === "pending" && this.#s.setOptions(this.options);
656
- }
657
- onUnsubscribe() {
658
- this.hasListeners() || this.#s?.removeObserver(this);
659
- }
660
- onMutationUpdate(t) {
661
- this.#n(), this.#r(t);
662
- }
663
- getCurrentResult() {
664
- return this.#t;
665
- }
666
- reset() {
667
- this.#s?.removeObserver(this), this.#s = void 0, this.#n(), this.#r();
668
- }
669
- mutate(t, e) {
670
- return this.#i = e, this.#s?.removeObserver(this), this.#s = this.#e.getMutationCache().build(this.#e, this.options), this.#s.addObserver(this), this.#s.execute(t);
671
- }
672
- #n() {
673
- const t = this.#s?.state ?? Mt();
674
- this.#t = {
675
- ...t,
676
- isPending: t.status === "pending",
677
- isSuccess: t.status === "success",
678
- isError: t.status === "error",
679
- isIdle: t.status === "idle",
680
- mutate: this.mutate,
681
- reset: this.reset
682
- };
683
- }
684
- #r(t) {
685
- ut.batch(() => {
686
- if (this.#i && this.hasListeners()) {
687
- const e = this.#t.variables, s = this.#t.context, n = {
688
- client: this.#e,
689
- meta: this.options.meta,
690
- mutationKey: this.options.mutationKey
691
- };
692
- if (t?.type === "success") {
693
- try {
694
- this.#i.onSuccess?.(
695
- t.data,
696
- e,
697
- s,
698
- n
699
- );
700
- } catch (i) {
701
- Promise.reject(i);
702
- }
703
- try {
704
- this.#i.onSettled?.(
705
- t.data,
706
- null,
707
- e,
708
- s,
709
- n
710
- );
711
- } catch (i) {
712
- Promise.reject(i);
713
- }
714
- } else if (t?.type === "error") {
715
- try {
716
- this.#i.onError?.(
717
- t.error,
718
- e,
719
- s,
720
- n
721
- );
722
- } catch (i) {
723
- Promise.reject(i);
724
- }
725
- try {
726
- this.#i.onSettled?.(
727
- void 0,
728
- t.error,
729
- e,
730
- s,
731
- n
732
- );
733
- } catch (i) {
734
- Promise.reject(i);
735
- }
736
- }
737
- }
738
- this.listeners.forEach((e) => {
739
- e(this.#t);
740
- });
741
- });
742
- }
743
- }, Lt = "VUE_QUERY_CLIENT";
744
- function Qt(t) {
745
- const e = t ? `:${t}` : "";
746
- return `${Lt}${e}`;
747
- }
748
- function N(t, e) {
749
- Object.keys(t).forEach((s) => {
750
- t[s] = e[s];
751
- });
752
- }
753
- function k(t, e, s = "", n = 0) {
754
- if (e) {
755
- const i = e(t, s, n);
756
- if (i === void 0 && X(t) || i !== void 0)
757
- return i;
758
- }
759
- if (Array.isArray(t))
760
- return t.map(
761
- (i, r) => k(i, e, String(r), n + 1)
762
- );
763
- if (typeof t == "object" && xt(t)) {
764
- const i = Object.entries(t).map(([r, h]) => [
765
- r,
766
- k(h, e, r, n + 1)
767
- ]);
768
- return Object.fromEntries(i);
769
- }
770
- return t;
771
- }
772
- function Ut(t, e) {
773
- return k(t, e);
774
- }
775
- function C(t, e = !1) {
776
- return Ut(t, (s, n, i) => {
777
- if (i === 1 && n === "queryKey")
778
- return C(s, !0);
779
- if (e && Nt(s))
780
- return C(s(), e);
781
- if (X(s))
782
- return C(ht(s), e);
783
- });
784
- }
785
- function xt(t) {
786
- if (Object.prototype.toString.call(t) !== "[object Object]")
787
- return !1;
788
- const e = Object.getPrototypeOf(t);
789
- return e === null || e === Object.prototype;
790
- }
791
- function Nt(t) {
792
- return typeof t == "function";
793
- }
794
- function ct(t = "") {
795
- if (!lt())
796
- throw new Error(
797
- "vue-query hooks can only be used inside setup() function or functions that support injection context."
798
- );
799
- const e = Qt(t), s = ft(e);
800
- if (!s)
801
- throw new Error(
802
- "No 'queryClient' found in Vue context, use 'VueQueryPlugin' to properly initialize the library."
803
- );
804
- return s;
805
- }
806
- function kt(t, e, s) {
807
- process.env.NODE_ENV === "development" && (G() || console.warn(
808
- 'vue-query composable like "useQuery()" should only be used inside a "setup()" function or a running effect scope. They might otherwise lead to memory leaks.'
809
- ));
810
- const n = ct(), i = tt(() => {
811
- let u = e;
812
- typeof u == "function" && (u = u());
813
- const f = C(u);
814
- typeof f.enabled == "function" && (f.enabled = f.enabled());
815
- const d = n.defaultQueryOptions(f);
816
- return d._optimisticResults = n.isRestoring?.value ? "isRestoring" : "optimistic", d;
817
- }), r = new t(n, i.value), h = i.value.shallow ? et(r.getCurrentResult()) : st(r.getCurrentResult());
818
- let o = () => {
819
- };
820
- n.isRestoring && w(
821
- n.isRestoring,
822
- (u) => {
823
- u || (o(), o = r.subscribe((f) => {
824
- N(h, f);
825
- }));
826
- },
827
- { immediate: !0 }
828
- );
829
- const l = () => {
830
- r.setOptions(i.value), N(h, r.getCurrentResult());
831
- };
832
- w(i, l), it(() => {
833
- o();
834
- });
835
- const y = (...u) => (l(), h.refetch(...u)), a = () => new Promise(
836
- (u, f) => {
837
- let d = () => {
838
- };
839
- const R = () => {
840
- if (i.value.enabled !== !1) {
841
- r.setOptions(i.value);
842
- const g = r.getOptimisticResult(
843
- i.value
844
- );
845
- g.isStale ? (d(), r.fetchOptimistic(i.value).then(u, (O) => {
846
- U(i.value.throwOnError, [
847
- O,
848
- r.getCurrentQuery()
849
- ]) ? f(O) : u(r.getCurrentResult());
850
- })) : (d(), u(g));
851
- }
852
- };
853
- R(), d = w(i, R);
854
- }
855
- );
856
- w(
857
- () => h.error,
858
- (u) => {
859
- if (h.isError && !h.isFetching && U(i.value.throwOnError, [
860
- u,
861
- r.getCurrentQuery()
862
- ]))
863
- throw u;
864
- }
865
- );
866
- const p = i.value.shallow ? nt(h) : rt(h), c = ot(p);
867
- for (const u in h)
868
- typeof h[u] == "function" && (c[u] = h[u]);
869
- return c.suspense = a, c.refetch = y, c;
870
- }
871
- function _t(t, e) {
872
- return kt(Ft, t);
873
- }
874
- function At(t, e) {
875
- process.env.NODE_ENV === "development" && (G() || console.warn(
876
- 'vue-query composable like "useQuery()" should only be used inside a "setup()" function or a running effect scope. They might otherwise lead to memory leaks.'
877
- ));
878
- const s = ct(), n = tt(() => {
879
- const a = typeof t == "function" ? t() : t;
880
- return s.defaultMutationOptions(C(a));
881
- }), i = new Dt(s, n.value), r = n.value.shallow ? et(i.getCurrentResult()) : st(i.getCurrentResult()), h = i.subscribe((a) => {
882
- N(r, a);
883
- }), o = (a, p) => {
884
- i.mutate(a, p).catch(() => {
885
- });
886
- };
887
- w(n, () => {
888
- i.setOptions(n.value);
889
- }), it(() => {
890
- h();
891
- });
892
- const l = n.value.shallow ? nt(r) : rt(r), y = ot(l);
893
- return w(
894
- () => r.error,
895
- (a) => {
896
- if (a && U(n.value.throwOnError, [a]))
897
- throw a;
898
- }
899
- ), {
900
- ...y,
901
- mutate: o,
902
- mutateAsync: r.mutate,
903
- reset: r.reset
904
- };
905
- }
906
- function Vt(t, e) {
907
- return _t({
908
- queryKey: [t],
909
- queryFn: async () => t.value ? (await at.get(t.value)).data : void 0,
910
- enabled: () => !!t.value,
911
- ...e
912
- });
913
- }
914
- function Kt(t, e) {
915
- return At({
916
- mutationFn: async (s) => t.value ? (await at.post(t.value, s)).data : void 0,
917
- ...e
918
- });
919
- }
920
- const Wt = {
921
- query: Vt,
922
- mutation: Kt
923
- };
924
- export {
925
- _t as a,
926
- Wt as b,
927
- At as u
928
- };