@nside/wefa 0.1.0 → 0.3.0

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 (60) hide show
  1. package/dist/{LegalConsent-Cn3qx30k.cjs → LegalConsent-CEcXZml6.cjs} +1 -1
  2. package/dist/{LegalConsent-pUADprVB.js → LegalConsent-Dzq3fdnt.js} +6 -6
  3. package/dist/{LegalDocument-BHtPY9AH.js → LegalDocument-BhoEpJ2O.js} +282 -255
  4. package/dist/LegalDocument-CS3MnOcV.cjs +109 -0
  5. package/dist/{LoginView-CMR9q_yi.cjs → LoginView-IIkXXw3R.cjs} +1 -1
  6. package/dist/{LoginView-C668oczA.js → LoginView-kH440cCh.js} +1 -1
  7. package/dist/{LogoutView-CzsPB9d9.cjs → LogoutView-B90MA-_Q.cjs} +1 -1
  8. package/dist/{LogoutView-DNgS20XP.js → LogoutView-DGqh4bP7.js} +1 -1
  9. package/dist/{apiClient-BAzNCKuU.js → apiClient-D-kcx_S1.js} +260 -232
  10. package/dist/apiClient-DJdAL3tN.cjs +1 -0
  11. package/dist/{axios-C7yNV7KF.js → axios-ClRPr3Xn.js} +158 -140
  12. package/dist/{axios-BompFBxL.cjs → axios-Dcidtc2l.cjs} +6 -6
  13. package/dist/containers.cjs +5 -5
  14. package/dist/containers.js +5 -5
  15. package/dist/{index-D7KjmN8m.cjs → index-B4vneBZh.cjs} +3 -3
  16. package/dist/{index-yOMKz8lD.cjs → index-B53YL3vD.cjs} +1 -1
  17. package/dist/{index-52nB-rKK.cjs → index-BSfhC_wu.cjs} +1 -1
  18. package/dist/{index-CeYaMyhs.cjs → index-BXrnPbjr.cjs} +3 -3
  19. package/dist/{index-CowW14sC.js → index-Bc699sOR.js} +906 -918
  20. package/dist/{index-BqxW11im.cjs → index-Bl3JVLei.cjs} +1 -1
  21. package/dist/{index--nRVi6aV.js → index-CEz0St1t.js} +7 -7
  22. package/dist/{index-DDCFRGsr.cjs → index-CJmnkrIs.cjs} +1 -1
  23. package/dist/{index-9kXqZ0Ez.cjs → index-CL_OJMNr.cjs} +1 -1
  24. package/dist/index-CTNsucOq.cjs +147 -0
  25. package/dist/{index-Dd7rSEka.js → index-Coos428-.js} +163 -174
  26. package/dist/{index-B-o2K-Ca.js → index-CwLAV8WF.js} +2 -2
  27. package/dist/{index-CowF3j5a.js → index-DGvdYnh3.js} +2 -2
  28. package/dist/{index-BVwluHCk.js → index-Dj5oTSEE.js} +22 -26
  29. package/dist/{index-BctaqoUB.js → index-DmVIgb18.js} +1 -1
  30. package/dist/{index-jIUtvXF6.js → index-FS8xE7Mo.js} +3 -3
  31. package/dist/index-FrfvunRp.cjs +146 -0
  32. package/dist/{index-CXJz1iyq.js → index-bRjoenrr.js} +1 -1
  33. package/dist/{lib-BEVtXpEW.cjs → lib-BBJH9d11.cjs} +83 -68
  34. package/dist/{lib-CA1k4S8X.js → lib-Y8FPgwH4.js} +1453 -1432
  35. package/dist/lib.cjs +1 -1
  36. package/dist/lib.d.ts +6 -3
  37. package/dist/lib.js +2 -2
  38. package/dist/{libRoutes-BJftOROB.js → libRoutes-BsneoQ4G.js} +2 -2
  39. package/dist/{libRoutes-CZNbtm5j.cjs → libRoutes-BzeZrIaK.cjs} +1 -1
  40. package/dist/network.cjs +1 -1
  41. package/dist/network.d.ts +5 -4
  42. package/dist/network.js +14 -14
  43. package/dist/router.cjs +1 -1
  44. package/dist/router.js +1 -1
  45. package/package.json +47 -46
  46. package/src/components/PlotlyComponent/PlotlyFromTableComponent.mdx +182 -108
  47. package/src/components/PlotlyComponent/PlotlyFromTableComponent.spec.ts +24 -17
  48. package/src/components/PlotlyComponent/PlotlyFromTableComponent.stories.ts +99 -36
  49. package/src/components/PlotlyComponent/PlotlyFromTableComponent.vue +18 -10
  50. package/src/components/TableComponent/TableComponent.spec.ts +0 -1
  51. package/src/demo/openapi/client/types.gen.ts +4 -3
  52. package/src/network/__tests__/typedApiClient.test.ts +9 -0
  53. package/src/network/network.mdx +8 -1
  54. package/src/network/typedApiClient.ts +8 -6
  55. package/src/plugins/legalConsent/views/__tests__/LegalConsent.test.ts +9 -4
  56. package/src/utils/componentRegistry.ts +0 -1
  57. package/dist/LegalDocument-CU8uyoKh.cjs +0 -110
  58. package/dist/apiClient-B6fJs4NI.cjs +0 -1
  59. package/dist/index-BCKqvrXF.cjs +0 -157
  60. package/dist/index-TM4WIzFN.cjs +0 -163
