@myxtra/authentication-green 2.3.0 → 2.4.0

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