@myxtra/authentication-green 1.13.0 → 1.14.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,3387 +0,0 @@
1
- import { r as d, j as n, u as bt, g as wt, a as H, b as Qe, P as Se, c as jt, E as St } from "./index-44240dac.mjs";
2
- class V {
3
- constructor() {
4
- this.listeners = /* @__PURE__ */ new Set(), this.subscribe = this.subscribe.bind(this);
5
- }
6
- subscribe(t) {
7
- const s = {
8
- listener: t
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 Z = typeof window > "u" || "Deno" in window;
23
- function N() {
24
- }
25
- function Et(e, t) {
26
- return typeof e == "function" ? e(t) : e;
27
- }
28
- function ce(e) {
29
- return typeof e == "number" && e >= 0 && e !== 1 / 0;
30
- }
31
- function qe(e, t) {
32
- return Math.max(e + (t || 0) - Date.now(), 0);
33
- }
34
- function $(e, t, s) {
35
- return z(e) ? typeof t == "function" ? {
36
- ...s,
37
- queryKey: e,
38
- queryFn: t
39
- } : {
40
- ...t,
41
- queryKey: e
42
- } : e;
43
- }
44
- function Rt(e, t, s) {
45
- return z(e) ? typeof t == "function" ? {
46
- ...s,
47
- mutationKey: e,
48
- mutationFn: t
49
- } : {
50
- ...t,
51
- mutationKey: e
52
- } : typeof e == "function" ? {
53
- ...t,
54
- mutationFn: e
55
- } : {
56
- ...e
57
- };
58
- }
59
- function T(e, t, s) {
60
- return z(e) ? [{
61
- ...t,
62
- queryKey: e
63
- }, s] : [e || {}, t];
64
- }
65
- function Ee(e, t) {
66
- const {
67
- type: s = "all",
68
- exact: r,
69
- fetchStatus: i,
70
- predicate: a,
71
- queryKey: o,
72
- stale: l
73
- } = e;
74
- if (z(o)) {
75
- if (r) {
76
- if (t.queryHash !== Ce(o, t.options))
77
- return !1;
78
- } else if (!B(t.queryKey, o))
79
- return !1;
80
- }
81
- if (s !== "all") {
82
- const c = t.isActive();
83
- if (s === "active" && !c || s === "inactive" && c)
84
- return !1;
85
- }
86
- return !(typeof l == "boolean" && t.isStale() !== l || typeof i < "u" && i !== t.state.fetchStatus || a && !a(t));
87
- }
88
- function Re(e, t) {
89
- const {
90
- exact: s,
91
- fetching: r,
92
- predicate: i,
93
- mutationKey: a
94
- } = e;
95
- if (z(a)) {
96
- if (!t.options.mutationKey)
97
- return !1;
98
- if (s) {
99
- if (Q(t.options.mutationKey) !== Q(a))
100
- return !1;
101
- } else if (!B(t.options.mutationKey, a))
102
- return !1;
103
- }
104
- return !(typeof r == "boolean" && t.state.status === "loading" !== r || i && !i(t));
105
- }
106
- function Ce(e, t) {
107
- return ((t == null ? void 0 : t.queryKeyHashFn) || Q)(e);
108
- }
109
- function Q(e) {
110
- return JSON.stringify(e, (t, s) => ue(s) ? Object.keys(s).sort().reduce((r, i) => (r[i] = s[i], r), {}) : s);
111
- }
112
- function B(e, t) {
113
- return He(e, t);
114
- }
115
- function He(e, t) {
116
- return e === t ? !0 : typeof e != typeof t ? !1 : e && t && typeof e == "object" && typeof t == "object" ? !Object.keys(t).some((s) => !He(e[s], t[s])) : !1;
117
- }
118
- function Ke(e, t) {
119
- if (e === t)
120
- return e;
121
- const s = Pe(e) && Pe(t);
122
- if (s || ue(e) && ue(t)) {
123
- const r = s ? e.length : Object.keys(e).length, i = s ? t : Object.keys(t), a = i.length, o = s ? [] : {};
124
- let l = 0;
125
- for (let c = 0; c < a; c++) {
126
- const h = s ? c : i[c];
127
- o[h] = Ke(e[h], t[h]), o[h] === e[h] && l++;
128
- }
129
- return r === a && l === r ? e : o;
130
- }
131
- return t;
132
- }
133
- function ee(e, t) {
134
- if (e && !t || t && !e)
135
- return !1;
136
- for (const s in e)
137
- if (e[s] !== t[s])
138
- return !1;
139
- return !0;
140
- }
141
- function Pe(e) {
142
- return Array.isArray(e) && e.length === Object.keys(e).length;
143
- }
144
- function ue(e) {
145
- if (!_e(e))
146
- return !1;
147
- const t = e.constructor;
148
- if (typeof t > "u")
149
- return !0;
150
- const s = t.prototype;
151
- return !(!_e(s) || !s.hasOwnProperty("isPrototypeOf"));
152
- }
153
- function _e(e) {
154
- return Object.prototype.toString.call(e) === "[object Object]";
155
- }
156
- function z(e) {
157
- return Array.isArray(e);
158
- }
159
- function Ve(e) {
160
- return new Promise((t) => {
161
- setTimeout(t, e);
162
- });
163
- }
164
- function Ae(e) {
165
- Ve(0).then(e);
166
- }
167
- function Pt() {
168
- if (typeof AbortController == "function")
169
- return new AbortController();
170
- }
171
- function de(e, t, s) {
172
- return s.isDataEqual != null && s.isDataEqual(e, t) ? e : typeof s.structuralSharing == "function" ? s.structuralSharing(e, t) : s.structuralSharing !== !1 ? Ke(e, t) : t;
173
- }
174
- class _t extends V {
175
- constructor() {
176
- super(), this.setup = (t) => {
177
- if (!Z && window.addEventListener) {
178
- const s = () => t();
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 t;
191
- (t = this.cleanup) == null || t.call(this), this.cleanup = void 0;
192
- }
193
- }
194
- setEventListener(t) {
195
- var s;
196
- this.setup = t, (s = this.cleanup) == null || s.call(this), this.cleanup = t((r) => {
197
- typeof r == "boolean" ? this.setFocused(r) : this.onFocus();
198
- });
199
- }
200
- setFocused(t) {
201
- this.focused !== t && (this.focused = t, this.onFocus());
202
- }
203
- onFocus() {
204
- this.listeners.forEach(({
205
- listener: t
206
- }) => {
207
- t();
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 te = new _t(), Oe = ["online", "offline"];
215
- class At extends V {
216
- constructor() {
217
- super(), this.setup = (t) => {
218
- if (!Z && window.addEventListener) {
219
- const s = () => t();
220
- return Oe.forEach((r) => {
221
- window.addEventListener(r, s, !1);
222
- }), () => {
223
- Oe.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 t;
236
- (t = this.cleanup) == null || t.call(this), this.cleanup = void 0;
237
- }
238
- }
239
- setEventListener(t) {
240
- var s;
241
- this.setup = t, (s = this.cleanup) == null || s.call(this), this.cleanup = t((r) => {
242
- typeof r == "boolean" ? this.setOnline(r) : this.onOnline();
243
- });
244
- }
245
- setOnline(t) {
246
- this.online !== t && (this.online = t, this.onOnline());
247
- }
248
- onOnline() {
249
- this.listeners.forEach(({
250
- listener: t
251
- }) => {
252
- t();
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 se = new At();
260
- function Ot(e) {
261
- return Math.min(1e3 * 2 ** e, 3e4);
262
- }
263
- function ae(e) {
264
- return (e ?? "online") === "online" ? se.isOnline() : !0;
265
- }
266
- class Ge {
267
- constructor(t) {
268
- this.revert = t == null ? void 0 : t.revert, this.silent = t == null ? void 0 : t.silent;
269
- }
270
- }
271
- function I(e) {
272
- return e instanceof Ge;
273
- }
274
- function We(e) {
275
- let t = !1, s = 0, r = !1, i, a, o;
276
- const l = new Promise((v, y) => {
277
- a = v, o = y;
278
- }), c = (v) => {
279
- r || (p(new Ge(v)), e.abort == null || e.abort());
280
- }, h = () => {
281
- t = !0;
282
- }, u = () => {
283
- t = !1;
284
- }, f = () => !te.isFocused() || e.networkMode !== "always" && !se.isOnline(), m = (v) => {
285
- r || (r = !0, e.onSuccess == null || e.onSuccess(v), i == null || i(), a(v));
286
- }, p = (v) => {
287
- r || (r = !0, e.onError == null || e.onError(v), i == null || i(), o(v));
288
- }, g = () => new Promise((v) => {
289
- i = (y) => {
290
- const _ = r || !f();
291
- return _ && v(y), _;
292
- }, e.onPause == null || e.onPause();
293
- }).then(() => {
294
- i = void 0, r || e.onContinue == null || e.onContinue();
295
- }), b = () => {
296
- if (r)
297
- return;
298
- let v;
299
- try {
300
- v = e.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 S = (_ = e.retry) != null ? _ : 3, M = (j = e.retryDelay) != null ? j : Ot, E = typeof M == "function" ? M(s, y) : M, w = S === !0 || typeof S == "number" && s < S || typeof S == "function" && S(s, y);
309
- if (t || !w) {
310
- p(y);
311
- return;
312
- }
313
- s++, e.onFail == null || e.onFail(s, y), Ve(E).then(() => {
314
- if (f())
315
- return g();
316
- }).then(() => {
317
- t ? p(y) : b();
318
- });
319
- });
320
- };
321
- return ae(e.networkMode) ? b() : g().then(b), {
322
- promise: l,
323
- cancel: c,
324
- continue: () => (i == null ? void 0 : i()) ? l : Promise.resolve(),
325
- cancelRetry: h,
326
- continueRetry: u
327
- };
328
- }
329
- const ge = console;
330
- function kt() {
331
- let e = [], t = 0, s = (u) => {
332
- u();
333
- }, r = (u) => {
334
- u();
335
- };
336
- const i = (u) => {
337
- let f;
338
- t++;
339
- try {
340
- f = u();
341
- } finally {
342
- t--, t || l();
343
- }
344
- return f;
345
- }, a = (u) => {
346
- t ? e.push(u) : Ae(() => {
347
- s(u);
348
- });
349
- }, o = (u) => (...f) => {
350
- a(() => {
351
- u(...f);
352
- });
353
- }, l = () => {
354
- const u = e;
355
- e = [], u.length && Ae(() => {
356
- r(() => {
357
- u.forEach((f) => {
358
- s(f);
359
- });
360
- });
361
- });
362
- };
363
- return {
364
- batch: i,
365
- batchCalls: o,
366
- schedule: a,
367
- setNotifyFunction: (u) => {
368
- s = u;
369
- },
370
- setBatchNotifyFunction: (u) => {
371
- r = u;
372
- }
373
- };
374
- }
375
- const A = kt();
376
- class $e {
377
- destroy() {
378
- this.clearGcTimeout();
379
- }
380
- scheduleGc() {
381
- this.clearGcTimeout(), ce(this.cacheTime) && (this.gcTimeout = setTimeout(() => {
382
- this.optionalRemove();
383
- }, this.cacheTime));
384
- }
385
- updateCacheTime(t) {
386
- this.cacheTime = Math.max(this.cacheTime || 0, t ?? (Z ? 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(t) {
394
- super(), this.abortSignalConsumed = !1, this.defaultOptions = t.defaultOptions, this.setOptions(t.options), this.observers = [], this.cache = t.cache, this.logger = t.logger || ge, this.queryKey = t.queryKey, this.queryHash = t.queryHash, this.initialState = t.state || Mt(this.options), this.state = this.initialState, this.scheduleGc();
395
- }
396
- get meta() {
397
- return this.options.meta;
398
- }
399
- setOptions(t) {
400
- this.options = {
401
- ...this.defaultOptions,
402
- ...t
403
- }, this.updateCacheTime(this.options.cacheTime);
404
- }
405
- optionalRemove() {
406
- !this.observers.length && this.state.fetchStatus === "idle" && this.cache.remove(this);
407
- }
408
- setData(t, s) {
409
- const r = de(this.state.data, t, 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(t, s) {
418
- this.dispatch({
419
- type: "setState",
420
- state: t,
421
- setStateOptions: s
422
- });
423
- }
424
- cancel(t) {
425
- var s;
426
- const r = this.promise;
427
- return (s = this.retryer) == null || s.cancel(t), r ? r.then(N).catch(N) : 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((t) => t.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((t) => t.getCurrentResult().isStale);
445
- }
446
- isStaleByTime(t = 0) {
447
- return this.state.isInvalidated || !this.state.dataUpdatedAt || !qe(this.state.dataUpdatedAt, t);
448
- }
449
- onFocus() {
450
- var t;
451
- const s = this.observers.find((r) => r.shouldFetchOnWindowFocus());
452
- s && s.refetch({
453
- cancelRefetch: !1
454
- }), (t = this.retryer) == null || t.continue();
455
- }
456
- onOnline() {
457
- var t;
458
- const s = this.observers.find((r) => r.shouldFetchOnReconnect());
459
- s && s.refetch({
460
- cancelRefetch: !1
461
- }), (t = this.retryer) == null || t.continue();
462
- }
463
- addObserver(t) {
464
- this.observers.includes(t) || (this.observers.push(t), this.clearGcTimeout(), this.cache.notify({
465
- type: "observerAdded",
466
- query: this,
467
- observer: t
468
- }));
469
- }
470
- removeObserver(t) {
471
- this.observers.includes(t) && (this.observers = this.observers.filter((s) => s !== t), 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: t
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(t, 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 a;
496
- return (a = this.retryer) == null || a.continueRetry(), this.promise;
497
- }
498
- }
499
- if (t && this.setOptions(t), !this.options.queryFn) {
500
- const p = this.observers.find((g) => g.options.queryFn);
501
- p && this.setOptions(p.options);
502
- }
503
- const o = Pt(), l = {
504
- queryKey: this.queryKey,
505
- pageParam: void 0,
506
- meta: this.meta
507
- }, c = (p) => {
508
- Object.defineProperty(p, "signal", {
509
- enumerable: !0,
510
- get: () => {
511
- if (o)
512
- return this.abortSignalConsumed = !0, o.signal;
513
- }
514
- });
515
- };
516
- c(l);
517
- const h = () => this.options.queryFn ? (this.abortSignalConsumed = !1, this.options.queryFn(l)) : Promise.reject("Missing queryFn for queryKey '" + this.options.queryHash + "'"), u = {
518
- fetchOptions: s,
519
- options: this.options,
520
- queryKey: this.queryKey,
521
- state: this.state,
522
- fetchFn: h
523
- };
524
- if (c(u), (r = this.options.behavior) == null || r.onFetch(u), this.revertState = this.state, this.state.fetchStatus === "idle" || this.state.fetchMeta !== ((i = u.fetchOptions) == null ? void 0 : i.meta)) {
525
- var f;
526
- this.dispatch({
527
- type: "fetch",
528
- meta: (f = u.fetchOptions) == null ? void 0 : f.meta
529
- });
530
- }
531
- const m = (p) => {
532
- if (I(p) && p.silent || this.dispatch({
533
- type: "error",
534
- error: p
535
- }), !I(p)) {
536
- var g, b, v, y;
537
- (g = (b = this.cache.config).onError) == null || g.call(b, p, this), (v = (y = this.cache.config).onSettled) == null || v.call(y, this.state.data, p, this);
538
- }
539
- this.isFetchingOptimistic || this.scheduleGc(), this.isFetchingOptimistic = !1;
540
- };
541
- return this.retryer = We({
542
- fn: u.fetchFn,
543
- abort: o == null ? void 0 : o.abort.bind(o),
544
- onSuccess: (p) => {
545
- var g, b, v, y;
546
- if (typeof p > "u") {
547
- m(new Error(this.queryHash + " data is undefined"));
548
- return;
549
- }
550
- this.setData(p), (g = (b = this.cache.config).onSuccess) == null || g.call(b, p, this), (v = (y = this.cache.config).onSettled) == null || v.call(y, p, this.state.error, this), this.isFetchingOptimistic || this.scheduleGc(), this.isFetchingOptimistic = !1;
551
- },
552
- onError: m,
553
- onFail: (p, g) => {
554
- this.dispatch({
555
- type: "failed",
556
- failureCount: p,
557
- error: g
558
- });
559
- },
560
- onPause: () => {
561
- this.dispatch({
562
- type: "pause"
563
- });
564
- },
565
- onContinue: () => {
566
- this.dispatch({
567
- type: "continue"
568
- });
569
- },
570
- retry: u.options.retry,
571
- retryDelay: u.options.retryDelay,
572
- networkMode: u.options.networkMode
573
- }), this.promise = this.retryer.promise, this.promise;
574
- }
575
- dispatch(t) {
576
- const s = (r) => {
577
- var i, a;
578
- switch (t.type) {
579
- case "failed":
580
- return {
581
- ...r,
582
- fetchFailureCount: t.failureCount,
583
- fetchFailureReason: t.error
584
- };
585
- case "pause":
586
- return {
587
- ...r,
588
- fetchStatus: "paused"
589
- };
590
- case "continue":
591
- return {
592
- ...r,
593
- fetchStatus: "fetching"
594
- };
595
- case "fetch":
596
- return {
597
- ...r,
598
- fetchFailureCount: 0,
599
- fetchFailureReason: null,
600
- fetchMeta: (i = t.meta) != null ? i : null,
601
- fetchStatus: ae(this.options.networkMode) ? "fetching" : "paused",
602
- ...!r.dataUpdatedAt && {
603
- error: null,
604
- status: "loading"
605
- }
606
- };
607
- case "success":
608
- return {
609
- ...r,
610
- data: t.data,
611
- dataUpdateCount: r.dataUpdateCount + 1,
612
- dataUpdatedAt: (a = t.dataUpdatedAt) != null ? a : Date.now(),
613
- error: null,
614
- isInvalidated: !1,
615
- status: "success",
616
- ...!t.manual && {
617
- fetchStatus: "idle",
618
- fetchFailureCount: 0,
619
- fetchFailureReason: null
620
- }
621
- };
622
- case "error":
623
- const o = t.error;
624
- return I(o) && o.revert && this.revertState ? {
625
- ...this.revertState,
626
- fetchStatus: "idle"
627
- } : {
628
- ...r,
629
- error: o,
630
- errorUpdateCount: r.errorUpdateCount + 1,
631
- errorUpdatedAt: Date.now(),
632
- fetchFailureCount: r.fetchFailureCount + 1,
633
- fetchFailureReason: o,
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
- ...t.state
646
- };
647
- }
648
- };
649
- this.state = s(this.state), A.batch(() => {
650
- this.observers.forEach((r) => {
651
- r.onQueryUpdate(t);
652
- }), this.cache.notify({
653
- query: this,
654
- type: "updated",
655
- action: t
656
- });
657
- });
658
- }
659
- }
660
- function Mt(e) {
661
- const t = typeof e.initialData == "function" ? e.initialData() : e.initialData, s = typeof t < "u", r = s ? typeof e.initialDataUpdatedAt == "function" ? e.initialDataUpdatedAt() : e.initialDataUpdatedAt : 0;
662
- return {
663
- data: t,
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 Nt extends V {
678
- constructor(t) {
679
- super(), this.config = t || {}, this.queries = [], this.queriesMap = {};
680
- }
681
- build(t, s, r) {
682
- var i;
683
- const a = s.queryKey, o = (i = s.queryHash) != null ? i : Ce(a, s);
684
- let l = this.get(o);
685
- return l || (l = new Ft({
686
- cache: this,
687
- logger: t.getLogger(),
688
- queryKey: a,
689
- queryHash: o,
690
- options: t.defaultQueryOptions(s),
691
- state: r,
692
- defaultOptions: t.getQueryDefaults(a)
693
- }), this.add(l)), l;
694
- }
695
- add(t) {
696
- this.queriesMap[t.queryHash] || (this.queriesMap[t.queryHash] = t, this.queries.push(t), this.notify({
697
- type: "added",
698
- query: t
699
- }));
700
- }
701
- remove(t) {
702
- const s = this.queriesMap[t.queryHash];
703
- s && (t.destroy(), this.queries = this.queries.filter((r) => r !== t), s === t && delete this.queriesMap[t.queryHash], this.notify({
704
- type: "removed",
705
- query: t
706
- }));
707
- }
708
- clear() {
709
- A.batch(() => {
710
- this.queries.forEach((t) => {
711
- this.remove(t);
712
- });
713
- });
714
- }
715
- get(t) {
716
- return this.queriesMap[t];
717
- }
718
- getAll() {
719
- return this.queries;
720
- }
721
- find(t, s) {
722
- const [r] = T(t, s);
723
- return typeof r.exact > "u" && (r.exact = !0), this.queries.find((i) => Ee(r, i));
724
- }
725
- findAll(t, s) {
726
- const [r] = T(t, s);
727
- return Object.keys(r).length > 0 ? this.queries.filter((i) => Ee(r, i)) : this.queries;
728
- }
729
- notify(t) {
730
- A.batch(() => {
731
- this.listeners.forEach(({
732
- listener: s
733
- }) => {
734
- s(t);
735
- });
736
- });
737
- }
738
- onFocus() {
739
- A.batch(() => {
740
- this.queries.forEach((t) => {
741
- t.onFocus();
742
- });
743
- });
744
- }
745
- onOnline() {
746
- A.batch(() => {
747
- this.queries.forEach((t) => {
748
- t.onOnline();
749
- });
750
- });
751
- }
752
- }
753
- class Lt extends $e {
754
- constructor(t) {
755
- super(), this.defaultOptions = t.defaultOptions, this.mutationId = t.mutationId, this.mutationCache = t.mutationCache, this.logger = t.logger || ge, this.observers = [], this.state = t.state || Ze(), this.setOptions(t.options), this.scheduleGc();
756
- }
757
- setOptions(t) {
758
- this.options = {
759
- ...this.defaultOptions,
760
- ...t
761
- }, this.updateCacheTime(this.options.cacheTime);
762
- }
763
- get meta() {
764
- return this.options.meta;
765
- }
766
- setState(t) {
767
- this.dispatch({
768
- type: "setState",
769
- state: t
770
- });
771
- }
772
- addObserver(t) {
773
- this.observers.includes(t) || (this.observers.push(t), this.clearGcTimeout(), this.mutationCache.notify({
774
- type: "observerAdded",
775
- mutation: this,
776
- observer: t
777
- }));
778
- }
779
- removeObserver(t) {
780
- this.observers = this.observers.filter((s) => s !== t), this.scheduleGc(), this.mutationCache.notify({
781
- type: "observerRemoved",
782
- mutation: this,
783
- observer: t
784
- });
785
- }
786
- optionalRemove() {
787
- this.observers.length || (this.state.status === "loading" ? this.scheduleGc() : this.mutationCache.remove(this));
788
- }
789
- continue() {
790
- var t, s;
791
- return (t = (s = this.retryer) == null ? void 0 : s.continue()) != null ? t : this.execute();
792
- }
793
- async execute() {
794
- const t = () => {
795
- var w;
796
- return this.retryer = We({
797
- fn: () => this.options.mutationFn ? this.options.mutationFn(this.state.variables) : Promise.reject("No mutationFn found"),
798
- onFail: (x, k) => {
799
- this.dispatch({
800
- type: "failed",
801
- failureCount: x,
802
- error: k
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, a, o, l, c, h, u;
822
- if (!s) {
823
- var f, m, p, g;
824
- this.dispatch({
825
- type: "loading",
826
- variables: this.options.variables
827
- }), await ((f = (m = this.mutationCache.config).onMutate) == null ? void 0 : f.call(m, this.state.variables, this));
828
- const x = await ((p = (g = this.options).onMutate) == null ? void 0 : p.call(g, this.state.variables));
829
- x !== this.state.context && this.dispatch({
830
- type: "loading",
831
- context: x,
832
- variables: this.state.variables
833
- });
834
- }
835
- const w = await t();
836
- return await ((r = (i = this.mutationCache.config).onSuccess) == null ? void 0 : r.call(i, w, this.state.variables, this.state.context, this)), await ((a = (o = this.options).onSuccess) == null ? void 0 : a.call(o, w, this.state.variables, this.state.context)), await ((l = (c = this.mutationCache.config).onSettled) == null ? void 0 : l.call(c, w, null, this.state.variables, this.state.context, this)), await ((h = (u = this.options).onSettled) == null ? void 0 : h.call(u, 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 b, v, y, _, j, S, M, E;
843
- throw await ((b = (v = this.mutationCache.config).onError) == null ? void 0 : b.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 = (S = this.mutationCache.config).onSettled) == null ? void 0 : j.call(S, void 0, w, this.state.variables, this.state.context, this)), await ((M = (E = this.options).onSettled) == null ? void 0 : M.call(E, 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(t) {
853
- const s = (r) => {
854
- switch (t.type) {
855
- case "failed":
856
- return {
857
- ...r,
858
- failureCount: t.failureCount,
859
- failureReason: t.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: t.context,
875
- data: void 0,
876
- failureCount: 0,
877
- failureReason: null,
878
- error: null,
879
- isPaused: !ae(this.options.networkMode),
880
- status: "loading",
881
- variables: t.variables
882
- };
883
- case "success":
884
- return {
885
- ...r,
886
- data: t.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: t.error,
898
- failureCount: r.failureCount + 1,
899
- failureReason: t.error,
900
- isPaused: !1,
901
- status: "error"
902
- };
903
- case "setState":
904
- return {
905
- ...r,
906
- ...t.state
907
- };
908
- }
909
- };
910
- this.state = s(this.state), A.batch(() => {
911
- this.observers.forEach((r) => {
912
- r.onMutationUpdate(t);
913
- }), this.mutationCache.notify({
914
- mutation: this,
915
- type: "updated",
916
- action: t
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 Dt extends V {
934
- constructor(t) {
935
- super(), this.config = t || {}, this.mutations = [], this.mutationId = 0;
936
- }
937
- build(t, s, r) {
938
- const i = new Lt({
939
- mutationCache: this,
940
- logger: t.getLogger(),
941
- mutationId: ++this.mutationId,
942
- options: t.defaultMutationOptions(s),
943
- state: r,
944
- defaultOptions: s.mutationKey ? t.getMutationDefaults(s.mutationKey) : void 0
945
- });
946
- return this.add(i), i;
947
- }
948
- add(t) {
949
- this.mutations.push(t), this.notify({
950
- type: "added",
951
- mutation: t
952
- });
953
- }
954
- remove(t) {
955
- this.mutations = this.mutations.filter((s) => s !== t), this.notify({
956
- type: "removed",
957
- mutation: t
958
- });
959
- }
960
- clear() {
961
- A.batch(() => {
962
- this.mutations.forEach((t) => {
963
- this.remove(t);
964
- });
965
- });
966
- }
967
- getAll() {
968
- return this.mutations;
969
- }
970
- find(t) {
971
- return typeof t.exact > "u" && (t.exact = !0), this.mutations.find((s) => Re(t, s));
972
- }
973
- findAll(t) {
974
- return this.mutations.filter((s) => Re(t, s));
975
- }
976
- notify(t) {
977
- A.batch(() => {
978
- this.listeners.forEach(({
979
- listener: s
980
- }) => {
981
- s(t);
982
- });
983
- });
984
- }
985
- resumePausedMutations() {
986
- var t;
987
- return this.resuming = ((t = this.resuming) != null ? t : Promise.resolve()).then(() => {
988
- const s = this.mutations.filter((r) => r.state.isPaused);
989
- return A.batch(() => s.reduce((r, i) => r.then(() => i.continue().catch(N)), Promise.resolve()));
990
- }).then(() => {
991
- this.resuming = void 0;
992
- }), this.resuming;
993
- }
994
- }
995
- function Tt() {
996
- return {
997
- onFetch: (e) => {
998
- e.fetchFn = () => {
999
- var t, s, r, i, a, o;
1000
- const l = (t = e.fetchOptions) == null || (s = t.meta) == null ? void 0 : s.refetchPage, c = (r = e.fetchOptions) == null || (i = r.meta) == null ? void 0 : i.fetchMore, h = c == null ? void 0 : c.pageParam, u = (c == null ? void 0 : c.direction) === "forward", f = (c == null ? void 0 : c.direction) === "backward", m = ((a = e.state.data) == null ? void 0 : a.pages) || [], p = ((o = e.state.data) == null ? void 0 : o.pageParams) || [];
1001
- let g = p, b = !1;
1002
- const v = (E) => {
1003
- Object.defineProperty(E, "signal", {
1004
- enumerable: !0,
1005
- get: () => {
1006
- var w;
1007
- if ((w = e.signal) != null && w.aborted)
1008
- b = !0;
1009
- else {
1010
- var x;
1011
- (x = e.signal) == null || x.addEventListener("abort", () => {
1012
- b = !0;
1013
- });
1014
- }
1015
- return e.signal;
1016
- }
1017
- });
1018
- }, y = e.options.queryFn || (() => Promise.reject("Missing queryFn for queryKey '" + e.options.queryHash + "'")), _ = (E, w, x, k) => (g = k ? [w, ...g] : [...g, w], k ? [x, ...E] : [...E, x]), j = (E, w, x, k) => {
1019
- if (b)
1020
- return Promise.reject("Cancelled");
1021
- if (typeof x > "u" && !w && E.length)
1022
- return Promise.resolve(E);
1023
- const W = {
1024
- queryKey: e.queryKey,
1025
- pageParam: x,
1026
- meta: e.options.meta
1027
- };
1028
- v(W);
1029
- const oe = y(W);
1030
- return Promise.resolve(oe).then((xt) => _(E, x, xt, k));
1031
- };
1032
- let S;
1033
- if (!m.length)
1034
- S = j([]);
1035
- else if (u) {
1036
- const E = typeof h < "u", w = E ? h : ke(e.options, m);
1037
- S = j(m, E, w);
1038
- } else if (f) {
1039
- const E = typeof h < "u", w = E ? h : Ut(e.options, m);
1040
- S = j(m, E, w, !0);
1041
- } else {
1042
- g = [];
1043
- const E = typeof e.options.getNextPageParam > "u";
1044
- S = (l && m[0] ? l(m[0], 0, m) : !0) ? j([], E, p[0]) : Promise.resolve(_([], p[0], m[0]));
1045
- for (let x = 1; x < m.length; x++)
1046
- S = S.then((k) => {
1047
- if (l && m[x] ? l(m[x], x, m) : !0) {
1048
- const oe = E ? p[x] : ke(e.options, k);
1049
- return j(k, E, oe);
1050
- }
1051
- return Promise.resolve(_(k, p[x], m[x]));
1052
- });
1053
- }
1054
- return S.then((E) => ({
1055
- pages: E,
1056
- pageParams: g
1057
- }));
1058
- };
1059
- }
1060
- };
1061
- }
1062
- function ke(e, t) {
1063
- return e.getNextPageParam == null ? void 0 : e.getNextPageParam(t[t.length - 1], t);
1064
- }
1065
- function Ut(e, t) {
1066
- return e.getPreviousPageParam == null ? void 0 : e.getPreviousPageParam(t[0], t);
1067
- }
1068
- class ze {
1069
- constructor(t = {}) {
1070
- this.queryCache = t.queryCache || new Nt(), this.mutationCache = t.mutationCache || new Dt(), this.logger = t.logger || ge, this.defaultOptions = t.defaultOptions || {}, this.queryDefaults = [], this.mutationDefaults = [], this.mountCount = 0;
1071
- }
1072
- mount() {
1073
- this.mountCount++, this.mountCount === 1 && (this.unsubscribeFocus = te.subscribe(() => {
1074
- te.isFocused() && (this.resumePausedMutations(), this.queryCache.onFocus());
1075
- }), this.unsubscribeOnline = se.subscribe(() => {
1076
- se.isOnline() && (this.resumePausedMutations(), this.queryCache.onOnline());
1077
- }));
1078
- }
1079
- unmount() {
1080
- var t, s;
1081
- this.mountCount--, this.mountCount === 0 && ((t = this.unsubscribeFocus) == null || t.call(this), this.unsubscribeFocus = void 0, (s = this.unsubscribeOnline) == null || s.call(this), this.unsubscribeOnline = void 0);
1082
- }
1083
- isFetching(t, s) {
1084
- const [r] = T(t, s);
1085
- return r.fetchStatus = "fetching", this.queryCache.findAll(r).length;
1086
- }
1087
- isMutating(t) {
1088
- return this.mutationCache.findAll({
1089
- ...t,
1090
- fetching: !0
1091
- }).length;
1092
- }
1093
- getQueryData(t, s) {
1094
- var r;
1095
- return (r = this.queryCache.find(t, s)) == null ? void 0 : r.state.data;
1096
- }
1097
- ensureQueryData(t, s, r) {
1098
- const i = $(t, s, r), a = this.getQueryData(i.queryKey);
1099
- return a ? Promise.resolve(a) : this.fetchQuery(i);
1100
- }
1101
- getQueriesData(t) {
1102
- return this.getQueryCache().findAll(t).map(({
1103
- queryKey: s,
1104
- state: r
1105
- }) => {
1106
- const i = r.data;
1107
- return [s, i];
1108
- });
1109
- }
1110
- setQueryData(t, s, r) {
1111
- const i = this.queryCache.find(t), a = i == null ? void 0 : i.state.data, o = Et(s, a);
1112
- if (typeof o > "u")
1113
- return;
1114
- const l = $(t), c = this.defaultQueryOptions(l);
1115
- return this.queryCache.build(this, c).setData(o, {
1116
- ...r,
1117
- manual: !0
1118
- });
1119
- }
1120
- setQueriesData(t, s, r) {
1121
- return A.batch(() => this.getQueryCache().findAll(t).map(({
1122
- queryKey: i
1123
- }) => [i, this.setQueryData(i, s, r)]));
1124
- }
1125
- getQueryState(t, s) {
1126
- var r;
1127
- return (r = this.queryCache.find(t, s)) == null ? void 0 : r.state;
1128
- }
1129
- removeQueries(t, s) {
1130
- const [r] = T(t, s), i = this.queryCache;
1131
- A.batch(() => {
1132
- i.findAll(r).forEach((a) => {
1133
- i.remove(a);
1134
- });
1135
- });
1136
- }
1137
- resetQueries(t, s, r) {
1138
- const [i, a] = T(t, s, r), o = this.queryCache, l = {
1139
- type: "active",
1140
- ...i
1141
- };
1142
- return A.batch(() => (o.findAll(i).forEach((c) => {
1143
- c.reset();
1144
- }), this.refetchQueries(l, a)));
1145
- }
1146
- cancelQueries(t, s, r) {
1147
- const [i, a = {}] = T(t, s, r);
1148
- typeof a.revert > "u" && (a.revert = !0);
1149
- const o = A.batch(() => this.queryCache.findAll(i).map((l) => l.cancel(a)));
1150
- return Promise.all(o).then(N).catch(N);
1151
- }
1152
- invalidateQueries(t, s, r) {
1153
- const [i, a] = T(t, s, r);
1154
- return A.batch(() => {
1155
- var o, l;
1156
- if (this.queryCache.findAll(i).forEach((h) => {
1157
- h.invalidate();
1158
- }), i.refetchType === "none")
1159
- return Promise.resolve();
1160
- const c = {
1161
- ...i,
1162
- type: (o = (l = i.refetchType) != null ? l : i.type) != null ? o : "active"
1163
- };
1164
- return this.refetchQueries(c, a);
1165
- });
1166
- }
1167
- refetchQueries(t, s, r) {
1168
- const [i, a] = T(t, s, r), o = A.batch(() => this.queryCache.findAll(i).filter((c) => !c.isDisabled()).map((c) => {
1169
- var h;
1170
- return c.fetch(void 0, {
1171
- ...a,
1172
- cancelRefetch: (h = a == null ? void 0 : a.cancelRefetch) != null ? h : !0,
1173
- meta: {
1174
- refetchPage: i.refetchPage
1175
- }
1176
- });
1177
- }));
1178
- let l = Promise.all(o).then(N);
1179
- return a != null && a.throwOnError || (l = l.catch(N)), l;
1180
- }
1181
- fetchQuery(t, s, r) {
1182
- const i = $(t, s, r), a = this.defaultQueryOptions(i);
1183
- typeof a.retry > "u" && (a.retry = !1);
1184
- const o = this.queryCache.build(this, a);
1185
- return o.isStaleByTime(a.staleTime) ? o.fetch(a) : Promise.resolve(o.state.data);
1186
- }
1187
- prefetchQuery(t, s, r) {
1188
- return this.fetchQuery(t, s, r).then(N).catch(N);
1189
- }
1190
- fetchInfiniteQuery(t, s, r) {
1191
- const i = $(t, s, r);
1192
- return i.behavior = Tt(), this.fetchQuery(i);
1193
- }
1194
- prefetchInfiniteQuery(t, s, r) {
1195
- return this.fetchInfiniteQuery(t, s, r).then(N).catch(N);
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(t) {
1213
- this.defaultOptions = t;
1214
- }
1215
- setQueryDefaults(t, s) {
1216
- const r = this.queryDefaults.find((i) => Q(t) === Q(i.queryKey));
1217
- r ? r.defaultOptions = s : this.queryDefaults.push({
1218
- queryKey: t,
1219
- defaultOptions: s
1220
- });
1221
- }
1222
- getQueryDefaults(t) {
1223
- if (!t)
1224
- return;
1225
- const s = this.queryDefaults.find((r) => B(t, r.queryKey));
1226
- return s == null ? void 0 : s.defaultOptions;
1227
- }
1228
- setMutationDefaults(t, s) {
1229
- const r = this.mutationDefaults.find((i) => Q(t) === Q(i.mutationKey));
1230
- r ? r.defaultOptions = s : this.mutationDefaults.push({
1231
- mutationKey: t,
1232
- defaultOptions: s
1233
- });
1234
- }
1235
- getMutationDefaults(t) {
1236
- if (!t)
1237
- return;
1238
- const s = this.mutationDefaults.find((r) => B(t, r.mutationKey));
1239
- return s == null ? void 0 : s.defaultOptions;
1240
- }
1241
- defaultQueryOptions(t) {
1242
- if (t != null && t._defaulted)
1243
- return t;
1244
- const s = {
1245
- ...this.defaultOptions.queries,
1246
- ...this.getQueryDefaults(t == null ? void 0 : t.queryKey),
1247
- ...t,
1248
- _defaulted: !0
1249
- };
1250
- return !s.queryHash && s.queryKey && (s.queryHash = Ce(s.queryKey, s)), typeof s.refetchOnReconnect > "u" && (s.refetchOnReconnect = s.networkMode !== "always"), typeof s.useErrorBoundary > "u" && (s.useErrorBoundary = !!s.suspense), s;
1251
- }
1252
- defaultMutationOptions(t) {
1253
- return t != null && t._defaulted ? t : {
1254
- ...this.defaultOptions.mutations,
1255
- ...this.getMutationDefaults(t == null ? void 0 : t.mutationKey),
1256
- ...t,
1257
- _defaulted: !0
1258
- };
1259
- }
1260
- clear() {
1261
- this.queryCache.clear(), this.mutationCache.clear();
1262
- }
1263
- }
1264
- class Qt extends V {
1265
- constructor(t, s) {
1266
- super(), this.client = t, 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 he(this.currentQuery, this.options, this.options.refetchOnReconnect);
1279
- }
1280
- shouldFetchOnWindowFocus() {
1281
- return he(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(t, s) {
1287
- const r = this.options, i = this.currentQuery;
1288
- if (this.options = this.client.defaultQueryOptions(t), ee(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 a = this.hasListeners();
1296
- a && Me(this.currentQuery, i, this.options, r) && this.executeFetch(), this.updateResult(s), a && (this.currentQuery !== i || this.options.enabled !== r.enabled || this.options.staleTime !== r.staleTime) && this.updateStaleTimeout();
1297
- const o = this.computeRefetchInterval();
1298
- a && (this.currentQuery !== i || this.options.enabled !== r.enabled || o !== this.currentRefetchInterval) && this.updateRefetchInterval(o);
1299
- }
1300
- getOptimisticResult(t) {
1301
- const s = this.client.getQueryCache().build(this.client, t), r = this.createResult(s, t);
1302
- return Ht(this, r, t) && (this.currentResult = r, this.currentResultOptions = this.options, this.currentResultState = this.currentQuery.state), r;
1303
- }
1304
- getCurrentResult() {
1305
- return this.currentResult;
1306
- }
1307
- trackResult(t) {
1308
- const s = {};
1309
- return Object.keys(t).forEach((r) => {
1310
- Object.defineProperty(s, r, {
1311
- configurable: !1,
1312
- enumerable: !0,
1313
- get: () => (this.trackedProps.add(r), t[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: t,
1325
- ...s
1326
- } = {}) {
1327
- return this.fetch({
1328
- ...s,
1329
- meta: {
1330
- refetchPage: t
1331
- }
1332
- });
1333
- }
1334
- fetchOptimistic(t) {
1335
- const s = this.client.defaultQueryOptions(t), r = this.client.getQueryCache().build(this.client, s);
1336
- return r.isFetchingOptimistic = !0, r.fetch().then(() => this.createResult(r, s));
1337
- }
1338
- fetch(t) {
1339
- var s;
1340
- return this.executeFetch({
1341
- ...t,
1342
- cancelRefetch: (s = t.cancelRefetch) != null ? s : !0
1343
- }).then(() => (this.updateResult(), this.currentResult));
1344
- }
1345
- executeFetch(t) {
1346
- this.updateQuery();
1347
- let s = this.currentQuery.fetch(this.options, t);
1348
- return t != null && t.throwOnError || (s = s.catch(N)), s;
1349
- }
1350
- updateStaleTimeout() {
1351
- if (this.clearStaleTimeout(), Z || this.currentResult.isStale || !ce(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 t;
1360
- return typeof this.options.refetchInterval == "function" ? this.options.refetchInterval(this.currentResult.data, this.currentQuery) : (t = this.options.refetchInterval) != null ? t : !1;
1361
- }
1362
- updateRefetchInterval(t) {
1363
- this.clearRefetchInterval(), this.currentRefetchInterval = t, !(Z || this.options.enabled === !1 || !ce(this.currentRefetchInterval) || this.currentRefetchInterval === 0) && (this.refetchIntervalId = setInterval(() => {
1364
- (this.options.refetchIntervalInBackground || te.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(t, s) {
1377
- const r = this.currentQuery, i = this.options, a = this.currentResult, o = this.currentResultState, l = this.currentResultOptions, c = t !== r, h = c ? t.state : this.currentQueryInitialState, u = c ? this.currentResult : this.previousQueryResult, {
1378
- state: f
1379
- } = t;
1380
- let {
1381
- dataUpdatedAt: m,
1382
- error: p,
1383
- errorUpdatedAt: g,
1384
- fetchStatus: b,
1385
- status: v
1386
- } = f, y = !1, _ = !1, j;
1387
- if (s._optimisticResults) {
1388
- const x = this.hasListeners(), k = !x && Fe(t, s), W = x && Me(t, r, s, i);
1389
- (k || W) && (b = ae(t.options.networkMode) ? "fetching" : "paused", m || (v = "loading")), s._optimisticResults === "isRestoring" && (b = "idle");
1390
- }
1391
- if (s.keepPreviousData && !f.dataUpdatedAt && u != null && u.isSuccess && v !== "error")
1392
- j = u.data, m = u.dataUpdatedAt, v = u.status, y = !0;
1393
- else if (s.select && typeof f.data < "u")
1394
- if (a && f.data === (o == null ? void 0 : o.data) && s.select === this.selectFn)
1395
- j = this.selectResult;
1396
- else
1397
- try {
1398
- this.selectFn = s.select, j = s.select(f.data), j = de(a == null ? void 0 : a.data, j, s), this.selectResult = j, this.selectError = null;
1399
- } catch (x) {
1400
- this.selectError = x;
1401
- }
1402
- else
1403
- j = f.data;
1404
- if (typeof s.placeholderData < "u" && typeof j > "u" && v === "loading") {
1405
- let x;
1406
- if (a != null && a.isPlaceholderData && s.placeholderData === (l == null ? void 0 : l.placeholderData))
1407
- x = a.data;
1408
- else if (x = typeof s.placeholderData == "function" ? s.placeholderData() : s.placeholderData, s.select && typeof x < "u")
1409
- try {
1410
- x = s.select(x), this.selectError = null;
1411
- } catch (k) {
1412
- this.selectError = k;
1413
- }
1414
- typeof x < "u" && (v = "success", j = de(a == null ? void 0 : a.data, x, s), _ = !0);
1415
- }
1416
- this.selectError && (p = this.selectError, j = this.selectResult, g = Date.now(), v = "error");
1417
- const S = b === "fetching", M = v === "loading", E = v === "error";
1418
- return {
1419
- status: v,
1420
- fetchStatus: b,
1421
- isLoading: M,
1422
- isSuccess: v === "success",
1423
- isError: E,
1424
- isInitialLoading: M && S,
1425
- data: j,
1426
- dataUpdatedAt: m,
1427
- error: p,
1428
- errorUpdatedAt: g,
1429
- failureCount: f.fetchFailureCount,
1430
- failureReason: f.fetchFailureReason,
1431
- errorUpdateCount: f.errorUpdateCount,
1432
- isFetched: f.dataUpdateCount > 0 || f.errorUpdateCount > 0,
1433
- isFetchedAfterMount: f.dataUpdateCount > h.dataUpdateCount || f.errorUpdateCount > h.errorUpdateCount,
1434
- isFetching: S,
1435
- isRefetching: S && !M,
1436
- isLoadingError: E && f.dataUpdatedAt === 0,
1437
- isPaused: b === "paused",
1438
- isPlaceholderData: _,
1439
- isPreviousData: y,
1440
- isRefetchError: E && f.dataUpdatedAt !== 0,
1441
- isStale: xe(t, s),
1442
- refetch: this.refetch,
1443
- remove: this.remove
1444
- };
1445
- }
1446
- updateResult(t) {
1447
- const s = this.currentResult, r = this.createResult(this.currentQuery, this.options);
1448
- if (this.currentResultState = this.currentQuery.state, this.currentResultOptions = this.options, ee(r, s))
1449
- return;
1450
- this.currentResult = r;
1451
- const i = {
1452
- cache: !0
1453
- }, a = () => {
1454
- if (!s)
1455
- return !0;
1456
- const {
1457
- notifyOnChangeProps: o
1458
- } = this.options, l = typeof o == "function" ? o() : o;
1459
- if (l === "all" || !l && !this.trackedProps.size)
1460
- return !0;
1461
- const c = new Set(l ?? this.trackedProps);
1462
- return this.options.useErrorBoundary && c.add("error"), Object.keys(this.currentResult).some((h) => {
1463
- const u = h;
1464
- return this.currentResult[u] !== s[u] && c.has(u);
1465
- });
1466
- };
1467
- (t == null ? void 0 : t.listeners) !== !1 && a() && (i.listeners = !0), this.notify({
1468
- ...i,
1469
- ...t
1470
- });
1471
- }
1472
- updateQuery() {
1473
- const t = this.client.getQueryCache().build(this.client, this.options);
1474
- if (t === this.currentQuery)
1475
- return;
1476
- const s = this.currentQuery;
1477
- this.currentQuery = t, this.currentQueryInitialState = t.state, this.previousQueryResult = this.currentResult, this.hasListeners() && (s == null || s.removeObserver(this), t.addObserver(this));
1478
- }
1479
- onQueryUpdate(t) {
1480
- const s = {};
1481
- t.type === "success" ? s.onSuccess = !t.manual : t.type === "error" && !I(t.error) && (s.onError = !0), this.updateResult(s), this.hasListeners() && this.updateTimers();
1482
- }
1483
- notify(t) {
1484
- A.batch(() => {
1485
- if (t.onSuccess) {
1486
- var s, r, i, a;
1487
- (s = (r = this.options).onSuccess) == null || s.call(r, this.currentResult.data), (i = (a = this.options).onSettled) == null || i.call(a, this.currentResult.data, null);
1488
- } else if (t.onError) {
1489
- var o, l, c, h;
1490
- (o = (l = this.options).onError) == null || o.call(l, this.currentResult.error), (c = (h = this.options).onSettled) == null || c.call(h, void 0, this.currentResult.error);
1491
- }
1492
- t.listeners && this.listeners.forEach(({
1493
- listener: u
1494
- }) => {
1495
- u(this.currentResult);
1496
- }), t.cache && this.client.getQueryCache().notify({
1497
- query: this.currentQuery,
1498
- type: "observerResultsUpdated"
1499
- });
1500
- });
1501
- }
1502
- }
1503
- function qt(e, t) {
1504
- return t.enabled !== !1 && !e.state.dataUpdatedAt && !(e.state.status === "error" && t.retryOnMount === !1);
1505
- }
1506
- function Fe(e, t) {
1507
- return qt(e, t) || e.state.dataUpdatedAt > 0 && he(e, t, t.refetchOnMount);
1508
- }
1509
- function he(e, t, s) {
1510
- if (t.enabled !== !1) {
1511
- const r = typeof s == "function" ? s(e) : s;
1512
- return r === "always" || r !== !1 && xe(e, t);
1513
- }
1514
- return !1;
1515
- }
1516
- function Me(e, t, s, r) {
1517
- return s.enabled !== !1 && (e !== t || r.enabled === !1) && (!s.suspense || e.state.status !== "error") && xe(e, s);
1518
- }
1519
- function xe(e, t) {
1520
- return e.isStaleByTime(t.staleTime);
1521
- }
1522
- function Ht(e, t, s) {
1523
- return s.keepPreviousData ? !1 : s.placeholderData !== void 0 ? t.isPlaceholderData : !ee(e.getCurrentResult(), t);
1524
- }
1525
- class Kt extends V {
1526
- constructor(t, s) {
1527
- super(), this.client = t, this.setOptions(s), this.bindMethods(), this.updateResult();
1528
- }
1529
- bindMethods() {
1530
- this.mutate = this.mutate.bind(this), this.reset = this.reset.bind(this);
1531
- }
1532
- setOptions(t) {
1533
- var s;
1534
- const r = this.options;
1535
- this.options = this.client.defaultMutationOptions(t), ee(r, this.options) || this.client.getMutationCache().notify({
1536
- type: "observerOptionsUpdated",
1537
- mutation: this.currentMutation,
1538
- observer: this
1539
- }), (s = this.currentMutation) == null || s.setOptions(this.options);
1540
- }
1541
- onUnsubscribe() {
1542
- if (!this.hasListeners()) {
1543
- var t;
1544
- (t = this.currentMutation) == null || t.removeObserver(this);
1545
- }
1546
- }
1547
- onMutationUpdate(t) {
1548
- this.updateResult();
1549
- const s = {
1550
- listeners: !0
1551
- };
1552
- t.type === "success" ? s.onSuccess = !0 : t.type === "error" && (s.onError = !0), this.notify(s);
1553
- }
1554
- getCurrentResult() {
1555
- return this.currentResult;
1556
- }
1557
- reset() {
1558
- this.currentMutation = void 0, this.updateResult(), this.notify({
1559
- listeners: !0
1560
- });
1561
- }
1562
- mutate(t, s) {
1563
- return this.mutateOptions = s, this.currentMutation && this.currentMutation.removeObserver(this), this.currentMutation = this.client.getMutationCache().build(this.client, {
1564
- ...this.options,
1565
- variables: typeof t < "u" ? t : this.options.variables
1566
- }), this.currentMutation.addObserver(this), this.currentMutation.execute();
1567
- }
1568
- updateResult() {
1569
- const t = this.currentMutation ? this.currentMutation.state : Ze(), s = {
1570
- ...t,
1571
- isLoading: t.status === "loading",
1572
- isSuccess: t.status === "success",
1573
- isError: t.status === "error",
1574
- isIdle: t.status === "idle",
1575
- mutate: this.mutate,
1576
- reset: this.reset
1577
- };
1578
- this.currentResult = s;
1579
- }
1580
- notify(t) {
1581
- A.batch(() => {
1582
- if (this.mutateOptions && this.hasListeners()) {
1583
- if (t.onSuccess) {
1584
- var s, r, i, a;
1585
- (s = (r = this.mutateOptions).onSuccess) == null || s.call(r, this.currentResult.data, this.currentResult.variables, this.currentResult.context), (i = (a = this.mutateOptions).onSettled) == null || i.call(a, this.currentResult.data, null, this.currentResult.variables, this.currentResult.context);
1586
- } else if (t.onError) {
1587
- var o, l, c, h;
1588
- (o = (l = this.mutateOptions).onError) == null || o.call(l, this.currentResult.error, this.currentResult.variables, this.currentResult.context), (c = (h = this.mutateOptions).onSettled) == null || c.call(h, void 0, this.currentResult.error, this.currentResult.variables, this.currentResult.context);
1589
- }
1590
- }
1591
- t.listeners && this.listeners.forEach(({
1592
- listener: u
1593
- }) => {
1594
- u(this.currentResult);
1595
- });
1596
- });
1597
- }
1598
- }
1599
- var Ye = { exports: {} }, Je = {};
1600
- /**
1601
- * @license React
1602
- * use-sync-external-store-shim.production.min.js
1603
- *
1604
- * Copyright (c) Facebook, Inc. and its affiliates.
1605
- *
1606
- * This source code is licensed under the MIT license found in the
1607
- * LICENSE file in the root directory of this source tree.
1608
- */
1609
- var K = d;
1610
- function Vt(e, t) {
1611
- return e === t && (e !== 0 || 1 / e === 1 / t) || e !== e && t !== t;
1612
- }
1613
- var Gt = typeof Object.is == "function" ? Object.is : Vt, Wt = K.useState, $t = K.useEffect, Zt = K.useLayoutEffect, zt = K.useDebugValue;
1614
- function Yt(e, t) {
1615
- var s = t(), r = Wt({ inst: { value: s, getSnapshot: t } }), i = r[0].inst, a = r[1];
1616
- return Zt(function() {
1617
- i.value = s, i.getSnapshot = t, le(i) && a({ inst: i });
1618
- }, [e, s, t]), $t(function() {
1619
- return le(i) && a({ inst: i }), e(function() {
1620
- le(i) && a({ inst: i });
1621
- });
1622
- }, [e]), zt(s), s;
1623
- }
1624
- function le(e) {
1625
- var t = e.getSnapshot;
1626
- e = e.value;
1627
- try {
1628
- var s = t();
1629
- return !Gt(e, s);
1630
- } catch {
1631
- return !0;
1632
- }
1633
- }
1634
- function Jt(e, t) {
1635
- return t();
1636
- }
1637
- var Xt = typeof window > "u" || typeof window.document > "u" || typeof window.document.createElement > "u" ? Jt : Yt;
1638
- Je.useSyncExternalStore = K.useSyncExternalStore !== void 0 ? K.useSyncExternalStore : Xt;
1639
- Ye.exports = Je;
1640
- var It = Ye.exports;
1641
- const Xe = It.useSyncExternalStore, Ne = /* @__PURE__ */ d.createContext(void 0), Ie = /* @__PURE__ */ d.createContext(!1);
1642
- function Be(e, t) {
1643
- return e || (t && typeof window < "u" ? (window.ReactQueryClientContext || (window.ReactQueryClientContext = Ne), window.ReactQueryClientContext) : Ne);
1644
- }
1645
- const et = ({
1646
- context: e
1647
- } = {}) => {
1648
- const t = d.useContext(Be(e, d.useContext(Ie)));
1649
- if (!t)
1650
- throw new Error("No QueryClient set, use QueryClientProvider to set one");
1651
- return t;
1652
- }, Bt = ({
1653
- client: e,
1654
- children: t,
1655
- context: s,
1656
- contextSharing: r = !1
1657
- }) => {
1658
- d.useEffect(() => (e.mount(), () => {
1659
- e.unmount();
1660
- }), [e]);
1661
- const i = Be(s, r);
1662
- return /* @__PURE__ */ d.createElement(Ie.Provider, {
1663
- value: !s && r
1664
- }, /* @__PURE__ */ d.createElement(i.Provider, {
1665
- value: e
1666
- }, t));
1667
- }, tt = /* @__PURE__ */ d.createContext(!1), es = () => d.useContext(tt);
1668
- tt.Provider;
1669
- function ts() {
1670
- let e = !1;
1671
- return {
1672
- clearReset: () => {
1673
- e = !1;
1674
- },
1675
- reset: () => {
1676
- e = !0;
1677
- },
1678
- isReset: () => e
1679
- };
1680
- }
1681
- const ss = /* @__PURE__ */ d.createContext(ts()), rs = () => d.useContext(ss);
1682
- function st(e, t) {
1683
- return typeof e == "function" ? e(...t) : !!e;
1684
- }
1685
- const ns = (e, t) => {
1686
- (e.suspense || e.useErrorBoundary) && (t.isReset() || (e.retryOnMount = !1));
1687
- }, is = (e) => {
1688
- d.useEffect(() => {
1689
- e.clearReset();
1690
- }, [e]);
1691
- }, as = ({
1692
- result: e,
1693
- errorResetBoundary: t,
1694
- useErrorBoundary: s,
1695
- query: r
1696
- }) => e.isError && !t.isReset() && !e.isFetching && st(s, [e.error, r]), os = (e) => {
1697
- e.suspense && typeof e.staleTime != "number" && (e.staleTime = 1e3);
1698
- }, ls = (e, t) => e.isLoading && e.isFetching && !t, cs = (e, t, s) => (e == null ? void 0 : e.suspense) && ls(t, s), us = (e, t, s) => t.fetchOptimistic(e).then(({
1699
- data: r
1700
- }) => {
1701
- e.onSuccess == null || e.onSuccess(r), e.onSettled == null || e.onSettled(r, null);
1702
- }).catch((r) => {
1703
- s.clearReset(), e.onError == null || e.onError(r), e.onSettled == null || e.onSettled(void 0, r);
1704
- });
1705
- function ds(e, t) {
1706
- const s = et({
1707
- context: e.context
1708
- }), r = es(), i = rs(), a = s.defaultQueryOptions(e);
1709
- a._optimisticResults = r ? "isRestoring" : "optimistic", a.onError && (a.onError = A.batchCalls(a.onError)), a.onSuccess && (a.onSuccess = A.batchCalls(a.onSuccess)), a.onSettled && (a.onSettled = A.batchCalls(a.onSettled)), os(a), ns(a, i), is(i);
1710
- const [o] = d.useState(() => new t(s, a)), l = o.getOptimisticResult(a);
1711
- if (Xe(d.useCallback((c) => {
1712
- const h = r ? () => {
1713
- } : o.subscribe(A.batchCalls(c));
1714
- return o.updateResult(), h;
1715
- }, [o, r]), () => o.getCurrentResult(), () => o.getCurrentResult()), d.useEffect(() => {
1716
- o.setOptions(a, {
1717
- listeners: !1
1718
- });
1719
- }, [a, o]), cs(a, l, r))
1720
- throw us(a, o, i);
1721
- if (as({
1722
- result: l,
1723
- errorResetBoundary: i,
1724
- useErrorBoundary: a.useErrorBoundary,
1725
- query: o.getCurrentQuery()
1726
- }))
1727
- throw l.error;
1728
- return a.notifyOnChangeProps ? l : o.trackResult(l);
1729
- }
1730
- function rt(e, t, s) {
1731
- const r = $(e, t, s);
1732
- return ds(r, Qt);
1733
- }
1734
- function hs(e, t, s) {
1735
- const r = Rt(e, t, s), i = et({
1736
- context: r.context
1737
- }), [a] = d.useState(() => new Kt(i, r));
1738
- d.useEffect(() => {
1739
- a.setOptions(r);
1740
- }, [a, r]);
1741
- const o = Xe(d.useCallback((c) => a.subscribe(A.batchCalls(c)), [a]), () => a.getCurrentResult(), () => a.getCurrentResult()), l = d.useCallback((c, h) => {
1742
- a.mutate(c, h).catch(fs);
1743
- }, [a]);
1744
- if (o.error && st(a.options.useErrorBoundary, [o.error]))
1745
- throw o.error;
1746
- return {
1747
- ...o,
1748
- mutate: l,
1749
- mutateAsync: o.mutate
1750
- };
1751
- }
1752
- function fs() {
1753
- }
1754
- function nt(e) {
1755
- var t, s, r = "";
1756
- if (typeof e == "string" || typeof e == "number")
1757
- r += e;
1758
- else if (typeof e == "object")
1759
- if (Array.isArray(e))
1760
- for (t = 0; t < e.length; t++)
1761
- e[t] && (s = nt(e[t])) && (r && (r += " "), r += s);
1762
- else
1763
- for (t in e)
1764
- e[t] && (r && (r += " "), r += t);
1765
- return r;
1766
- }
1767
- function P() {
1768
- for (var e, t, s = 0, r = ""; s < arguments.length; )
1769
- (e = arguments[s++]) && (t = nt(e)) && (r && (r += " "), r += t);
1770
- return r;
1771
- }
1772
- var ps = Object.defineProperty, vs = Object.defineProperties, ms = Object.getOwnPropertyDescriptors, re = Object.getOwnPropertySymbols, it = Object.prototype.hasOwnProperty, at = Object.prototype.propertyIsEnumerable, Le = (e, t, s) => t in e ? ps(e, t, { enumerable: !0, configurable: !0, writable: !0, value: s }) : e[t] = s, C = (e, t) => {
1773
- for (var s in t || (t = {}))
1774
- it.call(t, s) && Le(e, s, t[s]);
1775
- if (re)
1776
- for (var s of re(t))
1777
- at.call(t, s) && Le(e, s, t[s]);
1778
- return e;
1779
- }, R = (e, t) => vs(e, ms(t)), O = (e, t) => {
1780
- var s = {};
1781
- for (var r in e)
1782
- it.call(e, r) && t.indexOf(r) < 0 && (s[r] = e[r]);
1783
- if (e != null && re)
1784
- for (var r of re(e))
1785
- t.indexOf(r) < 0 && at.call(e, r) && (s[r] = e[r]);
1786
- return s;
1787
- };
1788
- function ne() {
1789
- return ne = Object.assign ? Object.assign.bind() : function(e) {
1790
- for (var t = 1; t < arguments.length; t++) {
1791
- var s = arguments[t];
1792
- for (var r in s)
1793
- Object.prototype.hasOwnProperty.call(s, r) && (e[r] = s[r]);
1794
- }
1795
- return e;
1796
- }, ne.apply(this, arguments);
1797
- }
1798
- function ys(e, t) {
1799
- typeof e == "function" ? e(t) : e != null && (e.current = t);
1800
- }
1801
- function Cs(...e) {
1802
- return (t) => e.forEach(
1803
- (s) => ys(s, t)
1804
- );
1805
- }
1806
- var gs = /* @__PURE__ */ d.forwardRef((e, t) => {
1807
- const s = e, { children: r } = s, i = O(s, ["children"]), a = d.Children.toArray(r), o = a.find(bs);
1808
- if (o) {
1809
- const l = o.props.children, c = a.map((h) => h === o ? d.Children.count(l) > 1 ? d.Children.only(null) : /* @__PURE__ */ d.isValidElement(l) ? l.props.children : null : h);
1810
- return /* @__PURE__ */ d.createElement(fe, ne({}, i, {
1811
- ref: t
1812
- }), /* @__PURE__ */ d.isValidElement(l) ? /* @__PURE__ */ d.cloneElement(l, void 0, c) : null);
1813
- }
1814
- return /* @__PURE__ */ d.createElement(fe, ne({}, i, {
1815
- ref: t
1816
- }), r);
1817
- });
1818
- gs.displayName = "Slot";
1819
- var fe = /* @__PURE__ */ d.forwardRef((e, t) => {
1820
- const s = e, { children: r } = s, i = O(s, ["children"]);
1821
- return /* @__PURE__ */ d.isValidElement(r) ? /* @__PURE__ */ d.cloneElement(r, R(C({}, ws(i, r.props)), {
1822
- ref: t ? Cs(t, r.ref) : r.ref
1823
- })) : d.Children.count(r) > 1 ? d.Children.only(null) : null;
1824
- });
1825
- fe.displayName = "SlotClone";
1826
- var xs = ({ children: e }) => /* @__PURE__ */ d.createElement(d.Fragment, null, e);
1827
- function bs(e) {
1828
- return /* @__PURE__ */ d.isValidElement(e) && e.type === xs;
1829
- }
1830
- function ws(e, t) {
1831
- const s = C({}, t);
1832
- for (const r in t) {
1833
- const i = e[r], a = t[r];
1834
- /^on[A-Z]/.test(r) ? i && a ? s[r] = (...l) => {
1835
- a(...l), i(...l);
1836
- } : i && (s[r] = i) : r === "style" ? s[r] = C(C({}, i), a) : r === "className" && (s[r] = [
1837
- i,
1838
- a
1839
- ].filter(Boolean).join(" "));
1840
- }
1841
- return C(C({}, e), s);
1842
- }
1843
- var js = ({ firstName: e, lastName: t, variant: s = "small" }) => {
1844
- const r = `${e.charAt(0)}${t.charAt(0)}`;
1845
- return /* @__PURE__ */ n.jsx(
1846
- "span",
1847
- {
1848
- className: `avatar avatar--${s}`,
1849
- "aria-label": `${e} ${t}`,
1850
- role: "img",
1851
- children: /* @__PURE__ */ n.jsx("span", { className: "avatar__initials", children: r })
1852
- }
1853
- );
1854
- }, Y = d.forwardRef(
1855
- (e, t) => {
1856
- var s = e, {
1857
- iconLeft: r,
1858
- iconRight: i,
1859
- isPending: a = !1,
1860
- isFilled: o = !1,
1861
- variant: l,
1862
- className: c,
1863
- children: h
1864
- } = s, u = O(s, [
1865
- "iconLeft",
1866
- "iconRight",
1867
- "isPending",
1868
- "isFilled",
1869
- "variant",
1870
- "className",
1871
- "children"
1872
- ]);
1873
- const f = !!r || !!i;
1874
- return /* @__PURE__ */ n.jsxs(
1875
- "button",
1876
- R(C({
1877
- ref: t
1878
- }, u), {
1879
- className: P(
1880
- "button",
1881
- l && `button--${l}`,
1882
- l && o && `button--${l}--filled`,
1883
- f && "button--with-icon",
1884
- a && "button--pending",
1885
- c
1886
- ),
1887
- children: [
1888
- r && /* @__PURE__ */ n.jsx("div", { className: "button__icon", children: r }),
1889
- !!h && /* @__PURE__ */ n.jsx("span", { className: "button__label", children: h }),
1890
- i && /* @__PURE__ */ n.jsx("div", { className: "button__icon button__icon-right", children: i })
1891
- ]
1892
- })
1893
- );
1894
- }
1895
- );
1896
- Y.displayName = "Button";
1897
- d.createContext(void 0);
1898
- var Ss = d.forwardRef(
1899
- (e, t) => {
1900
- var s = e, { prefix: r, suffix: i, className: a } = s, o = O(s, ["prefix", "suffix", "className"]);
1901
- return /* @__PURE__ */ n.jsxs("div", { className: "input__wrapper", children: [
1902
- r && /* @__PURE__ */ n.jsx("span", { className: "input__prefix", children: r }),
1903
- /* @__PURE__ */ n.jsx(
1904
- "input",
1905
- C({
1906
- ref: t,
1907
- className: P(
1908
- "input",
1909
- r && "input--with-prefix",
1910
- i && "input--with-suffix",
1911
- a
1912
- )
1913
- }, o)
1914
- ),
1915
- i && /* @__PURE__ */ n.jsx("span", { className: "input__suffix", children: i })
1916
- ] });
1917
- }
1918
- );
1919
- Ss.displayName = "TextField";
1920
- d.createContext(void 0);
1921
- var Es = ({ children: e }) => /* @__PURE__ */ n.jsx("div", { className: "card__header__action", children: e }), Rs = (e) => {
1922
- var t = e, { children: s, className: r } = t, i = O(t, ["children", "className"]);
1923
- return /* @__PURE__ */ n.jsx("div", R(C({ className: P("card__body", r) }, i), { children: s }));
1924
- }, Ps = (e) => /* @__PURE__ */ n.jsx(
1925
- "svg",
1926
- R(C({
1927
- width: "24",
1928
- height: "24",
1929
- viewBox: "0 0 24 24",
1930
- fill: "none",
1931
- xmlns: "http://www.w3.org/2000/svg"
1932
- }, e), {
1933
- children: /* @__PURE__ */ n.jsx(
1934
- "path",
1935
- {
1936
- d: "M8 10L12 14L16 10",
1937
- stroke: "currentColor",
1938
- strokeWidth: "1.5",
1939
- strokeLinecap: "round",
1940
- strokeLinejoin: "round"
1941
- }
1942
- )
1943
- })
1944
- ), be = Ps, _s = (e) => /* @__PURE__ */ n.jsx(
1945
- "svg",
1946
- R(C({
1947
- width: "24",
1948
- height: "24",
1949
- viewBox: "0 0 24 24",
1950
- fill: "none",
1951
- xmlns: "http://www.w3.org/2000/svg"
1952
- }, e), {
1953
- children: /* @__PURE__ */ n.jsx(
1954
- "path",
1955
- {
1956
- d: "M20 6.5L9 17.5L4 12.5",
1957
- stroke: "currentColor",
1958
- strokeWidth: "1.5",
1959
- strokeLinecap: "round",
1960
- strokeLinejoin: "round"
1961
- }
1962
- )
1963
- })
1964
- ), As = _s, Os = (e) => /* @__PURE__ */ n.jsx(
1965
- "svg",
1966
- R(C({
1967
- width: "24",
1968
- height: "24",
1969
- viewBox: "0 0 24 24",
1970
- fill: "none",
1971
- xmlns: "http://www.w3.org/2000/svg"
1972
- }, e), {
1973
- children: /* @__PURE__ */ n.jsx(
1974
- "path",
1975
- {
1976
- fillRule: "evenodd",
1977
- clipRule: "evenodd",
1978
- fill: "currentColor",
1979
- 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"
1980
- }
1981
- )
1982
- })
1983
- ), ks = Os, Fs = (e) => /* @__PURE__ */ n.jsx(
1984
- "svg",
1985
- R(C({
1986
- width: "24",
1987
- height: "24",
1988
- viewBox: "0 0 24 24",
1989
- fill: "none",
1990
- xmlns: "http://www.w3.org/2000/svg"
1991
- }, e), {
1992
- children: /* @__PURE__ */ n.jsx(
1993
- "path",
1994
- {
1995
- fillRule: "evenodd",
1996
- clipRule: "evenodd",
1997
- 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",
1998
- fill: "#323232"
1999
- }
2000
- )
2001
- })
2002
- ), Ms = Fs, Ns = (e) => /* @__PURE__ */ n.jsx(
2003
- "svg",
2004
- R(C({
2005
- width: "24",
2006
- height: "24",
2007
- viewBox: "0 0 24 24",
2008
- fill: "none",
2009
- xmlns: "http://www.w3.org/2000/svg"
2010
- }, e), {
2011
- children: /* @__PURE__ */ n.jsx(
2012
- "path",
2013
- {
2014
- fillRule: "evenodd",
2015
- clipRule: "evenodd",
2016
- 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",
2017
- fill: "currentColor"
2018
- }
2019
- )
2020
- })
2021
- ), Ls = Ns, Ds = (e) => /* @__PURE__ */ n.jsxs(
2022
- "svg",
2023
- R(C({
2024
- width: "24",
2025
- height: "24",
2026
- fill: "none",
2027
- viewBox: "0 0 24 24",
2028
- xmlns: "http://www.w3.org/2000/svg"
2029
- }, e), {
2030
- children: [
2031
- /* @__PURE__ */ n.jsxs("g", { clipPath: "url(#clip0_19_444)", children: [
2032
- /* @__PURE__ */ n.jsx(
2033
- "path",
2034
- {
2035
- 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",
2036
- stroke: "currentColor",
2037
- strokeWidth: "1.5",
2038
- strokeLinecap: "round",
2039
- strokeLinejoin: "round"
2040
- }
2041
- ),
2042
- /* @__PURE__ */ n.jsx("circle", { cx: "10.3", cy: "15.5", r: "0.8", fill: "currentColor" }),
2043
- /* @__PURE__ */ n.jsx("circle", { cx: "13.7", cy: "15.5", r: "0.8", fill: "currentColor" }),
2044
- /* @__PURE__ */ n.jsx(
2045
- "path",
2046
- {
2047
- d: "M8 10V7V7C8 4.79086 9.79086 3 12 3V3C14.2091 3 16 4.79086 16 7V10",
2048
- stroke: "currentColor",
2049
- strokeWidth: "1.5",
2050
- strokeLinecap: "round",
2051
- strokeLinejoin: "round"
2052
- }
2053
- )
2054
- ] }),
2055
- /* @__PURE__ */ n.jsx("defs", { children: /* @__PURE__ */ n.jsx("clipPath", { id: "clip0_19_444", children: /* @__PURE__ */ n.jsx("rect", { width: "24", height: "24", fill: "white" }) }) })
2056
- ]
2057
- })
2058
- ), Ts = Ds, Us = (e) => /* @__PURE__ */ n.jsxs(
2059
- "svg",
2060
- R(C({
2061
- width: "24",
2062
- height: "24",
2063
- viewBox: "0 0 24 24",
2064
- fill: "none",
2065
- xmlns: "http://www.w3.org/2000/svg"
2066
- }, e), {
2067
- children: [
2068
- /* @__PURE__ */ n.jsx(
2069
- "path",
2070
- {
2071
- 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",
2072
- stroke: "currentColor",
2073
- strokeWidth: "1.5",
2074
- strokeLinecap: "round",
2075
- strokeLinejoin: "round"
2076
- }
2077
- ),
2078
- /* @__PURE__ */ n.jsx(
2079
- "path",
2080
- {
2081
- 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",
2082
- stroke: "currentColor",
2083
- strokeWidth: "1.5",
2084
- strokeLinecap: "round",
2085
- strokeLinejoin: "round"
2086
- }
2087
- )
2088
- ]
2089
- })
2090
- ), Qs = Us, qs = (e) => /* @__PURE__ */ n.jsxs(
2091
- "svg",
2092
- R(C({
2093
- width: "24",
2094
- height: "24",
2095
- viewBox: "0 0 24 24",
2096
- fill: "none",
2097
- xmlns: "http://www.w3.org/2000/svg"
2098
- }, e), {
2099
- children: [
2100
- /* @__PURE__ */ n.jsx(
2101
- "path",
2102
- {
2103
- 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",
2104
- stroke: "currentColor",
2105
- strokeWidth: "1.5",
2106
- strokeLinecap: "round",
2107
- strokeLinejoin: "round"
2108
- }
2109
- ),
2110
- /* @__PURE__ */ n.jsx(
2111
- "path",
2112
- {
2113
- 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",
2114
- stroke: "currentColor",
2115
- strokeWidth: "1.5",
2116
- strokeLinecap: "round",
2117
- strokeLinejoin: "round"
2118
- }
2119
- ),
2120
- /* @__PURE__ */ n.jsx(
2121
- "path",
2122
- {
2123
- d: "M17.5 16V18.0164V20",
2124
- stroke: "currentColor",
2125
- strokeWidth: "1.5",
2126
- strokeLinecap: "round",
2127
- strokeLinejoin: "round"
2128
- }
2129
- ),
2130
- /* @__PURE__ */ n.jsx(
2131
- "path",
2132
- {
2133
- d: "M19.5 18L17.4836 18L15.5 18",
2134
- stroke: "currentColor",
2135
- strokeWidth: "1.5",
2136
- strokeLinecap: "round",
2137
- strokeLinejoin: "round"
2138
- }
2139
- )
2140
- ]
2141
- })
2142
- ), Hs = qs, Ks = (e) => /* @__PURE__ */ n.jsxs(
2143
- "svg",
2144
- R(C({
2145
- width: "20",
2146
- height: "21",
2147
- fill: "none",
2148
- viewBox: "0 0 20 21",
2149
- xmlns: "http://www.w3.org/2000/svg"
2150
- }, e), {
2151
- children: [
2152
- /* @__PURE__ */ n.jsx("circle", { cx: "10", cy: "10.0996", r: "7.5", stroke: "#00ab9e", strokeWidth: "1.25" }),
2153
- /* @__PURE__ */ n.jsx(
2154
- "circle",
2155
- {
2156
- cx: "10",
2157
- cy: "10.0996",
2158
- r: "7.5",
2159
- stroke: "white",
2160
- strokeDasharray: "15 30",
2161
- strokeWidth: "1.25"
2162
- }
2163
- )
2164
- ]
2165
- })
2166
- ), Vs = Ks, Gs = (e) => /* @__PURE__ */ n.jsxs(
2167
- "svg",
2168
- R(C({
2169
- width: "24",
2170
- height: "24",
2171
- fill: "none",
2172
- viewBox: "0 0 24 24",
2173
- xmlns: "http://www.w3.org/2000/svg"
2174
- }, e), {
2175
- children: [
2176
- /* @__PURE__ */ n.jsxs("g", { clipPath: "url(#clip0_762_2934)", children: [
2177
- /* @__PURE__ */ n.jsx(
2178
- "path",
2179
- {
2180
- fillRule: "evenodd",
2181
- clipRule: "evenodd",
2182
- 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",
2183
- fill: "currentColor"
2184
- }
2185
- ),
2186
- /* @__PURE__ */ n.jsx(
2187
- "path",
2188
- {
2189
- 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",
2190
- stroke: "currentColor",
2191
- strokeWidth: "1.5",
2192
- strokeLinecap: "round",
2193
- strokeLinejoin: "round"
2194
- }
2195
- )
2196
- ] }),
2197
- /* @__PURE__ */ n.jsx("defs", { children: /* @__PURE__ */ n.jsx("clipPath", { id: "clip0_762_2934", children: /* @__PURE__ */ n.jsx("rect", { width: "24", height: "24", fill: "white" }) }) })
2198
- ]
2199
- })
2200
- ), Ws = Gs, $s = (e) => {
2201
- const t = (s) => `${s}${e.suffix ? `_${e.suffix}` : ""}`;
2202
- return /* @__PURE__ */ n.jsxs(
2203
- "svg",
2204
- R(C({
2205
- width: "24",
2206
- height: "24",
2207
- viewBox: "0 0 24 24",
2208
- fill: "none",
2209
- xmlns: "http://www.w3.org/2000/svg"
2210
- }, e), {
2211
- children: [
2212
- /* @__PURE__ */ n.jsx(
2213
- "path",
2214
- {
2215
- 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",
2216
- fill: t("url(#paint0")
2217
- }
2218
- ),
2219
- /* @__PURE__ */ n.jsx(
2220
- "path",
2221
- {
2222
- opacity: "0.9",
2223
- 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",
2224
- fill: t("url(#paint1")
2225
- }
2226
- ),
2227
- /* @__PURE__ */ n.jsx(
2228
- "path",
2229
- {
2230
- 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",
2231
- fill: t("url(#paint2")
2232
- }
2233
- ),
2234
- /* @__PURE__ */ n.jsx(
2235
- "path",
2236
- {
2237
- opacity: "0.85",
2238
- 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",
2239
- fill: t("url(#paint3")
2240
- }
2241
- ),
2242
- /* @__PURE__ */ n.jsx(
2243
- "path",
2244
- {
2245
- opacity: "0.87",
2246
- 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",
2247
- fill: t("url(#paint4")
2248
- }
2249
- ),
2250
- /* @__PURE__ */ n.jsx(
2251
- "path",
2252
- {
2253
- 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",
2254
- fill: t("url(#paint5")
2255
- }
2256
- ),
2257
- /* @__PURE__ */ n.jsxs("defs", { children: [
2258
- /* @__PURE__ */ n.jsxs(
2259
- "linearGradient",
2260
- {
2261
- id: t("paint0"),
2262
- x1: "10.6862",
2263
- y1: "11.0225",
2264
- x2: "14.9751",
2265
- y2: "0.707188",
2266
- gradientUnits: "userSpaceOnUse",
2267
- children: [
2268
- /* @__PURE__ */ n.jsx("stop", { offset: "0.413", stopColor: "#90B117" }),
2269
- /* @__PURE__ */ n.jsx("stop", { offset: "0.501", stopColor: "#8BAF19" }),
2270
- /* @__PURE__ */ n.jsx("stop", { offset: "0.601", stopColor: "#7DAB1E" }),
2271
- /* @__PURE__ */ n.jsx("stop", { offset: "0.706", stopColor: "#67A325" }),
2272
- /* @__PURE__ */ n.jsx("stop", { offset: "0.815", stopColor: "#479830" }),
2273
- /* @__PURE__ */ n.jsx("stop", { offset: "0.925", stopColor: "#1F8A3E" }),
2274
- /* @__PURE__ */ n.jsx("stop", { offset: "1", stopColor: "#007F48" })
2275
- ]
2276
- }
2277
- ),
2278
- /* @__PURE__ */ n.jsxs(
2279
- "linearGradient",
2280
- {
2281
- id: t("paint1"),
2282
- x1: "11.5281",
2283
- y1: "8.85339",
2284
- x2: "12.4519",
2285
- y2: "1.60772",
2286
- gradientUnits: "userSpaceOnUse",
2287
- children: [
2288
- /* @__PURE__ */ n.jsx("stop", { stopColor: "#36BCEE" }),
2289
- /* @__PURE__ */ n.jsx("stop", { offset: "0.201", stopColor: "#31ACE3" }),
2290
- /* @__PURE__ */ n.jsx("stop", { offset: "0.59", stopColor: "#2583C5" }),
2291
- /* @__PURE__ */ n.jsx("stop", { offset: "1", stopColor: "#1652A1" })
2292
- ]
2293
- }
2294
- ),
2295
- /* @__PURE__ */ n.jsxs(
2296
- "linearGradient",
2297
- {
2298
- id: t("paint2"),
2299
- x1: "15.0651",
2300
- y1: "18.7384",
2301
- x2: "12.9747",
2302
- y2: "8.0336",
2303
- gradientUnits: "userSpaceOnUse",
2304
- children: [
2305
- /* @__PURE__ */ n.jsx("stop", { stopColor: "#E42313" }),
2306
- /* @__PURE__ */ n.jsx("stop", { offset: "0.071", stopColor: "#E73611" }),
2307
- /* @__PURE__ */ n.jsx("stop", { offset: "0.312", stopColor: "#F0710B" }),
2308
- /* @__PURE__ */ n.jsx("stop", { offset: "0.534", stopColor: "#F6A006" }),
2309
- /* @__PURE__ */ n.jsx("stop", { offset: "0.73", stopColor: "#FBC103" }),
2310
- /* @__PURE__ */ n.jsx("stop", { offset: "0.891", stopColor: "#FED601" }),
2311
- /* @__PURE__ */ n.jsx("stop", { offset: "0.999", stopColor: "#FFDD00" })
2312
- ]
2313
- }
2314
- ),
2315
- /* @__PURE__ */ n.jsxs(
2316
- "linearGradient",
2317
- {
2318
- id: t("paint3"),
2319
- x1: "13.9806",
2320
- y1: "8.29749",
2321
- x2: "10.8203",
2322
- y2: "18.1127",
2323
- gradientUnits: "userSpaceOnUse",
2324
- children: [
2325
- /* @__PURE__ */ n.jsx("stop", { stopColor: "#FFC832" }),
2326
- /* @__PURE__ */ n.jsx("stop", { offset: "0.354", stopColor: "#F8A220" }),
2327
- /* @__PURE__ */ n.jsx("stop", { offset: "0.779", stopColor: "#F07A0D" }),
2328
- /* @__PURE__ */ n.jsx("stop", { offset: "1", stopColor: "#ED6B06" })
2329
- ]
2330
- }
2331
- ),
2332
- /* @__PURE__ */ n.jsxs(
2333
- "linearGradient",
2334
- {
2335
- id: t("paint4"),
2336
- x1: "13.9806",
2337
- y1: "8.2892",
2338
- x2: "10.8212",
2339
- y2: "18.1113",
2340
- gradientUnits: "userSpaceOnUse",
2341
- children: [
2342
- /* @__PURE__ */ n.jsx("stop", { offset: "0.461", stopColor: "#F3C636", stopOpacity: "0" }),
2343
- /* @__PURE__ */ n.jsx("stop", { offset: "0.645", stopColor: "#F1A223", stopOpacity: "0.341" }),
2344
- /* @__PURE__ */ n.jsx("stop", { offset: "0.879", stopColor: "#EE7A0E", stopOpacity: "0.776" }),
2345
- /* @__PURE__ */ n.jsx("stop", { offset: "1", stopColor: "#ED6B06" })
2346
- ]
2347
- }
2348
- ),
2349
- /* @__PURE__ */ n.jsxs(
2350
- "radialGradient",
2351
- {
2352
- id: t("paint5"),
2353
- cx: "0",
2354
- cy: "0",
2355
- r: "1",
2356
- gradientUnits: "userSpaceOnUse",
2357
- gradientTransform: "translate(11.9404 22.4736) scale(7.73227 0.851796)",
2358
- children: [
2359
- /* @__PURE__ */ n.jsx("stop", { stopColor: "#C9C9C9" }),
2360
- /* @__PURE__ */ n.jsx("stop", { offset: "0.302", stopColor: "#CCCCCC", stopOpacity: "0.698" }),
2361
- /* @__PURE__ */ n.jsx("stop", { offset: "0.554", stopColor: "#D7D7D7", stopOpacity: "0.447" }),
2362
- /* @__PURE__ */ n.jsx("stop", { offset: "0.787", stopColor: "#E8E8E8", stopOpacity: "0.212" }),
2363
- /* @__PURE__ */ n.jsx("stop", { offset: "1", stopColor: "white", stopOpacity: "0" })
2364
- ]
2365
- }
2366
- )
2367
- ] })
2368
- ]
2369
- })
2370
- );
2371
- }, we = $s, Zs = (e) => /* @__PURE__ */ n.jsxs(
2372
- "svg",
2373
- R(C({
2374
- fill: "none",
2375
- xmlns: "http://www.w3.org/2000/svg",
2376
- viewBox: "0 0 24 24",
2377
- width: "24",
2378
- height: "24"
2379
- }, e), {
2380
- children: [
2381
- /* @__PURE__ */ n.jsx(
2382
- "path",
2383
- {
2384
- d: "M16 3H8C5.23858 3 3 5.23858 3 8V16C3 18.7614 5.23858 21 8 21H16C18.7614 21 21 18.7614 21 16V8C21 5.23858 18.7614 3 16 3Z",
2385
- stroke: "currentColor",
2386
- strokeWidth: "1.5",
2387
- strokeLinecap: "round",
2388
- strokeLinejoin: "round"
2389
- }
2390
- ),
2391
- /* @__PURE__ */ n.jsx(
2392
- "path",
2393
- {
2394
- d: "M12.001 11.258C12.001 8.906 13.634 7 15.648 7C16.515 7 17.218 7.703 17.218 8.57C17.218 10.464 14.881 12 11.999 12C9.117 12 6.78 10.465 6.78 8.57C6.78 7.703 7.483 7 8.351 7C10.365 7 11.998 8.906 11.998 11.258",
2395
- stroke: "currentColor",
2396
- strokeWidth: "1.5",
2397
- strokeLinecap: "round",
2398
- strokeLinejoin: "round"
2399
- }
2400
- ),
2401
- /* @__PURE__ */ n.jsx(
2402
- "path",
2403
- {
2404
- d: "M8 15.854C10.208 15.854 11.998 13.764 11.998 11.186L12.002 11.2C12.002 13.778 13.792 15.868 16 15.868",
2405
- stroke: "currentColor",
2406
- strokeWidth: "1.5",
2407
- strokeLinecap: "round",
2408
- strokeLinejoin: "round"
2409
- }
2410
- ),
2411
- /* @__PURE__ */ n.jsx(
2412
- "path",
2413
- {
2414
- d: "M12 3V21",
2415
- stroke: "currentColor",
2416
- strokeWidth: "1.5",
2417
- strokeLinecap: "round",
2418
- strokeLinejoin: "round"
2419
- }
2420
- ),
2421
- /* @__PURE__ */ n.jsx(
2422
- "path",
2423
- {
2424
- d: "M21 12H3",
2425
- stroke: "currentColor",
2426
- strokeWidth: "1.5",
2427
- strokeLinecap: "round",
2428
- strokeLinejoin: "round"
2429
- }
2430
- )
2431
- ]
2432
- })
2433
- ), zs = Zs, Ys = (e) => /* @__PURE__ */ n.jsx(
2434
- "svg",
2435
- R(C({
2436
- fill: "none",
2437
- xmlns: "http://www.w3.org/2000/svg",
2438
- viewBox: "0 0 21 16",
2439
- width: "21",
2440
- height: "16"
2441
- }, e), {
2442
- children: /* @__PURE__ */ n.jsx(
2443
- "path",
2444
- {
2445
- 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",
2446
- stroke: "currentcolor",
2447
- strokeWidth: "1.5",
2448
- strokeLinecap: "round",
2449
- strokeLinejoin: "round"
2450
- }
2451
- )
2452
- })
2453
- ), Js = Ys, Xs = (e) => /* @__PURE__ */ n.jsxs(
2454
- "svg",
2455
- R(C({
2456
- width: "24",
2457
- height: "24",
2458
- fill: "none",
2459
- xmlns: "http://www.w3.org/2000/svg",
2460
- viewBox: "0 0 24 24"
2461
- }, e), {
2462
- children: [
2463
- /* @__PURE__ */ n.jsx(
2464
- "path",
2465
- {
2466
- d: "M3 3h6v6H3V3ZM2.8 14.8h6v6h-6v-6ZM20.8 8.8h-6v-6h6v6Z",
2467
- strokeWidth: "1.5",
2468
- strokeLinecap: "round",
2469
- strokeLinejoin: "round",
2470
- stroke: "currentColor"
2471
- }
2472
- ),
2473
- /* @__PURE__ */ n.jsx("circle", { r: ".8", transform: "matrix(1 0 0 -1 14.8 14.7)", fill: "currentColor" }),
2474
- /* @__PURE__ */ n.jsx("circle", { r: ".8", transform: "matrix(1 0 0 -1 20.8 14.7)", fill: "currentColor" }),
2475
- /* @__PURE__ */ n.jsx("circle", { r: ".8", transform: "matrix(1 0 0 -1 17.8 17.7)", fill: "currentColor" }),
2476
- /* @__PURE__ */ n.jsx("circle", { r: ".8", transform: "matrix(1 0 0 -1 14.8 20.7)", fill: "currentColor" }),
2477
- /* @__PURE__ */ n.jsx("circle", { r: ".8", transform: "matrix(1 0 0 -1 20.8 20.7)", fill: "currentColor" })
2478
- ]
2479
- })
2480
- ), Is = Xs, Bs = (e) => {
2481
- var t = e, {
2482
- variant: s,
2483
- icon: r,
2484
- isStandalone: i,
2485
- title: a,
2486
- description: o,
2487
- className: l
2488
- } = t, c = O(t, [
2489
- "variant",
2490
- "icon",
2491
- "isStandalone",
2492
- "title",
2493
- "description",
2494
- "className"
2495
- ]);
2496
- return /* @__PURE__ */ n.jsx(
2497
- "div",
2498
- R(C({}, c), {
2499
- className: P(
2500
- "card__empty-state",
2501
- s === "error" && "card__empty-state--error",
2502
- i && "card__empty-state--standalone",
2503
- l
2504
- ),
2505
- children: /* @__PURE__ */ n.jsxs("div", { className: "card__empty-state__wrapper", children: [
2506
- /* @__PURE__ */ n.jsx("i", { className: "card__empty-state__icon", "aria-hidden": !0, children: s === "error" ? /* @__PURE__ */ n.jsx(Ws, {}) : r }),
2507
- /* @__PURE__ */ n.jsxs("div", { className: "card__empty-state__content", children: [
2508
- /* @__PURE__ */ n.jsx("p", { className: "card__empty-state__title", children: a }),
2509
- /* @__PURE__ */ n.jsx("p", { className: "card__empty-state__description", children: o })
2510
- ] })
2511
- ] })
2512
- })
2513
- );
2514
- }, er = ({ children: e }) => /* @__PURE__ */ n.jsx("div", { className: "card__footer", children: e }), tr = (e) => {
2515
- var t = e, {
2516
- variant: s = "default",
2517
- sticky: r,
2518
- className: i,
2519
- children: a
2520
- } = t, o = O(t, [
2521
- "variant",
2522
- "sticky",
2523
- "className",
2524
- "children"
2525
- ]);
2526
- return /* @__PURE__ */ n.jsx(
2527
- "div",
2528
- R(C({}, o), {
2529
- className: P(
2530
- "card__header",
2531
- s && `card__header--${s}`,
2532
- r && "card__header--sticky",
2533
- i
2534
- ),
2535
- children: a
2536
- })
2537
- );
2538
- }, sr = ({ children: e }) => /* @__PURE__ */ n.jsx("div", { className: "card__image", children: e }), rr = ({ children: e, className: t }) => /* @__PURE__ */ n.jsx("div", { className: P("card__body__item", t), children: e }), nr = ({ children: e }) => /* @__PURE__ */ n.jsx("div", { className: "card__body__subtitle", children: e }), ir = ({ icon: e, children: t }) => /* @__PURE__ */ n.jsxs("div", { className: "card__header__title", children: [
2539
- e && /* @__PURE__ */ n.jsx("span", { className: "card__header__title__icon", children: e }),
2540
- t
2541
- ] }), ot = d.forwardRef(
2542
- (e, t) => {
2543
- var s = e, { type: r, children: i, className: a, variant: o = "default", disabled: l = !1 } = s, c = O(s, ["type", "children", "className", "variant", "disabled"]);
2544
- return d.createElement(
2545
- r,
2546
- C({
2547
- className: P(
2548
- "card",
2549
- l && "card--disabled",
2550
- o && `card--${o}`,
2551
- a
2552
- ),
2553
- ref: t
2554
- }, c),
2555
- i
2556
- );
2557
- }
2558
- );
2559
- ot.displayName = "Card";
2560
- Object.assign(ot, {
2561
- Header: tr,
2562
- Action: Es,
2563
- Title: ir,
2564
- Subtitle: nr,
2565
- Body: Rs,
2566
- Image: sr,
2567
- Item: rr,
2568
- Footer: er,
2569
- EmptyState: Bs
2570
- });
2571
- var ar = (e) => {
2572
- var t = e, { className: s, children: r } = t, i = O(t, ["className", "children"]);
2573
- return /* @__PURE__ */ n.jsx("div", R(C({ className: P("checkbox__content", s) }, i), { children: r }));
2574
- }, or = (e) => {
2575
- var t = e, { className: s, children: r } = t, i = O(t, ["className", "children"]);
2576
- return /* @__PURE__ */ n.jsx("span", R(C({ className: P("checkbox__hint", s) }, i), { children: r }));
2577
- }, lt = d.createContext(void 0), lr = ({ id: e, name: t, children: s }) => /* @__PURE__ */ n.jsx(lt.Provider, { value: { id: e, name: t }, children: s }), cr = () => {
2578
- const e = d.useContext(lt);
2579
- if (!e)
2580
- throw new Error("Checkbox compound components can not be rendered outside of Checkbox");
2581
- return e;
2582
- }, ur = (e) => {
2583
- var t = e, { className: s, children: r } = t, i = O(t, ["className", "children"]);
2584
- const { id: a } = cr();
2585
- return /* @__PURE__ */ n.jsx("label", R(C({ htmlFor: a, className: P("checkbox__label", s) }, i), { children: r }));
2586
- }, q = (e) => {
2587
- var t = e, {
2588
- id: s,
2589
- name: r,
2590
- isPending: i = !1,
2591
- variant: a = "neutral",
2592
- hasError: o = !1,
2593
- single: l,
2594
- className: c,
2595
- children: h
2596
- } = t, u = O(t, [
2597
- "id",
2598
- "name",
2599
- "isPending",
2600
- "variant",
2601
- "hasError",
2602
- "single",
2603
- "className",
2604
- "children"
2605
- ]);
2606
- const f = d.useRef(null);
2607
- return d.useEffect(() => {
2608
- f.current && (i ? f.current.indeterminate = !0 : f.current.indeterminate = !1);
2609
- }, [i]), /* @__PURE__ */ n.jsxs(
2610
- "div",
2611
- {
2612
- className: P("checkbox", a && `checkbox--${a}`, o && "checkbox--error"),
2613
- children: [
2614
- /* @__PURE__ */ n.jsx(
2615
- "input",
2616
- C({
2617
- id: s,
2618
- name: r,
2619
- type: "checkbox",
2620
- ref: f,
2621
- className: P("checkbox__input", c),
2622
- value: l ? "true" : ""
2623
- }, u)
2624
- ),
2625
- i ? /* @__PURE__ */ n.jsx(Vs, { className: "checkbox__spinner", "aria-hidden": !0 }) : /* @__PURE__ */ n.jsx(As, { className: "checkbox__check", "aria-hidden": !0, strokeDasharray: "75" }),
2626
- /* @__PURE__ */ n.jsx(lr, { id: s, name: r, children: h })
2627
- ]
2628
- }
2629
- );
2630
- };
2631
- q.Content = ar;
2632
- q.Label = ur;
2633
- q.Hint = or;
2634
- q.Error = Error;
2635
- var dr = (e) => {
2636
- var t = e, { type: s = "div", className: r, children: i } = t, a = O(t, ["type", "className", "children"]);
2637
- return d.createElement(s, C({ className: P("dialog__body", r) }, a), i);
2638
- }, pe = () => document.body.style.removeProperty("overflow"), De = (e) => e.preventDefault(), hr = '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])', fr = (e) => {
2639
- var t = e, { className: s, children: r, shouldAnimate: i = !0 } = t, a = O(t, ["className", "children", "shouldAnimate"]);
2640
- const { ref: o, defaultOpen: l, isModal: c, onClose: h } = J();
2641
- return d.useEffect(() => {
2642
- const u = o == null ? void 0 : o.current;
2643
- if (u != null && u.open) {
2644
- const f = u.querySelectorAll(hr), m = f[0], p = f[f.length - 1], g = (b) => {
2645
- if (!(b.key === "Tab"))
2646
- return;
2647
- b.shiftKey ? document.activeElement === m && (p.focus(), b.preventDefault()) : document.activeElement === p && (m.focus(), b.preventDefault());
2648
- };
2649
- return document.body.style.overflow = "hidden", u.addEventListener("keydown", g), window.addEventListener("popstate", () => pe()), () => {
2650
- u.removeEventListener("keydown", g), window.removeEventListener("popstate", () => pe());
2651
- };
2652
- }
2653
- }, [o]), d.useEffect(() => {
2654
- const u = o == null ? void 0 : o.current;
2655
- if (!u)
2656
- return;
2657
- if (l && (u.removeAttribute("open"), u.showModal(), u.focus()), c)
2658
- return u.addEventListener("cancel", De), () => u.removeEventListener("cancel", De);
2659
- const f = ({ clientX: m, clientY: p }) => {
2660
- const { top: g, right: b, bottom: v, left: y } = u.getBoundingClientRect(), _ = 0 < p && 0 < m, j = g < p && p < v, S = y < m && m < b;
2661
- _ && !(j && S) && h();
2662
- };
2663
- return u.addEventListener("cancel", h), u.addEventListener("mousedown", f), () => {
2664
- u.removeEventListener("cancel", h), u.removeEventListener("mousedown", f);
2665
- };
2666
- }, [o, c, h, l]), /* @__PURE__ */ n.jsx(
2667
- "dialog",
2668
- R(C({
2669
- ref: o,
2670
- open: l,
2671
- "aria-modal": !!c,
2672
- "aria-labelledby": "dialogTitle",
2673
- className: P("dialog", i && "dialog--animated", s)
2674
- }, a), {
2675
- children: r
2676
- })
2677
- );
2678
- }, ct = d.createContext(void 0), pr = ({ defaultOpen: e, onClose: t, isModal: s, children: r }) => {
2679
- const i = d.useRef(null), a = d.useRef(t), o = d.useCallback(() => {
2680
- var l;
2681
- pe(), (l = i.current) == null || l.close(), a.current && (a == null || a.current());
2682
- }, [i]);
2683
- return /* @__PURE__ */ n.jsx(ct.Provider, { value: { ref: i, defaultOpen: e, isModal: s, onClose: o }, children: r });
2684
- }, J = () => {
2685
- const e = d.useContext(ct);
2686
- if (!e)
2687
- throw new Error("Dialog compound components can not be rendered outside of Dialog");
2688
- return e;
2689
- }, vr = (e) => {
2690
- var t = e, { children: s } = t, r = O(t, ["children"]);
2691
- const { onClose: i } = J();
2692
- return /* @__PURE__ */ n.jsx(Y, R(C({ onClick: i }, r), { children: s }));
2693
- }, ut = d.forwardRef((e, t) => {
2694
- var s = e, { className: r } = s, i = O(s, ["className"]);
2695
- const { onClose: a } = J();
2696
- return /* @__PURE__ */ n.jsx(
2697
- Y,
2698
- C({
2699
- type: "submit",
2700
- ref: t,
2701
- formMethod: "dialog",
2702
- onClick: a,
2703
- iconLeft: /* @__PURE__ */ n.jsx(ks, {}),
2704
- variant: "icon--secondary",
2705
- className: P("dialog__close button--icon", r)
2706
- }, i)
2707
- );
2708
- });
2709
- ut.displayName = "Close";
2710
- var mr = (e) => {
2711
- var t = e, { className: s, children: r } = t, i = O(t, ["className", "children"]);
2712
- return /* @__PURE__ */ n.jsx("div", R(C({ className: P("dialog__footer", s) }, i), { children: r }));
2713
- }, yr = ({ children: e }) => /* @__PURE__ */ n.jsx("div", { className: "dialog__header", children: e }), Cr = (e) => {
2714
- var t = e, { icon: s, children: r, className: i } = t, a = O(t, ["icon", "children", "className"]);
2715
- const { ref: o } = J(), l = d.useRef(null);
2716
- return d.useEffect(() => {
2717
- o != null && o.current && o.current.focus();
2718
- }, [o]), /* @__PURE__ */ n.jsxs(
2719
- "div",
2720
- R(C({
2721
- tabIndex: 0,
2722
- ref: l,
2723
- id: "dialogTitle",
2724
- className: P("dialog__header__title", i)
2725
- }, a), {
2726
- children: [
2727
- s && /* @__PURE__ */ n.jsx("span", { className: "dialog__header__icon", children: s }),
2728
- r
2729
- ]
2730
- })
2731
- );
2732
- }, gr = (e) => {
2733
- var t = e, { children: s } = t, r = O(t, ["children"]);
2734
- const { ref: i } = J();
2735
- return /* @__PURE__ */ n.jsx(Y, R(C({ onClick: () => {
2736
- var a;
2737
- return (a = i == null ? void 0 : i.current) == null ? void 0 : a.showModal();
2738
- } }, r), { children: s }));
2739
- }, F = ({ defaultOpen: e, isModal: t, children: s, onClose: r }) => /* @__PURE__ */ n.jsx(pr, { defaultOpen: !!e, isModal: t, onClose: r, children: s });
2740
- F.Trigger = gr;
2741
- F.Root = fr;
2742
- F.Title = Cr;
2743
- F.Header = yr;
2744
- F.Body = dr;
2745
- F.Footer = mr;
2746
- F.Button = vr;
2747
- F.Close = ut;
2748
- var dt = d.createContext(void 0), xr = ({
2749
- id: e,
2750
- position: t,
2751
- isOpen: s,
2752
- setIsOpen: r,
2753
- activeItemIndex: i,
2754
- setActiveItemIndex: a,
2755
- clearActiveItemIndex: o,
2756
- triggerRef: l,
2757
- contentRef: c,
2758
- children: h
2759
- }) => /* @__PURE__ */ n.jsx(
2760
- dt.Provider,
2761
- {
2762
- value: {
2763
- id: e,
2764
- position: t,
2765
- isOpen: s,
2766
- setIsOpen: r,
2767
- activeItemIndex: i,
2768
- setActiveItemIndex: a,
2769
- clearActiveItemIndex: o,
2770
- triggerRef: l,
2771
- contentRef: c
2772
- },
2773
- children: h
2774
- }
2775
- ), ht = () => {
2776
- const e = d.useContext(dt);
2777
- if (e === void 0)
2778
- throw new Error("useMenu must be used within a MenuProvider");
2779
- return e;
2780
- }, br = ({ as: e, children: t }) => {
2781
- const {
2782
- id: s,
2783
- position: r,
2784
- isOpen: i,
2785
- setIsOpen: a,
2786
- activeItemIndex: o,
2787
- setActiveItemIndex: l,
2788
- clearActiveItemIndex: c,
2789
- triggerRef: h,
2790
- contentRef: u
2791
- } = ht(), f = (m) => {
2792
- var p;
2793
- if (!i)
2794
- return;
2795
- if (m.key === "Escape")
2796
- return c(), a(!1), (p = h.current) == null ? void 0 : p.focus();
2797
- const g = u.current.childElementCount - 1;
2798
- switch (m.key) {
2799
- case "ArrowUp":
2800
- case "ArrowLeft":
2801
- return m.preventDefault(), l(o ? Math.max(0, o - 1) : 0);
2802
- case "ArrowDown":
2803
- case "ArrowRight": {
2804
- m.preventDefault();
2805
- const b = o !== void 0 ? o + 1 : 0;
2806
- return l(Math.min(g, b));
2807
- }
2808
- case "Home":
2809
- return m.preventDefault(), l(0);
2810
- case "End":
2811
- return m.preventDefault(), l(g);
2812
- }
2813
- };
2814
- return e ? d.createElement(
2815
- e,
2816
- {
2817
- id: `${s}-content`,
2818
- ref: u,
2819
- className: P("menu__list", `menu__list--${r}`, i && "menu__list--active"),
2820
- onKeyDown: f
2821
- },
2822
- t
2823
- ) : (
2824
- // eslint-disable-next-line jsx-a11y/no-noninteractive-element-interactions
2825
- /* @__PURE__ */ n.jsx(
2826
- "ul",
2827
- {
2828
- id: `${s}-content`,
2829
- ref: u,
2830
- className: P("menu__list", `menu__list--${r}`, i && "menu__list--active"),
2831
- onKeyDown: f,
2832
- children: t
2833
- }
2834
- )
2835
- );
2836
- }, wr = (e) => {
2837
- var t = e, { children: s, className: r } = t, i = O(t, ["children", "className"]);
2838
- return /* @__PURE__ */ n.jsx("li", R(C({}, i), { className: P("menu__list-item", r), children: s }));
2839
- }, ft = ({ children: e, className: t }) => {
2840
- const { id: s, isOpen: r, setIsOpen: i, clearActiveItemIndex: a, setActiveItemIndex: o, triggerRef: l } = ht(), c = () => {
2841
- a(), i((u) => !u);
2842
- }, h = (u) => {
2843
- if (r) {
2844
- if (u.key === "Escape")
2845
- return a(), i(!1);
2846
- u.key === "ArrowDown" && (u.preventDefault(), o(0));
2847
- }
2848
- };
2849
- return d.cloneElement(e, {
2850
- id: `${s}-trigger`,
2851
- ref: l,
2852
- className: P("menu__trigger", t),
2853
- onClick: c,
2854
- onKeyDown: h,
2855
- "aria-expanded": r,
2856
- "aria-controls": `${s}-content`
2857
- });
2858
- };
2859
- ft.displayName = "Trigger";
2860
- var L = (e) => {
2861
- var t = e, { type: s, id: r, position: i = "right", children: a, className: o } = t, l = O(t, ["type", "id", "position", "children", "className"]);
2862
- const c = d.useRef(null), h = d.useRef(null), u = d.useRef(null), [f, m] = d.useState(!1), [p, g] = d.useState(), [b, v] = d.useState(p);
2863
- p !== b && p !== void 0 && (u.current.children[p].firstChild.focus(), v(p));
2864
- const y = () => {
2865
- g(void 0), v(void 0);
2866
- }, _ = (j) => {
2867
- var S;
2868
- ((S = c.current) == null ? void 0 : S.contains(j.relatedTarget)) || (y(), m(!1));
2869
- };
2870
- return /* @__PURE__ */ n.jsx(
2871
- xr,
2872
- {
2873
- id: r,
2874
- position: i,
2875
- isOpen: f,
2876
- setIsOpen: m,
2877
- activeItemIndex: p,
2878
- setActiveItemIndex: g,
2879
- clearActiveItemIndex: y,
2880
- triggerRef: h,
2881
- contentRef: u,
2882
- children: d.createElement(
2883
- s,
2884
- R(C({}, l), {
2885
- id: r,
2886
- ref: c,
2887
- className: `menu ${o || ""}`,
2888
- onBlur: _
2889
- }),
2890
- a
2891
- )
2892
- }
2893
- );
2894
- };
2895
- L.Trigger = ft;
2896
- L.Content = br;
2897
- L.Item = wr;
2898
- d.createContext(void 0);
2899
- var jr = (/* @__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");
2900
- [...new Set(jr.values())].map((e) => ({
2901
- label: `+${e}`,
2902
- value: e
2903
- }));
2904
- d.createContext(void 0);
2905
- d.createContext(void 0);
2906
- var ie = /* @__PURE__ */ ((e) => (e[e.categoriesVegetables = 0] = "categoriesVegetables", e[e.categoriesMeat = 1] = "categoriesMeat", e[e.categoriesFish = 2] = "categoriesFish", e[e.categoriesDairy = 3] = "categoriesDairy", e[e.categoriesBreakfast = 4] = "categoriesBreakfast", e[e.categoriesSnacks = 5] = "categoriesSnacks", e[e.categoriesCandy = 6] = "categoriesCandy", e[e.categoriesNonFood = 7] = "categoriesNonFood", e[e.categoriesDryFood = 8] = "categoriesDryFood", e[e.categoriesTins = 9] = "categoriesTins", e[e.categoriesGrid = 10] = "categoriesGrid", e[e.categoriesSoda = 11] = "categoriesSoda", e[e.categoriesBakery = 12] = "categoriesBakery", e[e.categoriesWine = 13] = "categoriesWine", e[e.categoriesBaby = 14] = "categoriesBaby", e[e.categoriesDiet = 15] = "categoriesDiet", e[e.categoriesHygiene = 16] = "categoriesHygiene", e[e.categoriesCleaning = 17] = "categoriesCleaning", e[e.categoriesPets = 18] = "categoriesPets", e[e.categoriesFreezer = 19] = "categoriesFreezer", e[e.categoriesBbq = 20] = "categoriesBbq", e[e.categoriesMealbox = 21] = "categoriesMealbox", e[e.categoriesBrik = 22] = "categoriesBrik", e[e.categoriesGranen = 23] = "categoriesGranen", e[e.categoriesConserve = 24] = "categoriesConserve", e[e.categoriesHome = 25] = "categoriesHome", e[e.categoriesEaster = 26] = "categoriesEaster", e[e.categoriesOnlinePromo = 27] = "categoriesOnlinePromo", e[e.categoriesSportFood = 28] = "categoriesSportFood", e[e.categoriesClothing = 29] = "categoriesClothing", e[e.categoriesEnergy = 30] = "categoriesEnergy", e[e.categoriesDeskAndTravel = 31] = "categoriesDeskAndTravel", e[e.categoriesCigarette = 32] = "categoriesCigarette", e[e.categoriesFood = 33] = "categoriesFood", e[e.categoriesChild = 34] = "categoriesChild", e[e.categoriesPuzzle = 35] = "categoriesPuzzle", e[e.categoriesToys = 36] = "categoriesToys", e[e.categoriesCar = 37] = "categoriesCar", e[e.categoriesPlaceholder = 38] = "categoriesPlaceholder", e[e.categoriesFuel = 39] = "categoriesFuel", e[e.categoriesCarAndBike = 40] = "categoriesCarAndBike", e[e.categoriesToyAndHobby = 41] = "categoriesToyAndHobby", e[e.categoriesMultimedia = 42] = "categoriesMultimedia", e[e.categoriesParty = 43] = "categoriesParty", e[e.toolsPay = 44] = "toolsPay", e[e.toolsReceipt = 45] = "toolsReceipt", e[e.toolsFuel = 46] = "toolsFuel", e[e.toolsStoreLocator = 47] = "toolsStoreLocator", e[e.toolsStats = 48] = "toolsStats", e[e.toolsShowXtraOld = 49] = "toolsShowXtraOld", e[e.toolsShowXtraNew = 50] = "toolsShowXtraNew", e[e.toolsScan2 = 51] = "toolsScan2", e[e.toolsRecipes2 = 52] = "toolsRecipes2", e[e.toolsWarranty = 53] = "toolsWarranty", e[e.toolsCoupons = 54] = "toolsCoupons", e[e.toolsFavoriteInactive = 55] = "toolsFavoriteInactive", e[e.toolsFavoriteActive = 56] = "toolsFavoriteActive", e[e.toolsAssortment = 57] = "toolsAssortment", e[e.toolsPromo = 58] = "toolsPromo", e[e.fuelCng = 59] = "fuelCng", e[e.fuelE5 = 60] = "fuelE5", e[e.fuelAdblue = 61] = "fuelAdblue", e[e.fuelB7 = 62] = "fuelB7", e[e.fuelH2 = 63] = "fuelH2", e[e.fuelE10 = 64] = "fuelE10", e[e.fuelFreeTireInflation = 65] = "fuelFreeTireInflation", e[e.functionalClose = 66] = "functionalClose", e[e.functionalBack = 67] = "functionalBack", e[e.functionalSearch = 68] = "functionalSearch", e[e.functionalEdit = 69] = "functionalEdit", e[e.functionalShare = 70] = "functionalShare", e[e.functionalLocation = 71] = "functionalLocation", e[e.functionalTrash = 72] = "functionalTrash", e[e.functionalCamera = 73] = "functionalCamera", e[e.functionalPhone = 74] = "functionalPhone", e[e.functionalPushNotifications = 75] = "functionalPushNotifications", e[e.functionalMail = 76] = "functionalMail", e[e.functionalGift = 77] = "functionalGift", e[e.functionalPresent = 78] = "functionalPresent", e[e.functionalLoading = 79] = "functionalLoading", e[e.functionalChevronRight = 80] = "functionalChevronRight", e[e.functionalCheck = 81] = "functionalCheck", e[e.functionalChevronDown = 82] = "functionalChevronDown", e[e.functionalChevronUp = 83] = "functionalChevronUp", e[e.functionalPlus = 84] = "functionalPlus", e[e.functionalReset = 85] = "functionalReset", e[e.functionalDownload = 86] = "functionalDownload", e[e.functionalExport = 87] = "functionalExport", e[e.functionalCustomerService = 88] = "functionalCustomerService", e[e.functionalTruck = 89] = "functionalTruck", e[e.functionalBox = 90] = "functionalBox", e[e.functionalEllipsis = 91] = "functionalEllipsis", e[e.functionalLocationHome = 92] = "functionalLocationHome", e[e.functionalLocationPickup = 93] = "functionalLocationPickup", e[e.functionalAccount = 94] = "functionalAccount", e[e.functionalPrivacy = 95] = "functionalPrivacy", e[e.functionalSettings = 96] = "functionalSettings", e[e.functionalUserInfo = 97] = "functionalUserInfo", e[e.functionalPinOutlines = 98] = "functionalPinOutlines", e[e.functionalCalendar = 99] = "functionalCalendar", e[e.functionalMinus = 100] = "functionalMinus", e[e.functionalLifestyle = 101] = "functionalLifestyle", e[e.functionalSms = 102] = "functionalSms", e[e.functionalSwitch = 103] = "functionalSwitch", e[e.functionalSorting = 104] = "functionalSorting", e[e.functionalWarningCircle = 105] = "functionalWarningCircle", e[e.functionalQuestionCircle = 106] = "functionalQuestionCircle", e[e.functionalErrorCircle = 107] = "functionalErrorCircle", e[e.functionalSuccessCircle = 108] = "functionalSuccessCircle", e[e.functionalMessage = 109] = "functionalMessage", e[e.functionalExternalLink = 110] = "functionalExternalLink", e[e.functionalAddToList = 111] = "functionalAddToList", e[e.functionalShoppingcart = 112] = "functionalShoppingcart", e[e.functionalFilter = 113] = "functionalFilter", e[e.functionalLocate = 114] = "functionalLocate", e[e.functionalBarcode = 115] = "functionalBarcode", e[e.functionalClock = 116] = "functionalClock", e[e.functionalHistory = 117] = "functionalHistory", e[e.functionalShops = 118] = "functionalShops", e[e.functionalAddUser = 119] = "functionalAddUser", e[e.functionalOther = 120] = "functionalOther", e[e.functionalInAppNotifications = 121] = "functionalInAppNotifications", e[e.functionalExit = 122] = "functionalExit", e[e.functionalShared = 123] = "functionalShared", e[e.functionalThumbsup = 124] = "functionalThumbsup", e[e.functionalDiscount = 125] = "functionalDiscount", e[e.functionalPercentage = 126] = "functionalPercentage", e[e.functionalList = 127] = "functionalList", e[e.functionalMapLocation = 128] = "functionalMapLocation", e[e.functionalNoConnection = 129] = "functionalNoConnection", e[e.functionalSwap = 130] = "functionalSwap", e[e.functionalPiece = 131] = "functionalPiece", e[e.functionalWeight = 132] = "functionalWeight", e[e.functionalPack = 133] = "functionalPack", e[e.functionalCommunications = 134] = "functionalCommunications", e[e.functionalDeliveryAddresses = 135] = "functionalDeliveryAddresses", e[e["functional18+"] = 136] = "functional18+", e[e.functionalReadtime = 137] = "functionalReadtime", e[e.functionalCopy = 138] = "functionalCopy", e[e.functionalMessageField = 139] = "functionalMessageField", e[e.functionalNext = 140] = "functionalNext", e[e.functionalSave = 141] = "functionalSave", e[e.functionalLogin = 142] = "functionalLogin", e[e.functionalLogout = 143] = "functionalLogout", e[e.functionalWebsite = 144] = "functionalWebsite", e[e.functionalMenu = 145] = "functionalMenu", e[e.functionalRegister = 146] = "functionalRegister", e[e.functionalNews = 147] = "functionalNews", e[e.functionalTimer = 148] = "functionalTimer", e[e.functionalEyeShow = 149] = "functionalEyeShow", e[e.functionalMobilePay = 150] = "functionalMobilePay", e[e.functionalConnectionCable = 151] = "functionalConnectionCable", e[e.functionalDryCleaning = 152] = "functionalDryCleaning", e[e.functionalKiosk = 153] = "functionalKiosk", e[e.functionalConnectedDevice = 154] = "functionalConnectedDevice", e[e.functionalCookies = 155] = "functionalCookies", e[e.functionalViewFile = 156] = "functionalViewFile", e[e.functionalLastAdded = 157] = "functionalLastAdded", e[e.functionalFirstAdded = 158] = "functionalFirstAdded", e[e.functionalStoreLayout = 159] = "functionalStoreLayout", e[e.functionalBlock = 160] = "functionalBlock", e[e.functionalChecklist = 161] = "functionalChecklist", e[e.functionalCartCheckout = 162] = "functionalCartCheckout", e[e.functionalCartEdit = 163] = "functionalCartEdit", e[e.functionalEyeHidden = 164] = "functionalEyeHidden", e[e.functionalWarningCircleFilled = 165] = "functionalWarningCircleFilled", e[e.functionalErrorCircleFilled = 166] = "functionalErrorCircleFilled", e[e.functionalSuccessCircleFilled = 167] = "functionalSuccessCircleFilled", e[e.functionalPlusCircle = 168] = "functionalPlusCircle", e[e.functionalSpinner = 169] = "functionalSpinner", e[e.functionalEcoEarth = 170] = "functionalEcoEarth", e[e.functionalAlphaBeta = 171] = "functionalAlphaBeta", e[e.functionalEuro = 172] = "functionalEuro", e[e.functionalNumber = 173] = "functionalNumber", e[e.functionalIdea = 174] = "functionalIdea", e[e.functionalMultifactorAuthenticator = 175] = "functionalMultifactorAuthenticator", e[e.functionalPassword = 176] = "functionalPassword", e[e.functionalDiscountCode = 177] = "functionalDiscountCode", e))(ie || {});
2907
- const Sr = "/icons/bouMenuIcons.svg", Er = ({
2908
- bouIconId: e,
2909
- ...t
2910
- }) => /* @__PURE__ */ n.jsx("svg", { width: "24", height: "24", viewBox: "0 0 24 24", ...t, children: /* @__PURE__ */ n.jsx("use", { href: `${Sr}#${ie[e]}` }) }), U = ({
2911
- className: e,
2912
- label: t,
2913
- mobileUrl: s,
2914
- desktopUrl: r,
2915
- icon: i
2916
- }) => {
2917
- const a = () => typeof i == "string" && i in ie ? /* @__PURE__ */ n.jsx(Er, { bouIconId: ie[i] }) : i;
2918
- return /* @__PURE__ */ n.jsxs(L.Item, { className: e, children: [
2919
- /* @__PURE__ */ n.jsxs("a", { href: s, referrerPolicy: "no-referrer-when-downgrade", children: [
2920
- a(),
2921
- t
2922
- ] }),
2923
- r && /* @__PURE__ */ n.jsxs("a", { href: r, referrerPolicy: "no-referrer-when-downgrade", children: [
2924
- a(),
2925
- t
2926
- ] })
2927
- ] });
2928
- }, pt = d.createContext(void 0), Rr = ({
2929
- position: e,
2930
- bouMenuItems: t,
2931
- authenticationStatus: s,
2932
- profile: r,
2933
- children: i
2934
- }) => /* @__PURE__ */ n.jsx(pt.Provider, { value: { position: e, bouMenuItems: t, authenticationStatus: s, profile: r }, children: i }), je = () => {
2935
- const e = d.useContext(pt);
2936
- if (!e)
2937
- throw new Error("Authentication context can not be rendered outside of Authentication");
2938
- return e;
2939
- }, vt = d.createContext(void 0), Pr = ({ apiUrl: e, redirectUrl: t, children: s }) => /* @__PURE__ */ n.jsx(vt.Provider, { value: { apiUrl: e, redirectUrl: t }, children: s }), mt = () => {
2940
- const e = d.useContext(vt);
2941
- if (!e)
2942
- throw new Error("Api context can not be rendered outside of Api");
2943
- return e;
2944
- }, yt = () => {
2945
- const { apiUrl: e, redirectUrl: t } = mt(), s = bt();
2946
- return wt({ apiUrl: e, redirectUrl: t, trackingInfo: s });
2947
- }, G = () => {
2948
- const { apiUrl: e } = mt(), { loginUrl: t, logoutUrl: s } = yt(), r = `${e}/user/profile`, i = `${e}/gdpr/tc/check`, a = `${e}/gdpr/tc`;
2949
- return {
2950
- loginUrl: t,
2951
- logoutUrl: s,
2952
- profileEndpoint: r,
2953
- getTermsAndConditionsEndpoint: i,
2954
- postTermsAndConditionsEndpoint: a
2955
- };
2956
- }, _r = (e) => e != null && e.length ? /* @__PURE__ */ n.jsx("ul", { className: "bou-menu__list", children: e == null ? void 0 : e.map(({ label: t, icon: s, url: r }, i) => /* @__PURE__ */ n.jsx(
2957
- U,
2958
- {
2959
- className: "bou-menu-item",
2960
- mobileUrl: r,
2961
- desktopUrl: r,
2962
- icon: s,
2963
- label: t
2964
- },
2965
- i
2966
- )) }) : null, Ar = () => {
2967
- const { t: e } = H(), t = Qe(), { position: s, profile: r, bouMenuItems: i } = je(), { logoutUrl: a } = G(), o = (r == null ? void 0 : r.firstName) ?? "", l = (r == null ? void 0 : r.lastName) ?? "";
2968
- return /* @__PURE__ */ n.jsxs(L, { type: "nav", id: "xtra-menu", position: s, children: [
2969
- /* @__PURE__ */ n.jsx(
2970
- L.Trigger,
2971
- {
2972
- className: P(
2973
- "button",
2974
- "button--neutral",
2975
- "button--authentication",
2976
- "button--authentication--authenticated"
2977
- ),
2978
- children: /* @__PURE__ */ n.jsxs("button", { children: [
2979
- /* @__PURE__ */ n.jsx("div", { className: "button__icon", children: /* @__PURE__ */ n.jsx(js, { variant: "small", firstName: o, lastName: l }) }),
2980
- /* @__PURE__ */ n.jsx("span", { className: "button__label", children: o }),
2981
- /* @__PURE__ */ n.jsx("div", { className: "button__icon button__icon-right", children: /* @__PURE__ */ n.jsx(be, {}) })
2982
- ] })
2983
- }
2984
- ),
2985
- /* @__PURE__ */ n.jsxs(L.Content, { as: "div", children: [
2986
- _r(i),
2987
- /* @__PURE__ */ n.jsxs("ul", { children: [
2988
- /* @__PURE__ */ n.jsx(
2989
- U,
2990
- {
2991
- className: "manage-profile",
2992
- mobileUrl: `${t}/manage-profile`,
2993
- desktopUrl: `${t}/manage-profile/personal-data`,
2994
- icon: /* @__PURE__ */ n.jsx(Qs, {}),
2995
- label: e("manageProfile")
2996
- }
2997
- ),
2998
- /* @__PURE__ */ n.jsx(
2999
- U,
3000
- {
3001
- className: "payment",
3002
- mobileUrl: `${t}/payment`,
3003
- icon: /* @__PURE__ */ n.jsx(Js, {}),
3004
- label: e("payment")
3005
- }
3006
- ),
3007
- /* @__PURE__ */ n.jsx(
3008
- U,
3009
- {
3010
- className: "gift-cards",
3011
- mobileUrl: `${t}/gift-cards`,
3012
- icon: /* @__PURE__ */ n.jsx(zs, {}),
3013
- label: e("giftCards")
3014
- }
3015
- ),
3016
- /* @__PURE__ */ n.jsx(
3017
- U,
3018
- {
3019
- mobileUrl: `${t}/identifiers`,
3020
- icon: /* @__PURE__ */ n.jsx(Is, {}),
3021
- label: e("qrCode")
3022
- }
3023
- ),
3024
- /* @__PURE__ */ n.jsx(
3025
- U,
3026
- {
3027
- className: "manage-privacy",
3028
- mobileUrl: `${t}/manage-privacy`,
3029
- desktopUrl: `${t}/manage-privacy/permissions`,
3030
- icon: /* @__PURE__ */ n.jsx(Ts, {}),
3031
- label: e("privacy")
3032
- }
3033
- ),
3034
- /* @__PURE__ */ n.jsx(U, { mobileUrl: a, icon: /* @__PURE__ */ n.jsx(Ls, {}), label: e("logout") })
3035
- ] })
3036
- ] })
3037
- ] });
3038
- }, Or = () => {
3039
- const { t: e } = H();
3040
- return /* @__PURE__ */ n.jsxs("button", { className: P("button", "button--neutral", "button--authentication"), children: [
3041
- /* @__PURE__ */ n.jsx("div", { className: "button__icon", children: /* @__PURE__ */ n.jsx("i", { className: "spinner" }) }),
3042
- /* @__PURE__ */ n.jsxs("span", { className: "button__label", children: [
3043
- e("loading"),
3044
- "..."
3045
- ] })
3046
- ] });
3047
- }, kr = ({ className: e }) => {
3048
- const { t } = H(), { loginUrl: s } = G();
3049
- return /* @__PURE__ */ n.jsxs(
3050
- "a",
3051
- {
3052
- href: s,
3053
- className: P(
3054
- "button",
3055
- "button--neutral",
3056
- "button--authentication",
3057
- "button--authentication--unauthenticated",
3058
- e
3059
- ),
3060
- children: [
3061
- /* @__PURE__ */ n.jsx("div", { className: "button__icon", children: /* @__PURE__ */ n.jsx(we, { width: 24, height: 24, suffix: "desktop" }) }),
3062
- /* @__PURE__ */ n.jsx("span", { className: "button__label", children: t("login") }),
3063
- /* @__PURE__ */ n.jsx("div", { className: "button__icon button__icon-right", children: /* @__PURE__ */ n.jsx(be, {}) })
3064
- ]
3065
- }
3066
- );
3067
- };
3068
- const Fr = () => {
3069
- const { t: e } = H(), { loginUrl: t } = G(), s = Qe(), { position: r } = je();
3070
- return /* @__PURE__ */ n.jsxs(
3071
- L,
3072
- {
3073
- type: "nav",
3074
- id: "xtra-menu",
3075
- position: r,
3076
- className: "menu--unauthenticated",
3077
- "aria-label": e("xtraMenuAriaLabel"),
3078
- children: [
3079
- /* @__PURE__ */ n.jsx(L.Trigger, { className: P("button", "button--neutral", "button--authentication"), children: /* @__PURE__ */ n.jsxs("button", { children: [
3080
- /* @__PURE__ */ n.jsx("div", { className: "button__icon", children: /* @__PURE__ */ n.jsx(we, { width: 24, height: 24, suffix: "mobile" }) }),
3081
- /* @__PURE__ */ n.jsx("div", { className: "button__icon button__icon-right", children: /* @__PURE__ */ n.jsx(be, {}) })
3082
- ] }) }),
3083
- /* @__PURE__ */ n.jsxs(L.Content, { children: [
3084
- /* @__PURE__ */ n.jsx(L.Item, { children: /* @__PURE__ */ n.jsxs("a", { href: t, className: "button button--with-icon", children: [
3085
- /* @__PURE__ */ n.jsx("span", { className: "button__icon", children: /* @__PURE__ */ n.jsx(Ms, {}) }),
3086
- /* @__PURE__ */ n.jsx("span", { className: "button__label", children: e("login") })
3087
- ] }) }),
3088
- /* @__PURE__ */ n.jsx(L.Item, { children: /* @__PURE__ */ n.jsxs("a", { href: `${s}/onboarding/register`, className: "button button--with-icon", children: [
3089
- /* @__PURE__ */ n.jsx("span", { className: "button__icon", children: /* @__PURE__ */ n.jsx(Hs, {}) }),
3090
- /* @__PURE__ */ n.jsx("span", { className: "button__label", children: e("register") })
3091
- ] }) })
3092
- ] })
3093
- ]
3094
- }
3095
- );
3096
- };
3097
- var D = /* @__PURE__ */ ((e) => (e.Authenticated = "authenticated", e.NotAuthenticated = "notAuthenticated", e.Pending = "pending", e))(D || {});
3098
- const Mr = () => {
3099
- const { authenticationStatus: e } = je();
3100
- return e === D.NotAuthenticated ? /* @__PURE__ */ n.jsxs(n.Fragment, { children: [
3101
- /* @__PURE__ */ n.jsx(kr, {}),
3102
- /* @__PURE__ */ n.jsx(Fr, {})
3103
- ] }) : e === D.Pending ? /* @__PURE__ */ n.jsx(Or, {}) : /* @__PURE__ */ n.jsx(Ar, {});
3104
- };
3105
- /*! js-cookie v3.0.5 | MIT */
3106
- function X(e) {
3107
- for (var t = 1; t < arguments.length; t++) {
3108
- var s = arguments[t];
3109
- for (var r in s)
3110
- e[r] = s[r];
3111
- }
3112
- return e;
3113
- }
3114
- var Nr = {
3115
- read: function(e) {
3116
- return e[0] === '"' && (e = e.slice(1, -1)), e.replace(/(%[\dA-F]{2})+/gi, decodeURIComponent);
3117
- },
3118
- write: function(e) {
3119
- return encodeURIComponent(e).replace(
3120
- /%(2[346BF]|3[AC-F]|40|5[BDE]|60|7[BCD])/g,
3121
- decodeURIComponent
3122
- );
3123
- }
3124
- };
3125
- function ve(e, t) {
3126
- function s(i, a, o) {
3127
- if (!(typeof document > "u")) {
3128
- o = X({}, t, o), typeof o.expires == "number" && (o.expires = new Date(Date.now() + o.expires * 864e5)), o.expires && (o.expires = o.expires.toUTCString()), i = encodeURIComponent(i).replace(/%(2[346B]|5E|60|7C)/g, decodeURIComponent).replace(/[()]/g, escape);
3129
- var l = "";
3130
- for (var c in o)
3131
- o[c] && (l += "; " + c, o[c] !== !0 && (l += "=" + o[c].split(";")[0]));
3132
- return document.cookie = i + "=" + e.write(a, i) + l;
3133
- }
3134
- }
3135
- function r(i) {
3136
- if (!(typeof document > "u" || arguments.length && !i)) {
3137
- for (var a = document.cookie ? document.cookie.split("; ") : [], o = {}, l = 0; l < a.length; l++) {
3138
- var c = a[l].split("="), h = c.slice(1).join("=");
3139
- try {
3140
- var u = decodeURIComponent(c[0]);
3141
- if (o[u] = e.read(h, u), i === u)
3142
- break;
3143
- } catch {
3144
- }
3145
- }
3146
- return i ? o[i] : o;
3147
- }
3148
- }
3149
- return Object.create(
3150
- {
3151
- set: s,
3152
- get: r,
3153
- remove: function(i, a) {
3154
- s(
3155
- i,
3156
- "",
3157
- X({}, a, {
3158
- expires: -1
3159
- })
3160
- );
3161
- },
3162
- withAttributes: function(i) {
3163
- return ve(this.converter, X({}, this.attributes, i));
3164
- },
3165
- withConverter: function(i) {
3166
- return ve(X({}, this.converter, i), this.attributes);
3167
- }
3168
- },
3169
- {
3170
- attributes: { value: Object.freeze(t) },
3171
- converter: { value: Object.freeze(e) }
3172
- }
3173
- );
3174
- }
3175
- var me = ve(Nr, { path: "/" });
3176
- class ye extends Error {
3177
- constructor(t) {
3178
- super(t), this.name = "UnauthorizedError";
3179
- }
3180
- }
3181
- const Lr = () => {
3182
- const { i18n: e } = H(), { profileEndpoint: t } = G();
3183
- return rt({
3184
- queryKey: ["profile"],
3185
- queryFn: async () => {
3186
- const r = await fetch(t, {
3187
- credentials: "include",
3188
- mode: "cors",
3189
- headers: { "Accept-Language": e.language }
3190
- });
3191
- if (!r.ok)
3192
- throw r.status === 401 ? new ye(`${r.status} - ${r.statusText}`) : new Error("Network response was not ok");
3193
- return await r.json();
3194
- },
3195
- retry: (r, i) => i instanceof ye ? !1 : r < 2,
3196
- refetchOnWindowFocus: !1
3197
- });
3198
- }, Te = (e) => e ? `+${e.countryCode} ${e.number}` : "", Ue = (e, t) => t == null ? void 0 : t.find((s) => s.type === e), Dr = (e) => {
3199
- const t = new Date(e.dateOfBirth), s = Ue(Se.Mobile, e.phone), r = Ue(Se.Fixed, e.phone), i = Te(s) ?? Te(r) ?? "";
3200
- return {
3201
- user: {
3202
- firstName: () => e.firstName,
3203
- lastName: () => e.lastName,
3204
- dob: () => t.getDate(),
3205
- mob: () => t.getMonth() + 1,
3206
- yob: () => t.getFullYear(),
3207
- gender: () => e.genderCode,
3208
- phone: () => i,
3209
- streetName: () => {
3210
- var a;
3211
- return (a = e.address) == null ? void 0 : a.streetName;
3212
- },
3213
- houseNr: () => {
3214
- var a;
3215
- return (a = e.address) == null ? void 0 : a.houseNumber;
3216
- },
3217
- box: () => {
3218
- var a;
3219
- return (a = e.address) == null ? void 0 : a.letterBoxName;
3220
- },
3221
- zip: () => {
3222
- var a;
3223
- return (a = e.address) == null ? void 0 : a.postalCode;
3224
- },
3225
- city: () => {
3226
- var a;
3227
- return (a = e.address) == null ? void 0 : a.locationName;
3228
- },
3229
- country: () => {
3230
- var a;
3231
- return (a = e.address) == null ? void 0 : a.countryCode;
3232
- },
3233
- email: () => e.email,
3234
- cbh: () => e.customerIdentifier,
3235
- state: () => D.Authenticated
3236
- }
3237
- };
3238
- }, Ct = () => {
3239
- const e = Lr(), t = me.get("profile"), s = !!t, [r, i] = d.useState(
3240
- s ? D.Authenticated : D.Pending
3241
- ), [a, o] = d.useState(
3242
- s ? JSON.parse(t) : void 0
3243
- );
3244
- return d.useEffect(() => {
3245
- if (e.isError && e.error instanceof ye && (me.remove("profile"), i(D.NotAuthenticated)), e.isError && i(
3246
- s ? D.Authenticated : D.NotAuthenticated
3247
- ), e.isSuccess) {
3248
- i(D.Authenticated);
3249
- const l = e.data;
3250
- o(l), window.XTRA = Dr(l);
3251
- }
3252
- }, [
3253
- s,
3254
- e.data,
3255
- e.error,
3256
- e.isError,
3257
- e.isSuccess
3258
- ]), { authenticationStatus: r, profile: a };
3259
- }, Tr = ({ position: e, bouMenuItems: t }) => {
3260
- const { authenticationStatus: s, profile: r } = Ct();
3261
- return /* @__PURE__ */ n.jsx(
3262
- Rr,
3263
- {
3264
- bouMenuItems: t,
3265
- authenticationStatus: s,
3266
- position: e,
3267
- profile: r,
3268
- children: /* @__PURE__ */ n.jsx(Mr, {})
3269
- }
3270
- );
3271
- }, Ur = () => {
3272
- const { postTermsAndConditionsEndpoint: e } = G(), t = new ze();
3273
- return hs({
3274
- mutationFn: async (r) => {
3275
- const i = await fetch(e, {
3276
- method: "post",
3277
- body: JSON.stringify({ acceptedTC: r }),
3278
- credentials: "include",
3279
- mode: "cors"
3280
- });
3281
- if (!i.ok)
3282
- throw new Error("Network response was not ok");
3283
- return i;
3284
- },
3285
- onSuccess: async () => {
3286
- await t.invalidateQueries({ queryKey: ["gdpr"] });
3287
- }
3288
- });
3289
- }, Qr = () => {
3290
- const { i18n: e } = H(), { getTermsAndConditionsEndpoint: t } = G(), { authenticationStatus: s } = Ct(), r = me.get("hasAcceptedLatestTermsAndConditions"), i = [], a = r === "true", o = s === D.Authenticated;
3291
- return rt({
3292
- queryKey: ["gdpr"],
3293
- queryFn: async () => {
3294
- const c = await fetch(t, {
3295
- credentials: "include",
3296
- mode: "cors",
3297
- headers: { "Accept-Language": e.language }
3298
- });
3299
- if (!c.ok)
3300
- throw new Error("Network response was not ok");
3301
- return await c.json();
3302
- },
3303
- enabled: o && !a,
3304
- initialData: i
3305
- });
3306
- }, qr = () => {
3307
- const { t: e } = H(), { logoutUrl: t } = yt(), s = d.useRef(null), [r, i] = d.useState(0), [a, o] = d.useState({}), { mutate: l, isError: c } = Ur(), { AccessibleFormMessage: h, formRef: u } = jt({ submitCount: r, errors: a }), { data: f } = Qr(), m = !!(f != null && f.length), p = e("termsAndConditions.error.required"), g = () => {
3308
- var v;
3309
- (v = s == null ? void 0 : s.current) == null || v.click(), document.body.style.removeProperty("overflow");
3310
- };
3311
- d.useEffect(() => {
3312
- m && document.body.style.setProperty("overflow", "hidden");
3313
- }, [m]), d.useEffect(() => {
3314
- c && o({ acceptedTC: p });
3315
- }, [p, c]);
3316
- const b = (v) => {
3317
- v.preventDefault(), i(r + 1);
3318
- const { acceptedTC: y } = v.target;
3319
- if (y instanceof RadioNodeList) {
3320
- const _ = Object.values(y);
3321
- _.every((S) => S.checked) ? (o({}), l(_.map((S) => S.value)), g()) : o({ acceptedTC: p });
3322
- } else
3323
- y != null && y.checked ? (o({}), l([y.value]), g()) : o({ acceptedTC: p });
3324
- };
3325
- return m ? /* @__PURE__ */ n.jsxs(F, { defaultOpen: m, isModal: !0, children: [
3326
- h,
3327
- /* @__PURE__ */ n.jsxs(F.Root, { children: [
3328
- /* @__PURE__ */ n.jsx(F.Header, { children: /* @__PURE__ */ n.jsx(F.Title, { icon: /* @__PURE__ */ n.jsx(we, { role: "presentation" }), children: /* @__PURE__ */ n.jsx(Gr, { children: e("termsAndConditions.title") }) }) }),
3329
- /* @__PURE__ */ n.jsx(F.Body, { children: /* @__PURE__ */ n.jsxs(gt, { ref: u, id: "tc-form", onSubmit: b, children: [
3330
- /* @__PURE__ */ n.jsxs(Kr, { children: [
3331
- e("termsAndConditions.description"),
3332
- a.acceptedTC && /* @__PURE__ */ n.jsx(Wr, { children: p })
3333
- ] }),
3334
- f.map(({ tcCode: v, title: y, URL: _ }) => /* @__PURE__ */ n.jsx(
3335
- q,
3336
- {
3337
- id: v,
3338
- value: v,
3339
- name: "acceptedTC",
3340
- variant: "primary",
3341
- children: /* @__PURE__ */ n.jsxs(q.Content, { children: [
3342
- /* @__PURE__ */ n.jsx(Hr, { children: y }),
3343
- /* @__PURE__ */ n.jsx(Vr, { href: _, children: e("termsAndConditions.action", { title: y }) })
3344
- ] })
3345
- },
3346
- v
3347
- ))
3348
- ] }) }),
3349
- /* @__PURE__ */ n.jsxs(F.Footer, { children: [
3350
- /* @__PURE__ */ n.jsx(
3351
- "a",
3352
- {
3353
- className: P("button", "button--secondary", "button--terms-and-conditions"),
3354
- href: t,
3355
- children: e("logout")
3356
- }
3357
- ),
3358
- /* @__PURE__ */ n.jsx(Y, { form: "tc-form", type: "submit", variant: "primary", children: e("confirm") })
3359
- ] })
3360
- ] })
3361
- ] }) : /* @__PURE__ */ n.jsx(n.Fragment, {});
3362
- }, Hr = ({
3363
- children: e,
3364
- ...t
3365
- }) => /* @__PURE__ */ n.jsx(q.Label, { className: "form--tc__label", ...t, children: e }), gt = d.forwardRef(({ children: e, ...t }, s) => /* @__PURE__ */ n.jsx("form", { className: "form--tc", ref: s, ...t, children: e }));
3366
- gt.displayName = "TermsAndConditionsForm";
3367
- const Kr = ({
3368
- children: e,
3369
- ...t
3370
- }) => /* @__PURE__ */ n.jsx("p", { className: "form--tc__description", ...t, children: e }), Vr = ({ children: e, ...t }) => /* @__PURE__ */ n.jsx(
3371
- "a",
3372
- {
3373
- className: "form--tc__link",
3374
- target: "_blank",
3375
- rel: "noreferrer",
3376
- role: "button",
3377
- download: !0,
3378
- ...t,
3379
- children: e
3380
- }
3381
- ), Gr = ({ children: e }) => /* @__PURE__ */ n.jsx("h1", { className: "form--tc__title", children: e }), Wr = ({ children: e, ...t }) => /* @__PURE__ */ n.jsx("span", { className: "form--tc__error", role: "alert", ...t, children: e }), $r = new ze(), Yr = ({ environment: e, redirectUrl: t, apiUrl: s, position: r, bouMenuItems: i }) => /* @__PURE__ */ n.jsx(St, { environment: e, children: /* @__PURE__ */ n.jsx(Pr, { apiUrl: s, redirectUrl: t, children: /* @__PURE__ */ n.jsxs(Bt, { client: $r, children: [
3382
- /* @__PURE__ */ n.jsx(Tr, { position: r, bouMenuItems: i }),
3383
- /* @__PURE__ */ n.jsx(qr, {})
3384
- ] }) }) });
3385
- export {
3386
- Yr as default
3387
- };