@@ -1,6 +1,6 @@
1
- import { isRef as Y, unref as ut, hasInjectionContext as ht, inject as ct, getCurrentScope as Z, computed as X, shallowReactive as G, reactive as tt, watch as R, onScopeDispose as et, shallowReadonly as st, readonly as it, toRefs as nt } from "vue";
2
- import { a as rt } from "./axios-C7yNV7KF.js";
3
- var P = class {
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 R, onScopeDispose as it, shallowReadonly as nt, readonly as rt, toRefs as ot } from "vue";
2
+ import { a as at } from "./axios-ClRPr3Xn.js";
3
+ var D = class {
4
4
  constructor() {
5
5
  this.listeners = /* @__PURE__ */ new Set(), this.subscribe = this.subscribe.bind(this);
6
6
  }
@@ -16,7 +16,7 @@ var P = class {
16
16
  }
17
17
  onUnsubscribe() {
18
18
  }
19
- }, lt = {
19
+ }, dt = {
20
20
  // We need the wrapper function syntax below instead of direct references to
21
21
  // global setTimeout etc.
22
22
  //
@@ -31,14 +31,14 @@ var P = class {
31
31
  clearTimeout: (t) => clearTimeout(t),
32
32
  setInterval: (t, e) => setInterval(t, e),
33
33
  clearInterval: (t) => clearInterval(t)
34
- }, ft = class {
34
+ }, pt = class {
35
35
  // We cannot have TimeoutManager<T> as we must instantiate it with a concrete
36
36
  // type at app boot; and if we leave that type, then any new timer provider
37
37
  // would need to support ReturnType<typeof setTimeout>, which is infeasible.
38
38
  //
39
39
  // We settle for type safety for the TimeoutProvider type, and accept that
40
40
  // this class is unsafe internally to allow for extension.
41
- #e = lt;
41
+ #e = dt;
42
42
  #t = !1;
43
43
  setTimeoutProvider(t) {
44
44
  process.env.NODE_ENV !== "production" && this.#t && t !== this.#e && console.error(
@@ -58,17 +58,17 @@ var P = class {
58
58
  clearInterval(t) {
59
59
  this.#e.clearInterval(t);
60
60
  }
61
- }, T = new ft();
62
- function dt(t) {
61
+ }, F = new pt();
62
+ function bt(t) {
63
63
  setTimeout(t, 0);
64
64
  }
65
- var F = typeof window > "u" || "Deno" in globalThis;
66
- function pt() {
65
+ var P = typeof window > "u" || "Deno" in globalThis;
66
+ function vt() {
67
67
  }
68
- function K(t) {
68
+ function z(t) {
69
69
  return typeof t == "number" && t >= 0 && t !== 1 / 0;
70
70
  }
71
- function bt(t, e) {
71
+ function yt(t, e) {
72
72
  return Math.max(t + (e || 0) - Date.now(), 0);
73
73
  }
74
74
  function E(t, e) {
@@ -77,34 +77,35 @@ function E(t, e) {
77
77
  function v(t, e) {
78
78
  return typeof t == "function" ? t(e) : t;
79
79
  }
80
- function q(t) {
80
+ function $(t) {
81
81
  return JSON.stringify(
82
82
  t,
83
83
  (e, s) => U(s) ? Object.keys(s).sort().reduce((n, i) => (n[i] = s[i], n), {}) : s
84
84
  );
85
85
  }
86
- var vt = Object.prototype.hasOwnProperty;
87
- function Q(t, e) {
86
+ var mt = Object.prototype.hasOwnProperty;
87
+ function Q(t, e, s = 0) {
88
88
  if (t === e)
89
89
  return t;
90
- const s = z(t) && z(e);
91
- if (!s && !(U(t) && U(e))) return e;
92
- const i = (s ? t : Object.keys(t)).length, r = s ? e : Object.keys(e), u = r.length, o = s ? new Array(u) : {};
93
- let l = 0;
94
- for (let d = 0; d < u; d++) {
95
- const a = s ? d : r[d], f = t[a], h = e[a];
96
- if (f === h) {
97
- o[a] = f, (s ? d < i : vt.call(t, a)) && l++;
90
+ if (s > 500) return e;
91
+ const n = W(t) && W(e);
92
+ if (!n && !(U(t) && U(e))) return e;
93
+ const r = (n ? t : Object.keys(t)).length, h = n ? e : Object.keys(e), o = h.length, l = n ? new Array(o) : {};
94
+ let y = 0;
95
+ for (let a = 0; a < o; a++) {
96
+ const p = n ? a : h[a], c = t[p], u = e[p];
97
+ if (c === u) {
98
+ l[p] = c, (n ? a < r : mt.call(t, p)) && y++;
98
99
  continue;
99
100
  }
100
- if (f === null || h === null || typeof f != "object" || typeof h != "object") {
101
- o[a] = h;
101
+ if (c === null || u === null || typeof c != "object" || typeof u != "object") {
102
+ l[p] = u;
102
103
  continue;
103
104
  }
104
- const c = Q(f, h);
105
- o[a] = c, c === f && l++;
105
+ const f = Q(c, u, s + 1);
106
+ l[p] = f, f === c && y++;
106
107
  }
107
- return i === u && l === i ? t : o;
108
+ return r === o && y === r ? t : l;
108
109
  }
109
110
  function M(t, e) {
110
111
  if (!e || Object.keys(t).length !== Object.keys(e).length)
@@ -114,22 +115,22 @@ function M(t, e) {
114
115
  return !1;
115
116
  return !0;
116
117
  }
117
- function z(t) {
118
+ function W(t) {
118
119
  return Array.isArray(t) && t.length === Object.keys(t).length;
119
120
  }
120
121
  function U(t) {
121
- if (!$(t))
122
+ if (!B(t))
122
123
  return !1;
123
124
  const e = t.constructor;
124
125
  if (e === void 0)
125
126
  return !0;
126
127
  const s = e.prototype;
127
- return !(!$(s) || !s.hasOwnProperty("isPrototypeOf") || Object.getPrototypeOf(t) !== Object.prototype);
128
+ return !(!B(s) || !s.hasOwnProperty("isPrototypeOf") || Object.getPrototypeOf(t) !== Object.prototype);
128
129
  }
129
- function $(t) {
130
+ function B(t) {
130
131
  return Object.prototype.toString.call(t) === "[object Object]";
131
132
  }
132
- function B(t, e, s) {
133
+ function H(t, e, s) {
133
134
  if (typeof s.structuralSharing == "function")
134
135
  return s.structuralSharing(t, e);
135
136
  if (s.structuralSharing !== !1) {
@@ -145,16 +146,16 @@ function B(t, e, s) {
145
146
  }
146
147
  return e;
147
148
  }
148
- function D(t, e) {
149
+ function x(t, e) {
149
150
  return typeof t == "function" ? t(...e) : !!t;
150
151
  }
151
- var yt = class extends P {
152
+ var gt = class extends D {
152
153
  #e;
153
154
  #t;
154
155
  #s;
155
156
  constructor() {
156
157
  super(), this.#s = (t) => {
157
- if (!F && window.addEventListener) {
158
+ if (!P && window.addEventListener) {
158
159
  const e = () => t();
159
160
  return window.addEventListener("visibilitychange", e, !1), () => {
160
161
  window.removeEventListener("visibilitychange", e);
@@ -185,8 +186,8 @@ var yt = class extends P {
185
186
  isFocused() {
186
187
  return typeof this.#e == "boolean" ? this.#e : globalThis.document?.visibilityState !== "hidden";
187
188
  }
188
- }, mt = new yt();
189
- function W() {
189
+ }, Ot = new gt();
190
+ function J() {
190
191
  let t, e;
191
192
  const s = new Promise((i, r) => {
192
193
  t = i, e = r;
@@ -208,18 +209,18 @@ function W() {
208
209
  }), e(i);
209
210
  }, s;
210
211
  }
211
- var gt = dt;
212
- function Ot() {
212
+ var Rt = bt;
213
+ function wt() {
213
214
  let t = [], e = 0, s = (o) => {
214
215
  o();
215
216
  }, n = (o) => {
216
217
  o();
217
- }, i = gt;
218
+ }, i = Rt;
218
219
  const r = (o) => {
219
220
  e ? t.push(o) : i(() => {
220
221
  s(o);
221
222
  });
222
- }, u = () => {
223
+ }, h = () => {
223
224
  const o = t;
224
225
  t = [], o.length && i(() => {
225
226
  n(() => {
@@ -236,7 +237,7 @@ function Ot() {
236
237
  try {
237
238
  l = o();
238
239
  } finally {
239
- e--, e || u();
240
+ e--, e || h();
240
241
  }
241
242
  return l;
242
243
  },
@@ -268,13 +269,13 @@ function Ot() {
268
269
  }
269
270
  };
270
271
  }
271
- var ot = Ot(), wt = class extends P {
272
+ var ut = wt(), St = class extends D {
272
273
  #e = !0;
273
274
  #t;
274
275
  #s;
275
276
  constructor() {
276
277
  super(), this.#s = (t) => {
277
- if (!F && window.addEventListener) {
278
+ if (!P && window.addEventListener) {
278
279
  const e = () => t(!0), s = () => t(!1);
279
280
  return window.addEventListener("online", e, !1), window.addEventListener("offline", s, !1), () => {
280
281
  window.removeEventListener("online", e), window.removeEventListener("offline", s);
@@ -299,24 +300,24 @@ var ot = Ot(), wt = class extends P {
299
300
  isOnline() {
300
301
  return this.#e;
301
302
  }
302
- }, Rt = new wt();
303
- function St(t) {
304
- return (t ?? "online") === "online" ? Rt.isOnline() : !0;
303
+ }, Et = new St();
304
+ function Ct(t) {
305
+ return (t ?? "online") === "online" ? Et.isOnline() : !0;
305
306
  }
306
- function Et(t, e) {
307
+ function jt(t, e) {
307
308
  return {
308
309
  fetchFailureCount: 0,
309
310
  fetchFailureReason: null,
310
- fetchStatus: St(e.networkMode) ? "fetching" : "paused",
311
+ fetchStatus: Ct(e.networkMode) ? "fetching" : "paused",
311
312
  ...t === void 0 && {
312
313
  error: null,
313
314
  status: "pending"
314
315
  }
315
316
  };
316
317
  }
317
- var Ct = class extends P {
318
+ var It = class extends D {
318
319
  constructor(t, e) {
319
- super(), this.options = e, this.#e = t, this.#a = null, this.#o = W(), this.bindMethods(), this.setOptions(e);
320
+ super(), this.options = e, this.#e = t, this.#a = null, this.#o = J(), this.bindMethods(), this.setOptions(e);
320
321
  }
321
322
  #e;
322
323
  #t = void 0;
@@ -331,35 +332,35 @@ var Ct = class extends P {
331
332
  // This property keeps track of the last query with defined data.
332
333
  // It will be used to pass the previous data and query to the placeholder function between renders.
333
334
  #d;
334
- #h;
335
335
  #c;
336
+ #h;
336
337
  #u;
337
338
  #p = /* @__PURE__ */ new Set();
338
339
  bindMethods() {
339
340
  this.refetch = this.refetch.bind(this);
340
341
  }
341
342
  onSubscribe() {
342
- this.listeners.size === 1 && (this.#t.addObserver(this), H(this.#t, this.options) ? this.#l() : this.updateResult(), this.#g());
343
+ this.listeners.size === 1 && (this.#t.addObserver(this), Y(this.#t, this.options) ? this.#l() : this.updateResult(), this.#g());
343
344
  }
344
345
  onUnsubscribe() {
345
346
  this.hasListeners() || this.destroy();
346
347
  }
347
348
  shouldFetchOnReconnect() {
348
- return x(
349
+ return N(
349
350
  this.#t,
350
351
  this.options,
351
352
  this.options.refetchOnReconnect
352
353
  );
353
354
  }
354
355
  shouldFetchOnWindowFocus() {
355
- return x(
356
+ return N(
356
357
  this.#t,
357
358
  this.options,
358
359
  this.options.refetchOnWindowFocus
359
360
  );
360
361
  }
361
362
  destroy() {
362
- this.listeners = /* @__PURE__ */ new Set(), this.#O(), this.#w(), this.#t.removeObserver(this);
363
+ this.listeners = /* @__PURE__ */ new Set(), this.#O(), this.#R(), this.#t.removeObserver(this);
363
364
  }
364
365
  setOptions(t) {
365
366
  const e = this.options, s = this.#t;
@@ -367,13 +368,13 @@ var Ct = class extends P {
367
368
  throw new Error(
368
369
  "Expected enabled to be a boolean or a callback that returns a boolean"
369
370
  );
370
- this.#R(), this.#t.setOptions(this.options), e._defaulted && !M(this.options, e) && this.#e.getQueryCache().notify({
371
+ this.#w(), this.#t.setOptions(this.options), e._defaulted && !M(this.options, e) && this.#e.getQueryCache().notify({
371
372
  type: "observerOptionsUpdated",
372
373
  query: this.#t,
373
374
  observer: this
374
375
  });
375
376
  const n = this.hasListeners();
376
- n && J(
377
+ n && Z(
377
378
  this.#t,
378
379
  s,
379
380
  this.options,
@@ -384,7 +385,7 @@ var Ct = class extends P {
384
385
  }
385
386
  getOptimisticResult(t) {
386
387
  const e = this.#e.getQueryCache().build(this.#e, t), s = this.createResult(e, t);
387
- return jt(this, s) && (this.#i = s, this.#r = this.options, this.#n = this.#t.state), s;
388
+ return Ft(this, s) && (this.#i = s, this.#r = this.options, this.#n = this.#t.state), s;
388
389
  }
389
390
  getCurrentResult() {
390
391
  return this.#i;
@@ -420,12 +421,12 @@ var Ct = class extends P {
420
421
  }).then(() => (this.updateResult(), this.#i));
421
422
  }
422
423
  #l(t) {
423
- this.#R();
424
+ this.#w();
424
425
  let e = this.#t.fetch(
425
426
  this.options,
426
427
  t
427
428
  );
428
- return t?.throwOnError || (e = e.catch(pt)), e;
429
+ return t?.throwOnError || (e = e.catch(vt)), e;
429
430
  }
430
431
  #v() {
431
432
  this.#O();
@@ -433,10 +434,10 @@ var Ct = class extends P {
433
434
  this.options.staleTime,
434
435
  this.#t
435
436
  );
436
- if (F || this.#i.isStale || !K(t))
437
+ if (P || this.#i.isStale || !z(t))
437
438
  return;
438
- const s = bt(this.#i.dataUpdatedAt, t) + 1;
439
- this.#h = T.setTimeout(() => {
439
+ const s = yt(this.#i.dataUpdatedAt, t) + 1;
440
+ this.#c = F.setTimeout(() => {
440
441
  this.#i.isStale || this.updateResult();
441
442
  }, s);
442
443
  }
@@ -444,65 +445,65 @@ var Ct = class extends P {
444
445
  return (typeof this.options.refetchInterval == "function" ? this.options.refetchInterval(this.#t) : this.options.refetchInterval) ?? !1;
445
446
  }
446
447
  #m(t) {
447
- this.#w(), this.#u = t, !(F || v(this.options.enabled, this.#t) === !1 || !K(this.#u) || this.#u === 0) && (this.#c = T.setInterval(() => {
448
- (this.options.refetchIntervalInBackground || mt.isFocused()) && this.#l();
448
+ this.#R(), this.#u = t, !(P || v(this.options.enabled, this.#t) === !1 || !z(this.#u) || this.#u === 0) && (this.#h = F.setInterval(() => {
449
+ (this.options.refetchIntervalInBackground || Ot.isFocused()) && this.#l();
449
450
  }, this.#u));
450
451
  }
451
452
  #g() {
452
453
  this.#v(), this.#m(this.#y());
453
454
  }
454
455
  #O() {
455
- this.#h && (T.clearTimeout(this.#h), this.#h = void 0);
456
+ this.#c && (F.clearTimeout(this.#c), this.#c = void 0);
456
457
  }
457
- #w() {
458
- this.#c && (T.clearInterval(this.#c), this.#c = void 0);
458
+ #R() {
459
+ this.#h && (F.clearInterval(this.#h), this.#h = void 0);
459
460
  }
460
461
  createResult(t, e) {
461
- const s = this.#t, n = this.options, i = this.#i, r = this.#n, u = this.#r, l = t !== s ? t.state : this.#s, { state: d } = t;
462
- let a = { ...d }, f = !1, h;
462
+ 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;
463
+ let a = { ...y }, p = !1, c;
463
464
  if (e._optimisticResults) {
464
- const p = this.hasListeners(), I = !p && H(t, e), w = p && J(t, s, e, n);
465
- (I || w) && (a = {
465
+ const b = this.hasListeners(), S = !b && Y(t, e), j = b && Z(t, s, e, n);
466
+ (S || j) && (a = {
466
467
  ...a,
467
- ...Et(d.data, t.options)
468
+ ...jt(y.data, t.options)
468
469
  }), e._optimisticResults === "isRestoring" && (a.fetchStatus = "idle");
469
470
  }
470
- let { error: c, errorUpdatedAt: m, status: b } = a;
471
- h = a.data;
472
- let S = !1;
473
- if (e.placeholderData !== void 0 && h === void 0 && b === "pending") {
474
- let p;
475
- i?.isPlaceholderData && e.placeholderData === u?.placeholderData ? (p = i.data, S = !0) : p = typeof e.placeholderData == "function" ? e.placeholderData(
471
+ let { error: u, errorUpdatedAt: f, status: d } = a;
472
+ c = a.data;
473
+ let w = !1;
474
+ if (e.placeholderData !== void 0 && c === void 0 && d === "pending") {
475
+ let b;
476
+ i?.isPlaceholderData && e.placeholderData === h?.placeholderData ? (b = i.data, w = !0) : b = typeof e.placeholderData == "function" ? e.placeholderData(
476
477
  this.#d?.state.data,
477
478
  this.#d
478
- ) : e.placeholderData, p !== void 0 && (b = "success", h = B(
479
+ ) : e.placeholderData, b !== void 0 && (d = "success", c = H(
479
480
  i?.data,
480
- p,
481
+ b,
481
482
  e
482
- ), f = !0);
483
+ ), p = !0);
483
484
  }
484
- if (e.select && h !== void 0 && !S)
485
- if (i && h === r?.data && e.select === this.#b)
486
- h = this.#f;
485
+ if (e.select && c !== void 0 && !w)
486
+ if (i && c === r?.data && e.select === this.#b)
487
+ c = this.#f;
487
488
  else
488
489
  try {
489
- this.#b = e.select, h = e.select(h), h = B(i?.data, h, e), this.#f = h, this.#a = null;
490
- } catch (p) {
491
- this.#a = p;
490
+ this.#b = e.select, c = e.select(c), c = H(i?.data, c, e), this.#f = c, this.#a = null;
491
+ } catch (b) {
492
+ this.#a = b;
492
493
  }
493
- this.#a && (c = this.#a, h = this.#f, m = Date.now(), b = "error");
494
- const g = a.fetchStatus === "fetching", O = b === "pending", L = b === "error", A = O && g, V = h !== void 0, y = {
495
- status: b,
494
+ this.#a && (u = this.#a, c = this.#f, f = Date.now(), d = "error");
495
+ const g = a.fetchStatus === "fetching", O = d === "pending", L = d === "error", V = O && g, K = c !== void 0, m = {
496
+ status: d,
496
497
  fetchStatus: a.fetchStatus,
497
498
  isPending: O,
498
- isSuccess: b === "success",
499
+ isSuccess: d === "success",
499
500
  isError: L,
500
- isInitialLoading: A,
501
- isLoading: A,
502
- data: h,
501
+ isInitialLoading: V,
502
+ isLoading: V,
503
+ data: c,
503
504
  dataUpdatedAt: a.dataUpdatedAt,
504
- error: c,
505
- errorUpdatedAt: m,
505
+ error: u,
506
+ errorUpdatedAt: f,
506
507
  failureCount: a.fetchFailureCount,
507
508
  failureReason: a.fetchFailureReason,
508
509
  errorUpdateCount: a.errorUpdateCount,
@@ -510,35 +511,35 @@ var Ct = class extends P {
510
511
  isFetchedAfterMount: a.dataUpdateCount > l.dataUpdateCount || a.errorUpdateCount > l.errorUpdateCount,
511
512
  isFetching: g,
512
513
  isRefetching: g && !O,
513
- isLoadingError: L && !V,
514
+ isLoadingError: L && !K,
514
515
  isPaused: a.fetchStatus === "paused",
515
- isPlaceholderData: f,
516
- isRefetchError: L && V,
517
- isStale: _(t, e),
516
+ isPlaceholderData: p,
517
+ isRefetchError: L && K,
518
+ isStale: A(t, e),
518
519
  refetch: this.refetch,
519
520
  promise: this.#o,
520
521
  isEnabled: v(e.enabled, t) !== !1
521
522
  };
522
523
  if (this.options.experimental_prefetchInRender) {
523
- const p = (j) => {
524
- y.status === "error" ? j.reject(y.error) : y.data !== void 0 && j.resolve(y.data);
525
- }, I = () => {
526
- const j = this.#o = y.promise = W();
527
- p(j);
528
- }, w = this.#o;
529
- switch (w.status) {
524
+ const b = m.data !== void 0, S = m.status === "error" && !b, j = (T) => {
525
+ S ? T.reject(m.error) : b && T.resolve(m.data);
526
+ }, q = () => {
527
+ const T = this.#o = m.promise = J();
528
+ j(T);
529
+ }, I = this.#o;
530
+ switch (I.status) {
530
531
  case "pending":
531
- t.queryHash === s.queryHash && p(w);
532
+ t.queryHash === s.queryHash && j(I);
532
533
  break;
533
534
  case "fulfilled":
534
- (y.status === "error" || y.data !== w.value) && I();
535
+ (S || m.data !== I.value) && q();
535
536
  break;
536
537
  case "rejected":
537
- (y.status !== "error" || y.error !== w.reason) && I();
538
+ (!S || m.error !== I.reason) && q();
538
539
  break;
539
540
  }
540
541
  }
541
- return y;
542
+ return m;
542
543
  }
543
544
  updateResult() {
544
545
  const t = this.#i, e = this.createResult(this.#t, this.options);
@@ -554,14 +555,14 @@ var Ct = class extends P {
554
555
  const r = new Set(
555
556
  i ?? this.#p
556
557
  );
557
- return this.options.throwOnError && r.add("error"), Object.keys(this.#i).some((u) => {
558
- const o = u;
558
+ return this.options.throwOnError && r.add("error"), Object.keys(this.#i).some((h) => {
559
+ const o = h;
559
560
  return this.#i[o] !== t[o] && r.has(o);
560
561
  });
561
562
  };
562
563
  this.#S({ listeners: s() });
563
564
  }
564
- #R() {
565
+ #w() {
565
566
  const t = this.#e.getQueryCache().build(this.#e, this.options);
566
567
  if (t === this.#t)
567
568
  return;
@@ -572,7 +573,7 @@ var Ct = class extends P {
572
573
  this.updateResult(), this.hasListeners() && this.#g();
573
574
  }
574
575
  #S(t) {
575
- ot.batch(() => {
576
+ ut.batch(() => {
576
577
  t.listeners && this.listeners.forEach((e) => {
577
578
  e(this.#i);
578
579
  }), this.#e.getQueryCache().notify({
@@ -582,29 +583,29 @@ var Ct = class extends P {
582
583
  });
583
584
  }
584
585
  };
585
- function It(t, e) {
586
+ function Tt(t, e) {
586
587
  return v(e.enabled, t) !== !1 && t.state.data === void 0 && !(t.state.status === "error" && e.retryOnMount === !1);
587
588
  }
588
- function H(t, e) {
589
- return It(t, e) || t.state.data !== void 0 && x(t, e, e.refetchOnMount);
589
+ function Y(t, e) {
590
+ return Tt(t, e) || t.state.data !== void 0 && N(t, e, e.refetchOnMount);
590
591
  }
591
- function x(t, e, s) {
592
+ function N(t, e, s) {
592
593
  if (v(e.enabled, t) !== !1 && E(e.staleTime, t) !== "static") {
593
594
  const n = typeof s == "function" ? s(t) : s;
594
- return n === "always" || n !== !1 && _(t, e);
595
+ return n === "always" || n !== !1 && A(t, e);
595
596
  }
596
597
  return !1;
597
598
  }
598
- function J(t, e, s, n) {
599
- return (t !== e || v(n.enabled, t) === !1) && (!s.suspense || t.state.status !== "error") && _(t, s);
599
+ function Z(t, e, s, n) {
600
+ return (t !== e || v(n.enabled, t) === !1) && (!s.suspense || t.state.status !== "error") && A(t, s);
600
601
  }
601
- function _(t, e) {
602
+ function A(t, e) {
602
603
  return v(e.enabled, t) !== !1 && t.isStaleByTime(E(e.staleTime, t));
603
604
  }
604
- function jt(t, e) {
605
+ function Ft(t, e) {
605
606
  return !M(t.getCurrentResult(), e);
606
607
  }
607
- function Tt() {
608
+ function Pt() {
608
609
  return {
609
610
  context: void 0,
610
611
  data: void 0,
@@ -617,7 +618,7 @@ function Tt() {
617
618
  submittedAt: 0
618
619
  };
619
620
  }
620
- var Ft = class extends P {
621
+ var Mt = class extends D {
621
622
  #e;
622
623
  #t = void 0;
623
624
  #s;
@@ -634,7 +635,7 @@ var Ft = class extends P {
634
635
  type: "observerOptionsUpdated",
635
636
  mutation: this.#s,
636
637
  observer: this
637
- }), e?.mutationKey && this.options.mutationKey && q(e.mutationKey) !== q(this.options.mutationKey) ? this.reset() : this.#s?.state.status === "pending" && this.#s.setOptions(this.options);
638
+ }), e?.mutationKey && this.options.mutationKey && $(e.mutationKey) !== $(this.options.mutationKey) ? this.reset() : this.#s?.state.status === "pending" && this.#s.setOptions(this.options);
638
639
  }
639
640
  onUnsubscribe() {
640
641
  this.hasListeners() || this.#s?.removeObserver(this);
@@ -652,7 +653,7 @@ var Ft = class extends P {
652
653
  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);
653
654
  }
654
655
  #n() {
655
- const t = this.#s?.state ?? Tt();
656
+ const t = this.#s?.state ?? Pt();
656
657
  this.#t = {
657
658
  ...t,
658
659
  isPending: t.status === "pending",
@@ -664,220 +665,247 @@ var Ft = class extends P {
664
665
  };
665
666
  }
666
667
  #r(t) {
667
- ot.batch(() => {
668
+ ut.batch(() => {
668
669
  if (this.#i && this.hasListeners()) {
669
670
  const e = this.#t.variables, s = this.#t.context, n = {
670
671
  client: this.#e,
671
672
  meta: this.options.meta,
672
673
  mutationKey: this.options.mutationKey
673
674
  };
674
- t?.type === "success" ? (this.#i.onSuccess?.(
675
- t.data,
676
- e,
677
- s,
678
- n
679
- ), this.#i.onSettled?.(
680
- t.data,
681
- null,
682
- e,
683
- s,
684
- n
685
- )) : t?.type === "error" && (this.#i.onError?.(
686
- t.error,
687
- e,
688
- s,
689
- n
690
- ), this.#i.onSettled?.(
691
- void 0,
692
- t.error,
693
- e,
694
- s,
695
- n
696
- ));
675
+ if (t?.type === "success") {
676
+ try {
677
+ this.#i.onSuccess?.(
678
+ t.data,
679
+ e,
680
+ s,
681
+ n
682
+ );
683
+ } catch (i) {
684
+ Promise.reject(i);
685
+ }
686
+ try {
687
+ this.#i.onSettled?.(
688
+ t.data,
689
+ null,
690
+ e,
691
+ s,
692
+ n
693
+ );
694
+ } catch (i) {
695
+ Promise.reject(i);
696
+ }
697
+ } else if (t?.type === "error") {
698
+ try {
699
+ this.#i.onError?.(
700
+ t.error,
701
+ e,
702
+ s,
703
+ n
704
+ );
705
+ } catch (i) {
706
+ Promise.reject(i);
707
+ }
708
+ try {
709
+ this.#i.onSettled?.(
710
+ void 0,
711
+ t.error,
712
+ e,
713
+ s,
714
+ n
715
+ );
716
+ } catch (i) {
717
+ Promise.reject(i);
718
+ }
719
+ }
697
720
  }
698
721
  this.listeners.forEach((e) => {
699
722
  e(this.#t);
700
723
  });
701
724
  });
702
725
  }
703
- }, Mt = "VUE_QUERY_CLIENT";
704
- function Pt(t) {
726
+ }, Dt = "VUE_QUERY_CLIENT";
727
+ function Lt(t) {
705
728
  const e = t ? `:${t}` : "";
706
- return `${Mt}${e}`;
729
+ return `${Dt}${e}`;
707
730
  }
708
- function N(t, e) {
731
+ function k(t, e) {
709
732
  Object.keys(t).forEach((s) => {
710
733
  t[s] = e[s];
711
734
  });
712
735
  }
713
- function k(t, e, s = "", n = 0) {
736
+ function _(t, e, s = "", n = 0) {
714
737
  if (e) {
715
738
  const i = e(t, s, n);
716
- if (i === void 0 && Y(t) || i !== void 0)
739
+ if (i === void 0 && X(t) || i !== void 0)
717
740
  return i;
718
741
  }
719
742
  if (Array.isArray(t))
720
743
  return t.map(
721
- (i, r) => k(i, e, String(r), n + 1)
744
+ (i, r) => _(i, e, String(r), n + 1)
722
745
  );
723
- if (typeof t == "object" && Qt(t)) {
724
- const i = Object.entries(t).map(([r, u]) => [
746
+ if (typeof t == "object" && Ut(t)) {
747
+ const i = Object.entries(t).map(([r, h]) => [
725
748
  r,
726
- k(u, e, r, n + 1)
749
+ _(h, e, r, n + 1)
727
750
  ]);
728
751
  return Object.fromEntries(i);
729
752
  }
730
753
  return t;
731
754
  }
732
- function Lt(t, e) {
733
- return k(t, e);
755
+ function Qt(t, e) {
756
+ return _(t, e);
734
757
  }
735
758
  function C(t, e = !1) {
736
- return Lt(t, (s, n, i) => {
759
+ return Qt(t, (s, n, i) => {
737
760
  if (i === 1 && n === "queryKey")
738
761
  return C(s, !0);
739
- if (e && Ut(s))
762
+ if (e && xt(s))
740
763
  return C(s(), e);
741
- if (Y(s))
742
- return C(ut(s), e);
764
+ if (X(s))
765
+ return C(ht(s), e);
743
766
  });
744
767
  }
745
- function Qt(t) {
768
+ function Ut(t) {
746
769
  if (Object.prototype.toString.call(t) !== "[object Object]")
747
770
  return !1;
748
771
  const e = Object.getPrototypeOf(t);
749
772
  return e === null || e === Object.prototype;
750
773
  }
751
- function Ut(t) {
774
+ function xt(t) {
752
775
  return typeof t == "function";
753
776
  }
754
- function at(t = "") {
755
- if (!ht())
777
+ function ct(t = "") {
778
+ if (!lt())
756
779
  throw new Error(
757
780
  "vue-query hooks can only be used inside setup() function or functions that support injection context."
758
781
  );
759
- const e = Pt(t), s = ct(e);
782
+ const e = Lt(t), s = ft(e);
760
783
  if (!s)
761
784
  throw new Error(
762
785
  "No 'queryClient' found in Vue context, use 'VueQueryPlugin' to properly initialize the library."
763
786
  );
764
787
  return s;
765
788
  }
766
- function Dt(t, e, s) {
767
- process.env.NODE_ENV === "development" && (Z() || console.warn(
789
+ function Nt(t, e, s) {
790
+ process.env.NODE_ENV === "development" && (G() || console.warn(
768
791
  '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.'
769
792
  ));
770
- const n = at(), i = X(() => {
771
- const c = C(e);
772
- typeof c.enabled == "function" && (c.enabled = c.enabled());
773
- const m = n.defaultQueryOptions(c);
774
- return m._optimisticResults = n.isRestoring?.value ? "isRestoring" : "optimistic", m;
775
- }), r = new t(n, i.value), u = i.value.shallow ? G(r.getCurrentResult()) : tt(r.getCurrentResult());
793
+ const n = ct(), i = tt(() => {
794
+ let u = e;
795
+ typeof u == "function" && (u = u());
796
+ const f = C(u);
797
+ typeof f.enabled == "function" && (f.enabled = f.enabled());
798
+ const d = n.defaultQueryOptions(f);
799
+ return d._optimisticResults = n.isRestoring?.value ? "isRestoring" : "optimistic", d;
800
+ }), r = new t(n, i.value), h = i.value.shallow ? et(r.getCurrentResult()) : st(r.getCurrentResult());
776
801
  let o = () => {
777
802
  };
778
803
  n.isRestoring && R(
779
804
  n.isRestoring,
780
- (c) => {
781
- c || (o(), o = r.subscribe((m) => {
782
- N(u, m);
805
+ (u) => {
806
+ u || (o(), o = r.subscribe((f) => {
807
+ k(h, f);
783
808
  }));
784
809
  },
785
810
  { immediate: !0 }
786
811
  );
787
812
  const l = () => {
788
- r.setOptions(i.value), N(u, r.getCurrentResult());
813
+ r.setOptions(i.value), k(h, r.getCurrentResult());
789
814
  };
790
- R(i, l), et(() => {
815
+ R(i, l), it(() => {
791
816
  o();
792
817
  });
793
- const d = (...c) => (l(), u.refetch(...c)), a = () => new Promise(
794
- (c, m) => {
795
- let b = () => {
818
+ const y = (...u) => (l(), h.refetch(...u)), a = () => new Promise(
819
+ (u, f) => {
820
+ let d = () => {
796
821
  };
797
- const S = () => {
822
+ const w = () => {
798
823
  if (i.value.enabled !== !1) {
799
824
  r.setOptions(i.value);
800
825
  const g = r.getOptimisticResult(
801
826
  i.value
802
827
  );
803
- g.isStale ? (b(), r.fetchOptimistic(i.value).then(c, (O) => {
804
- D(i.value.throwOnError, [
828
+ g.isStale ? (d(), r.fetchOptimistic(i.value).then(u, (O) => {
829
+ x(i.value.throwOnError, [
805
830
  O,
806
831
  r.getCurrentQuery()
807
- ]) ? m(O) : c(r.getCurrentResult());
808
- })) : (b(), c(g));
832
+ ]) ? f(O) : u(r.getCurrentResult());
833
+ })) : (d(), u(g));
809
834
  }
810
835
  };
811
- S(), b = R(i, S);
836
+ w(), d = R(i, w);
812
837
  }
813
838
  );
814
839
  R(
815
- () => u.error,
816
- (c) => {
817
- if (u.isError && !u.isFetching && D(i.value.throwOnError, [
818
- c,
840
+ () => h.error,
841
+ (u) => {
842
+ if (h.isError && !h.isFetching && x(i.value.throwOnError, [
843
+ u,
819
844
  r.getCurrentQuery()
820
845
  ]))
821
- throw c;
846
+ throw u;
822
847
  }
823
848
  );
824
- const f = i.value.shallow ? st(u) : it(u), h = nt(f);
825
- for (const c in u)
826
- typeof u[c] == "function" && (h[c] = u[c]);
827
- return h.suspense = a, h.refetch = d, h;
849
+ const p = i.value.shallow ? nt(h) : rt(h), c = ot(p);
850
+ for (const u in h)
851
+ typeof h[u] == "function" && (c[u] = h[u]);
852
+ return c.suspense = a, c.refetch = y, c;
828
853
  }
829
- function xt(t, e) {
830
- return Dt(Ct, t);
854
+ function kt(t, e) {
855
+ return Nt(It, t);
831
856
  }
832
- function Nt(t, e) {
833
- process.env.NODE_ENV === "development" && (Z() || console.warn(
857
+ function _t(t, e) {
858
+ process.env.NODE_ENV === "development" && (G() || console.warn(
834
859
  '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.'
835
860
  ));
836
- const s = at(), n = X(() => s.defaultMutationOptions(C(t))), i = new Ft(s, n.value), r = n.value.shallow ? G(i.getCurrentResult()) : tt(i.getCurrentResult()), u = i.subscribe((a) => {
837
- N(r, a);
838
- }), o = (a, f) => {
839
- i.mutate(a, f).catch(() => {
861
+ const s = ct(), n = tt(() => {
862
+ const a = typeof t == "function" ? t() : t;
863
+ return s.defaultMutationOptions(C(a));
864
+ }), i = new Mt(s, n.value), r = n.value.shallow ? et(i.getCurrentResult()) : st(i.getCurrentResult()), h = i.subscribe((a) => {
865
+ k(r, a);
866
+ }), o = (a, p) => {
867
+ i.mutate(a, p).catch(() => {
840
868
  });
841
869
  };
842
870
  R(n, () => {
843
871
  i.setOptions(n.value);
844
- }), et(() => {
845
- u();
872
+ }), it(() => {
873
+ h();
846
874
  });
847
- const l = n.value.shallow ? st(r) : it(r), d = nt(l);
875
+ const l = n.value.shallow ? nt(r) : rt(r), y = ot(l);
848
876
  return R(
849
877
  () => r.error,
850
878
  (a) => {
851
- if (a && D(n.value.throwOnError, [a]))
879
+ if (a && x(n.value.throwOnError, [a]))
852
880
  throw a;
853
881
  }
854
882
  ), {
855
- ...d,
883
+ ...y,
856
884
  mutate: o,
857
885
  mutateAsync: r.mutate,
858
886
  reset: r.reset
859
887
  };
860
888
  }
861
- function kt(t, e) {
862
- return xt({
889
+ function At(t, e) {
890
+ return kt({
863
891
  queryKey: [t],
864
- queryFn: async () => t.value ? (await rt.get(t.value)).data : void 0,
892
+ queryFn: async () => t.value ? (await at.get(t.value)).data : void 0,
865
893
  enabled: () => !!t.value,
866
894
  ...e
867
895
  });
868
896
  }
869
- function _t(t, e) {
870
- return Nt({
871
- mutationFn: async (s) => t.value ? (await rt.post(t.value, s)).data : void 0,
897
+ function Vt(t, e) {
898
+ return _t({
899
+ mutationFn: async (s) => t.value ? (await at.post(t.value, s)).data : void 0,
872
900
  ...e
873
901
  });
874
902
  }
875
- const qt = {
876
- query: kt,
877
- mutation: _t
903
+ const $t = {
904
+ query: At,
905
+ mutation: Vt
878
906
  };
879
907
  export {
880
- xt as a,
881
- qt as b,
882
- Nt as u
908
+ kt as a,
909
+ $t as b,
910
+ _t as u
883
911
  };