@leancodepl/react-query-cqrs-client 9.7.3 → 10.0.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.
package/dist/index.js CHANGED
@@ -1,2470 +1,1188 @@
1
- import * as R from "react";
2
- import "react/jsx-runtime";
3
- var ne = class {
4
- constructor() {
5
- this.listeners = /* @__PURE__ */ new Set(), this.subscribe = this.subscribe.bind(this);
6
- }
7
- subscribe(e) {
8
- return this.listeners.add(e), this.onSubscribe(), () => {
9
- this.listeners.delete(e), this.onUnsubscribe();
10
- };
11
- }
12
- hasListeners() {
13
- return this.listeners.size > 0;
14
- }
15
- onSubscribe() {
16
- }
17
- onUnsubscribe() {
18
- }
19
- }, Et = {
20
- // We need the wrapper function syntax below instead of direct references to
21
- // global setTimeout etc.
22
- //
23
- // BAD: `setTimeout: setTimeout`
24
- // GOOD: `setTimeout: (cb, delay) => setTimeout(cb, delay)`
25
- //
26
- // If we use direct references here, then anything that wants to spy on or
27
- // replace the global setTimeout (like tests) won't work since we'll already
28
- // have a hard reference to the original implementation at the time when this
29
- // file was imported.
30
- setTimeout: (e, t) => setTimeout(e, t),
31
- clearTimeout: (e) => clearTimeout(e),
32
- setInterval: (e, t) => setInterval(e, t),
33
- clearInterval: (e) => clearInterval(e)
34
- }, St = class {
35
- // We cannot have TimeoutManager<T> as we must instantiate it with a concrete
36
- // type at app boot; and if we leave that type, then any new timer provider
37
- // would need to support ReturnType<typeof setTimeout>, which is infeasible.
38
- //
39
- // We settle for type safety for the TimeoutProvider type, and accept that
40
- // this class is unsafe internally to allow for extension.
41
- #t = Et;
42
- #e = !1;
43
- setTimeoutProvider(e) {
44
- process.env.NODE_ENV !== "production" && this.#e && e !== this.#t && console.error(
45
- "[timeoutManager]: Switching provider after calls to previous provider might result in unexpected behavior.",
46
- { previous: this.#t, provider: e }
47
- ), this.#t = e, process.env.NODE_ENV !== "production" && (this.#e = !1);
48
- }
49
- setTimeout(e, t) {
50
- return process.env.NODE_ENV !== "production" && (this.#e = !0), this.#t.setTimeout(e, t);
51
- }
52
- clearTimeout(e) {
53
- this.#t.clearTimeout(e);
54
- }
55
- setInterval(e, t) {
56
- return process.env.NODE_ENV !== "production" && (this.#e = !0), this.#t.setInterval(e, t);
57
- }
58
- clearInterval(e) {
59
- this.#t.clearInterval(e);
60
- }
61
- }, X = new St();
62
- function Ot(e) {
63
- setTimeout(e, 0);
64
- }
65
- var V = typeof window > "u" || "Deno" in globalThis;
66
- function Y() {
67
- }
68
- function ke(e) {
69
- return typeof e == "number" && e >= 0 && e !== 1 / 0;
70
- }
71
- function Pt(e, t) {
72
- return Math.max(e + (t || 0) - Date.now(), 0);
73
- }
74
- function B(e, t) {
75
- return typeof e == "function" ? e(t) : e;
76
- }
77
- function F(e, t) {
78
- return typeof e == "function" ? e(t) : e;
79
- }
80
- function Ce(e) {
81
- return JSON.stringify(
82
- e,
83
- (t, r) => fe(r) ? Object.keys(r).sort().reduce((n, i) => (n[i] = r[i], n), {}) : r
84
- );
85
- }
86
- var Rt = Object.prototype.hasOwnProperty;
87
- function le(e, t) {
88
- if (e === t)
89
- return e;
90
- const r = je(e) && je(t);
91
- if (!r && !(fe(e) && fe(t))) return t;
92
- const i = (r ? e : Object.keys(e)).length, s = r ? t : Object.keys(t), a = s.length, l = r ? new Array(a) : {};
93
- let o = 0;
94
- for (let c = 0; c < a; c++) {
95
- const u = r ? c : s[c], f = e[u], h = t[u];
96
- if (f === h) {
97
- l[u] = f, (r ? c < i : Rt.call(e, u)) && o++;
98
- continue;
99
- }
100
- if (f === null || h === null || typeof f != "object" || typeof h != "object") {
101
- l[u] = h;
102
- continue;
103
- }
104
- const d = le(f, h);
105
- l[u] = d, d === f && o++;
106
- }
107
- return i === a && o === i ? e : l;
108
- }
109
- function Z(e, t) {
110
- if (!t || Object.keys(e).length !== Object.keys(t).length)
111
- return !1;
112
- for (const r in e)
113
- if (e[r] !== t[r])
114
- return !1;
115
- return !0;
116
- }
117
- function je(e) {
118
- return Array.isArray(e) && e.length === Object.keys(e).length;
119
- }
120
- function fe(e) {
121
- if (!Le(e))
122
- return !1;
123
- const t = e.constructor;
124
- if (t === void 0)
125
- return !0;
126
- const r = t.prototype;
127
- return !(!Le(r) || !r.hasOwnProperty("isPrototypeOf") || Object.getPrototypeOf(e) !== Object.prototype);
128
- }
129
- function Le(e) {
130
- return Object.prototype.toString.call(e) === "[object Object]";
131
- }
132
- function Me(e, t, r) {
133
- if (typeof r.structuralSharing == "function")
134
- return r.structuralSharing(e, t);
135
- if (r.structuralSharing !== !1) {
136
- if (process.env.NODE_ENV !== "production")
137
- try {
138
- return le(e, t);
139
- } catch (n) {
140
- throw console.error(
141
- `Structural sharing requires data to be JSON serializable. To fix this, turn off structuralSharing or return JSON-serializable data from your queryFn. [${r.queryHash}]: ${n}`
142
- ), n;
143
- }
144
- return le(e, t);
145
- }
146
- return t;
147
- }
148
- function Tt(e, t, r = 0) {
149
- const n = [...e, t];
150
- return r && n.length > r ? n.slice(1) : n;
151
- }
152
- function xt(e, t, r = 0) {
153
- const n = [t, ...e];
154
- return r && n.length > r ? n.slice(0, -1) : n;
155
- }
156
- var Qe = /* @__PURE__ */ Symbol();
157
- function It(e, t) {
158
- return process.env.NODE_ENV !== "production" && e.queryFn === Qe && console.error(
159
- `Attempted to invoke queryFn when set to skipToken. This is likely a configuration error. Query hash: '${e.queryHash}'`
160
- ), !e.queryFn && t?.initialPromise ? () => t.initialPromise : !e.queryFn || e.queryFn === Qe ? () => Promise.reject(new Error(`Missing queryFn: '${e.queryHash}'`)) : e.queryFn;
161
- }
162
- function Xe(e, t) {
163
- return typeof e == "function" ? e(...t) : !!e;
164
- }
165
- var At = class extends ne {
166
- #t;
167
- #e;
168
- #r;
169
- constructor() {
170
- super(), this.#r = (e) => {
171
- if (!V && window.addEventListener) {
172
- const t = () => e();
173
- return window.addEventListener("visibilitychange", t, !1), () => {
174
- window.removeEventListener("visibilitychange", t);
175
- };
176
- }
177
- };
178
- }
179
- onSubscribe() {
180
- this.#e || this.setEventListener(this.#r);
181
- }
182
- onUnsubscribe() {
183
- this.hasListeners() || (this.#e?.(), this.#e = void 0);
184
- }
185
- setEventListener(e) {
186
- this.#r = e, this.#e?.(), this.#e = e((t) => {
187
- typeof t == "boolean" ? this.setFocused(t) : this.onFocus();
188
- });
189
- }
190
- setFocused(e) {
191
- this.#t !== e && (this.#t = e, this.onFocus());
192
- }
193
- onFocus() {
194
- const e = this.isFocused();
195
- this.listeners.forEach((t) => {
196
- t(e);
197
- });
198
- }
199
- isFocused() {
200
- return typeof this.#t == "boolean" ? this.#t : globalThis.document?.visibilityState !== "hidden";
201
- }
202
- }, Ft = new At();
203
- function De() {
204
- let e, t;
205
- const r = new Promise((i, s) => {
206
- e = i, t = s;
207
- });
208
- r.status = "pending", r.catch(() => {
209
- });
210
- function n(i) {
211
- Object.assign(r, i), delete r.resolve, delete r.reject;
212
- }
213
- return r.resolve = (i) => {
214
- n({
215
- status: "fulfilled",
216
- value: i
217
- }), e(i);
218
- }, r.reject = (i) => {
219
- n({
220
- status: "rejected",
221
- reason: i
222
- }), t(i);
223
- }, r;
224
- }
225
- var kt = Ot;
226
- function Ct() {
227
- let e = [], t = 0, r = (l) => {
228
- l();
229
- }, n = (l) => {
230
- l();
231
- }, i = kt;
232
- const s = (l) => {
233
- t ? e.push(l) : i(() => {
234
- r(l);
235
- });
236
- }, a = () => {
237
- const l = e;
238
- e = [], l.length && i(() => {
239
- n(() => {
240
- l.forEach((o) => {
241
- r(o);
242
- });
243
- });
244
- });
245
- };
246
- return {
247
- batch: (l) => {
248
- let o;
249
- t++;
250
- try {
251
- o = l();
252
- } finally {
253
- t--, t || a();
254
- }
255
- return o;
256
- },
257
- /**
258
- * All calls to the wrapped function will be batched.
259
- */
260
- batchCalls: (l) => (...o) => {
261
- s(() => {
262
- l(...o);
263
- });
264
- },
265
- schedule: s,
266
- /**
267
- * Use this method to set a custom notify function.
268
- * This can be used to for example wrap notifications with `React.act` while running tests.
269
- */
270
- setNotifyFunction: (l) => {
271
- r = l;
272
- },
273
- /**
274
- * Use this method to set a custom function to batch notifications together into a single tick.
275
- * By default React Query will use the batch function provided by ReactDOM or React Native.
276
- */
277
- setBatchNotifyFunction: (l) => {
278
- n = l;
279
- },
280
- setScheduler: (l) => {
281
- i = l;
282
- }
283
- };
284
- }
285
- var ie = Ct(), jt = class extends ne {
286
- #t = !0;
287
- #e;
288
- #r;
289
- constructor() {
290
- super(), this.#r = (e) => {
291
- if (!V && window.addEventListener) {
292
- const t = () => e(!0), r = () => e(!1);
293
- return window.addEventListener("online", t, !1), window.addEventListener("offline", r, !1), () => {
294
- window.removeEventListener("online", t), window.removeEventListener("offline", r);
295
- };
296
- }
297
- };
298
- }
299
- onSubscribe() {
300
- this.#e || this.setEventListener(this.#r);
301
- }
302
- onUnsubscribe() {
303
- this.hasListeners() || (this.#e?.(), this.#e = void 0);
304
- }
305
- setEventListener(e) {
306
- this.#r = e, this.#e?.(), this.#e = e(this.setOnline.bind(this));
307
- }
308
- setOnline(e) {
309
- this.#t !== e && (this.#t = e, this.listeners.forEach((r) => {
310
- r(e);
311
- }));
312
- }
313
- isOnline() {
314
- return this.#t;
315
- }
316
- }, Lt = new jt();
317
- function Mt(e) {
318
- return (e ?? "online") === "online" ? Lt.isOnline() : !0;
319
- }
320
- function Qt(e, t) {
321
- return {
322
- fetchFailureCount: 0,
323
- fetchFailureReason: null,
324
- fetchStatus: Mt(t.networkMode) ? "fetching" : "paused",
325
- ...e === void 0 && {
326
- error: null,
327
- status: "pending"
328
- }
329
- };
330
- }
331
- var We = class extends ne {
332
- constructor(e, t) {
333
- super(), this.options = t, this.#t = e, this.#a = null, this.#o = De(), this.bindMethods(), this.setOptions(t);
334
- }
335
- #t;
336
- #e = void 0;
337
- #r = void 0;
338
- #n = void 0;
339
- #i;
340
- #s;
341
- #o;
342
- #a;
343
- #v;
344
- #h;
345
- // This property keeps track of the last query with defined data.
346
- // It will be used to pass the previous data and query to the placeholder function between renders.
347
- #d;
348
- #c;
349
- #l;
350
- #u;
351
- #p = /* @__PURE__ */ new Set();
352
- bindMethods() {
353
- this.refetch = this.refetch.bind(this);
354
- }
355
- onSubscribe() {
356
- this.listeners.size === 1 && (this.#e.addObserver(this), Ne(this.#e, this.options) ? this.#f() : this.updateResult(), this.#g());
357
- }
358
- onUnsubscribe() {
359
- this.hasListeners() || this.destroy();
360
- }
361
- shouldFetchOnReconnect() {
362
- return he(
363
- this.#e,
364
- this.options,
365
- this.options.refetchOnReconnect
366
- );
367
- }
368
- shouldFetchOnWindowFocus() {
369
- return he(
370
- this.#e,
371
- this.options,
372
- this.options.refetchOnWindowFocus
373
- );
374
- }
375
- destroy() {
376
- this.listeners = /* @__PURE__ */ new Set(), this.#w(), this.#E(), this.#e.removeObserver(this);
377
- }
378
- setOptions(e) {
379
- const t = this.options, r = this.#e;
380
- if (this.options = this.#t.defaultQueryOptions(e), this.options.enabled !== void 0 && typeof this.options.enabled != "boolean" && typeof this.options.enabled != "function" && typeof F(this.options.enabled, this.#e) != "boolean")
381
- throw new Error(
382
- "Expected enabled to be a boolean or a callback that returns a boolean"
383
- );
384
- this.#S(), this.#e.setOptions(this.options), t._defaulted && !Z(this.options, t) && this.#t.getQueryCache().notify({
385
- type: "observerOptionsUpdated",
386
- query: this.#e,
387
- observer: this
388
- });
389
- const n = this.hasListeners();
390
- n && Ue(
391
- this.#e,
392
- r,
393
- this.options,
394
- t
395
- ) && this.#f(), this.updateResult(), n && (this.#e !== r || F(this.options.enabled, this.#e) !== F(t.enabled, this.#e) || B(this.options.staleTime, this.#e) !== B(t.staleTime, this.#e)) && this.#y();
396
- const i = this.#m();
397
- n && (this.#e !== r || F(this.options.enabled, this.#e) !== F(t.enabled, this.#e) || i !== this.#u) && this.#b(i);
398
- }
399
- getOptimisticResult(e) {
400
- const t = this.#t.getQueryCache().build(this.#t, e), r = this.createResult(t, e);
401
- return Nt(this, r) && (this.#n = r, this.#s = this.options, this.#i = this.#e.state), r;
402
- }
403
- getCurrentResult() {
404
- return this.#n;
405
- }
406
- trackResult(e, t) {
407
- return new Proxy(e, {
408
- get: (r, n) => (this.trackProp(n), t?.(n), n === "promise" && !this.options.experimental_prefetchInRender && this.#o.status === "pending" && this.#o.reject(
409
- new Error(
410
- "experimental_prefetchInRender feature flag is not enabled"
411
- )
412
- ), Reflect.get(r, n))
413
- });
414
- }
415
- trackProp(e) {
416
- this.#p.add(e);
417
- }
418
- getCurrentQuery() {
419
- return this.#e;
420
- }
421
- refetch({ ...e } = {}) {
422
- return this.fetch({
423
- ...e
424
- });
425
- }
426
- fetchOptimistic(e) {
427
- const t = this.#t.defaultQueryOptions(e), r = this.#t.getQueryCache().build(this.#t, t);
428
- return r.fetch().then(() => this.createResult(r, t));
429
- }
430
- fetch(e) {
431
- return this.#f({
432
- ...e,
433
- cancelRefetch: e.cancelRefetch ?? !0
434
- }).then(() => (this.updateResult(), this.#n));
435
- }
436
- #f(e) {
437
- this.#S();
438
- let t = this.#e.fetch(
439
- this.options,
440
- e
441
- );
442
- return e?.throwOnError || (t = t.catch(Y)), t;
443
- }
444
- #y() {
445
- this.#w();
446
- const e = B(
447
- this.options.staleTime,
448
- this.#e
449
- );
450
- if (V || this.#n.isStale || !ke(e))
451
- return;
452
- const r = Pt(this.#n.dataUpdatedAt, e) + 1;
453
- this.#c = X.setTimeout(() => {
454
- this.#n.isStale || this.updateResult();
455
- }, r);
456
- }
457
- #m() {
458
- return (typeof this.options.refetchInterval == "function" ? this.options.refetchInterval(this.#e) : this.options.refetchInterval) ?? !1;
459
- }
460
- #b(e) {
461
- this.#E(), this.#u = e, !(V || F(this.options.enabled, this.#e) === !1 || !ke(this.#u) || this.#u === 0) && (this.#l = X.setInterval(() => {
462
- (this.options.refetchIntervalInBackground || Ft.isFocused()) && this.#f();
463
- }, this.#u));
464
- }
465
- #g() {
466
- this.#y(), this.#b(this.#m());
467
- }
468
- #w() {
469
- this.#c && (X.clearTimeout(this.#c), this.#c = void 0);
470
- }
471
- #E() {
472
- this.#l && (X.clearInterval(this.#l), this.#l = void 0);
473
- }
474
- createResult(e, t) {
475
- const r = this.#e, n = this.options, i = this.#n, s = this.#i, a = this.#s, o = e !== r ? e.state : this.#r, { state: c } = e;
476
- let u = { ...c }, f = !1, h;
477
- if (t._optimisticResults) {
478
- const T = this.hasListeners(), _ = !T && Ne(e, t), k = T && Ue(e, r, t, n);
479
- (_ || k) && (u = {
480
- ...u,
481
- ...Qt(c.data, e.options)
482
- }), t._optimisticResults === "isRestoring" && (u.fetchStatus = "idle");
483
- }
484
- let { error: d, errorUpdatedAt: v, status: p } = u;
485
- h = u.data;
486
- let S = !1;
487
- if (t.placeholderData !== void 0 && h === void 0 && p === "pending") {
488
- let T;
489
- i?.isPlaceholderData && t.placeholderData === a?.placeholderData ? (T = i.data, S = !0) : T = typeof t.placeholderData == "function" ? t.placeholderData(
490
- this.#d?.state.data,
491
- this.#d
492
- ) : t.placeholderData, T !== void 0 && (p = "success", h = Me(
493
- i?.data,
494
- T,
495
- t
496
- ), f = !0);
497
- }
498
- if (t.select && h !== void 0 && !S)
499
- if (i && h === s?.data && t.select === this.#v)
500
- h = this.#h;
501
- else
502
- try {
503
- this.#v = t.select, h = t.select(h), h = Me(i?.data, h, t), this.#h = h, this.#a = null;
504
- } catch (T) {
505
- this.#a = T;
506
- }
507
- this.#a && (d = this.#a, h = this.#h, v = Date.now(), p = "error");
508
- const g = u.fetchStatus === "fetching", P = p === "pending", w = p === "error", y = P && g, m = h !== void 0, A = {
509
- status: p,
510
- fetchStatus: u.fetchStatus,
511
- isPending: P,
512
- isSuccess: p === "success",
513
- isError: w,
514
- isInitialLoading: y,
515
- isLoading: y,
516
- data: h,
517
- dataUpdatedAt: u.dataUpdatedAt,
518
- error: d,
519
- errorUpdatedAt: v,
520
- failureCount: u.fetchFailureCount,
521
- failureReason: u.fetchFailureReason,
522
- errorUpdateCount: u.errorUpdateCount,
523
- isFetched: u.dataUpdateCount > 0 || u.errorUpdateCount > 0,
524
- isFetchedAfterMount: u.dataUpdateCount > o.dataUpdateCount || u.errorUpdateCount > o.errorUpdateCount,
525
- isFetching: g,
526
- isRefetching: g && !P,
527
- isLoadingError: w && !m,
528
- isPaused: u.fetchStatus === "paused",
529
- isPlaceholderData: f,
530
- isRefetchError: w && m,
531
- isStale: me(e, t),
532
- refetch: this.refetch,
533
- promise: this.#o,
534
- isEnabled: F(t.enabled, e) !== !1
535
- };
536
- if (this.options.experimental_prefetchInRender) {
537
- const T = (L) => {
538
- A.status === "error" ? L.reject(A.error) : A.data !== void 0 && L.resolve(A.data);
539
- }, _ = () => {
540
- const L = this.#o = A.promise = De();
541
- T(L);
542
- }, k = this.#o;
543
- switch (k.status) {
544
- case "pending":
545
- e.queryHash === r.queryHash && T(k);
546
- break;
547
- case "fulfilled":
548
- (A.status === "error" || A.data !== k.value) && _();
549
- break;
550
- case "rejected":
551
- (A.status !== "error" || A.error !== k.reason) && _();
552
- break;
553
- }
554
- }
555
- return A;
556
- }
557
- updateResult() {
558
- const e = this.#n, t = this.createResult(this.#e, this.options);
559
- if (this.#i = this.#e.state, this.#s = this.options, this.#i.data !== void 0 && (this.#d = this.#e), Z(t, e))
560
- return;
561
- this.#n = t;
562
- const r = () => {
563
- if (!e)
564
- return !0;
565
- const { notifyOnChangeProps: n } = this.options, i = typeof n == "function" ? n() : n;
566
- if (i === "all" || !i && !this.#p.size)
567
- return !0;
568
- const s = new Set(
569
- i ?? this.#p
570
- );
571
- return this.options.throwOnError && s.add("error"), Object.keys(this.#n).some((a) => {
572
- const l = a;
573
- return this.#n[l] !== e[l] && s.has(l);
574
- });
575
- };
576
- this.#O({ listeners: r() });
577
- }
578
- #S() {
579
- const e = this.#t.getQueryCache().build(this.#t, this.options);
580
- if (e === this.#e)
581
- return;
582
- const t = this.#e;
583
- this.#e = e, this.#r = e.state, this.hasListeners() && (t?.removeObserver(this), e.addObserver(this));
584
- }
585
- onQueryUpdate() {
586
- this.updateResult(), this.hasListeners() && this.#g();
587
- }
588
- #O(e) {
589
- ie.batch(() => {
590
- e.listeners && this.listeners.forEach((t) => {
591
- t(this.#n);
592
- }), this.#t.getQueryCache().notify({
593
- query: this.#e,
594
- type: "observerResultsUpdated"
595
- });
596
- });
597
- }
598
- };
599
- function Dt(e, t) {
600
- return F(t.enabled, e) !== !1 && e.state.data === void 0 && !(e.state.status === "error" && t.retryOnMount === !1);
601
- }
602
- function Ne(e, t) {
603
- return Dt(e, t) || e.state.data !== void 0 && he(e, t, t.refetchOnMount);
604
- }
605
- function he(e, t, r) {
606
- if (F(t.enabled, e) !== !1 && B(t.staleTime, e) !== "static") {
607
- const n = typeof r == "function" ? r(e) : r;
608
- return n === "always" || n !== !1 && me(e, t);
609
- }
610
- return !1;
611
- }
612
- function Ue(e, t, r, n) {
613
- return (e !== t || F(n.enabled, e) === !1) && (!r.suspense || e.state.status !== "error") && me(e, r);
614
- }
615
- function me(e, t) {
616
- return F(t.enabled, e) !== !1 && e.isStaleByTime(B(t.staleTime, e));
617
- }
618
- function Nt(e, t) {
619
- return !Z(e.getCurrentResult(), t);
620
- }
621
- function _e(e) {
622
- return {
623
- onFetch: (t, r) => {
624
- const n = t.options, i = t.fetchOptions?.meta?.fetchMore?.direction, s = t.state.data?.pages || [], a = t.state.data?.pageParams || [];
625
- let l = { pages: [], pageParams: [] }, o = 0;
626
- const c = async () => {
627
- let u = !1;
628
- const f = (v) => {
629
- Object.defineProperty(v, "signal", {
630
- enumerable: !0,
631
- get: () => (t.signal.aborted ? u = !0 : t.signal.addEventListener("abort", () => {
632
- u = !0;
633
- }), t.signal)
634
- });
635
- }, h = It(t.options, t.fetchOptions), d = async (v, p, S) => {
636
- if (u)
637
- return Promise.reject();
638
- if (p == null && v.pages.length)
639
- return Promise.resolve(v);
640
- const P = (() => {
641
- const j = {
642
- client: t.client,
643
- queryKey: t.queryKey,
644
- pageParam: p,
645
- direction: S ? "backward" : "forward",
646
- meta: t.options.meta
647
- };
648
- return f(j), j;
649
- })(), w = await h(P), { maxPages: y } = t.options, m = S ? xt : Tt;
650
- return {
651
- pages: m(v.pages, w, y),
652
- pageParams: m(v.pageParams, p, y)
653
- };
654
- };
655
- if (i && s.length) {
656
- const v = i === "backward", p = v ? Ye : de, S = {
657
- pages: s,
658
- pageParams: a
659
- }, g = p(n, S);
660
- l = await d(S, g, v);
661
- } else {
662
- const v = s.length;
663
- do {
664
- const p = o === 0 ? a[0] ?? n.initialPageParam : de(n, l);
665
- if (o > 0 && p == null)
666
- break;
667
- l = await d(l, p), o++;
668
- } while (o < v);
669
- }
670
- return l;
671
- };
672
- t.options.persister ? t.fetchFn = () => t.options.persister?.(
673
- c,
674
- {
675
- client: t.client,
676
- queryKey: t.queryKey,
677
- meta: t.options.meta,
678
- signal: t.signal
679
- },
680
- r
681
- ) : t.fetchFn = c;
682
- }
683
- };
684
- }
685
- function de(e, { pages: t, pageParams: r }) {
686
- const n = t.length - 1;
687
- return t.length > 0 ? e.getNextPageParam(
688
- t[n],
689
- t,
690
- r[n],
691
- r
692
- ) : void 0;
693
- }
694
- function Ye(e, { pages: t, pageParams: r }) {
695
- return t.length > 0 ? e.getPreviousPageParam?.(t[0], t, r[0], r) : void 0;
696
- }
697
- function Ut(e, t) {
698
- return t ? de(e, t) != null : !1;
699
- }
700
- function _t(e, t) {
701
- return !t || !e.getPreviousPageParam ? !1 : Ye(e, t) != null;
702
- }
703
- var qt = class extends We {
704
- constructor(e, t) {
705
- super(e, t);
706
- }
707
- bindMethods() {
708
- super.bindMethods(), this.fetchNextPage = this.fetchNextPage.bind(this), this.fetchPreviousPage = this.fetchPreviousPage.bind(this);
709
- }
710
- setOptions(e) {
711
- super.setOptions({
712
- ...e,
713
- behavior: _e()
714
- });
715
- }
716
- getOptimisticResult(e) {
717
- return e.behavior = _e(), super.getOptimisticResult(e);
718
- }
719
- fetchNextPage(e) {
720
- return this.fetch({
721
- ...e,
722
- meta: {
723
- fetchMore: { direction: "forward" }
724
- }
725
- });
726
- }
727
- fetchPreviousPage(e) {
728
- return this.fetch({
729
- ...e,
730
- meta: {
731
- fetchMore: { direction: "backward" }
732
- }
733
- });
734
- }
735
- createResult(e, t) {
736
- const { state: r } = e, n = super.createResult(e, t), { isFetching: i, isRefetching: s, isError: a, isRefetchError: l } = n, o = r.fetchMeta?.fetchMore?.direction, c = a && o === "forward", u = i && o === "forward", f = a && o === "backward", h = i && o === "backward";
737
- return {
738
- ...n,
739
- fetchNextPage: this.fetchNextPage,
740
- fetchPreviousPage: this.fetchPreviousPage,
741
- hasNextPage: Ut(t, r.data),
742
- hasPreviousPage: _t(t, r.data),
743
- isFetchNextPageError: c,
744
- isFetchingNextPage: u,
745
- isFetchPreviousPageError: f,
746
- isFetchingPreviousPage: h,
747
- isRefetchError: l && !c && !f,
748
- isRefetching: s && !u && !h
749
- };
750
- }
751
- };
752
- function Ht() {
753
- return {
754
- context: void 0,
755
- data: void 0,
756
- error: null,
757
- failureCount: 0,
758
- failureReason: null,
759
- isPaused: !1,
760
- status: "idle",
761
- variables: void 0,
762
- submittedAt: 0
763
- };
764
- }
765
- var Bt = class extends ne {
766
- #t;
767
- #e = void 0;
768
- #r;
769
- #n;
770
- constructor(e, t) {
771
- super(), this.#t = e, this.setOptions(t), this.bindMethods(), this.#i();
772
- }
773
- bindMethods() {
774
- this.mutate = this.mutate.bind(this), this.reset = this.reset.bind(this);
775
- }
776
- setOptions(e) {
777
- const t = this.options;
778
- this.options = this.#t.defaultMutationOptions(e), Z(this.options, t) || this.#t.getMutationCache().notify({
779
- type: "observerOptionsUpdated",
780
- mutation: this.#r,
781
- observer: this
782
- }), t?.mutationKey && this.options.mutationKey && Ce(t.mutationKey) !== Ce(this.options.mutationKey) ? this.reset() : this.#r?.state.status === "pending" && this.#r.setOptions(this.options);
783
- }
784
- onUnsubscribe() {
785
- this.hasListeners() || this.#r?.removeObserver(this);
786
- }
787
- onMutationUpdate(e) {
788
- this.#i(), this.#s(e);
789
- }
790
- getCurrentResult() {
791
- return this.#e;
792
- }
793
- reset() {
794
- this.#r?.removeObserver(this), this.#r = void 0, this.#i(), this.#s();
795
- }
796
- mutate(e, t) {
797
- return this.#n = t, this.#r?.removeObserver(this), this.#r = this.#t.getMutationCache().build(this.#t, this.options), this.#r.addObserver(this), this.#r.execute(e);
798
- }
799
- #i() {
800
- const e = this.#r?.state ?? Ht();
801
- this.#e = {
802
- ...e,
803
- isPending: e.status === "pending",
804
- isSuccess: e.status === "success",
805
- isError: e.status === "error",
806
- isIdle: e.status === "idle",
807
- mutate: this.mutate,
808
- reset: this.reset
809
- };
810
- }
811
- #s(e) {
812
- ie.batch(() => {
813
- if (this.#n && this.hasListeners()) {
814
- const t = this.#e.variables, r = this.#e.context, n = {
815
- client: this.#t,
816
- meta: this.options.meta,
817
- mutationKey: this.options.mutationKey
818
- };
819
- e?.type === "success" ? (this.#n.onSuccess?.(
820
- e.data,
821
- t,
822
- r,
823
- n
824
- ), this.#n.onSettled?.(
825
- e.data,
826
- null,
827
- t,
828
- r,
829
- n
830
- )) : e?.type === "error" && (this.#n.onError?.(
831
- e.error,
832
- t,
833
- r,
834
- n
835
- ), this.#n.onSettled?.(
836
- void 0,
837
- e.error,
838
- t,
839
- r,
840
- n
841
- ));
842
- }
843
- this.listeners.forEach((t) => {
844
- t(this.#e);
845
- });
846
- });
847
- }
848
- }, Kt = R.createContext(
849
- void 0
850
- ), Ze = (e) => {
851
- const t = R.useContext(Kt);
852
- if (e)
853
- return e;
854
- if (!t)
855
- throw new Error("No QueryClient set, use QueryClientProvider to set one");
856
- return t;
857
- }, et = R.createContext(!1), Vt = () => R.useContext(et);
858
- et.Provider;
859
- function $t() {
860
- let e = !1;
861
- return {
862
- clearReset: () => {
863
- e = !1;
864
- },
865
- reset: () => {
866
- e = !0;
867
- },
868
- isReset: () => e
869
- };
870
- }
871
- var zt = R.createContext($t()), Gt = () => R.useContext(zt), Jt = (e, t) => {
872
- (e.suspense || e.throwOnError || e.experimental_prefetchInRender) && (t.isReset() || (e.retryOnMount = !1));
873
- }, Xt = (e) => {
874
- R.useEffect(() => {
875
- e.clearReset();
876
- }, [e]);
877
- }, Wt = ({
878
- result: e,
879
- errorResetBoundary: t,
880
- throwOnError: r,
881
- query: n,
882
- suspense: i
883
- }) => e.isError && !t.isReset() && !e.isFetching && n && (i && e.data === void 0 || Xe(r, [e.error, n])), Yt = (e) => {
884
- if (e.suspense) {
885
- const r = (i) => i === "static" ? i : Math.max(i ?? 1e3, 1e3), n = e.staleTime;
886
- e.staleTime = typeof n == "function" ? (...i) => r(n(...i)) : r(n), typeof e.gcTime == "number" && (e.gcTime = Math.max(
887
- e.gcTime,
888
- 1e3
889
- ));
890
- }
891
- }, Zt = (e, t) => e.isLoading && e.isFetching && !t, er = (e, t) => e?.suspense && t.isPending, qe = (e, t, r) => t.fetchOptimistic(e).catch(() => {
892
- r.clearReset();
893
- });
894
- function tt(e, t, r) {
895
- if (process.env.NODE_ENV !== "production" && (typeof e != "object" || Array.isArray(e)))
896
- throw new Error(
897
- 'Bad argument type. Starting with v5, only the "Object" form is allowed when calling query related functions. Please use the error stack to find the culprit call. More info here: https://tanstack.com/query/latest/docs/react/guides/migrating-to-v5#supports-a-single-signature-one-object'
898
- );
899
- const n = Vt(), i = Gt(), s = Ze(r), a = s.defaultQueryOptions(e);
900
- s.getDefaultOptions().queries?._experimental_beforeQuery?.(
901
- a
902
- ), process.env.NODE_ENV !== "production" && (a.queryFn || console.error(
903
- `[${a.queryHash}]: No queryFn was passed as an option, and no default queryFn was found. The queryFn parameter is only optional when using a default queryFn. More info here: https://tanstack.com/query/latest/docs/framework/react/guides/default-query-function`
904
- )), a._optimisticResults = n ? "isRestoring" : "optimistic", Yt(a), Jt(a, i), Xt(i);
905
- const l = !s.getQueryCache().get(a.queryHash), [o] = R.useState(
906
- () => new t(
907
- s,
908
- a
909
- )
910
- ), c = o.getOptimisticResult(a), u = !n && e.subscribed !== !1;
911
- if (R.useSyncExternalStore(
912
- R.useCallback(
913
- (f) => {
914
- const h = u ? o.subscribe(ie.batchCalls(f)) : Y;
915
- return o.updateResult(), h;
916
- },
917
- [o, u]
918
- ),
919
- () => o.getCurrentResult(),
920
- () => o.getCurrentResult()
921
- ), R.useEffect(() => {
922
- o.setOptions(a);
923
- }, [a, o]), er(a, c))
924
- throw qe(a, o, i);
925
- if (Wt({
926
- result: c,
927
- errorResetBoundary: i,
928
- throwOnError: a.throwOnError,
929
- query: s.getQueryCache().get(a.queryHash),
930
- suspense: a.suspense
931
- }))
932
- throw c.error;
933
- return s.getDefaultOptions().queries?._experimental_afterQuery?.(
934
- a,
935
- c
936
- ), a.experimental_prefetchInRender && !V && Zt(c, n) && (l ? (
937
- // Fetch immediately on render in order to ensure `.promise` is resolved even if the component is unmounted
938
- qe(a, o, i)
939
- ) : (
940
- // subscribe to the "cache promise" so that we can finalize the currentThenable once data comes in
941
- s.getQueryCache().get(a.queryHash)?.promise
942
- ))?.catch(Y).finally(() => {
943
- o.updateResult();
944
- }), a.notifyOnChangeProps ? c : o.trackResult(c);
945
- }
946
- function tr(e, t) {
947
- return tt(e, We, t);
948
- }
949
- function oe(e, t) {
950
- const r = Ze(t), [n] = R.useState(
951
- () => new Bt(
952
- r,
953
- e
954
- )
955
- );
956
- R.useEffect(() => {
957
- n.setOptions(e);
958
- }, [n, e]);
959
- const i = R.useSyncExternalStore(
960
- R.useCallback(
961
- (a) => n.subscribe(ie.batchCalls(a)),
962
- [n]
963
- ),
964
- () => n.getCurrentResult(),
965
- () => n.getCurrentResult()
966
- ), s = R.useCallback(
967
- (a, l) => {
968
- n.mutate(a, l).catch(Y);
969
- },
970
- [n]
971
- );
972
- if (i.error && Xe(n.options.throwOnError, [i.error]))
973
- throw i.error;
974
- return { ...i, mutate: s, mutateAsync: i.mutate };
975
- }
976
- function rr(e, t) {
977
- return tt(
978
- e,
979
- qt,
980
- t
981
- );
982
- }
983
- var pe = function(e, t) {
984
- return pe = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function(r, n) {
985
- r.__proto__ = n;
986
- } || function(r, n) {
987
- for (var i in n) Object.prototype.hasOwnProperty.call(n, i) && (r[i] = n[i]);
988
- }, pe(e, t);
1
+ import { useMutation as _, useInfiniteQuery as Pe, useQuery as je } from "@tanstack/react-query";
2
+ import { catchError as he, throwError as ye, of as ke, race as Re, fromEvent as Ie, firstValueFrom as P, from as Le } from "rxjs";
3
+ import { handleResponse as De } from "@leancodepl/validation";
4
+ import { toLowerFirst as Ue } from "@leancodepl/utils";
5
+ var M = function(e, r) {
6
+ return M = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function(t, n) {
7
+ t.__proto__ = n;
8
+ } || function(t, n) {
9
+ for (var a in n) Object.prototype.hasOwnProperty.call(n, a) && (t[a] = n[a]);
10
+ }, M(e, r);
989
11
  };
990
- function be(e, t) {
991
- if (typeof t != "function" && t !== null)
992
- throw new TypeError("Class extends value " + String(t) + " is not a constructor or null");
993
- pe(e, t);
994
- function r() {
12
+ function z(e, r) {
13
+ if (typeof r != "function" && r !== null)
14
+ throw new TypeError("Class extends value " + String(r) + " is not a constructor or null");
15
+ M(e, r);
16
+ function t() {
995
17
  this.constructor = e;
996
18
  }
997
- e.prototype = t === null ? Object.create(t) : (r.prototype = t.prototype, new r());
19
+ e.prototype = r === null ? Object.create(r) : (t.prototype = r.prototype, new t());
998
20
  }
999
- var K = function() {
1000
- return K = Object.assign || function(t) {
1001
- for (var r, n = 1, i = arguments.length; n < i; n++) {
1002
- r = arguments[n];
1003
- for (var s in r) Object.prototype.hasOwnProperty.call(r, s) && (t[s] = r[s]);
21
+ var L = function() {
22
+ return L = Object.assign || function(r) {
23
+ for (var t, n = 1, a = arguments.length; n < a; n++) {
24
+ t = arguments[n];
25
+ for (var o in t) Object.prototype.hasOwnProperty.call(t, o) && (r[o] = t[o]);
1004
26
  }
1005
- return t;
1006
- }, K.apply(this, arguments);
27
+ return r;
28
+ }, L.apply(this, arguments);
1007
29
  };
1008
- function nr(e, t, r, n) {
1009
- function i(s) {
1010
- return s instanceof r ? s : new r(function(a) {
1011
- a(s);
30
+ function Fe(e, r, t, n) {
31
+ function a(o) {
32
+ return o instanceof t ? o : new t(function(u) {
33
+ u(o);
1012
34
  });
1013
35
  }
1014
- return new (r || (r = Promise))(function(s, a) {
1015
- function l(u) {
36
+ return new (t || (t = Promise))(function(o, u) {
37
+ function l(c) {
1016
38
  try {
1017
- c(n.next(u));
39
+ s(n.next(c));
1018
40
  } catch (f) {
1019
- a(f);
41
+ u(f);
1020
42
  }
1021
43
  }
1022
- function o(u) {
44
+ function i(c) {
1023
45
  try {
1024
- c(n.throw(u));
46
+ s(n.throw(c));
1025
47
  } catch (f) {
1026
- a(f);
48
+ u(f);
1027
49
  }
1028
50
  }
1029
- function c(u) {
1030
- u.done ? s(u.value) : i(u.value).then(l, o);
51
+ function s(c) {
52
+ c.done ? o(c.value) : a(c.value).then(l, i);
1031
53
  }
1032
- c((n = n.apply(e, t || [])).next());
54
+ s((n = n.apply(e, r || [])).next());
1033
55
  });
1034
56
  }
1035
- function rt(e, t) {
1036
- var r = { label: 0, sent: function() {
1037
- if (s[0] & 1) throw s[1];
1038
- return s[1];
1039
- }, trys: [], ops: [] }, n, i, s, a = Object.create((typeof Iterator == "function" ? Iterator : Object).prototype);
1040
- return a.next = l(0), a.throw = l(1), a.return = l(2), typeof Symbol == "function" && (a[Symbol.iterator] = function() {
57
+ function ve(e, r) {
58
+ var t = { label: 0, sent: function() {
59
+ if (o[0] & 1) throw o[1];
60
+ return o[1];
61
+ }, trys: [], ops: [] }, n, a, o, u = Object.create((typeof Iterator == "function" ? Iterator : Object).prototype);
62
+ return u.next = l(0), u.throw = l(1), u.return = l(2), typeof Symbol == "function" && (u[Symbol.iterator] = function() {
1041
63
  return this;
1042
- }), a;
1043
- function l(c) {
1044
- return function(u) {
1045
- return o([c, u]);
64
+ }), u;
65
+ function l(s) {
66
+ return function(c) {
67
+ return i([s, c]);
1046
68
  };
1047
69
  }
1048
- function o(c) {
70
+ function i(s) {
1049
71
  if (n) throw new TypeError("Generator is already executing.");
1050
- for (; a && (a = 0, c[0] && (r = 0)), r; ) try {
1051
- if (n = 1, i && (s = c[0] & 2 ? i.return : c[0] ? i.throw || ((s = i.return) && s.call(i), 0) : i.next) && !(s = s.call(i, c[1])).done) return s;
1052
- switch (i = 0, s && (c = [c[0] & 2, s.value]), c[0]) {
72
+ for (; u && (u = 0, s[0] && (t = 0)), t; ) try {
73
+ if (n = 1, a && (o = s[0] & 2 ? a.return : s[0] ? a.throw || ((o = a.return) && o.call(a), 0) : a.next) && !(o = o.call(a, s[1])).done) return o;
74
+ switch (a = 0, o && (s = [s[0] & 2, o.value]), s[0]) {
1053
75
  case 0:
1054
76
  case 1:
1055
- s = c;
77
+ o = s;
1056
78
  break;
1057
79
  case 4:
1058
- return r.label++, { value: c[1], done: !1 };
80
+ return t.label++, { value: s[1], done: !1 };
1059
81
  case 5:
1060
- r.label++, i = c[1], c = [0];
82
+ t.label++, a = s[1], s = [0];
1061
83
  continue;
1062
84
  case 7:
1063
- c = r.ops.pop(), r.trys.pop();
85
+ s = t.ops.pop(), t.trys.pop();
1064
86
  continue;
1065
87
  default:
1066
- if (s = r.trys, !(s = s.length > 0 && s[s.length - 1]) && (c[0] === 6 || c[0] === 2)) {
1067
- r = 0;
88
+ if (o = t.trys, !(o = o.length > 0 && o[o.length - 1]) && (s[0] === 6 || s[0] === 2)) {
89
+ t = 0;
1068
90
  continue;
1069
91
  }
1070
- if (c[0] === 3 && (!s || c[1] > s[0] && c[1] < s[3])) {
1071
- r.label = c[1];
92
+ if (s[0] === 3 && (!o || s[1] > o[0] && s[1] < o[3])) {
93
+ t.label = s[1];
1072
94
  break;
1073
95
  }
1074
- if (c[0] === 6 && r.label < s[1]) {
1075
- r.label = s[1], s = c;
96
+ if (s[0] === 6 && t.label < o[1]) {
97
+ t.label = o[1], o = s;
1076
98
  break;
1077
99
  }
1078
- if (s && r.label < s[2]) {
1079
- r.label = s[2], r.ops.push(c);
100
+ if (o && t.label < o[2]) {
101
+ t.label = o[2], t.ops.push(s);
1080
102
  break;
1081
103
  }
1082
- s[2] && r.ops.pop(), r.trys.pop();
104
+ o[2] && t.ops.pop(), t.trys.pop();
1083
105
  continue;
1084
106
  }
1085
- c = t.call(e, r);
1086
- } catch (u) {
1087
- c = [6, u], i = 0;
107
+ s = r.call(e, t);
108
+ } catch (c) {
109
+ s = [6, c], a = 0;
1088
110
  } finally {
1089
- n = s = 0;
111
+ n = o = 0;
1090
112
  }
1091
- if (c[0] & 5) throw c[1];
1092
- return { value: c[0] ? c[1] : void 0, done: !0 };
113
+ if (s[0] & 5) throw s[1];
114
+ return { value: s[0] ? s[1] : void 0, done: !0 };
1093
115
  }
1094
116
  }
1095
- function $(e) {
1096
- var t = typeof Symbol == "function" && Symbol.iterator, r = t && e[t], n = 0;
1097
- if (r) return r.call(e);
117
+ function D(e) {
118
+ var r = typeof Symbol == "function" && Symbol.iterator, t = r && e[r], n = 0;
119
+ if (t) return t.call(e);
1098
120
  if (e && typeof e.length == "number") return {
1099
121
  next: function() {
1100
122
  return e && n >= e.length && (e = void 0), { value: e && e[n++], done: !e };
1101
123
  }
1102
124
  };
1103
- throw new TypeError(t ? "Object is not iterable." : "Symbol.iterator is not defined.");
125
+ throw new TypeError(r ? "Object is not iterable." : "Symbol.iterator is not defined.");
1104
126
  }
1105
- function z(e, t) {
1106
- var r = typeof Symbol == "function" && e[Symbol.iterator];
1107
- if (!r) return e;
1108
- var n = r.call(e), i, s = [], a;
127
+ function $(e, r) {
128
+ var t = typeof Symbol == "function" && e[Symbol.iterator];
129
+ if (!t) return e;
130
+ var n = t.call(e), a, o = [], u;
1109
131
  try {
1110
- for (; (t === void 0 || t-- > 0) && !(i = n.next()).done; ) s.push(i.value);
132
+ for (; (r === void 0 || r-- > 0) && !(a = n.next()).done; ) o.push(a.value);
1111
133
  } catch (l) {
1112
- a = { error: l };
134
+ u = { error: l };
1113
135
  } finally {
1114
136
  try {
1115
- i && !i.done && (r = n.return) && r.call(n);
137
+ a && !a.done && (t = n.return) && t.call(n);
1116
138
  } finally {
1117
- if (a) throw a.error;
139
+ if (u) throw u.error;
1118
140
  }
1119
141
  }
1120
- return s;
142
+ return o;
1121
143
  }
1122
- function ee(e, t, r) {
1123
- if (r || arguments.length === 2) for (var n = 0, i = t.length, s; n < i; n++)
1124
- (s || !(n in t)) && (s || (s = Array.prototype.slice.call(t, 0, n)), s[n] = t[n]);
1125
- return e.concat(s || Array.prototype.slice.call(t));
144
+ function q(e, r, t) {
145
+ if (t || arguments.length === 2) for (var n = 0, a = r.length, o; n < a; n++)
146
+ (o || !(n in r)) && (o || (o = Array.prototype.slice.call(r, 0, n)), o[n] = r[n]);
147
+ return e.concat(o || Array.prototype.slice.call(r));
1126
148
  }
1127
- function q(e) {
1128
- return this instanceof q ? (this.v = e, this) : new q(e);
149
+ function R(e) {
150
+ return this instanceof R ? (this.v = e, this) : new R(e);
1129
151
  }
1130
- function ir(e, t, r) {
152
+ function Qe(e, r, t) {
1131
153
  if (!Symbol.asyncIterator) throw new TypeError("Symbol.asyncIterator is not defined.");
1132
- var n = r.apply(e, t || []), i, s = [];
1133
- return i = Object.create((typeof AsyncIterator == "function" ? AsyncIterator : Object).prototype), l("next"), l("throw"), l("return", a), i[Symbol.asyncIterator] = function() {
154
+ var n = t.apply(e, r || []), a, o = [];
155
+ return a = Object.create((typeof AsyncIterator == "function" ? AsyncIterator : Object).prototype), l("next"), l("throw"), l("return", u), a[Symbol.asyncIterator] = function() {
1134
156
  return this;
1135
- }, i;
1136
- function a(d) {
1137
- return function(v) {
1138
- return Promise.resolve(v).then(d, f);
157
+ }, a;
158
+ function u(p) {
159
+ return function(m) {
160
+ return Promise.resolve(m).then(p, f);
1139
161
  };
1140
162
  }
1141
- function l(d, v) {
1142
- n[d] && (i[d] = function(p) {
1143
- return new Promise(function(S, g) {
1144
- s.push([d, p, S, g]) > 1 || o(d, p);
163
+ function l(p, m) {
164
+ n[p] && (a[p] = function(y) {
165
+ return new Promise(function(A, S) {
166
+ o.push([p, y, A, S]) > 1 || i(p, y);
1145
167
  });
1146
- }, v && (i[d] = v(i[d])));
168
+ }, m && (a[p] = m(a[p])));
1147
169
  }
1148
- function o(d, v) {
170
+ function i(p, m) {
1149
171
  try {
1150
- c(n[d](v));
1151
- } catch (p) {
1152
- h(s[0][3], p);
172
+ s(n[p](m));
173
+ } catch (y) {
174
+ d(o[0][3], y);
1153
175
  }
1154
176
  }
1155
- function c(d) {
1156
- d.value instanceof q ? Promise.resolve(d.value.v).then(u, f) : h(s[0][2], d);
177
+ function s(p) {
178
+ p.value instanceof R ? Promise.resolve(p.value.v).then(c, f) : d(o[0][2], p);
1157
179
  }
1158
- function u(d) {
1159
- o("next", d);
180
+ function c(p) {
181
+ i("next", p);
1160
182
  }
1161
- function f(d) {
1162
- o("throw", d);
183
+ function f(p) {
184
+ i("throw", p);
1163
185
  }
1164
- function h(d, v) {
1165
- d(v), s.shift(), s.length && o(s[0][0], s[0][1]);
186
+ function d(p, m) {
187
+ p(m), o.shift(), o.length && i(o[0][0], o[0][1]);
1166
188
  }
1167
189
  }
1168
- function sr(e) {
190
+ function He(e) {
1169
191
  if (!Symbol.asyncIterator) throw new TypeError("Symbol.asyncIterator is not defined.");
1170
- var t = e[Symbol.asyncIterator], r;
1171
- return t ? t.call(e) : (e = typeof $ == "function" ? $(e) : e[Symbol.iterator](), r = {}, n("next"), n("throw"), n("return"), r[Symbol.asyncIterator] = function() {
192
+ var r = e[Symbol.asyncIterator], t;
193
+ return r ? r.call(e) : (e = typeof D == "function" ? D(e) : e[Symbol.iterator](), t = {}, n("next"), n("throw"), n("return"), t[Symbol.asyncIterator] = function() {
1172
194
  return this;
1173
- }, r);
1174
- function n(s) {
1175
- r[s] = e[s] && function(a) {
1176
- return new Promise(function(l, o) {
1177
- a = e[s](a), i(l, o, a.done, a.value);
195
+ }, t);
196
+ function n(o) {
197
+ t[o] = e[o] && function(u) {
198
+ return new Promise(function(l, i) {
199
+ u = e[o](u), a(l, i, u.done, u.value);
1178
200
  });
1179
201
  };
1180
202
  }
1181
- function i(s, a, l, o) {
1182
- Promise.resolve(o).then(function(c) {
1183
- s({ value: c, done: l });
1184
- }, a);
203
+ function a(o, u, l, i) {
204
+ Promise.resolve(i).then(function(s) {
205
+ o({ value: s, done: l });
206
+ }, u);
1185
207
  }
1186
208
  }
1187
- function b(e) {
209
+ function E(e) {
1188
210
  return typeof e == "function";
1189
211
  }
1190
- function ge(e) {
1191
- var t = function(n) {
1192
- Error.call(n), n.stack = new Error().stack;
1193
- }, r = e(t);
1194
- return r.prototype = Object.create(Error.prototype), r.prototype.constructor = r, r;
212
+ function _e(e) {
213
+ return E(e?.lift);
1195
214
  }
1196
- var ae = ge(function(e) {
215
+ function me(e) {
1197
216
  return function(r) {
1198
- e(this), this.message = r ? r.length + ` errors occurred during unsubscription:
1199
- ` + r.map(function(n, i) {
1200
- return i + 1 + ") " + n.toString();
217
+ if (_e(r))
218
+ return r.lift(function(t) {
219
+ try {
220
+ return e(t, this);
221
+ } catch (n) {
222
+ this.error(n);
223
+ }
224
+ });
225
+ throw new TypeError("Unable to lift unknown Observable type");
226
+ };
227
+ }
228
+ function be(e) {
229
+ var r = function(n) {
230
+ Error.call(n), n.stack = new Error().stack;
231
+ }, t = e(r);
232
+ return t.prototype = Object.create(Error.prototype), t.prototype.constructor = t, t;
233
+ }
234
+ var B = be(function(e) {
235
+ return function(t) {
236
+ e(this), this.message = t ? t.length + ` errors occurred during unsubscription:
237
+ ` + t.map(function(n, a) {
238
+ return a + 1 + ") " + n.toString();
1201
239
  }).join(`
1202
- `) : "", this.name = "UnsubscriptionError", this.errors = r;
240
+ `) : "", this.name = "UnsubscriptionError", this.errors = t;
1203
241
  };
1204
242
  });
1205
- function He(e, t) {
243
+ function ue(e, r) {
1206
244
  if (e) {
1207
- var r = e.indexOf(t);
1208
- 0 <= r && e.splice(r, 1);
245
+ var t = e.indexOf(r);
246
+ 0 <= t && e.splice(t, 1);
1209
247
  }
1210
248
  }
1211
- var we = (function() {
1212
- function e(t) {
1213
- this.initialTeardown = t, this.closed = !1, this._parentage = null, this._finalizers = null;
249
+ var C = (function() {
250
+ function e(r) {
251
+ this.initialTeardown = r, this.closed = !1, this._parentage = null, this._finalizers = null;
1214
252
  }
1215
253
  return e.prototype.unsubscribe = function() {
1216
- var t, r, n, i, s;
254
+ var r, t, n, a, o;
1217
255
  if (!this.closed) {
1218
256
  this.closed = !0;
1219
- var a = this._parentage;
1220
- if (a)
1221
- if (this._parentage = null, Array.isArray(a))
257
+ var u = this._parentage;
258
+ if (u)
259
+ if (this._parentage = null, Array.isArray(u))
1222
260
  try {
1223
- for (var l = $(a), o = l.next(); !o.done; o = l.next()) {
1224
- var c = o.value;
1225
- c.remove(this);
261
+ for (var l = D(u), i = l.next(); !i.done; i = l.next()) {
262
+ var s = i.value;
263
+ s.remove(this);
1226
264
  }
1227
- } catch (p) {
1228
- t = { error: p };
265
+ } catch (y) {
266
+ r = { error: y };
1229
267
  } finally {
1230
268
  try {
1231
- o && !o.done && (r = l.return) && r.call(l);
269
+ i && !i.done && (t = l.return) && t.call(l);
1232
270
  } finally {
1233
- if (t) throw t.error;
271
+ if (r) throw r.error;
1234
272
  }
1235
273
  }
1236
274
  else
1237
- a.remove(this);
1238
- var u = this.initialTeardown;
1239
- if (b(u))
275
+ u.remove(this);
276
+ var c = this.initialTeardown;
277
+ if (E(c))
1240
278
  try {
1241
- u();
1242
- } catch (p) {
1243
- s = p instanceof ae ? p.errors : [p];
279
+ c();
280
+ } catch (y) {
281
+ o = y instanceof B ? y.errors : [y];
1244
282
  }
1245
283
  var f = this._finalizers;
1246
284
  if (f) {
1247
285
  this._finalizers = null;
1248
286
  try {
1249
- for (var h = $(f), d = h.next(); !d.done; d = h.next()) {
1250
- var v = d.value;
287
+ for (var d = D(f), p = d.next(); !p.done; p = d.next()) {
288
+ var m = p.value;
1251
289
  try {
1252
- Be(v);
1253
- } catch (p) {
1254
- s = s ?? [], p instanceof ae ? s = ee(ee([], z(s)), z(p.errors)) : s.push(p);
290
+ se(m);
291
+ } catch (y) {
292
+ o = o ?? [], y instanceof B ? o = q(q([], $(o)), $(y.errors)) : o.push(y);
1255
293
  }
1256
294
  }
1257
- } catch (p) {
1258
- n = { error: p };
295
+ } catch (y) {
296
+ n = { error: y };
1259
297
  } finally {
1260
298
  try {
1261
- d && !d.done && (i = h.return) && i.call(h);
299
+ p && !p.done && (a = d.return) && a.call(d);
1262
300
  } finally {
1263
301
  if (n) throw n.error;
1264
302
  }
1265
303
  }
1266
304
  }
1267
- if (s)
1268
- throw new ae(s);
305
+ if (o)
306
+ throw new B(o);
1269
307
  }
1270
- }, e.prototype.add = function(t) {
1271
- var r;
1272
- if (t && t !== this)
308
+ }, e.prototype.add = function(r) {
309
+ var t;
310
+ if (r && r !== this)
1273
311
  if (this.closed)
1274
- Be(t);
312
+ se(r);
1275
313
  else {
1276
- if (t instanceof e) {
1277
- if (t.closed || t._hasParent(this))
314
+ if (r instanceof e) {
315
+ if (r.closed || r._hasParent(this))
1278
316
  return;
1279
- t._addParent(this);
317
+ r._addParent(this);
1280
318
  }
1281
- (this._finalizers = (r = this._finalizers) !== null && r !== void 0 ? r : []).push(t);
319
+ (this._finalizers = (t = this._finalizers) !== null && t !== void 0 ? t : []).push(r);
1282
320
  }
1283
- }, e.prototype._hasParent = function(t) {
1284
- var r = this._parentage;
1285
- return r === t || Array.isArray(r) && r.includes(t);
1286
- }, e.prototype._addParent = function(t) {
1287
- var r = this._parentage;
1288
- this._parentage = Array.isArray(r) ? (r.push(t), r) : r ? [r, t] : t;
1289
- }, e.prototype._removeParent = function(t) {
1290
- var r = this._parentage;
1291
- r === t ? this._parentage = null : Array.isArray(r) && He(r, t);
1292
- }, e.prototype.remove = function(t) {
1293
- var r = this._finalizers;
1294
- r && He(r, t), t instanceof e && t._removeParent(this);
321
+ }, e.prototype._hasParent = function(r) {
322
+ var t = this._parentage;
323
+ return t === r || Array.isArray(t) && t.includes(r);
324
+ }, e.prototype._addParent = function(r) {
325
+ var t = this._parentage;
326
+ this._parentage = Array.isArray(t) ? (t.push(r), t) : t ? [t, r] : r;
327
+ }, e.prototype._removeParent = function(r) {
328
+ var t = this._parentage;
329
+ t === r ? this._parentage = null : Array.isArray(t) && ue(t, r);
330
+ }, e.prototype.remove = function(r) {
331
+ var t = this._finalizers;
332
+ t && ue(t, r), r instanceof e && r._removeParent(this);
1295
333
  }, e.EMPTY = (function() {
1296
- var t = new e();
1297
- return t.closed = !0, t;
334
+ var r = new e();
335
+ return r.closed = !0, r;
1298
336
  })(), e;
1299
337
  })();
1300
- we.EMPTY;
1301
- function nt(e) {
1302
- return e instanceof we || e && "closed" in e && b(e.remove) && b(e.add) && b(e.unsubscribe);
338
+ C.EMPTY;
339
+ function we(e) {
340
+ return e instanceof C || e && "closed" in e && E(e.remove) && E(e.add) && E(e.unsubscribe);
1303
341
  }
1304
- function Be(e) {
1305
- b(e) ? e() : e.unsubscribe();
342
+ function se(e) {
343
+ E(e) ? e() : e.unsubscribe();
1306
344
  }
1307
- var or = {
345
+ var Be = {
1308
346
  Promise: void 0
1309
- }, ar = {
1310
- setTimeout: function(e, t) {
1311
- for (var r = [], n = 2; n < arguments.length; n++)
1312
- r[n - 2] = arguments[n];
1313
- return setTimeout.apply(void 0, ee([e, t], z(r)));
347
+ }, Ge = {
348
+ setTimeout: function(e, r) {
349
+ for (var t = [], n = 2; n < arguments.length; n++)
350
+ t[n - 2] = arguments[n];
351
+ return setTimeout.apply(void 0, q([e, r], $(t)));
1314
352
  },
1315
353
  clearTimeout: function(e) {
1316
354
  return clearTimeout(e);
1317
355
  },
1318
356
  delegate: void 0
1319
357
  };
1320
- function it(e) {
1321
- ar.setTimeout(function() {
358
+ function Se(e) {
359
+ Ge.setTimeout(function() {
1322
360
  throw e;
1323
361
  });
1324
362
  }
1325
- function Ke() {
363
+ function ce() {
1326
364
  }
1327
- function ur(e) {
365
+ function Ke(e) {
1328
366
  e();
1329
367
  }
1330
- var Ee = (function(e) {
1331
- be(t, e);
1332
- function t(r) {
368
+ var N = (function(e) {
369
+ z(r, e);
370
+ function r(t) {
1333
371
  var n = e.call(this) || this;
1334
- return n.isStopped = !1, r ? (n.destination = r, nt(r) && r.add(n)) : n.destination = fr, n;
1335
- }
1336
- return t.create = function(r, n, i) {
1337
- return new te(r, n, i);
1338
- }, t.prototype.next = function(r) {
1339
- this.isStopped || this._next(r);
1340
- }, t.prototype.error = function(r) {
1341
- this.isStopped || (this.isStopped = !0, this._error(r));
1342
- }, t.prototype.complete = function() {
372
+ return n.isStopped = !1, t ? (n.destination = t, we(t) && t.add(n)) : n.destination = qe, n;
373
+ }
374
+ return r.create = function(t, n, a) {
375
+ return new X(t, n, a);
376
+ }, r.prototype.next = function(t) {
377
+ this.isStopped || this._next(t);
378
+ }, r.prototype.error = function(t) {
379
+ this.isStopped || (this.isStopped = !0, this._error(t));
380
+ }, r.prototype.complete = function() {
1343
381
  this.isStopped || (this.isStopped = !0, this._complete());
1344
- }, t.prototype.unsubscribe = function() {
382
+ }, r.prototype.unsubscribe = function() {
1345
383
  this.closed || (this.isStopped = !0, e.prototype.unsubscribe.call(this), this.destination = null);
1346
- }, t.prototype._next = function(r) {
1347
- this.destination.next(r);
1348
- }, t.prototype._error = function(r) {
384
+ }, r.prototype._next = function(t) {
385
+ this.destination.next(t);
386
+ }, r.prototype._error = function(t) {
1349
387
  try {
1350
- this.destination.error(r);
388
+ this.destination.error(t);
1351
389
  } finally {
1352
390
  this.unsubscribe();
1353
391
  }
1354
- }, t.prototype._complete = function() {
392
+ }, r.prototype._complete = function() {
1355
393
  try {
1356
394
  this.destination.complete();
1357
395
  } finally {
1358
396
  this.unsubscribe();
1359
397
  }
1360
- }, t;
1361
- })(we), cr = (function() {
1362
- function e(t) {
1363
- this.partialObserver = t;
398
+ }, r;
399
+ })(C), Me = (function() {
400
+ function e(r) {
401
+ this.partialObserver = r;
1364
402
  }
1365
- return e.prototype.next = function(t) {
1366
- var r = this.partialObserver;
1367
- if (r.next)
403
+ return e.prototype.next = function(r) {
404
+ var t = this.partialObserver;
405
+ if (t.next)
1368
406
  try {
1369
- r.next(t);
407
+ t.next(r);
1370
408
  } catch (n) {
1371
- W(n);
409
+ Q(n);
1372
410
  }
1373
- }, e.prototype.error = function(t) {
1374
- var r = this.partialObserver;
1375
- if (r.error)
411
+ }, e.prototype.error = function(r) {
412
+ var t = this.partialObserver;
413
+ if (t.error)
1376
414
  try {
1377
- r.error(t);
415
+ t.error(r);
1378
416
  } catch (n) {
1379
- W(n);
417
+ Q(n);
1380
418
  }
1381
419
  else
1382
- W(t);
420
+ Q(r);
1383
421
  }, e.prototype.complete = function() {
1384
- var t = this.partialObserver;
1385
- if (t.complete)
422
+ var r = this.partialObserver;
423
+ if (r.complete)
1386
424
  try {
1387
- t.complete();
1388
- } catch (r) {
1389
- W(r);
425
+ r.complete();
426
+ } catch (t) {
427
+ Q(t);
1390
428
  }
1391
429
  }, e;
1392
- })(), te = (function(e) {
1393
- be(t, e);
1394
- function t(r, n, i) {
1395
- var s = e.call(this) || this, a;
1396
- return b(r) || !r ? a = {
1397
- next: r ?? void 0,
430
+ })(), X = (function(e) {
431
+ z(r, e);
432
+ function r(t, n, a) {
433
+ var o = e.call(this) || this, u;
434
+ return E(t) || !t ? u = {
435
+ next: t ?? void 0,
1398
436
  error: n ?? void 0,
1399
- complete: i ?? void 0
1400
- } : a = r, s.destination = new cr(a), s;
437
+ complete: a ?? void 0
438
+ } : u = t, o.destination = new Me(u), o;
1401
439
  }
1402
- return t;
1403
- })(Ee);
1404
- function W(e) {
1405
- it(e);
440
+ return r;
441
+ })(N);
442
+ function Q(e) {
443
+ Se(e);
1406
444
  }
1407
- function lr(e) {
445
+ function $e(e) {
1408
446
  throw e;
1409
447
  }
1410
- var fr = {
448
+ var qe = {
1411
449
  closed: !0,
1412
- next: Ke,
1413
- error: lr,
1414
- complete: Ke
1415
- }, Se = (function() {
450
+ next: ce,
451
+ error: $e,
452
+ complete: ce
453
+ };
454
+ function J(e, r, t, n, a) {
455
+ return new Xe(e, r, t, n, a);
456
+ }
457
+ var Xe = (function(e) {
458
+ z(r, e);
459
+ function r(t, n, a, o, u, l) {
460
+ var i = e.call(this, t) || this;
461
+ return i.onFinalize = u, i.shouldUnsubscribe = l, i._next = n ? function(s) {
462
+ try {
463
+ n(s);
464
+ } catch (c) {
465
+ t.error(c);
466
+ }
467
+ } : e.prototype._next, i._error = o ? function(s) {
468
+ try {
469
+ o(s);
470
+ } catch (c) {
471
+ t.error(c);
472
+ } finally {
473
+ this.unsubscribe();
474
+ }
475
+ } : e.prototype._error, i._complete = a ? function() {
476
+ try {
477
+ a();
478
+ } catch (s) {
479
+ t.error(s);
480
+ } finally {
481
+ this.unsubscribe();
482
+ }
483
+ } : e.prototype._complete, i;
484
+ }
485
+ return r.prototype.unsubscribe = function() {
486
+ var t;
487
+ if (!this.shouldUnsubscribe || this.shouldUnsubscribe()) {
488
+ var n = this.closed;
489
+ e.prototype.unsubscribe.call(this), !n && ((t = this.onFinalize) === null || t === void 0 || t.call(this));
490
+ }
491
+ }, r;
492
+ })(N);
493
+ function I(e, r) {
494
+ return me(function(t, n) {
495
+ var a = 0;
496
+ t.subscribe(J(n, function(o) {
497
+ n.next(e.call(r, o, a++));
498
+ }));
499
+ });
500
+ }
501
+ var Y = (function() {
1416
502
  return typeof Symbol == "function" && Symbol.observable || "@@observable";
1417
503
  })();
1418
- function hr(e) {
504
+ function Je(e) {
1419
505
  return e;
1420
506
  }
1421
- function dr(e) {
1422
- return e.length === 0 ? hr : e.length === 1 ? e[0] : function(r) {
1423
- return e.reduce(function(n, i) {
1424
- return i(n);
1425
- }, r);
507
+ function Ve(e) {
508
+ return e.length === 0 ? Je : e.length === 1 ? e[0] : function(t) {
509
+ return e.reduce(function(n, a) {
510
+ return a(n);
511
+ }, t);
1426
512
  };
1427
513
  }
1428
- var I = (function() {
1429
- function e(t) {
1430
- t && (this._subscribe = t);
514
+ var j = (function() {
515
+ function e(r) {
516
+ r && (this._subscribe = r);
1431
517
  }
1432
- return e.prototype.lift = function(t) {
1433
- var r = new e();
1434
- return r.source = this, r.operator = t, r;
1435
- }, e.prototype.subscribe = function(t, r, n) {
1436
- var i = this, s = vr(t) ? t : new te(t, r, n);
1437
- return ur(function() {
1438
- var a = i, l = a.operator, o = a.source;
1439
- s.add(l ? l.call(s, o) : o ? i._subscribe(s) : i._trySubscribe(s));
1440
- }), s;
1441
- }, e.prototype._trySubscribe = function(t) {
518
+ return e.prototype.lift = function(r) {
519
+ var t = new e();
520
+ return t.source = this, t.operator = r, t;
521
+ }, e.prototype.subscribe = function(r, t, n) {
522
+ var a = this, o = Ce(r) ? r : new X(r, t, n);
523
+ return Ke(function() {
524
+ var u = a, l = u.operator, i = u.source;
525
+ o.add(l ? l.call(o, i) : i ? a._subscribe(o) : a._trySubscribe(o));
526
+ }), o;
527
+ }, e.prototype._trySubscribe = function(r) {
1442
528
  try {
1443
- return this._subscribe(t);
1444
- } catch (r) {
1445
- t.error(r);
529
+ return this._subscribe(r);
530
+ } catch (t) {
531
+ r.error(t);
1446
532
  }
1447
- }, e.prototype.forEach = function(t, r) {
533
+ }, e.prototype.forEach = function(r, t) {
1448
534
  var n = this;
1449
- return r = Ve(r), new r(function(i, s) {
1450
- var a = new te({
535
+ return t = fe(t), new t(function(a, o) {
536
+ var u = new X({
1451
537
  next: function(l) {
1452
538
  try {
1453
- t(l);
1454
- } catch (o) {
1455
- s(o), a.unsubscribe();
539
+ r(l);
540
+ } catch (i) {
541
+ o(i), u.unsubscribe();
1456
542
  }
1457
543
  },
1458
- error: s,
1459
- complete: i
544
+ error: o,
545
+ complete: a
1460
546
  });
1461
- n.subscribe(a);
547
+ n.subscribe(u);
1462
548
  });
1463
- }, e.prototype._subscribe = function(t) {
1464
- var r;
1465
- return (r = this.source) === null || r === void 0 ? void 0 : r.subscribe(t);
1466
- }, e.prototype[Se] = function() {
549
+ }, e.prototype._subscribe = function(r) {
550
+ var t;
551
+ return (t = this.source) === null || t === void 0 ? void 0 : t.subscribe(r);
552
+ }, e.prototype[Y] = function() {
1467
553
  return this;
1468
554
  }, e.prototype.pipe = function() {
1469
- for (var t = [], r = 0; r < arguments.length; r++)
1470
- t[r] = arguments[r];
1471
- return dr(t)(this);
1472
- }, e.prototype.toPromise = function(t) {
1473
- var r = this;
1474
- return t = Ve(t), new t(function(n, i) {
1475
- var s;
1476
- r.subscribe(function(a) {
1477
- return s = a;
1478
- }, function(a) {
1479
- return i(a);
555
+ for (var r = [], t = 0; t < arguments.length; t++)
556
+ r[t] = arguments[t];
557
+ return Ve(r)(this);
558
+ }, e.prototype.toPromise = function(r) {
559
+ var t = this;
560
+ return r = fe(r), new r(function(n, a) {
561
+ var o;
562
+ t.subscribe(function(u) {
563
+ return o = u;
564
+ }, function(u) {
565
+ return a(u);
1480
566
  }, function() {
1481
- return n(s);
567
+ return n(o);
1482
568
  });
1483
569
  });
1484
- }, e.create = function(t) {
1485
- return new e(t);
570
+ }, e.create = function(r) {
571
+ return new e(r);
1486
572
  }, e;
1487
573
  })();
1488
- function Ve(e) {
1489
- var t;
1490
- return (t = e ?? or.Promise) !== null && t !== void 0 ? t : Promise;
1491
- }
1492
- function pr(e) {
1493
- return e && b(e.next) && b(e.error) && b(e.complete);
574
+ function fe(e) {
575
+ var r;
576
+ return (r = e ?? Be.Promise) !== null && r !== void 0 ? r : Promise;
1494
577
  }
1495
- function vr(e) {
1496
- return e && e instanceof Ee || pr(e) && nt(e);
578
+ function ze(e) {
579
+ return e && E(e.next) && E(e.error) && E(e.complete);
1497
580
  }
1498
- function yr(e) {
1499
- return b(e?.lift);
581
+ function Ce(e) {
582
+ return e && e instanceof N || ze(e) && we(e);
1500
583
  }
1501
- function J(e) {
1502
- return function(t) {
1503
- if (yr(t))
1504
- return t.lift(function(r) {
1505
- try {
1506
- return e(r, this);
1507
- } catch (n) {
1508
- this.error(n);
1509
- }
1510
- });
1511
- throw new TypeError("Unable to lift unknown Observable type");
584
+ function xe(e) {
585
+ switch (e.responseType) {
586
+ case "json": {
587
+ if ("response" in e)
588
+ return e.response;
589
+ var r = e;
590
+ return JSON.parse(r.responseText);
591
+ }
592
+ case "document":
593
+ return e.responseXML;
594
+ default: {
595
+ if ("response" in e)
596
+ return e.response;
597
+ var r = e;
598
+ return r.responseText;
599
+ }
600
+ }
601
+ }
602
+ var Ne = /* @__PURE__ */ (function() {
603
+ function e(r, t, n, a) {
604
+ a === void 0 && (a = "download_load"), this.originalEvent = r, this.xhr = t, this.request = n, this.type = a;
605
+ var o = t.status, u = t.responseType;
606
+ this.status = o ?? 0, this.responseType = u ?? "";
607
+ var l = t.getAllResponseHeaders();
608
+ this.responseHeaders = l ? l.split(`
609
+ `).reduce(function(c, f) {
610
+ var d = f.indexOf(": ");
611
+ return c[f.slice(0, d)] = f.slice(d + 2), c;
612
+ }, {}) : {}, this.response = xe(t);
613
+ var i = r.loaded, s = r.total;
614
+ this.loaded = i, this.total = s;
615
+ }
616
+ return e;
617
+ })(), U = be(function(e) {
618
+ return function(t, n, a) {
619
+ this.message = t, this.name = "AjaxError", this.xhr = n, this.request = a, this.status = n.status, this.responseType = n.responseType;
620
+ var o;
621
+ try {
622
+ o = xe(n);
623
+ } catch {
624
+ o = n.responseText;
625
+ }
626
+ this.response = o;
1512
627
  };
628
+ }), Ye = (function() {
629
+ function e(r, t) {
630
+ return U.call(this, "ajax timeout", r, t), this.name = "AjaxTimeoutError", this;
631
+ }
632
+ return e.prototype = Object.create(U.prototype), e;
633
+ })();
634
+ function We(e, r) {
635
+ return k({ method: "GET", url: e, headers: r });
1513
636
  }
1514
- function H(e, t, r, n, i) {
1515
- return new mr(e, t, r, n, i);
637
+ function Ze(e, r, t) {
638
+ return k({ method: "POST", url: e, body: r, headers: t });
1516
639
  }
1517
- var mr = (function(e) {
1518
- be(t, e);
1519
- function t(r, n, i, s, a, l) {
1520
- var o = e.call(this, r) || this;
1521
- return o.onFinalize = a, o.shouldUnsubscribe = l, o._next = n ? function(c) {
1522
- try {
1523
- n(c);
1524
- } catch (u) {
1525
- r.error(u);
1526
- }
1527
- } : e.prototype._next, o._error = s ? function(c) {
1528
- try {
1529
- s(c);
1530
- } catch (u) {
1531
- r.error(u);
1532
- } finally {
1533
- this.unsubscribe();
1534
- }
1535
- } : e.prototype._error, o._complete = i ? function() {
1536
- try {
1537
- i();
1538
- } catch (c) {
1539
- r.error(c);
1540
- } finally {
1541
- this.unsubscribe();
1542
- }
1543
- } : e.prototype._complete, o;
1544
- }
1545
- return t.prototype.unsubscribe = function() {
1546
- var r;
1547
- if (!this.shouldUnsubscribe || this.shouldUnsubscribe()) {
1548
- var n = this.closed;
1549
- e.prototype.unsubscribe.call(this), !n && ((r = this.onFinalize) === null || r === void 0 || r.call(this));
640
+ function er(e, r) {
641
+ return k({ method: "DELETE", url: e, headers: r });
642
+ }
643
+ function rr(e, r, t) {
644
+ return k({ method: "PUT", url: e, body: r, headers: t });
645
+ }
646
+ function tr(e, r, t) {
647
+ return k({ method: "PATCH", url: e, body: r, headers: t });
648
+ }
649
+ var nr = I(function(e) {
650
+ return e.response;
651
+ });
652
+ function or(e, r) {
653
+ return nr(k({
654
+ method: "GET",
655
+ url: e,
656
+ headers: r
657
+ }));
658
+ }
659
+ var k = (function() {
660
+ var e = function(r) {
661
+ var t = typeof r == "string" ? {
662
+ url: r
663
+ } : r;
664
+ return ar(t);
665
+ };
666
+ return e.get = We, e.post = Ze, e.delete = er, e.put = rr, e.patch = tr, e.getJSON = or, e;
667
+ })(), ir = "upload", le = "download", G = "loadstart", K = "progress", de = "load";
668
+ function ar(e) {
669
+ return new j(function(r) {
670
+ var t, n, a = L({ async: !0, crossDomain: !1, withCredentials: !1, method: "GET", timeout: 0, responseType: "json" }, e), o = a.queryParams, u = a.body, l = a.headers, i = a.url;
671
+ if (!i)
672
+ throw new TypeError("url is required");
673
+ if (o) {
674
+ var s;
675
+ if (i.includes("?")) {
676
+ var c = i.split("?");
677
+ if (2 < c.length)
678
+ throw new TypeError("invalid url");
679
+ s = new URLSearchParams(c[1]), new URLSearchParams(o).forEach(function(b, w) {
680
+ return s.set(w, b);
681
+ }), i = c[0] + "?" + s;
682
+ } else
683
+ s = new URLSearchParams(o), i = i + "?" + s;
1550
684
  }
1551
- }, t;
1552
- })(Ee);
1553
- function br(e) {
1554
- return e && b(e.schedule);
685
+ var f = {};
686
+ if (l)
687
+ for (var d in l)
688
+ l.hasOwnProperty(d) && (f[d.toLowerCase()] = l[d]);
689
+ var p = a.crossDomain;
690
+ !p && !("x-requested-with" in f) && (f["x-requested-with"] = "XMLHttpRequest");
691
+ var m = a.withCredentials, y = a.xsrfCookieName, A = a.xsrfHeaderName;
692
+ if ((m || !p) && y && A) {
693
+ var S = (n = (t = document?.cookie.match(new RegExp("(^|;\\s*)(" + y + ")=([^;]*)"))) === null || t === void 0 ? void 0 : t.pop()) !== null && n !== void 0 ? n : "";
694
+ S && (f[A] = S);
695
+ }
696
+ var T = ur(u, f), x = L(L({}, a), {
697
+ url: i,
698
+ headers: f,
699
+ body: T
700
+ }), h;
701
+ h = e.createXHR ? e.createXHR() : new XMLHttpRequest();
702
+ {
703
+ var v = e.progressSubscriber, F = e.includeDownloadProgress, ge = F === void 0 ? !1 : F, Z = e.includeUploadProgress, Ae = Z === void 0 ? !1 : Z, ee = function(b, w) {
704
+ h.addEventListener(b, function() {
705
+ var g, O = w();
706
+ (g = v?.error) === null || g === void 0 || g.call(v, O), r.error(O);
707
+ });
708
+ };
709
+ ee("timeout", function() {
710
+ return new Ye(h, x);
711
+ }), ee("abort", function() {
712
+ return new U("aborted", h, x);
713
+ });
714
+ var re = function(b, w) {
715
+ return new Ne(w, h, x, b + "_" + w.type);
716
+ }, te = function(b, w, g) {
717
+ b.addEventListener(w, function(O) {
718
+ r.next(re(g, O));
719
+ });
720
+ };
721
+ Ae && [G, K, de].forEach(function(b) {
722
+ return te(h.upload, b, ir);
723
+ }), v && [G, K].forEach(function(b) {
724
+ return h.upload.addEventListener(b, function(w) {
725
+ var g;
726
+ return (g = v?.next) === null || g === void 0 ? void 0 : g.call(v, w);
727
+ });
728
+ }), ge && [G, K].forEach(function(b) {
729
+ return te(h, b, le);
730
+ });
731
+ var ne = function(b) {
732
+ var w = "ajax error" + (b ? " " + b : "");
733
+ r.error(new U(w, h, x));
734
+ };
735
+ h.addEventListener("error", function(b) {
736
+ var w;
737
+ (w = v?.error) === null || w === void 0 || w.call(v, b), ne();
738
+ }), h.addEventListener(de, function(b) {
739
+ var w, g, O = h.status;
740
+ if (O < 400) {
741
+ (w = v?.complete) === null || w === void 0 || w.call(v);
742
+ var ae = void 0;
743
+ try {
744
+ ae = re(le, b);
745
+ } catch (Oe) {
746
+ r.error(Oe);
747
+ return;
748
+ }
749
+ r.next(ae), r.complete();
750
+ } else
751
+ (g = v?.error) === null || g === void 0 || g.call(v, b), ne(O);
752
+ });
753
+ }
754
+ var oe = x.user, ie = x.method, H = x.async;
755
+ oe ? h.open(ie, i, H, oe, x.password) : h.open(ie, i, H), H && (h.timeout = x.timeout, h.responseType = x.responseType), "withCredentials" in h && (h.withCredentials = x.withCredentials);
756
+ for (var d in f)
757
+ f.hasOwnProperty(d) && h.setRequestHeader(d, f[d]);
758
+ return T ? h.send(T) : h.send(), function() {
759
+ h && h.readyState !== 4 && h.abort();
760
+ };
761
+ });
1555
762
  }
1556
- function gr(e) {
1557
- return e[e.length - 1];
763
+ function ur(e, r) {
764
+ var t;
765
+ if (!e || typeof e == "string" || pr(e) || hr(e) || cr(e) || fr(e) || lr(e) || yr(e))
766
+ return e;
767
+ if (dr(e))
768
+ return e.buffer;
769
+ if (typeof e == "object")
770
+ return r["content-type"] = (t = r["content-type"]) !== null && t !== void 0 ? t : "application/json;charset=utf-8", JSON.stringify(e);
771
+ throw new TypeError("Unknown body type");
1558
772
  }
1559
- function wr(e) {
1560
- return br(gr(e)) ? e.pop() : void 0;
773
+ var sr = Object.prototype.toString;
774
+ function W(e, r) {
775
+ return sr.call(e) === "[object " + r + "]";
776
+ }
777
+ function cr(e) {
778
+ return W(e, "ArrayBuffer");
779
+ }
780
+ function fr(e) {
781
+ return W(e, "File");
782
+ }
783
+ function lr(e) {
784
+ return W(e, "Blob");
785
+ }
786
+ function dr(e) {
787
+ return typeof ArrayBuffer < "u" && ArrayBuffer.isView(e);
788
+ }
789
+ function pr(e) {
790
+ return typeof FormData < "u" && e instanceof FormData;
1561
791
  }
1562
- var Oe = (function(e) {
792
+ function hr(e) {
793
+ return typeof URLSearchParams < "u" && e instanceof URLSearchParams;
794
+ }
795
+ function yr(e) {
796
+ return typeof ReadableStream < "u" && e instanceof ReadableStream;
797
+ }
798
+ var vr = (function(e) {
1563
799
  return e && typeof e.length == "number" && typeof e != "function";
1564
800
  });
1565
- function st(e) {
1566
- return b(e?.then);
801
+ function mr(e) {
802
+ return E(e?.then);
1567
803
  }
1568
- function ot(e) {
1569
- return b(e[Se]);
804
+ function br(e) {
805
+ return E(e[Y]);
1570
806
  }
1571
- function at(e) {
1572
- return Symbol.asyncIterator && b(e?.[Symbol.asyncIterator]);
807
+ function wr(e) {
808
+ return Symbol.asyncIterator && E(e?.[Symbol.asyncIterator]);
1573
809
  }
1574
- function ut(e) {
810
+ function Sr(e) {
1575
811
  return new TypeError("You provided " + (e !== null && typeof e == "object" ? "an invalid object" : "'" + e + "'") + " where a stream was expected. You can provide an Observable, Promise, ReadableStream, Array, AsyncIterable, or Iterable.");
1576
812
  }
1577
- function Er() {
813
+ function xr() {
1578
814
  return typeof Symbol != "function" || !Symbol.iterator ? "@@iterator" : Symbol.iterator;
1579
815
  }
1580
- var ct = Er();
1581
- function lt(e) {
1582
- return b(e?.[ct]);
816
+ var Er = xr();
817
+ function Tr(e) {
818
+ return E(e?.[Er]);
1583
819
  }
1584
- function ft(e) {
1585
- return ir(this, arguments, function() {
1586
- var r, n, i, s;
1587
- return rt(this, function(a) {
1588
- switch (a.label) {
820
+ function gr(e) {
821
+ return Qe(this, arguments, function() {
822
+ var t, n, a, o;
823
+ return ve(this, function(u) {
824
+ switch (u.label) {
1589
825
  case 0:
1590
- r = e.getReader(), a.label = 1;
826
+ t = e.getReader(), u.label = 1;
1591
827
  case 1:
1592
- a.trys.push([1, , 9, 10]), a.label = 2;
828
+ u.trys.push([1, , 9, 10]), u.label = 2;
1593
829
  case 2:
1594
- return [4, q(r.read())];
830
+ return [4, R(t.read())];
1595
831
  case 3:
1596
- return n = a.sent(), i = n.value, s = n.done, s ? [4, q(void 0)] : [3, 5];
832
+ return n = u.sent(), a = n.value, o = n.done, o ? [4, R(void 0)] : [3, 5];
1597
833
  case 4:
1598
- return [2, a.sent()];
834
+ return [2, u.sent()];
1599
835
  case 5:
1600
- return [4, q(i)];
836
+ return [4, R(a)];
1601
837
  case 6:
1602
- return [4, a.sent()];
838
+ return [4, u.sent()];
1603
839
  case 7:
1604
- return a.sent(), [3, 2];
840
+ return u.sent(), [3, 2];
1605
841
  case 8:
1606
842
  return [3, 10];
1607
843
  case 9:
1608
- return r.releaseLock(), [7];
844
+ return t.releaseLock(), [7];
1609
845
  case 10:
1610
846
  return [2];
1611
847
  }
1612
848
  });
1613
849
  });
1614
850
  }
1615
- function ht(e) {
1616
- return b(e?.getReader);
851
+ function Ar(e) {
852
+ return E(e?.getReader);
1617
853
  }
1618
- function C(e) {
1619
- if (e instanceof I)
854
+ function Ee(e) {
855
+ if (e instanceof j)
1620
856
  return e;
1621
857
  if (e != null) {
1622
- if (ot(e))
1623
- return Sr(e);
1624
- if (Oe(e))
858
+ if (br(e))
1625
859
  return Or(e);
1626
- if (st(e))
860
+ if (vr(e))
1627
861
  return Pr(e);
1628
- if (at(e))
1629
- return dt(e);
1630
- if (lt(e))
862
+ if (mr(e))
863
+ return jr(e);
864
+ if (wr(e))
865
+ return Te(e);
866
+ if (Tr(e))
867
+ return kr(e);
868
+ if (Ar(e))
1631
869
  return Rr(e);
1632
- if (ht(e))
1633
- return Tr(e);
1634
870
  }
1635
- throw ut(e);
871
+ throw Sr(e);
1636
872
  }
1637
- function Sr(e) {
1638
- return new I(function(t) {
1639
- var r = e[Se]();
1640
- if (b(r.subscribe))
1641
- return r.subscribe(t);
873
+ function Or(e) {
874
+ return new j(function(r) {
875
+ var t = e[Y]();
876
+ if (E(t.subscribe))
877
+ return t.subscribe(r);
1642
878
  throw new TypeError("Provided object does not correctly implement Symbol.observable");
1643
879
  });
1644
880
  }
1645
- function Or(e) {
1646
- return new I(function(t) {
1647
- for (var r = 0; r < e.length && !t.closed; r++)
1648
- t.next(e[r]);
1649
- t.complete();
881
+ function Pr(e) {
882
+ return new j(function(r) {
883
+ for (var t = 0; t < e.length && !r.closed; t++)
884
+ r.next(e[t]);
885
+ r.complete();
1650
886
  });
1651
887
  }
1652
- function Pr(e) {
1653
- return new I(function(t) {
1654
- e.then(function(r) {
1655
- t.closed || (t.next(r), t.complete());
1656
- }, function(r) {
1657
- return t.error(r);
1658
- }).then(null, it);
888
+ function jr(e) {
889
+ return new j(function(r) {
890
+ e.then(function(t) {
891
+ r.closed || (r.next(t), r.complete());
892
+ }, function(t) {
893
+ return r.error(t);
894
+ }).then(null, Se);
1659
895
  });
1660
896
  }
1661
- function Rr(e) {
1662
- return new I(function(t) {
1663
- var r, n;
897
+ function kr(e) {
898
+ return new j(function(r) {
899
+ var t, n;
1664
900
  try {
1665
- for (var i = $(e), s = i.next(); !s.done; s = i.next()) {
1666
- var a = s.value;
1667
- if (t.next(a), t.closed)
901
+ for (var a = D(e), o = a.next(); !o.done; o = a.next()) {
902
+ var u = o.value;
903
+ if (r.next(u), r.closed)
1668
904
  return;
1669
905
  }
1670
906
  } catch (l) {
1671
- r = { error: l };
907
+ t = { error: l };
1672
908
  } finally {
1673
909
  try {
1674
- s && !s.done && (n = i.return) && n.call(i);
910
+ o && !o.done && (n = a.return) && n.call(a);
1675
911
  } finally {
1676
- if (r) throw r.error;
912
+ if (t) throw t.error;
1677
913
  }
1678
914
  }
1679
- t.complete();
915
+ r.complete();
1680
916
  });
1681
917
  }
1682
- function dt(e) {
1683
- return new I(function(t) {
1684
- xr(e, t).catch(function(r) {
1685
- return t.error(r);
918
+ function Te(e) {
919
+ return new j(function(r) {
920
+ Ir(e, r).catch(function(t) {
921
+ return r.error(t);
1686
922
  });
1687
923
  });
1688
924
  }
1689
- function Tr(e) {
1690
- return dt(ft(e));
1691
- }
1692
- function xr(e, t) {
1693
- var r, n, i, s;
1694
- return nr(this, void 0, void 0, function() {
1695
- var a, l;
1696
- return rt(this, function(o) {
1697
- switch (o.label) {
925
+ function Rr(e) {
926
+ return Te(gr(e));
927
+ }
928
+ function Ir(e, r) {
929
+ var t, n, a, o;
930
+ return Fe(this, void 0, void 0, function() {
931
+ var u, l;
932
+ return ve(this, function(i) {
933
+ switch (i.label) {
1698
934
  case 0:
1699
- o.trys.push([0, 5, 6, 11]), r = sr(e), o.label = 1;
935
+ i.trys.push([0, 5, 6, 11]), t = He(e), i.label = 1;
1700
936
  case 1:
1701
- return [4, r.next()];
937
+ return [4, t.next()];
1702
938
  case 2:
1703
- if (n = o.sent(), !!n.done) return [3, 4];
1704
- if (a = n.value, t.next(a), t.closed)
939
+ if (n = i.sent(), !!n.done) return [3, 4];
940
+ if (u = n.value, r.next(u), r.closed)
1705
941
  return [2];
1706
- o.label = 3;
942
+ i.label = 3;
1707
943
  case 3:
1708
944
  return [3, 1];
1709
945
  case 4:
1710
946
  return [3, 11];
1711
947
  case 5:
1712
- return l = o.sent(), i = { error: l }, [3, 11];
948
+ return l = i.sent(), a = { error: l }, [3, 11];
1713
949
  case 6:
1714
- return o.trys.push([6, , 9, 10]), n && !n.done && (s = r.return) ? [4, s.call(r)] : [3, 8];
950
+ return i.trys.push([6, , 9, 10]), n && !n.done && (o = t.return) ? [4, o.call(t)] : [3, 8];
1715
951
  case 7:
1716
- o.sent(), o.label = 8;
952
+ i.sent(), i.label = 8;
1717
953
  case 8:
1718
954
  return [3, 10];
1719
955
  case 9:
1720
- if (i) throw i.error;
956
+ if (a) throw a.error;
1721
957
  return [7];
1722
958
  case 10:
1723
959
  return [7];
1724
960
  case 11:
1725
- return t.complete(), [2];
961
+ return r.complete(), [2];
1726
962
  }
1727
963
  });
1728
964
  });
1729
965
  }
1730
- function D(e, t, r, n, i) {
1731
- n === void 0 && (n = 0), i === void 0 && (i = !1);
1732
- var s = t.schedule(function() {
1733
- r(), i ? e.add(this.schedule(null, n)) : this.unsubscribe();
1734
- }, n);
1735
- if (e.add(s), !i)
1736
- return s;
1737
- }
1738
- function pt(e, t) {
1739
- return t === void 0 && (t = 0), J(function(r, n) {
1740
- r.subscribe(H(n, function(i) {
1741
- return D(n, e, function() {
1742
- return n.next(i);
1743
- }, t);
966
+ function Lr(e, r, t, n, a, o, u, l) {
967
+ var i = [], s = 0, c = 0, f = !1, d = function() {
968
+ f && !i.length && !s && r.complete();
969
+ }, p = function(y) {
970
+ return s < n ? m(y) : i.push(y);
971
+ }, m = function(y) {
972
+ s++;
973
+ var A = !1;
974
+ Ee(t(y, c++)).subscribe(J(r, function(S) {
975
+ r.next(S);
1744
976
  }, function() {
1745
- return D(n, e, function() {
1746
- return n.complete();
1747
- }, t);
1748
- }, function(i) {
1749
- return D(n, e, function() {
1750
- return n.error(i);
1751
- }, t);
1752
- }));
1753
- });
1754
- }
1755
- function vt(e, t) {
1756
- return t === void 0 && (t = 0), J(function(r, n) {
1757
- n.add(e.schedule(function() {
1758
- return r.subscribe(n);
1759
- }, t));
1760
- });
1761
- }
1762
- function Ir(e, t) {
1763
- return C(e).pipe(vt(t), pt(t));
1764
- }
1765
- function Ar(e, t) {
1766
- return C(e).pipe(vt(t), pt(t));
1767
- }
1768
- function Fr(e, t) {
1769
- return new I(function(r) {
1770
- var n = 0;
1771
- return t.schedule(function() {
1772
- n === e.length ? r.complete() : (r.next(e[n++]), r.closed || this.schedule());
1773
- });
1774
- });
1775
- }
1776
- function kr(e, t) {
1777
- return new I(function(r) {
1778
- var n;
1779
- return D(r, t, function() {
1780
- n = e[ct](), D(r, t, function() {
1781
- var i, s, a;
1782
- try {
1783
- i = n.next(), s = i.value, a = i.done;
1784
- } catch (l) {
1785
- r.error(l);
1786
- return;
1787
- }
1788
- a ? r.complete() : r.next(s);
1789
- }, 0, !0);
1790
- }), function() {
1791
- return b(n?.return) && n.return();
1792
- };
1793
- });
1794
- }
1795
- function yt(e, t) {
1796
- if (!e)
1797
- throw new Error("Iterable cannot be null");
1798
- return new I(function(r) {
1799
- D(r, t, function() {
1800
- var n = e[Symbol.asyncIterator]();
1801
- D(r, t, function() {
1802
- n.next().then(function(i) {
1803
- i.done ? r.complete() : r.next(i.value);
1804
- });
1805
- }, 0, !0);
1806
- });
1807
- });
1808
- }
1809
- function Cr(e, t) {
1810
- return yt(ft(e), t);
1811
- }
1812
- function jr(e, t) {
1813
- if (e != null) {
1814
- if (ot(e))
1815
- return Ir(e, t);
1816
- if (Oe(e))
1817
- return Fr(e, t);
1818
- if (st(e))
1819
- return Ar(e, t);
1820
- if (at(e))
1821
- return yt(e, t);
1822
- if (lt(e))
1823
- return kr(e, t);
1824
- if (ht(e))
1825
- return Cr(e, t);
1826
- }
1827
- throw ut(e);
1828
- }
1829
- function mt(e, t) {
1830
- return t ? jr(e, t) : C(e);
1831
- }
1832
- function Lr() {
1833
- for (var e = [], t = 0; t < arguments.length; t++)
1834
- e[t] = arguments[t];
1835
- var r = wr(e);
1836
- return mt(e, r);
1837
- }
1838
- function bt(e, t) {
1839
- var r = b(e) ? e : function() {
1840
- return e;
1841
- }, n = function(i) {
1842
- return i.error(r());
1843
- };
1844
- return new I(n);
1845
- }
1846
- var Mr = ge(function(e) {
1847
- return function() {
1848
- e(this), this.name = "EmptyError", this.message = "no elements in sequence";
1849
- };
1850
- });
1851
- function Q(e, t) {
1852
- return new Promise(function(r, n) {
1853
- var i = new te({
1854
- next: function(s) {
1855
- r(s), i.unsubscribe();
1856
- },
1857
- error: n,
1858
- complete: function() {
1859
- n(new Mr());
1860
- }
1861
- });
1862
- e.subscribe(i);
1863
- });
1864
- }
1865
- function N(e, t) {
1866
- return J(function(r, n) {
1867
- var i = 0;
1868
- r.subscribe(H(n, function(s) {
1869
- n.next(e.call(t, s, i++));
1870
- }));
1871
- });
1872
- }
1873
- var Qr = Array.isArray;
1874
- function Dr(e, t) {
1875
- return Qr(t) ? e.apply(void 0, ee([], z(t))) : e(t);
1876
- }
1877
- function Nr(e) {
1878
- return N(function(t) {
1879
- return Dr(e, t);
1880
- });
1881
- }
1882
- function Ur(e, t, r, n, i, s, a, l) {
1883
- var o = [], c = 0, u = 0, f = !1, h = function() {
1884
- f && !o.length && !c && t.complete();
1885
- }, d = function(p) {
1886
- return c < n ? v(p) : o.push(p);
1887
- }, v = function(p) {
1888
- c++;
1889
- var S = !1;
1890
- C(r(p, u++)).subscribe(H(t, function(g) {
1891
- t.next(g);
1892
- }, function() {
1893
- S = !0;
977
+ A = !0;
1894
978
  }, void 0, function() {
1895
- if (S)
979
+ if (A)
1896
980
  try {
1897
- c--;
1898
- for (var g = function() {
1899
- var P = o.shift();
1900
- a || v(P);
1901
- }; o.length && c < n; )
1902
- g();
1903
- h();
1904
- } catch (P) {
1905
- t.error(P);
981
+ s--;
982
+ for (var S = function() {
983
+ var T = i.shift();
984
+ u || m(T);
985
+ }; i.length && s < n; )
986
+ S();
987
+ d();
988
+ } catch (T) {
989
+ r.error(T);
1906
990
  }
1907
991
  }));
1908
992
  };
1909
- return e.subscribe(H(t, d, function() {
1910
- f = !0, h();
993
+ return e.subscribe(J(r, p, function() {
994
+ f = !0, d();
1911
995
  })), function() {
1912
996
  };
1913
997
  }
1914
- function re(e, t, r) {
1915
- return r === void 0 && (r = 1 / 0), b(t) ? re(function(n, i) {
1916
- return N(function(s, a) {
1917
- return t(n, s, i, a);
1918
- })(C(e(n, i)));
1919
- }, r) : (typeof t == "number" && (r = t), J(function(n, i) {
1920
- return Ur(n, i, e, r);
1921
- }));
1922
- }
1923
- var _r = ["addListener", "removeListener"], qr = ["addEventListener", "removeEventListener"], Hr = ["on", "off"];
1924
- function ve(e, t, r, n) {
1925
- if (b(r) && (n = r, r = void 0), n)
1926
- return ve(e, t, r).pipe(Nr(n));
1927
- var i = z(Vr(e) ? qr.map(function(l) {
1928
- return function(o) {
1929
- return e[l](t, o, r);
1930
- };
1931
- }) : Br(e) ? _r.map($e(e, t)) : Kr(e) ? Hr.map($e(e, t)) : [], 2), s = i[0], a = i[1];
1932
- if (!s && Oe(e))
1933
- return re(function(l) {
1934
- return ve(l, t, r);
1935
- })(C(e));
1936
- if (!s)
1937
- throw new TypeError("Invalid event target");
1938
- return new I(function(l) {
1939
- var o = function() {
1940
- for (var c = [], u = 0; u < arguments.length; u++)
1941
- c[u] = arguments[u];
1942
- return l.next(1 < c.length ? c : c[0]);
1943
- };
1944
- return s(o), function() {
1945
- return a(o);
1946
- };
1947
- });
1948
- }
1949
- function $e(e, t) {
1950
- return function(r) {
1951
- return function(n) {
1952
- return e[r](t, n);
1953
- };
1954
- };
1955
- }
1956
- function Br(e) {
1957
- return b(e.addListener) && b(e.removeListener);
1958
- }
1959
- function Kr(e) {
1960
- return b(e.on) && b(e.off);
1961
- }
1962
- function Vr(e) {
1963
- return b(e.addEventListener) && b(e.removeEventListener);
1964
- }
1965
- var $r = Array.isArray;
1966
- function zr(e) {
1967
- return e.length === 1 && $r(e[0]) ? e[0] : e;
1968
- }
1969
- function Gr() {
1970
- for (var e = [], t = 0; t < arguments.length; t++)
1971
- e[t] = arguments[t];
1972
- return e = zr(e), e.length === 1 ? C(e[0]) : new I(Jr(e));
1973
- }
1974
- function Jr(e) {
1975
- return function(t) {
1976
- for (var r = [], n = function(s) {
1977
- r.push(C(e[s]).subscribe(H(t, function(a) {
1978
- if (r) {
1979
- for (var l = 0; l < r.length; l++)
1980
- l !== s && r[l].unsubscribe();
1981
- r = null;
1982
- }
1983
- t.next(a);
1984
- })));
1985
- }, i = 0; r && !t.closed && i < e.length; i++)
1986
- n(i);
1987
- };
1988
- }
1989
- function Pe(e) {
1990
- return J(function(t, r) {
1991
- var n = null, i = !1, s;
1992
- n = t.subscribe(H(r, void 0, void 0, function(a) {
1993
- s = C(e(a, Pe(e)(t))), n ? (n.unsubscribe(), n = null, s.subscribe(r)) : i = !0;
1994
- })), i && (n.unsubscribe(), n = null, s.subscribe(r));
1995
- });
1996
- }
1997
- function gt(e) {
1998
- switch (e.responseType) {
1999
- case "json": {
2000
- if ("response" in e)
2001
- return e.response;
2002
- var t = e;
2003
- return JSON.parse(t.responseText);
2004
- }
2005
- case "document":
2006
- return e.responseXML;
2007
- default: {
2008
- if ("response" in e)
2009
- return e.response;
2010
- var t = e;
2011
- return t.responseText;
2012
- }
2013
- }
2014
- }
2015
- var Xr = /* @__PURE__ */ (function() {
2016
- function e(t, r, n, i) {
2017
- i === void 0 && (i = "download_load"), this.originalEvent = t, this.xhr = r, this.request = n, this.type = i;
2018
- var s = r.status, a = r.responseType;
2019
- this.status = s ?? 0, this.responseType = a ?? "";
2020
- var l = r.getAllResponseHeaders();
2021
- this.responseHeaders = l ? l.split(`
2022
- `).reduce(function(u, f) {
2023
- var h = f.indexOf(": ");
2024
- return u[f.slice(0, h)] = f.slice(h + 2), u;
2025
- }, {}) : {}, this.response = gt(r);
2026
- var o = t.loaded, c = t.total;
2027
- this.loaded = o, this.total = c;
2028
- }
2029
- return e;
2030
- })(), G = ge(function(e) {
2031
- return function(r, n, i) {
2032
- this.message = r, this.name = "AjaxError", this.xhr = n, this.request = i, this.status = n.status, this.responseType = n.responseType;
2033
- var s;
2034
- try {
2035
- s = gt(n);
2036
- } catch {
2037
- s = n.responseText;
2038
- }
2039
- this.response = s;
2040
- };
2041
- }), Wr = (function() {
2042
- function e(t, r) {
2043
- return G.call(this, "ajax timeout", t, r), this.name = "AjaxTimeoutError", this;
2044
- }
2045
- return e.prototype = Object.create(G.prototype), e;
2046
- })();
2047
- function Yr(e, t) {
2048
- return U({ method: "GET", url: e, headers: t });
2049
- }
2050
- function Zr(e, t, r) {
2051
- return U({ method: "POST", url: e, body: t, headers: r });
2052
- }
2053
- function en(e, t) {
2054
- return U({ method: "DELETE", url: e, headers: t });
2055
- }
2056
- function tn(e, t, r) {
2057
- return U({ method: "PUT", url: e, body: t, headers: r });
2058
- }
2059
- function rn(e, t, r) {
2060
- return U({ method: "PATCH", url: e, body: t, headers: r });
2061
- }
2062
- var nn = N(function(e) {
2063
- return e.response;
2064
- });
2065
- function sn(e, t) {
2066
- return nn(U({
2067
- method: "GET",
2068
- url: e,
2069
- headers: t
998
+ function V(e, r, t) {
999
+ return t === void 0 && (t = 1 / 0), E(r) ? V(function(n, a) {
1000
+ return I(function(o, u) {
1001
+ return r(n, o, a, u);
1002
+ })(Ee(e(n, a)));
1003
+ }, t) : (typeof r == "number" && (t = r), me(function(n, a) {
1004
+ return Lr(n, a, e, t);
2070
1005
  }));
2071
1006
  }
2072
- var U = (function() {
2073
- var e = function(t) {
2074
- var r = typeof t == "string" ? {
2075
- url: t
2076
- } : t;
2077
- return an(r);
2078
- };
2079
- return e.get = Yr, e.post = Zr, e.delete = en, e.put = tn, e.patch = rn, e.getJSON = sn, e;
2080
- })(), on = "upload", ze = "download", ue = "loadstart", ce = "progress", Ge = "load";
2081
- function an(e) {
2082
- return new I(function(t) {
2083
- var r, n, i = K({ async: !0, crossDomain: !1, withCredentials: !1, method: "GET", timeout: 0, responseType: "json" }, e), s = i.queryParams, a = i.body, l = i.headers, o = i.url;
2084
- if (!o)
2085
- throw new TypeError("url is required");
2086
- if (s) {
2087
- var c;
2088
- if (o.includes("?")) {
2089
- var u = o.split("?");
2090
- if (2 < u.length)
2091
- throw new TypeError("invalid url");
2092
- c = new URLSearchParams(u[1]), new URLSearchParams(s).forEach(function(E, O) {
2093
- return c.set(O, E);
2094
- }), o = u[0] + "?" + c;
2095
- } else
2096
- c = new URLSearchParams(s), o = o + "?" + c;
2097
- }
2098
- var f = {};
2099
- if (l)
2100
- for (var h in l)
2101
- l.hasOwnProperty(h) && (f[h.toLowerCase()] = l[h]);
2102
- var d = i.crossDomain;
2103
- !d && !("x-requested-with" in f) && (f["x-requested-with"] = "XMLHttpRequest");
2104
- var v = i.withCredentials, p = i.xsrfCookieName, S = i.xsrfHeaderName;
2105
- if ((v || !d) && p && S) {
2106
- var g = (n = (r = document?.cookie.match(new RegExp("(^|;\\s*)(" + p + ")=([^;]*)"))) === null || r === void 0 ? void 0 : r.pop()) !== null && n !== void 0 ? n : "";
2107
- g && (f[S] = g);
2108
- }
2109
- var P = un(a, f), w = K(K({}, i), {
2110
- url: o,
2111
- headers: f,
2112
- body: P
2113
- }), y;
2114
- y = e.createXHR ? e.createXHR() : new XMLHttpRequest();
2115
- {
2116
- var m = e.progressSubscriber, j = e.includeDownloadProgress, A = j === void 0 ? !1 : j, T = e.includeUploadProgress, _ = T === void 0 ? !1 : T, k = function(E, O) {
2117
- y.addEventListener(E, function() {
2118
- var x, M = O();
2119
- (x = m?.error) === null || x === void 0 || x.call(m, M), t.error(M);
2120
- });
2121
- };
2122
- k("timeout", function() {
2123
- return new Wr(y, w);
2124
- }), k("abort", function() {
2125
- return new G("aborted", y, w);
2126
- });
2127
- var L = function(E, O) {
2128
- return new Xr(O, y, w, E + "_" + O.type);
2129
- }, Te = function(E, O, x) {
2130
- E.addEventListener(O, function(M) {
2131
- t.next(L(x, M));
2132
- });
2133
- };
2134
- _ && [ue, ce, Ge].forEach(function(E) {
2135
- return Te(y.upload, E, on);
2136
- }), m && [ue, ce].forEach(function(E) {
2137
- return y.upload.addEventListener(E, function(O) {
2138
- var x;
2139
- return (x = m?.next) === null || x === void 0 ? void 0 : x.call(m, O);
2140
- });
2141
- }), A && [ue, ce].forEach(function(E) {
2142
- return Te(y, E, ze);
2143
- });
2144
- var xe = function(E) {
2145
- var O = "ajax error" + (E ? " " + E : "");
2146
- t.error(new G(O, y, w));
2147
- };
2148
- y.addEventListener("error", function(E) {
2149
- var O;
2150
- (O = m?.error) === null || O === void 0 || O.call(m, E), xe();
2151
- }), y.addEventListener(Ge, function(E) {
2152
- var O, x, M = y.status;
2153
- if (M < 400) {
2154
- (O = m?.complete) === null || O === void 0 || O.call(m);
2155
- var Fe = void 0;
2156
- try {
2157
- Fe = L(ze, E);
2158
- } catch (wt) {
2159
- t.error(wt);
2160
- return;
2161
- }
2162
- t.next(Fe), t.complete();
2163
- } else
2164
- (x = m?.error) === null || x === void 0 || x.call(m, E), xe(M);
2165
- });
2166
- }
2167
- var Ie = w.user, Ae = w.method, se = w.async;
2168
- Ie ? y.open(Ae, o, se, Ie, w.password) : y.open(Ae, o, se), se && (y.timeout = w.timeout, y.responseType = w.responseType), "withCredentials" in y && (y.withCredentials = w.withCredentials);
2169
- for (var h in f)
2170
- f.hasOwnProperty(h) && y.setRequestHeader(h, f[h]);
2171
- return P ? y.send(P) : y.send(), function() {
2172
- y && y.readyState !== 4 && y.abort();
2173
- };
2174
- });
2175
- }
2176
- function un(e, t) {
2177
- var r;
2178
- if (!e || typeof e == "string" || pn(e) || vn(e) || ln(e) || fn(e) || hn(e) || yn(e))
2179
- return e;
2180
- if (dn(e))
2181
- return e.buffer;
2182
- if (typeof e == "object")
2183
- return t["content-type"] = (r = t["content-type"]) !== null && r !== void 0 ? r : "application/json;charset=utf-8", JSON.stringify(e);
2184
- throw new TypeError("Unknown body type");
2185
- }
2186
- var cn = Object.prototype.toString;
2187
- function Re(e, t) {
2188
- return cn.call(e) === "[object " + t + "]";
2189
- }
2190
- function ln(e) {
2191
- return Re(e, "ArrayBuffer");
2192
- }
2193
- function fn(e) {
2194
- return Re(e, "File");
2195
- }
2196
- function hn(e) {
2197
- return Re(e, "Blob");
2198
- }
2199
- function dn(e) {
2200
- return typeof ArrayBuffer < "u" && ArrayBuffer.isView(e);
2201
- }
2202
- function pn(e) {
2203
- return typeof FormData < "u" && e instanceof FormData;
2204
- }
2205
- function vn(e) {
2206
- return typeof URLSearchParams < "u" && e instanceof URLSearchParams;
2207
- }
2208
- function yn(e) {
2209
- return typeof ReadableStream < "u" && e instanceof ReadableStream;
2210
- }
2211
- function ye(e, t, r = []) {
2212
- return {
2213
- handle: (n, i) => {
2214
- let s;
2215
- for (const l of Array.isArray(n) ? n : [n]) {
2216
- const o = e.find(
2217
- (c) => c.ErrorCode === t[l]
2218
- );
2219
- if (o) {
2220
- s = i(l, o);
2221
- break;
2222
- }
2223
- }
2224
- let a = r;
2225
- return s !== void 0 && (a = [...a, s]), ye(
2226
- e,
2227
- t,
2228
- a
2229
- );
2230
- },
2231
- handleAll: (n, i) => {
2232
- let s;
2233
- const a = (Array.isArray(n) ? n : [n]).reduce(
2234
- (o, c) => {
2235
- const u = e.filter(
2236
- (f) => f.ErrorCode === t[c]
2237
- );
2238
- return u.length === 0 ? o : [
2239
- ...o,
2240
- {
2241
- errorName: c,
2242
- errors: u
2243
- }
2244
- ];
2245
- },
2246
- []
2247
- );
2248
- a.length > 0 && (s = i(a));
2249
- let l = r;
2250
- return s !== void 0 && (l = [...l, s]), ye(
2251
- e,
2252
- t,
2253
- l
2254
- );
2255
- },
2256
- check: ((n) => {
2257
- if (n)
2258
- return r.reduce(n.reducer, n.initialValue);
2259
- })
2260
- };
2261
- }
2262
- function mn(e, t) {
2263
- const r = {
2264
- ...t,
2265
- success: -1,
2266
- failure: -2
2267
- }, n = e.isSuccess ? e.result.WasSuccessful ? [
2268
- {
2269
- ErrorMessage: "",
2270
- PropertyName: "",
2271
- ErrorCode: -1
2272
- }
2273
- ] : e.result.ValidationErrors : [
2274
- {
2275
- ErrorMessage: "",
2276
- PropertyName: "",
2277
- ErrorCode: -2
2278
- }
2279
- ];
2280
- return ye(n, r);
2281
- }
2282
- function bn(e) {
2283
- return e?.invalidateToken ? (t) => t.pipe(
2284
- Pe((r) => (r.status === 401 && e.invalidateToken?.(), bt(() => r)))
2285
- ) : (t) => t;
2286
- }
2287
- process.env.NODE_ENV;
2288
- function gn(e, t) {
2289
- return e.length === 0 ? "" : t(e[0]) + e.slice(1);
2290
- }
2291
- function wn(e) {
2292
- return gn(e, (t) => t.toLowerCase());
1007
+ function Dr(e) {
1008
+ return e?.invalidateToken ? (r) => r.pipe(
1009
+ he((t) => (t.status === 401 && e.invalidateToken?.(), ye(() => t)))
1010
+ ) : (r) => r;
2293
1011
  }
2294
- function En(e) {
2295
- return JSON.parse(e, (t, r) => {
2296
- if (!(r === null && t !== ""))
2297
- return !r || Array.isArray(r) || typeof r != "object" ? r : Object.fromEntries(Object.entries(r).map(([n, i]) => [wn(n), i]));
1012
+ function Ur(e) {
1013
+ return JSON.parse(e, (r, t) => {
1014
+ if (!(t === null && r !== ""))
1015
+ return !t || Array.isArray(t) || typeof t != "object" ? t : Object.fromEntries(Object.entries(t).map(([n, a]) => [Ue(n), a]));
2298
1016
  });
2299
1017
  }
2300
- function Je() {
2301
- return (e) => e.pipe(N(En));
1018
+ function pe() {
1019
+ return (e) => e.pipe(I(Ur));
2302
1020
  }
2303
- function On({
1021
+ function Br({
2304
1022
  cqrsEndpoint: e,
2305
- queryClient: t,
2306
- tokenProvider: r,
1023
+ queryClient: r,
1024
+ tokenProvider: t,
2307
1025
  ajaxOptions: n,
2308
- tokenHeader: i = "Authorization"
1026
+ tokenHeader: a = "Authorization"
2309
1027
  }) {
2310
- function s(a, l = {}) {
2311
- const o = (f, h) => U({
1028
+ function o(u, l = {}) {
1029
+ const i = (f, d) => k({
2312
1030
  ...n,
2313
1031
  ...l,
2314
1032
  headers: {
2315
- [i]: h,
1033
+ [a]: d,
2316
1034
  "Content-Type": "application/json"
2317
1035
  },
2318
- url: `${e}/${a}`,
1036
+ url: `${e}/${u}`,
2319
1037
  method: "POST",
2320
1038
  body: f,
2321
1039
  withCredentials: n?.withCredentials ?? !0
2322
- }), c = r?.getToken, u = (f, h) => o(f, h).pipe(
2323
- bn(r),
2324
- N((d) => d.response)
1040
+ }), s = t?.getToken, c = (f, d) => i(f, d).pipe(
1041
+ Dr(t),
1042
+ I((p) => p.response)
2325
1043
  );
2326
- return c ? (f) => mt(c()).pipe(re((h) => u(f, h))) : (f) => u(f);
1044
+ return s ? (f) => Le(s()).pipe(V((d) => c(f, d))) : (f) => c(f);
2327
1045
  }
2328
1046
  return {
2329
- createQuery(a) {
2330
- const l = s(`query/${a}`, { responseType: "text" });
2331
- function o(u, f) {
2332
- return tr(
1047
+ createQuery(u) {
1048
+ const l = o(`query/${u}`, { responseType: "text" });
1049
+ function i(c, f) {
1050
+ return je(
2333
1051
  {
2334
- queryKey: o.key(u),
2335
- queryFn: (h) => Q(o.fetcher(u, h)),
1052
+ queryKey: i.key(c),
1053
+ queryFn: (d) => P(i.fetcher(c, d)),
2336
1054
  ...f
2337
1055
  },
2338
- t
1056
+ r
2339
1057
  );
2340
1058
  }
2341
- o.type = a, o.fetcher = (u, f) => Gr([
2342
- l(u).pipe(Je()),
1059
+ i.type = u, i.fetcher = (c, f) => Re([
1060
+ l(c).pipe(pe()),
2343
1061
  ...f?.signal ? [
2344
- ve(f.signal, "abort").pipe(
2345
- re(() => bt(() => new Error("Query aborted")))
1062
+ Ie(f.signal, "abort").pipe(
1063
+ V(() => ye(() => new Error("Query aborted")))
2346
1064
  )
2347
1065
  ] : []
2348
- ]), o.fetch = (u, f) => t.fetchQuery({
2349
- queryKey: o.key(u),
2350
- queryFn: (h) => Q(o.fetcher(u, h)),
1066
+ ]), i.fetch = (c, f) => r.fetchQuery({
1067
+ queryKey: i.key(c),
1068
+ queryFn: (d) => P(i.fetcher(c, d)),
2351
1069
  ...f
2352
- }), o.lazy = function(u = {}) {
2353
- return oe(
1070
+ }), i.lazy = function(c = {}) {
1071
+ return _(
2354
1072
  {
2355
- mutationKey: [a],
2356
- mutationFn: (f) => Q(o.fetcher(f)),
2357
- ...u
1073
+ mutationKey: [u],
1074
+ mutationFn: (f) => P(i.fetcher(f)),
1075
+ ...c
2358
1076
  },
2359
- t
1077
+ r
2360
1078
  );
2361
- }, o.infinite = function(u, f) {
2362
- return rr(
1079
+ }, i.infinite = function(c, f) {
1080
+ return Pe(
2363
1081
  {
2364
- queryKey: [a],
2365
- queryFn: (h) => Q(o.fetcher(h.pageParam, h)),
2366
- initialPageParam: u,
1082
+ queryKey: [u],
1083
+ queryFn: (d) => P(i.fetcher(d.pageParam, d)),
1084
+ initialPageParam: c,
2367
1085
  ...f
2368
1086
  },
2369
- t
1087
+ r
2370
1088
  );
2371
- }, o.key = (u) => [a, u];
2372
- function c(u, f) {
2373
- const h = Array.isArray(u) ? u : o.key(u);
2374
- return t.setQueryData(h, f);
1089
+ }, i.key = (c) => [u, c];
1090
+ function s(c, f) {
1091
+ const d = Array.isArray(c) ? c : i.key(c);
1092
+ return r.setQueryData(d, f);
2375
1093
  }
2376
- return o.setQueryData = c, o.setQueriesData = (u, f) => t.setQueriesData({ queryKey: o.key(u) }, f), o.getQueryData = (u) => t.getQueryData(o.key(u)), o.getQueriesData = (u) => t.getQueriesData({
2377
- queryKey: o.key(u)
2378
- }), o.prefetch = (u, f) => t.prefetchQuery({
2379
- queryKey: o.key(u),
2380
- queryFn: (h) => Q(o.fetcher(u, h)),
1094
+ return i.setQueryData = s, i.setQueriesData = (c, f) => r.setQueriesData({ queryKey: i.key(c) }, f), i.getQueryData = (c) => r.getQueryData(i.key(c)), i.getQueriesData = (c) => r.getQueriesData({
1095
+ queryKey: i.key(c)
1096
+ }), i.prefetch = (c, f) => r.prefetchQuery({
1097
+ queryKey: i.key(c),
1098
+ queryFn: (d) => P(i.fetcher(c, d)),
2381
1099
  ...f
2382
- }), o.invalidate = (u) => t.invalidateQueries({ queryKey: o.key(u) }), o.cancel = (u) => t.cancelQueries({ queryKey: o.key(u) }), o.optimisticUpdate = async (u, f = {}) => {
2383
- await o.cancel(f);
2384
- const h = o.getQueriesData(f);
2385
- return o.setQueriesData(f, u), () => h.forEach(([d, v]) => t.setQueryData(d, v));
2386
- }, o;
1100
+ }), i.invalidate = (c) => r.invalidateQueries({ queryKey: i.key(c) }), i.cancel = (c) => r.cancelQueries({ queryKey: i.key(c) }), i.optimisticUpdate = async (c, f = {}) => {
1101
+ await i.cancel(f);
1102
+ const d = i.getQueriesData(f);
1103
+ return i.setQueriesData(f, c), () => d.forEach(([p, m]) => r.setQueryData(p, m));
1104
+ }, i;
2387
1105
  },
2388
- createOperation(a) {
2389
- const l = s(`operation/${a}`, { responseType: "text" });
2390
- function o({
2391
- onSuccess: c,
2392
- invalidateQueries: u,
1106
+ createOperation(u) {
1107
+ const l = o(`operation/${u}`, { responseType: "text" });
1108
+ function i({
1109
+ onSuccess: s,
1110
+ invalidateQueries: c,
2393
1111
  ...f
2394
1112
  } = {}) {
2395
- return oe(
1113
+ return _(
2396
1114
  {
2397
- mutationKey: o.key,
2398
- mutationFn: (h) => Q(o.fetcher(h)),
1115
+ mutationKey: i.key,
1116
+ mutationFn: (d) => P(i.fetcher(d)),
2399
1117
  ...f,
2400
- async onSuccess(h, d, v, p) {
2401
- const S = await c?.(h, d, v, p);
2402
- return u && await Promise.allSettled(u.map((g) => t.invalidateQueries({ queryKey: g }))), S;
1118
+ async onSuccess(d, p, m, y) {
1119
+ const A = await s?.(d, p, m, y);
1120
+ return c && await Promise.allSettled(c.map((S) => r.invalidateQueries({ queryKey: S }))), A;
2403
1121
  }
2404
1122
  },
2405
- t
1123
+ r
2406
1124
  );
2407
1125
  }
2408
- return o.type = a, o.key = [o.type], o.fetcher = (c) => l(c).pipe(Je()), o;
1126
+ return i.type = u, i.key = [i.type], i.fetcher = (s) => l(s).pipe(pe()), i;
2409
1127
  },
2410
- createCommand(a, l) {
2411
- const o = s(`command/${a}`);
2412
- function c({
2413
- invalidateQueries: u,
1128
+ createCommand(u, l) {
1129
+ const i = o(`command/${u}`);
1130
+ function s({
1131
+ invalidateQueries: c,
2414
1132
  handler: f,
2415
- optimisticUpdate: h,
2416
- onMutate: d,
2417
- onError: v,
2418
- onSettled: p,
2419
- ...S
1133
+ optimisticUpdate: d,
1134
+ onMutate: p,
1135
+ onError: m,
1136
+ onSettled: y,
1137
+ ...A
2420
1138
  } = {}) {
2421
- return oe(
1139
+ return _(
2422
1140
  {
2423
- ...S,
2424
- mutationKey: c.key,
2425
- mutationFn: (g) => Q(c.call(g, f)),
2426
- async onMutate(g, P) {
2427
- const w = await d?.(g, P), y = await Promise.all(h?.(g) ?? []);
1141
+ ...A,
1142
+ mutationKey: s.key,
1143
+ mutationFn: (S) => P(s.call(S, f)),
1144
+ async onMutate(S, T) {
1145
+ const x = await p?.(S, T), h = await Promise.all(d?.(S) ?? []);
2428
1146
  return {
2429
- ...w,
2430
- revertOptimisticUpdate: () => y.forEach((m) => m())
1147
+ ...x,
1148
+ revertOptimisticUpdate: () => h.forEach((v) => v())
2431
1149
  };
2432
1150
  },
2433
- async onError(g, P, w, y) {
2434
- await v?.(g, P, w, y), w?.revertOptimisticUpdate();
1151
+ async onError(S, T, x, h) {
1152
+ await m?.(S, T, x, h), x?.revertOptimisticUpdate();
2435
1153
  },
2436
1154
  // eslint-disable-next-line max-params
2437
- async onSettled(g, P, w, y, m) {
2438
- return u && await Promise.allSettled(u.map((j) => t.invalidateQueries({ queryKey: j }))), await p?.(g, P, w, y, m);
1155
+ async onSettled(S, T, x, h, v) {
1156
+ return c && await Promise.allSettled(c.map((F) => r.invalidateQueries({ queryKey: F }))), await y?.(S, T, x, h, v);
2439
1157
  }
2440
1158
  },
2441
- t
1159
+ r
2442
1160
  );
2443
1161
  }
2444
- return c.type = a, c.key = [c.type], c.fetcher = o, c.call = (u, f) => c.fetcher(u).pipe(
2445
- N(
2446
- (d) => ({
1162
+ return s.type = u, s.key = [s.type], s.fetcher = i, s.call = (c, f) => s.fetcher(c).pipe(
1163
+ I(
1164
+ (p) => ({
2447
1165
  isSuccess: !0,
2448
- result: d
1166
+ result: p
2449
1167
  })
2450
1168
  ),
2451
- Pe((d) => Lr(c.mapError(d))),
2452
- N((d) => {
2453
- const v = f ? c.handleResponse(f, u)(d) : d;
2454
- if (!d.isSuccess || !d.result.WasSuccessful)
2455
- throw v;
2456
- return v;
1169
+ he((p) => ke(s.mapError(p))),
1170
+ I((p) => {
1171
+ const m = f ? s.handleResponse(f, c)(p) : p;
1172
+ if (!p.isSuccess || !p.result.WasSuccessful)
1173
+ throw m;
1174
+ return m;
2457
1175
  })
2458
- ), c.mapError = (u) => u instanceof G && u.status === 422 ? {
1176
+ ), s.mapError = (c) => c instanceof U && c.status === 422 ? {
2459
1177
  isSuccess: !0,
2460
- result: u.response
1178
+ result: c.response
2461
1179
  } : {
2462
1180
  isSuccess: !1,
2463
- error: u
2464
- }, c.handleResponse = (u, f) => (h) => u(mn(h, l), f), c;
1181
+ error: c
1182
+ }, s.handleResponse = (c, f) => (d) => c(De(d, l), f), s;
2465
1183
  }
2466
1184
  };
2467
1185
  }
2468
1186
  export {
2469
- On as mkCqrsClient
1187
+ Br as mkCqrsClient
2470
1188
  };