@prefecthq/prefab-ui-docs 0.18.2 → 0.18.3

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,2021 +0,0 @@
1
- import { j as W, c as Xt } from "./embed-DguKmtmL.mjs";
2
- import { r as _, R as It, C as fn, a as dn, b as pn, c as gn } from "./icons-z7UO1VFZ.mjs";
3
- function mn(t) {
4
- return Object.prototype.toString.call(t) === "[object Object]";
5
- }
6
- function _t(t) {
7
- return mn(t) || Array.isArray(t);
8
- }
9
- function hn() {
10
- return !!(typeof window < "u" && window.document && window.document.createElement);
11
- }
12
- function Tt(t, n) {
13
- const e = Object.keys(t), i = Object.keys(n);
14
- if (e.length !== i.length) return !1;
15
- const s = JSON.stringify(Object.keys(t.breakpoints || {})), r = JSON.stringify(Object.keys(n.breakpoints || {}));
16
- return s !== r ? !1 : e.every((o) => {
17
- const l = t[o], c = n[o];
18
- return typeof l == "function" ? `${l}` == `${c}` : !_t(l) || !_t(c) ? l === c : Tt(l, c);
19
- });
20
- }
21
- function qt(t) {
22
- return t.concat().sort((n, e) => n.name > e.name ? 1 : -1).map((n) => n.options);
23
- }
24
- function yn(t, n) {
25
- if (t.length !== n.length) return !1;
26
- const e = qt(t), i = qt(n);
27
- return e.every((s, r) => {
28
- const o = i[r];
29
- return Tt(s, o);
30
- });
31
- }
32
- function Pt(t) {
33
- return typeof t == "number";
34
- }
35
- function Dt(t) {
36
- return typeof t == "string";
37
- }
38
- function xt(t) {
39
- return typeof t == "boolean";
40
- }
41
- function Gt(t) {
42
- return Object.prototype.toString.call(t) === "[object Object]";
43
- }
44
- function q(t) {
45
- return Math.abs(t);
46
- }
47
- function Mt(t) {
48
- return Math.sign(t);
49
- }
50
- function pt(t, n) {
51
- return q(t - n);
52
- }
53
- function Sn(t, n) {
54
- if (t === 0 || n === 0 || q(t) <= q(n)) return 0;
55
- const e = pt(q(t), q(n));
56
- return q(e / t);
57
- }
58
- function bn(t) {
59
- return Math.round(t * 100) / 100;
60
- }
61
- function gt(t) {
62
- return mt(t).map(Number);
63
- }
64
- function st(t) {
65
- return t[yt(t)];
66
- }
67
- function yt(t) {
68
- return Math.max(0, t.length - 1);
69
- }
70
- function At(t, n) {
71
- return n === yt(t);
72
- }
73
- function Yt(t, n = 0) {
74
- return Array.from(Array(t), (e, i) => n + i);
75
- }
76
- function mt(t) {
77
- return Object.keys(t);
78
- }
79
- function Qt(t, n) {
80
- return [t, n].reduce((e, i) => (mt(i).forEach((s) => {
81
- const r = e[s], o = i[s], l = Gt(r) && Gt(o);
82
- e[s] = l ? Qt(r, o) : o;
83
- }), e), {});
84
- }
85
- function Lt(t, n) {
86
- return typeof n.MouseEvent < "u" && t instanceof n.MouseEvent;
87
- }
88
- function xn(t, n) {
89
- const e = {
90
- start: i,
91
- center: s,
92
- end: r
93
- };
94
- function i() {
95
- return 0;
96
- }
97
- function s(c) {
98
- return r(c) / 2;
99
- }
100
- function r(c) {
101
- return n - c;
102
- }
103
- function o(c, a) {
104
- return Dt(t) ? e[t](c) : t(n, c, a);
105
- }
106
- return {
107
- measure: o
108
- };
109
- }
110
- function ht() {
111
- let t = [];
112
- function n(s, r, o, l = {
113
- passive: !0
114
- }) {
115
- let c;
116
- if ("addEventListener" in s)
117
- s.addEventListener(r, o, l), c = () => s.removeEventListener(r, o, l);
118
- else {
119
- const a = s;
120
- a.addListener(o), c = () => a.removeListener(o);
121
- }
122
- return t.push(c), i;
123
- }
124
- function e() {
125
- t = t.filter((s) => s());
126
- }
127
- const i = {
128
- add: n,
129
- clear: e
130
- };
131
- return i;
132
- }
133
- function vn(t, n, e, i) {
134
- const s = ht(), r = 1e3 / 60;
135
- let o = null, l = 0, c = 0;
136
- function a() {
137
- s.add(t, "visibilitychange", () => {
138
- t.hidden && d();
139
- });
140
- }
141
- function y() {
142
- v(), s.clear();
143
- }
144
- function f(h) {
145
- if (!c) return;
146
- o || (o = h, e(), e());
147
- const u = h - o;
148
- for (o = h, l += u; l >= r; )
149
- e(), l -= r;
150
- const S = l / r;
151
- i(S), c && (c = n.requestAnimationFrame(f));
152
- }
153
- function p() {
154
- c || (c = n.requestAnimationFrame(f));
155
- }
156
- function v() {
157
- n.cancelAnimationFrame(c), o = null, l = 0, c = 0;
158
- }
159
- function d() {
160
- o = null, l = 0;
161
- }
162
- return {
163
- init: a,
164
- destroy: y,
165
- start: p,
166
- stop: v,
167
- update: e,
168
- render: i
169
- };
170
- }
171
- function En(t, n) {
172
- const e = n === "rtl", i = t === "y", s = i ? "y" : "x", r = i ? "x" : "y", o = !i && e ? -1 : 1, l = y(), c = f();
173
- function a(d) {
174
- const {
175
- height: g,
176
- width: h
177
- } = d;
178
- return i ? g : h;
179
- }
180
- function y() {
181
- return i ? "top" : e ? "right" : "left";
182
- }
183
- function f() {
184
- return i ? "bottom" : e ? "left" : "right";
185
- }
186
- function p(d) {
187
- return d * o;
188
- }
189
- return {
190
- scroll: s,
191
- cross: r,
192
- startEdge: l,
193
- endEdge: c,
194
- measureSize: a,
195
- direction: p
196
- };
197
- }
198
- function lt(t = 0, n = 0) {
199
- const e = q(t - n);
200
- function i(a) {
201
- return a < t;
202
- }
203
- function s(a) {
204
- return a > n;
205
- }
206
- function r(a) {
207
- return i(a) || s(a);
208
- }
209
- function o(a) {
210
- return r(a) ? i(a) ? t : n : a;
211
- }
212
- function l(a) {
213
- return e ? a - e * Math.ceil((a - n) / e) : a;
214
- }
215
- return {
216
- length: e,
217
- max: n,
218
- min: t,
219
- constrain: o,
220
- reachedAny: r,
221
- reachedMax: s,
222
- reachedMin: i,
223
- removeOffset: l
224
- };
225
- }
226
- function Jt(t, n, e) {
227
- const {
228
- constrain: i
229
- } = lt(0, t), s = t + 1;
230
- let r = o(n);
231
- function o(p) {
232
- return e ? q((s + p) % s) : i(p);
233
- }
234
- function l() {
235
- return r;
236
- }
237
- function c(p) {
238
- return r = o(p), f;
239
- }
240
- function a(p) {
241
- return y().set(l() + p);
242
- }
243
- function y() {
244
- return Jt(t, l(), e);
245
- }
246
- const f = {
247
- get: l,
248
- set: c,
249
- add: a,
250
- clone: y
251
- };
252
- return f;
253
- }
254
- function On(t, n, e, i, s, r, o, l, c, a, y, f, p, v, d, g, h, u, S) {
255
- const {
256
- cross: E,
257
- direction: P
258
- } = t, F = ["INPUT", "SELECT", "TEXTAREA"], L = {
259
- passive: !1
260
- }, w = ht(), T = ht(), m = lt(50, 225).constrain(v.measure(20)), D = {
261
- mouse: 300,
262
- touch: 400
263
- }, C = {
264
- mouse: 500,
265
- touch: 600
266
- }, U = d ? 43 : 25;
267
- let Y = !1, b = 0, I = 0, O = !1, M = !1, A = !1, k = !1;
268
- function N(x) {
269
- if (!S) return;
270
- function B(Z) {
271
- (xt(S) || S(x, Z)) && rt(Z);
272
- }
273
- const X = n;
274
- w.add(X, "dragstart", (Z) => Z.preventDefault(), L).add(X, "touchmove", () => {
275
- }, L).add(X, "touchend", () => {
276
- }).add(X, "touchstart", B).add(X, "mousedown", B).add(X, "touchcancel", K).add(X, "contextmenu", K).add(X, "click", tt, !0);
277
- }
278
- function j() {
279
- w.clear(), T.clear();
280
- }
281
- function R() {
282
- const x = k ? e : n;
283
- T.add(x, "touchmove", Q, L).add(x, "touchend", K).add(x, "mousemove", Q, L).add(x, "mouseup", K);
284
- }
285
- function z(x) {
286
- const B = x.nodeName || "";
287
- return F.includes(B);
288
- }
289
- function H() {
290
- return (d ? C : D)[k ? "mouse" : "touch"];
291
- }
292
- function nt(x, B) {
293
- const X = f.add(Mt(x) * -1), Z = y.byDistance(x, !d).distance;
294
- return d || q(x) < m ? Z : h && B ? Z * 0.5 : y.byIndex(X.get(), 0).distance;
295
- }
296
- function rt(x) {
297
- const B = Lt(x, i);
298
- k = B, A = d && B && !x.buttons && Y, Y = pt(s.get(), o.get()) >= 2, !(B && x.button !== 0) && (z(x.target) || (O = !0, r.pointerDown(x), a.useFriction(0).useDuration(0), s.set(o), R(), b = r.readPoint(x), I = r.readPoint(x, E), p.emit("pointerDown")));
299
- }
300
- function Q(x) {
301
- if (!Lt(x, i) && x.touches.length >= 2) return K(x);
302
- const X = r.readPoint(x), Z = r.readPoint(x, E), et = pt(X, b), ot = pt(Z, I);
303
- if (!M && !k && (!x.cancelable || (M = et > ot, !M)))
304
- return K(x);
305
- const V = r.pointerMove(x);
306
- et > g && (A = !0), a.useFriction(0.3).useDuration(0.75), l.start(), s.add(P(V)), x.preventDefault();
307
- }
308
- function K(x) {
309
- const X = y.byDistance(0, !1).index !== f.get(), Z = r.pointerUp(x) * H(), et = nt(P(Z), X), ot = Sn(Z, et), V = U - 10 * ot, G = u + ot / 50;
310
- M = !1, O = !1, T.clear(), a.useDuration(V).useFriction(G), c.distance(et, !d), k = !1, p.emit("pointerUp");
311
- }
312
- function tt(x) {
313
- A && (x.stopPropagation(), x.preventDefault(), A = !1);
314
- }
315
- function J() {
316
- return O;
317
- }
318
- return {
319
- init: N,
320
- destroy: j,
321
- pointerDown: J
322
- };
323
- }
324
- function In(t, n) {
325
- let i, s;
326
- function r(f) {
327
- return f.timeStamp;
328
- }
329
- function o(f, p) {
330
- const d = `client${(p || t.scroll) === "x" ? "X" : "Y"}`;
331
- return (Lt(f, n) ? f : f.touches[0])[d];
332
- }
333
- function l(f) {
334
- return i = f, s = f, o(f);
335
- }
336
- function c(f) {
337
- const p = o(f) - o(s), v = r(f) - r(i) > 170;
338
- return s = f, v && (i = f), p;
339
- }
340
- function a(f) {
341
- if (!i || !s) return 0;
342
- const p = o(s) - o(i), v = r(f) - r(i), d = r(f) - r(s) > 170, g = p / v;
343
- return v && !d && q(g) > 0.1 ? g : 0;
344
- }
345
- return {
346
- pointerDown: l,
347
- pointerMove: c,
348
- pointerUp: a,
349
- readPoint: o
350
- };
351
- }
352
- function wn() {
353
- function t(e) {
354
- const {
355
- offsetTop: i,
356
- offsetLeft: s,
357
- offsetWidth: r,
358
- offsetHeight: o
359
- } = e;
360
- return {
361
- top: i,
362
- right: s + r,
363
- bottom: i + o,
364
- left: s,
365
- width: r,
366
- height: o
367
- };
368
- }
369
- return {
370
- measure: t
371
- };
372
- }
373
- function Dn(t) {
374
- function n(i) {
375
- return t * (i / 100);
376
- }
377
- return {
378
- measure: n
379
- };
380
- }
381
- function Ln(t, n, e, i, s, r, o) {
382
- const l = [t].concat(i);
383
- let c, a, y = [], f = !1;
384
- function p(h) {
385
- return s.measureSize(o.measure(h));
386
- }
387
- function v(h) {
388
- if (!r) return;
389
- a = p(t), y = i.map(p);
390
- function u(S) {
391
- for (const E of S) {
392
- if (f) return;
393
- const P = E.target === t, F = i.indexOf(E.target), L = P ? a : y[F], w = p(P ? t : i[F]);
394
- if (q(w - L) >= 0.5) {
395
- h.reInit(), n.emit("resize");
396
- break;
397
- }
398
- }
399
- }
400
- c = new ResizeObserver((S) => {
401
- (xt(r) || r(h, S)) && u(S);
402
- }), e.requestAnimationFrame(() => {
403
- l.forEach((S) => c.observe(S));
404
- });
405
- }
406
- function d() {
407
- f = !0, c && c.disconnect();
408
- }
409
- return {
410
- init: v,
411
- destroy: d
412
- };
413
- }
414
- function Tn(t, n, e, i, s, r) {
415
- let o = 0, l = 0, c = s, a = r, y = t.get(), f = 0;
416
- function p() {
417
- const L = i.get() - t.get(), w = !c;
418
- let T = 0;
419
- return w ? (o = 0, e.set(i), t.set(i), T = L) : (e.set(t), o += L / c, o *= a, y += o, t.add(o), T = y - f), l = Mt(T), f = y, F;
420
- }
421
- function v() {
422
- const L = i.get() - n.get();
423
- return q(L) < 1e-3;
424
- }
425
- function d() {
426
- return c;
427
- }
428
- function g() {
429
- return l;
430
- }
431
- function h() {
432
- return o;
433
- }
434
- function u() {
435
- return E(s);
436
- }
437
- function S() {
438
- return P(r);
439
- }
440
- function E(L) {
441
- return c = L, F;
442
- }
443
- function P(L) {
444
- return a = L, F;
445
- }
446
- const F = {
447
- direction: g,
448
- duration: d,
449
- velocity: h,
450
- seek: p,
451
- settled: v,
452
- useBaseFriction: S,
453
- useBaseDuration: u,
454
- useFriction: P,
455
- useDuration: E
456
- };
457
- return F;
458
- }
459
- function Pn(t, n, e, i, s) {
460
- const r = s.measure(10), o = s.measure(50), l = lt(0.1, 0.99);
461
- let c = !1;
462
- function a() {
463
- return !(c || !t.reachedAny(e.get()) || !t.reachedAny(n.get()));
464
- }
465
- function y(v) {
466
- if (!a()) return;
467
- const d = t.reachedMin(n.get()) ? "min" : "max", g = q(t[d] - n.get()), h = e.get() - n.get(), u = l.constrain(g / o);
468
- e.subtract(h * u), !v && q(h) < r && (e.set(t.constrain(e.get())), i.useDuration(25).useBaseFriction());
469
- }
470
- function f(v) {
471
- c = !v;
472
- }
473
- return {
474
- shouldConstrain: a,
475
- constrain: y,
476
- toggleActive: f
477
- };
478
- }
479
- function Mn(t, n, e, i, s) {
480
- const r = lt(-n + t, 0), o = f(), l = y(), c = p();
481
- function a(d, g) {
482
- return pt(d, g) <= 1;
483
- }
484
- function y() {
485
- const d = o[0], g = st(o), h = o.lastIndexOf(d), u = o.indexOf(g) + 1;
486
- return lt(h, u);
487
- }
488
- function f() {
489
- return e.map((d, g) => {
490
- const {
491
- min: h,
492
- max: u
493
- } = r, S = r.constrain(d), E = !g, P = At(e, g);
494
- return E ? u : P || a(h, S) ? h : a(u, S) ? u : S;
495
- }).map((d) => parseFloat(d.toFixed(3)));
496
- }
497
- function p() {
498
- if (n <= t + s) return [r.max];
499
- if (i === "keepSnaps") return o;
500
- const {
501
- min: d,
502
- max: g
503
- } = l;
504
- return o.slice(d, g);
505
- }
506
- return {
507
- snapsContained: c,
508
- scrollContainLimit: l
509
- };
510
- }
511
- function An(t, n, e) {
512
- const i = n[0], s = e ? i - t : st(n);
513
- return {
514
- limit: lt(s, i)
515
- };
516
- }
517
- function Cn(t, n, e, i) {
518
- const r = n.min + 0.1, o = n.max + 0.1, {
519
- reachedMin: l,
520
- reachedMax: c
521
- } = lt(r, o);
522
- function a(p) {
523
- return p === 1 ? c(e.get()) : p === -1 ? l(e.get()) : !1;
524
- }
525
- function y(p) {
526
- if (!a(p)) return;
527
- const v = t * (p * -1);
528
- i.forEach((d) => d.add(v));
529
- }
530
- return {
531
- loop: y
532
- };
533
- }
534
- function Fn(t) {
535
- const {
536
- max: n,
537
- length: e
538
- } = t;
539
- function i(r) {
540
- const o = r - n;
541
- return e ? o / -e : 0;
542
- }
543
- return {
544
- get: i
545
- };
546
- }
547
- function kn(t, n, e, i, s) {
548
- const {
549
- startEdge: r,
550
- endEdge: o
551
- } = t, {
552
- groupSlides: l
553
- } = s, c = f().map(n.measure), a = p(), y = v();
554
- function f() {
555
- return l(i).map((g) => st(g)[o] - g[0][r]).map(q);
556
- }
557
- function p() {
558
- return i.map((g) => e[r] - g[r]).map((g) => -q(g));
559
- }
560
- function v() {
561
- return l(a).map((g) => g[0]).map((g, h) => g + c[h]);
562
- }
563
- return {
564
- snaps: a,
565
- snapsAligned: y
566
- };
567
- }
568
- function Nn(t, n, e, i, s, r) {
569
- const {
570
- groupSlides: o
571
- } = s, {
572
- min: l,
573
- max: c
574
- } = i, a = y();
575
- function y() {
576
- const p = o(r), v = !t || n === "keepSnaps";
577
- return e.length === 1 ? [r] : v ? p : p.slice(l, c).map((d, g, h) => {
578
- const u = !g, S = At(h, g);
579
- if (u) {
580
- const E = st(h[0]) + 1;
581
- return Yt(E);
582
- }
583
- if (S) {
584
- const E = yt(r) - st(h)[0] + 1;
585
- return Yt(E, st(h)[0]);
586
- }
587
- return d;
588
- });
589
- }
590
- return {
591
- slideRegistry: a
592
- };
593
- }
594
- function Bn(t, n, e, i, s) {
595
- const {
596
- reachedAny: r,
597
- removeOffset: o,
598
- constrain: l
599
- } = i;
600
- function c(d) {
601
- return d.concat().sort((g, h) => q(g) - q(h))[0];
602
- }
603
- function a(d) {
604
- const g = t ? o(d) : l(d), h = n.map((S, E) => ({
605
- diff: y(S - g, 0),
606
- index: E
607
- })).sort((S, E) => q(S.diff) - q(E.diff)), {
608
- index: u
609
- } = h[0];
610
- return {
611
- index: u,
612
- distance: g
613
- };
614
- }
615
- function y(d, g) {
616
- const h = [d, d + e, d - e];
617
- if (!t) return d;
618
- if (!g) return c(h);
619
- const u = h.filter((S) => Mt(S) === g);
620
- return u.length ? c(u) : st(h) - e;
621
- }
622
- function f(d, g) {
623
- const h = n[d] - s.get(), u = y(h, g);
624
- return {
625
- index: d,
626
- distance: u
627
- };
628
- }
629
- function p(d, g) {
630
- const h = s.get() + d, {
631
- index: u,
632
- distance: S
633
- } = a(h), E = !t && r(h);
634
- if (!g || E) return {
635
- index: u,
636
- distance: d
637
- };
638
- const P = n[u] - S, F = d + y(P, 0);
639
- return {
640
- index: u,
641
- distance: F
642
- };
643
- }
644
- return {
645
- byDistance: p,
646
- byIndex: f,
647
- shortcut: y
648
- };
649
- }
650
- function jn(t, n, e, i, s, r, o) {
651
- function l(f) {
652
- const p = f.distance, v = f.index !== n.get();
653
- r.add(p), p && (i.duration() ? t.start() : (t.update(), t.render(1), t.update())), v && (e.set(n.get()), n.set(f.index), o.emit("select"));
654
- }
655
- function c(f, p) {
656
- const v = s.byDistance(f, p);
657
- l(v);
658
- }
659
- function a(f, p) {
660
- const v = n.clone().set(f), d = s.byIndex(v.get(), p);
661
- l(d);
662
- }
663
- return {
664
- distance: c,
665
- index: a
666
- };
667
- }
668
- function Rn(t, n, e, i, s, r, o, l) {
669
- const c = {
670
- passive: !0,
671
- capture: !0
672
- };
673
- let a = 0;
674
- function y(v) {
675
- if (!l) return;
676
- function d(g) {
677
- if ((/* @__PURE__ */ new Date()).getTime() - a > 10) return;
678
- o.emit("slideFocusStart"), t.scrollLeft = 0;
679
- const S = e.findIndex((E) => E.includes(g));
680
- Pt(S) && (s.useDuration(0), i.index(S, 0), o.emit("slideFocus"));
681
- }
682
- r.add(document, "keydown", f, !1), n.forEach((g, h) => {
683
- r.add(g, "focus", (u) => {
684
- (xt(l) || l(v, u)) && d(h);
685
- }, c);
686
- });
687
- }
688
- function f(v) {
689
- v.code === "Tab" && (a = (/* @__PURE__ */ new Date()).getTime());
690
- }
691
- return {
692
- init: y
693
- };
694
- }
695
- function dt(t) {
696
- let n = t;
697
- function e() {
698
- return n;
699
- }
700
- function i(c) {
701
- n = o(c);
702
- }
703
- function s(c) {
704
- n += o(c);
705
- }
706
- function r(c) {
707
- n -= o(c);
708
- }
709
- function o(c) {
710
- return Pt(c) ? c : c.get();
711
- }
712
- return {
713
- get: e,
714
- set: i,
715
- add: s,
716
- subtract: r
717
- };
718
- }
719
- function Zt(t, n) {
720
- const e = t.scroll === "x" ? o : l, i = n.style;
721
- let s = null, r = !1;
722
- function o(p) {
723
- return `translate3d(${p}px,0px,0px)`;
724
- }
725
- function l(p) {
726
- return `translate3d(0px,${p}px,0px)`;
727
- }
728
- function c(p) {
729
- if (r) return;
730
- const v = bn(t.direction(p));
731
- v !== s && (i.transform = e(v), s = v);
732
- }
733
- function a(p) {
734
- r = !p;
735
- }
736
- function y() {
737
- r || (i.transform = "", n.getAttribute("style") || n.removeAttribute("style"));
738
- }
739
- return {
740
- clear: y,
741
- to: c,
742
- toggleActive: a
743
- };
744
- }
745
- function zn(t, n, e, i, s, r, o, l, c) {
746
- const y = gt(s), f = gt(s).reverse(), p = u().concat(S());
747
- function v(w, T) {
748
- return w.reduce((m, D) => m - s[D], T);
749
- }
750
- function d(w, T) {
751
- return w.reduce((m, D) => v(m, T) > 0 ? m.concat([D]) : m, []);
752
- }
753
- function g(w) {
754
- return r.map((T, m) => ({
755
- start: T - i[m] + 0.5 + w,
756
- end: T + n - 0.5 + w
757
- }));
758
- }
759
- function h(w, T, m) {
760
- const D = g(T);
761
- return w.map((C) => {
762
- const U = m ? 0 : -e, Y = m ? e : 0, b = m ? "end" : "start", I = D[C][b];
763
- return {
764
- index: C,
765
- loopPoint: I,
766
- slideLocation: dt(-1),
767
- translate: Zt(t, c[C]),
768
- target: () => l.get() > I ? U : Y
769
- };
770
- });
771
- }
772
- function u() {
773
- const w = o[0], T = d(f, w);
774
- return h(T, e, !1);
775
- }
776
- function S() {
777
- const w = n - o[0] - 1, T = d(y, w);
778
- return h(T, -e, !0);
779
- }
780
- function E() {
781
- return p.every(({
782
- index: w
783
- }) => {
784
- const T = y.filter((m) => m !== w);
785
- return v(T, n) <= 0.1;
786
- });
787
- }
788
- function P() {
789
- p.forEach((w) => {
790
- const {
791
- target: T,
792
- translate: m,
793
- slideLocation: D
794
- } = w, C = T();
795
- C !== D.get() && (m.to(C), D.set(C));
796
- });
797
- }
798
- function F() {
799
- p.forEach((w) => w.translate.clear());
800
- }
801
- return {
802
- canLoop: E,
803
- clear: F,
804
- loop: P,
805
- loopPoints: p
806
- };
807
- }
808
- function Un(t, n, e) {
809
- let i, s = !1;
810
- function r(c) {
811
- if (!e) return;
812
- function a(y) {
813
- for (const f of y)
814
- if (f.type === "childList") {
815
- c.reInit(), n.emit("slidesChanged");
816
- break;
817
- }
818
- }
819
- i = new MutationObserver((y) => {
820
- s || (xt(e) || e(c, y)) && a(y);
821
- }), i.observe(t, {
822
- childList: !0
823
- });
824
- }
825
- function o() {
826
- i && i.disconnect(), s = !0;
827
- }
828
- return {
829
- init: r,
830
- destroy: o
831
- };
832
- }
833
- function $n(t, n, e, i) {
834
- const s = {};
835
- let r = null, o = null, l, c = !1;
836
- function a() {
837
- l = new IntersectionObserver((d) => {
838
- c || (d.forEach((g) => {
839
- const h = n.indexOf(g.target);
840
- s[h] = g;
841
- }), r = null, o = null, e.emit("slidesInView"));
842
- }, {
843
- root: t.parentElement,
844
- threshold: i
845
- }), n.forEach((d) => l.observe(d));
846
- }
847
- function y() {
848
- l && l.disconnect(), c = !0;
849
- }
850
- function f(d) {
851
- return mt(s).reduce((g, h) => {
852
- const u = parseInt(h), {
853
- isIntersecting: S
854
- } = s[u];
855
- return (d && S || !d && !S) && g.push(u), g;
856
- }, []);
857
- }
858
- function p(d = !0) {
859
- if (d && r) return r;
860
- if (!d && o) return o;
861
- const g = f(d);
862
- return d && (r = g), d || (o = g), g;
863
- }
864
- return {
865
- init: a,
866
- destroy: y,
867
- get: p
868
- };
869
- }
870
- function Hn(t, n, e, i, s, r) {
871
- const {
872
- measureSize: o,
873
- startEdge: l,
874
- endEdge: c
875
- } = t, a = e[0] && s, y = d(), f = g(), p = e.map(o), v = h();
876
- function d() {
877
- if (!a) return 0;
878
- const S = e[0];
879
- return q(n[l] - S[l]);
880
- }
881
- function g() {
882
- if (!a) return 0;
883
- const S = r.getComputedStyle(st(i));
884
- return parseFloat(S.getPropertyValue(`margin-${c}`));
885
- }
886
- function h() {
887
- return e.map((S, E, P) => {
888
- const F = !E, L = At(P, E);
889
- return F ? p[E] + y : L ? p[E] + f : P[E + 1][l] - S[l];
890
- }).map(q);
891
- }
892
- return {
893
- slideSizes: p,
894
- slideSizesWithGaps: v,
895
- startGap: y,
896
- endGap: f
897
- };
898
- }
899
- function Vn(t, n, e, i, s, r, o, l, c) {
900
- const {
901
- startEdge: a,
902
- endEdge: y,
903
- direction: f
904
- } = t, p = Pt(e);
905
- function v(u, S) {
906
- return gt(u).filter((E) => E % S === 0).map((E) => u.slice(E, E + S));
907
- }
908
- function d(u) {
909
- return u.length ? gt(u).reduce((S, E, P) => {
910
- const F = st(S) || 0, L = F === 0, w = E === yt(u), T = s[a] - r[F][a], m = s[a] - r[E][y], D = !i && L ? f(o) : 0, C = !i && w ? f(l) : 0, U = q(m - C - (T + D));
911
- return P && U > n + c && S.push(E), w && S.push(u.length), S;
912
- }, []).map((S, E, P) => {
913
- const F = Math.max(P[E - 1] || 0);
914
- return u.slice(F, S);
915
- }) : [];
916
- }
917
- function g(u) {
918
- return p ? v(u, e) : d(u);
919
- }
920
- return {
921
- groupSlides: g
922
- };
923
- }
924
- function _n(t, n, e, i, s, r, o) {
925
- const {
926
- align: l,
927
- axis: c,
928
- direction: a,
929
- startIndex: y,
930
- loop: f,
931
- duration: p,
932
- dragFree: v,
933
- dragThreshold: d,
934
- inViewThreshold: g,
935
- slidesToScroll: h,
936
- skipSnaps: u,
937
- containScroll: S,
938
- watchResize: E,
939
- watchSlides: P,
940
- watchDrag: F,
941
- watchFocus: L
942
- } = r, w = 2, T = wn(), m = T.measure(n), D = e.map(T.measure), C = En(c, a), U = C.measureSize(m), Y = Dn(U), b = xn(l, U), I = !f && !!S, O = f || !!S, {
943
- slideSizes: M,
944
- slideSizesWithGaps: A,
945
- startGap: k,
946
- endGap: N
947
- } = Hn(C, m, D, e, O, s), j = Vn(C, U, h, f, m, D, k, N, w), {
948
- snaps: R,
949
- snapsAligned: z
950
- } = kn(C, b, m, D, j), H = -st(R) + st(A), {
951
- snapsContained: nt,
952
- scrollContainLimit: rt
953
- } = Mn(U, H, z, S, w), Q = I ? nt : z, {
954
- limit: K
955
- } = An(H, Q, f), tt = Jt(yt(Q), y, f), J = tt.clone(), $ = gt(e), x = ({
956
- dragHandler: at,
957
- scrollBody: Et,
958
- scrollBounds: Ot,
959
- options: {
960
- loop: St
961
- }
962
- }) => {
963
- St || Ot.constrain(at.pointerDown()), Et.seek();
964
- }, B = ({
965
- scrollBody: at,
966
- translate: Et,
967
- location: Ot,
968
- offsetLocation: St,
969
- previousLocation: en,
970
- scrollLooper: on,
971
- slideLooper: sn,
972
- dragHandler: rn,
973
- animation: cn,
974
- eventHandler: Rt,
975
- scrollBounds: ln,
976
- options: {
977
- loop: zt
978
- }
979
- }, Ut) => {
980
- const $t = at.settled(), an = !ln.shouldConstrain(), Ht = zt ? $t : $t && an, Vt = Ht && !rn.pointerDown();
981
- Vt && cn.stop();
982
- const un = Ot.get() * Ut + en.get() * (1 - Ut);
983
- St.set(un), zt && (on.loop(at.direction()), sn.loop()), Et.to(St.get()), Vt && Rt.emit("settle"), Ht || Rt.emit("scroll");
984
- }, X = vn(i, s, () => x(vt), (at) => B(vt, at)), Z = 0.68, et = Q[tt.get()], ot = dt(et), V = dt(et), G = dt(et), it = dt(et), ct = Tn(ot, G, V, it, p, Z), ut = Bn(f, Q, H, K, it), ft = jn(X, tt, J, ct, ut, it, o), Nt = Fn(K), Bt = ht(), tn = $n(n, e, o, g), {
985
- slideRegistry: jt
986
- } = Nn(I, S, Q, rt, j, $), nn = Rn(t, e, jt, ft, ct, Bt, o, L), vt = {
987
- ownerDocument: i,
988
- ownerWindow: s,
989
- eventHandler: o,
990
- containerRect: m,
991
- slideRects: D,
992
- animation: X,
993
- axis: C,
994
- dragHandler: On(C, t, i, s, it, In(C, s), ot, X, ft, ct, ut, tt, o, Y, v, d, u, Z, F),
995
- eventStore: Bt,
996
- percentOfView: Y,
997
- index: tt,
998
- indexPrevious: J,
999
- limit: K,
1000
- location: ot,
1001
- offsetLocation: G,
1002
- previousLocation: V,
1003
- options: r,
1004
- resizeHandler: Ln(n, o, s, e, C, E, T),
1005
- scrollBody: ct,
1006
- scrollBounds: Pn(K, G, it, ct, Y),
1007
- scrollLooper: Cn(H, K, G, [ot, G, V, it]),
1008
- scrollProgress: Nt,
1009
- scrollSnapList: Q.map(Nt.get),
1010
- scrollSnaps: Q,
1011
- scrollTarget: ut,
1012
- scrollTo: ft,
1013
- slideLooper: zn(C, U, H, M, A, R, Q, G, e),
1014
- slideFocus: nn,
1015
- slidesHandler: Un(n, o, P),
1016
- slidesInView: tn,
1017
- slideIndexes: $,
1018
- slideRegistry: jt,
1019
- slidesToScroll: j,
1020
- target: it,
1021
- translate: Zt(C, n)
1022
- };
1023
- return vt;
1024
- }
1025
- function qn() {
1026
- let t = {}, n;
1027
- function e(a) {
1028
- n = a;
1029
- }
1030
- function i(a) {
1031
- return t[a] || [];
1032
- }
1033
- function s(a) {
1034
- return i(a).forEach((y) => y(n, a)), c;
1035
- }
1036
- function r(a, y) {
1037
- return t[a] = i(a).concat([y]), c;
1038
- }
1039
- function o(a, y) {
1040
- return t[a] = i(a).filter((f) => f !== y), c;
1041
- }
1042
- function l() {
1043
- t = {};
1044
- }
1045
- const c = {
1046
- init: e,
1047
- emit: s,
1048
- off: o,
1049
- on: r,
1050
- clear: l
1051
- };
1052
- return c;
1053
- }
1054
- const Gn = {
1055
- align: "center",
1056
- axis: "x",
1057
- container: null,
1058
- slides: null,
1059
- containScroll: "trimSnaps",
1060
- direction: "ltr",
1061
- slidesToScroll: 1,
1062
- inViewThreshold: 0,
1063
- breakpoints: {},
1064
- dragFree: !1,
1065
- dragThreshold: 10,
1066
- loop: !1,
1067
- skipSnaps: !1,
1068
- duration: 25,
1069
- startIndex: 0,
1070
- active: !0,
1071
- watchDrag: !0,
1072
- watchResize: !0,
1073
- watchSlides: !0,
1074
- watchFocus: !0
1075
- };
1076
- function Yn(t) {
1077
- function n(r, o) {
1078
- return Qt(r, o || {});
1079
- }
1080
- function e(r) {
1081
- const o = r.breakpoints || {}, l = mt(o).filter((c) => t.matchMedia(c).matches).map((c) => o[c]).reduce((c, a) => n(c, a), {});
1082
- return n(r, l);
1083
- }
1084
- function i(r) {
1085
- return r.map((o) => mt(o.breakpoints || {})).reduce((o, l) => o.concat(l), []).map(t.matchMedia);
1086
- }
1087
- return {
1088
- mergeOptions: n,
1089
- optionsAtMedia: e,
1090
- optionsMediaQueries: i
1091
- };
1092
- }
1093
- function Kn(t) {
1094
- let n = [];
1095
- function e(r, o) {
1096
- return n = o.filter(({
1097
- options: l
1098
- }) => t.optionsAtMedia(l).active !== !1), n.forEach((l) => l.init(r, t)), o.reduce((l, c) => Object.assign(l, {
1099
- [c.name]: c
1100
- }), {});
1101
- }
1102
- function i() {
1103
- n = n.filter((r) => r.destroy());
1104
- }
1105
- return {
1106
- init: e,
1107
- destroy: i
1108
- };
1109
- }
1110
- function bt(t, n, e) {
1111
- const i = t.ownerDocument, s = i.defaultView, r = Yn(s), o = Kn(r), l = ht(), c = qn(), {
1112
- mergeOptions: a,
1113
- optionsAtMedia: y,
1114
- optionsMediaQueries: f
1115
- } = r, {
1116
- on: p,
1117
- off: v,
1118
- emit: d
1119
- } = c, g = C;
1120
- let h = !1, u, S = a(Gn, bt.globalOptions), E = a(S), P = [], F, L, w;
1121
- function T() {
1122
- const {
1123
- container: $,
1124
- slides: x
1125
- } = E;
1126
- L = (Dt($) ? t.querySelector($) : $) || t.children[0];
1127
- const X = Dt(x) ? L.querySelectorAll(x) : x;
1128
- w = [].slice.call(X || L.children);
1129
- }
1130
- function m($) {
1131
- const x = _n(t, L, w, i, s, $, c);
1132
- if ($.loop && !x.slideLooper.canLoop()) {
1133
- const B = Object.assign({}, $, {
1134
- loop: !1
1135
- });
1136
- return m(B);
1137
- }
1138
- return x;
1139
- }
1140
- function D($, x) {
1141
- h || (S = a(S, $), E = y(S), P = x || P, T(), u = m(E), f([S, ...P.map(({
1142
- options: B
1143
- }) => B)]).forEach((B) => l.add(B, "change", C)), E.active && (u.translate.to(u.location.get()), u.animation.init(), u.slidesInView.init(), u.slideFocus.init(J), u.eventHandler.init(J), u.resizeHandler.init(J), u.slidesHandler.init(J), u.options.loop && u.slideLooper.loop(), L.offsetParent && w.length && u.dragHandler.init(J), F = o.init(J, P)));
1144
- }
1145
- function C($, x) {
1146
- const B = j();
1147
- U(), D(a({
1148
- startIndex: B
1149
- }, $), x), c.emit("reInit");
1150
- }
1151
- function U() {
1152
- u.dragHandler.destroy(), u.eventStore.clear(), u.translate.clear(), u.slideLooper.clear(), u.resizeHandler.destroy(), u.slidesHandler.destroy(), u.slidesInView.destroy(), u.animation.destroy(), o.destroy(), l.clear();
1153
- }
1154
- function Y() {
1155
- h || (h = !0, l.clear(), U(), c.emit("destroy"), c.clear());
1156
- }
1157
- function b($, x, B) {
1158
- !E.active || h || (u.scrollBody.useBaseFriction().useDuration(x === !0 ? 0 : E.duration), u.scrollTo.index($, B || 0));
1159
- }
1160
- function I($) {
1161
- const x = u.index.add(1).get();
1162
- b(x, $, -1);
1163
- }
1164
- function O($) {
1165
- const x = u.index.add(-1).get();
1166
- b(x, $, 1);
1167
- }
1168
- function M() {
1169
- return u.index.add(1).get() !== j();
1170
- }
1171
- function A() {
1172
- return u.index.add(-1).get() !== j();
1173
- }
1174
- function k() {
1175
- return u.scrollSnapList;
1176
- }
1177
- function N() {
1178
- return u.scrollProgress.get(u.offsetLocation.get());
1179
- }
1180
- function j() {
1181
- return u.index.get();
1182
- }
1183
- function R() {
1184
- return u.indexPrevious.get();
1185
- }
1186
- function z() {
1187
- return u.slidesInView.get();
1188
- }
1189
- function H() {
1190
- return u.slidesInView.get(!1);
1191
- }
1192
- function nt() {
1193
- return F;
1194
- }
1195
- function rt() {
1196
- return u;
1197
- }
1198
- function Q() {
1199
- return t;
1200
- }
1201
- function K() {
1202
- return L;
1203
- }
1204
- function tt() {
1205
- return w;
1206
- }
1207
- const J = {
1208
- canScrollNext: M,
1209
- canScrollPrev: A,
1210
- containerNode: K,
1211
- internalEngine: rt,
1212
- destroy: Y,
1213
- off: v,
1214
- on: p,
1215
- emit: d,
1216
- plugins: nt,
1217
- previousScrollSnap: R,
1218
- reInit: g,
1219
- rootNode: Q,
1220
- scrollNext: I,
1221
- scrollPrev: O,
1222
- scrollProgress: N,
1223
- scrollSnapList: k,
1224
- scrollTo: b,
1225
- selectedScrollSnap: j,
1226
- slideNodes: tt,
1227
- slidesInView: z,
1228
- slidesNotInView: H
1229
- };
1230
- return D(n, e), setTimeout(() => c.emit("init"), 0), J;
1231
- }
1232
- bt.globalOptions = void 0;
1233
- function Ct(t = {}, n = []) {
1234
- const e = _.useRef(t), i = _.useRef(n), [s, r] = _.useState(), [o, l] = _.useState(), c = _.useCallback(() => {
1235
- s && s.reInit(e.current, i.current);
1236
- }, [s]);
1237
- return _.useEffect(() => {
1238
- Tt(e.current, t) || (e.current = t, c());
1239
- }, [t, c]), _.useEffect(() => {
1240
- yn(i.current, n) || (i.current = n, c());
1241
- }, [n, c]), _.useEffect(() => {
1242
- if (hn() && o) {
1243
- bt.globalOptions = Ct.globalOptions;
1244
- const a = bt(o, e.current, i.current);
1245
- return r(a), () => a.destroy();
1246
- } else
1247
- r(void 0);
1248
- }, [o, r]), [l, s];
1249
- }
1250
- Ct.globalOptions = void 0;
1251
- const Xn = {
1252
- active: !0,
1253
- breakpoints: {},
1254
- delay: 4e3,
1255
- jump: !1,
1256
- playOnInit: !0,
1257
- stopOnFocusIn: !0,
1258
- stopOnInteraction: !0,
1259
- stopOnMouseEnter: !1,
1260
- stopOnLastSnap: !1,
1261
- rootNode: null
1262
- };
1263
- function Qn(t, n) {
1264
- const e = t.scrollSnapList();
1265
- return typeof n == "number" ? e.map(() => n) : n(e, t);
1266
- }
1267
- function Jn(t, n) {
1268
- const e = t.rootNode();
1269
- return n && n(e) || e;
1270
- }
1271
- function Ft(t = {}) {
1272
- let n, e, i, s, r = null, o = 0, l = !1, c = !1, a = !1, y = !1;
1273
- function f(b, I) {
1274
- e = b;
1275
- const {
1276
- mergeOptions: O,
1277
- optionsAtMedia: M
1278
- } = I, A = O(Xn, Ft.globalOptions), k = O(A, t);
1279
- if (n = M(k), e.scrollSnapList().length <= 1) return;
1280
- y = n.jump, i = !1, s = Qn(e, n.delay);
1281
- const {
1282
- eventStore: N,
1283
- ownerDocument: j
1284
- } = e.internalEngine(), R = !!e.internalEngine().options.watchDrag, z = Jn(e, n.rootNode);
1285
- N.add(j, "visibilitychange", u), R && e.on("pointerDown", E), R && !n.stopOnInteraction && e.on("pointerUp", P), n.stopOnMouseEnter && N.add(z, "mouseenter", F), n.stopOnMouseEnter && !n.stopOnInteraction && N.add(z, "mouseleave", L), n.stopOnFocusIn && e.on("slideFocusStart", h), n.stopOnFocusIn && !n.stopOnInteraction && N.add(e.containerNode(), "focusout", g), n.playOnInit && g();
1286
- }
1287
- function p() {
1288
- e.off("pointerDown", E).off("pointerUp", P).off("slideFocusStart", h), h(), i = !0, l = !1;
1289
- }
1290
- function v() {
1291
- const {
1292
- ownerWindow: b
1293
- } = e.internalEngine();
1294
- b.clearTimeout(o), o = b.setTimeout(C, s[e.selectedScrollSnap()]), r = (/* @__PURE__ */ new Date()).getTime(), e.emit("autoplay:timerset");
1295
- }
1296
- function d() {
1297
- const {
1298
- ownerWindow: b
1299
- } = e.internalEngine();
1300
- b.clearTimeout(o), o = 0, r = null, e.emit("autoplay:timerstopped");
1301
- }
1302
- function g() {
1303
- if (!i) {
1304
- if (S()) {
1305
- a = !0;
1306
- return;
1307
- }
1308
- l || e.emit("autoplay:play"), v(), l = !0;
1309
- }
1310
- }
1311
- function h() {
1312
- i || (l && e.emit("autoplay:stop"), d(), l = !1);
1313
- }
1314
- function u() {
1315
- if (S())
1316
- return a = l, h();
1317
- a && g();
1318
- }
1319
- function S() {
1320
- const {
1321
- ownerDocument: b
1322
- } = e.internalEngine();
1323
- return b.visibilityState === "hidden";
1324
- }
1325
- function E() {
1326
- c || h();
1327
- }
1328
- function P() {
1329
- c || g();
1330
- }
1331
- function F() {
1332
- c = !0, h();
1333
- }
1334
- function L() {
1335
- c = !1, g();
1336
- }
1337
- function w(b) {
1338
- typeof b < "u" && (y = b), g();
1339
- }
1340
- function T() {
1341
- l && h();
1342
- }
1343
- function m() {
1344
- l && g();
1345
- }
1346
- function D() {
1347
- return l;
1348
- }
1349
- function C() {
1350
- const {
1351
- index: b
1352
- } = e.internalEngine(), I = b.clone().add(1).get(), O = e.scrollSnapList().length - 1, M = n.stopOnLastSnap && I === O;
1353
- if (e.canScrollNext() ? e.scrollNext(y) : e.scrollTo(0, y), e.emit("autoplay:select"), M) return h();
1354
- g();
1355
- }
1356
- function U() {
1357
- if (!r) return null;
1358
- const b = s[e.selectedScrollSnap()], I = (/* @__PURE__ */ new Date()).getTime() - r;
1359
- return b - I;
1360
- }
1361
- return {
1362
- name: "autoplay",
1363
- options: t,
1364
- init: f,
1365
- destroy: p,
1366
- play: w,
1367
- stop: T,
1368
- reset: m,
1369
- isPlaying: D,
1370
- timeUntilNext: U
1371
- };
1372
- }
1373
- Ft.globalOptions = void 0;
1374
- const Zn = {
1375
- direction: "forward",
1376
- speed: 2,
1377
- startDelay: 1e3,
1378
- active: !0,
1379
- breakpoints: {},
1380
- playOnInit: !0,
1381
- stopOnFocusIn: !0,
1382
- stopOnInteraction: !0,
1383
- stopOnMouseEnter: !1,
1384
- rootNode: null
1385
- };
1386
- function Wn(t, n) {
1387
- const e = t.rootNode();
1388
- return n && n(e) || e;
1389
- }
1390
- function kt(t = {}) {
1391
- let n, e, i, s, r = 0, o = !1, l = !1, c;
1392
- function a(m, D) {
1393
- e = m;
1394
- const {
1395
- mergeOptions: C,
1396
- optionsAtMedia: U
1397
- } = D, Y = C(Zn, kt.globalOptions), b = C(Y, t);
1398
- if (n = U(b), e.scrollSnapList().length <= 1) return;
1399
- s = n.startDelay, i = !1, c = e.internalEngine().scrollBody;
1400
- const {
1401
- eventStore: I
1402
- } = e.internalEngine(), O = !!e.internalEngine().options.watchDrag, M = Wn(e, n.rootNode);
1403
- O && e.on("pointerDown", d), O && !n.stopOnInteraction && e.on("pointerUp", g), n.stopOnMouseEnter && I.add(M, "mouseenter", h), n.stopOnMouseEnter && !n.stopOnInteraction && I.add(M, "mouseleave", u), n.stopOnFocusIn && e.on("slideFocusStart", p), n.stopOnFocusIn && !n.stopOnInteraction && I.add(e.containerNode(), "focusout", f), n.playOnInit && f();
1404
- }
1405
- function y() {
1406
- e.off("pointerDown", d).off("pointerUp", g).off("slideFocusStart", p).off("settle", S), p(), i = !0, o = !1;
1407
- }
1408
- function f() {
1409
- if (i || o) return;
1410
- e.emit("autoScroll:play");
1411
- const m = e.internalEngine(), {
1412
- ownerWindow: D
1413
- } = m;
1414
- r = D.setTimeout(() => {
1415
- m.scrollBody = v(m), m.animation.start();
1416
- }, s), o = !0;
1417
- }
1418
- function p() {
1419
- if (i || !o) return;
1420
- e.emit("autoScroll:stop");
1421
- const m = e.internalEngine(), {
1422
- ownerWindow: D
1423
- } = m;
1424
- m.scrollBody = c, D.clearTimeout(r), r = 0, o = !1;
1425
- }
1426
- function v(m) {
1427
- const {
1428
- location: D,
1429
- previousLocation: C,
1430
- offsetLocation: U,
1431
- target: Y,
1432
- scrollTarget: b,
1433
- index: I,
1434
- indexPrevious: O,
1435
- limit: {
1436
- reachedMin: M,
1437
- reachedMax: A,
1438
- constrain: k
1439
- },
1440
- options: {
1441
- loop: N
1442
- }
1443
- } = m, j = n.direction === "forward" ? -1 : 1, R = () => tt;
1444
- let z = 0, H = 0, nt = D.get(), rt = 0, Q = !1;
1445
- function K() {
1446
- let J = 0;
1447
- C.set(D), z = j * n.speed, nt += z, D.add(z), Y.set(D), J = nt - rt, H = Math.sign(J), rt = nt;
1448
- const $ = b.byDistance(0, !1).index;
1449
- I.get() !== $ && (O.set(I.get()), I.set($), e.emit("select"));
1450
- const x = n.direction === "forward" ? M(U.get()) : A(U.get());
1451
- if (!N && x) {
1452
- Q = !0;
1453
- const B = k(D.get());
1454
- D.set(B), Y.set(D), p();
1455
- }
1456
- return tt;
1457
- }
1458
- const tt = {
1459
- direction: () => H,
1460
- duration: () => -1,
1461
- velocity: () => z,
1462
- settled: () => Q,
1463
- seek: K,
1464
- useBaseFriction: R,
1465
- useBaseDuration: R,
1466
- useFriction: R,
1467
- useDuration: R
1468
- };
1469
- return tt;
1470
- }
1471
- function d() {
1472
- l || p();
1473
- }
1474
- function g() {
1475
- l || E();
1476
- }
1477
- function h() {
1478
- l = !0, p();
1479
- }
1480
- function u() {
1481
- l = !1, f();
1482
- }
1483
- function S() {
1484
- e.off("settle", S), f();
1485
- }
1486
- function E() {
1487
- e.on("settle", S);
1488
- }
1489
- function P(m) {
1490
- typeof m < "u" && (s = m), f();
1491
- }
1492
- function F() {
1493
- o && p();
1494
- }
1495
- function L() {
1496
- o && (p(), E());
1497
- }
1498
- function w() {
1499
- return o;
1500
- }
1501
- return {
1502
- name: "autoScroll",
1503
- options: t,
1504
- init: a,
1505
- destroy: y,
1506
- play: P,
1507
- stop: F,
1508
- reset: L,
1509
- isPlaying: w
1510
- };
1511
- }
1512
- kt.globalOptions = void 0;
1513
- function Kt(t, n, e) {
1514
- return Math.min(Math.max(t, n), e);
1515
- }
1516
- function wt(t) {
1517
- return typeof t == "number" && !isNaN(t);
1518
- }
1519
- function Wt(t = {}) {
1520
- let s, r = [], o, l = 0, c = 0, a = 0, y = !1, f, p;
1521
- function v(b) {
1522
- s = b;
1523
- const I = s.selectedScrollSnap(), {
1524
- scrollBody: O,
1525
- containerRect: M,
1526
- axis: A
1527
- } = s.internalEngine(), k = A.measureSize(M);
1528
- o = Kt(k * 0.75, 200, 500), y = !1, r = s.scrollSnapList().map((N, j) => j === I ? 1 : 0), f = O.settled, p = s.scrollProgress, O.settled = C, s.scrollProgress = U, s.on("select", S).on("slideFocus", g).on("pointerDown", u).on("pointerUp", h), P(), g();
1529
- }
1530
- function d() {
1531
- const {
1532
- scrollBody: b
1533
- } = s.internalEngine();
1534
- b.settled = f, s.scrollProgress = p, s.off("select", S).off("slideFocus", g).off("pointerDown", u).off("pointerUp", h), s.slideNodes().forEach((I) => {
1535
- const O = I.style;
1536
- O.opacity = "", O.transform = "", O.pointerEvents = "", I.getAttribute("style") || I.removeAttribute("style");
1537
- });
1538
- }
1539
- function g() {
1540
- const b = s.selectedScrollSnap();
1541
- L(b, 1);
1542
- }
1543
- function h() {
1544
- y = !1;
1545
- }
1546
- function u() {
1547
- y = !1, l = 0, c = 0;
1548
- }
1549
- function S() {
1550
- const b = s.internalEngine().scrollBody.duration();
1551
- c = b ? 0 : 1, y = !0, b || g();
1552
- }
1553
- function E(b) {
1554
- const {
1555
- axis: I
1556
- } = s.internalEngine();
1557
- return `translate${I.scroll.toUpperCase()}(${I.direction(b)}px)`;
1558
- }
1559
- function P() {
1560
- const {
1561
- translate: b,
1562
- slideLooper: I
1563
- } = s.internalEngine();
1564
- b.clear(), b.toggleActive(!1), I.loopPoints.forEach(({
1565
- translate: O
1566
- }) => {
1567
- O.clear(), O.toggleActive(!1);
1568
- });
1569
- }
1570
- function F(b) {
1571
- const {
1572
- scrollSnaps: I,
1573
- location: O,
1574
- target: M
1575
- } = s.internalEngine();
1576
- !wt(b) || r[b] < 0.5 || (O.set(I[b]), M.set(O));
1577
- }
1578
- function L(b, I) {
1579
- s.scrollSnapList().forEach((M, A) => {
1580
- const k = Math.abs(I), N = r[A], j = A === b, R = j ? N + k : N - k, z = Kt(R, 0, 1);
1581
- r[A] = z;
1582
- const H = j && y, nt = s.previousScrollSnap();
1583
- H && (r[nt] = 1 - z), j && T(b, z), w(A);
1584
- });
1585
- }
1586
- function w(b) {
1587
- const I = s.internalEngine().slideRegistry[b], {
1588
- scrollSnaps: O,
1589
- containerRect: M
1590
- } = s.internalEngine(), A = r[b];
1591
- I.forEach((k) => {
1592
- const N = s.slideNodes()[k].style, j = parseFloat(A.toFixed(2)), R = j > 0, z = R ? O[b] : M.width + 2, H = E(z);
1593
- R && (N.transform = H), N.opacity = j.toString(), N.pointerEvents = A > 0.5 ? "auto" : "none", R || (N.transform = H);
1594
- });
1595
- }
1596
- function T(b, I) {
1597
- const {
1598
- index: O,
1599
- dragHandler: M,
1600
- scrollSnaps: A
1601
- } = s.internalEngine(), k = M.pointerDown(), N = 1 / (A.length - 1);
1602
- let j = b, R = k ? s.selectedScrollSnap() : s.previousScrollSnap();
1603
- if (k && j === R) {
1604
- const nt = Math.sign(l) * -1;
1605
- j = R, R = O.clone().set(R).add(nt).get();
1606
- }
1607
- const z = R * N, H = (j - R) * N;
1608
- a = z + H * I;
1609
- }
1610
- function m() {
1611
- const {
1612
- dragHandler: b,
1613
- index: I,
1614
- scrollBody: O
1615
- } = s.internalEngine(), M = s.selectedScrollSnap();
1616
- if (!b.pointerDown()) return M;
1617
- const A = Math.sign(O.velocity()), k = Math.sign(l), N = I.clone().set(M).add(A * -1).get();
1618
- return !A || !k ? null : k === A ? N : M;
1619
- }
1620
- function D(b) {
1621
- const {
1622
- dragHandler: I,
1623
- scrollBody: O
1624
- } = b.internalEngine(), M = I.pointerDown(), A = O.velocity(), k = O.duration(), N = m(), j = !wt(N);
1625
- if (M) {
1626
- if (!A) return;
1627
- l += A, c = Math.abs(A / o), F(N);
1628
- }
1629
- if (!M) {
1630
- if (!k || j) return;
1631
- c += (1 - r[N]) / k, c *= 0.68;
1632
- }
1633
- j || L(N, c);
1634
- }
1635
- function C() {
1636
- const {
1637
- target: b,
1638
- location: I
1639
- } = s.internalEngine(), O = b.get() - I.get(), M = Math.abs(O) >= 1, A = m(), k = !wt(A);
1640
- return D(s), k || M ? !1 : r[A] > 0.999;
1641
- }
1642
- function U() {
1643
- return a;
1644
- }
1645
- return {
1646
- name: "fade",
1647
- options: t,
1648
- init: v,
1649
- destroy: d
1650
- };
1651
- }
1652
- Wt.globalOptions = void 0;
1653
- function te(t, n, e) {
1654
- return e === "fade" ? 1 : t !== void 0 ? t : n ? null : 1;
1655
- }
1656
- function ne(t, n, e) {
1657
- return n === "fade" && e === 1 ? 0 : t;
1658
- }
1659
- function ee({
1660
- loop: t,
1661
- continuous: n,
1662
- visibleCount: e,
1663
- childCount: i
1664
- }) {
1665
- if (!t || n || e == null || e <= 1 || i <= 0) return 1;
1666
- const s = Math.ceil(e) + 1;
1667
- return i >= s ? 1 : Math.ceil(s / i);
1668
- }
1669
- function oe(t, n) {
1670
- const [e, i] = _.useState(void 0);
1671
- return [_.useCallback(
1672
- (r) => {
1673
- if (!r || !t || n != null) return;
1674
- const o = r.firstElementChild;
1675
- o && o.offsetHeight > 0 ? i(o.offsetHeight) : requestAnimationFrame(() => {
1676
- const l = r.firstElementChild;
1677
- l && l.offsetHeight > 0 && i(l.offsetHeight);
1678
- });
1679
- },
1680
- [t, n]
1681
- ), n ?? e];
1682
- }
1683
- function ce({
1684
- visible: t,
1685
- gap: n = 0,
1686
- height: e,
1687
- direction: i = "left",
1688
- loop: s = !0,
1689
- autoAdvance: r = 0,
1690
- continuous: o = !1,
1691
- speed: l = 2,
1692
- effect: c = "slide",
1693
- dimInactive: a = !1,
1694
- showControls: y = !0,
1695
- controlsPosition: f = "outside",
1696
- showDots: p = !1,
1697
- pauseOnHover: v = !0,
1698
- align: d = "start",
1699
- slidesToScroll: g = 1,
1700
- drag: h = !0,
1701
- className: u,
1702
- cssClass: S,
1703
- children: E
1704
- }) {
1705
- const P = i === "up" || i === "down", F = te(t, o, c), L = _.Children.toArray(E).filter(
1706
- (O) => O != null && O !== ""
1707
- ), [w, T] = oe(P, e), m = !P || T != null, D = F != null && F > 0 ? F : null, C = ne(n, c, D), U = C > 0 ? C / 2 : 0, Y = D != null ? P && T != null ? `${T / D}px` : `${100 / D}%` : void 0;
1708
- let b = L;
1709
- if (s && o)
1710
- b = [
1711
- ...L,
1712
- ...L.map(
1713
- (O, M) => It.cloneElement(O, { key: `dup1-${M}` })
1714
- ),
1715
- ...L.map(
1716
- (O, M) => It.cloneElement(O, { key: `dup2-${M}` })
1717
- )
1718
- ];
1719
- else if (s && D != null && D > 1 && L.length > 0) {
1720
- const O = ee({
1721
- loop: s,
1722
- continuous: o,
1723
- visibleCount: D,
1724
- childCount: L.length
1725
- });
1726
- O > 1 && (b = Array.from(
1727
- { length: O },
1728
- (M, A) => L.map(
1729
- (k, N) => It.cloneElement(k, {
1730
- key: `loopdup-${A}-${N}`
1731
- })
1732
- )
1733
- ).flat());
1734
- }
1735
- const I = L.length;
1736
- return m ? /* @__PURE__ */ W.jsx(
1737
- se,
1738
- {
1739
- isVertical: P,
1740
- effectiveHeight: T,
1741
- validChildren: b,
1742
- realSlideCount: I,
1743
- slideBasis: Y,
1744
- halfGap: U,
1745
- loop: s,
1746
- align: d,
1747
- slidesToScroll: g,
1748
- continuous: o,
1749
- drag: h,
1750
- effect: c,
1751
- autoAdvance: r,
1752
- speed: l,
1753
- direction: i,
1754
- pauseOnHover: v,
1755
- dimInactive: a,
1756
- showControls: y,
1757
- controlsPosition: f,
1758
- showDots: p,
1759
- className: u,
1760
- cssClass: S
1761
- }
1762
- ) : /* @__PURE__ */ W.jsx(
1763
- "div",
1764
- {
1765
- ref: w,
1766
- className: Xt(u, S),
1767
- style: { overflow: "hidden", height: 0, position: "relative" },
1768
- children: L[0]
1769
- }
1770
- );
1771
- }
1772
- function se({
1773
- isVertical: t,
1774
- effectiveHeight: n,
1775
- validChildren: e,
1776
- realSlideCount: i,
1777
- slideBasis: s,
1778
- halfGap: r,
1779
- loop: o,
1780
- align: l,
1781
- slidesToScroll: c,
1782
- continuous: a,
1783
- drag: y,
1784
- effect: f,
1785
- autoAdvance: p,
1786
- speed: v,
1787
- direction: d,
1788
- pauseOnHover: g,
1789
- dimInactive: h,
1790
- showControls: u,
1791
- controlsPosition: S,
1792
- showDots: E,
1793
- className: P,
1794
- cssClass: F
1795
- }) {
1796
- const L = {
1797
- axis: t ? "y" : "x",
1798
- loop: o,
1799
- align: l,
1800
- slidesToScroll: c,
1801
- dragFree: a,
1802
- watchDrag: y
1803
- }, w = [];
1804
- f === "fade" && w.push(Wt()), a ? w.push(
1805
- kt({
1806
- speed: v,
1807
- direction: d === "right" || d === "down" ? "backward" : "forward",
1808
- playOnInit: !0,
1809
- stopOnMouseEnter: g,
1810
- stopOnInteraction: !1
1811
- })
1812
- ) : p > 0 && w.push(
1813
- Ft({
1814
- delay: p,
1815
- playOnInit: !0,
1816
- stopOnMouseEnter: g,
1817
- stopOnInteraction: !1
1818
- })
1819
- );
1820
- const [T, m] = Ct(L, w);
1821
- _.useEffect(() => {
1822
- if (!m) return;
1823
- const V = window;
1824
- V.__emblaDebug || (V.__emblaDebug = []), V.__emblaDebug.push(m), console.log(
1825
- "[Carousel] init axis=" + (t ? "y" : "x") + " snaps=" + m.scrollSnapList().length + " canNext=" + m.canScrollNext() + " canPrev=" + m.canScrollPrev() + " slides=" + m.slideNodes().length
1826
- );
1827
- }, [m]);
1828
- const [D, C] = _.useState(!1), [U, Y] = _.useState(!1), [b, I] = _.useState(0), [O, M] = _.useState(0), [A, k] = _.useState([]), N = _.useCallback(() => m == null ? void 0 : m.scrollPrev(), [m]), j = _.useCallback(() => m == null ? void 0 : m.scrollNext(), [m]), R = _.useCallback(
1829
- (V) => m == null ? void 0 : m.scrollTo(V),
1830
- [m]
1831
- ), z = _.useCallback(() => {
1832
- if (!m) return;
1833
- C(m.canScrollPrev()), Y(m.canScrollNext());
1834
- const V = m.selectedScrollSnap();
1835
- I(i > 0 ? V % i : V);
1836
- }, [m, i]), H = _.useCallback((V) => {
1837
- const G = V.scrollProgress(), ct = V.scrollSnapList().map((ut) => {
1838
- const ft = Math.abs(G - ut);
1839
- return Math.max(0.3, 1 - ft * 2);
1840
- });
1841
- k(ct);
1842
- }, []);
1843
- _.useEffect(() => {
1844
- if (m)
1845
- return M(i), z(), m.on("select", z), m.on("reInit", z), h && (H(m), m.on("scroll", H), m.on("reInit", H)), () => {
1846
- m.off("select", z), m.off("reInit", z), h && (m.off("scroll", H), m.off("reInit", H));
1847
- };
1848
- }, [m, z, h, H, i]);
1849
- const nt = t ? fn : dn, rt = t ? pn : gn, Q = u && !a, K = S === "outside", tt = E && O > 1, J = tt && t, $ = tt && !t, x = 32, B = x + 8, Z = {
1850
- position: "relative",
1851
- ...Q && K ? t ? { paddingTop: B, paddingBottom: B } : { paddingLeft: B, paddingRight: B } : {},
1852
- ...J ? { paddingRight: 20 } : {}
1853
- }, et = K ? t ? { top: 0, left: "50%", transform: "translateX(-50%)" } : { left: 0, top: "50%", transform: "translateY(-50%)" } : t ? { top: 8, right: 8 } : { left: 8, top: "50%", transform: "translateY(-50%)" }, ot = K ? t ? { bottom: 0, left: "50%", transform: "translateX(-50%)" } : { right: 0, top: "50%", transform: "translateY(-50%)" } : t ? { bottom: 8, right: 8 } : { right: 8, top: "50%", transform: "translateY(-50%)" };
1854
- return /* @__PURE__ */ W.jsxs("div", { className: Xt(P, F), style: { position: "relative" }, children: [
1855
- /* @__PURE__ */ W.jsxs("div", { style: Z, children: [
1856
- /* @__PURE__ */ W.jsx(
1857
- "div",
1858
- {
1859
- ref: T,
1860
- style: {
1861
- overflow: "hidden",
1862
- // For vertical: set height on the viewport so Embla knows the
1863
- // visible area. This was measured before this component mounted.
1864
- ...t && n != null ? { height: n } : {}
1865
- },
1866
- children: /* @__PURE__ */ W.jsx(
1867
- "div",
1868
- {
1869
- style: {
1870
- display: "flex",
1871
- flexDirection: t ? "column" : "row",
1872
- // For vertical carousels, Embla measures the container rect for
1873
- // view size. Keep container height fixed to the viewport height.
1874
- ...t && n != null ? { height: n } : {},
1875
- touchAction: t ? "pan-x pinch-zoom" : "pan-y pinch-zoom",
1876
- ...r > 0 ? t ? { marginTop: -r, marginBottom: -r } : { marginLeft: -r, marginRight: -r } : {},
1877
- ...f === "fade" ? { position: "relative" } : {}
1878
- },
1879
- children: e.map((V, G) => /* @__PURE__ */ W.jsx(
1880
- "div",
1881
- {
1882
- role: "group",
1883
- "aria-roledescription": "slide",
1884
- style: {
1885
- flexShrink: 0,
1886
- flexGrow: 0,
1887
- ...t ? { minHeight: 0 } : { minWidth: 0 },
1888
- ...s != null ? { flexBasis: s } : {},
1889
- ...r > 0 ? t ? { paddingTop: r, paddingBottom: r } : { paddingLeft: r, paddingRight: r } : {},
1890
- ...h && A[G] != null ? {
1891
- opacity: A[G],
1892
- transition: "opacity 300ms ease"
1893
- } : {}
1894
- },
1895
- children: V
1896
- },
1897
- G
1898
- ))
1899
- }
1900
- )
1901
- }
1902
- ),
1903
- Q && /* @__PURE__ */ W.jsxs(W.Fragment, { children: [
1904
- /* @__PURE__ */ W.jsx(
1905
- "button",
1906
- {
1907
- onClick: N,
1908
- disabled: !o && !D,
1909
- style: {
1910
- position: "absolute",
1911
- zIndex: 10,
1912
- display: "flex",
1913
- alignItems: "center",
1914
- justifyContent: "center",
1915
- width: x,
1916
- height: x,
1917
- borderRadius: "50%",
1918
- border: "1px solid var(--border, #e5e7eb)",
1919
- background: "var(--background, #fff)",
1920
- boxShadow: "0 1px 3px rgba(0,0,0,.1)",
1921
- cursor: "pointer",
1922
- opacity: !o && !D ? 0 : 1,
1923
- transition: "opacity 150ms",
1924
- ...et
1925
- },
1926
- children: /* @__PURE__ */ W.jsx(nt, { style: { width: 16, height: 16 } })
1927
- }
1928
- ),
1929
- /* @__PURE__ */ W.jsx(
1930
- "button",
1931
- {
1932
- onClick: j,
1933
- disabled: !o && !U,
1934
- style: {
1935
- position: "absolute",
1936
- zIndex: 10,
1937
- display: "flex",
1938
- alignItems: "center",
1939
- justifyContent: "center",
1940
- width: x,
1941
- height: x,
1942
- borderRadius: "50%",
1943
- border: "1px solid var(--border, #e5e7eb)",
1944
- background: "var(--background, #fff)",
1945
- boxShadow: "0 1px 3px rgba(0,0,0,.1)",
1946
- cursor: "pointer",
1947
- opacity: !o && !U ? 0 : 1,
1948
- transition: "opacity 150ms",
1949
- ...ot
1950
- },
1951
- children: /* @__PURE__ */ W.jsx(rt, { style: { width: 16, height: 16 } })
1952
- }
1953
- )
1954
- ] }),
1955
- J && /* @__PURE__ */ W.jsx(
1956
- "div",
1957
- {
1958
- style: {
1959
- position: "absolute",
1960
- top: "50%",
1961
- right: 0,
1962
- transform: "translateY(-50%)",
1963
- display: "flex",
1964
- flexDirection: "column",
1965
- alignItems: "center",
1966
- justifyContent: "center",
1967
- gap: 6
1968
- },
1969
- children: Array.from({ length: O }, (V, G) => /* @__PURE__ */ W.jsx(
1970
- "button",
1971
- {
1972
- onClick: () => R(G),
1973
- style: {
1974
- width: 8,
1975
- height: 8,
1976
- borderRadius: "50%",
1977
- border: "none",
1978
- cursor: "pointer",
1979
- transition: "opacity 150ms",
1980
- background: "var(--foreground, #000)",
1981
- opacity: G === b ? 1 : 0.2
1982
- }
1983
- },
1984
- G
1985
- ))
1986
- }
1987
- )
1988
- ] }),
1989
- $ && /* @__PURE__ */ W.jsx(
1990
- "div",
1991
- {
1992
- style: {
1993
- display: "flex",
1994
- justifyContent: "center",
1995
- gap: 6,
1996
- marginTop: 12
1997
- },
1998
- children: Array.from({ length: O }, (V, G) => /* @__PURE__ */ W.jsx(
1999
- "button",
2000
- {
2001
- onClick: () => R(G),
2002
- style: {
2003
- width: 8,
2004
- height: 8,
2005
- borderRadius: "50%",
2006
- border: "none",
2007
- cursor: "pointer",
2008
- transition: "opacity 150ms",
2009
- background: "var(--foreground, #000)",
2010
- opacity: G === b ? 1 : 0.2
2011
- }
2012
- },
2013
- G
2014
- ))
2015
- }
2016
- )
2017
- ] });
2018
- }
2019
- export {
2020
- ce as PrefabCarousel
2021
- };