reactjrx 1.117.0 → 1.117.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js CHANGED
@@ -1,11 +1,11 @@
1
1
  var pe = Object.defineProperty;
2
2
  var ge = (e, t, r) => t in e ? pe(e, t, { enumerable: !0, configurable: !0, writable: !0, value: r }) : e[t] = r;
3
3
  var w = (e, t, r) => ge(e, typeof t != "symbol" ? t + "" : t, r);
4
- import { useRef as E, useMemo as W, useCallback as h, useSyncExternalStore as he, useEffect as b, createContext as X, memo as Z, useContext as B, useState as ve } from "react";
5
- import { isObservable as K, from as x, of as p, defer as Q, startWith as Se, identity as ee, distinctUntilChanged as te, tap as re, catchError as M, EMPTY as T, Subject as z, BehaviorSubject as C, retry as be, merge as N, throwError as R, timer as Ie, map as P, switchMap as F, zip as we, share as ne, throttleTime as Ee, asyncScheduler as Ve, concatMap as xe, scan as Ce, takeUntil as se, fromEvent as Fe, take as ue, delay as $e, defaultIfEmpty as Me, filter as Ne, first as Pe, noop as L } from "rxjs";
6
- import { catchError as J, mergeMap as q, retryWhen as Oe, concatMap as Re, first as qe, tap as Ae } from "rxjs/operators";
4
+ import { useRef as E, useMemo as W, useCallback as h, useSyncExternalStore as he, useEffect as b, createContext as X, memo as Z, useContext as B, useState as Se } from "react";
5
+ import { isObservable as K, from as x, of as p, defer as Q, startWith as ve, identity as ee, distinctUntilChanged as te, tap as re, catchError as $, EMPTY as T, Subject as z, BehaviorSubject as F, retry as be, merge as M, throwError as R, timer as Ie, map as N, switchMap as C, zip as we, share as ne, throttleTime as Ee, asyncScheduler as Ve, concatMap as xe, scan as Fe, takeUntil as se, fromEvent as Ce, take as ue, delay as $e, defaultIfEmpty as Me, filter as Ne, first as Pe, noop as L } from "rxjs";
6
+ import { catchError as J, mergeMap as O, retryWhen as Re, concatMap as Oe, first as qe, tap as Ae } from "rxjs/operators";
7
7
  import { jsx as ce } from "react/jsx-runtime";
8
- import { hashKey as oe, useQueryClient as ae, useQuery as Qe, useMutation as Te } from "@tanstack/react-query";
8
+ import { hashKey as ae, useQueryClient as oe, useQuery as Qe, useMutation as Te } from "@tanstack/react-query";
9
9
  function Y(e) {
10
10
  return e instanceof Promise || e && typeof e == "object" && "then" in e && typeof e.then == "function" && "catch" in e && e.catch === "function";
11
11
  }
@@ -19,7 +19,7 @@ function D(e) {
19
19
  return Y(n) ? x(n) : K(n) ? n : p(n);
20
20
  });
21
21
  }
