@myxtra/authentication-green 1.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.
@@ -0,0 +1,3252 @@
1
+ import { r as c, j as n, g as wt, u as z, a as Qe, b as _t, E as Rt } from "./index-a5c488e5.mjs";
2
+ class B {
3
+ constructor() {
4
+ this.listeners = /* @__PURE__ */ new Set(), this.subscribe = this.subscribe.bind(this);
5
+ }
6
+ subscribe(e) {
7
+ const s = {
8
+ listener: e
9
+ };
10
+ return this.listeners.add(s), this.onSubscribe(), () => {
11
+ this.listeners.delete(s), this.onUnsubscribe();
12
+ };
13
+ }
14
+ hasListeners() {
15
+ return this.listeners.size > 0;
16
+ }
17
+ onSubscribe() {
18
+ }
19
+ onUnsubscribe() {
20
+ }
21
+ }
22
+ const Y = typeof window > "u" || "Deno" in window;
23
+ function k() {
24
+ }
25
+ function Et(t, e) {
26
+ return typeof t == "function" ? t(e) : t;
27
+ }
28
+ function de(t) {
29
+ return typeof t == "number" && t >= 0 && t !== 1 / 0;
30
+ }
31
+ function qe(t, e) {
32
+ return Math.max(t + (e || 0) - Date.now(), 0);
33
+ }
34
+ function W(t, e, s) {
35
+ return J(t) ? typeof e == "function" ? {
36
+ ...s,
37
+ queryKey: t,
38
+ queryFn: e
39
+ } : {
40
+ ...e,
41
+ queryKey: t
42
+ } : t;
43
+ }
44
+ function Ot(t, e, s) {
45
+ return J(t) ? typeof e == "function" ? {
46
+ ...s,
47
+ mutationKey: t,
48
+ mutationFn: e
49
+ } : {
50
+ ...e,
51
+ mutationKey: t
52
+ } : typeof t == "function" ? {
53
+ ...e,
54
+ mutationFn: t
55
+ } : {
56
+ ...t
57
+ };
58
+ }
59
+ function I(t, e, s) {
60
+ return J(t) ? [{
61
+ ...e,
62
+ queryKey: t
63
+ }, s] : [t || {}, e];
64
+ }
65
+ function Ee(t, e) {
66
+ const {
67
+ type: s = "all",
68
+ exact: r,
69
+ fetchStatus: i,
70
+ predicate: o,
71
+ queryKey: a,
72
+ stale: u
73
+ } = t;
74
+ if (J(a)) {
75
+ if (r) {
76
+ if (e.queryHash !== be(a, e.options))
77
+ return !1;
78
+ } else if (!se(e.queryKey, a))
79
+ return !1;
80
+ }
81
+ if (s !== "all") {
82
+ const l = e.isActive();
83
+ if (s === "active" && !l || s === "inactive" && l)
84
+ return !1;
85
+ }
86
+ return !(typeof u == "boolean" && e.isStale() !== u || typeof i < "u" && i !== e.state.fetchStatus || o && !o(e));
87
+ }
88
+ function Oe(t, e) {
89
+ const {
90
+ exact: s,
91
+ fetching: r,
92
+ predicate: i,
93
+ mutationKey: o
94
+ } = t;
95
+ if (J(o)) {
96
+ if (!e.options.mutationKey)
97
+ return !1;
98
+ if (s) {
99
+ if (T(e.options.mutationKey) !== T(o))
100
+ return !1;
101
+ } else if (!se(e.options.mutationKey, o))
102
+ return !1;
103
+ }
104
+ return !(typeof r == "boolean" && e.state.status === "loading" !== r || i && !i(e));
105
+ }
106
+ function be(t, e) {
107
+ return ((e == null ? void 0 : e.queryKeyHashFn) || T)(t);
108
+ }
109
+ function T(t) {
110
+ return JSON.stringify(t, (e, s) => fe(s) ? Object.keys(s).sort().reduce((r, i) => (r[i] = s[i], r), {}) : s);
111
+ }
112
+ function se(t, e) {
113
+ return Be(t, e);
114
+ }
115
+ function Be(t, e) {
116
+ return t === e ? !0 : typeof t != typeof e ? !1 : t && e && typeof t == "object" && typeof e == "object" ? !Object.keys(e).some((s) => !Be(t[s], e[s])) : !1;
117
+ }
118
+ function Ke(t, e) {
119
+ if (t === e)
120
+ return t;
121
+ const s = Se(t) && Se(e);
122
+ if (s || fe(t) && fe(e)) {
123
+ const r = s ? t.length : Object.keys(t).length, i = s ? e : Object.keys(e), o = i.length, a = s ? [] : {};
124
+ let u = 0;
125
+ for (let l = 0; l < o; l++) {
126
+ const h = s ? l : i[l];
127
+ a[h] = Ke(t[h], e[h]), a[h] === t[h] && u++;
128
+ }
129
+ return r === o && u === r ? t : a;
130
+ }
131
+ return e;
132
+ }
133
+ function he(t, e) {
134
+ if (t && !e || e && !t)
135
+ return !1;
136
+ for (const s in t)
137
+ if (t[s] !== e[s])
138
+ return !1;
139
+ return !0;
140
+ }
141
+ function Se(t) {
142
+ return Array.isArray(t) && t.length === Object.keys(t).length;
143
+ }
144
+ function fe(t) {
145
+ if (!Pe(t))
146
+ return !1;
147
+ const e = t.constructor;
148
+ if (typeof e > "u")
149
+ return !0;
150
+ const s = e.prototype;
151
+ return !(!Pe(s) || !s.hasOwnProperty("isPrototypeOf"));
152
+ }
153
+ function Pe(t) {
154
+ return Object.prototype.toString.call(t) === "[object Object]";
155
+ }
156
+ function J(t) {
157
+ return Array.isArray(t);
158
+ }
159
+ function He(t) {
160
+ return new Promise((e) => {
161
+ setTimeout(e, t);
162
+ });
163
+ }
164
+ function Ae(t) {
165
+ He(0).then(t);
166
+ }
167
+ function St() {
168
+ if (typeof AbortController == "function")
169
+ return new AbortController();
170
+ }
171
+ function pe(t, e, s) {
172
+ return s.isDataEqual != null && s.isDataEqual(t, e) ? t : typeof s.structuralSharing == "function" ? s.structuralSharing(t, e) : s.structuralSharing !== !1 ? Ke(t, e) : e;
173
+ }
174
+ class Pt extends B {
175
+ constructor() {
176
+ super(), this.setup = (e) => {
177
+ if (!Y && window.addEventListener) {
178
+ const s = () => e();
179
+ return window.addEventListener("visibilitychange", s, !1), window.addEventListener("focus", s, !1), () => {
180
+ window.removeEventListener("visibilitychange", s), window.removeEventListener("focus", s);
181
+ };
182
+ }
183
+ };
184
+ }
185
+ onSubscribe() {
186
+ this.cleanup || this.setEventListener(this.setup);
187
+ }
188
+ onUnsubscribe() {
189
+ if (!this.hasListeners()) {
190
+ var e;
191
+ (e = this.cleanup) == null || e.call(this), this.cleanup = void 0;
192
+ }
193
+ }
194
+ setEventListener(e) {
195
+ var s;
196
+ this.setup = e, (s = this.cleanup) == null || s.call(this), this.cleanup = e((r) => {
197
+ typeof r == "boolean" ? this.setFocused(r) : this.onFocus();
198
+ });
199
+ }
200
+ setFocused(e) {
201
+ this.focused = e, e && this.onFocus();
202
+ }
203
+ onFocus() {
204
+ this.listeners.forEach(({
205
+ listener: e
206
+ }) => {
207
+ e();
208
+ });
209
+ }
210
+ isFocused() {
211
+ return typeof this.focused == "boolean" ? this.focused : typeof document > "u" ? !0 : [void 0, "visible", "prerender"].includes(document.visibilityState);
212
+ }
213
+ }
214
+ const re = new Pt(), Ne = ["online", "offline"];
215
+ class At extends B {
216
+ constructor() {
217
+ super(), this.setup = (e) => {
218
+ if (!Y && window.addEventListener) {
219
+ const s = () => e();
220
+ return Ne.forEach((r) => {
221
+ window.addEventListener(r, s, !1);
222
+ }), () => {
223
+ Ne.forEach((r) => {
224
+ window.removeEventListener(r, s);
225
+ });
226
+ };
227
+ }
228
+ };
229
+ }
230
+ onSubscribe() {
231
+ this.cleanup || this.setEventListener(this.setup);
232
+ }
233
+ onUnsubscribe() {
234
+ if (!this.hasListeners()) {
235
+ var e;
236
+ (e = this.cleanup) == null || e.call(this), this.cleanup = void 0;
237
+ }
238
+ }
239
+ setEventListener(e) {
240
+ var s;
241
+ this.setup = e, (s = this.cleanup) == null || s.call(this), this.cleanup = e((r) => {
242
+ typeof r == "boolean" ? this.setOnline(r) : this.onOnline();
243
+ });
244
+ }
245
+ setOnline(e) {
246
+ this.online = e, e && this.onOnline();
247
+ }
248
+ onOnline() {
249
+ this.listeners.forEach(({
250
+ listener: e
251
+ }) => {
252
+ e();
253
+ });
254
+ }
255
+ isOnline() {
256
+ return typeof this.online == "boolean" ? this.online : typeof navigator > "u" || typeof navigator.onLine > "u" ? !0 : navigator.onLine;
257
+ }
258
+ }
259
+ const ne = new At();
260
+ function Nt(t) {
261
+ return Math.min(1e3 * 2 ** t, 3e4);
262
+ }
263
+ function ue(t) {
264
+ return (t ?? "online") === "online" ? ne.isOnline() : !0;
265
+ }
266
+ class Ge {
267
+ constructor(e) {
268
+ this.revert = e == null ? void 0 : e.revert, this.silent = e == null ? void 0 : e.silent;
269
+ }
270
+ }
271
+ function te(t) {
272
+ return t instanceof Ge;
273
+ }
274
+ function Ve(t) {
275
+ let e = !1, s = 0, r = !1, i, o, a;
276
+ const u = new Promise((v, y) => {
277
+ o = v, a = y;
278
+ }), l = (v) => {
279
+ r || (f(new Ge(v)), t.abort == null || t.abort());
280
+ }, h = () => {
281
+ e = !0;
282
+ }, d = () => {
283
+ e = !1;
284
+ }, p = () => !re.isFocused() || t.networkMode !== "always" && !ne.isOnline(), m = (v) => {
285
+ r || (r = !0, t.onSuccess == null || t.onSuccess(v), i == null || i(), o(v));
286
+ }, f = (v) => {
287
+ r || (r = !0, t.onError == null || t.onError(v), i == null || i(), a(v));
288
+ }, C = () => new Promise((v) => {
289
+ i = (y) => {
290
+ const _ = r || !p();
291
+ return _ && v(y), _;
292
+ }, t.onPause == null || t.onPause();
293
+ }).then(() => {
294
+ i = void 0, r || t.onContinue == null || t.onContinue();
295
+ }), g = () => {
296
+ if (r)
297
+ return;
298
+ let v;
299
+ try {
300
+ v = t.fn();
301
+ } catch (y) {
302
+ v = Promise.reject(y);
303
+ }
304
+ Promise.resolve(v).then(m).catch((y) => {
305
+ var _, j;
306
+ if (r)
307
+ return;
308
+ const O = (_ = t.retry) != null ? _ : 3, N = (j = t.retryDelay) != null ? j : Nt, R = typeof N == "function" ? N(s, y) : N, w = O === !0 || typeof O == "number" && s < O || typeof O == "function" && O(s, y);
309
+ if (e || !w) {
310
+ f(y);
311
+ return;
312
+ }
313
+ s++, t.onFail == null || t.onFail(s, y), He(R).then(() => {
314
+ if (p())
315
+ return C();
316
+ }).then(() => {
317
+ e ? f(y) : g();
318
+ });
319
+ });
320
+ };
321
+ return ue(t.networkMode) ? g() : C().then(g), {
322
+ promise: u,
323
+ cancel: l,
324
+ continue: () => (i == null ? void 0 : i()) ? u : Promise.resolve(),
325
+ cancelRetry: h,
326
+ continueRetry: d
327
+ };
328
+ }
329
+ const ge = console;
330
+ function Mt() {
331
+ let t = [], e = 0, s = (d) => {
332
+ d();
333
+ }, r = (d) => {
334
+ d();
335
+ };
336
+ const i = (d) => {
337
+ let p;
338
+ e++;
339
+ try {
340
+ p = d();
341
+ } finally {
342
+ e--, e || u();
343
+ }
344
+ return p;
345
+ }, o = (d) => {
346
+ e ? t.push(d) : Ae(() => {
347
+ s(d);
348
+ });
349
+ }, a = (d) => (...p) => {
350
+ o(() => {
351
+ d(...p);
352
+ });
353
+ }, u = () => {
354
+ const d = t;
355
+ t = [], d.length && Ae(() => {
356
+ r(() => {
357
+ d.forEach((p) => {
358
+ s(p);
359
+ });
360
+ });
361
+ });
362
+ };
363
+ return {
364
+ batch: i,
365
+ batchCalls: a,
366
+ schedule: o,
367
+ setNotifyFunction: (d) => {
368
+ s = d;
369
+ },
370
+ setBatchNotifyFunction: (d) => {
371
+ r = d;
372
+ }
373
+ };
374
+ }
375
+ const P = Mt();
376
+ class $e {
377
+ destroy() {
378
+ this.clearGcTimeout();
379
+ }
380
+ scheduleGc() {
381
+ this.clearGcTimeout(), de(this.cacheTime) && (this.gcTimeout = setTimeout(() => {
382
+ this.optionalRemove();
383
+ }, this.cacheTime));
384
+ }
385
+ updateCacheTime(e) {
386
+ this.cacheTime = Math.max(this.cacheTime || 0, e ?? (Y ? 1 / 0 : 5 * 60 * 1e3));
387
+ }
388
+ clearGcTimeout() {
389
+ this.gcTimeout && (clearTimeout(this.gcTimeout), this.gcTimeout = void 0);
390
+ }
391
+ }
392
+ class Ft extends $e {
393
+ constructor(e) {
394
+ super(), this.abortSignalConsumed = !1, this.defaultOptions = e.defaultOptions, this.setOptions(e.options), this.observers = [], this.cache = e.cache, this.logger = e.logger || ge, this.queryKey = e.queryKey, this.queryHash = e.queryHash, this.initialState = e.state || kt(this.options), this.state = this.initialState, this.scheduleGc();
395
+ }
396
+ get meta() {
397
+ return this.options.meta;
398
+ }
399
+ setOptions(e) {
400
+ this.options = {
401
+ ...this.defaultOptions,
402
+ ...e
403
+ }, this.updateCacheTime(this.options.cacheTime);
404
+ }
405
+ optionalRemove() {
406
+ !this.observers.length && this.state.fetchStatus === "idle" && this.cache.remove(this);
407
+ }
408
+ setData(e, s) {
409
+ const r = pe(this.state.data, e, this.options);
410
+ return this.dispatch({
411
+ data: r,
412
+ type: "success",
413
+ dataUpdatedAt: s == null ? void 0 : s.updatedAt,
414
+ manual: s == null ? void 0 : s.manual
415
+ }), r;
416
+ }
417
+ setState(e, s) {
418
+ this.dispatch({
419
+ type: "setState",
420
+ state: e,
421
+ setStateOptions: s
422
+ });
423
+ }
424
+ cancel(e) {
425
+ var s;
426
+ const r = this.promise;
427
+ return (s = this.retryer) == null || s.cancel(e), r ? r.then(k).catch(k) : Promise.resolve();
428
+ }
429
+ destroy() {
430
+ super.destroy(), this.cancel({
431
+ silent: !0
432
+ });
433
+ }
434
+ reset() {
435
+ this.destroy(), this.setState(this.initialState);
436
+ }
437
+ isActive() {
438
+ return this.observers.some((e) => e.options.enabled !== !1);
439
+ }
440
+ isDisabled() {
441
+ return this.getObserversCount() > 0 && !this.isActive();
442
+ }
443
+ isStale() {
444
+ return this.state.isInvalidated || !this.state.dataUpdatedAt || this.observers.some((e) => e.getCurrentResult().isStale);
445
+ }
446
+ isStaleByTime(e = 0) {
447
+ return this.state.isInvalidated || !this.state.dataUpdatedAt || !qe(this.state.dataUpdatedAt, e);
448
+ }
449
+ onFocus() {
450
+ var e;
451
+ const s = this.observers.find((r) => r.shouldFetchOnWindowFocus());
452
+ s && s.refetch({
453
+ cancelRefetch: !1
454
+ }), (e = this.retryer) == null || e.continue();
455
+ }
456
+ onOnline() {
457
+ var e;
458
+ const s = this.observers.find((r) => r.shouldFetchOnReconnect());
459
+ s && s.refetch({
460
+ cancelRefetch: !1
461
+ }), (e = this.retryer) == null || e.continue();
462
+ }
463
+ addObserver(e) {
464
+ this.observers.includes(e) || (this.observers.push(e), this.clearGcTimeout(), this.cache.notify({
465
+ type: "observerAdded",
466
+ query: this,
467
+ observer: e
468
+ }));
469
+ }
470
+ removeObserver(e) {
471
+ this.observers.includes(e) && (this.observers = this.observers.filter((s) => s !== e), this.observers.length || (this.retryer && (this.abortSignalConsumed ? this.retryer.cancel({
472
+ revert: !0
473
+ }) : this.retryer.cancelRetry()), this.scheduleGc()), this.cache.notify({
474
+ type: "observerRemoved",
475
+ query: this,
476
+ observer: e
477
+ }));
478
+ }
479
+ getObserversCount() {
480
+ return this.observers.length;
481
+ }
482
+ invalidate() {
483
+ this.state.isInvalidated || this.dispatch({
484
+ type: "invalidate"
485
+ });
486
+ }
487
+ fetch(e, s) {
488
+ var r, i;
489
+ if (this.state.fetchStatus !== "idle") {
490
+ if (this.state.dataUpdatedAt && s != null && s.cancelRefetch)
491
+ this.cancel({
492
+ silent: !0
493
+ });
494
+ else if (this.promise) {
495
+ var o;
496
+ return (o = this.retryer) == null || o.continueRetry(), this.promise;
497
+ }
498
+ }
499
+ if (e && this.setOptions(e), !this.options.queryFn) {
500
+ const f = this.observers.find((C) => C.options.queryFn);
501
+ f && this.setOptions(f.options);
502
+ }
503
+ Array.isArray(this.options.queryKey);
504
+ const a = St(), u = {
505
+ queryKey: this.queryKey,
506
+ pageParam: void 0,
507
+ meta: this.meta
508
+ }, l = (f) => {
509
+ Object.defineProperty(f, "signal", {
510
+ enumerable: !0,
511
+ get: () => {
512
+ if (a)
513
+ return this.abortSignalConsumed = !0, a.signal;
514
+ }
515
+ });
516
+ };
517
+ l(u);
518
+ const h = () => this.options.queryFn ? (this.abortSignalConsumed = !1, this.options.queryFn(u)) : Promise.reject("Missing queryFn for queryKey '" + this.options.queryHash + "'"), d = {
519
+ fetchOptions: s,
520
+ options: this.options,
521
+ queryKey: this.queryKey,
522
+ state: this.state,
523
+ fetchFn: h
524
+ };
525
+ if (l(d), (r = this.options.behavior) == null || r.onFetch(d), this.revertState = this.state, this.state.fetchStatus === "idle" || this.state.fetchMeta !== ((i = d.fetchOptions) == null ? void 0 : i.meta)) {
526
+ var p;
527
+ this.dispatch({
528
+ type: "fetch",
529
+ meta: (p = d.fetchOptions) == null ? void 0 : p.meta
530
+ });
531
+ }
532
+ const m = (f) => {
533
+ if (te(f) && f.silent || this.dispatch({
534
+ type: "error",
535
+ error: f
536
+ }), !te(f)) {
537
+ var C, g, v, y;
538
+ (C = (g = this.cache.config).onError) == null || C.call(g, f, this), (v = (y = this.cache.config).onSettled) == null || v.call(y, this.state.data, f, this);
539
+ }
540
+ this.isFetchingOptimistic || this.scheduleGc(), this.isFetchingOptimistic = !1;
541
+ };
542
+ return this.retryer = Ve({
543
+ fn: d.fetchFn,
544
+ abort: a == null ? void 0 : a.abort.bind(a),
545
+ onSuccess: (f) => {
546
+ var C, g, v, y;
547
+ if (typeof f > "u") {
548
+ m(new Error(this.queryHash + " data is undefined"));
549
+ return;
550
+ }
551
+ this.setData(f), (C = (g = this.cache.config).onSuccess) == null || C.call(g, f, this), (v = (y = this.cache.config).onSettled) == null || v.call(y, f, this.state.error, this), this.isFetchingOptimistic || this.scheduleGc(), this.isFetchingOptimistic = !1;
552
+ },
553
+ onError: m,
554
+ onFail: (f, C) => {
555
+ this.dispatch({
556
+ type: "failed",
557
+ failureCount: f,
558
+ error: C
559
+ });
560
+ },
561
+ onPause: () => {
562
+ this.dispatch({
563
+ type: "pause"
564
+ });
565
+ },
566
+ onContinue: () => {
567
+ this.dispatch({
568
+ type: "continue"
569
+ });
570
+ },
571
+ retry: d.options.retry,
572
+ retryDelay: d.options.retryDelay,
573
+ networkMode: d.options.networkMode
574
+ }), this.promise = this.retryer.promise, this.promise;
575
+ }
576
+ dispatch(e) {
577
+ const s = (r) => {
578
+ var i, o;
579
+ switch (e.type) {
580
+ case "failed":
581
+ return {
582
+ ...r,
583
+ fetchFailureCount: e.failureCount,
584
+ fetchFailureReason: e.error
585
+ };
586
+ case "pause":
587
+ return {
588
+ ...r,
589
+ fetchStatus: "paused"
590
+ };
591
+ case "continue":
592
+ return {
593
+ ...r,
594
+ fetchStatus: "fetching"
595
+ };
596
+ case "fetch":
597
+ return {
598
+ ...r,
599
+ fetchFailureCount: 0,
600
+ fetchFailureReason: null,
601
+ fetchMeta: (i = e.meta) != null ? i : null,
602
+ fetchStatus: ue(this.options.networkMode) ? "fetching" : "paused",
603
+ ...!r.dataUpdatedAt && {
604
+ error: null,
605
+ status: "loading"
606
+ }
607
+ };
608
+ case "success":
609
+ return {
610
+ ...r,
611
+ data: e.data,
612
+ dataUpdateCount: r.dataUpdateCount + 1,
613
+ dataUpdatedAt: (o = e.dataUpdatedAt) != null ? o : Date.now(),
614
+ error: null,
615
+ isInvalidated: !1,
616
+ status: "success",
617
+ ...!e.manual && {
618
+ fetchStatus: "idle",
619
+ fetchFailureCount: 0,
620
+ fetchFailureReason: null
621
+ }
622
+ };
623
+ case "error":
624
+ const a = e.error;
625
+ return te(a) && a.revert && this.revertState ? {
626
+ ...this.revertState
627
+ } : {
628
+ ...r,
629
+ error: a,
630
+ errorUpdateCount: r.errorUpdateCount + 1,
631
+ errorUpdatedAt: Date.now(),
632
+ fetchFailureCount: r.fetchFailureCount + 1,
633
+ fetchFailureReason: a,
634
+ fetchStatus: "idle",
635
+ status: "error"
636
+ };
637
+ case "invalidate":
638
+ return {
639
+ ...r,
640
+ isInvalidated: !0
641
+ };
642
+ case "setState":
643
+ return {
644
+ ...r,
645
+ ...e.state
646
+ };
647
+ }
648
+ };
649
+ this.state = s(this.state), P.batch(() => {
650
+ this.observers.forEach((r) => {
651
+ r.onQueryUpdate(e);
652
+ }), this.cache.notify({
653
+ query: this,
654
+ type: "updated",
655
+ action: e
656
+ });
657
+ });
658
+ }
659
+ }
660
+ function kt(t) {
661
+ const e = typeof t.initialData == "function" ? t.initialData() : t.initialData, s = typeof e < "u", r = s ? typeof t.initialDataUpdatedAt == "function" ? t.initialDataUpdatedAt() : t.initialDataUpdatedAt : 0;
662
+ return {
663
+ data: e,
664
+ dataUpdateCount: 0,
665
+ dataUpdatedAt: s ? r ?? Date.now() : 0,
666
+ error: null,
667
+ errorUpdateCount: 0,
668
+ errorUpdatedAt: 0,
669
+ fetchFailureCount: 0,
670
+ fetchFailureReason: null,
671
+ fetchMeta: null,
672
+ isInvalidated: !1,
673
+ status: s ? "success" : "loading",
674
+ fetchStatus: "idle"
675
+ };
676
+ }
677
+ class Lt extends B {
678
+ constructor(e) {
679
+ super(), this.config = e || {}, this.queries = [], this.queriesMap = {};
680
+ }
681
+ build(e, s, r) {
682
+ var i;
683
+ const o = s.queryKey, a = (i = s.queryHash) != null ? i : be(o, s);
684
+ let u = this.get(a);
685
+ return u || (u = new Ft({
686
+ cache: this,
687
+ logger: e.getLogger(),
688
+ queryKey: o,
689
+ queryHash: a,
690
+ options: e.defaultQueryOptions(s),
691
+ state: r,
692
+ defaultOptions: e.getQueryDefaults(o)
693
+ }), this.add(u)), u;
694
+ }
695
+ add(e) {
696
+ this.queriesMap[e.queryHash] || (this.queriesMap[e.queryHash] = e, this.queries.push(e), this.notify({
697
+ type: "added",
698
+ query: e
699
+ }));
700
+ }
701
+ remove(e) {
702
+ const s = this.queriesMap[e.queryHash];
703
+ s && (e.destroy(), this.queries = this.queries.filter((r) => r !== e), s === e && delete this.queriesMap[e.queryHash], this.notify({
704
+ type: "removed",
705
+ query: e
706
+ }));
707
+ }
708
+ clear() {
709
+ P.batch(() => {
710
+ this.queries.forEach((e) => {
711
+ this.remove(e);
712
+ });
713
+ });
714
+ }
715
+ get(e) {
716
+ return this.queriesMap[e];
717
+ }
718
+ getAll() {
719
+ return this.queries;
720
+ }
721
+ find(e, s) {
722
+ const [r] = I(e, s);
723
+ return typeof r.exact > "u" && (r.exact = !0), this.queries.find((i) => Ee(r, i));
724
+ }
725
+ findAll(e, s) {
726
+ const [r] = I(e, s);
727
+ return Object.keys(r).length > 0 ? this.queries.filter((i) => Ee(r, i)) : this.queries;
728
+ }
729
+ notify(e) {
730
+ P.batch(() => {
731
+ this.listeners.forEach(({
732
+ listener: s
733
+ }) => {
734
+ s(e);
735
+ });
736
+ });
737
+ }
738
+ onFocus() {
739
+ P.batch(() => {
740
+ this.queries.forEach((e) => {
741
+ e.onFocus();
742
+ });
743
+ });
744
+ }
745
+ onOnline() {
746
+ P.batch(() => {
747
+ this.queries.forEach((e) => {
748
+ e.onOnline();
749
+ });
750
+ });
751
+ }
752
+ }
753
+ class Dt extends $e {
754
+ constructor(e) {
755
+ super(), this.defaultOptions = e.defaultOptions, this.mutationId = e.mutationId, this.mutationCache = e.mutationCache, this.logger = e.logger || ge, this.observers = [], this.state = e.state || Ze(), this.setOptions(e.options), this.scheduleGc();
756
+ }
757
+ setOptions(e) {
758
+ this.options = {
759
+ ...this.defaultOptions,
760
+ ...e
761
+ }, this.updateCacheTime(this.options.cacheTime);
762
+ }
763
+ get meta() {
764
+ return this.options.meta;
765
+ }
766
+ setState(e) {
767
+ this.dispatch({
768
+ type: "setState",
769
+ state: e
770
+ });
771
+ }
772
+ addObserver(e) {
773
+ this.observers.includes(e) || (this.observers.push(e), this.clearGcTimeout(), this.mutationCache.notify({
774
+ type: "observerAdded",
775
+ mutation: this,
776
+ observer: e
777
+ }));
778
+ }
779
+ removeObserver(e) {
780
+ this.observers = this.observers.filter((s) => s !== e), this.scheduleGc(), this.mutationCache.notify({
781
+ type: "observerRemoved",
782
+ mutation: this,
783
+ observer: e
784
+ });
785
+ }
786
+ optionalRemove() {
787
+ this.observers.length || (this.state.status === "loading" ? this.scheduleGc() : this.mutationCache.remove(this));
788
+ }
789
+ continue() {
790
+ var e, s;
791
+ return (e = (s = this.retryer) == null ? void 0 : s.continue()) != null ? e : this.execute();
792
+ }
793
+ async execute() {
794
+ const e = () => {
795
+ var w;
796
+ return this.retryer = Ve({
797
+ fn: () => this.options.mutationFn ? this.options.mutationFn(this.state.variables) : Promise.reject("No mutationFn found"),
798
+ onFail: (b, F) => {
799
+ this.dispatch({
800
+ type: "failed",
801
+ failureCount: b,
802
+ error: F
803
+ });
804
+ },
805
+ onPause: () => {
806
+ this.dispatch({
807
+ type: "pause"
808
+ });
809
+ },
810
+ onContinue: () => {
811
+ this.dispatch({
812
+ type: "continue"
813
+ });
814
+ },
815
+ retry: (w = this.options.retry) != null ? w : 0,
816
+ retryDelay: this.options.retryDelay,
817
+ networkMode: this.options.networkMode
818
+ }), this.retryer.promise;
819
+ }, s = this.state.status === "loading";
820
+ try {
821
+ var r, i, o, a, u, l, h, d;
822
+ if (!s) {
823
+ var p, m, f, C;
824
+ this.dispatch({
825
+ type: "loading",
826
+ variables: this.options.variables
827
+ }), await ((p = (m = this.mutationCache.config).onMutate) == null ? void 0 : p.call(m, this.state.variables, this));
828
+ const b = await ((f = (C = this.options).onMutate) == null ? void 0 : f.call(C, this.state.variables));
829
+ b !== this.state.context && this.dispatch({
830
+ type: "loading",
831
+ context: b,
832
+ variables: this.state.variables
833
+ });
834
+ }
835
+ const w = await e();
836
+ return await ((r = (i = this.mutationCache.config).onSuccess) == null ? void 0 : r.call(i, w, this.state.variables, this.state.context, this)), await ((o = (a = this.options).onSuccess) == null ? void 0 : o.call(a, w, this.state.variables, this.state.context)), await ((u = (l = this.mutationCache.config).onSettled) == null ? void 0 : u.call(l, w, null, this.state.variables, this.state.context, this)), await ((h = (d = this.options).onSettled) == null ? void 0 : h.call(d, w, null, this.state.variables, this.state.context)), this.dispatch({
837
+ type: "success",
838
+ data: w
839
+ }), w;
840
+ } catch (w) {
841
+ try {
842
+ var g, v, y, _, j, O, N, R;
843
+ throw await ((g = (v = this.mutationCache.config).onError) == null ? void 0 : g.call(v, w, this.state.variables, this.state.context, this)), await ((y = (_ = this.options).onError) == null ? void 0 : y.call(_, w, this.state.variables, this.state.context)), await ((j = (O = this.mutationCache.config).onSettled) == null ? void 0 : j.call(O, void 0, w, this.state.variables, this.state.context, this)), await ((N = (R = this.options).onSettled) == null ? void 0 : N.call(R, void 0, w, this.state.variables, this.state.context)), w;
844
+ } finally {
845
+ this.dispatch({
846
+ type: "error",
847
+ error: w
848
+ });
849
+ }
850
+ }
851
+ }
852
+ dispatch(e) {
853
+ const s = (r) => {
854
+ switch (e.type) {
855
+ case "failed":
856
+ return {
857
+ ...r,
858
+ failureCount: e.failureCount,
859
+ failureReason: e.error
860
+ };
861
+ case "pause":
862
+ return {
863
+ ...r,
864
+ isPaused: !0
865
+ };
866
+ case "continue":
867
+ return {
868
+ ...r,
869
+ isPaused: !1
870
+ };
871
+ case "loading":
872
+ return {
873
+ ...r,
874
+ context: e.context,
875
+ data: void 0,
876
+ failureCount: 0,
877
+ failureReason: null,
878
+ error: null,
879
+ isPaused: !ue(this.options.networkMode),
880
+ status: "loading",
881
+ variables: e.variables
882
+ };
883
+ case "success":
884
+ return {
885
+ ...r,
886
+ data: e.data,
887
+ failureCount: 0,
888
+ failureReason: null,
889
+ error: null,
890
+ status: "success",
891
+ isPaused: !1
892
+ };
893
+ case "error":
894
+ return {
895
+ ...r,
896
+ data: void 0,
897
+ error: e.error,
898
+ failureCount: r.failureCount + 1,
899
+ failureReason: e.error,
900
+ isPaused: !1,
901
+ status: "error"
902
+ };
903
+ case "setState":
904
+ return {
905
+ ...r,
906
+ ...e.state
907
+ };
908
+ }
909
+ };
910
+ this.state = s(this.state), P.batch(() => {
911
+ this.observers.forEach((r) => {
912
+ r.onMutationUpdate(e);
913
+ }), this.mutationCache.notify({
914
+ mutation: this,
915
+ type: "updated",
916
+ action: e
917
+ });
918
+ });
919
+ }
920
+ }
921
+ function Ze() {
922
+ return {
923
+ context: void 0,
924
+ data: void 0,
925
+ error: null,
926
+ failureCount: 0,
927
+ failureReason: null,
928
+ isPaused: !1,
929
+ status: "idle",
930
+ variables: void 0
931
+ };
932
+ }
933
+ class It extends B {
934
+ constructor(e) {
935
+ super(), this.config = e || {}, this.mutations = [], this.mutationId = 0;
936
+ }
937
+ build(e, s, r) {
938
+ const i = new Dt({
939
+ mutationCache: this,
940
+ logger: e.getLogger(),
941
+ mutationId: ++this.mutationId,
942
+ options: e.defaultMutationOptions(s),
943
+ state: r,
944
+ defaultOptions: s.mutationKey ? e.getMutationDefaults(s.mutationKey) : void 0
945
+ });
946
+ return this.add(i), i;
947
+ }
948
+ add(e) {
949
+ this.mutations.push(e), this.notify({
950
+ type: "added",
951
+ mutation: e
952
+ });
953
+ }
954
+ remove(e) {
955
+ this.mutations = this.mutations.filter((s) => s !== e), this.notify({
956
+ type: "removed",
957
+ mutation: e
958
+ });
959
+ }
960
+ clear() {
961
+ P.batch(() => {
962
+ this.mutations.forEach((e) => {
963
+ this.remove(e);
964
+ });
965
+ });
966
+ }
967
+ getAll() {
968
+ return this.mutations;
969
+ }
970
+ find(e) {
971
+ return typeof e.exact > "u" && (e.exact = !0), this.mutations.find((s) => Oe(e, s));
972
+ }
973
+ findAll(e) {
974
+ return this.mutations.filter((s) => Oe(e, s));
975
+ }
976
+ notify(e) {
977
+ P.batch(() => {
978
+ this.listeners.forEach(({
979
+ listener: s
980
+ }) => {
981
+ s(e);
982
+ });
983
+ });
984
+ }
985
+ resumePausedMutations() {
986
+ var e;
987
+ return this.resuming = ((e = this.resuming) != null ? e : Promise.resolve()).then(() => {
988
+ const s = this.mutations.filter((r) => r.state.isPaused);
989
+ return P.batch(() => s.reduce((r, i) => r.then(() => i.continue().catch(k)), Promise.resolve()));
990
+ }).then(() => {
991
+ this.resuming = void 0;
992
+ }), this.resuming;
993
+ }
994
+ }
995
+ function Tt() {
996
+ return {
997
+ onFetch: (t) => {
998
+ t.fetchFn = () => {
999
+ var e, s, r, i, o, a;
1000
+ const u = (e = t.fetchOptions) == null || (s = e.meta) == null ? void 0 : s.refetchPage, l = (r = t.fetchOptions) == null || (i = r.meta) == null ? void 0 : i.fetchMore, h = l == null ? void 0 : l.pageParam, d = (l == null ? void 0 : l.direction) === "forward", p = (l == null ? void 0 : l.direction) === "backward", m = ((o = t.state.data) == null ? void 0 : o.pages) || [], f = ((a = t.state.data) == null ? void 0 : a.pageParams) || [];
1001
+ let C = f, g = !1;
1002
+ const v = (R) => {
1003
+ Object.defineProperty(R, "signal", {
1004
+ enumerable: !0,
1005
+ get: () => {
1006
+ var w;
1007
+ if ((w = t.signal) != null && w.aborted)
1008
+ g = !0;
1009
+ else {
1010
+ var b;
1011
+ (b = t.signal) == null || b.addEventListener("abort", () => {
1012
+ g = !0;
1013
+ });
1014
+ }
1015
+ return t.signal;
1016
+ }
1017
+ });
1018
+ }, y = t.options.queryFn || (() => Promise.reject("Missing queryFn for queryKey '" + t.options.queryHash + "'")), _ = (R, w, b, F) => (C = F ? [w, ...C] : [...C, w], F ? [b, ...R] : [...R, b]), j = (R, w, b, F) => {
1019
+ if (g)
1020
+ return Promise.reject("Cancelled");
1021
+ if (typeof b > "u" && !w && R.length)
1022
+ return Promise.resolve(R);
1023
+ const $ = {
1024
+ queryKey: t.queryKey,
1025
+ pageParam: b,
1026
+ meta: t.options.meta
1027
+ };
1028
+ v($);
1029
+ const le = y($);
1030
+ return Promise.resolve(le).then((jt) => _(R, b, jt, F));
1031
+ };
1032
+ let O;
1033
+ if (!m.length)
1034
+ O = j([]);
1035
+ else if (d) {
1036
+ const R = typeof h < "u", w = R ? h : Me(t.options, m);
1037
+ O = j(m, R, w);
1038
+ } else if (p) {
1039
+ const R = typeof h < "u", w = R ? h : Ut(t.options, m);
1040
+ O = j(m, R, w, !0);
1041
+ } else {
1042
+ C = [];
1043
+ const R = typeof t.options.getNextPageParam > "u";
1044
+ O = (u && m[0] ? u(m[0], 0, m) : !0) ? j([], R, f[0]) : Promise.resolve(_([], f[0], m[0]));
1045
+ for (let b = 1; b < m.length; b++)
1046
+ O = O.then((F) => {
1047
+ if (u && m[b] ? u(m[b], b, m) : !0) {
1048
+ const le = R ? f[b] : Me(t.options, F);
1049
+ return j(F, R, le);
1050
+ }
1051
+ return Promise.resolve(_(F, f[b], m[b]));
1052
+ });
1053
+ }
1054
+ return O.then((R) => ({
1055
+ pages: R,
1056
+ pageParams: C
1057
+ }));
1058
+ };
1059
+ }
1060
+ };
1061
+ }
1062
+ function Me(t, e) {
1063
+ return t.getNextPageParam == null ? void 0 : t.getNextPageParam(e[e.length - 1], e);
1064
+ }
1065
+ function Ut(t, e) {
1066
+ return t.getPreviousPageParam == null ? void 0 : t.getPreviousPageParam(e[0], e);
1067
+ }
1068
+ class We {
1069
+ constructor(e = {}) {
1070
+ this.queryCache = e.queryCache || new Lt(), this.mutationCache = e.mutationCache || new It(), this.logger = e.logger || ge, this.defaultOptions = e.defaultOptions || {}, this.queryDefaults = [], this.mutationDefaults = [], this.mountCount = 0;
1071
+ }
1072
+ mount() {
1073
+ this.mountCount++, this.mountCount === 1 && (this.unsubscribeFocus = re.subscribe(() => {
1074
+ re.isFocused() && (this.resumePausedMutations(), this.queryCache.onFocus());
1075
+ }), this.unsubscribeOnline = ne.subscribe(() => {
1076
+ ne.isOnline() && (this.resumePausedMutations(), this.queryCache.onOnline());
1077
+ }));
1078
+ }
1079
+ unmount() {
1080
+ var e, s;
1081
+ this.mountCount--, this.mountCount === 0 && ((e = this.unsubscribeFocus) == null || e.call(this), this.unsubscribeFocus = void 0, (s = this.unsubscribeOnline) == null || s.call(this), this.unsubscribeOnline = void 0);
1082
+ }
1083
+ isFetching(e, s) {
1084
+ const [r] = I(e, s);
1085
+ return r.fetchStatus = "fetching", this.queryCache.findAll(r).length;
1086
+ }
1087
+ isMutating(e) {
1088
+ return this.mutationCache.findAll({
1089
+ ...e,
1090
+ fetching: !0
1091
+ }).length;
1092
+ }
1093
+ getQueryData(e, s) {
1094
+ var r;
1095
+ return (r = this.queryCache.find(e, s)) == null ? void 0 : r.state.data;
1096
+ }
1097
+ ensureQueryData(e, s, r) {
1098
+ const i = W(e, s, r), o = this.getQueryData(i.queryKey);
1099
+ return o ? Promise.resolve(o) : this.fetchQuery(i);
1100
+ }
1101
+ getQueriesData(e) {
1102
+ return this.getQueryCache().findAll(e).map(({
1103
+ queryKey: s,
1104
+ state: r
1105
+ }) => {
1106
+ const i = r.data;
1107
+ return [s, i];
1108
+ });
1109
+ }
1110
+ setQueryData(e, s, r) {
1111
+ const i = this.queryCache.find(e), o = i == null ? void 0 : i.state.data, a = Et(s, o);
1112
+ if (typeof a > "u")
1113
+ return;
1114
+ const u = W(e), l = this.defaultQueryOptions(u);
1115
+ return this.queryCache.build(this, l).setData(a, {
1116
+ ...r,
1117
+ manual: !0
1118
+ });
1119
+ }
1120
+ setQueriesData(e, s, r) {
1121
+ return P.batch(() => this.getQueryCache().findAll(e).map(({
1122
+ queryKey: i
1123
+ }) => [i, this.setQueryData(i, s, r)]));
1124
+ }
1125
+ getQueryState(e, s) {
1126
+ var r;
1127
+ return (r = this.queryCache.find(e, s)) == null ? void 0 : r.state;
1128
+ }
1129
+ removeQueries(e, s) {
1130
+ const [r] = I(e, s), i = this.queryCache;
1131
+ P.batch(() => {
1132
+ i.findAll(r).forEach((o) => {
1133
+ i.remove(o);
1134
+ });
1135
+ });
1136
+ }
1137
+ resetQueries(e, s, r) {
1138
+ const [i, o] = I(e, s, r), a = this.queryCache, u = {
1139
+ type: "active",
1140
+ ...i
1141
+ };
1142
+ return P.batch(() => (a.findAll(i).forEach((l) => {
1143
+ l.reset();
1144
+ }), this.refetchQueries(u, o)));
1145
+ }
1146
+ cancelQueries(e, s, r) {
1147
+ const [i, o = {}] = I(e, s, r);
1148
+ typeof o.revert > "u" && (o.revert = !0);
1149
+ const a = P.batch(() => this.queryCache.findAll(i).map((u) => u.cancel(o)));
1150
+ return Promise.all(a).then(k).catch(k);
1151
+ }
1152
+ invalidateQueries(e, s, r) {
1153
+ const [i, o] = I(e, s, r);
1154
+ return P.batch(() => {
1155
+ var a, u;
1156
+ if (this.queryCache.findAll(i).forEach((h) => {
1157
+ h.invalidate();
1158
+ }), i.refetchType === "none")
1159
+ return Promise.resolve();
1160
+ const l = {
1161
+ ...i,
1162
+ type: (a = (u = i.refetchType) != null ? u : i.type) != null ? a : "active"
1163
+ };
1164
+ return this.refetchQueries(l, o);
1165
+ });
1166
+ }
1167
+ refetchQueries(e, s, r) {
1168
+ const [i, o] = I(e, s, r), a = P.batch(() => this.queryCache.findAll(i).filter((l) => !l.isDisabled()).map((l) => {
1169
+ var h;
1170
+ return l.fetch(void 0, {
1171
+ ...o,
1172
+ cancelRefetch: (h = o == null ? void 0 : o.cancelRefetch) != null ? h : !0,
1173
+ meta: {
1174
+ refetchPage: i.refetchPage
1175
+ }
1176
+ });
1177
+ }));
1178
+ let u = Promise.all(a).then(k);
1179
+ return o != null && o.throwOnError || (u = u.catch(k)), u;
1180
+ }
1181
+ fetchQuery(e, s, r) {
1182
+ const i = W(e, s, r), o = this.defaultQueryOptions(i);
1183
+ typeof o.retry > "u" && (o.retry = !1);
1184
+ const a = this.queryCache.build(this, o);
1185
+ return a.isStaleByTime(o.staleTime) ? a.fetch(o) : Promise.resolve(a.state.data);
1186
+ }
1187
+ prefetchQuery(e, s, r) {
1188
+ return this.fetchQuery(e, s, r).then(k).catch(k);
1189
+ }
1190
+ fetchInfiniteQuery(e, s, r) {
1191
+ const i = W(e, s, r);
1192
+ return i.behavior = Tt(), this.fetchQuery(i);
1193
+ }
1194
+ prefetchInfiniteQuery(e, s, r) {
1195
+ return this.fetchInfiniteQuery(e, s, r).then(k).catch(k);
1196
+ }
1197
+ resumePausedMutations() {
1198
+ return this.mutationCache.resumePausedMutations();
1199
+ }
1200
+ getQueryCache() {
1201
+ return this.queryCache;
1202
+ }
1203
+ getMutationCache() {
1204
+ return this.mutationCache;
1205
+ }
1206
+ getLogger() {
1207
+ return this.logger;
1208
+ }
1209
+ getDefaultOptions() {
1210
+ return this.defaultOptions;
1211
+ }
1212
+ setDefaultOptions(e) {
1213
+ this.defaultOptions = e;
1214
+ }
1215
+ setQueryDefaults(e, s) {
1216
+ const r = this.queryDefaults.find((i) => T(e) === T(i.queryKey));
1217
+ r ? r.defaultOptions = s : this.queryDefaults.push({
1218
+ queryKey: e,
1219
+ defaultOptions: s
1220
+ });
1221
+ }
1222
+ getQueryDefaults(e) {
1223
+ if (!e)
1224
+ return;
1225
+ const s = this.queryDefaults.find((r) => se(e, r.queryKey));
1226
+ return s == null ? void 0 : s.defaultOptions;
1227
+ }
1228
+ setMutationDefaults(e, s) {
1229
+ const r = this.mutationDefaults.find((i) => T(e) === T(i.mutationKey));
1230
+ r ? r.defaultOptions = s : this.mutationDefaults.push({
1231
+ mutationKey: e,
1232
+ defaultOptions: s
1233
+ });
1234
+ }
1235
+ getMutationDefaults(e) {
1236
+ if (!e)
1237
+ return;
1238
+ const s = this.mutationDefaults.find((r) => se(e, r.mutationKey));
1239
+ return s == null ? void 0 : s.defaultOptions;
1240
+ }
1241
+ defaultQueryOptions(e) {
1242
+ if (e != null && e._defaulted)
1243
+ return e;
1244
+ const s = {
1245
+ ...this.defaultOptions.queries,
1246
+ ...this.getQueryDefaults(e == null ? void 0 : e.queryKey),
1247
+ ...e,
1248
+ _defaulted: !0
1249
+ };
1250
+ return !s.queryHash && s.queryKey && (s.queryHash = be(s.queryKey, s)), typeof s.refetchOnReconnect > "u" && (s.refetchOnReconnect = s.networkMode !== "always"), typeof s.useErrorBoundary > "u" && (s.useErrorBoundary = !!s.suspense), s;
1251
+ }
1252
+ defaultMutationOptions(e) {
1253
+ return e != null && e._defaulted ? e : {
1254
+ ...this.defaultOptions.mutations,
1255
+ ...this.getMutationDefaults(e == null ? void 0 : e.mutationKey),
1256
+ ...e,
1257
+ _defaulted: !0
1258
+ };
1259
+ }
1260
+ clear() {
1261
+ this.queryCache.clear(), this.mutationCache.clear();
1262
+ }
1263
+ }
1264
+ class Qt extends B {
1265
+ constructor(e, s) {
1266
+ super(), this.client = e, this.options = s, this.trackedProps = /* @__PURE__ */ new Set(), this.selectError = null, this.bindMethods(), this.setOptions(s);
1267
+ }
1268
+ bindMethods() {
1269
+ this.remove = this.remove.bind(this), this.refetch = this.refetch.bind(this);
1270
+ }
1271
+ onSubscribe() {
1272
+ this.listeners.size === 1 && (this.currentQuery.addObserver(this), Fe(this.currentQuery, this.options) && this.executeFetch(), this.updateTimers());
1273
+ }
1274
+ onUnsubscribe() {
1275
+ this.hasListeners() || this.destroy();
1276
+ }
1277
+ shouldFetchOnReconnect() {
1278
+ return ve(this.currentQuery, this.options, this.options.refetchOnReconnect);
1279
+ }
1280
+ shouldFetchOnWindowFocus() {
1281
+ return ve(this.currentQuery, this.options, this.options.refetchOnWindowFocus);
1282
+ }
1283
+ destroy() {
1284
+ this.listeners = /* @__PURE__ */ new Set(), this.clearStaleTimeout(), this.clearRefetchInterval(), this.currentQuery.removeObserver(this);
1285
+ }
1286
+ setOptions(e, s) {
1287
+ const r = this.options, i = this.currentQuery;
1288
+ if (this.options = this.client.defaultQueryOptions(e), he(r, this.options) || this.client.getQueryCache().notify({
1289
+ type: "observerOptionsUpdated",
1290
+ query: this.currentQuery,
1291
+ observer: this
1292
+ }), typeof this.options.enabled < "u" && typeof this.options.enabled != "boolean")
1293
+ throw new Error("Expected enabled to be a boolean");
1294
+ this.options.queryKey || (this.options.queryKey = r.queryKey), this.updateQuery();
1295
+ const o = this.hasListeners();
1296
+ o && ke(this.currentQuery, i, this.options, r) && this.executeFetch(), this.updateResult(s), o && (this.currentQuery !== i || this.options.enabled !== r.enabled || this.options.staleTime !== r.staleTime) && this.updateStaleTimeout();
1297
+ const a = this.computeRefetchInterval();
1298
+ o && (this.currentQuery !== i || this.options.enabled !== r.enabled || a !== this.currentRefetchInterval) && this.updateRefetchInterval(a);
1299
+ }
1300
+ getOptimisticResult(e) {
1301
+ const s = this.client.getQueryCache().build(this.client, e);
1302
+ return this.createResult(s, e);
1303
+ }
1304
+ getCurrentResult() {
1305
+ return this.currentResult;
1306
+ }
1307
+ trackResult(e) {
1308
+ const s = {};
1309
+ return Object.keys(e).forEach((r) => {
1310
+ Object.defineProperty(s, r, {
1311
+ configurable: !1,
1312
+ enumerable: !0,
1313
+ get: () => (this.trackedProps.add(r), e[r])
1314
+ });
1315
+ }), s;
1316
+ }
1317
+ getCurrentQuery() {
1318
+ return this.currentQuery;
1319
+ }
1320
+ remove() {
1321
+ this.client.getQueryCache().remove(this.currentQuery);
1322
+ }
1323
+ refetch({
1324
+ refetchPage: e,
1325
+ ...s
1326
+ } = {}) {
1327
+ return this.fetch({
1328
+ ...s,
1329
+ meta: {
1330
+ refetchPage: e
1331
+ }
1332
+ });
1333
+ }
1334
+ fetchOptimistic(e) {
1335
+ const s = this.client.defaultQueryOptions(e), r = this.client.getQueryCache().build(this.client, s);
1336
+ return r.isFetchingOptimistic = !0, r.fetch().then(() => this.createResult(r, s));
1337
+ }
1338
+ fetch(e) {
1339
+ var s;
1340
+ return this.executeFetch({
1341
+ ...e,
1342
+ cancelRefetch: (s = e.cancelRefetch) != null ? s : !0
1343
+ }).then(() => (this.updateResult(), this.currentResult));
1344
+ }
1345
+ executeFetch(e) {
1346
+ this.updateQuery();
1347
+ let s = this.currentQuery.fetch(this.options, e);
1348
+ return e != null && e.throwOnError || (s = s.catch(k)), s;
1349
+ }
1350
+ updateStaleTimeout() {
1351
+ if (this.clearStaleTimeout(), Y || this.currentResult.isStale || !de(this.options.staleTime))
1352
+ return;
1353
+ const s = qe(this.currentResult.dataUpdatedAt, this.options.staleTime) + 1;
1354
+ this.staleTimeoutId = setTimeout(() => {
1355
+ this.currentResult.isStale || this.updateResult();
1356
+ }, s);
1357
+ }
1358
+ computeRefetchInterval() {
1359
+ var e;
1360
+ return typeof this.options.refetchInterval == "function" ? this.options.refetchInterval(this.currentResult.data, this.currentQuery) : (e = this.options.refetchInterval) != null ? e : !1;
1361
+ }
1362
+ updateRefetchInterval(e) {
1363
+ this.clearRefetchInterval(), this.currentRefetchInterval = e, !(Y || this.options.enabled === !1 || !de(this.currentRefetchInterval) || this.currentRefetchInterval === 0) && (this.refetchIntervalId = setInterval(() => {
1364
+ (this.options.refetchIntervalInBackground || re.isFocused()) && this.executeFetch();
1365
+ }, this.currentRefetchInterval));
1366
+ }
1367
+ updateTimers() {
1368
+ this.updateStaleTimeout(), this.updateRefetchInterval(this.computeRefetchInterval());
1369
+ }
1370
+ clearStaleTimeout() {
1371
+ this.staleTimeoutId && (clearTimeout(this.staleTimeoutId), this.staleTimeoutId = void 0);
1372
+ }
1373
+ clearRefetchInterval() {
1374
+ this.refetchIntervalId && (clearInterval(this.refetchIntervalId), this.refetchIntervalId = void 0);
1375
+ }
1376
+ createResult(e, s) {
1377
+ const r = this.currentQuery, i = this.options, o = this.currentResult, a = this.currentResultState, u = this.currentResultOptions, l = e !== r, h = l ? e.state : this.currentQueryInitialState, d = l ? this.currentResult : this.previousQueryResult, {
1378
+ state: p
1379
+ } = e;
1380
+ let {
1381
+ dataUpdatedAt: m,
1382
+ error: f,
1383
+ errorUpdatedAt: C,
1384
+ fetchStatus: g,
1385
+ status: v
1386
+ } = p, y = !1, _ = !1, j;
1387
+ if (s._optimisticResults) {
1388
+ const b = this.hasListeners(), F = !b && Fe(e, s), $ = b && ke(e, r, s, i);
1389
+ (F || $) && (g = ue(e.options.networkMode) ? "fetching" : "paused", m || (v = "loading")), s._optimisticResults === "isRestoring" && (g = "idle");
1390
+ }
1391
+ if (s.keepPreviousData && !p.dataUpdatedAt && d != null && d.isSuccess && v !== "error")
1392
+ j = d.data, m = d.dataUpdatedAt, v = d.status, y = !0;
1393
+ else if (s.select && typeof p.data < "u")
1394
+ if (o && p.data === (a == null ? void 0 : a.data) && s.select === this.selectFn)
1395
+ j = this.selectResult;
1396
+ else
1397
+ try {
1398
+ this.selectFn = s.select, j = s.select(p.data), j = pe(o == null ? void 0 : o.data, j, s), this.selectResult = j, this.selectError = null;
1399
+ } catch (b) {
1400
+ this.selectError = b;
1401
+ }
1402
+ else
1403
+ j = p.data;
1404
+ if (typeof s.placeholderData < "u" && typeof j > "u" && v === "loading") {
1405
+ let b;
1406
+ if (o != null && o.isPlaceholderData && s.placeholderData === (u == null ? void 0 : u.placeholderData))
1407
+ b = o.data;
1408
+ else if (b = typeof s.placeholderData == "function" ? s.placeholderData() : s.placeholderData, s.select && typeof b < "u")
1409
+ try {
1410
+ b = s.select(b), this.selectError = null;
1411
+ } catch (F) {
1412
+ this.selectError = F;
1413
+ }
1414
+ typeof b < "u" && (v = "success", j = pe(o == null ? void 0 : o.data, b, s), _ = !0);
1415
+ }
1416
+ this.selectError && (f = this.selectError, j = this.selectResult, C = Date.now(), v = "error");
1417
+ const O = g === "fetching", N = v === "loading", R = v === "error";
1418
+ return {
1419
+ status: v,
1420
+ fetchStatus: g,
1421
+ isLoading: N,
1422
+ isSuccess: v === "success",
1423
+ isError: R,
1424
+ isInitialLoading: N && O,
1425
+ data: j,
1426
+ dataUpdatedAt: m,
1427
+ error: f,
1428
+ errorUpdatedAt: C,
1429
+ failureCount: p.fetchFailureCount,
1430
+ failureReason: p.fetchFailureReason,
1431
+ errorUpdateCount: p.errorUpdateCount,
1432
+ isFetched: p.dataUpdateCount > 0 || p.errorUpdateCount > 0,
1433
+ isFetchedAfterMount: p.dataUpdateCount > h.dataUpdateCount || p.errorUpdateCount > h.errorUpdateCount,
1434
+ isFetching: O,
1435
+ isRefetching: O && !N,
1436
+ isLoadingError: R && p.dataUpdatedAt === 0,
1437
+ isPaused: g === "paused",
1438
+ isPlaceholderData: _,
1439
+ isPreviousData: y,
1440
+ isRefetchError: R && p.dataUpdatedAt !== 0,
1441
+ isStale: je(e, s),
1442
+ refetch: this.refetch,
1443
+ remove: this.remove
1444
+ };
1445
+ }
1446
+ updateResult(e) {
1447
+ const s = this.currentResult, r = this.createResult(this.currentQuery, this.options);
1448
+ if (this.currentResultState = this.currentQuery.state, this.currentResultOptions = this.options, he(r, s))
1449
+ return;
1450
+ this.currentResult = r;
1451
+ const i = {
1452
+ cache: !0
1453
+ }, o = () => {
1454
+ if (!s)
1455
+ return !0;
1456
+ const {
1457
+ notifyOnChangeProps: a
1458
+ } = this.options;
1459
+ if (a === "all" || !a && !this.trackedProps.size)
1460
+ return !0;
1461
+ const u = new Set(a ?? this.trackedProps);
1462
+ return this.options.useErrorBoundary && u.add("error"), Object.keys(this.currentResult).some((l) => {
1463
+ const h = l;
1464
+ return this.currentResult[h] !== s[h] && u.has(h);
1465
+ });
1466
+ };
1467
+ (e == null ? void 0 : e.listeners) !== !1 && o() && (i.listeners = !0), this.notify({
1468
+ ...i,
1469
+ ...e
1470
+ });
1471
+ }
1472
+ updateQuery() {
1473
+ const e = this.client.getQueryCache().build(this.client, this.options);
1474
+ if (e === this.currentQuery)
1475
+ return;
1476
+ const s = this.currentQuery;
1477
+ this.currentQuery = e, this.currentQueryInitialState = e.state, this.previousQueryResult = this.currentResult, this.hasListeners() && (s == null || s.removeObserver(this), e.addObserver(this));
1478
+ }
1479
+ onQueryUpdate(e) {
1480
+ const s = {};
1481
+ e.type === "success" ? s.onSuccess = !e.manual : e.type === "error" && !te(e.error) && (s.onError = !0), this.updateResult(s), this.hasListeners() && this.updateTimers();
1482
+ }
1483
+ notify(e) {
1484
+ P.batch(() => {
1485
+ if (e.onSuccess) {
1486
+ var s, r, i, o;
1487
+ (s = (r = this.options).onSuccess) == null || s.call(r, this.currentResult.data), (i = (o = this.options).onSettled) == null || i.call(o, this.currentResult.data, null);
1488
+ } else if (e.onError) {
1489
+ var a, u, l, h;
1490
+ (a = (u = this.options).onError) == null || a.call(u, this.currentResult.error), (l = (h = this.options).onSettled) == null || l.call(h, void 0, this.currentResult.error);
1491
+ }
1492
+ e.listeners && this.listeners.forEach(({
1493
+ listener: d
1494
+ }) => {
1495
+ d(this.currentResult);
1496
+ }), e.cache && this.client.getQueryCache().notify({
1497
+ query: this.currentQuery,
1498
+ type: "observerResultsUpdated"
1499
+ });
1500
+ });
1501
+ }
1502
+ }
1503
+ function qt(t, e) {
1504
+ return e.enabled !== !1 && !t.state.dataUpdatedAt && !(t.state.status === "error" && e.retryOnMount === !1);
1505
+ }
1506
+ function Fe(t, e) {
1507
+ return qt(t, e) || t.state.dataUpdatedAt > 0 && ve(t, e, e.refetchOnMount);
1508
+ }
1509
+ function ve(t, e, s) {
1510
+ if (e.enabled !== !1) {
1511
+ const r = typeof s == "function" ? s(t) : s;
1512
+ return r === "always" || r !== !1 && je(t, e);
1513
+ }
1514
+ return !1;
1515
+ }
1516
+ function ke(t, e, s, r) {
1517
+ return s.enabled !== !1 && (t !== e || r.enabled === !1) && (!s.suspense || t.state.status !== "error") && je(t, s);
1518
+ }
1519
+ function je(t, e) {
1520
+ return t.isStaleByTime(e.staleTime);
1521
+ }
1522
+ class Bt extends B {
1523
+ constructor(e, s) {
1524
+ super(), this.client = e, this.setOptions(s), this.bindMethods(), this.updateResult();
1525
+ }
1526
+ bindMethods() {
1527
+ this.mutate = this.mutate.bind(this), this.reset = this.reset.bind(this);
1528
+ }
1529
+ setOptions(e) {
1530
+ var s;
1531
+ const r = this.options;
1532
+ this.options = this.client.defaultMutationOptions(e), he(r, this.options) || this.client.getMutationCache().notify({
1533
+ type: "observerOptionsUpdated",
1534
+ mutation: this.currentMutation,
1535
+ observer: this
1536
+ }), (s = this.currentMutation) == null || s.setOptions(this.options);
1537
+ }
1538
+ onUnsubscribe() {
1539
+ if (!this.hasListeners()) {
1540
+ var e;
1541
+ (e = this.currentMutation) == null || e.removeObserver(this);
1542
+ }
1543
+ }
1544
+ onMutationUpdate(e) {
1545
+ this.updateResult();
1546
+ const s = {
1547
+ listeners: !0
1548
+ };
1549
+ e.type === "success" ? s.onSuccess = !0 : e.type === "error" && (s.onError = !0), this.notify(s);
1550
+ }
1551
+ getCurrentResult() {
1552
+ return this.currentResult;
1553
+ }
1554
+ reset() {
1555
+ this.currentMutation = void 0, this.updateResult(), this.notify({
1556
+ listeners: !0
1557
+ });
1558
+ }
1559
+ mutate(e, s) {
1560
+ return this.mutateOptions = s, this.currentMutation && this.currentMutation.removeObserver(this), this.currentMutation = this.client.getMutationCache().build(this.client, {
1561
+ ...this.options,
1562
+ variables: typeof e < "u" ? e : this.options.variables
1563
+ }), this.currentMutation.addObserver(this), this.currentMutation.execute();
1564
+ }
1565
+ updateResult() {
1566
+ const e = this.currentMutation ? this.currentMutation.state : Ze(), s = {
1567
+ ...e,
1568
+ isLoading: e.status === "loading",
1569
+ isSuccess: e.status === "success",
1570
+ isError: e.status === "error",
1571
+ isIdle: e.status === "idle",
1572
+ mutate: this.mutate,
1573
+ reset: this.reset
1574
+ };
1575
+ this.currentResult = s;
1576
+ }
1577
+ notify(e) {
1578
+ P.batch(() => {
1579
+ if (this.mutateOptions && this.hasListeners()) {
1580
+ if (e.onSuccess) {
1581
+ var s, r, i, o;
1582
+ (s = (r = this.mutateOptions).onSuccess) == null || s.call(r, this.currentResult.data, this.currentResult.variables, this.currentResult.context), (i = (o = this.mutateOptions).onSettled) == null || i.call(o, this.currentResult.data, null, this.currentResult.variables, this.currentResult.context);
1583
+ } else if (e.onError) {
1584
+ var a, u, l, h;
1585
+ (a = (u = this.mutateOptions).onError) == null || a.call(u, this.currentResult.error, this.currentResult.variables, this.currentResult.context), (l = (h = this.mutateOptions).onSettled) == null || l.call(h, void 0, this.currentResult.error, this.currentResult.variables, this.currentResult.context);
1586
+ }
1587
+ }
1588
+ e.listeners && this.listeners.forEach(({
1589
+ listener: d
1590
+ }) => {
1591
+ d(this.currentResult);
1592
+ });
1593
+ });
1594
+ }
1595
+ }
1596
+ var Ye = { exports: {} }, ze = {};
1597
+ /**
1598
+ * @license React
1599
+ * use-sync-external-store-shim.production.min.js
1600
+ *
1601
+ * Copyright (c) Facebook, Inc. and its affiliates.
1602
+ *
1603
+ * This source code is licensed under the MIT license found in the
1604
+ * LICENSE file in the root directory of this source tree.
1605
+ */
1606
+ var q = c;
1607
+ function Kt(t, e) {
1608
+ return t === e && (t !== 0 || 1 / t === 1 / e) || t !== t && e !== e;
1609
+ }
1610
+ var Ht = typeof Object.is == "function" ? Object.is : Kt, Gt = q.useState, Vt = q.useEffect, $t = q.useLayoutEffect, Zt = q.useDebugValue;
1611
+ function Wt(t, e) {
1612
+ var s = e(), r = Gt({ inst: { value: s, getSnapshot: e } }), i = r[0].inst, o = r[1];
1613
+ return $t(function() {
1614
+ i.value = s, i.getSnapshot = e, ce(i) && o({ inst: i });
1615
+ }, [t, s, e]), Vt(function() {
1616
+ return ce(i) && o({ inst: i }), t(function() {
1617
+ ce(i) && o({ inst: i });
1618
+ });
1619
+ }, [t]), Zt(s), s;
1620
+ }
1621
+ function ce(t) {
1622
+ var e = t.getSnapshot;
1623
+ t = t.value;
1624
+ try {
1625
+ var s = e();
1626
+ return !Ht(t, s);
1627
+ } catch {
1628
+ return !0;
1629
+ }
1630
+ }
1631
+ function Yt(t, e) {
1632
+ return e();
1633
+ }
1634
+ var zt = typeof window > "u" || typeof window.document > "u" || typeof window.document.createElement > "u" ? Yt : Wt;
1635
+ ze.useSyncExternalStore = q.useSyncExternalStore !== void 0 ? q.useSyncExternalStore : zt;
1636
+ Ye.exports = ze;
1637
+ var Jt = Ye.exports;
1638
+ const Je = Jt.useSyncExternalStore, Le = /* @__PURE__ */ c.createContext(void 0), Xe = /* @__PURE__ */ c.createContext(!1);
1639
+ function et(t, e) {
1640
+ return t || (e && typeof window < "u" ? (window.ReactQueryClientContext || (window.ReactQueryClientContext = Le), window.ReactQueryClientContext) : Le);
1641
+ }
1642
+ const tt = ({
1643
+ context: t
1644
+ } = {}) => {
1645
+ const e = c.useContext(et(t, c.useContext(Xe)));
1646
+ if (!e)
1647
+ throw new Error("No QueryClient set, use QueryClientProvider to set one");
1648
+ return e;
1649
+ }, Xt = ({
1650
+ client: t,
1651
+ children: e,
1652
+ context: s,
1653
+ contextSharing: r = !1
1654
+ }) => {
1655
+ c.useEffect(() => (t.mount(), () => {
1656
+ t.unmount();
1657
+ }), [t]);
1658
+ const i = et(s, r);
1659
+ return /* @__PURE__ */ c.createElement(Xe.Provider, {
1660
+ value: !s && r
1661
+ }, /* @__PURE__ */ c.createElement(i.Provider, {
1662
+ value: t
1663
+ }, e));
1664
+ }, st = /* @__PURE__ */ c.createContext(!1), es = () => c.useContext(st);
1665
+ st.Provider;
1666
+ function ts() {
1667
+ let t = !1;
1668
+ return {
1669
+ clearReset: () => {
1670
+ t = !1;
1671
+ },
1672
+ reset: () => {
1673
+ t = !0;
1674
+ },
1675
+ isReset: () => t
1676
+ };
1677
+ }
1678
+ const ss = /* @__PURE__ */ c.createContext(ts()), rs = () => c.useContext(ss);
1679
+ function rt(t, e) {
1680
+ return typeof t == "function" ? t(...e) : !!t;
1681
+ }
1682
+ const ns = (t, e) => {
1683
+ (t.suspense || t.useErrorBoundary) && (e.isReset() || (t.retryOnMount = !1));
1684
+ }, is = (t) => {
1685
+ c.useEffect(() => {
1686
+ t.clearReset();
1687
+ }, [t]);
1688
+ }, os = ({
1689
+ result: t,
1690
+ errorResetBoundary: e,
1691
+ useErrorBoundary: s,
1692
+ query: r
1693
+ }) => t.isError && !e.isReset() && !t.isFetching && rt(s, [t.error, r]), as = (t) => {
1694
+ t.suspense && typeof t.staleTime != "number" && (t.staleTime = 1e3);
1695
+ }, us = (t, e) => t.isLoading && t.isFetching && !e, ls = (t, e, s) => (t == null ? void 0 : t.suspense) && us(e, s), cs = (t, e, s) => e.fetchOptimistic(t).then(({
1696
+ data: r
1697
+ }) => {
1698
+ t.onSuccess == null || t.onSuccess(r), t.onSettled == null || t.onSettled(r, null);
1699
+ }).catch((r) => {
1700
+ s.clearReset(), t.onError == null || t.onError(r), t.onSettled == null || t.onSettled(void 0, r);
1701
+ });
1702
+ function ds(t, e) {
1703
+ const s = tt({
1704
+ context: t.context
1705
+ }), r = es(), i = rs(), o = s.defaultQueryOptions(t);
1706
+ o._optimisticResults = r ? "isRestoring" : "optimistic", o.onError && (o.onError = P.batchCalls(o.onError)), o.onSuccess && (o.onSuccess = P.batchCalls(o.onSuccess)), o.onSettled && (o.onSettled = P.batchCalls(o.onSettled)), as(o), ns(o, i), is(i);
1707
+ const [a] = c.useState(() => new e(s, o)), u = a.getOptimisticResult(o);
1708
+ if (Je(c.useCallback((l) => {
1709
+ const h = r ? () => {
1710
+ } : a.subscribe(P.batchCalls(l));
1711
+ return a.updateResult(), h;
1712
+ }, [a, r]), () => a.getCurrentResult(), () => a.getCurrentResult()), c.useEffect(() => {
1713
+ a.setOptions(o, {
1714
+ listeners: !1
1715
+ });
1716
+ }, [o, a]), ls(o, u, r))
1717
+ throw cs(o, a, i);
1718
+ if (os({
1719
+ result: u,
1720
+ errorResetBoundary: i,
1721
+ useErrorBoundary: o.useErrorBoundary,
1722
+ query: a.getCurrentQuery()
1723
+ }))
1724
+ throw u.error;
1725
+ return o.notifyOnChangeProps ? u : a.trackResult(u);
1726
+ }
1727
+ function nt(t, e, s) {
1728
+ const r = W(t, e, s);
1729
+ return ds(r, Qt);
1730
+ }
1731
+ function hs(t, e, s) {
1732
+ const r = Ot(t, e, s), i = tt({
1733
+ context: r.context
1734
+ }), [o] = c.useState(() => new Bt(i, r));
1735
+ c.useEffect(() => {
1736
+ o.setOptions(r);
1737
+ }, [o, r]);
1738
+ const a = Je(c.useCallback((l) => o.subscribe(P.batchCalls(l)), [o]), () => o.getCurrentResult(), () => o.getCurrentResult()), u = c.useCallback((l, h) => {
1739
+ o.mutate(l, h).catch(fs);
1740
+ }, [o]);
1741
+ if (a.error && rt(o.options.useErrorBoundary, [a.error]))
1742
+ throw a.error;
1743
+ return {
1744
+ ...a,
1745
+ mutate: u,
1746
+ mutateAsync: a.mutate
1747
+ };
1748
+ }
1749
+ function fs() {
1750
+ }
1751
+ function it(t) {
1752
+ var e, s, r = "";
1753
+ if (typeof t == "string" || typeof t == "number")
1754
+ r += t;
1755
+ else if (typeof t == "object")
1756
+ if (Array.isArray(t))
1757
+ for (e = 0; e < t.length; e++)
1758
+ t[e] && (s = it(t[e])) && (r && (r += " "), r += s);
1759
+ else
1760
+ for (e in t)
1761
+ t[e] && (r && (r += " "), r += e);
1762
+ return r;
1763
+ }
1764
+ function S() {
1765
+ for (var t, e, s = 0, r = ""; s < arguments.length; )
1766
+ (t = arguments[s++]) && (e = it(t)) && (r && (r += " "), r += e);
1767
+ return r;
1768
+ }
1769
+ var ps = Object.defineProperty, vs = Object.defineProperties, ms = Object.getOwnPropertyDescriptors, ie = Object.getOwnPropertySymbols, ot = Object.prototype.hasOwnProperty, at = Object.prototype.propertyIsEnumerable, De = (t, e, s) => e in t ? ps(t, e, { enumerable: !0, configurable: !0, writable: !0, value: s }) : t[e] = s, x = (t, e) => {
1770
+ for (var s in e || (e = {}))
1771
+ ot.call(e, s) && De(t, s, e[s]);
1772
+ if (ie)
1773
+ for (var s of ie(e))
1774
+ at.call(e, s) && De(t, s, e[s]);
1775
+ return t;
1776
+ }, E = (t, e) => vs(t, ms(e)), A = (t, e) => {
1777
+ var s = {};
1778
+ for (var r in t)
1779
+ ot.call(t, r) && e.indexOf(r) < 0 && (s[r] = t[r]);
1780
+ if (t != null && ie)
1781
+ for (var r of ie(t))
1782
+ e.indexOf(r) < 0 && at.call(t, r) && (s[r] = t[r]);
1783
+ return s;
1784
+ };
1785
+ function oe() {
1786
+ return oe = Object.assign ? Object.assign.bind() : function(t) {
1787
+ for (var e = 1; e < arguments.length; e++) {
1788
+ var s = arguments[e];
1789
+ for (var r in s)
1790
+ Object.prototype.hasOwnProperty.call(s, r) && (t[r] = s[r]);
1791
+ }
1792
+ return t;
1793
+ }, oe.apply(this, arguments);
1794
+ }
1795
+ function ys(t, e) {
1796
+ typeof t == "function" ? t(e) : t != null && (t.current = e);
1797
+ }
1798
+ function Cs(...t) {
1799
+ return (e) => t.forEach(
1800
+ (s) => ys(s, e)
1801
+ );
1802
+ }
1803
+ var xs = /* @__PURE__ */ c.forwardRef((t, e) => {
1804
+ const s = t, { children: r } = s, i = A(s, ["children"]), o = c.Children.toArray(r), a = o.find(gs);
1805
+ if (a) {
1806
+ const u = a.props.children, l = o.map((h) => h === a ? c.Children.count(u) > 1 ? c.Children.only(null) : /* @__PURE__ */ c.isValidElement(u) ? u.props.children : null : h);
1807
+ return /* @__PURE__ */ c.createElement(me, oe({}, i, {
1808
+ ref: e
1809
+ }), /* @__PURE__ */ c.isValidElement(u) ? /* @__PURE__ */ c.cloneElement(u, void 0, l) : null);
1810
+ }
1811
+ return /* @__PURE__ */ c.createElement(me, oe({}, i, {
1812
+ ref: e
1813
+ }), r);
1814
+ });
1815
+ xs.displayName = "Slot";
1816
+ var me = /* @__PURE__ */ c.forwardRef((t, e) => {
1817
+ const s = t, { children: r } = s, i = A(s, ["children"]);
1818
+ return /* @__PURE__ */ c.isValidElement(r) ? /* @__PURE__ */ c.cloneElement(r, E(x({}, js(i, r.props)), {
1819
+ ref: e ? Cs(e, r.ref) : r.ref
1820
+ })) : c.Children.count(r) > 1 ? c.Children.only(null) : null;
1821
+ });
1822
+ me.displayName = "SlotClone";
1823
+ var bs = ({ children: t }) => /* @__PURE__ */ c.createElement(c.Fragment, null, t);
1824
+ function gs(t) {
1825
+ return /* @__PURE__ */ c.isValidElement(t) && t.type === bs;
1826
+ }
1827
+ function js(t, e) {
1828
+ const s = x({}, e);
1829
+ for (const r in e) {
1830
+ const i = t[r], o = e[r];
1831
+ /^on[A-Z]/.test(r) ? i && o ? s[r] = (...u) => {
1832
+ o(...u), i(...u);
1833
+ } : i && (s[r] = i) : r === "style" ? s[r] = x(x({}, i), o) : r === "className" && (s[r] = [
1834
+ i,
1835
+ o
1836
+ ].filter(Boolean).join(" "));
1837
+ }
1838
+ return x(x({}, t), s);
1839
+ }
1840
+ var ws = ({ firstName: t, lastName: e, variant: s = "small" }) => {
1841
+ const r = `${t.charAt(0)}${e.charAt(0)}`;
1842
+ return /* @__PURE__ */ n.jsx(
1843
+ "span",
1844
+ {
1845
+ className: `avatar avatar--${s}`,
1846
+ "aria-label": `${t} ${e}`,
1847
+ role: "img",
1848
+ children: /* @__PURE__ */ n.jsx("span", { className: "avatar__initials", children: r })
1849
+ }
1850
+ );
1851
+ }, K = c.forwardRef(
1852
+ (t, e) => {
1853
+ var s = t, {
1854
+ iconLeft: r,
1855
+ iconRight: i,
1856
+ isPending: o = !1,
1857
+ isFilled: a = !1,
1858
+ variant: u,
1859
+ className: l,
1860
+ children: h
1861
+ } = s, d = A(s, [
1862
+ "iconLeft",
1863
+ "iconRight",
1864
+ "isPending",
1865
+ "isFilled",
1866
+ "variant",
1867
+ "className",
1868
+ "children"
1869
+ ]);
1870
+ const p = !!r || !!i;
1871
+ return /* @__PURE__ */ n.jsxs(
1872
+ "button",
1873
+ E(x({
1874
+ ref: e
1875
+ }, d), {
1876
+ className: S(
1877
+ "button",
1878
+ u && `button--${u}`,
1879
+ u && a && `button--${u}--filled`,
1880
+ p && "button--with-icon",
1881
+ o && "button--pending",
1882
+ l
1883
+ ),
1884
+ children: [
1885
+ r && /* @__PURE__ */ n.jsx("div", { className: "button__icon", children: r }),
1886
+ !!h && /* @__PURE__ */ n.jsx("span", { className: "button__label", children: h }),
1887
+ i && /* @__PURE__ */ n.jsx("div", { className: "button__icon button__icon-right", children: i })
1888
+ ]
1889
+ })
1890
+ );
1891
+ }
1892
+ );
1893
+ K.displayName = "Button";
1894
+ c.createContext(void 0);
1895
+ var _s = c.forwardRef(
1896
+ (t, e) => {
1897
+ var s = t, { prefix: r, suffix: i, className: o } = s, a = A(s, ["prefix", "suffix", "className"]);
1898
+ return /* @__PURE__ */ n.jsxs("div", { className: "input__wrapper", children: [
1899
+ r && /* @__PURE__ */ n.jsx("span", { className: "input__prefix", children: r }),
1900
+ /* @__PURE__ */ n.jsx(
1901
+ "input",
1902
+ x({
1903
+ ref: e,
1904
+ className: S(
1905
+ "input",
1906
+ r && "input--with-prefix",
1907
+ i && "input--with-suffix",
1908
+ o
1909
+ )
1910
+ }, a)
1911
+ ),
1912
+ i && /* @__PURE__ */ n.jsx("span", { className: "input__suffix", children: i })
1913
+ ] });
1914
+ }
1915
+ );
1916
+ _s.displayName = "TextField";
1917
+ c.createContext(void 0);
1918
+ var Rs = ({ children: t }) => /* @__PURE__ */ n.jsx("div", { className: "card__header__action", children: t }), Es = ({ children: t }) => /* @__PURE__ */ n.jsx("div", { className: "card__body", children: t }), Os = (t) => /* @__PURE__ */ n.jsx(
1919
+ "svg",
1920
+ E(x({
1921
+ width: "24",
1922
+ height: "24",
1923
+ viewBox: "0 0 24 24",
1924
+ fill: "none",
1925
+ xmlns: "http://www.w3.org/2000/svg"
1926
+ }, t), {
1927
+ children: /* @__PURE__ */ n.jsx(
1928
+ "path",
1929
+ {
1930
+ d: "M8 10L12 14L16 10",
1931
+ stroke: "currentColor",
1932
+ strokeWidth: "1.5",
1933
+ strokeLinecap: "round",
1934
+ strokeLinejoin: "round"
1935
+ }
1936
+ )
1937
+ })
1938
+ ), we = Os, Ss = (t) => /* @__PURE__ */ n.jsx(
1939
+ "svg",
1940
+ E(x({
1941
+ width: "24",
1942
+ height: "24",
1943
+ viewBox: "0 0 24 24",
1944
+ fill: "none",
1945
+ xmlns: "http://www.w3.org/2000/svg"
1946
+ }, t), {
1947
+ children: /* @__PURE__ */ n.jsx(
1948
+ "path",
1949
+ {
1950
+ fillRule: "evenodd",
1951
+ clipRule: "evenodd",
1952
+ fill: "currentColor",
1953
+ d: "M5.53033 4.46967C5.23744 4.17678 4.76256 4.17678 4.46967 4.46967C4.17678 4.76256 4.17678 5.23744 4.46967 5.53033L10.9393 12L4.46967 18.4697C4.17678 18.7626 4.17678 19.2374 4.46967 19.5303C4.76256 19.8232 5.23744 19.8232 5.53033 19.5303L12 13.0607L18.4697 19.5303C18.7626 19.8232 19.2374 19.8232 19.5303 19.5303C19.8232 19.2374 19.8232 18.7626 19.5303 18.4697L13.0607 12L19.5303 5.53033C19.8232 5.23744 19.8232 4.76256 19.5303 4.46967C19.2374 4.17678 18.7626 4.17678 18.4697 4.46967L12 10.9393L5.53033 4.46967Z"
1954
+ }
1955
+ )
1956
+ })
1957
+ ), Ps = Ss, As = (t) => /* @__PURE__ */ n.jsx(
1958
+ "svg",
1959
+ E(x({
1960
+ width: "24",
1961
+ height: "24",
1962
+ viewBox: "0 0 24 24",
1963
+ fill: "none",
1964
+ xmlns: "http://www.w3.org/2000/svg"
1965
+ }, t), {
1966
+ children: /* @__PURE__ */ n.jsx(
1967
+ "path",
1968
+ {
1969
+ fillRule: "evenodd",
1970
+ clipRule: "evenodd",
1971
+ d: "M10.25 2.25C9.83579 2.25 9.5 2.58579 9.5 3C9.5 3.41421 9.83579 3.75 10.25 3.75H15.25C16.112 3.75 16.9386 4.09241 17.5481 4.7019C18.1576 5.3114 18.5 6.13805 18.5 7V17C18.5 17.862 18.1576 18.6886 17.5481 19.2981C16.9386 19.9076 16.112 20.25 15.25 20.25H10.25C9.83579 20.25 9.5 20.5858 9.5 21C9.5 21.4142 9.83579 21.75 10.25 21.75H15.25C16.5098 21.75 17.718 21.2496 18.6088 20.3588C19.4996 19.468 20 18.2598 20 17V7C20 5.74022 19.4996 4.53204 18.6088 3.64124C17.718 2.75044 16.5098 2.25 15.25 2.25H10.25ZM9.71967 9.53033C9.42678 9.23744 9.42678 8.76256 9.71967 8.46967C10.0126 8.17678 10.4874 8.17678 10.7803 8.46967L13.7803 11.4697C14.0732 11.7626 14.0732 12.2374 13.7803 12.5303L10.7803 15.5303C10.4874 15.8232 10.0126 15.8232 9.71967 15.5303C9.42678 15.2374 9.42678 14.7626 9.71967 14.4697L11.4393 12.75L4.25 12.75C3.83579 12.75 3.5 12.4142 3.5 12C3.5 11.5858 3.83579 11.25 4.25 11.25L11.4393 11.25L9.71967 9.53033Z",
1972
+ fill: "#323232"
1973
+ }
1974
+ )
1975
+ })
1976
+ ), Ns = As, Ms = (t) => /* @__PURE__ */ n.jsxs(
1977
+ "svg",
1978
+ E(x({
1979
+ width: "24",
1980
+ height: "24",
1981
+ viewBox: "0 0 24 24",
1982
+ fill: "none",
1983
+ xmlns: "http://www.w3.org/2000/svg"
1984
+ }, t), {
1985
+ children: [
1986
+ /* @__PURE__ */ n.jsx(
1987
+ "path",
1988
+ {
1989
+ d: "M14.4749 4.52513C15.8418 5.89197 15.8418 8.10804 14.4749 9.47488C13.1081 10.8417 10.892 10.8417 9.52516 9.47488C8.15832 8.10804 8.15832 5.89197 9.52516 4.52513C10.892 3.15829 13.1081 3.15829 14.4749 4.52513",
1990
+ stroke: "currentColor",
1991
+ strokeWidth: "1.5",
1992
+ strokeLinecap: "round",
1993
+ strokeLinejoin: "round"
1994
+ }
1995
+ ),
1996
+ /* @__PURE__ */ n.jsx(
1997
+ "path",
1998
+ {
1999
+ d: "M13.5 20.5H10H5C4.448 20.5 4 20.052 4 19.5V18.5C4 15.9788 6.7434 14.1935 10 13.6679C10.6521 13.5627 11.3247 13.508 12 13.508C13.0272 13.508 14.0482 13.6346 15 13.873",
2000
+ stroke: "currentColor",
2001
+ strokeWidth: "1.5",
2002
+ strokeLinecap: "round",
2003
+ strokeLinejoin: "round"
2004
+ }
2005
+ ),
2006
+ /* @__PURE__ */ n.jsx(
2007
+ "path",
2008
+ {
2009
+ d: "M17.5 16V18.0164V20",
2010
+ stroke: "currentColor",
2011
+ strokeWidth: "1.5",
2012
+ strokeLinecap: "round",
2013
+ strokeLinejoin: "round"
2014
+ }
2015
+ ),
2016
+ /* @__PURE__ */ n.jsx(
2017
+ "path",
2018
+ {
2019
+ d: "M19.5 18L17.4836 18L15.5 18",
2020
+ stroke: "currentColor",
2021
+ strokeWidth: "1.5",
2022
+ strokeLinecap: "round",
2023
+ strokeLinejoin: "round"
2024
+ }
2025
+ )
2026
+ ]
2027
+ })
2028
+ ), Fs = Ms, ks = (t) => /* @__PURE__ */ n.jsx(
2029
+ "svg",
2030
+ E(x({
2031
+ width: "24",
2032
+ height: "24",
2033
+ viewBox: "0 0 24 24",
2034
+ fill: "none",
2035
+ xmlns: "http://www.w3.org/2000/svg"
2036
+ }, t), {
2037
+ children: /* @__PURE__ */ n.jsx(
2038
+ "path",
2039
+ {
2040
+ fillRule: "evenodd",
2041
+ clipRule: "evenodd",
2042
+ d: "M13.25 2.25C13.6642 2.25 14 2.58579 14 3C14 3.41421 13.6642 3.75 13.25 3.75H8.25C7.38805 3.75 6.5614 4.09241 5.9519 4.7019C5.34241 5.3114 5 6.13805 5 7V17C5 17.862 5.34241 18.6886 5.9519 19.2981C6.5614 19.9076 7.38805 20.25 8.25 20.25H13.25C13.6642 20.25 14 20.5858 14 21C14 21.4142 13.6642 21.75 13.25 21.75H8.25C6.99022 21.75 5.78204 21.2496 4.89124 20.3588C4.00045 19.468 3.5 18.2598 3.5 17V7C3.5 5.74022 4.00045 4.53204 4.89124 3.64124C5.78204 2.75044 6.99022 2.25 8.25 2.25H13.25ZM15.7197 8.46967C16.0126 8.17678 16.4874 8.17678 16.7803 8.46967L19.7803 11.4697C20.0732 11.7626 20.0732 12.2374 19.7803 12.5303L16.7803 15.5303C16.4874 15.8232 16.0126 15.8232 15.7197 15.5303C15.4268 15.2374 15.4268 14.7626 15.7197 14.4697L17.4393 12.75L10.25 12.75C9.83579 12.75 9.5 12.4142 9.5 12C9.5 11.5858 9.83579 11.25 10.25 11.25L17.4393 11.25L15.7197 9.53033C15.4268 9.23744 15.4268 8.76256 15.7197 8.46967Z",
2043
+ fill: "currentColor"
2044
+ }
2045
+ )
2046
+ })
2047
+ ), Ls = ks, Ds = (t) => /* @__PURE__ */ n.jsxs(
2048
+ "svg",
2049
+ E(x({
2050
+ width: "24",
2051
+ height: "24",
2052
+ viewBox: "0 0 24 24",
2053
+ fill: "none",
2054
+ xmlns: "http://www.w3.org/2000/svg"
2055
+ }, t), {
2056
+ children: [
2057
+ /* @__PURE__ */ n.jsx(
2058
+ "path",
2059
+ {
2060
+ d: "M14.4749 4.52513C15.8418 5.89197 15.8418 8.10804 14.4749 9.47488C13.1081 10.8417 10.892 10.8417 9.52516 9.47488C8.15832 8.10804 8.15832 5.89197 9.52516 4.52513C10.892 3.15829 13.1081 3.15829 14.4749 4.52513",
2061
+ stroke: "currentColor",
2062
+ strokeWidth: "1.5",
2063
+ strokeLinecap: "round",
2064
+ strokeLinejoin: "round"
2065
+ }
2066
+ ),
2067
+ /* @__PURE__ */ n.jsx(
2068
+ "path",
2069
+ {
2070
+ d: "M4 18.5V19.5C4 20.052 4.448 20.5 5 20.5H19C19.552 20.5 20 20.052 20 19.5V18.5C20 15.474 16.048 13.508 12 13.508C7.952 13.508 4 15.474 4 18.5Z",
2071
+ stroke: "currentColor",
2072
+ strokeWidth: "1.5",
2073
+ strokeLinecap: "round",
2074
+ strokeLinejoin: "round"
2075
+ }
2076
+ )
2077
+ ]
2078
+ })
2079
+ ), Is = Ds, Ts = (t) => /* @__PURE__ */ n.jsx(
2080
+ "svg",
2081
+ E(x({
2082
+ width: "24",
2083
+ height: "24",
2084
+ viewBox: "0 0 24 24",
2085
+ fill: "none",
2086
+ xmlns: "http://www.w3.org/2000/svg"
2087
+ }, t), {
2088
+ children: /* @__PURE__ */ n.jsx(
2089
+ "path",
2090
+ {
2091
+ d: "M20 6.5L9 17.5L4 12.5",
2092
+ stroke: "currentColor",
2093
+ strokeWidth: "1.5",
2094
+ strokeLinecap: "round",
2095
+ strokeLinejoin: "round"
2096
+ }
2097
+ )
2098
+ })
2099
+ ), Us = Ts, Qs = (t) => /* @__PURE__ */ n.jsxs(
2100
+ "svg",
2101
+ E(x({
2102
+ width: "24",
2103
+ height: "24",
2104
+ fill: "none",
2105
+ viewBox: "0 0 24 24",
2106
+ xmlns: "http://www.w3.org/2000/svg"
2107
+ }, t), {
2108
+ children: [
2109
+ /* @__PURE__ */ n.jsxs("g", { clipPath: "url(#clip0_19_444)", children: [
2110
+ /* @__PURE__ */ n.jsx(
2111
+ "path",
2112
+ {
2113
+ d: "M17 21H7V21C5.89543 21 5 20.1046 5 19V12V12C5 10.8954 5.89543 10 7 10H17V10C18.1046 10 19 10.8954 19 12V19V19C19 20.1046 18.1046 21 17 21C17 21 17 21 17 21V21Z",
2114
+ stroke: "currentColor",
2115
+ strokeWidth: "1.5",
2116
+ strokeLinecap: "round",
2117
+ strokeLinejoin: "round"
2118
+ }
2119
+ ),
2120
+ /* @__PURE__ */ n.jsx("circle", { cx: "10.3", cy: "15.5", r: "0.8", fill: "currentColor" }),
2121
+ /* @__PURE__ */ n.jsx("circle", { cx: "13.7", cy: "15.5", r: "0.8", fill: "currentColor" }),
2122
+ /* @__PURE__ */ n.jsx(
2123
+ "path",
2124
+ {
2125
+ d: "M8 10V7V7C8 4.79086 9.79086 3 12 3V3C14.2091 3 16 4.79086 16 7V10",
2126
+ stroke: "currentColor",
2127
+ strokeWidth: "1.5",
2128
+ strokeLinecap: "round",
2129
+ strokeLinejoin: "round"
2130
+ }
2131
+ )
2132
+ ] }),
2133
+ /* @__PURE__ */ n.jsx("defs", { children: /* @__PURE__ */ n.jsx("clipPath", { id: "clip0_19_444", children: /* @__PURE__ */ n.jsx("rect", { width: "24", height: "24", fill: "white" }) }) })
2134
+ ]
2135
+ })
2136
+ ), qs = Qs, Bs = (t) => /* @__PURE__ */ n.jsxs(
2137
+ "svg",
2138
+ E(x({
2139
+ width: "24",
2140
+ height: "24",
2141
+ fill: "none",
2142
+ viewBox: "0 0 24 24",
2143
+ xmlns: "http://www.w3.org/2000/svg"
2144
+ }, t), {
2145
+ children: [
2146
+ /* @__PURE__ */ n.jsxs("g", { clipPath: "url(#clip0_762_2934)", children: [
2147
+ /* @__PURE__ */ n.jsx(
2148
+ "path",
2149
+ {
2150
+ fillRule: "evenodd",
2151
+ clipRule: "evenodd",
2152
+ d: "M12.75 8.39996C12.75 7.98575 12.4142 7.64996 12 7.64996C11.5858 7.64996 11.25 7.98575 11.25 8.39996V11.669C11.25 12.0832 11.5858 12.419 12 12.419C12.4142 12.419 12.75 12.0832 12.75 11.669V8.39996ZM12.005 16.35C12.5159 16.35 12.93 15.9359 12.93 15.425C12.93 14.9141 12.5159 14.5 12.005 14.5C11.4942 14.5 11.08 14.9141 11.08 15.425C11.08 15.9359 11.4942 16.35 12.005 16.35Z",
2153
+ fill: "currentColor"
2154
+ }
2155
+ ),
2156
+ /* @__PURE__ */ n.jsx(
2157
+ "path",
2158
+ {
2159
+ d: "M12 21C7.029 21 3 16.971 3 12C3 7.029 7.029 3 12 3C16.971 3 21 7.029 21 12C21 16.971 16.971 21 12 21Z",
2160
+ stroke: "currentColor",
2161
+ strokeWidth: "1.5",
2162
+ strokeLinecap: "round",
2163
+ strokeLinejoin: "round"
2164
+ }
2165
+ )
2166
+ ] }),
2167
+ /* @__PURE__ */ n.jsx("defs", { children: /* @__PURE__ */ n.jsx("clipPath", { id: "clip0_762_2934", children: /* @__PURE__ */ n.jsx("rect", { width: "24", height: "24", fill: "white" }) }) })
2168
+ ]
2169
+ })
2170
+ ), Ks = Bs, Hs = (t) => /* @__PURE__ */ n.jsxs(
2171
+ "svg",
2172
+ E(x({
2173
+ width: "20",
2174
+ height: "21",
2175
+ fill: "none",
2176
+ viewBox: "0 0 20 21",
2177
+ xmlns: "http://www.w3.org/2000/svg"
2178
+ }, t), {
2179
+ children: [
2180
+ /* @__PURE__ */ n.jsx("circle", { cx: "10", cy: "10.0996", r: "7.5", stroke: "#00ab9e", strokeWidth: "1.25" }),
2181
+ /* @__PURE__ */ n.jsx(
2182
+ "circle",
2183
+ {
2184
+ cx: "10",
2185
+ cy: "10.0996",
2186
+ r: "7.5",
2187
+ stroke: "white",
2188
+ strokeDasharray: "15 30",
2189
+ strokeWidth: "1.25"
2190
+ }
2191
+ )
2192
+ ]
2193
+ })
2194
+ ), Gs = Hs, Vs = (t) => {
2195
+ const e = (s) => `${s}${t.suffix ? `_${t.suffix}` : ""}`;
2196
+ return /* @__PURE__ */ n.jsxs(
2197
+ "svg",
2198
+ E(x({
2199
+ width: "24",
2200
+ height: "24",
2201
+ viewBox: "0 0 24 24",
2202
+ fill: "none",
2203
+ xmlns: "http://www.w3.org/2000/svg"
2204
+ }, t), {
2205
+ children: [
2206
+ /* @__PURE__ */ n.jsx(
2207
+ "path",
2208
+ {
2209
+ d: "M17.6214 11.1549C20.4161 8.33951 21.712 5.41047 20.6067 3.876C19.1586 1.85988 14.1278 2.98841 9.3766 6.39936C8.31103 7.15864 7.31229 8.00725 6.39122 8.93598L17.6214 11.1549Z",
2210
+ fill: e("url(#paint0")
2211
+ }
2212
+ ),
2213
+ /* @__PURE__ */ n.jsx(
2214
+ "path",
2215
+ {
2216
+ opacity: "0.9",
2217
+ d: "M17.6214 11.1548C17.1178 9.955 16.5189 8.79735 15.8301 7.693C12.6925 2.58286 8.41126 -0.498612 6.30132 0.794902C4.66377 1.79657 4.80319 5.119 6.39145 8.93562L17.6214 11.1548Z",
2218
+ fill: e("url(#paint1")
2219
+ }
2220
+ ),
2221
+ /* @__PURE__ */ n.jsx(
2222
+ "path",
2223
+ {
2224
+ d: "M6.39122 8.93591C6.89474 10.1357 7.49373 11.2934 8.18245 12.3977C11.3329 17.5079 15.6006 20.5894 17.7229 19.2958C19.3616 18.2942 19.221 14.9718 17.6339 11.1549L6.39122 8.93591Z",
2225
+ fill: e("url(#paint2")
2226
+ }
2227
+ ),
2228
+ /* @__PURE__ */ n.jsx(
2229
+ "path",
2230
+ {
2231
+ opacity: "0.85",
2232
+ d: "M6.39113 8.93591C3.5836 11.7637 2.28796 14.6927 3.39319 16.2272C4.8413 18.2433 9.87186 17.1147 14.6224 13.7038C15.6888 12.9404 16.6916 12.0922 17.6213 11.1677L6.39113 8.93591Z",
2233
+ fill: e("url(#paint3")
2234
+ }
2235
+ ),
2236
+ /* @__PURE__ */ n.jsx(
2237
+ "path",
2238
+ {
2239
+ opacity: "0.87",
2240
+ d: "M6.39113 8.93591C3.5836 11.7509 2.28796 14.6801 3.39319 16.2272C4.8413 18.2433 9.87186 17.1147 14.6224 13.7038C15.6888 12.9404 16.6916 12.0922 17.6213 11.1677L6.39113 8.93591Z",
2241
+ fill: e("url(#paint4")
2242
+ }
2243
+ ),
2244
+ /* @__PURE__ */ n.jsx(
2245
+ "path",
2246
+ {
2247
+ d: "M12.0064 23.2897C16.2652 23.2897 19.7177 22.9093 19.7177 22.4402C19.7177 21.971 16.2652 21.5907 12.0064 21.5907C7.74761 21.5907 4.29517 21.971 4.29517 22.4402C4.29517 22.9093 7.74761 23.2897 12.0064 23.2897Z",
2248
+ fill: e("url(#paint5")
2249
+ }
2250
+ ),
2251
+ /* @__PURE__ */ n.jsxs("defs", { children: [
2252
+ /* @__PURE__ */ n.jsxs(
2253
+ "linearGradient",
2254
+ {
2255
+ id: e("paint0"),
2256
+ x1: "10.6862",
2257
+ y1: "11.0225",
2258
+ x2: "14.9751",
2259
+ y2: "0.707188",
2260
+ gradientUnits: "userSpaceOnUse",
2261
+ children: [
2262
+ /* @__PURE__ */ n.jsx("stop", { offset: "0.413", stopColor: "#90B117" }),
2263
+ /* @__PURE__ */ n.jsx("stop", { offset: "0.501", stopColor: "#8BAF19" }),
2264
+ /* @__PURE__ */ n.jsx("stop", { offset: "0.601", stopColor: "#7DAB1E" }),
2265
+ /* @__PURE__ */ n.jsx("stop", { offset: "0.706", stopColor: "#67A325" }),
2266
+ /* @__PURE__ */ n.jsx("stop", { offset: "0.815", stopColor: "#479830" }),
2267
+ /* @__PURE__ */ n.jsx("stop", { offset: "0.925", stopColor: "#1F8A3E" }),
2268
+ /* @__PURE__ */ n.jsx("stop", { offset: "1", stopColor: "#007F48" })
2269
+ ]
2270
+ }
2271
+ ),
2272
+ /* @__PURE__ */ n.jsxs(
2273
+ "linearGradient",
2274
+ {
2275
+ id: e("paint1"),
2276
+ x1: "11.5281",
2277
+ y1: "8.85339",
2278
+ x2: "12.4519",
2279
+ y2: "1.60772",
2280
+ gradientUnits: "userSpaceOnUse",
2281
+ children: [
2282
+ /* @__PURE__ */ n.jsx("stop", { stopColor: "#36BCEE" }),
2283
+ /* @__PURE__ */ n.jsx("stop", { offset: "0.201", stopColor: "#31ACE3" }),
2284
+ /* @__PURE__ */ n.jsx("stop", { offset: "0.59", stopColor: "#2583C5" }),
2285
+ /* @__PURE__ */ n.jsx("stop", { offset: "1", stopColor: "#1652A1" })
2286
+ ]
2287
+ }
2288
+ ),
2289
+ /* @__PURE__ */ n.jsxs(
2290
+ "linearGradient",
2291
+ {
2292
+ id: e("paint2"),
2293
+ x1: "15.0651",
2294
+ y1: "18.7384",
2295
+ x2: "12.9747",
2296
+ y2: "8.0336",
2297
+ gradientUnits: "userSpaceOnUse",
2298
+ children: [
2299
+ /* @__PURE__ */ n.jsx("stop", { stopColor: "#E42313" }),
2300
+ /* @__PURE__ */ n.jsx("stop", { offset: "0.071", stopColor: "#E73611" }),
2301
+ /* @__PURE__ */ n.jsx("stop", { offset: "0.312", stopColor: "#F0710B" }),
2302
+ /* @__PURE__ */ n.jsx("stop", { offset: "0.534", stopColor: "#F6A006" }),
2303
+ /* @__PURE__ */ n.jsx("stop", { offset: "0.73", stopColor: "#FBC103" }),
2304
+ /* @__PURE__ */ n.jsx("stop", { offset: "0.891", stopColor: "#FED601" }),
2305
+ /* @__PURE__ */ n.jsx("stop", { offset: "0.999", stopColor: "#FFDD00" })
2306
+ ]
2307
+ }
2308
+ ),
2309
+ /* @__PURE__ */ n.jsxs(
2310
+ "linearGradient",
2311
+ {
2312
+ id: e("paint3"),
2313
+ x1: "13.9806",
2314
+ y1: "8.29749",
2315
+ x2: "10.8203",
2316
+ y2: "18.1127",
2317
+ gradientUnits: "userSpaceOnUse",
2318
+ children: [
2319
+ /* @__PURE__ */ n.jsx("stop", { stopColor: "#FFC832" }),
2320
+ /* @__PURE__ */ n.jsx("stop", { offset: "0.354", stopColor: "#F8A220" }),
2321
+ /* @__PURE__ */ n.jsx("stop", { offset: "0.779", stopColor: "#F07A0D" }),
2322
+ /* @__PURE__ */ n.jsx("stop", { offset: "1", stopColor: "#ED6B06" })
2323
+ ]
2324
+ }
2325
+ ),
2326
+ /* @__PURE__ */ n.jsxs(
2327
+ "linearGradient",
2328
+ {
2329
+ id: e("paint4"),
2330
+ x1: "13.9806",
2331
+ y1: "8.2892",
2332
+ x2: "10.8212",
2333
+ y2: "18.1113",
2334
+ gradientUnits: "userSpaceOnUse",
2335
+ children: [
2336
+ /* @__PURE__ */ n.jsx("stop", { offset: "0.461", stopColor: "#F3C636", stopOpacity: "0" }),
2337
+ /* @__PURE__ */ n.jsx("stop", { offset: "0.645", stopColor: "#F1A223", stopOpacity: "0.341" }),
2338
+ /* @__PURE__ */ n.jsx("stop", { offset: "0.879", stopColor: "#EE7A0E", stopOpacity: "0.776" }),
2339
+ /* @__PURE__ */ n.jsx("stop", { offset: "1", stopColor: "#ED6B06" })
2340
+ ]
2341
+ }
2342
+ ),
2343
+ /* @__PURE__ */ n.jsxs(
2344
+ "radialGradient",
2345
+ {
2346
+ id: e("paint5"),
2347
+ cx: "0",
2348
+ cy: "0",
2349
+ r: "1",
2350
+ gradientUnits: "userSpaceOnUse",
2351
+ gradientTransform: "translate(11.9404 22.4736) scale(7.73227 0.851796)",
2352
+ children: [
2353
+ /* @__PURE__ */ n.jsx("stop", { stopColor: "#C9C9C9" }),
2354
+ /* @__PURE__ */ n.jsx("stop", { offset: "0.302", stopColor: "#CCCCCC", stopOpacity: "0.698" }),
2355
+ /* @__PURE__ */ n.jsx("stop", { offset: "0.554", stopColor: "#D7D7D7", stopOpacity: "0.447" }),
2356
+ /* @__PURE__ */ n.jsx("stop", { offset: "0.787", stopColor: "#E8E8E8", stopOpacity: "0.212" }),
2357
+ /* @__PURE__ */ n.jsx("stop", { offset: "1", stopColor: "white", stopOpacity: "0" })
2358
+ ]
2359
+ }
2360
+ )
2361
+ ] })
2362
+ ]
2363
+ })
2364
+ );
2365
+ }, _e = Vs, $s = (t) => /* @__PURE__ */ n.jsx(
2366
+ "svg",
2367
+ E(x({
2368
+ fill: "none",
2369
+ xmlns: "http://www.w3.org/2000/svg",
2370
+ viewBox: "0 0 21 16",
2371
+ width: "21",
2372
+ height: "16"
2373
+ }, t), {
2374
+ children: /* @__PURE__ */ n.jsx(
2375
+ "path",
2376
+ {
2377
+ d: "M1.5 5h18M8.07 9H5.5M16.5 15h-12a3 3 0 0 1-3-3V4a3 3 0 0 1 3-3h12a3 3 0 0 1 3 3v8a3 3 0 0 1-3 3Z",
2378
+ stroke: "currentcolor",
2379
+ strokeWidth: "1.5",
2380
+ strokeLinecap: "round",
2381
+ strokeLinejoin: "round"
2382
+ }
2383
+ )
2384
+ })
2385
+ ), Zs = $s, Ws = (t) => /* @__PURE__ */ n.jsxs(
2386
+ "svg",
2387
+ E(x({
2388
+ width: "24",
2389
+ height: "24",
2390
+ fill: "none",
2391
+ xmlns: "http://www.w3.org/2000/svg",
2392
+ viewBox: "0 0 24 24"
2393
+ }, t), {
2394
+ children: [
2395
+ /* @__PURE__ */ n.jsx(
2396
+ "path",
2397
+ {
2398
+ d: "M3 3h6v6H3V3ZM2.8 14.8h6v6h-6v-6ZM20.8 8.8h-6v-6h6v6Z",
2399
+ strokeWidth: "1.5",
2400
+ strokeLinecap: "round",
2401
+ strokeLinejoin: "round",
2402
+ stroke: "currentColor"
2403
+ }
2404
+ ),
2405
+ /* @__PURE__ */ n.jsx("circle", { r: ".8", transform: "matrix(1 0 0 -1 14.8 14.7)", fill: "currentColor" }),
2406
+ /* @__PURE__ */ n.jsx("circle", { r: ".8", transform: "matrix(1 0 0 -1 20.8 14.7)", fill: "currentColor" }),
2407
+ /* @__PURE__ */ n.jsx("circle", { r: ".8", transform: "matrix(1 0 0 -1 17.8 17.7)", fill: "currentColor" }),
2408
+ /* @__PURE__ */ n.jsx("circle", { r: ".8", transform: "matrix(1 0 0 -1 14.8 20.7)", fill: "currentColor" }),
2409
+ /* @__PURE__ */ n.jsx("circle", { r: ".8", transform: "matrix(1 0 0 -1 20.8 20.7)", fill: "currentColor" })
2410
+ ]
2411
+ })
2412
+ ), Ys = Ws, zs = (t) => {
2413
+ var e = t, {
2414
+ variant: s,
2415
+ icon: r,
2416
+ isStandalone: i,
2417
+ title: o,
2418
+ description: a,
2419
+ className: u
2420
+ } = e, l = A(e, [
2421
+ "variant",
2422
+ "icon",
2423
+ "isStandalone",
2424
+ "title",
2425
+ "description",
2426
+ "className"
2427
+ ]);
2428
+ return /* @__PURE__ */ n.jsx(
2429
+ "div",
2430
+ E(x({}, l), {
2431
+ className: S(
2432
+ "card__empty-state",
2433
+ s === "error" && "card__empty-state--error",
2434
+ i && "card__empty-state--standalone",
2435
+ u
2436
+ ),
2437
+ children: /* @__PURE__ */ n.jsxs("div", { className: "card__empty-state__wrapper", children: [
2438
+ /* @__PURE__ */ n.jsx("i", { className: "card__empty-state__icon", "aria-hidden": !0, children: s === "error" ? /* @__PURE__ */ n.jsx(Ks, {}) : r }),
2439
+ /* @__PURE__ */ n.jsxs("div", { className: "card__empty-state__content", children: [
2440
+ /* @__PURE__ */ n.jsx("p", { className: "card__empty-state__title", children: o }),
2441
+ /* @__PURE__ */ n.jsx("p", { className: "card__empty-state__description", children: a })
2442
+ ] })
2443
+ ] })
2444
+ })
2445
+ );
2446
+ }, Js = ({ children: t }) => /* @__PURE__ */ n.jsx("div", { className: "card__footer", children: t }), Xs = (t) => {
2447
+ var e = t, { sticky: s, className: r, children: i } = e, o = A(e, ["sticky", "className", "children"]);
2448
+ return /* @__PURE__ */ n.jsx("div", E(x({}, o), { className: S("card__header", s && "card__header--sticky", r), children: i }));
2449
+ }, er = ({ children: t }) => /* @__PURE__ */ n.jsx("div", { className: "card__image", children: t }), tr = ({ children: t, className: e }) => /* @__PURE__ */ n.jsx("div", { className: S("card__body__item", e), children: t }), sr = ({ icon: t, children: e }) => /* @__PURE__ */ n.jsxs("div", { className: "card__header__title", children: [
2450
+ t && /* @__PURE__ */ n.jsx("span", { className: "card__header__title__icon", children: t }),
2451
+ e
2452
+ ] }), ut = c.forwardRef(
2453
+ (t, e) => {
2454
+ var s = t, { type: r, children: i, className: o, variant: a = "default", disabled: u = !1 } = s, l = A(s, ["type", "children", "className", "variant", "disabled"]);
2455
+ return c.createElement(
2456
+ r,
2457
+ x({
2458
+ className: S(
2459
+ "card",
2460
+ u && "card--disabled",
2461
+ a && `card--${a}`,
2462
+ o
2463
+ ),
2464
+ ref: e
2465
+ }, l),
2466
+ i
2467
+ );
2468
+ }
2469
+ );
2470
+ ut.displayName = "Card";
2471
+ Object.assign(ut, {
2472
+ Header: Xs,
2473
+ Action: Rs,
2474
+ Title: sr,
2475
+ Body: Es,
2476
+ Image: er,
2477
+ Item: tr,
2478
+ Footer: Js,
2479
+ EmptyState: zs
2480
+ });
2481
+ var rr = (t) => {
2482
+ var e = t, { className: s, children: r } = e, i = A(e, ["className", "children"]);
2483
+ return /* @__PURE__ */ n.jsx("div", E(x({ className: S("checkbox__content", s) }, i), { children: r }));
2484
+ }, nr = (t) => {
2485
+ var e = t, { className: s, children: r } = e, i = A(e, ["className", "children"]);
2486
+ return /* @__PURE__ */ n.jsx("span", E(x({ className: S("checkbox__error", s) }, i), { children: r }));
2487
+ }, ir = (t) => {
2488
+ var e = t, { className: s, children: r } = e, i = A(e, ["className", "children"]);
2489
+ return /* @__PURE__ */ n.jsx("span", E(x({ className: S("checkbox__hint", s) }, i), { children: r }));
2490
+ }, lt = c.createContext(void 0), or = ({ id: t, name: e, children: s }) => /* @__PURE__ */ n.jsx(lt.Provider, { value: { id: t, name: e }, children: s }), ar = () => {
2491
+ const t = c.useContext(lt);
2492
+ if (!t)
2493
+ throw new Error("Checkbox compound components can not be rendered outside of Checkbox");
2494
+ return t;
2495
+ }, ur = (t) => {
2496
+ var e = t, { className: s, children: r } = e, i = A(e, ["className", "children"]);
2497
+ const { id: o } = ar();
2498
+ return /* @__PURE__ */ n.jsx("label", E(x({ htmlFor: o, className: S("checkbox__label", s) }, i), { children: r }));
2499
+ }, U = (t) => {
2500
+ var e = t, {
2501
+ id: s,
2502
+ name: r,
2503
+ isPending: i = !1,
2504
+ variant: o = "neutral",
2505
+ hasError: a = !1,
2506
+ className: u,
2507
+ children: l
2508
+ } = e, h = A(e, [
2509
+ "id",
2510
+ "name",
2511
+ "isPending",
2512
+ "variant",
2513
+ "hasError",
2514
+ "className",
2515
+ "children"
2516
+ ]);
2517
+ const d = c.useRef(null);
2518
+ return c.useEffect(() => {
2519
+ d.current && (i ? d.current.indeterminate = !0 : d.current.indeterminate = !1);
2520
+ }, [i]), /* @__PURE__ */ n.jsxs(
2521
+ "div",
2522
+ {
2523
+ className: S("checkbox", o && `checkbox--${o}`, a && "checkbox--error"),
2524
+ children: [
2525
+ /* @__PURE__ */ n.jsx(
2526
+ "input",
2527
+ x({
2528
+ id: s,
2529
+ name: r,
2530
+ type: "checkbox",
2531
+ ref: d,
2532
+ className: S("checkbox__input", u)
2533
+ }, h)
2534
+ ),
2535
+ i ? /* @__PURE__ */ n.jsx(Gs, { className: "checkbox__spinner", "aria-hidden": !0 }) : /* @__PURE__ */ n.jsx(Us, { className: "checkbox__check", "aria-hidden": !0, strokeDasharray: "75" }),
2536
+ /* @__PURE__ */ n.jsx(or, { id: s, name: r, children: l })
2537
+ ]
2538
+ }
2539
+ );
2540
+ };
2541
+ U.Content = rr;
2542
+ U.Label = ur;
2543
+ U.Hint = ir;
2544
+ U.Error = nr;
2545
+ var lr = (t) => {
2546
+ var e = t, { type: s = "div", className: r, children: i } = e, o = A(e, ["type", "className", "children"]);
2547
+ return c.createElement(s, x({ className: S("dialog__body", r) }, o), i);
2548
+ }, ye = () => document.body.style.removeProperty("overflow"), Ie = (t) => t.preventDefault(), cr = 'a[href]:not([disabled]), button:not([disabled]), textarea:not([disabled]), input[type="text"]:not([disabled]), input[type="radio"]:not([disabled]), input[type="checkbox"]:not([disabled]), select:not([disabled])', dr = (t) => {
2549
+ var e = t, { className: s, children: r, shouldAnimate: i = !0 } = e, o = A(e, ["className", "children", "shouldAnimate"]);
2550
+ const { ref: a, defaultOpen: u, isModal: l, onClose: h } = X();
2551
+ return c.useEffect(() => {
2552
+ const d = a == null ? void 0 : a.current;
2553
+ if (d != null && d.open) {
2554
+ const p = d.querySelectorAll(cr), m = p[0], f = p[p.length - 1], C = (g) => {
2555
+ if (!(g.key === "Tab"))
2556
+ return;
2557
+ g.shiftKey ? document.activeElement === m && (f.focus(), g.preventDefault()) : document.activeElement === f && (m.focus(), g.preventDefault());
2558
+ };
2559
+ return document.body.style.overflow = "hidden", d.addEventListener("keydown", C), window.addEventListener("popstate", () => ye()), () => {
2560
+ d.removeEventListener("keydown", C), window.removeEventListener("popstate", () => ye());
2561
+ };
2562
+ }
2563
+ }, [a]), c.useEffect(() => {
2564
+ const d = a == null ? void 0 : a.current;
2565
+ if (!d)
2566
+ return;
2567
+ if (u && (d.removeAttribute("open"), d.showModal(), d.focus()), l)
2568
+ return d.addEventListener("cancel", Ie), () => d.removeEventListener("cancel", Ie);
2569
+ const p = ({ clientX: m, clientY: f }) => {
2570
+ const { top: C, right: g, bottom: v, left: y } = d.getBoundingClientRect(), _ = 0 < f && 0 < m, j = C < f && f < v, O = y < m && m < g;
2571
+ _ && !(j && O) && h();
2572
+ };
2573
+ return d.addEventListener("cancel", h), d.addEventListener("mousedown", p), () => {
2574
+ d.removeEventListener("cancel", h), d.removeEventListener("mousedown", p);
2575
+ };
2576
+ }, [a, l, h, u]), /* @__PURE__ */ n.jsx(
2577
+ "dialog",
2578
+ E(x({
2579
+ ref: a,
2580
+ tabIndex: -1,
2581
+ open: u,
2582
+ "aria-modal": !!l,
2583
+ className: S("dialog", i && "dialog--animated", s)
2584
+ }, o), {
2585
+ children: r
2586
+ })
2587
+ );
2588
+ }, ct = c.createContext(void 0), hr = ({ defaultOpen: t, onClose: e, isModal: s, children: r }) => {
2589
+ const i = c.useRef(null), o = c.useRef(e), a = c.useCallback(() => {
2590
+ var u;
2591
+ ye(), (u = i.current) == null || u.close(), o.current && (o == null || o.current());
2592
+ }, [i]);
2593
+ return /* @__PURE__ */ n.jsx(ct.Provider, { value: { ref: i, defaultOpen: t, isModal: s, onClose: a }, children: r });
2594
+ }, X = () => {
2595
+ const t = c.useContext(ct);
2596
+ if (!t)
2597
+ throw new Error("Dialog compound components can not be rendered outside of Dialog");
2598
+ return t;
2599
+ }, fr = (t) => {
2600
+ var e = t, { children: s } = e, r = A(e, ["children"]);
2601
+ const { onClose: i } = X();
2602
+ return /* @__PURE__ */ n.jsx(K, E(x({ onClick: i }, r), { children: s }));
2603
+ }, dt = c.forwardRef((t, e) => {
2604
+ var s = t, { className: r } = s, i = A(s, ["className"]);
2605
+ const { onClose: o } = X();
2606
+ return /* @__PURE__ */ n.jsx(
2607
+ K,
2608
+ x({
2609
+ type: "submit",
2610
+ ref: e,
2611
+ formMethod: "dialog",
2612
+ onClick: o,
2613
+ iconLeft: /* @__PURE__ */ n.jsx(Ps, {}),
2614
+ variant: "icon--secondary",
2615
+ className: S("dialog__close button--icon", r)
2616
+ }, i)
2617
+ );
2618
+ });
2619
+ dt.displayName = "Close";
2620
+ var pr = (t) => {
2621
+ var e = t, { className: s, children: r } = e, i = A(e, ["className", "children"]);
2622
+ return /* @__PURE__ */ n.jsx("div", E(x({ className: S("dialog__footer", s) }, i), { children: r }));
2623
+ }, vr = ({ children: t }) => /* @__PURE__ */ n.jsx("div", { className: "dialog__header", children: t }), mr = (t) => {
2624
+ var e = t, { icon: s, children: r, className: i } = e, o = A(e, ["icon", "children", "className"]);
2625
+ const { ref: a } = X(), u = c.useRef(null);
2626
+ return c.useEffect(() => {
2627
+ a != null && a.current && a.current.focus();
2628
+ }, [a]), /* @__PURE__ */ n.jsxs(
2629
+ "div",
2630
+ E(x({
2631
+ tabIndex: 0,
2632
+ ref: u,
2633
+ className: S("dialog__header__title", i)
2634
+ }, o), {
2635
+ children: [
2636
+ s && /* @__PURE__ */ n.jsx("span", { className: "dialog__header__icon", children: s }),
2637
+ r
2638
+ ]
2639
+ })
2640
+ );
2641
+ }, yr = (t) => {
2642
+ var e = t, { children: s } = e, r = A(e, ["children"]);
2643
+ const { ref: i } = X();
2644
+ return /* @__PURE__ */ n.jsx(K, E(x({ onClick: () => {
2645
+ var o;
2646
+ return (o = i == null ? void 0 : i.current) == null ? void 0 : o.showModal();
2647
+ } }, r), { children: s }));
2648
+ }, M = ({ defaultOpen: t, isModal: e, children: s, onClose: r }) => /* @__PURE__ */ n.jsx(hr, { defaultOpen: !!t, isModal: e, onClose: r, children: s });
2649
+ M.Trigger = yr;
2650
+ M.Root = dr;
2651
+ M.Title = mr;
2652
+ M.Header = vr;
2653
+ M.Body = lr;
2654
+ M.Footer = pr;
2655
+ M.Button = fr;
2656
+ M.Close = dt;
2657
+ var ht = c.createContext(void 0), Cr = ({
2658
+ id: t,
2659
+ position: e,
2660
+ isOpen: s,
2661
+ setIsOpen: r,
2662
+ activeItemIndex: i,
2663
+ setActiveItemIndex: o,
2664
+ clearActiveItemIndex: a,
2665
+ triggerRef: u,
2666
+ contentRef: l,
2667
+ children: h
2668
+ }) => /* @__PURE__ */ n.jsx(
2669
+ ht.Provider,
2670
+ {
2671
+ value: {
2672
+ id: t,
2673
+ position: e,
2674
+ isOpen: s,
2675
+ setIsOpen: r,
2676
+ activeItemIndex: i,
2677
+ setActiveItemIndex: o,
2678
+ clearActiveItemIndex: a,
2679
+ triggerRef: u,
2680
+ contentRef: l
2681
+ },
2682
+ children: h
2683
+ }
2684
+ ), ft = () => {
2685
+ const t = c.useContext(ht);
2686
+ if (t === void 0)
2687
+ throw new Error("useMenu must be used within a MenuProvider");
2688
+ return t;
2689
+ }, xr = ({ children: t }) => {
2690
+ const {
2691
+ id: e,
2692
+ position: s,
2693
+ isOpen: r,
2694
+ setIsOpen: i,
2695
+ activeItemIndex: o,
2696
+ setActiveItemIndex: a,
2697
+ clearActiveItemIndex: u,
2698
+ triggerRef: l,
2699
+ contentRef: h
2700
+ } = ft(), d = (p) => {
2701
+ var m;
2702
+ if (!r)
2703
+ return;
2704
+ if (p.key === "Escape")
2705
+ return u(), i(!1), (m = l.current) == null ? void 0 : m.focus();
2706
+ const f = h.current.childElementCount - 1;
2707
+ switch (p.key) {
2708
+ case "ArrowUp":
2709
+ case "ArrowLeft":
2710
+ return p.preventDefault(), a(o ? Math.max(0, o - 1) : 0);
2711
+ case "ArrowDown":
2712
+ case "ArrowRight":
2713
+ p.preventDefault();
2714
+ const C = o !== void 0 ? o + 1 : 0;
2715
+ return a(Math.min(f, C));
2716
+ case "Home":
2717
+ return p.preventDefault(), a(0);
2718
+ case "End":
2719
+ return p.preventDefault(), a(f);
2720
+ }
2721
+ };
2722
+ return (
2723
+ // eslint-disable-next-line jsx-a11y/no-noninteractive-element-interactions
2724
+ /* @__PURE__ */ n.jsx(
2725
+ "ul",
2726
+ {
2727
+ id: `${e}-content`,
2728
+ ref: h,
2729
+ className: S("menu__list", `menu__list--${s}`, r && "menu__list--active"),
2730
+ onKeyDown: d,
2731
+ children: t
2732
+ }
2733
+ )
2734
+ );
2735
+ }, br = (t) => {
2736
+ var e = t, { children: s, className: r } = e, i = A(e, ["children", "className"]);
2737
+ return /* @__PURE__ */ n.jsx("li", E(x({}, i), { className: S("menu__list-item", r), children: s }));
2738
+ }, pt = ({ children: t, className: e }) => {
2739
+ const { id: s, isOpen: r, setIsOpen: i, clearActiveItemIndex: o, setActiveItemIndex: a, triggerRef: u } = ft(), l = () => {
2740
+ o(), i((d) => !d);
2741
+ }, h = (d) => {
2742
+ if (r) {
2743
+ if (d.key === "Escape")
2744
+ return o(), i(!1);
2745
+ d.key === "ArrowDown" && (d.preventDefault(), a(0));
2746
+ }
2747
+ };
2748
+ return c.cloneElement(t, {
2749
+ id: `${s}-trigger`,
2750
+ ref: u,
2751
+ className: S("menu__trigger", e),
2752
+ onClick: l,
2753
+ onKeyDown: h,
2754
+ "aria-expanded": r,
2755
+ "aria-controls": `${s}-content`
2756
+ });
2757
+ };
2758
+ pt.displayName = "Trigger";
2759
+ var L = (t) => {
2760
+ var e = t, { type: s, id: r, position: i = "right", children: o, className: a } = e, u = A(e, ["type", "id", "position", "children", "className"]);
2761
+ const l = c.useRef(null), h = c.useRef(null), d = c.useRef(null), [p, m] = c.useState(!1), [f, C] = c.useState(), [g, v] = c.useState(f);
2762
+ f !== g && f !== void 0 && (d.current.children[f].firstChild.focus(), v(f));
2763
+ const y = () => {
2764
+ C(void 0), v(void 0);
2765
+ }, _ = (j) => {
2766
+ var O;
2767
+ ((O = l.current) == null ? void 0 : O.contains(j.relatedTarget)) || (y(), m(!1));
2768
+ };
2769
+ return /* @__PURE__ */ n.jsx(
2770
+ Cr,
2771
+ {
2772
+ id: r,
2773
+ position: i,
2774
+ isOpen: p,
2775
+ setIsOpen: m,
2776
+ activeItemIndex: f,
2777
+ setActiveItemIndex: C,
2778
+ clearActiveItemIndex: y,
2779
+ triggerRef: h,
2780
+ contentRef: d,
2781
+ children: c.createElement(
2782
+ s,
2783
+ E(x({}, u), {
2784
+ id: r,
2785
+ ref: l,
2786
+ className: `menu ${a || ""}`,
2787
+ onBlur: _
2788
+ }),
2789
+ o
2790
+ )
2791
+ }
2792
+ );
2793
+ };
2794
+ L.Trigger = pt;
2795
+ L.Content = xr;
2796
+ L.Item = br;
2797
+ c.createContext(void 0);
2798
+ var gr = (/* @__PURE__ */ new Map()).set("BE", "32").set("FR", "33").set("NL", "31").set("LU", "352").set("DE", "49").set("CA", "1").set("PR", "1").set("TC", "1").set("US", "1").set("BS", "1242").set("BB", "1246").set("AI", "1264").set("AG", "1268").set("KY", "1345").set("BM", "1441").set("GD", "1473").set("MS", "1664").set("GU", "1671").set("LC", "1758").set("DM", "1767").set("VC", "1784").set("DO", "1809").set("TT", "1868").set("KN", "1869").set("JM", "1876").set("EG", "20").set("SS", "211").set("MA", "212").set("DZ", "213").set("TN", "216").set("LY", "218").set("GM", "220").set("SN", "221").set("MR", "222").set("ML", "223").set("GN", "224").set("CI", "225").set("BF", "226").set("NE", "227").set("TG", "228").set("BJ", "229").set("MU", "230").set("LR", "231").set("SL", "232").set("GH", "233").set("NG", "234").set("TD", "235").set("CF", "236").set("CM", "237").set("CV", "238").set("ST", "239").set("GQ", "240").set("GA", "241").set("CG", "242").set("CD", "243").set("AO", "244").set("GW", "245").set("SC", "248").set("SD", "249").set("RW", "250").set("ET", "251").set("SO", "252").set("DJ", "253").set("KE", "254").set("TZ", "255").set("UG", "256").set("BI", "257").set("MZ", "258").set("ZM", "260").set("MG", "261").set("RE", "262").set("ZW", "263").set("NA", "264").set("MW", "265").set("LS", "266").set("BW", "267").set("SZ", "268").set("KM", "269").set("ZA", "27").set("VG", "284").set("ER", "291").set("AW", "297").set("FO", "298").set("GL", "299").set("GR", "30").set("ES", "34").set("GI", "350").set("PT", "351").set("IE", "353").set("IS", "354").set("AL", "355").set("MT", "356").set("CY", "357").set("FI", "358").set("BG", "359").set("HU", "36").set("LT", "370").set("LV", "371").set("EE", "372").set("MD", "373").set("AM", "374").set("BY", "375").set("AD", "376").set("MC", "377").set("SM", "378").set("UA", "380").set("RS", "381").set("ME", "382").set("HR", "385").set("SI", "386").set("BA", "387").set("MK", "389").set("IT", "39").set("RO", "40").set("CH", "41").set("CZ", "420").set("SK", "421").set("LI", "423").set("AT", "43").set("GB", "44").set("DK", "45").set("SE", "46").set("NO", "47").set("PL", "48").set("FK", "500").set("BZ", "501").set("GT", "502").set("SV", "503").set("HN", "504").set("NI", "505").set("CR", "506").set("PA", "507").set("PM", "508").set("HT", "509").set("PE", "51").set("MX", "52").set("CU", "53").set("AR", "54").set("BR", "55").set("CL", "56").set("CO", "57").set("VE", "58").set("GP", "590").set("BO", "591").set("GY", "592").set("EC", "593").set("FG", "594").set("PY", "595").set("MQ", "596").set("SR", "597").set("UY", "598").set("CW", "599").set("AN", "599").set("MY", "60").set("AU", "61").set("ID", "62").set("PH", "63").set("NZ", "64").set("SG", "65").set("TH", "66").set("TP", "670").set("BN", "673").set("PG", "675").set("TO", "676").set("SB", "677").set("VU", "678").set("FJ", "679").set("PW", "680").set("CK", "682").set("NU", "683").set("AS", "684").set("WS", "685").set("KI", "686").set("NC", "687").set("TV", "688").set("PF", "689").set("FM", "691").set("KZ", "7").set("RU", "7").set("JP", "81").set("KR", "82").set("VN", "84").set("KP", "850").set("HK", "852").set("MO", "853").set("KH", "855").set("LA", "856").set("CN", "86").set("BD", "880").set("TW", "886").set("TR", "90").set("IN", "91").set("PK", "92").set("AF", "93").set("LK", "94").set("MM", "95").set("MV", "960").set("LB", "961").set("JO", "962").set("SY", "963").set("IQ", "964").set("KW", "965").set("SA", "966").set("YE", "967").set("OM", "968").set("PS", "970").set("AE", "971").set("IL", "972").set("BH", "973").set("QA", "974").set("BT", "975").set("MN", "976").set("NP", "977").set("IR", "98").set("TK", "992").set("TM", "993").set("AZ", "994").set("GE", "995").set("KG", "996").set("UZ", "998");
2799
+ [...new Set(gr.values())].map((t) => ({
2800
+ label: `+${t}`,
2801
+ value: t
2802
+ }));
2803
+ c.createContext(void 0);
2804
+ c.createContext(void 0);
2805
+ const Z = ({
2806
+ className: t,
2807
+ label: e,
2808
+ mobileUrl: s,
2809
+ desktopUrl: r,
2810
+ icon: i
2811
+ }) => /* @__PURE__ */ n.jsxs(L.Item, { className: t, children: [
2812
+ /* @__PURE__ */ n.jsxs("a", { href: s, referrerPolicy: "no-referrer-when-downgrade", children: [
2813
+ i,
2814
+ e
2815
+ ] }),
2816
+ r && /* @__PURE__ */ n.jsxs("a", { href: r, referrerPolicy: "no-referrer-when-downgrade", children: [
2817
+ i,
2818
+ e
2819
+ ] })
2820
+ ] }), vt = c.createContext(void 0), jr = ({ position: t, authenticationStatus: e, profile: s, children: r }) => /* @__PURE__ */ n.jsx(vt.Provider, { value: { position: t, authenticationStatus: e, profile: s }, children: r }), Re = () => {
2821
+ const t = c.useContext(vt);
2822
+ if (!t)
2823
+ throw new Error("Authentication context can not be rendered outside of Authentication");
2824
+ return t;
2825
+ }, mt = c.createContext(void 0), wr = ({ apiUrl: t, redirectUrl: e, children: s }) => /* @__PURE__ */ n.jsx(mt.Provider, { value: { apiUrl: t, redirectUrl: e }, children: s }), yt = () => {
2826
+ const t = c.useContext(mt);
2827
+ if (!t)
2828
+ throw new Error("Api context can not be rendered outside of Api");
2829
+ return t;
2830
+ }, H = () => {
2831
+ const { apiUrl: t, redirectUrl: e } = yt(), s = wt({ apiUrl: t, redirectUrl: e }), r = `${t}/logout?redirectUrl=${e}`, i = `${t}/user/profile`, o = `${t}/gdpr/tc/check`, a = `${t}/gdpr/tc`;
2832
+ return {
2833
+ loginUrl: s,
2834
+ logoutUrl: r,
2835
+ profileEndpoint: i,
2836
+ getTermsAndConditionsEndpoint: o,
2837
+ postTermsAndConditionsEndpoint: a
2838
+ };
2839
+ }, _r = () => {
2840
+ const { t } = z(), e = Qe(), { position: s, profile: r } = Re(), { logoutUrl: i } = H(), o = (r == null ? void 0 : r.firstName) || "", a = (r == null ? void 0 : r.lastName) || "";
2841
+ return /* @__PURE__ */ n.jsxs(L, { type: "nav", id: "xtra-menu", position: s, children: [
2842
+ /* @__PURE__ */ n.jsx(
2843
+ L.Trigger,
2844
+ {
2845
+ className: S(
2846
+ "button",
2847
+ "button--neutral",
2848
+ "button--authentication",
2849
+ "button--authentication--authenticated"
2850
+ ),
2851
+ children: /* @__PURE__ */ n.jsxs("button", { children: [
2852
+ /* @__PURE__ */ n.jsx("div", { className: "button__icon", children: /* @__PURE__ */ n.jsx(ws, { variant: "small", firstName: o, lastName: a }) }),
2853
+ /* @__PURE__ */ n.jsx("span", { className: "button__label", children: o }),
2854
+ /* @__PURE__ */ n.jsx("div", { className: "button__icon button__icon-right", children: /* @__PURE__ */ n.jsx(we, {}) })
2855
+ ] })
2856
+ }
2857
+ ),
2858
+ /* @__PURE__ */ n.jsxs(L.Content, { children: [
2859
+ /* @__PURE__ */ n.jsx(
2860
+ Z,
2861
+ {
2862
+ className: "manage-profile",
2863
+ mobileUrl: `${e}/manage-profile`,
2864
+ desktopUrl: `${e}/manage-profile/personal-data`,
2865
+ icon: /* @__PURE__ */ n.jsx(Is, {}),
2866
+ label: t("manageProfile")
2867
+ }
2868
+ ),
2869
+ /* @__PURE__ */ n.jsx(
2870
+ Z,
2871
+ {
2872
+ className: "payment",
2873
+ mobileUrl: `${e}/payment`,
2874
+ desktopUrl: `${e}/payment/pay-with-xtra`,
2875
+ icon: /* @__PURE__ */ n.jsx(Zs, {}),
2876
+ label: t("payment")
2877
+ }
2878
+ ),
2879
+ /* @__PURE__ */ n.jsx(
2880
+ Z,
2881
+ {
2882
+ mobileUrl: `${e}/identifiers`,
2883
+ icon: /* @__PURE__ */ n.jsx(Ys, {}),
2884
+ label: t("qrCode")
2885
+ }
2886
+ ),
2887
+ /* @__PURE__ */ n.jsx(
2888
+ Z,
2889
+ {
2890
+ className: "manage-privacy",
2891
+ mobileUrl: `${e}/manage-privacy`,
2892
+ desktopUrl: `${e}/manage-privacy/permissions`,
2893
+ icon: /* @__PURE__ */ n.jsx(qs, {}),
2894
+ label: t("privacy")
2895
+ }
2896
+ ),
2897
+ /* @__PURE__ */ n.jsx(Z, { mobileUrl: i, icon: /* @__PURE__ */ n.jsx(Ls, {}), label: t("logout") })
2898
+ ] })
2899
+ ] });
2900
+ }, Rr = () => {
2901
+ const { t } = z();
2902
+ return /* @__PURE__ */ n.jsxs("button", { className: S("button", "button--neutral", "button--authentication"), children: [
2903
+ /* @__PURE__ */ n.jsx("div", { className: "button__icon", children: /* @__PURE__ */ n.jsx("i", { className: "spinner" }) }),
2904
+ /* @__PURE__ */ n.jsxs("span", { className: "button__label", children: [
2905
+ t("loading"),
2906
+ "..."
2907
+ ] })
2908
+ ] });
2909
+ }, Er = ({ className: t }) => {
2910
+ const { t: e } = z(), { loginUrl: s } = H();
2911
+ return /* @__PURE__ */ n.jsxs(
2912
+ "a",
2913
+ {
2914
+ href: s,
2915
+ className: S(
2916
+ "button",
2917
+ "button--neutral",
2918
+ "button--authentication",
2919
+ "button--authentication--unauthenticated",
2920
+ t
2921
+ ),
2922
+ children: [
2923
+ /* @__PURE__ */ n.jsx("div", { className: "button__icon", children: /* @__PURE__ */ n.jsx(_e, { width: 24, height: 24, suffix: "desktop" }) }),
2924
+ /* @__PURE__ */ n.jsx("span", { className: "button__label", children: e("login") }),
2925
+ /* @__PURE__ */ n.jsx("div", { className: "button__icon button__icon-right", children: /* @__PURE__ */ n.jsx(we, {}) })
2926
+ ]
2927
+ }
2928
+ );
2929
+ };
2930
+ const Or = () => {
2931
+ const { t } = z(), { loginUrl: e } = H(), s = Qe(), { position: r } = Re();
2932
+ return /* @__PURE__ */ n.jsxs(L, { type: "nav", id: "xtra-menu", position: r, className: "menu--unauthenticated", children: [
2933
+ /* @__PURE__ */ n.jsx(L.Trigger, { className: S("button", "button--neutral", "button--authentication"), children: /* @__PURE__ */ n.jsxs("button", { children: [
2934
+ /* @__PURE__ */ n.jsx("div", { className: "button__icon", children: /* @__PURE__ */ n.jsx(_e, { width: 24, height: 24, suffix: "mobile" }) }),
2935
+ /* @__PURE__ */ n.jsx("div", { className: "button__icon button__icon-right", children: /* @__PURE__ */ n.jsx(we, {}) })
2936
+ ] }) }),
2937
+ /* @__PURE__ */ n.jsxs(L.Content, { children: [
2938
+ /* @__PURE__ */ n.jsx(L.Item, { children: /* @__PURE__ */ n.jsxs("a", { href: e, className: "button button--with-icon", children: [
2939
+ /* @__PURE__ */ n.jsx("span", { className: "button__icon", children: /* @__PURE__ */ n.jsx(Ns, {}) }),
2940
+ /* @__PURE__ */ n.jsx("span", { className: "button__label", children: t("login") })
2941
+ ] }) }),
2942
+ /* @__PURE__ */ n.jsx(L.Item, { children: /* @__PURE__ */ n.jsxs("a", { href: `${s}/onboarding/register`, className: "button button--with-icon", children: [
2943
+ /* @__PURE__ */ n.jsx("span", { className: "button__icon", children: /* @__PURE__ */ n.jsx(Fs, {}) }),
2944
+ /* @__PURE__ */ n.jsx("span", { className: "button__label", children: t("register") })
2945
+ ] }) })
2946
+ ] })
2947
+ ] });
2948
+ };
2949
+ var D = /* @__PURE__ */ ((t) => (t.Authenticated = "authenticated", t.NotAuthenticated = "notAuthenticated", t.Pending = "pending", t))(D || {});
2950
+ const Sr = () => {
2951
+ const { authenticationStatus: t } = Re();
2952
+ return t === D.NotAuthenticated ? /* @__PURE__ */ n.jsxs(n.Fragment, { children: [
2953
+ /* @__PURE__ */ n.jsx(Er, {}),
2954
+ /* @__PURE__ */ n.jsx(Or, {})
2955
+ ] }) : t === D.Pending ? /* @__PURE__ */ n.jsx(Rr, {}) : /* @__PURE__ */ n.jsx(_r, {});
2956
+ };
2957
+ /*! js-cookie v3.0.5 | MIT */
2958
+ function ee(t) {
2959
+ for (var e = 1; e < arguments.length; e++) {
2960
+ var s = arguments[e];
2961
+ for (var r in s)
2962
+ t[r] = s[r];
2963
+ }
2964
+ return t;
2965
+ }
2966
+ var Pr = {
2967
+ read: function(t) {
2968
+ return t[0] === '"' && (t = t.slice(1, -1)), t.replace(/(%[\dA-F]{2})+/gi, decodeURIComponent);
2969
+ },
2970
+ write: function(t) {
2971
+ return encodeURIComponent(t).replace(
2972
+ /%(2[346BF]|3[AC-F]|40|5[BDE]|60|7[BCD])/g,
2973
+ decodeURIComponent
2974
+ );
2975
+ }
2976
+ };
2977
+ function Ce(t, e) {
2978
+ function s(i, o, a) {
2979
+ if (!(typeof document > "u")) {
2980
+ a = ee({}, e, a), typeof a.expires == "number" && (a.expires = new Date(Date.now() + a.expires * 864e5)), a.expires && (a.expires = a.expires.toUTCString()), i = encodeURIComponent(i).replace(/%(2[346B]|5E|60|7C)/g, decodeURIComponent).replace(/[()]/g, escape);
2981
+ var u = "";
2982
+ for (var l in a)
2983
+ a[l] && (u += "; " + l, a[l] !== !0 && (u += "=" + a[l].split(";")[0]));
2984
+ return document.cookie = i + "=" + t.write(o, i) + u;
2985
+ }
2986
+ }
2987
+ function r(i) {
2988
+ if (!(typeof document > "u" || arguments.length && !i)) {
2989
+ for (var o = document.cookie ? document.cookie.split("; ") : [], a = {}, u = 0; u < o.length; u++) {
2990
+ var l = o[u].split("="), h = l.slice(1).join("=");
2991
+ try {
2992
+ var d = decodeURIComponent(l[0]);
2993
+ if (a[d] = t.read(h, d), i === d)
2994
+ break;
2995
+ } catch {
2996
+ }
2997
+ }
2998
+ return i ? a[i] : a;
2999
+ }
3000
+ }
3001
+ return Object.create(
3002
+ {
3003
+ set: s,
3004
+ get: r,
3005
+ remove: function(i, o) {
3006
+ s(
3007
+ i,
3008
+ "",
3009
+ ee({}, o, {
3010
+ expires: -1
3011
+ })
3012
+ );
3013
+ },
3014
+ withAttributes: function(i) {
3015
+ return Ce(this.converter, ee({}, this.attributes, i));
3016
+ },
3017
+ withConverter: function(i) {
3018
+ return Ce(ee({}, this.converter, i), this.attributes);
3019
+ }
3020
+ },
3021
+ {
3022
+ attributes: { value: Object.freeze(e) },
3023
+ converter: { value: Object.freeze(t) }
3024
+ }
3025
+ );
3026
+ }
3027
+ var xe = Ce(Pr, { path: "/" });
3028
+ class Te extends Error {
3029
+ constructor(e) {
3030
+ super(e), this.name = "UnauthorizedError";
3031
+ }
3032
+ }
3033
+ const Ar = () => {
3034
+ const { profileEndpoint: t } = H();
3035
+ return nt({
3036
+ // @ts-expect-error queryKey is the right type
3037
+ queryKey: ["profile"],
3038
+ queryFn: async () => {
3039
+ const s = await fetch(t, {
3040
+ credentials: "include",
3041
+ mode: "cors"
3042
+ });
3043
+ if (!s.ok)
3044
+ throw s.status === 401 ? new Te(`${s.status} - ${s.statusText}`) : new Error("Network response was not ok");
3045
+ return await s.json();
3046
+ },
3047
+ retry: (s, r) => r instanceof Te ? !1 : 3
3048
+ });
3049
+ }, Ct = () => {
3050
+ var u, l;
3051
+ const t = xe.get("profile"), e = !!t, [s, r] = c.useState(
3052
+ e ? D.Authenticated : D.Pending
3053
+ ), [i, o] = c.useState(
3054
+ e ? JSON.parse(t) : void 0
3055
+ ), a = Ar();
3056
+ return c.useEffect(() => {
3057
+ if (a.isLoading && r(D.Pending), a.isError && e && (xe.remove("profile"), r(D.NotAuthenticated)), a.isError && !e && r(D.NotAuthenticated), a.isSuccess) {
3058
+ r(D.Authenticated);
3059
+ const h = {
3060
+ firstName: a.data.firstName,
3061
+ lastName: a.data.lastName
3062
+ };
3063
+ o(h);
3064
+ }
3065
+ }, [
3066
+ s,
3067
+ e,
3068
+ t,
3069
+ (u = a.data) == null ? void 0 : u.firstName,
3070
+ (l = a.data) == null ? void 0 : l.lastName,
3071
+ a.isError,
3072
+ a.isLoading,
3073
+ a.isSuccess
3074
+ ]), { authenticationStatus: s, profile: i };
3075
+ }, Nr = ({ position: t }) => {
3076
+ const { authenticationStatus: e, profile: s } = Ct();
3077
+ return /* @__PURE__ */ n.jsx(jr, { authenticationStatus: e, position: t, profile: s, children: /* @__PURE__ */ n.jsx(Sr, {}) });
3078
+ };
3079
+ var Mr = Object.defineProperty, Fr = Object.defineProperties, kr = Object.getOwnPropertyDescriptors, ae = Object.getOwnPropertySymbols, xt = Object.prototype.hasOwnProperty, bt = Object.prototype.propertyIsEnumerable, Ue = (t, e, s) => e in t ? Mr(t, e, { enumerable: !0, configurable: !0, writable: !0, value: s }) : t[e] = s, Q = (t, e) => {
3080
+ for (var s in e || (e = {}))
3081
+ xt.call(e, s) && Ue(t, s, e[s]);
3082
+ if (ae)
3083
+ for (var s of ae(e))
3084
+ bt.call(e, s) && Ue(t, s, e[s]);
3085
+ return t;
3086
+ }, G = (t, e) => Fr(t, kr(e)), V = (t, e) => {
3087
+ var s = {};
3088
+ for (var r in t)
3089
+ xt.call(t, r) && e.indexOf(r) < 0 && (s[r] = t[r]);
3090
+ if (t != null && ae)
3091
+ for (var r of ae(t))
3092
+ e.indexOf(r) < 0 && bt.call(t, r) && (s[r] = t[r]);
3093
+ return s;
3094
+ }, Lr = c.forwardRef((t, e) => {
3095
+ const s = t, { isAuthenticated: r, className: i } = s, o = V(s, ["isAuthenticated", "className"]);
3096
+ return /* @__PURE__ */ n.jsx(
3097
+ K,
3098
+ Q({
3099
+ type: "button",
3100
+ ref: e,
3101
+ className: S(
3102
+ "button--neutral",
3103
+ "button--authentication",
3104
+ r && "button--authentication--authenticated",
3105
+ i
3106
+ )
3107
+ }, o)
3108
+ );
3109
+ });
3110
+ Lr.displayName = "AuthenticationButton";
3111
+ var Dr = (t) => {
3112
+ var e = t, {
3113
+ children: s
3114
+ } = e, r = V(e, [
3115
+ "children"
3116
+ ]);
3117
+ return /* @__PURE__ */ n.jsx(U.Label, G(Q({ className: "form--tc__label" }, r), { children: s }));
3118
+ }, gt = c.forwardRef(
3119
+ (t, e) => {
3120
+ var s = t, { children: r } = s, i = V(s, ["children"]);
3121
+ return /* @__PURE__ */ n.jsx("form", G(Q({ className: "form--tc", ref: e }, i), { children: r }));
3122
+ }
3123
+ );
3124
+ gt.displayName = "TermsAndConditionsForm";
3125
+ var Ir = (t) => {
3126
+ var e = t, {
3127
+ children: s
3128
+ } = e, r = V(e, [
3129
+ "children"
3130
+ ]);
3131
+ return /* @__PURE__ */ n.jsx("p", G(Q({ className: "form--tc__description" }, r), { children: s }));
3132
+ }, Tr = (t) => {
3133
+ var e = t, { children: s } = e, r = V(e, ["children"]);
3134
+ return /* @__PURE__ */ n.jsx(
3135
+ "a",
3136
+ G(Q({
3137
+ className: "form--tc__link",
3138
+ target: "_blank",
3139
+ rel: "noreferrer",
3140
+ role: "button",
3141
+ download: !0
3142
+ }, r), {
3143
+ children: s
3144
+ })
3145
+ );
3146
+ }, Ur = ({ children: t }) => /* @__PURE__ */ n.jsx("h1", { className: "form--tc__title", children: t }), Qr = c.forwardRef(
3147
+ (t, e) => /* @__PURE__ */ n.jsx(M.Close, G(Q({ className: "hidden" }, t), { ref: e }))
3148
+ );
3149
+ Qr.displayName = "TermsAndConditionsClose";
3150
+ var qr = (t) => {
3151
+ var e = t, { children: s } = e, r = V(e, ["children"]);
3152
+ return /* @__PURE__ */ n.jsx("span", G(Q({ className: "form--tc__error", role: "alert" }, r), { children: s }));
3153
+ };
3154
+ const Br = () => {
3155
+ const { postTermsAndConditionsEndpoint: t } = H(), e = new We();
3156
+ return hs({
3157
+ mutationFn: async (r) => {
3158
+ const i = await fetch(t, {
3159
+ method: "post",
3160
+ body: JSON.stringify({ acceptedTC: r }),
3161
+ credentials: "include",
3162
+ mode: "cors"
3163
+ });
3164
+ if (!i.ok)
3165
+ throw new Error("Network response was not ok");
3166
+ return i;
3167
+ },
3168
+ onSuccess: async () => {
3169
+ await e.invalidateQueries({ queryKey: ["gdpr"] });
3170
+ }
3171
+ });
3172
+ }, Kr = () => {
3173
+ const { getTermsAndConditionsEndpoint: t } = H(), { authenticationStatus: e } = Ct(), s = xe.get("hasAcceptedLatestTermsAndConditions"), r = [], i = s === "true", o = e === D.Authenticated;
3174
+ return nt({
3175
+ queryKey: ["gdpr"],
3176
+ queryFn: async () => {
3177
+ const u = await fetch(t, {
3178
+ credentials: "include",
3179
+ mode: "cors"
3180
+ });
3181
+ if (!u.ok)
3182
+ throw new Error("Network response was not ok");
3183
+ return await u.json();
3184
+ },
3185
+ enabled: o && !i,
3186
+ initialData: r
3187
+ });
3188
+ }, Hr = ({ redirectUrl: t }) => {
3189
+ const { t: e } = z(), { apiUrl: s } = yt(), r = c.useRef(null), [i, o] = c.useState(0), [a, u] = c.useState({}), { mutate: l, isError: h } = Br(), { AccessibleFormMessage: d, formRef: p } = _t({ submitCount: i, errors: a }), { data: m } = Kr(), f = !!(m != null && m.length), C = e("termsAndConditions.error.required"), g = () => {
3190
+ var y;
3191
+ (y = r == null ? void 0 : r.current) == null || y.click(), document.body.style.removeProperty("overflow");
3192
+ };
3193
+ c.useEffect(() => {
3194
+ f && document.body.style.setProperty("overflow", "hidden");
3195
+ }, [f]), c.useEffect(() => {
3196
+ h && u({ acceptedTC: C });
3197
+ }, [C, h]);
3198
+ const v = (y) => {
3199
+ y.preventDefault(), o(i + 1);
3200
+ const { acceptedTC: _ } = y.target;
3201
+ if (_ instanceof RadioNodeList) {
3202
+ const j = Object.values(_);
3203
+ j.every((N) => N.checked) ? (u({}), l(j.map((N) => N.value)), g()) : u({ acceptedTC: C });
3204
+ } else
3205
+ _ != null && _.checked ? (u({}), l([_.value]), g()) : u({ acceptedTC: C });
3206
+ };
3207
+ return f ? /* @__PURE__ */ n.jsxs(M, { defaultOpen: f, isModal: !0, children: [
3208
+ d,
3209
+ /* @__PURE__ */ n.jsxs(M.Root, { children: [
3210
+ /* @__PURE__ */ n.jsx(M.Header, { children: /* @__PURE__ */ n.jsx(M.Title, { icon: /* @__PURE__ */ n.jsx(_e, { role: "presentation" }), children: /* @__PURE__ */ n.jsx(Ur, { children: e("termsAndConditions.title") }) }) }),
3211
+ /* @__PURE__ */ n.jsx(M.Body, { children: /* @__PURE__ */ n.jsxs(gt, { ref: p, id: "tc-form", onSubmit: v, children: [
3212
+ /* @__PURE__ */ n.jsxs(Ir, { children: [
3213
+ e("termsAndConditions.description"),
3214
+ a.acceptedTC && /* @__PURE__ */ n.jsx(qr, { children: C })
3215
+ ] }),
3216
+ m.map(({ tcCode: y, title: _, URL: j }) => /* @__PURE__ */ n.jsx(
3217
+ U,
3218
+ {
3219
+ id: y,
3220
+ value: y,
3221
+ name: "acceptedTC",
3222
+ variant: "primary",
3223
+ children: /* @__PURE__ */ n.jsxs(U.Content, { children: [
3224
+ /* @__PURE__ */ n.jsx(Dr, { children: _ }),
3225
+ /* @__PURE__ */ n.jsx(Tr, { href: j, children: e("termsAndConditions.action", { title: _ }) })
3226
+ ] })
3227
+ },
3228
+ y
3229
+ ))
3230
+ ] }) }),
3231
+ /* @__PURE__ */ n.jsxs(M.Footer, { children: [
3232
+ /* @__PURE__ */ n.jsx(
3233
+ "a",
3234
+ {
3235
+ className: S("button", "button--secondary", "button--terms-and-conditions"),
3236
+ href: `${s}/logout?redirectUrl=${t}`,
3237
+ children: e("logout")
3238
+ }
3239
+ ),
3240
+ /* @__PURE__ */ n.jsx(K, { form: "tc-form", type: "submit", variant: "primary", children: e("confirm") })
3241
+ ] })
3242
+ ] })
3243
+ ] }) : /* @__PURE__ */ n.jsx(n.Fragment, {});
3244
+ }, Gr = c.forwardRef(({ children: t, ...e }, s) => /* @__PURE__ */ n.jsx("form", { className: "form--tc", ref: s, ...e, children: t }));
3245
+ Gr.displayName = "TermsAndConditionsForm";
3246
+ const Vr = new We(), Wr = ({ environment: t, redirectUrl: e, apiUrl: s, position: r }) => /* @__PURE__ */ n.jsx(Rt, { environment: t, children: /* @__PURE__ */ n.jsx(wr, { apiUrl: s, redirectUrl: e, children: /* @__PURE__ */ n.jsxs(Xt, { client: Vr, children: [
3247
+ /* @__PURE__ */ n.jsx(Nr, { position: r }),
3248
+ /* @__PURE__ */ n.jsx(Hr, { redirectUrl: e })
3249
+ ] }) }) });
3250
+ export {
3251
+ Wr as default
3252
+ };