22
- const S = (e) => {
22
+ const v = (e) => {
23
23
  const t = E(e);
24
24
  return W(() => {
25
25
  t.current = e;
@@ -32,33 +32,33 @@ function k(e, t, r) {
32
32
  compareFn: void 0
33
33
  }, s = !r && Array.isArray(t) ? t : typeof e == "function" ? r ?? [] : [e], c = E(
34
34
  "getValue" in e && typeof e.getValue == "function" ? e.getValue() : n.defaultValue
35
- ), u = S(e), i = S(n), o = h(() => c.current, []), a = h(
36
- (l) => {
35
+ ), u = v(e), l = v(n), a = h(() => c.current, []), o = h(
36
+ (i) => {
37
37
  const m = u.current, g = D(m)().pipe(
38
- i.current.defaultValue ? Se(i.current.defaultValue) : ee,
38
+ l.current.defaultValue ? ve(l.current.defaultValue) : ee,
39
39
  /**
40
40
  * @important there is already a Object.is comparison in place from react
41
41
  * so we only add a custom compareFn if provided
42
42
  */
43
- te((d, y) => i.current.compareFn ? d === void 0 || y === void 0 ? !1 : i.current.compareFn(d, y) : !1),
43
+ te((d, y) => l.current.compareFn ? d === void 0 || y === void 0 ? !1 : l.current.compareFn(d, y) : !1),
44
44
  re((d) => {
45
45
  c.current = d;
46
46
  }),
47
- M((d) => (console.error(d), T))
48
- ).subscribe(l);
47
+ $((d) => (console.error(d), T))
48
+ ).subscribe(i);
49
49
  return () => {
50
- i.current.unsubscribeOnUnmount !== !1 && g.unsubscribe();
50
+ l.current.unsubscribeOnUnmount !== !1 && g.unsubscribe();
51
51
  };
52
52
  },
53
53
  [...s]
54
54
  );
55
- return he(a, o, o);
55
+ return he(o, a, a);
56
56
  }
57
57
  function De(e, t = []) {
58
- const r = S(e);
58
+ const r = v(e);
59
59
  b(() => {
60
60
  const n = D(r.current)().pipe(
61
- M((s) => (console.error(s), T))
61
+ $((s) => (console.error(s), T))
62
62
  ).subscribe();
63
63
  return () => {
64
64
  n.unsubscribe();
@@ -74,7 +74,7 @@ const _ = (e) => {
74
74
  onBeforeComplete: e,
75
75
  completeOnUnmount: t = !0
76
76
  } = {}) => {
77
- const r = _(() => new z()), n = E(!1), s = S(e), c = S(t);
77
+ const r = _(() => new z()), n = E(!1), s = v(e), c = v(t);
78
78
  return b(() => (n.current && (r.current = new z(), n.current = !1), () => {
79
79
  if (!c.current) {
80
80
  n.current = !0;
@@ -88,12 +88,12 @@ const _ = (e) => {
88
88
  }, []);
89
89
  return [e.current, t];
90
90
  }, j = (e) => {
91
- const t = _(() => new C(e)), r = E(!1), n = E(e);
92
- return r.current && (t.current = new C(n.current), r.current = !1), b(() => () => {
91
+ const t = _(() => new F(e)), r = E(!1), n = E(e);
92
+ return r.current && (t.current = new F(n.current), r.current = !1), b(() => () => {
93
93
  r.current || (t.current.complete(), r.current = !0);
94
94
  }, [t]), t.current;
95
95
  }, ot = (e) => {
96
- const t = j(e), r = S(t), n = h(
96
+ const t = j(e), r = v(t), n = h(
97
97
  (s) => {
98
98
  t.next(s);
99
99
  },
@@ -106,24 +106,24 @@ const _ = (e) => {
106
106
  t.next(e);
107
107
  }, [e, t]), t;
108
108
  };
109
- function at(e, t, r = []) {
110
- const n = t != null && !Array.isArray(t) ? t : {}, s = n.retry ?? !0, c = S(
111
- n.onError ?? ((o) => {
112
- console.error(o);
109
+ function it(e, t, r = []) {
110
+ const n = t != null && !Array.isArray(t) ? t : {}, s = n.retry ?? !0, c = v(
111
+ n.onError ?? ((a) => {
112
+ console.error(a);
113
113
  })
114
- ), u = h(() => D(e)(), r), i = h(
114
+ ), u = h(() => D(e)(), r), l = h(
115
115
  () => u().pipe(
116
- M((o) => {
117
- throw c.current(o), o;
116
+ $((a) => {
117
+ throw c.current(a), a;
118
118
  }),
119
119
  s ? be() : ee
120
120
  ),
121
121
  [u, s, c]
122
122
  );
123
- De(i, r);
123
+ De(l, r);
124
124
  }
125
125
  const _e = Symbol("SIGNAL_RESET");
126
- class le extends C {
126
+ class le extends F {
127
127
  constructor(r) {
128
128
  super(r.default);
129
129
  w(this, "update", (r) => {
@@ -151,22 +151,22 @@ class le extends C {
151
151
  return this.config.key;
152
152
  }
153
153
  }
154
- class $ {
154
+ class A {
155
155
  constructor(t) {
156
156
  this.config = t;
157
157
  }
158
158
  }
159
- function it(e = {}) {
159
+ function lt(e = {}) {
160
160
  return new le({
161
161
  key: void 0,
162
162
  ...e,
163
163
  default: e.default ?? void 0
164
164
  });
165
165
  }
166
- function lt(e) {
167
- return new $(e);
166
+ function ft(e) {
167
+ return new A(e);
168
168
  }
169
- const ft = () => {
169
+ const yt = () => {
170
170
  const e = ie({
171
171
  onBeforeComplete: () => {
172
172
  e.current.next();
@@ -175,7 +175,7 @@ const ft = () => {
175
175
  return e;
176
176
  }, je = (e) => {
177
177
  b(e, []);
178
- }, yt = (e) => {
178
+ }, dt = (e) => {
179
179
  je(() => {
180
180
  e();
181
181
  });
@@ -186,7 +186,7 @@ function He(e, t) {
186
186
  function Ke(e, t) {
187
187
  return 2 ** e * t;
188
188
  }
189
- function dt(e) {
189
+ function mt(e) {
190
190
  const {
191
191
  retry: t,
192
192
  retryDelay: r,
@@ -195,45 +195,45 @@ function dt(e) {
195
195
  } = e, c = typeof t != "function" ? t === !1 ? 0 : t === !0 ? Number.POSITIVE_INFINITY : t ?? Number.POSITIVE_INFINITY : Number.POSITIVE_INFINITY, u = typeof t == "function" ? (
196
196
  // ? (attempt: number, error: TError) => of(retry(attempt, error))
197
197
  t
198
- ) : () => !0, i = typeof r == "number" ? r : 100, o = {
198
+ ) : () => !0, l = typeof r == "number" ? r : 100, a = {
199
199
  ...e
200
200
  }, {
201
- maxInterval: a = Number.POSITIVE_INFINITY,
201
+ maxInterval: o = Number.POSITIVE_INFINITY,
202
202
  resetOnSuccess: f = !1,
203
- backoffDelay: l = Ke
204
- } = o;
203
+ backoffDelay: i = Ke
204
+ } = a;
205
205
  return (m) => Q(() => {
206
206
  let g = 0;
207
- const d = (y, v) => y < c ? u(y, v) : !1;
207
+ const d = (y, S) => y < c ? u(y, S) : !1;
208
208
  return m.pipe(
209
209
  J((y) => {
210
210
  var I;
211
211
  if (g++, !d(g - 1, y)) throw y;
212
- const v = (I = e.caughtError) == null ? void 0 : I.call(e, g, y);
213
- if (!v) throw y;
214
- return v.pipe(
215
- q(
216
- (O) => N(
217
- p(O),
212
+ const S = (I = e.caughtError) == null ? void 0 : I.call(e, g, y);
213
+ if (!S) throw y;
214
+ return S.pipe(
215
+ O(
216
+ (P) => M(
217
+ p(P),
218
218
  R(() => y)
219
219
  )
220
220
  )
221
221
  );
222
222
  }),
223
- Oe((y) => y.pipe(
224
- Re((v) => {
223
+ Re((y) => y.pipe(
224
+ Oe((S) => {
225
225
  const I = g - 1;
226
226
  return s().pipe(
227
227
  qe(),
228
- q(
229
- () => d(I, v) ? Ie(
228
+ O(
229
+ () => d(I, S) ? Ie(
230
230
  He(
231
- l(I, i),
232
- a
231
+ i(I, l),
232
+ o
233
233
  )
234
234
  ).pipe(
235
- q((O) => n && !n(I, v) ? R(() => v) : p(O))
236
- ) : R(() => v)
235
+ O((P) => n && !n(I, S) ? R(() => S) : p(P))
236
+ ) : R(() => S)
237
237
  )
238
238
  );
239
239
  })
@@ -249,14 +249,14 @@ function dt(e) {
249
249
  );
250
250
  });
251
251
  }
252
- function mt(e) {
252
+ function pt(e) {
253
253
  return e != null;
254
254
  }
255
- const pt = (e, t) => e.length === t.length && e.every((r, n) => r === t[n]), gt = typeof window > "u" || "Deno" in window;
255
+ const gt = (e, t) => e.length === t.length && e.every((r, n) => r === t[n]), ht = typeof window > "u" || "Deno" in window;
256
256
  class G {
257
257
  constructor() {
258
258
  // biome-ignore lint/suspicious/noExplicitAny: <explanation>
259
- w(this, "signals", new C(/* @__PURE__ */ new Map()));
259
+ w(this, "signals", new F(/* @__PURE__ */ new Map()));
260
260
  w(this, "isDestroyed", !1);
261
261
  }
262
262
  getOrCreateSignal(t) {
@@ -272,8 +272,7 @@ class G {
272
272
  }), this.signals.value.clear(), this.signals.complete(), this.isDestroyed = !0;
273
273
  }
274
274
  }
275
- const fe = X(void 0);
276
- Z(
275
+ const fe = X(void 0), St = Z(
277
276
  ({ children: e }) => {
278
277
  const t = _(() => new G());
279
278
  t.current.isDestroyed && (t.current = new G());
@@ -282,9 +281,8 @@ Z(
282
281
  t.current.destroy();
283
282
  }, [t]), /* @__PURE__ */ ce(fe.Provider, { value: r, children: e });
284
283
  }
285
- );
286
- const H = () => B(fe), ye = (e) => {
287
- const t = H();
284
+ ), ye = () => B(fe), ze = (e) => {
285
+ const t = ye();
288
286
  if (!t) {
289
287
  if (e)
290
288
  throw new Error(
@@ -295,7 +293,7 @@ const H = () => B(fe), ye = (e) => {
295
293
  const r = t.signals;
296
294
  return k(
297
295
  () => r.pipe(
298
- P(
296
+ N(
299
297
  () => e ? t.getOrCreateSignal(e) : void 0
300
298
  )
301
299
  ),
@@ -305,44 +303,40 @@ const H = () => B(fe), ye = (e) => {
305
303
  [r]
306
304
  );
307
305
  };
308
- function ze(e, t) {
309
- const r = S(t), n = H();
310
- if (e instanceof $ && !n)
306
+ function H(e) {
307
+ const t = ye();
308
+ if (e instanceof A && !t)
311
309
  throw new Error(
312
310
  "useSignalValue must be used within a SignalContextProvider"
313
311
  );
314
- const s = ye(
315
- e instanceof $ ? e : void 0
312
+ return ze(
313
+ e instanceof A ? e : void 0
316
314
  ) ?? e;
315
+ }
316
+ function Le(e, t) {
317
+ const r = v(t), n = H(e);
317
318
  return k(
318
319
  () => {
319
- const c = r.current ?? ((i) => i);
320
- return s.pipe(
321
- P(c),
320
+ const s = r.current ?? ((u) => u);
321
+ return n.pipe(
322
+ N(s),
322
323
  te()
323
324
  );
324
325
  },
325
326
  {
326
- defaultValue: t ? t == null ? void 0 : t(s.value) : s.value
327
+ defaultValue: t ? t == null ? void 0 : t(n.value) : n.value
327
328
  },
328
- [s]
329
+ [n]
329
330
  );
330
331
  }
331
- function Le(e) {
332
- const t = H();
333
- if (e instanceof $ && !t)
334
- throw new Error(
335
- "useSignalValue must be used within a SignalContextProvider"
336
- );
337
- return (ye(
338
- e instanceof $ ? e : void 0
339
- ) ?? e).update;
332
+ function Je(e) {
333
+ return H(e).update;
340
334
  }
341
- function ht(e) {
342
- const t = ze(e), r = Le(e);
343
- return [t, r];
335
+ function vt(e) {
336
+ const t = H(e), r = Le(e), n = Je(e);
337
+ return [r, n, t];
344
338
  }
345
- const vt = (e) => ({
339
+ const bt = (e) => ({
346
340
  getItem: async (t) => {
347
341
  const r = await e.getItem(t);
348
342
  if (r)
@@ -355,10 +349,10 @@ const vt = (e) => ({
355
349
  },
356
350
  clear: async () => {
357
351
  }
358
- }), A = (e) => {
352
+ }), q = (e) => {
359
353
  if (!(!e || typeof e != "object"))
360
354
  return e;
361
- }, Je = ({
355
+ }, Ye = ({
362
356
  adapter: e,
363
357
  key: t
364
358
  }) => ({
@@ -366,23 +360,23 @@ const vt = (e) => ({
366
360
  removeItem: async (r) => {
367
361
  const n = await e.getItem(t), { [r]: s, ...c } = (
368
362
  // biome-ignore lint/suspicious/noExplicitAny: <explanation>
369
- A(n) ?? {}
363
+ q(n) ?? {}
370
364
  );
371
365
  await e.setItem(t, c);
372
366
  },
373
367
  getItem: async (r) => {
374
- const n = await e.getItem(t), s = A(n) ?? {};
368
+ const n = await e.getItem(t), s = q(n) ?? {};
375
369
  if (r in s)
376
370
  return s[r];
377
371
  },
378
372
  setItem: async (r, n) => {
379
- const s = await e.getItem(t), c = A(s) ?? {};
373
+ const s = await e.getItem(t), c = q(s) ?? {};
380
374
  await e.setItem(t, { ...c, [r]: n });
381
375
  }
382
- }), Ye = ({
376
+ }), Ue = ({
383
377
  key: e
384
- } = {}) => e ? Je({
385
- adapter: Ye(),
378
+ } = {}) => e ? Ye({
379
+ adapter: Ue(),
386
380
  key: e
387
381
  }) : {
388
382
  clear: async () => {
@@ -400,7 +394,7 @@ const vt = (e) => ({
400
394
  localStorage.setItem(t, JSON.stringify(r));
401
395
  }
402
396
  };
403
- function Ue(e, t) {
397
+ function Ge(e, t) {
404
398
  if (e == null || t === void 0 || typeof e != "object" || typeof t != "object")
405
399
  return e === t;
406
400
  if (e.constructor !== (t == null ? void 0 : t.constructor))
@@ -413,10 +407,10 @@ function Ue(e, t) {
413
407
  return !1;
414
408
  return !0;
415
409
  }
416
- const V = "__reactjrx", Ge = (e) => {
410
+ const V = "__reactjrx", We = (e) => {
417
411
  if (typeof e == "object" && e !== null && V in e && e[V] === V)
418
412
  return e;
419
- }, We = ({
413
+ }, Xe = ({
420
414
  adapter: e,
421
415
  config: t
422
416
  }) => {
@@ -431,58 +425,58 @@ const V = "__reactjrx", Ge = (e) => {
431
425
  c,
432
426
  `for signal ${r.config.key}`
433
427
  ), x(e.setItem(r.config.key, c)).pipe(
434
- M((u) => (console.error(u), p(null)))
428
+ $((u) => (console.error(u), p(null)))
435
429
  );
436
430
  };
437
- function Xe({
431
+ function Ze({
438
432
  adapter: e,
439
433
  config: t
440
434
  }) {
441
435
  const { hydrate: r = ({ value: c }) => c, signal: n, version: s } = t;
442
436
  return x(e.getItem(n.config.key)).pipe(
443
- F((c) => {
444
- const u = Ge(c);
437
+ C((c) => {
438
+ const u = We(c);
445
439
  if (!u) return p(c);
446
- const i = typeof u.migrationVersion != "number", o = u.migrationVersion !== void 0 && s > u.migrationVersion;
447
- if (i || o || u.value === void 0)
440
+ const l = typeof u.migrationVersion != "number", a = u.migrationVersion !== void 0 && s > u.migrationVersion;
441
+ if (l || a || u.value === void 0)
448
442
  return p(c);
449
- const a = u.value;
443
+ const o = u.value;
450
444
  return process.env.NODE_ENV === "development" && console.log(
451
445
  "[reactjrx][state][persistance]:",
452
446
  "Hydrate value",
453
447
  u,
454
448
  `for signal ${n.config.key}`
455
- ), n.setValue(r({ value: a, version: s })), p(c);
449
+ ), n.setValue(r({ value: o, version: s })), p(c);
456
450
  })
457
451
  );
458
452
  }
459
- function Ze({
453
+ function Be({
460
454
  entries: e = [],
461
455
  onHydrated: t,
462
456
  adapter: r
463
457
  }) {
464
458
  const s = (e.length === 0 ? p([]) : we(
465
459
  ...e.map(
466
- (u) => Xe({
460
+ (u) => Ze({
467
461
  adapter: r,
468
462
  config: u
469
463
  })
470
464
  )
471
465
  )).pipe(
472
466
  re(t),
473
- M((u) => (console.error("Unable to hydrate", u), T)),
467
+ $((u) => (console.error("Unable to hydrate", u), T)),
474
468
  ne()
475
469
  ), c = s.pipe(
476
- F(
477
- () => N(
470
+ C(
471
+ () => M(
478
472
  ...e.map(
479
473
  (u) => u.signal.pipe(
480
474
  Ee(500, Ve, {
481
475
  trailing: !0
482
476
  }),
483
- F(
477
+ C(
484
478
  () => x(
485
- We({
479
+ Xe({
486
480
  adapter: r,
487
481
  config: u
488
482
  })
@@ -493,53 +487,53 @@ function Ze({
493
487
  )
494
488
  )
495
489
  );
496
- return N(
490
+ return M(
497
491
  s.pipe(
498
- P(() => ({
492
+ N(() => ({
499
493
  type: "hydrated"
500
494
  }))
501
495
  ),
502
496
  c.pipe(
503
- P(() => ({
497
+ N(() => ({
504
498
  type: "persisted"
505
499
  }))
506
500
  )
507
501
  );
508
502
  }
509
- function St({
503
+ function It({
510
504
  entries: e = [],
511
505
  onHydrated: t,
512
506
  adapter: r
513
507
  }) {
514
- const n = S(t), s = U(r), c = U(e);
508
+ const n = v(t), s = U(r), c = U(e);
515
509
  return k(
516
510
  () => s.pipe(
517
- F((i) => i ? N(
511
+ C((l) => l ? M(
518
512
  p({ type: "reset" }),
519
513
  c.pipe(
520
514
  xe(
521
- (o) => Ze({
522
- adapter: i,
523
- entries: o,
515
+ (a) => Be({
516
+ adapter: l,
517
+ entries: a,
524
518
  onHydrated: () => {
525
- var a;
526
- (a = n.current) == null || a.call(n);
519
+ var o;
520
+ (o = n.current) == null || o.call(n);
527
521
  }
528
522
  })
529
523
  )
530
524
  )
531
525
  ) : p({ type: "reset" }))
532
526
  ).pipe(
533
- Ce(
534
- (i, o) => o.type === "reset" ? { isHydrated: !1 } : o.type === "hydrated" ? { isHydrated: !0 } : i,
527
+ Fe(
528
+ (l, a) => a.type === "reset" ? { isHydrated: !1 } : a.type === "hydrated" ? { isHydrated: !0 } : l,
535
529
  { isHydrated: !1 }
536
530
  )
537
531
  ),
538
- { defaultValue: { isHydrated: !1 }, compareFn: Ue },
532
+ { defaultValue: { isHydrated: !1 }, compareFn: Ge },
539
533
  [s, c]
540
534
  );
541
535
  }
542
- class Be {
536
+ class et {
543
537
  constructor() {
544
538
  w(this, "queryMap", /* @__PURE__ */ new Map());
545
539
  }
@@ -547,14 +541,14 @@ class Be {
547
541
  return this.queryMap.get(t);
548
542
  }
549
543
  setQuery(t, r, n) {
550
- const s = oe(t), c = r.pipe(
544
+ const s = ae(t), c = r.pipe(
551
545
  /**
552
546
  * abort signal is triggered on:
553
547
  * - manual cancellation from user
554
548
  * - unmounting the component
555
549
  * @see https://tanstack.com/query/latest/docs/framework/react/guides/query-cancellation
556
550
  */
557
- se(Fe(n, "abort")),
551
+ se(Ce(n, "abort")),
558
552
  ne()
559
553
  ), u = {
560
554
  query$: c,
@@ -564,16 +558,16 @@ class Be {
564
558
  lastData: void 0
565
559
  };
566
560
  this.queryMap.set(s, u);
567
- const i = c.subscribe({
568
- next: (o) => {
569
- const a = this.queryMap.get(s);
570
- a && (a.lastData = { value: o });
561
+ const l = c.subscribe({
562
+ next: (a) => {
563
+ const o = this.queryMap.get(s);
564
+ o && (o.lastData = { value: a });
571
565
  },
572
566
  complete: () => {
573
567
  this.deleteQuery(s);
574
568
  }
575
569
  });
576
- return u.sub = i, u;
570
+ return u.sub = l, u;
577
571
  }
578
572
  deleteQuery(t) {
579
573
  const r = this.queryMap.get(t);
@@ -585,17 +579,17 @@ class Be {
585
579
  });
586
580
  }
587
581
  }
588
- const de = X(void 0), bt = Z(
582
+ const de = X(void 0), wt = Z(
589
583
  ({
590
584
  children: e,
591
585
  client: t
592
586
  }) => {
593
- const [r] = ve(() => t ?? new Be());
587
+ const [r] = Se(() => t ?? new et());
594
588
  return b(() => () => {
595
589
  r.destroy();
596
590
  }, [r]), /* @__PURE__ */ ce(de.Provider, { value: r, children: e });
597
591
  }
598
- ), et = () => {
592
+ ), tt = () => {
599
593
  const e = B(de);
600
594
  if (!e)
601
595
  throw new Error(
@@ -603,16 +597,16 @@ const de = X(void 0), bt = Z(
603
597
  );
604
598
  return e;
605
599
  };
606
- function It(e, t) {
607
- const r = ae(t), n = et();
600
+ function Et(e, t) {
601
+ const r = oe(t), n = tt();
608
602
  return Qe(
609
603
  {
610
604
  ...e,
611
- queryFn: (u) => new Promise((i, o) => {
612
- const a = () => Q(
605
+ queryFn: (u) => new Promise((l, a) => {
606
+ const o = () => Q(
613
607
  () => typeof e.queryFn == "function" ? e.queryFn(u) : e.queryFn
614
- ), f = oe(u.queryKey), l = n.getQuery(f) ?? n.setQuery(u.queryKey, a(), u.signal);
615
- l.query$.pipe(
608
+ ), f = ae(u.queryKey), i = n.getQuery(f) ?? n.setQuery(u.queryKey, o(), u.signal);
609
+ i.query$.pipe(
616
610
  ue(1),
617
611
  /**
618
612
  * If several values are emitted during this delay, we will only
@@ -621,17 +615,17 @@ function It(e, t) {
621
615
  */
622
616
  $e(1)
623
617
  ).subscribe({
624
- error: (g) => o(g),
618
+ error: (g) => a(g),
625
619
  complete: () => {
626
- if ((l == null ? void 0 : l.lastData) === void 0)
627
- return l.signal.aborted || (console.log(
620
+ if ((i == null ? void 0 : i.lastData) === void 0)
621
+ return i.signal.aborted || (console.log(
628
622
  `cancelled due to stream completing without data for query ${f}`,
629
- l == null ? void 0 : l.lastData
623
+ i == null ? void 0 : i.lastData
630
624
  ), r.cancelQueries({
631
625
  queryKey: u.queryKey,
632
626
  exact: !0
633
- })), i(void 0);
634
- i(l.lastData.value), (l == null ? void 0 : l.isCompleted) === !1 && setTimeout(() => {
627
+ })), l(void 0);
628
+ l(i.lastData.value), (i == null ? void 0 : i.isCompleted) === !1 && setTimeout(() => {
635
629
  r == null || r.refetchQueries({
636
630
  queryKey: u.queryKey,
637
631
  exact: !0
@@ -654,10 +648,10 @@ function me(e, t) {
654
648
  }), n = Te(
655
649
  {
656
650
  ...e,
657
- mutationFn: (a) => {
651
+ mutationFn: (o) => {
658
652
  let f;
659
- return new Promise((l, m) => {
660
- (typeof e.mutationFn == "function" ? e.mutationFn(a) : e.mutationFn).pipe(ue(1)).subscribe({
653
+ return new Promise((i, m) => {
654
+ (typeof e.mutationFn == "function" ? e.mutationFn(o) : e.mutationFn).pipe(ue(1)).subscribe({
661
655
  next: (d) => {
662
656
  f = { value: d };
663
657
  },
@@ -667,128 +661,133 @@ function me(e, t) {
667
661
  complete: () => {
668
662
  if (f === void 0)
669
663
  return m(new Error("Stream completed without any data"));
670
- l(f.value);
664
+ i(f.value);
671
665
  }
672
666
  });
673
667
  });
674
668
  }
675
669
  },
676
670
  t
677
- ), { status: s, isPending: c, isError: u, isSuccess: i, isIdle: o } = n;
671
+ ), { status: s, isPending: c, isError: u, isSuccess: l, isIdle: a } = n;
678
672
  return b(() => {
679
673
  r.next({
680
674
  status: s,
681
675
  isPending: c,
682
676
  isError: u,
683
- isSuccess: i,
684
- isIdle: o
677
+ isSuccess: l,
678
+ isIdle: a
685
679
  });
686
- }, [s, c, u, i, o, r]), { ...n, state$: r };
680
+ }, [s, c, u, l, a, r]), { ...n, state$: r };
687
681
  }
688
- function wt(e, t) {
682
+ function Vt(e, t) {
689
683
  const [r, n] = ke(), { mutate: s, mutateAsync: c, ...u } = me(
690
684
  {
691
685
  ...e,
692
- mutationFn: (a) => (typeof e.mutationFn == "function" ? e.mutationFn(a) : e.mutationFn).pipe(se(r), Me(null))
686
+ mutationFn: (o) => (typeof e.mutationFn == "function" ? e.mutationFn(o) : e.mutationFn).pipe(se(r), Me(null))
693
687
  },
694
688
  t
695
- ), i = h(
696
- (a) => (n(), s(a)),
689
+ ), l = h(
690
+ (o) => (n(), s(o)),
697
691
  [s, n]
698
- ), o = h(
699
- (a) => (n(), c(a)),
692
+ ), a = h(
693
+ (o) => (n(), c(o)),
700
694
  [c, n]
701
695
  );
702
- return { ...u, mutate: i, mutateAsync: o };
696
+ return { ...u, mutate: l, mutateAsync: a };
703
697
  }
704
- function Et(e, t) {
705
- const r = ae(t), n = e.mutationKey, { mutateAsync: s, ...c } = me(
698
+ function xt(e, t) {
699
+ const r = oe(t), n = e.mutationKey, { mutateAsync: s, ...c } = me(
706
700
  {
707
701
  ...e,
708
- onMutate({ variables: o }) {
709
- var a;
710
- return (a = e.onMutate) == null ? void 0 : a.call(e, o);
702
+ onMutate({ variables: a }) {
703
+ var o;
704
+ return (o = e.onMutate) == null ? void 0 : o.call(e, a);
711
705
  },
712
- onSuccess(o, a, f) {
713
- var l;
714
- return (l = e.onSuccess) == null ? void 0 : l.call(e, o, a.variables, f);
706
+ onSuccess(a, o, f) {
707
+ var i;
708
+ return (i = e.onSuccess) == null ? void 0 : i.call(e, a, o.variables, f);
715
709
  },
716
- onError(o, a, f) {
717
- var l;
718
- return (l = e.onError) == null ? void 0 : l.call(e, o, a.variables, f);
710
+ onError(a, o, f) {
711
+ var i;
712
+ return (i = e.onError) == null ? void 0 : i.call(e, a, o.variables, f);
719
713
  },
720
- onSettled(o, a, f, l) {
714
+ onSettled(a, o, f, i) {
721
715
  var m;
722
- return (m = e.onSettled) == null ? void 0 : m.call(e, o, a, f.variables, l);
716
+ return (m = e.onSettled) == null ? void 0 : m.call(e, a, o, f.variables, i);
723
717
  },
724
- mutationFn: ({ ready$: o, variables: a }) => {
725
- const f = typeof e.mutationFn == "function" ? e.mutationFn(a) : e.mutationFn;
726
- return o.pipe(
727
- Ne((l) => l),
718
+ mutationFn: ({ ready$: a, variables: o }) => {
719
+ const f = typeof e.mutationFn == "function" ? e.mutationFn(o) : e.mutationFn;
720
+ return a.pipe(
721
+ Ne((i) => i),
728
722
  Pe(),
729
- F(() => f)
723
+ C(() => f)
730
724
  );
731
725
  }
732
726
  },
733
727
  t
734
728
  ), u = h(
735
- async (o) => {
736
- const a = r.getMutationCache().findAll({
729
+ async (a) => {
730
+ const o = r.getMutationCache().findAll({
737
731
  mutationKey: n,
738
732
  exact: !0
739
- }), f = new C(!1), l = s({ variables: o, ready$: f });
733
+ }), f = new F(!1), i = s({ variables: a, ready$: f });
740
734
  return await Promise.all(
741
- a.map((m) => m.continue().catch(L))
742
- ), f.next(!0), await l.finally(() => {
735
+ o.map((m) => m.continue().catch(L))
736
+ ), f.next(!0), await i.finally(() => {
743
737
  f.complete();
744
738
  });
745
739
  },
746
740
  [s, r, n]
747
- ), i = h(
748
- (o) => {
749
- u(o).catch(L);
741
+ ), l = h(
742
+ (a) => {
743
+ u(a).catch(L);
750
744
  },
751
745
  [u]
752
746
  );
753
- return { ...c, mutate: i, mutateAsync: u };
747
+ return { ...c, mutate: l, mutateAsync: u };
754
748
  }
755
749
  export {
756
750
  de as Context,
757
- Be as QueryClient$,
758
- bt as QueryClientProvider$,
751
+ et as QueryClient$,
752
+ wt as QueryClientProvider$,
759
753
  _e as SIGNAL_RESET,
760
754
  le as Signal,
761
- $ as VirtualSignal,
762
- pt as arrayEqual,
763
- Ye as createLocalStorageAdapter,
764
- vt as createLocalforageAdapter,
755
+ St as SignalContextProvider,
756
+ fe as SignalReactContext,
757
+ A as VirtualSignal,
758
+ gt as arrayEqual,
759
+ Ue as createLocalStorageAdapter,
760
+ bt as createLocalforageAdapter,
765
761
  Ke as exponentialBackoffDelay,
766
762
  He as getDelay,
767
- mt as isDefined,
763
+ pt as isDefined,
768
764
  Y as isPromiseLike,
769
- gt as isServer,
770
- dt as retryBackoff,
771
- it as signal,
765
+ ht as isServer,
766
+ mt as retryBackoff,
767
+ lt as signal,
772
768
  j as useBehaviorSubject,
773
- Et as useContactMutation$,
769
+ xt as useContactMutation$,
774
770
  je as useEffectOnce,
775
771
  U as useLiveBehaviorSubject,
776
- S as useLiveRef,
777
- yt as useMount,
772
+ v as useLiveRef,
773
+ ze as useMakeOrRetrieveSignal,
774
+ dt as useMount,
778
775
  me as useMutation$,
779
776
  ke as useObservableCallback,
780
777
  ot as useObservableState,
781
778
  k as useObserve,
782
- St as usePersistSignals,
783
- It as useQuery$,
784
- et as useQueryClient$,
785
- ht as useSignal,
786
- ze as useSignalValue,
779
+ It as usePersistSignals,
780
+ Et as useQuery$,
781
+ tt as useQueryClient$,
782
+ Je as useSetSignal,
783
+ vt as useSignal,
784
+ ye as useSignalContext,
785
+ Le as useSignalValue,
787
786
  ie as useSubject,
788
787
  De as useSubscribe,
789
- at as useSubscribeEffect,
790
- wt as useSwitchMutation$,
791
- ft as useUnmountObservable,
792
- lt as virtualSignal
788
+ it as useSubscribeEffect,
789
+ Vt as useSwitchMutation$,
790
+ yt as useUnmountObservable,
791
+ ft as virtualSignal
793
792
  };
794
793
  //# sourceMappingURL=index.js.map