react-spring-carousel 3.0.0-beta-1.0.4095 → 3.0.0-beta-1.0.41
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.es.js +92 -92
- package/dist/index.umd.js +16 -16
- package/package.json +1 -1
package/dist/index.es.js
CHANGED
|
@@ -74,7 +74,7 @@ function I(r) {
|
|
|
74
74
|
}
|
|
75
75
|
return r;
|
|
76
76
|
}
|
|
77
|
-
const
|
|
77
|
+
const Ae = {
|
|
78
78
|
pointer: {
|
|
79
79
|
start: "down",
|
|
80
80
|
change: "move",
|
|
@@ -104,7 +104,7 @@ function nt(r = !1, e) {
|
|
|
104
104
|
return r && !rt.includes(e);
|
|
105
105
|
}
|
|
106
106
|
function it(r, e = "", t = !1) {
|
|
107
|
-
const n =
|
|
107
|
+
const n = Ae[r], i = n && n[e] || e;
|
|
108
108
|
return "on" + Te(r) + Te(i) + (nt(t, i) ? "Capture" : "");
|
|
109
109
|
}
|
|
110
110
|
const st = ["gotpointercapture", "lostpointercapture"];
|
|
@@ -120,13 +120,13 @@ function ot(r) {
|
|
|
120
120
|
};
|
|
121
121
|
}
|
|
122
122
|
function ct(r, e = "") {
|
|
123
|
-
const t =
|
|
123
|
+
const t = Ae[r], n = t && t[e] || e;
|
|
124
124
|
return r + n;
|
|
125
125
|
}
|
|
126
126
|
function ae(r) {
|
|
127
127
|
return "touches" in r;
|
|
128
128
|
}
|
|
129
|
-
function
|
|
129
|
+
function Le(r) {
|
|
130
130
|
return ae(r) ? "touch" : "pointerType" in r ? r.pointerType : "mouse";
|
|
131
131
|
}
|
|
132
132
|
function at(r) {
|
|
@@ -138,18 +138,18 @@ function at(r) {
|
|
|
138
138
|
function ut(r) {
|
|
139
139
|
return r.type === "touchend" || r.type === "touchcancel" ? r.changedTouches : r.targetTouches;
|
|
140
140
|
}
|
|
141
|
-
function
|
|
141
|
+
function Ve(r) {
|
|
142
142
|
return ae(r) ? ut(r)[0] : r;
|
|
143
143
|
}
|
|
144
144
|
function lt(r) {
|
|
145
145
|
return at(r).map((e) => e.identifier);
|
|
146
146
|
}
|
|
147
147
|
function ge(r) {
|
|
148
|
-
const e =
|
|
148
|
+
const e = Ve(r);
|
|
149
149
|
return ae(r) ? e.identifier : e.pointerId;
|
|
150
150
|
}
|
|
151
151
|
function De(r) {
|
|
152
|
-
const e =
|
|
152
|
+
const e = Ve(r);
|
|
153
153
|
return [e.clientX, e.clientY];
|
|
154
154
|
}
|
|
155
155
|
function ft(r) {
|
|
@@ -261,13 +261,13 @@ class gt {
|
|
|
261
261
|
} else
|
|
262
262
|
S[0] = u[0] !== !1 ? s - u[0] : 0, S[1] = u[1] !== !1 ? h - u[1] : 0;
|
|
263
263
|
this.restrictToAxis && !t._blocked && this.restrictToAxis(S);
|
|
264
|
-
const
|
|
264
|
+
const L = t.offset, G = t._active && !t._blocked || t.active;
|
|
265
265
|
G && (t.first = t._active && !t.active, t.last = !t._active && t.active, t.active = i[this.ingKey] = t._active, e && (t.first && ("bounds" in n && (t._bounds = ce(n.bounds, t)), this.setup && this.setup()), t.movement = S, this.computeOffset()));
|
|
266
|
-
const [T, C] = t.offset, [[N, Y], [X,
|
|
267
|
-
t.overflow = [T < N ? -1 : T > Y ? 1 : 0, C < X ? -1 : C >
|
|
266
|
+
const [T, C] = t.offset, [[N, Y], [X, b]] = t._bounds;
|
|
267
|
+
t.overflow = [T < N ? -1 : T > Y ? 1 : 0, C < X ? -1 : C > b ? 1 : 0], t._movementBound[0] = t.overflow[0] ? t._movementBound[0] === !1 ? t._movement[0] : t._movementBound[0] : !1, t._movementBound[1] = t.overflow[1] ? t._movementBound[1] === !1 ? t._movement[1] : t._movementBound[1] : !1;
|
|
268
268
|
const ee = t._active ? n.rubberband || [0, 0] : [0, 0];
|
|
269
|
-
if (t.offset = Ze(t._bounds, t.offset, ee), t.delta = k.sub(t.offset,
|
|
270
|
-
t.delta = k.sub(t.offset,
|
|
269
|
+
if (t.offset = Ze(t._bounds, t.offset, ee), t.delta = k.sub(t.offset, L), this.computeMovement(), G && (!t.last || c > pt)) {
|
|
270
|
+
t.delta = k.sub(t.offset, L);
|
|
271
271
|
const w = t.delta.map(Math.abs);
|
|
272
272
|
k.addTo(t.distance, w), t.direction = t.delta.map(Math.sign), t._direction = t._delta.map(Math.sign), !t.first && c > 0 && (t.velocity = [w[0] / c, w[1] / c], t.timeDelta = c);
|
|
273
273
|
}
|
|
@@ -310,7 +310,7 @@ class vt extends gt {
|
|
|
310
310
|
axisIntent(e) {
|
|
311
311
|
const t = this.state, n = this.config;
|
|
312
312
|
if (!t.axis && e) {
|
|
313
|
-
const i = typeof n.axisThreshold == "object" ? n.axisThreshold[
|
|
313
|
+
const i = typeof n.axisThreshold == "object" ? n.axisThreshold[Le(e)] : n.axisThreshold;
|
|
314
314
|
t.axis = mt(t._movement, i);
|
|
315
315
|
}
|
|
316
316
|
t._blocked = (n.lockDirection || !!n.axis) && !t.axis || !!n.axis && n.axis !== t.axis;
|
|
@@ -453,7 +453,7 @@ class yt extends vt {
|
|
|
453
453
|
const t = this.config, n = this.state;
|
|
454
454
|
if (e.buttons != null && (Array.isArray(t.pointerButtons) ? !t.pointerButtons.includes(e.buttons) : t.pointerButtons !== -1 && t.pointerButtons !== e.buttons)) return;
|
|
455
455
|
const i = this.ctrl.setEventIds(e);
|
|
456
|
-
t.pointerCapture && e.target.setPointerCapture(e.pointerId), !(i && i.size > 1 && n._pointerActive) && (this.start(e), this.setupPointer(e), n._pointerId = ge(e), n._pointerActive = !0, this.computeValues(De(e)), this.computeInitial(), t.preventScrollAxis &&
|
|
456
|
+
t.pointerCapture && e.target.setPointerCapture(e.pointerId), !(i && i.size > 1 && n._pointerActive) && (this.start(e), this.setupPointer(e), n._pointerId = ge(e), n._pointerActive = !0, this.computeValues(De(e)), this.computeInitial(), t.preventScrollAxis && Le(e) !== "mouse" ? (n._active = !1, this.setupScrollPrevention(e)) : t.delay > 0 ? (this.setupDelayTrigger(e), t.triggerAllEvents && (this.compute(e), this.emit())) : this.startPointerDrag(e));
|
|
457
457
|
}
|
|
458
458
|
startPointerDrag(e) {
|
|
459
459
|
const t = this.state;
|
|
@@ -498,10 +498,10 @@ class yt extends vt {
|
|
|
498
498
|
if (t.tap = c <= n.tapsThreshold && s <= n.tapsThreshold, t.tap && n.filterTaps)
|
|
499
499
|
t._force = !0;
|
|
500
500
|
else {
|
|
501
|
-
const [h, _] = t._delta, [E, u] = t._movement, [D, S] = n.swipe.velocity, [
|
|
501
|
+
const [h, _] = t._delta, [E, u] = t._movement, [D, S] = n.swipe.velocity, [L, G] = n.swipe.distance, T = n.swipe.duration;
|
|
502
502
|
if (t.elapsedTime < T) {
|
|
503
503
|
const C = Math.abs(h / t.timeDelta), N = Math.abs(_ / t.timeDelta);
|
|
504
|
-
C > D && Math.abs(E) >
|
|
504
|
+
C > D && Math.abs(E) > L && (t.swipe[0] = Math.sign(h)), N > S && Math.abs(u) > G && (t.swipe[1] = Math.sign(_));
|
|
505
505
|
}
|
|
506
506
|
}
|
|
507
507
|
this.emit();
|
|
@@ -561,11 +561,11 @@ function wt(r) {
|
|
|
561
561
|
"persist" in r && typeof r.persist == "function" && r.persist();
|
|
562
562
|
}
|
|
563
563
|
const Z = typeof window < "u" && window.document && window.document.createElement;
|
|
564
|
-
function
|
|
564
|
+
function $e() {
|
|
565
565
|
return Z && "ontouchstart" in window;
|
|
566
566
|
}
|
|
567
567
|
function _t() {
|
|
568
|
-
return
|
|
568
|
+
return $e() || Z && window.navigator.maxTouchPoints > 1;
|
|
569
569
|
}
|
|
570
570
|
function xt() {
|
|
571
571
|
return Z && "onpointerdown" in window;
|
|
@@ -580,10 +580,10 @@ function Et() {
|
|
|
580
580
|
return !1;
|
|
581
581
|
}
|
|
582
582
|
}
|
|
583
|
-
const
|
|
583
|
+
const A = {
|
|
584
584
|
isBrowser: Z,
|
|
585
585
|
gesture: Et(),
|
|
586
|
-
touch:
|
|
586
|
+
touch: $e(),
|
|
587
587
|
touchscreen: _t(),
|
|
588
588
|
pointer: xt(),
|
|
589
589
|
pointerLock: It()
|
|
@@ -599,12 +599,12 @@ const L = {
|
|
|
599
599
|
mouse: i = !1
|
|
600
600
|
} = {}
|
|
601
601
|
}) {
|
|
602
|
-
return this.pointerLock = n &&
|
|
602
|
+
return this.pointerLock = n && A.pointerLock, A.touch && t ? "touch" : this.pointerLock ? "mouse" : A.pointer && !i ? "pointer" : A.touch ? "touch" : "mouse";
|
|
603
603
|
},
|
|
604
604
|
preventScrollAxis(r, e, {
|
|
605
605
|
preventScroll: t
|
|
606
606
|
}) {
|
|
607
|
-
if (this.preventScrollDelay = typeof t == "number" ? t : t || t === void 0 && r ? St : void 0, !(!
|
|
607
|
+
if (this.preventScrollDelay = typeof t == "number" ? t : t || t === void 0 && r ? St : void 0, !(!A.touchscreen || t === !1))
|
|
608
608
|
return r || (t !== void 0 ? "y" : void 0);
|
|
609
609
|
},
|
|
610
610
|
pointerCapture(r, e, {
|
|
@@ -686,11 +686,11 @@ I(I({}, ye), {}, {
|
|
|
686
686
|
touch: n = !1
|
|
687
687
|
} = {}
|
|
688
688
|
}) {
|
|
689
|
-
if (t.target && !
|
|
690
|
-
if (
|
|
691
|
-
if (
|
|
692
|
-
if (
|
|
693
|
-
if (
|
|
689
|
+
if (t.target && !A.touch && A.gesture) return "gesture";
|
|
690
|
+
if (A.touch && n) return "touch";
|
|
691
|
+
if (A.touchscreen) {
|
|
692
|
+
if (A.pointer) return "pointer";
|
|
693
|
+
if (A.touch) return "touch";
|
|
694
694
|
}
|
|
695
695
|
},
|
|
696
696
|
bounds(r, e, {
|
|
@@ -754,7 +754,7 @@ function Rt(r, e) {
|
|
|
754
754
|
}
|
|
755
755
|
return t;
|
|
756
756
|
}
|
|
757
|
-
const
|
|
757
|
+
const At = {
|
|
758
758
|
target(r) {
|
|
759
759
|
if (r)
|
|
760
760
|
return () => "current" in r ? r.current : r;
|
|
@@ -762,7 +762,7 @@ const Lt = {
|
|
|
762
762
|
enabled(r = !0) {
|
|
763
763
|
return r;
|
|
764
764
|
},
|
|
765
|
-
window(r =
|
|
765
|
+
window(r = A.isBrowser ? window : void 0) {
|
|
766
766
|
return r;
|
|
767
767
|
},
|
|
768
768
|
eventOptions({
|
|
@@ -777,7 +777,7 @@ const Lt = {
|
|
|
777
777
|
transform(r) {
|
|
778
778
|
return r;
|
|
779
779
|
}
|
|
780
|
-
},
|
|
780
|
+
}, Lt = ["target", "eventOptions", "window", "enabled", "transform"];
|
|
781
781
|
function oe(r = {}, e) {
|
|
782
782
|
const t = {};
|
|
783
783
|
for (const [n, i] of Object.entries(e))
|
|
@@ -798,21 +798,21 @@ function oe(r = {}, e) {
|
|
|
798
798
|
}
|
|
799
799
|
return t;
|
|
800
800
|
}
|
|
801
|
-
function
|
|
801
|
+
function Vt(r, e, t = {}) {
|
|
802
802
|
const n = r, {
|
|
803
803
|
target: i,
|
|
804
804
|
eventOptions: c,
|
|
805
805
|
window: s,
|
|
806
806
|
enabled: h,
|
|
807
807
|
transform: _
|
|
808
|
-
} = n, E = Rt(n,
|
|
808
|
+
} = n, E = Rt(n, Lt);
|
|
809
809
|
if (t.shared = oe({
|
|
810
810
|
target: i,
|
|
811
811
|
eventOptions: c,
|
|
812
812
|
window: s,
|
|
813
813
|
enabled: h,
|
|
814
814
|
transform: _
|
|
815
|
-
},
|
|
815
|
+
}, At), e) {
|
|
816
816
|
const u = be.get(e);
|
|
817
817
|
t[e] = oe(I({
|
|
818
818
|
shared: t.shared
|
|
@@ -848,7 +848,7 @@ class Ge {
|
|
|
848
848
|
this._listeners.forEach((e) => e()), this._listeners.clear();
|
|
849
849
|
}
|
|
850
850
|
}
|
|
851
|
-
class
|
|
851
|
+
class $t {
|
|
852
852
|
constructor() {
|
|
853
853
|
O(this, "_timeouts", /* @__PURE__ */ new Map());
|
|
854
854
|
}
|
|
@@ -884,7 +884,7 @@ class jt {
|
|
|
884
884
|
this.handlers = e, this.nativeHandlers = t;
|
|
885
885
|
}
|
|
886
886
|
applyConfig(e, t) {
|
|
887
|
-
this.config =
|
|
887
|
+
this.config = Vt(e, t, this.config);
|
|
888
888
|
}
|
|
889
889
|
clean() {
|
|
890
890
|
this._targetEventStore.clean();
|
|
@@ -931,7 +931,7 @@ class jt {
|
|
|
931
931
|
}
|
|
932
932
|
}
|
|
933
933
|
function H(r, e) {
|
|
934
|
-
r.gestures.add(e), r.gestureEventStores[e] = new Ge(r, e), r.gestureTimeoutStores[e] = new
|
|
934
|
+
r.gestures.add(e), r.gestureEventStores[e] = new Ge(r, e), r.gestureTimeoutStores[e] = new $t();
|
|
935
935
|
}
|
|
936
936
|
function Bt(r, e) {
|
|
937
937
|
e.drag && H(r, "drag"), e.wheel && H(r, "wheel"), e.scroll && H(r, "scroll"), e.move && H(r, "move"), e.pinch && H(r, "pinch"), e.hover && H(r, "hover");
|
|
@@ -1047,7 +1047,7 @@ function qt({
|
|
|
1047
1047
|
fadeIn: E = !1,
|
|
1048
1048
|
initialActiveItem: u
|
|
1049
1049
|
}) {
|
|
1050
|
-
const [D, S] = qe(!1),
|
|
1050
|
+
const [D, S] = qe(!1), L = R([]), G = R(!1), T = R(0), C = _ ?? "slide", N = i ? [
|
|
1051
1051
|
...e.map((o) => ({
|
|
1052
1052
|
...o,
|
|
1053
1053
|
id: `prev-repeated-item-${o.id}`
|
|
@@ -1057,7 +1057,7 @@ function qt({
|
|
|
1057
1057
|
...o,
|
|
1058
1058
|
id: `next-repeated-item-${o.id}`
|
|
1059
1059
|
}))
|
|
1060
|
-
] : e, Y = R(n), X = R(0),
|
|
1060
|
+
] : e, Y = R(n), X = R(0), b = Je().replace(/:/g, ""), ee = R(null), w = R(null), te = R(0), v = R(!0), g = R(!1), a = R(0), [V, re] = Ye(
|
|
1061
1061
|
() => ({
|
|
1062
1062
|
value: 0,
|
|
1063
1063
|
onChange({ value: o }) {
|
|
@@ -1074,16 +1074,16 @@ function qt({
|
|
|
1074
1074
|
return w.current[s === "x" ? "scrollWidth" : "scrollHeight"] - ee.current.getBoundingClientRect()[s === "x" ? "width" : "height"];
|
|
1075
1075
|
}
|
|
1076
1076
|
function q(o) {
|
|
1077
|
-
o &&
|
|
1077
|
+
o && L.current.push(o), Re("The carousel can't be initialized. List of errors:"), console.table(L.current);
|
|
1078
1078
|
}
|
|
1079
1079
|
function Ke() {
|
|
1080
1080
|
return t === "freeScroll" ? {
|
|
1081
1081
|
onWheel() {
|
|
1082
|
-
|
|
1082
|
+
V.value.stop();
|
|
1083
1083
|
},
|
|
1084
1084
|
onScroll(o) {
|
|
1085
1085
|
const f = o.currentTarget, d = s === "x" ? f.scrollLeft : f.scrollTop, m = s === "x" ? f.scrollWidth - f.clientWidth : f.scrollHeight - f.clientHeight;
|
|
1086
|
-
d === 0 ?
|
|
1086
|
+
d === 0 ? v.current = !0 : d === m ? g.current = !0 : (v.current = !1, g.current = !1);
|
|
1087
1087
|
}
|
|
1088
1088
|
} : {};
|
|
1089
1089
|
}
|
|
@@ -1091,11 +1091,11 @@ function qt({
|
|
|
1091
1091
|
let o = 0, f = 0, d = 0;
|
|
1092
1092
|
const m = getComputedStyle(
|
|
1093
1093
|
document.documentElement
|
|
1094
|
-
).getPropertyValue(`--${
|
|
1094
|
+
).getPropertyValue(`--${b}-react-spring-carousel-item-gutter`), l = getComputedStyle(
|
|
1095
1095
|
document.documentElement
|
|
1096
|
-
).getPropertyValue(`--${
|
|
1096
|
+
).getPropertyValue(`--${b}-react-spring-carousel-items-per-slide`), p = getComputedStyle(
|
|
1097
1097
|
document.documentElement
|
|
1098
|
-
).getPropertyValue(`--${
|
|
1098
|
+
).getPropertyValue(`--${b}-react-spring-carousel-item-gutter`);
|
|
1099
1099
|
return p.includes("px") && (o = Number(p.replace("px", ""))), d = Number(l) || 1, m.includes("px") && (f = Number(
|
|
1100
1100
|
m.replace("px", "")
|
|
1101
1101
|
)), { totalGutterCssVar: o, totalStartEndGutterCssVar: f, itemsPerSlide: d };
|
|
@@ -1107,41 +1107,41 @@ function qt({
|
|
|
1107
1107
|
shouldAnimate: m = !0
|
|
1108
1108
|
}) {
|
|
1109
1109
|
var B, F, J, ie, we, _e, xe;
|
|
1110
|
-
let l = 0, p =
|
|
1111
|
-
if (
|
|
1110
|
+
let l = 0, p = V.value.get();
|
|
1111
|
+
if (v.current = !1, g.current = !1, t === "fixed") {
|
|
1112
1112
|
const M = a.current;
|
|
1113
1113
|
if (o === "prev" && (a.current = d ?? a.current - 1), o === "next" && (a.current = d ?? a.current + 1), i && C === "group" && T.current > 1 && o === "next") {
|
|
1114
1114
|
const x = e.length / T.current, j = Math.ceil(x) - 1 === a.current, W = Math.ceil(x) === a.current;
|
|
1115
|
-
j && (g.current = !0), l = -(a.current * y()), W && (a.current = 0, p =
|
|
1115
|
+
j && (g.current = !0), l = -(a.current * y()), W && (a.current = 0, p = V.value.get() + y() * x, l = 0, g.current = !1, v.current = !0);
|
|
1116
1116
|
}
|
|
1117
1117
|
if (i && C === "group" && T.current > 1 && o === "prev") {
|
|
1118
1118
|
const x = e.length / T.current, j = a.current === 0, W = a.current === -1;
|
|
1119
|
-
l = -(a.current * y()), j && (
|
|
1119
|
+
l = -(a.current * y()), j && (v.current = !0), W && (v.current = !1, g.current = !0, a.current = x - 1, p = V.value.get() - y() * x, l = -y() * x + y());
|
|
1120
1120
|
}
|
|
1121
1121
|
if (!i && C === "group" && T.current > 1) {
|
|
1122
1122
|
const x = e.length / T.current, j = 2 % x !== 0, W = Math.ceil(x - 1) === a.current, he = a.current === 0;
|
|
1123
|
-
l = -(a.current * y()), he && (
|
|
1123
|
+
l = -(a.current * y()), he && (v.current = !0), W && (g.current = !0, j && (l = -K()));
|
|
1124
1124
|
}
|
|
1125
1125
|
if (i && o === "next" && (C === "slide" || C === "group" && T.current === 1)) {
|
|
1126
1126
|
const x = ((B = e[a.current]) == null ? void 0 : B.id) === e[e.length - 1].id, j = N[e.length + a.current].id.includes(
|
|
1127
1127
|
"repeated-item"
|
|
1128
1128
|
);
|
|
1129
|
-
x && (g.current = !0), j && (a.current = 0, p =
|
|
1129
|
+
x && (g.current = !0), j && (a.current = 0, p = V.value.get() + y() * e.length, g.current = !1, v.current = !0), l = -(a.current * y());
|
|
1130
1130
|
}
|
|
1131
1131
|
if (i && o === "prev" && (C === "slide" || C === "group" && T.current === 1)) {
|
|
1132
1132
|
const x = N.findIndex(
|
|
1133
1133
|
(he) => he.id === e[M].id
|
|
1134
1134
|
), j = ((F = e[a.current]) == null ? void 0 : F.id) === e[0].id, W = N[x - 1].id.includes("repeated-item");
|
|
1135
|
-
j && (
|
|
1135
|
+
j && (v.current = !0), W && (v.current = !1, g.current = !0, a.current = e.length - 1, p = V.value.get() - y() * e.length), l = -(a.current * y());
|
|
1136
1136
|
}
|
|
1137
|
-
!i && C === "slide" && (((J = e[a.current + 1]) == null ? void 0 : J.id) === e[e.length - 1].id ? g.current = !0 : a.current === 0 ?
|
|
1137
|
+
!i && C === "slide" && (((J = e[a.current + 1]) == null ? void 0 : J.id) === e[e.length - 1].id ? g.current = !0 : a.current === 0 ? v.current = !0 : (v.current = !1, g.current = !1), l = -(a.current * y()), o === "next" && Math.abs(l) > K() && (g.current = !0, l = -K())), U({
|
|
1138
1138
|
eventName: "onSlideStartChange",
|
|
1139
1139
|
sliceActionType: f,
|
|
1140
1140
|
slideDirection: o,
|
|
1141
1141
|
nextItem: {
|
|
1142
1142
|
index: a.current,
|
|
1143
1143
|
id: e[a.current].id,
|
|
1144
|
-
startReached:
|
|
1144
|
+
startReached: v.current,
|
|
1145
1145
|
endReached: g.current
|
|
1146
1146
|
}
|
|
1147
1147
|
});
|
|
@@ -1151,20 +1151,20 @@ function qt({
|
|
|
1151
1151
|
const M = ((ie = e[a.current]) == null ? void 0 : ie.id) === e[e.length - 1].id, x = N[e.length + a.current].id.includes(
|
|
1152
1152
|
"repeated-item"
|
|
1153
1153
|
);
|
|
1154
|
-
M && (g.current = !0), x && (a.current = 0, p =
|
|
1154
|
+
M && (g.current = !0), x && (a.current = 0, p = V.value.get() + y() * e.length, l = 0, g.current = !1, v.current = !0);
|
|
1155
1155
|
}
|
|
1156
|
-
if (o === "next" && !i && (Math.abs(l) > K() ? (g.current = !0, l = -K()) : (
|
|
1156
|
+
if (o === "next" && !i && (Math.abs(l) > K() ? (g.current = !0, l = -K()) : (v.current = !1, g.current = !1)), o === "prev" && !i && ((we = e[a.current]) == null ? void 0 : we.id) === e[0].id && (v.current = !0), o === "prev" && i) {
|
|
1157
1157
|
const M = ((_e = e[a.current]) == null ? void 0 : _e.id) === e[0].id, x = (xe = N[e.length + a.current]) == null ? void 0 : xe.id.includes(
|
|
1158
1158
|
"repeated-item"
|
|
1159
1159
|
);
|
|
1160
|
-
M && (
|
|
1160
|
+
M && (v.current = !0), x && (a.current = e.length - 1, p = V.value.get() - y() * e.length, l = -(y() * e.length - y()), v.current = !1, g.current = !0);
|
|
1161
1161
|
}
|
|
1162
1162
|
U({
|
|
1163
1163
|
eventName: "onSlideStartChange",
|
|
1164
1164
|
sliceActionType: f,
|
|
1165
1165
|
slideDirection: o,
|
|
1166
1166
|
nextItem: {
|
|
1167
|
-
startReached:
|
|
1167
|
+
startReached: v.current,
|
|
1168
1168
|
endReached: g.current,
|
|
1169
1169
|
index: 0,
|
|
1170
1170
|
id: ""
|
|
@@ -1173,14 +1173,14 @@ function qt({
|
|
|
1173
1173
|
}
|
|
1174
1174
|
if (t === "freeScroll") {
|
|
1175
1175
|
const M = w.current[s === "x" ? "scrollLeft" : "scrollTop"], x = s === "x" ? w.current.scrollWidth - w.current.clientWidth : w.current.scrollHeight - w.current.clientHeight;
|
|
1176
|
-
p = M, o === "prev" && (l = p - y(), l < 0 && (l = 0), p - y() <= 0 && (
|
|
1176
|
+
p = M, o === "prev" && (l = p - y(), l < 0 && (l = 0), p - y() <= 0 && (v.current = !0), U({
|
|
1177
1177
|
eventName: "onSlideStartChange",
|
|
1178
1178
|
sliceActionType: f,
|
|
1179
1179
|
slideDirection: o,
|
|
1180
1180
|
nextItem: {
|
|
1181
1181
|
index: 0,
|
|
1182
1182
|
id: "",
|
|
1183
|
-
startReached:
|
|
1183
|
+
startReached: v.current,
|
|
1184
1184
|
endReached: !1
|
|
1185
1185
|
}
|
|
1186
1186
|
})), o === "next" && (l = p + y(), l > x && (l = x), p + y() >= x && (g.current = !0), U({
|
|
@@ -1195,13 +1195,13 @@ function qt({
|
|
|
1195
1195
|
}
|
|
1196
1196
|
}));
|
|
1197
1197
|
}
|
|
1198
|
-
const P = z(p),
|
|
1199
|
-
te.current =
|
|
1198
|
+
const P = z(p), $ = z(l);
|
|
1199
|
+
te.current = $, re.start({
|
|
1200
1200
|
from: {
|
|
1201
1201
|
value: P
|
|
1202
1202
|
},
|
|
1203
1203
|
to: {
|
|
1204
|
-
value:
|
|
1204
|
+
value: $
|
|
1205
1205
|
},
|
|
1206
1206
|
immediate: !m,
|
|
1207
1207
|
onRest({ finished: M }) {
|
|
@@ -1212,7 +1212,7 @@ function qt({
|
|
|
1212
1212
|
currentItem: {
|
|
1213
1213
|
index: a.current,
|
|
1214
1214
|
id: e[a.current].id,
|
|
1215
|
-
startReached:
|
|
1215
|
+
startReached: v.current,
|
|
1216
1216
|
endReached: g.current
|
|
1217
1217
|
}
|
|
1218
1218
|
}), M && t === "fluid" && U({
|
|
@@ -1222,7 +1222,7 @@ function qt({
|
|
|
1222
1222
|
currentItem: {
|
|
1223
1223
|
index: 0,
|
|
1224
1224
|
id: "",
|
|
1225
|
-
startReached:
|
|
1225
|
+
startReached: v.current,
|
|
1226
1226
|
endReached: g.current
|
|
1227
1227
|
}
|
|
1228
1228
|
});
|
|
@@ -1254,7 +1254,7 @@ function qt({
|
|
|
1254
1254
|
q("Carousel not initialized yet: slideToPrevItem");
|
|
1255
1255
|
return;
|
|
1256
1256
|
}
|
|
1257
|
-
if (o === "drag" || t === "fixed" && i || t === "fixed" && !i && !
|
|
1257
|
+
if (o === "drag" || t === "fixed" && i || t === "fixed" && !i && !v.current) {
|
|
1258
1258
|
const m = f ?? a.current - 1;
|
|
1259
1259
|
ne({
|
|
1260
1260
|
type: "prev",
|
|
@@ -1263,7 +1263,7 @@ function qt({
|
|
|
1263
1263
|
shouldAnimate: d
|
|
1264
1264
|
});
|
|
1265
1265
|
}
|
|
1266
|
-
(t === "fluid" && i || t === "fluid" && !i && !
|
|
1266
|
+
(t === "fluid" && i || t === "fluid" && !i && !v.current || t === "freeScroll" && !v.current) && ne({
|
|
1267
1267
|
type: "prev",
|
|
1268
1268
|
actionType: o,
|
|
1269
1269
|
shouldAnimate: d
|
|
@@ -1287,9 +1287,9 @@ function qt({
|
|
|
1287
1287
|
}
|
|
1288
1288
|
const l = m.children[f];
|
|
1289
1289
|
if (l) {
|
|
1290
|
-
const p = m[s === "x" ? "scrollWidth" : "scrollHeight"] - m.getBoundingClientRect()[s === "x" ? "width" : "height"],
|
|
1290
|
+
const p = m[s === "x" ? "scrollWidth" : "scrollHeight"] - m.getBoundingClientRect()[s === "x" ? "width" : "height"], $ = l.offsetLeft + l.offsetWidth / 2 - m.clientWidth / 2, B = Ft(l);
|
|
1291
1291
|
if (B.isOut) {
|
|
1292
|
-
const F = B.direction === "start" ?
|
|
1292
|
+
const F = B.direction === "start" ? $ < 0 ? 0 : $ : $ > p ? p : $, J = m[s === "x" ? "scrollLeft" : "scrollTop"];
|
|
1293
1293
|
new Xe({
|
|
1294
1294
|
from: {
|
|
1295
1295
|
value: J
|
|
@@ -1344,7 +1344,7 @@ function qt({
|
|
|
1344
1344
|
bottom: 0
|
|
1345
1345
|
})
|
|
1346
1346
|
},
|
|
1347
|
-
from: () => [
|
|
1347
|
+
from: () => [V.value.get(), V.value.get()]
|
|
1348
1348
|
}
|
|
1349
1349
|
);
|
|
1350
1350
|
return ve(() => {
|
|
@@ -1368,23 +1368,23 @@ function qt({
|
|
|
1368
1368
|
function m() {
|
|
1369
1369
|
const p = w.current.children[0];
|
|
1370
1370
|
let P = 0;
|
|
1371
|
-
const
|
|
1372
|
-
|
|
1371
|
+
const $ = t === "fixed" && C === "group" && T.current > 1;
|
|
1372
|
+
$ ? P = z(
|
|
1373
1373
|
w.current.getBoundingClientRect()[s === "x" ? "width" : "height"]
|
|
1374
1374
|
) : P = z(
|
|
1375
1375
|
p.getBoundingClientRect()[s === "x" ? "width" : "height"]
|
|
1376
1376
|
);
|
|
1377
1377
|
const { totalGutterCssVar: B, totalStartEndGutterCssVar: F } = ue();
|
|
1378
|
-
return P += B,
|
|
1378
|
+
return P += B, $ && (P -= F), Y.current = P, P;
|
|
1379
1379
|
}
|
|
1380
1380
|
function l() {
|
|
1381
|
-
|
|
1381
|
+
L.current = [];
|
|
1382
1382
|
const { itemsPerSlide: p } = ue();
|
|
1383
1383
|
if (console.log({ _itemsPerSlide: p }), T.current = p, N.length === 0 && Re(
|
|
1384
1384
|
"Init is true but no items are available; carousel will not be initialized"
|
|
1385
|
-
), t === "fixed" && C === "group" && e.length % T.current !== 0 &&
|
|
1385
|
+
), t === "fixed" && C === "group" && e.length % T.current !== 0 && L.current.push("When using scrollAmountType='group' and itemsPerSlide={number>1} make sure that itemsPerSlides is divisible by the total quantity of items otherwise the carousel won't initialize."), t === "fluid" && _ !== void 0 && L.current.push(
|
|
1386
1386
|
'scrollAmountType="group" is not available for slideType="fluid"; please change one of them.'
|
|
1387
|
-
),
|
|
1387
|
+
), L.current.length > 0) {
|
|
1388
1388
|
q();
|
|
1389
1389
|
return;
|
|
1390
1390
|
}
|
|
@@ -1417,46 +1417,46 @@ function qt({
|
|
|
1417
1417
|
/* @__PURE__ */ se(
|
|
1418
1418
|
"style",
|
|
1419
1419
|
{
|
|
1420
|
-
id: `carousel-container-${
|
|
1420
|
+
id: `carousel-container-${b}`,
|
|
1421
1421
|
dangerouslySetInnerHTML: {
|
|
1422
1422
|
__html: Wt(`
|
|
1423
1423
|
:root {
|
|
1424
|
-
--${
|
|
1425
|
-
--${
|
|
1426
|
-
--${
|
|
1424
|
+
--${b}-react-spring-carousel-item-gutter: 0px;
|
|
1425
|
+
--${b}-react-spring-carousel-start-end-gutter: 0px;
|
|
1426
|
+
--${b}-react-spring-carousel-items-per-slide: 1;
|
|
1427
1427
|
}
|
|
1428
|
-
.carousel-${
|
|
1428
|
+
.carousel-${b} {
|
|
1429
1429
|
display: flex;
|
|
1430
1430
|
overflow: hidden;
|
|
1431
1431
|
width: 100%;
|
|
1432
|
-
height:
|
|
1433
|
-
padding: ${s === "x" ? `0px var(--${
|
|
1432
|
+
height: 100%;
|
|
1433
|
+
padding: ${s === "x" ? `0px var(--${b}-react-spring-carousel-start-end-gutter)` : `var(--${b}-react-spring-carousel-start-end-gutter) 0px`};
|
|
1434
1434
|
}
|
|
1435
|
-
.carousel-${
|
|
1435
|
+
.carousel-${b} .use-spring-carousel-track {
|
|
1436
1436
|
display: flex;
|
|
1437
1437
|
width: 100%;
|
|
1438
1438
|
position: relative;
|
|
1439
1439
|
flex-direction: ${s === "x" ? "row" : "column"};
|
|
1440
|
-
gap: var(--${
|
|
1440
|
+
gap: var(--${b}-react-spring-carousel-item-gutter);
|
|
1441
1441
|
touch-action: ${c ? s === "x" ? "pan-y" : "pan-x" : "auto"};
|
|
1442
1442
|
overflow-x: ${t === "freeScroll" && s === "x" ? "auto" : "initial"};
|
|
1443
1443
|
overflow-y: ${t === "freeScroll" && s === "y" ? "auto" : "initial"};
|
|
1444
1444
|
}
|
|
1445
|
-
.carousel-${
|
|
1445
|
+
.carousel-${b} .use-spring-carousel-track::after {
|
|
1446
1446
|
content: "";
|
|
1447
1447
|
visibility: hidden;
|
|
1448
1448
|
display: block;
|
|
1449
|
-
width: var(--${
|
|
1449
|
+
width: var(--${b}-react-spring-carousel-start-end-gutter);
|
|
1450
1450
|
flex-shrink: 0;
|
|
1451
1451
|
}
|
|
1452
|
-
.carousel-${
|
|
1452
|
+
.carousel-${b} .use-spring-carousel-item {
|
|
1453
1453
|
position: relative;
|
|
1454
1454
|
display: flex;
|
|
1455
1455
|
width: 100%;
|
|
1456
1456
|
height: 100%;
|
|
1457
|
-
${t === "fixed" ? `flex: 0 0 calc(100% / var(--${
|
|
1457
|
+
${t === "fixed" ? `flex: 0 0 calc(100% / var(--${b}-react-spring-carousel-items-per-slide) - calc(var(--${b}-react-spring-carousel-item-gutter) * (var(--${b}-react-spring-carousel-items-per-slide) - 1) / var(--${b}-react-spring-carousel-items-per-slide)));` : ""}
|
|
1458
1458
|
}
|
|
1459
|
-
${E ? `.carousel-${
|
|
1459
|
+
${E ? `.carousel-${b} .use-spring-carousel-item {
|
|
1460
1460
|
position: absolute;
|
|
1461
1461
|
top: 0;
|
|
1462
1462
|
left: 0;
|
|
@@ -1464,7 +1464,7 @@ function qt({
|
|
|
1464
1464
|
height: 100%;
|
|
1465
1465
|
opacity: 0;
|
|
1466
1466
|
}
|
|
1467
|
-
.carousel-${
|
|
1467
|
+
.carousel-${b} .use-spring-carousel-item:first-child {
|
|
1468
1468
|
opacity: 1;
|
|
1469
1469
|
}`.trim() : ""}`)
|
|
1470
1470
|
}
|
|
@@ -1473,7 +1473,7 @@ function qt({
|
|
|
1473
1473
|
/* @__PURE__ */ se(
|
|
1474
1474
|
"div",
|
|
1475
1475
|
{
|
|
1476
|
-
className: `use-spring-carousel-container carousel-${
|
|
1476
|
+
className: `use-spring-carousel-container carousel-${b}`,
|
|
1477
1477
|
ref: ee,
|
|
1478
1478
|
"data-carousel-direction": s,
|
|
1479
1479
|
children: /* @__PURE__ */ se(
|
|
@@ -1508,7 +1508,7 @@ function qt({
|
|
|
1508
1508
|
de(o, f);
|
|
1509
1509
|
},
|
|
1510
1510
|
handleThumbsContainerScroll: Fe,
|
|
1511
|
-
carouselId:
|
|
1511
|
+
carouselId: b
|
|
1512
1512
|
};
|
|
1513
1513
|
}
|
|
1514
1514
|
export {
|
package/dist/index.umd.js
CHANGED
|
@@ -1,41 +1,41 @@
|
|
|
1
|
-
(function(B,$){typeof exports=="object"&&typeof module<"u"?$(exports,require("react/jsx-runtime"),require("@react-spring/web"),require("react")):typeof define=="function"&&define.amd?define(["exports","react/jsx-runtime","@react-spring/web","react"],$):(B=typeof globalThis<"u"?globalThis:B||self,$(B["react-spring-carousel"]={},B["react/jsx-runtime"],B["@react-spring/web"],B.React))})(this,function(B,$,ye,E){"use strict";function Ue(r,e,t){return Math.max(e,Math.min(r,t))}const k={toVector(r,e){return r===void 0&&(r=e),Array.isArray(r)?r:[r,r]},add(r,e){return[r[0]+e[0],r[1]+e[1]]},sub(r,e){return[r[0]-e[0],r[1]-e[1]]},addTo(r,e){r[0]+=e[0],r[1]+=e[1]},subTo(r,e){r[0]-=e[0],r[1]-=e[1]}};function we(r,e,t){return e===0||Math.abs(e)===1/0?Math.pow(r,t*5):r*e*t/(e+t*r)}function xe(r,e,t,n=.15){return n===0?Ue(r,e,t):r<e?-we(e-r,t-e,n)+e:r>t?+we(r-t,t-e,n)+t:r}function Ke(r,[e,t],[n,i]){const[[c,s],[h,_]]=r;return[xe(e,c,s,n),xe(t,h,_,i)]}function Fe(r,e){if(typeof r!="object"||r===null)return r;var t=r[Symbol.toPrimitive];if(t!==void 0){var n=t.call(r,e||"default");if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(r)}function We(r){var e=Fe(r,"string");return typeof e=="symbol"?e:String(e)}function P(r,e,t){return e=We(e),e in r?Object.defineProperty(r,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):r[e]=t,r}function _e(r,e){var t=Object.keys(r);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(r);e&&(n=n.filter(function(i){return Object.getOwnPropertyDescriptor(r,i).enumerable})),t.push.apply(t,n)}return t}function x(r){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?_e(Object(t),!0).forEach(function(n){P(r,n,t[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(r,Object.getOwnPropertyDescriptors(t)):_e(Object(t)).forEach(function(n){Object.defineProperty(r,n,Object.getOwnPropertyDescriptor(t,n))})}return r}const Ie={pointer:{start:"down",change:"move",end:"up"},mouse:{start:"down",change:"move",end:"up"},touch:{start:"start",change:"move",end:"end"},gesture:{start:"start",change:"change",end:"end"}};function Ee(r){return r?r[0].toUpperCase()+r.slice(1):""}const ze=["enter","leave"];function He(r=!1,e){return r&&!ze.includes(e)}function Ye(r,e="",t=!1){const n=Ie[r],i=n&&n[e]||e;return"on"+Ee(r)+Ee(i)+(He(t,i)?"Capture":"")}const Xe=["gotpointercapture","lostpointercapture"];function qe(r){let e=r.substring(2).toLowerCase();const t=!!~e.indexOf("passive");t&&(e=e.replace("passive",""));const n=Xe.includes(e)?"capturecapture":"capture",i=!!~e.indexOf(n);return i&&(e=e.replace("capture","")),{device:e,capture:i,passive:t}}function Je(r,e=""){const t=Ie[r],n=t&&t[e]||e;return r+n}function re(r){return"touches"in r}function Se(r){return re(r)?"touch":"pointerType"in r?r.pointerType:"mouse"}function Qe(r){return Array.from(r.touches).filter(e=>{var t,n;return e.target===r.currentTarget||((t=r.currentTarget)===null||t===void 0||(n=t.contains)===null||n===void 0?void 0:n.call(t,e.target))})}function Ze(r){return r.type==="touchend"||r.type==="touchcancel"?r.changedTouches:r.targetTouches}function Te(r){return re(r)?Ze(r)[0]:r}function et(r){return Qe(r).map(e=>e.identifier)}function le(r){const e=Te(r);return re(r)?e.identifier:e.pointerId}function De(r){const e=Te(r);return[e.clientX,e.clientY]}function tt(r){const e={};if("buttons"in r&&(e.buttons=r.buttons),"shiftKey"in r){const{shiftKey:t,altKey:n,metaKey:i,ctrlKey:c}=r;Object.assign(e,{shiftKey:t,altKey:n,metaKey:i,ctrlKey:c})}return e}function ne(r,...e){return typeof r=="function"?r(...e):r}function rt(){}function nt(...r){return r.length===0?rt:r.length===1?r[0]:function(){let e;for(const t of r)e=t.apply(this,arguments)||e;return e}}function Ce(r,e){return Object.assign({},e,r||{})}const it=32;class st{constructor(e,t,n){this.ctrl=e,this.args=t,this.key=n,this.state||(this.state={},this.computeValues([0,0]),this.computeInitial(),this.init&&this.init(),this.reset())}get state(){return this.ctrl.state[this.key]}set state(e){this.ctrl.state[this.key]=e}get shared(){return this.ctrl.state.shared}get eventStore(){return this.ctrl.gestureEventStores[this.key]}get timeoutStore(){return this.ctrl.gestureTimeoutStores[this.key]}get config(){return this.ctrl.config[this.key]}get sharedConfig(){return this.ctrl.config.shared}get handler(){return this.ctrl.handlers[this.key]}reset(){const{state:e,shared:t,ingKey:n,args:i}=this;t[n]=e._active=e.active=e._blocked=e._force=!1,e._step=[!1,!1],e.intentional=!1,e._movement=[0,0],e._distance=[0,0],e._direction=[0,0],e._delta=[0,0],e._bounds=[[-1/0,1/0],[-1/0,1/0]],e.args=i,e.axis=void 0,e.memo=void 0,e.elapsedTime=e.timeDelta=0,e.direction=[0,0],e.distance=[0,0],e.overflow=[0,0],e._movementBound=[!1,!1],e.velocity=[0,0],e.movement=[0,0],e.delta=[0,0],e.timeStamp=0}start(e){const t=this.state,n=this.config;t._active||(this.reset(),this.computeInitial(),t._active=!0,t.target=e.target,t.currentTarget=e.currentTarget,t.lastOffset=n.from?ne(n.from,t):t.offset,t.offset=t.lastOffset,t.startTime=t.timeStamp=e.timeStamp)}computeValues(e){const t=this.state;t._values=e,t.values=this.config.transform(e)}computeInitial(){const e=this.state;e._initial=e._values,e.initial=e.values}compute(e){const{state:t,config:n,shared:i}=this;t.args=this.args;let c=0;if(e&&(t.event=e,n.preventDefault&&e.cancelable&&t.event.preventDefault(),t.type=e.type,i.touches=this.ctrl.pointerIds.size||this.ctrl.touchIds.size,i.locked=!!document.pointerLockElement,Object.assign(i,tt(e)),i.down=i.pressed=i.buttons%2===1||i.touches>0,c=e.timeStamp-t.timeStamp,t.timeStamp=e.timeStamp,t.elapsedTime=t.timeStamp-t.startTime),t._active){const w=t._delta.map(Math.abs);k.addTo(t._distance,w)}this.axisIntent&&this.axisIntent(e);const[s,h]=t._movement,[_,S]=n.threshold,{_step:u,values:C}=t;if(n.hasCustomTransform?(u[0]===!1&&(u[0]=Math.abs(s)>=_&&C[0]),u[1]===!1&&(u[1]=Math.abs(h)>=S&&C[1])):(u[0]===!1&&(u[0]=Math.abs(s)>=_&&Math.sign(s)*_),u[1]===!1&&(u[1]=Math.abs(h)>=S&&Math.sign(h)*S)),t.intentional=u[0]!==!1||u[1]!==!1,!t.intentional)return;const T=[0,0];if(n.hasCustomTransform){const[w,oe]=C;T[0]=u[0]!==!1?w-u[0]:0,T[1]=u[1]!==!1?oe-u[1]:0}else T[0]=u[0]!==!1?s-u[0]:0,T[1]=u[1]!==!1?h-u[1]:0;this.restrictToAxis&&!t._blocked&&this.restrictToAxis(T);const V=t.offset,F=t._active&&!t._blocked||t.active;F&&(t.first=t._active&&!t.active,t.last=!t._active&&t.active,t.active=i[this.ingKey]=t._active,e&&(t.first&&("bounds"in n&&(t._bounds=ne(n.bounds,t)),this.setup&&this.setup()),t.movement=T,this.computeOffset()));const[D,O]=t.offset,[[L,Q],[Z,v]]=t._bounds;t.overflow=[D<L?-1:D>Q?1:0,O<Z?-1:O>v?1:0],t._movementBound[0]=t.overflow[0]?t._movementBound[0]===!1?t._movement[0]:t._movementBound[0]:!1,t._movementBound[1]=t.overflow[1]?t._movementBound[1]===!1?t._movement[1]:t._movementBound[1]:!1;const se=t._active?n.rubberband||[0,0]:[0,0];if(t.offset=Ke(t._bounds,t.offset,se),t.delta=k.sub(t.offset,V),this.computeMovement(),F&&(!t.last||c>it)){t.delta=k.sub(t.offset,V);const w=t.delta.map(Math.abs);k.addTo(t.distance,w),t.direction=t.delta.map(Math.sign),t._direction=t._delta.map(Math.sign),!t.first&&c>0&&(t.velocity=[w[0]/c,w[1]/c],t.timeDelta=c)}}emit(){const e=this.state,t=this.shared,n=this.config;if(e._active||this.clean(),(e._blocked||!e.intentional)&&!e._force&&!n.triggerAllEvents)return;const i=this.handler(x(x(x({},t),e),{},{[this.aliasKey]:e.values}));i!==void 0&&(e.memo=i)}clean(){this.eventStore.clean(),this.timeoutStore.clean()}}function ot([r,e],t){const n=Math.abs(r),i=Math.abs(e);if(n>i&&n>t)return"x";if(i>n&&i>t)return"y"}class ct extends st{constructor(...e){super(...e),P(this,"aliasKey","xy")}reset(){super.reset(),this.state.axis=void 0}init(){this.state.offset=[0,0],this.state.lastOffset=[0,0]}computeOffset(){this.state.offset=k.add(this.state.lastOffset,this.state.movement)}computeMovement(){this.state.movement=k.sub(this.state.offset,this.state.lastOffset)}axisIntent(e){const t=this.state,n=this.config;if(!t.axis&&e){const i=typeof n.axisThreshold=="object"?n.axisThreshold[Se(e)]:n.axisThreshold;t.axis=ot(t._movement,i)}t._blocked=(n.lockDirection||!!n.axis)&&!t.axis||!!n.axis&&n.axis!==t.axis}restrictToAxis(e){if(this.config.axis||this.config.lockDirection)switch(this.state.axis){case"x":e[1]=0;break;case"y":e[0]=0;break}}}const ke=r=>r,Oe=.15,fe={enabled(r=!0){return r},eventOptions(r,e,t){return x(x({},t.shared.eventOptions),r)},preventDefault(r=!1){return r},triggerAllEvents(r=!1){return r},rubberband(r=0){switch(r){case!0:return[Oe,Oe];case!1:return[0,0];default:return k.toVector(r)}},from(r){if(typeof r=="function")return r;if(r!=null)return k.toVector(r)},transform(r,e,t){const n=r||t.shared.transform;if(this.hasCustomTransform=!!n,process.env.NODE_ENV==="development"){const i=n||ke;return c=>{const s=i(c);return(!isFinite(s[0])||!isFinite(s[1]))&&console.warn(`[@use-gesture]: config.transform() must produce a valid result, but it was: [${s[0]},${[1]}]`),s}}return n||ke},threshold(r){return k.toVector(r,0)}};process.env.NODE_ENV==="development"&&Object.assign(fe,{domTarget(r){if(r!==void 0)throw Error("[@use-gesture]: `domTarget` option has been renamed to `target`.");return NaN},lockDirection(r){if(r!==void 0)throw Error("[@use-gesture]: `lockDirection` option has been merged with `axis`. Use it as in `{ axis: 'lock' }`");return NaN},initial(r){if(r!==void 0)throw Error("[@use-gesture]: `initial` option has been renamed to `from`.");return NaN}});const at=0,q=x(x({},fe),{},{axis(r,e,{axis:t}){if(this.lockDirection=t==="lock",!this.lockDirection)return t},axisThreshold(r=at){return r},bounds(r={}){if(typeof r=="function")return c=>q.bounds(r(c));if("current"in r)return()=>r.current;if(typeof HTMLElement=="function"&&r instanceof HTMLElement)return r;const{left:e=-1/0,right:t=1/0,top:n=-1/0,bottom:i=1/0}=r;return[[e,t],[n,i]]}}),Pe={ArrowRight:(r,e=1)=>[r*e,0],ArrowLeft:(r,e=1)=>[-1*r*e,0],ArrowUp:(r,e=1)=>[0,-1*r*e],ArrowDown:(r,e=1)=>[0,r*e]};class ut extends ct{constructor(...e){super(...e),P(this,"ingKey","dragging")}reset(){super.reset();const e=this.state;e._pointerId=void 0,e._pointerActive=!1,e._keyboardActive=!1,e._preventScroll=!1,e._delayed=!1,e.swipe=[0,0],e.tap=!1,e.canceled=!1,e.cancel=this.cancel.bind(this)}setup(){const e=this.state;if(e._bounds instanceof HTMLElement){const t=e._bounds.getBoundingClientRect(),n=e.currentTarget.getBoundingClientRect(),i={left:t.left-n.left+e.offset[0],right:t.right-n.right+e.offset[0],top:t.top-n.top+e.offset[1],bottom:t.bottom-n.bottom+e.offset[1]};e._bounds=q.bounds(i)}}cancel(){const e=this.state;e.canceled||(e.canceled=!0,e._active=!1,setTimeout(()=>{this.compute(),this.emit()},0))}setActive(){this.state._active=this.state._pointerActive||this.state._keyboardActive}clean(){this.pointerClean(),this.state._pointerActive=!1,this.state._keyboardActive=!1,super.clean()}pointerDown(e){const t=this.config,n=this.state;if(e.buttons!=null&&(Array.isArray(t.pointerButtons)?!t.pointerButtons.includes(e.buttons):t.pointerButtons!==-1&&t.pointerButtons!==e.buttons))return;const i=this.ctrl.setEventIds(e);t.pointerCapture&&e.target.setPointerCapture(e.pointerId),!(i&&i.size>1&&n._pointerActive)&&(this.start(e),this.setupPointer(e),n._pointerId=le(e),n._pointerActive=!0,this.computeValues(De(e)),this.computeInitial(),t.preventScrollAxis&&Se(e)!=="mouse"?(n._active=!1,this.setupScrollPrevention(e)):t.delay>0?(this.setupDelayTrigger(e),t.triggerAllEvents&&(this.compute(e),this.emit())):this.startPointerDrag(e))}startPointerDrag(e){const t=this.state;t._active=!0,t._preventScroll=!0,t._delayed=!1,this.compute(e),this.emit()}pointerMove(e){const t=this.state,n=this.config;if(!t._pointerActive)return;const i=le(e);if(t._pointerId!==void 0&&i!==t._pointerId)return;const c=De(e);if(document.pointerLockElement===e.target?t._delta=[e.movementX,e.movementY]:(t._delta=k.sub(c,t._values),this.computeValues(c)),k.addTo(t._movement,t._delta),this.compute(e),t._delayed&&t.intentional){this.timeoutStore.remove("dragDelay"),t.active=!1,this.startPointerDrag(e);return}if(n.preventScrollAxis&&!t._preventScroll)if(t.axis)if(t.axis===n.preventScrollAxis||n.preventScrollAxis==="xy"){t._active=!1,this.clean();return}else{this.timeoutStore.remove("startPointerDrag"),this.startPointerDrag(e);return}else return;this.emit()}pointerUp(e){this.ctrl.setEventIds(e);try{this.config.pointerCapture&&e.target.hasPointerCapture(e.pointerId)&&e.target.releasePointerCapture(e.pointerId)}catch{process.env.NODE_ENV==="development"&&console.warn("[@use-gesture]: If you see this message, it's likely that you're using an outdated version of `@react-three/fiber`. \n\nPlease upgrade to the latest version.")}const t=this.state,n=this.config;if(!t._active||!t._pointerActive)return;const i=le(e);if(t._pointerId!==void 0&&i!==t._pointerId)return;this.state._pointerActive=!1,this.setActive(),this.compute(e);const[c,s]=t._distance;if(t.tap=c<=n.tapsThreshold&&s<=n.tapsThreshold,t.tap&&n.filterTaps)t._force=!0;else{const[h,_]=t._delta,[S,u]=t._movement,[C,T]=n.swipe.velocity,[V,F]=n.swipe.distance,D=n.swipe.duration;if(t.elapsedTime<D){const O=Math.abs(h/t.timeDelta),L=Math.abs(_/t.timeDelta);O>C&&Math.abs(S)>V&&(t.swipe[0]=Math.sign(h)),L>T&&Math.abs(u)>F&&(t.swipe[1]=Math.sign(_))}}this.emit()}pointerClick(e){!this.state.tap&&e.detail>0&&(e.preventDefault(),e.stopPropagation())}setupPointer(e){const t=this.config,n=t.device;if(process.env.NODE_ENV==="development")try{if(n==="pointer"&&t.preventScrollDelay===void 0){const i="uv"in e?e.sourceEvent.currentTarget:e.currentTarget;window.getComputedStyle(i).touchAction==="auto"&&console.warn("[@use-gesture]: The drag target has its `touch-action` style property set to `auto`. It is recommended to add `touch-action: 'none'` so that the drag gesture behaves correctly on touch-enabled devices. For more information read this: https://use-gesture.netlify.app/docs/extras/#touch-action.\n\nThis message will only show in development mode. It won't appear in production. If this is intended, you can ignore it.",i)}}catch{}t.pointerLock&&e.currentTarget.requestPointerLock(),t.pointerCapture||(this.eventStore.add(this.sharedConfig.window,n,"change",this.pointerMove.bind(this)),this.eventStore.add(this.sharedConfig.window,n,"end",this.pointerUp.bind(this)),this.eventStore.add(this.sharedConfig.window,n,"cancel",this.pointerUp.bind(this)))}pointerClean(){this.config.pointerLock&&document.pointerLockElement===this.state.currentTarget&&document.exitPointerLock()}preventScroll(e){this.state._preventScroll&&e.cancelable&&e.preventDefault()}setupScrollPrevention(e){this.state._preventScroll=!1,lt(e);const t=this.eventStore.add(this.sharedConfig.window,"touch","change",this.preventScroll.bind(this),{passive:!1});this.eventStore.add(this.sharedConfig.window,"touch","end",t),this.eventStore.add(this.sharedConfig.window,"touch","cancel",t),this.timeoutStore.add("startPointerDrag",this.startPointerDrag.bind(this),this.config.preventScrollDelay,e)}setupDelayTrigger(e){this.state._delayed=!0,this.timeoutStore.add("dragDelay",()=>{this.state._step=[0,0],this.startPointerDrag(e)},this.config.delay)}keyDown(e){const t=Pe[e.key];if(t){const n=this.state,i=e.shiftKey?10:e.altKey?.1:1;this.start(e),n._delta=t(this.config.keyboardDisplacement,i),n._keyboardActive=!0,k.addTo(n._movement,n._delta),this.compute(e),this.emit()}}keyUp(e){e.key in Pe&&(this.state._keyboardActive=!1,this.setActive(),this.compute(e),this.emit())}bind(e){const t=this.config.device;e(t,"start",this.pointerDown.bind(this)),this.config.pointerCapture&&(e(t,"change",this.pointerMove.bind(this)),e(t,"end",this.pointerUp.bind(this)),e(t,"cancel",this.pointerUp.bind(this)),e("lostPointerCapture","",this.pointerUp.bind(this))),this.config.keys&&(e("key","down",this.keyDown.bind(this)),e("key","up",this.keyUp.bind(this))),this.config.filterTaps&&e("click","",this.pointerClick.bind(this),{capture:!0,passive:!1})}}function lt(r){"persist"in r&&typeof r.persist=="function"&&r.persist()}const J=typeof window<"u"&&window.document&&window.document.createElement;function Ne(){return J&&"ontouchstart"in window}function ft(){return Ne()||J&&window.navigator.maxTouchPoints>1}function dt(){return J&&"onpointerdown"in window}function ht(){return J&&"exitPointerLock"in window.document}function pt(){try{return"constructor"in GestureEvent}catch{return!1}}const M={isBrowser:J,gesture:pt(),touch:Ne(),touchscreen:ft(),pointer:dt(),pointerLock:ht()},gt=250,mt=180,vt=.5,bt=50,yt=250,wt=10,Me={mouse:0,touch:0,pen:8},Le=x(x({},q),{},{device(r,e,{pointer:{touch:t=!1,lock:n=!1,mouse:i=!1}={}}){return this.pointerLock=n&&M.pointerLock,M.touch&&t?"touch":this.pointerLock?"mouse":M.pointer&&!i?"pointer":M.touch?"touch":"mouse"},preventScrollAxis(r,e,{preventScroll:t}){if(this.preventScrollDelay=typeof t=="number"?t:t||t===void 0&&r?gt:void 0,!(!M.touchscreen||t===!1))return r||(t!==void 0?"y":void 0)},pointerCapture(r,e,{pointer:{capture:t=!0,buttons:n=1,keys:i=!0}={}}){return this.pointerButtons=n,this.keys=i,!this.pointerLock&&this.device==="pointer"&&t},threshold(r,e,{filterTaps:t=!1,tapsThreshold:n=3,axis:i=void 0}){const c=k.toVector(r,t?n:i?1:0);return this.filterTaps=t,this.tapsThreshold=n,c},swipe({velocity:r=vt,distance:e=bt,duration:t=yt}={}){return{velocity:this.transform(k.toVector(r)),distance:this.transform(k.toVector(e)),duration:t}},delay(r=0){switch(r){case!0:return mt;case!1:return 0;default:return r}},axisThreshold(r){return r?x(x({},Me),r):Me},keyboardDisplacement(r=wt){return r}});process.env.NODE_ENV==="development"&&Object.assign(Le,{useTouch(r){if(r!==void 0)throw Error("[@use-gesture]: `useTouch` option has been renamed to `pointer.touch`. Use it as in `{ pointer: { touch: true } }`.");return NaN},experimental_preventWindowScrollY(r){if(r!==void 0)throw Error("[@use-gesture]: `experimental_preventWindowScrollY` option has been renamed to `preventScroll`.");return NaN},swipeVelocity(r){if(r!==void 0)throw Error("[@use-gesture]: `swipeVelocity` option has been renamed to `swipe.velocity`. Use it as in `{ swipe: { velocity: 0.5 } }`.");return NaN},swipeDistance(r){if(r!==void 0)throw Error("[@use-gesture]: `swipeDistance` option has been renamed to `swipe.distance`. Use it as in `{ swipe: { distance: 50 } }`.");return NaN},swipeDuration(r){if(r!==void 0)throw Error("[@use-gesture]: `swipeDuration` option has been renamed to `swipe.duration`. Use it as in `{ swipe: { duration: 250 } }`.");return NaN}}),x(x({},fe),{},{device(r,e,{shared:t,pointer:{touch:n=!1}={}}){if(t.target&&!M.touch&&M.gesture)return"gesture";if(M.touch&&n)return"touch";if(M.touchscreen){if(M.pointer)return"pointer";if(M.touch)return"touch"}},bounds(r,e,{scaleBounds:t={},angleBounds:n={}}){const i=s=>{const h=Ce(ne(t,s),{min:-1/0,max:1/0});return[h.min,h.max]},c=s=>{const h=Ce(ne(n,s),{min:-1/0,max:1/0});return[h.min,h.max]};return typeof t!="function"&&typeof n!="function"?[i(),c()]:s=>[i(s),c(s)]},threshold(r,e,t){return this.lockDirection=t.axis==="lock",k.toVector(r,this.lockDirection?[.1,3]:0)},modifierKey(r){return r===void 0?"ctrlKey":r},pinchOnWheel(r=!0){return r}}),x(x({},q),{},{mouseOnly:(r=!0)=>r}),x(x({},q),{},{mouseOnly:(r=!0)=>r});const Ae=new Map,de=new Map;function xt(r){Ae.set(r.key,r.engine),de.set(r.key,r.resolver)}const _t={key:"drag",engine:ut,resolver:Le};function It(r,e){if(r==null)return{};var t={},n=Object.keys(r),i,c;for(c=0;c<n.length;c++)i=n[c],!(e.indexOf(i)>=0)&&(t[i]=r[i]);return t}function Et(r,e){if(r==null)return{};var t=It(r,e),n,i;if(Object.getOwnPropertySymbols){var c=Object.getOwnPropertySymbols(r);for(i=0;i<c.length;i++)n=c[i],!(e.indexOf(n)>=0)&&Object.prototype.propertyIsEnumerable.call(r,n)&&(t[n]=r[n])}return t}const St={target(r){if(r)return()=>"current"in r?r.current:r},enabled(r=!0){return r},window(r=M.isBrowser?window:void 0){return r},eventOptions({passive:r=!0,capture:e=!1}={}){return{passive:r,capture:e}},transform(r){return r}},Tt=["target","eventOptions","window","enabled","transform"];function ie(r={},e){const t={};for(const[n,i]of Object.entries(e))switch(typeof i){case"function":if(process.env.NODE_ENV==="development"){const c=i.call(t,r[n],n,r);Number.isNaN(c)||(t[n]=c)}else t[n]=i.call(t,r[n],n,r);break;case"object":t[n]=ie(r[n],i);break;case"boolean":i&&(t[n]=r[n]);break}return t}function Dt(r,e,t={}){const n=r,{target:i,eventOptions:c,window:s,enabled:h,transform:_}=n,S=Et(n,Tt);if(t.shared=ie({target:i,eventOptions:c,window:s,enabled:h,transform:_},St),e){const u=de.get(e);t[e]=ie(x({shared:t.shared},S),u)}else for(const u in S){const C=de.get(u);if(C)t[u]=ie(x({shared:t.shared},S[u]),C);else if(process.env.NODE_ENV==="development"&&!["drag","pinch","scroll","wheel","move","hover"].includes(u)){if(u==="domTarget")throw Error("[@use-gesture]: `domTarget` option has been renamed to `target`.");console.warn(`[@use-gesture]: Unknown config key \`${u}\` was used. Please read the documentation for further information.`)}}return t}class Ve{constructor(e,t){P(this,"_listeners",new Set),this._ctrl=e,this._gestureKey=t}add(e,t,n,i,c){const s=this._listeners,h=Je(t,n),_=this._gestureKey?this._ctrl.config[this._gestureKey].eventOptions:{},S=x(x({},_),c);e.addEventListener(h,i,S);const u=()=>{e.removeEventListener(h,i,S),s.delete(u)};return s.add(u),u}clean(){this._listeners.forEach(e=>e()),this._listeners.clear()}}class Ct{constructor(){P(this,"_timeouts",new Map)}add(e,t,n=140,...i){this.remove(e),this._timeouts.set(e,window.setTimeout(t,n,...i))}remove(e){const t=this._timeouts.get(e);t&&window.clearTimeout(t)}clean(){this._timeouts.forEach(e=>void window.clearTimeout(e)),this._timeouts.clear()}}class kt{constructor(e){P(this,"gestures",new Set),P(this,"_targetEventStore",new Ve(this)),P(this,"gestureEventStores",{}),P(this,"gestureTimeoutStores",{}),P(this,"handlers",{}),P(this,"config",{}),P(this,"pointerIds",new Set),P(this,"touchIds",new Set),P(this,"state",{shared:{shiftKey:!1,metaKey:!1,ctrlKey:!1,altKey:!1}}),Ot(this,e)}setEventIds(e){if(re(e))return this.touchIds=new Set(et(e)),this.touchIds;if("pointerId"in e)return e.type==="pointerup"||e.type==="pointercancel"?this.pointerIds.delete(e.pointerId):e.type==="pointerdown"&&this.pointerIds.add(e.pointerId),this.pointerIds}applyHandlers(e,t){this.handlers=e,this.nativeHandlers=t}applyConfig(e,t){this.config=Dt(e,t,this.config)}clean(){this._targetEventStore.clean();for(const e of this.gestures)this.gestureEventStores[e].clean(),this.gestureTimeoutStores[e].clean()}effect(){return this.config.shared.target&&this.bind(),()=>this._targetEventStore.clean()}bind(...e){const t=this.config.shared,n={};let i;if(!(t.target&&(i=t.target(),!i))){if(t.enabled){for(const s of this.gestures){const h=this.config[s],_=$e(n,h.eventOptions,!!i);if(h.enabled){const S=Ae.get(s);new S(this,e,s).bind(_)}}const c=$e(n,t.eventOptions,!!i);for(const s in this.nativeHandlers)c(s,"",h=>this.nativeHandlers[s](x(x({},this.state.shared),{},{event:h,args:e})),void 0,!0)}for(const c in n)n[c]=nt(...n[c]);if(!i)return n;for(const c in n){const{device:s,capture:h,passive:_}=qe(c);this._targetEventStore.add(i,s,"",n[c],{capture:h,passive:_})}}}}function X(r,e){r.gestures.add(e),r.gestureEventStores[e]=new Ve(r,e),r.gestureTimeoutStores[e]=new Ct}function Ot(r,e){e.drag&&X(r,"drag"),e.wheel&&X(r,"wheel"),e.scroll&&X(r,"scroll"),e.move&&X(r,"move"),e.pinch&&X(r,"pinch"),e.hover&&X(r,"hover")}const $e=(r,e,t)=>(n,i,c,s={},h=!1)=>{var _,S;const u=(_=s.capture)!==null&&_!==void 0?_:e.capture,C=(S=s.passive)!==null&&S!==void 0?S:e.passive;let T=h?n:Ye(n,i,u);t&&C&&(T+="Passive"),r[T]=r[T]||[],r[T].push(c)};function Pt(r,e={},t,n){const i=E.useMemo(()=>new kt(r),[]);if(i.applyHandlers(r,n),i.applyConfig(e,t),E.useEffect(i.effect.bind(i)),E.useEffect(()=>i.clean.bind(i),[]),e.target===void 0)return i.bind.bind(i)}function Nt(r,e){return xt(_t),Pt({drag:r},e||{},"drag")}const he="RSC::Event";function Mt(){const r=E.useRef(null);function e(n){E.useEffect(()=>{r.current||(r.current=document.createElement("div"));function i(c){n(c.detail)}if(r.current)return r.current.addEventListener(he,i,!1),()=>{var c;(c=r.current)==null||c.removeEventListener(he,i,!1)}},[n])}function t(n){if(r.current){const i=new CustomEvent(he,{detail:n});r.current.dispatchEvent(i)}}return{useListenToCustomEvent:e,emitEvent:t}}function Lt(r){const{left:e,right:t,top:n,bottom:i}=r.getBoundingClientRect(),{innerWidth:c,innerHeight:s}=window;return e<0||n<0?{isOut:!0,direction:"start"}:Math.floor(t)>Math.floor(c)||Math.floor(i)>Math.floor(s)?{isOut:!0,direction:"end"}:{isOut:!1,direction:null}}function K(r){return parseFloat(r.toFixed(2))}function Re(r){process.env.NODE_ENV!=="production"&&console.warn(r)}function At(r){if(!r||r.trim()==="")return"";let e="",t=!1,n=!0;for(let i=0;i<r.length;i++){const c=r[i];if(c==="$"&&r[i+1]==="{"){t=!0,e+=c;continue}if(t&&c==="}"){t=!1,e+=c,n=!0;continue}if(t){e+=c;continue}if(/\s/.test(c)){if(n)continue;let s=i+1;for(;s<r.length&&/\s/.test(r[s]);)s++;if(s<r.length&&/[{:;,}]/.test(r[s]))continue;e+=" ",n=!0;continue}/[{:;,]/.test(c)?n=!0:n=!1,e+=c}return e}function Vt({init:r=!0,items:e,slideType:t="fixed",scrollAmount:n,withLoop:i=!1,enableGestures:c=!0,carouselAxis:s="x",slideWhenDragThresholdIsReached:h=!0,scrollAmountType:_,fadeIn:S=!1,initialActiveItem:u}){const[C,T]=E.useState(!1),V=E.useRef([]),F=E.useRef(!1),D=E.useRef(0),O=_??"slide",L=i?[...e.map(o=>({...o,id:`prev-repeated-item-${o.id}`})),...e,...e.map(o=>({...o,id:`next-repeated-item-${o.id}`}))]:e,Q=E.useRef(n),Z=E.useRef(0),v=E.useId().replace(/:/g,""),se=E.useRef(null),w=E.useRef(null),oe=E.useRef(0),b=E.useRef(!0),g=E.useRef(!1),a=E.useRef(0),[R,ce]=ye.useSpring(()=>({value:0,onChange({value:o}){(t==="fixed"||t==="fluid")&&(s==="x"?w.current.style.transform=`translate3d(${o.value}px, 0px, 0px)`:w.current.style.transform=`translate3d(0px, ${o.value}px, 0px)`),t==="freeScroll"&&(w.current[s==="x"?"scrollLeft":"scrollTop"]=Math.abs(o.value))}}),[s]),{useListenToCustomEvent:$t,emitEvent:W}=Mt();function y(){const{totalStartEndGutterCssVar:o}=pe();return K(Q.current??0-o)}function z(){return w.current[s==="x"?"scrollWidth":"scrollHeight"]-se.current.getBoundingClientRect()[s==="x"?"width":"height"]}function ee(o){o&&V.current.push(o),Re("The carousel can't be initialized. List of errors:"),console.table(V.current)}function Rt(){return t==="freeScroll"?{onWheel(){R.value.stop()},onScroll(o){const f=o.currentTarget,d=s==="x"?f.scrollLeft:f.scrollTop,m=s==="x"?f.scrollWidth-f.clientWidth:f.scrollHeight-f.clientHeight;d===0?b.current=!0:d===m?g.current=!0:(b.current=!1,g.current=!1)}}:{}}function pe(){let o=0,f=0,d=0;const m=getComputedStyle(document.documentElement).getPropertyValue(`--${v}-react-spring-carousel-item-gutter`),l=getComputedStyle(document.documentElement).getPropertyValue(`--${v}-react-spring-carousel-items-per-slide`),p=getComputedStyle(document.documentElement).getPropertyValue(`--${v}-react-spring-carousel-item-gutter`);return p.includes("px")&&(o=Number(p.replace("px",""))),d=Number(l)||1,m.includes("px")&&(f=Number(m.replace("px",""))),{totalGutterCssVar:o,totalStartEndGutterCssVar:f,itemsPerSlide:d}}function ae({type:o,actionType:f,newActiveItem:d,shouldAnimate:m=!0}){var U,H,te,ue,je,Be,Ge;let l=0,p=R.value.get();if(b.current=!1,g.current=!1,t==="fixed"){const A=a.current;if(o==="prev"&&(a.current=d??a.current-1),o==="next"&&(a.current=d??a.current+1),i&&O==="group"&&D.current>1&&o==="next"){const I=e.length/D.current,G=Math.ceil(I)-1===a.current,Y=Math.ceil(I)===a.current;G&&(g.current=!0),l=-(a.current*y()),Y&&(a.current=0,p=R.value.get()+y()*I,l=0,g.current=!1,b.current=!0)}if(i&&O==="group"&&D.current>1&&o==="prev"){const I=e.length/D.current,G=a.current===0,Y=a.current===-1;l=-(a.current*y()),G&&(b.current=!0),Y&&(b.current=!1,g.current=!0,a.current=I-1,p=R.value.get()-y()*I,l=-y()*I+y())}if(!i&&O==="group"&&D.current>1){const I=e.length/D.current,G=2%I!==0,Y=Math.ceil(I-1)===a.current,be=a.current===0;l=-(a.current*y()),be&&(b.current=!0),Y&&(g.current=!0,G&&(l=-z()))}if(i&&o==="next"&&(O==="slide"||O==="group"&&D.current===1)){const I=((U=e[a.current])==null?void 0:U.id)===e[e.length-1].id,G=L[e.length+a.current].id.includes("repeated-item");I&&(g.current=!0),G&&(a.current=0,p=R.value.get()+y()*e.length,g.current=!1,b.current=!0),l=-(a.current*y())}if(i&&o==="prev"&&(O==="slide"||O==="group"&&D.current===1)){const I=L.findIndex(be=>be.id===e[A].id),G=((H=e[a.current])==null?void 0:H.id)===e[0].id,Y=L[I-1].id.includes("repeated-item");G&&(b.current=!0),Y&&(b.current=!1,g.current=!0,a.current=e.length-1,p=R.value.get()-y()*e.length),l=-(a.current*y())}!i&&O==="slide"&&(((te=e[a.current+1])==null?void 0:te.id)===e[e.length-1].id?g.current=!0:a.current===0?b.current=!0:(b.current=!1,g.current=!1),l=-(a.current*y()),o==="next"&&Math.abs(l)>z()&&(g.current=!0,l=-z())),W({eventName:"onSlideStartChange",sliceActionType:f,slideDirection:o,nextItem:{index:a.current,id:e[a.current].id,startReached:b.current,endReached:g.current}})}if(t==="fluid"){if(o==="prev"&&(a.current=d??a.current-1),o==="next"&&(a.current=d??a.current+1),l=-(a.current*y()),o==="next"&&i){const A=((ue=e[a.current])==null?void 0:ue.id)===e[e.length-1].id,I=L[e.length+a.current].id.includes("repeated-item");A&&(g.current=!0),I&&(a.current=0,p=R.value.get()+y()*e.length,l=0,g.current=!1,b.current=!0)}if(o==="next"&&!i&&(Math.abs(l)>z()?(g.current=!0,l=-z()):(b.current=!1,g.current=!1)),o==="prev"&&!i&&((je=e[a.current])==null?void 0:je.id)===e[0].id&&(b.current=!0),o==="prev"&&i){const A=((Be=e[a.current])==null?void 0:Be.id)===e[0].id,I=(Ge=L[e.length+a.current])==null?void 0:Ge.id.includes("repeated-item");A&&(b.current=!0),I&&(a.current=e.length-1,p=R.value.get()-y()*e.length,l=-(y()*e.length-y()),b.current=!1,g.current=!0)}W({eventName:"onSlideStartChange",sliceActionType:f,slideDirection:o,nextItem:{startReached:b.current,endReached:g.current,index:0,id:""}})}if(t==="freeScroll"){const A=w.current[s==="x"?"scrollLeft":"scrollTop"],I=s==="x"?w.current.scrollWidth-w.current.clientWidth:w.current.scrollHeight-w.current.clientHeight;p=A,o==="prev"&&(l=p-y(),l<0&&(l=0),p-y()<=0&&(b.current=!0),W({eventName:"onSlideStartChange",sliceActionType:f,slideDirection:o,nextItem:{index:0,id:"",startReached:b.current,endReached:!1}})),o==="next"&&(l=p+y(),l>I&&(l=I),p+y()>=I&&(g.current=!0),W({eventName:"onSlideStartChange",sliceActionType:f,slideDirection:o,nextItem:{index:0,id:"",startReached:!1,endReached:g.current}}))}const N=K(p),j=K(l);oe.current=j,ce.start({from:{value:N},to:{value:j},immediate:!m,onRest({finished:A}){A&&t==="fixed"&&W({eventName:"onSlideChangeComplete",sliceActionType:f,slideDirection:o,currentItem:{index:a.current,id:e[a.current].id,startReached:b.current,endReached:g.current}}),A&&t==="fluid"&&W({eventName:"onSlideChangeComplete",sliceActionType:f,slideDirection:o,currentItem:{index:0,id:"",startReached:b.current,endReached:g.current}})}})}function ge(o,f,d=!0){if(!C){ee("Carousel not initialized yet: slideToNextItem");return}if(o==="drag"||t==="fixed"&&i||t==="fixed"&&!i&&!g.current){const m=f??a.current+1;ae({type:"next",actionType:o,newActiveItem:m,shouldAnimate:d})}(t==="fluid"&&i||t==="fluid"&&!i&&!g.current||t==="freeScroll"&&!g.current)&&ae({type:"next",actionType:o,shouldAnimate:d})}function me(o,f,d=!0){if(!C){ee("Carousel not initialized yet: slideToPrevItem");return}if(o==="drag"||t==="fixed"&&i||t==="fixed"&&!i&&!b.current){const m=f??a.current-1;ae({type:"prev",actionType:o,newActiveItem:m,shouldAnimate:d})}(t==="fluid"&&i||t==="fluid"&&!i&&!b.current||t==="freeScroll"&&!b.current)&&ae({type:"prev",actionType:o,shouldAnimate:d})}function ve(o,f=!0){let d=0;typeof o=="string"?d=e.findIndex(m=>m.id===o):d=o,d>a.current&&ge("click",d,f),d<a.current&&me("click",d,f)}function jt({getContainer:o,activeItem:f,updateTotalValue:d}){const m=o();if(!(m instanceof HTMLElement)){console.warn(`Container is not a valid html element: container is ${m}`);return}const l=m.children[f];if(l){const p=m[s==="x"?"scrollWidth":"scrollHeight"]-m.getBoundingClientRect()[s==="x"?"width":"height"],j=l.offsetLeft+l.offsetWidth/2-m.clientWidth/2,U=Lt(l);if(U.isOut){const H=U.direction==="start"?j<0?0:j:j>p?p:j,te=m[s==="x"?"scrollLeft":"scrollTop"];new ye.Controller({from:{value:te},to:{value:d?d({from:te,to:H,itemOutOfViewport:U}):H},onChange({value:ue}){m[s==="x"?"scrollLeft":"scrollTop"]=ue.value}})}}}const Bt=Nt(o=>{if(!C){ee();return}const f=o.dragging,d=o.offset[s==="x"?0:1],m=o.movement[s==="x"?0:1],l=m>Z.current,p=m<-Z.current,N=o.velocity;f&&(W({...o,eventName:"onDrag",slideActionType:"drag"}),ce.start({value:d,immediate:!0,config:{velocity:N}}),h&&(l||p)&&o.cancel()),o.last&&(l?me("drag"):p?ge("drag"):ce.start({value:oe.current,config:{velocity:N}}))},{enabled:c&&t!=="freeScroll",axis:s,rubberband:!i,...i?{}:{bounds:()=>({right:0,left:-z(),top:-z(),bottom:0})},from:()=>[R.value.get(),R.value.get()]});return E.useEffect(()=>{function o(){document.hidden?(F.current=!0,T(!1)):(F.current=!1,T(!0))}function f(){if(w.current.style.top="0px",w.current.style.left="0px",!(t==="fixed"&&!i||t==="freeScroll"||t==="fluid"))if(t==="fixed"&&O==="group"&&D.current>1){const p=e.length*3/D.current;w.current.style[s==="x"?"left":"top"]=`calc(-${K(y()*p/3)}px)`}else w.current.style[s==="x"?"left":"top"]=`calc(-${K(y()*L.length/3)}px)`}function d(){m(),f(),ce.start({immediate:!0,value:-(a.current*y())})}function m(){const p=w.current.children[0];let N=0;const j=t==="fixed"&&O==="group"&&D.current>1;j?N=K(w.current.getBoundingClientRect()[s==="x"?"width":"height"]):N=K(p.getBoundingClientRect()[s==="x"?"width":"height"]);const{totalGutterCssVar:U,totalStartEndGutterCssVar:H}=pe();return N+=U,j&&(N-=H),Q.current=N,N}function l(){V.current=[];const{itemsPerSlide:p}=pe();if(console.log({_itemsPerSlide:p}),D.current=p,L.length===0&&Re("Init is true but no items are available; carousel will not be initialized"),t==="fixed"&&O==="group"&&e.length%D.current!==0&&V.current.push("When using scrollAmountType='group' and itemsPerSlide={number>1} make sure that itemsPerSlides is divisible by the total quantity of items otherwise the carousel won't initialize."),t==="fluid"&&_!==void 0&&V.current.push('scrollAmountType="group" is not available for slideType="fluid"; please change one of them.'),V.current.length>0){ee();return}m(),f(),Z.current=y()/4,T(!0)}if(typeof r=="function")r().then(p=>{if(p)return l(),u!==void 0&&ve(u,!1),window.addEventListener("resize",d),document.addEventListener("visibilitychange",o),()=>{document.removeEventListener("visibilitychange",o),window.removeEventListener("resize",d)}});else{if(r)return l(),window.addEventListener("resize",d),document.addEventListener("visibilitychange",o),()=>{document.removeEventListener("visibilitychange",o),window.removeEventListener("resize",d)};T(!1)}},[Q,r,t,i,s]),E.useEffect(()=>{u!==void 0&&C&&ve(u,!1)},[C,u]),{carouselFragment:$.jsxs($.Fragment,{children:[$.jsx("style",{id:`carousel-container-${v}`,dangerouslySetInnerHTML:{__html:At(`
|
|
1
|
+
(function(B,$){typeof exports=="object"&&typeof module<"u"?$(exports,require("react/jsx-runtime"),require("@react-spring/web"),require("react")):typeof define=="function"&&define.amd?define(["exports","react/jsx-runtime","@react-spring/web","react"],$):(B=typeof globalThis<"u"?globalThis:B||self,$(B["react-spring-carousel"]={},B["react/jsx-runtime"],B["@react-spring/web"],B.React))})(this,function(B,$,ye,E){"use strict";function Ue(r,e,t){return Math.max(e,Math.min(r,t))}const k={toVector(r,e){return r===void 0&&(r=e),Array.isArray(r)?r:[r,r]},add(r,e){return[r[0]+e[0],r[1]+e[1]]},sub(r,e){return[r[0]-e[0],r[1]-e[1]]},addTo(r,e){r[0]+=e[0],r[1]+=e[1]},subTo(r,e){r[0]-=e[0],r[1]-=e[1]}};function we(r,e,t){return e===0||Math.abs(e)===1/0?Math.pow(r,t*5):r*e*t/(e+t*r)}function xe(r,e,t,n=.15){return n===0?Ue(r,e,t):r<e?-we(e-r,t-e,n)+e:r>t?+we(r-t,t-e,n)+t:r}function Ke(r,[e,t],[n,i]){const[[c,s],[h,_]]=r;return[xe(e,c,s,n),xe(t,h,_,i)]}function Fe(r,e){if(typeof r!="object"||r===null)return r;var t=r[Symbol.toPrimitive];if(t!==void 0){var n=t.call(r,e||"default");if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(r)}function We(r){var e=Fe(r,"string");return typeof e=="symbol"?e:String(e)}function P(r,e,t){return e=We(e),e in r?Object.defineProperty(r,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):r[e]=t,r}function _e(r,e){var t=Object.keys(r);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(r);e&&(n=n.filter(function(i){return Object.getOwnPropertyDescriptor(r,i).enumerable})),t.push.apply(t,n)}return t}function x(r){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?_e(Object(t),!0).forEach(function(n){P(r,n,t[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(r,Object.getOwnPropertyDescriptors(t)):_e(Object(t)).forEach(function(n){Object.defineProperty(r,n,Object.getOwnPropertyDescriptor(t,n))})}return r}const Ie={pointer:{start:"down",change:"move",end:"up"},mouse:{start:"down",change:"move",end:"up"},touch:{start:"start",change:"move",end:"end"},gesture:{start:"start",change:"change",end:"end"}};function Ee(r){return r?r[0].toUpperCase()+r.slice(1):""}const ze=["enter","leave"];function He(r=!1,e){return r&&!ze.includes(e)}function Ye(r,e="",t=!1){const n=Ie[r],i=n&&n[e]||e;return"on"+Ee(r)+Ee(i)+(He(t,i)?"Capture":"")}const Xe=["gotpointercapture","lostpointercapture"];function qe(r){let e=r.substring(2).toLowerCase();const t=!!~e.indexOf("passive");t&&(e=e.replace("passive",""));const n=Xe.includes(e)?"capturecapture":"capture",i=!!~e.indexOf(n);return i&&(e=e.replace("capture","")),{device:e,capture:i,passive:t}}function Je(r,e=""){const t=Ie[r],n=t&&t[e]||e;return r+n}function re(r){return"touches"in r}function Se(r){return re(r)?"touch":"pointerType"in r?r.pointerType:"mouse"}function Qe(r){return Array.from(r.touches).filter(e=>{var t,n;return e.target===r.currentTarget||((t=r.currentTarget)===null||t===void 0||(n=t.contains)===null||n===void 0?void 0:n.call(t,e.target))})}function Ze(r){return r.type==="touchend"||r.type==="touchcancel"?r.changedTouches:r.targetTouches}function Te(r){return re(r)?Ze(r)[0]:r}function et(r){return Qe(r).map(e=>e.identifier)}function le(r){const e=Te(r);return re(r)?e.identifier:e.pointerId}function De(r){const e=Te(r);return[e.clientX,e.clientY]}function tt(r){const e={};if("buttons"in r&&(e.buttons=r.buttons),"shiftKey"in r){const{shiftKey:t,altKey:n,metaKey:i,ctrlKey:c}=r;Object.assign(e,{shiftKey:t,altKey:n,metaKey:i,ctrlKey:c})}return e}function ne(r,...e){return typeof r=="function"?r(...e):r}function rt(){}function nt(...r){return r.length===0?rt:r.length===1?r[0]:function(){let e;for(const t of r)e=t.apply(this,arguments)||e;return e}}function Ce(r,e){return Object.assign({},e,r||{})}const it=32;class st{constructor(e,t,n){this.ctrl=e,this.args=t,this.key=n,this.state||(this.state={},this.computeValues([0,0]),this.computeInitial(),this.init&&this.init(),this.reset())}get state(){return this.ctrl.state[this.key]}set state(e){this.ctrl.state[this.key]=e}get shared(){return this.ctrl.state.shared}get eventStore(){return this.ctrl.gestureEventStores[this.key]}get timeoutStore(){return this.ctrl.gestureTimeoutStores[this.key]}get config(){return this.ctrl.config[this.key]}get sharedConfig(){return this.ctrl.config.shared}get handler(){return this.ctrl.handlers[this.key]}reset(){const{state:e,shared:t,ingKey:n,args:i}=this;t[n]=e._active=e.active=e._blocked=e._force=!1,e._step=[!1,!1],e.intentional=!1,e._movement=[0,0],e._distance=[0,0],e._direction=[0,0],e._delta=[0,0],e._bounds=[[-1/0,1/0],[-1/0,1/0]],e.args=i,e.axis=void 0,e.memo=void 0,e.elapsedTime=e.timeDelta=0,e.direction=[0,0],e.distance=[0,0],e.overflow=[0,0],e._movementBound=[!1,!1],e.velocity=[0,0],e.movement=[0,0],e.delta=[0,0],e.timeStamp=0}start(e){const t=this.state,n=this.config;t._active||(this.reset(),this.computeInitial(),t._active=!0,t.target=e.target,t.currentTarget=e.currentTarget,t.lastOffset=n.from?ne(n.from,t):t.offset,t.offset=t.lastOffset,t.startTime=t.timeStamp=e.timeStamp)}computeValues(e){const t=this.state;t._values=e,t.values=this.config.transform(e)}computeInitial(){const e=this.state;e._initial=e._values,e.initial=e.values}compute(e){const{state:t,config:n,shared:i}=this;t.args=this.args;let c=0;if(e&&(t.event=e,n.preventDefault&&e.cancelable&&t.event.preventDefault(),t.type=e.type,i.touches=this.ctrl.pointerIds.size||this.ctrl.touchIds.size,i.locked=!!document.pointerLockElement,Object.assign(i,tt(e)),i.down=i.pressed=i.buttons%2===1||i.touches>0,c=e.timeStamp-t.timeStamp,t.timeStamp=e.timeStamp,t.elapsedTime=t.timeStamp-t.startTime),t._active){const w=t._delta.map(Math.abs);k.addTo(t._distance,w)}this.axisIntent&&this.axisIntent(e);const[s,h]=t._movement,[_,S]=n.threshold,{_step:u,values:C}=t;if(n.hasCustomTransform?(u[0]===!1&&(u[0]=Math.abs(s)>=_&&C[0]),u[1]===!1&&(u[1]=Math.abs(h)>=S&&C[1])):(u[0]===!1&&(u[0]=Math.abs(s)>=_&&Math.sign(s)*_),u[1]===!1&&(u[1]=Math.abs(h)>=S&&Math.sign(h)*S)),t.intentional=u[0]!==!1||u[1]!==!1,!t.intentional)return;const T=[0,0];if(n.hasCustomTransform){const[w,oe]=C;T[0]=u[0]!==!1?w-u[0]:0,T[1]=u[1]!==!1?oe-u[1]:0}else T[0]=u[0]!==!1?s-u[0]:0,T[1]=u[1]!==!1?h-u[1]:0;this.restrictToAxis&&!t._blocked&&this.restrictToAxis(T);const V=t.offset,F=t._active&&!t._blocked||t.active;F&&(t.first=t._active&&!t.active,t.last=!t._active&&t.active,t.active=i[this.ingKey]=t._active,e&&(t.first&&("bounds"in n&&(t._bounds=ne(n.bounds,t)),this.setup&&this.setup()),t.movement=T,this.computeOffset()));const[D,O]=t.offset,[[A,Q],[Z,b]]=t._bounds;t.overflow=[D<A?-1:D>Q?1:0,O<Z?-1:O>b?1:0],t._movementBound[0]=t.overflow[0]?t._movementBound[0]===!1?t._movement[0]:t._movementBound[0]:!1,t._movementBound[1]=t.overflow[1]?t._movementBound[1]===!1?t._movement[1]:t._movementBound[1]:!1;const se=t._active?n.rubberband||[0,0]:[0,0];if(t.offset=Ke(t._bounds,t.offset,se),t.delta=k.sub(t.offset,V),this.computeMovement(),F&&(!t.last||c>it)){t.delta=k.sub(t.offset,V);const w=t.delta.map(Math.abs);k.addTo(t.distance,w),t.direction=t.delta.map(Math.sign),t._direction=t._delta.map(Math.sign),!t.first&&c>0&&(t.velocity=[w[0]/c,w[1]/c],t.timeDelta=c)}}emit(){const e=this.state,t=this.shared,n=this.config;if(e._active||this.clean(),(e._blocked||!e.intentional)&&!e._force&&!n.triggerAllEvents)return;const i=this.handler(x(x(x({},t),e),{},{[this.aliasKey]:e.values}));i!==void 0&&(e.memo=i)}clean(){this.eventStore.clean(),this.timeoutStore.clean()}}function ot([r,e],t){const n=Math.abs(r),i=Math.abs(e);if(n>i&&n>t)return"x";if(i>n&&i>t)return"y"}class ct extends st{constructor(...e){super(...e),P(this,"aliasKey","xy")}reset(){super.reset(),this.state.axis=void 0}init(){this.state.offset=[0,0],this.state.lastOffset=[0,0]}computeOffset(){this.state.offset=k.add(this.state.lastOffset,this.state.movement)}computeMovement(){this.state.movement=k.sub(this.state.offset,this.state.lastOffset)}axisIntent(e){const t=this.state,n=this.config;if(!t.axis&&e){const i=typeof n.axisThreshold=="object"?n.axisThreshold[Se(e)]:n.axisThreshold;t.axis=ot(t._movement,i)}t._blocked=(n.lockDirection||!!n.axis)&&!t.axis||!!n.axis&&n.axis!==t.axis}restrictToAxis(e){if(this.config.axis||this.config.lockDirection)switch(this.state.axis){case"x":e[1]=0;break;case"y":e[0]=0;break}}}const ke=r=>r,Oe=.15,fe={enabled(r=!0){return r},eventOptions(r,e,t){return x(x({},t.shared.eventOptions),r)},preventDefault(r=!1){return r},triggerAllEvents(r=!1){return r},rubberband(r=0){switch(r){case!0:return[Oe,Oe];case!1:return[0,0];default:return k.toVector(r)}},from(r){if(typeof r=="function")return r;if(r!=null)return k.toVector(r)},transform(r,e,t){const n=r||t.shared.transform;if(this.hasCustomTransform=!!n,process.env.NODE_ENV==="development"){const i=n||ke;return c=>{const s=i(c);return(!isFinite(s[0])||!isFinite(s[1]))&&console.warn(`[@use-gesture]: config.transform() must produce a valid result, but it was: [${s[0]},${[1]}]`),s}}return n||ke},threshold(r){return k.toVector(r,0)}};process.env.NODE_ENV==="development"&&Object.assign(fe,{domTarget(r){if(r!==void 0)throw Error("[@use-gesture]: `domTarget` option has been renamed to `target`.");return NaN},lockDirection(r){if(r!==void 0)throw Error("[@use-gesture]: `lockDirection` option has been merged with `axis`. Use it as in `{ axis: 'lock' }`");return NaN},initial(r){if(r!==void 0)throw Error("[@use-gesture]: `initial` option has been renamed to `from`.");return NaN}});const at=0,q=x(x({},fe),{},{axis(r,e,{axis:t}){if(this.lockDirection=t==="lock",!this.lockDirection)return t},axisThreshold(r=at){return r},bounds(r={}){if(typeof r=="function")return c=>q.bounds(r(c));if("current"in r)return()=>r.current;if(typeof HTMLElement=="function"&&r instanceof HTMLElement)return r;const{left:e=-1/0,right:t=1/0,top:n=-1/0,bottom:i=1/0}=r;return[[e,t],[n,i]]}}),Pe={ArrowRight:(r,e=1)=>[r*e,0],ArrowLeft:(r,e=1)=>[-1*r*e,0],ArrowUp:(r,e=1)=>[0,-1*r*e],ArrowDown:(r,e=1)=>[0,r*e]};class ut extends ct{constructor(...e){super(...e),P(this,"ingKey","dragging")}reset(){super.reset();const e=this.state;e._pointerId=void 0,e._pointerActive=!1,e._keyboardActive=!1,e._preventScroll=!1,e._delayed=!1,e.swipe=[0,0],e.tap=!1,e.canceled=!1,e.cancel=this.cancel.bind(this)}setup(){const e=this.state;if(e._bounds instanceof HTMLElement){const t=e._bounds.getBoundingClientRect(),n=e.currentTarget.getBoundingClientRect(),i={left:t.left-n.left+e.offset[0],right:t.right-n.right+e.offset[0],top:t.top-n.top+e.offset[1],bottom:t.bottom-n.bottom+e.offset[1]};e._bounds=q.bounds(i)}}cancel(){const e=this.state;e.canceled||(e.canceled=!0,e._active=!1,setTimeout(()=>{this.compute(),this.emit()},0))}setActive(){this.state._active=this.state._pointerActive||this.state._keyboardActive}clean(){this.pointerClean(),this.state._pointerActive=!1,this.state._keyboardActive=!1,super.clean()}pointerDown(e){const t=this.config,n=this.state;if(e.buttons!=null&&(Array.isArray(t.pointerButtons)?!t.pointerButtons.includes(e.buttons):t.pointerButtons!==-1&&t.pointerButtons!==e.buttons))return;const i=this.ctrl.setEventIds(e);t.pointerCapture&&e.target.setPointerCapture(e.pointerId),!(i&&i.size>1&&n._pointerActive)&&(this.start(e),this.setupPointer(e),n._pointerId=le(e),n._pointerActive=!0,this.computeValues(De(e)),this.computeInitial(),t.preventScrollAxis&&Se(e)!=="mouse"?(n._active=!1,this.setupScrollPrevention(e)):t.delay>0?(this.setupDelayTrigger(e),t.triggerAllEvents&&(this.compute(e),this.emit())):this.startPointerDrag(e))}startPointerDrag(e){const t=this.state;t._active=!0,t._preventScroll=!0,t._delayed=!1,this.compute(e),this.emit()}pointerMove(e){const t=this.state,n=this.config;if(!t._pointerActive)return;const i=le(e);if(t._pointerId!==void 0&&i!==t._pointerId)return;const c=De(e);if(document.pointerLockElement===e.target?t._delta=[e.movementX,e.movementY]:(t._delta=k.sub(c,t._values),this.computeValues(c)),k.addTo(t._movement,t._delta),this.compute(e),t._delayed&&t.intentional){this.timeoutStore.remove("dragDelay"),t.active=!1,this.startPointerDrag(e);return}if(n.preventScrollAxis&&!t._preventScroll)if(t.axis)if(t.axis===n.preventScrollAxis||n.preventScrollAxis==="xy"){t._active=!1,this.clean();return}else{this.timeoutStore.remove("startPointerDrag"),this.startPointerDrag(e);return}else return;this.emit()}pointerUp(e){this.ctrl.setEventIds(e);try{this.config.pointerCapture&&e.target.hasPointerCapture(e.pointerId)&&e.target.releasePointerCapture(e.pointerId)}catch{process.env.NODE_ENV==="development"&&console.warn("[@use-gesture]: If you see this message, it's likely that you're using an outdated version of `@react-three/fiber`. \n\nPlease upgrade to the latest version.")}const t=this.state,n=this.config;if(!t._active||!t._pointerActive)return;const i=le(e);if(t._pointerId!==void 0&&i!==t._pointerId)return;this.state._pointerActive=!1,this.setActive(),this.compute(e);const[c,s]=t._distance;if(t.tap=c<=n.tapsThreshold&&s<=n.tapsThreshold,t.tap&&n.filterTaps)t._force=!0;else{const[h,_]=t._delta,[S,u]=t._movement,[C,T]=n.swipe.velocity,[V,F]=n.swipe.distance,D=n.swipe.duration;if(t.elapsedTime<D){const O=Math.abs(h/t.timeDelta),A=Math.abs(_/t.timeDelta);O>C&&Math.abs(S)>V&&(t.swipe[0]=Math.sign(h)),A>T&&Math.abs(u)>F&&(t.swipe[1]=Math.sign(_))}}this.emit()}pointerClick(e){!this.state.tap&&e.detail>0&&(e.preventDefault(),e.stopPropagation())}setupPointer(e){const t=this.config,n=t.device;if(process.env.NODE_ENV==="development")try{if(n==="pointer"&&t.preventScrollDelay===void 0){const i="uv"in e?e.sourceEvent.currentTarget:e.currentTarget;window.getComputedStyle(i).touchAction==="auto"&&console.warn("[@use-gesture]: The drag target has its `touch-action` style property set to `auto`. It is recommended to add `touch-action: 'none'` so that the drag gesture behaves correctly on touch-enabled devices. For more information read this: https://use-gesture.netlify.app/docs/extras/#touch-action.\n\nThis message will only show in development mode. It won't appear in production. If this is intended, you can ignore it.",i)}}catch{}t.pointerLock&&e.currentTarget.requestPointerLock(),t.pointerCapture||(this.eventStore.add(this.sharedConfig.window,n,"change",this.pointerMove.bind(this)),this.eventStore.add(this.sharedConfig.window,n,"end",this.pointerUp.bind(this)),this.eventStore.add(this.sharedConfig.window,n,"cancel",this.pointerUp.bind(this)))}pointerClean(){this.config.pointerLock&&document.pointerLockElement===this.state.currentTarget&&document.exitPointerLock()}preventScroll(e){this.state._preventScroll&&e.cancelable&&e.preventDefault()}setupScrollPrevention(e){this.state._preventScroll=!1,lt(e);const t=this.eventStore.add(this.sharedConfig.window,"touch","change",this.preventScroll.bind(this),{passive:!1});this.eventStore.add(this.sharedConfig.window,"touch","end",t),this.eventStore.add(this.sharedConfig.window,"touch","cancel",t),this.timeoutStore.add("startPointerDrag",this.startPointerDrag.bind(this),this.config.preventScrollDelay,e)}setupDelayTrigger(e){this.state._delayed=!0,this.timeoutStore.add("dragDelay",()=>{this.state._step=[0,0],this.startPointerDrag(e)},this.config.delay)}keyDown(e){const t=Pe[e.key];if(t){const n=this.state,i=e.shiftKey?10:e.altKey?.1:1;this.start(e),n._delta=t(this.config.keyboardDisplacement,i),n._keyboardActive=!0,k.addTo(n._movement,n._delta),this.compute(e),this.emit()}}keyUp(e){e.key in Pe&&(this.state._keyboardActive=!1,this.setActive(),this.compute(e),this.emit())}bind(e){const t=this.config.device;e(t,"start",this.pointerDown.bind(this)),this.config.pointerCapture&&(e(t,"change",this.pointerMove.bind(this)),e(t,"end",this.pointerUp.bind(this)),e(t,"cancel",this.pointerUp.bind(this)),e("lostPointerCapture","",this.pointerUp.bind(this))),this.config.keys&&(e("key","down",this.keyDown.bind(this)),e("key","up",this.keyUp.bind(this))),this.config.filterTaps&&e("click","",this.pointerClick.bind(this),{capture:!0,passive:!1})}}function lt(r){"persist"in r&&typeof r.persist=="function"&&r.persist()}const J=typeof window<"u"&&window.document&&window.document.createElement;function Ne(){return J&&"ontouchstart"in window}function ft(){return Ne()||J&&window.navigator.maxTouchPoints>1}function dt(){return J&&"onpointerdown"in window}function ht(){return J&&"exitPointerLock"in window.document}function pt(){try{return"constructor"in GestureEvent}catch{return!1}}const M={isBrowser:J,gesture:pt(),touch:Ne(),touchscreen:ft(),pointer:dt(),pointerLock:ht()},gt=250,mt=180,vt=.5,bt=50,yt=250,wt=10,Me={mouse:0,touch:0,pen:8},Ae=x(x({},q),{},{device(r,e,{pointer:{touch:t=!1,lock:n=!1,mouse:i=!1}={}}){return this.pointerLock=n&&M.pointerLock,M.touch&&t?"touch":this.pointerLock?"mouse":M.pointer&&!i?"pointer":M.touch?"touch":"mouse"},preventScrollAxis(r,e,{preventScroll:t}){if(this.preventScrollDelay=typeof t=="number"?t:t||t===void 0&&r?gt:void 0,!(!M.touchscreen||t===!1))return r||(t!==void 0?"y":void 0)},pointerCapture(r,e,{pointer:{capture:t=!0,buttons:n=1,keys:i=!0}={}}){return this.pointerButtons=n,this.keys=i,!this.pointerLock&&this.device==="pointer"&&t},threshold(r,e,{filterTaps:t=!1,tapsThreshold:n=3,axis:i=void 0}){const c=k.toVector(r,t?n:i?1:0);return this.filterTaps=t,this.tapsThreshold=n,c},swipe({velocity:r=vt,distance:e=bt,duration:t=yt}={}){return{velocity:this.transform(k.toVector(r)),distance:this.transform(k.toVector(e)),duration:t}},delay(r=0){switch(r){case!0:return mt;case!1:return 0;default:return r}},axisThreshold(r){return r?x(x({},Me),r):Me},keyboardDisplacement(r=wt){return r}});process.env.NODE_ENV==="development"&&Object.assign(Ae,{useTouch(r){if(r!==void 0)throw Error("[@use-gesture]: `useTouch` option has been renamed to `pointer.touch`. Use it as in `{ pointer: { touch: true } }`.");return NaN},experimental_preventWindowScrollY(r){if(r!==void 0)throw Error("[@use-gesture]: `experimental_preventWindowScrollY` option has been renamed to `preventScroll`.");return NaN},swipeVelocity(r){if(r!==void 0)throw Error("[@use-gesture]: `swipeVelocity` option has been renamed to `swipe.velocity`. Use it as in `{ swipe: { velocity: 0.5 } }`.");return NaN},swipeDistance(r){if(r!==void 0)throw Error("[@use-gesture]: `swipeDistance` option has been renamed to `swipe.distance`. Use it as in `{ swipe: { distance: 50 } }`.");return NaN},swipeDuration(r){if(r!==void 0)throw Error("[@use-gesture]: `swipeDuration` option has been renamed to `swipe.duration`. Use it as in `{ swipe: { duration: 250 } }`.");return NaN}}),x(x({},fe),{},{device(r,e,{shared:t,pointer:{touch:n=!1}={}}){if(t.target&&!M.touch&&M.gesture)return"gesture";if(M.touch&&n)return"touch";if(M.touchscreen){if(M.pointer)return"pointer";if(M.touch)return"touch"}},bounds(r,e,{scaleBounds:t={},angleBounds:n={}}){const i=s=>{const h=Ce(ne(t,s),{min:-1/0,max:1/0});return[h.min,h.max]},c=s=>{const h=Ce(ne(n,s),{min:-1/0,max:1/0});return[h.min,h.max]};return typeof t!="function"&&typeof n!="function"?[i(),c()]:s=>[i(s),c(s)]},threshold(r,e,t){return this.lockDirection=t.axis==="lock",k.toVector(r,this.lockDirection?[.1,3]:0)},modifierKey(r){return r===void 0?"ctrlKey":r},pinchOnWheel(r=!0){return r}}),x(x({},q),{},{mouseOnly:(r=!0)=>r}),x(x({},q),{},{mouseOnly:(r=!0)=>r});const Le=new Map,de=new Map;function xt(r){Le.set(r.key,r.engine),de.set(r.key,r.resolver)}const _t={key:"drag",engine:ut,resolver:Ae};function It(r,e){if(r==null)return{};var t={},n=Object.keys(r),i,c;for(c=0;c<n.length;c++)i=n[c],!(e.indexOf(i)>=0)&&(t[i]=r[i]);return t}function Et(r,e){if(r==null)return{};var t=It(r,e),n,i;if(Object.getOwnPropertySymbols){var c=Object.getOwnPropertySymbols(r);for(i=0;i<c.length;i++)n=c[i],!(e.indexOf(n)>=0)&&Object.prototype.propertyIsEnumerable.call(r,n)&&(t[n]=r[n])}return t}const St={target(r){if(r)return()=>"current"in r?r.current:r},enabled(r=!0){return r},window(r=M.isBrowser?window:void 0){return r},eventOptions({passive:r=!0,capture:e=!1}={}){return{passive:r,capture:e}},transform(r){return r}},Tt=["target","eventOptions","window","enabled","transform"];function ie(r={},e){const t={};for(const[n,i]of Object.entries(e))switch(typeof i){case"function":if(process.env.NODE_ENV==="development"){const c=i.call(t,r[n],n,r);Number.isNaN(c)||(t[n]=c)}else t[n]=i.call(t,r[n],n,r);break;case"object":t[n]=ie(r[n],i);break;case"boolean":i&&(t[n]=r[n]);break}return t}function Dt(r,e,t={}){const n=r,{target:i,eventOptions:c,window:s,enabled:h,transform:_}=n,S=Et(n,Tt);if(t.shared=ie({target:i,eventOptions:c,window:s,enabled:h,transform:_},St),e){const u=de.get(e);t[e]=ie(x({shared:t.shared},S),u)}else for(const u in S){const C=de.get(u);if(C)t[u]=ie(x({shared:t.shared},S[u]),C);else if(process.env.NODE_ENV==="development"&&!["drag","pinch","scroll","wheel","move","hover"].includes(u)){if(u==="domTarget")throw Error("[@use-gesture]: `domTarget` option has been renamed to `target`.");console.warn(`[@use-gesture]: Unknown config key \`${u}\` was used. Please read the documentation for further information.`)}}return t}class Ve{constructor(e,t){P(this,"_listeners",new Set),this._ctrl=e,this._gestureKey=t}add(e,t,n,i,c){const s=this._listeners,h=Je(t,n),_=this._gestureKey?this._ctrl.config[this._gestureKey].eventOptions:{},S=x(x({},_),c);e.addEventListener(h,i,S);const u=()=>{e.removeEventListener(h,i,S),s.delete(u)};return s.add(u),u}clean(){this._listeners.forEach(e=>e()),this._listeners.clear()}}class Ct{constructor(){P(this,"_timeouts",new Map)}add(e,t,n=140,...i){this.remove(e),this._timeouts.set(e,window.setTimeout(t,n,...i))}remove(e){const t=this._timeouts.get(e);t&&window.clearTimeout(t)}clean(){this._timeouts.forEach(e=>void window.clearTimeout(e)),this._timeouts.clear()}}class kt{constructor(e){P(this,"gestures",new Set),P(this,"_targetEventStore",new Ve(this)),P(this,"gestureEventStores",{}),P(this,"gestureTimeoutStores",{}),P(this,"handlers",{}),P(this,"config",{}),P(this,"pointerIds",new Set),P(this,"touchIds",new Set),P(this,"state",{shared:{shiftKey:!1,metaKey:!1,ctrlKey:!1,altKey:!1}}),Ot(this,e)}setEventIds(e){if(re(e))return this.touchIds=new Set(et(e)),this.touchIds;if("pointerId"in e)return e.type==="pointerup"||e.type==="pointercancel"?this.pointerIds.delete(e.pointerId):e.type==="pointerdown"&&this.pointerIds.add(e.pointerId),this.pointerIds}applyHandlers(e,t){this.handlers=e,this.nativeHandlers=t}applyConfig(e,t){this.config=Dt(e,t,this.config)}clean(){this._targetEventStore.clean();for(const e of this.gestures)this.gestureEventStores[e].clean(),this.gestureTimeoutStores[e].clean()}effect(){return this.config.shared.target&&this.bind(),()=>this._targetEventStore.clean()}bind(...e){const t=this.config.shared,n={};let i;if(!(t.target&&(i=t.target(),!i))){if(t.enabled){for(const s of this.gestures){const h=this.config[s],_=$e(n,h.eventOptions,!!i);if(h.enabled){const S=Le.get(s);new S(this,e,s).bind(_)}}const c=$e(n,t.eventOptions,!!i);for(const s in this.nativeHandlers)c(s,"",h=>this.nativeHandlers[s](x(x({},this.state.shared),{},{event:h,args:e})),void 0,!0)}for(const c in n)n[c]=nt(...n[c]);if(!i)return n;for(const c in n){const{device:s,capture:h,passive:_}=qe(c);this._targetEventStore.add(i,s,"",n[c],{capture:h,passive:_})}}}}function X(r,e){r.gestures.add(e),r.gestureEventStores[e]=new Ve(r,e),r.gestureTimeoutStores[e]=new Ct}function Ot(r,e){e.drag&&X(r,"drag"),e.wheel&&X(r,"wheel"),e.scroll&&X(r,"scroll"),e.move&&X(r,"move"),e.pinch&&X(r,"pinch"),e.hover&&X(r,"hover")}const $e=(r,e,t)=>(n,i,c,s={},h=!1)=>{var _,S;const u=(_=s.capture)!==null&&_!==void 0?_:e.capture,C=(S=s.passive)!==null&&S!==void 0?S:e.passive;let T=h?n:Ye(n,i,u);t&&C&&(T+="Passive"),r[T]=r[T]||[],r[T].push(c)};function Pt(r,e={},t,n){const i=E.useMemo(()=>new kt(r),[]);if(i.applyHandlers(r,n),i.applyConfig(e,t),E.useEffect(i.effect.bind(i)),E.useEffect(()=>i.clean.bind(i),[]),e.target===void 0)return i.bind.bind(i)}function Nt(r,e){return xt(_t),Pt({drag:r},e||{},"drag")}const he="RSC::Event";function Mt(){const r=E.useRef(null);function e(n){E.useEffect(()=>{r.current||(r.current=document.createElement("div"));function i(c){n(c.detail)}if(r.current)return r.current.addEventListener(he,i,!1),()=>{var c;(c=r.current)==null||c.removeEventListener(he,i,!1)}},[n])}function t(n){if(r.current){const i=new CustomEvent(he,{detail:n});r.current.dispatchEvent(i)}}return{useListenToCustomEvent:e,emitEvent:t}}function At(r){const{left:e,right:t,top:n,bottom:i}=r.getBoundingClientRect(),{innerWidth:c,innerHeight:s}=window;return e<0||n<0?{isOut:!0,direction:"start"}:Math.floor(t)>Math.floor(c)||Math.floor(i)>Math.floor(s)?{isOut:!0,direction:"end"}:{isOut:!1,direction:null}}function K(r){return parseFloat(r.toFixed(2))}function Re(r){process.env.NODE_ENV!=="production"&&console.warn(r)}function Lt(r){if(!r||r.trim()==="")return"";let e="",t=!1,n=!0;for(let i=0;i<r.length;i++){const c=r[i];if(c==="$"&&r[i+1]==="{"){t=!0,e+=c;continue}if(t&&c==="}"){t=!1,e+=c,n=!0;continue}if(t){e+=c;continue}if(/\s/.test(c)){if(n)continue;let s=i+1;for(;s<r.length&&/\s/.test(r[s]);)s++;if(s<r.length&&/[{:;,}]/.test(r[s]))continue;e+=" ",n=!0;continue}/[{:;,]/.test(c)?n=!0:n=!1,e+=c}return e}function Vt({init:r=!0,items:e,slideType:t="fixed",scrollAmount:n,withLoop:i=!1,enableGestures:c=!0,carouselAxis:s="x",slideWhenDragThresholdIsReached:h=!0,scrollAmountType:_,fadeIn:S=!1,initialActiveItem:u}){const[C,T]=E.useState(!1),V=E.useRef([]),F=E.useRef(!1),D=E.useRef(0),O=_??"slide",A=i?[...e.map(o=>({...o,id:`prev-repeated-item-${o.id}`})),...e,...e.map(o=>({...o,id:`next-repeated-item-${o.id}`}))]:e,Q=E.useRef(n),Z=E.useRef(0),b=E.useId().replace(/:/g,""),se=E.useRef(null),w=E.useRef(null),oe=E.useRef(0),v=E.useRef(!0),g=E.useRef(!1),a=E.useRef(0),[R,ce]=ye.useSpring(()=>({value:0,onChange({value:o}){(t==="fixed"||t==="fluid")&&(s==="x"?w.current.style.transform=`translate3d(${o.value}px, 0px, 0px)`:w.current.style.transform=`translate3d(0px, ${o.value}px, 0px)`),t==="freeScroll"&&(w.current[s==="x"?"scrollLeft":"scrollTop"]=Math.abs(o.value))}}),[s]),{useListenToCustomEvent:$t,emitEvent:W}=Mt();function y(){const{totalStartEndGutterCssVar:o}=pe();return K(Q.current??0-o)}function z(){return w.current[s==="x"?"scrollWidth":"scrollHeight"]-se.current.getBoundingClientRect()[s==="x"?"width":"height"]}function ee(o){o&&V.current.push(o),Re("The carousel can't be initialized. List of errors:"),console.table(V.current)}function Rt(){return t==="freeScroll"?{onWheel(){R.value.stop()},onScroll(o){const f=o.currentTarget,d=s==="x"?f.scrollLeft:f.scrollTop,m=s==="x"?f.scrollWidth-f.clientWidth:f.scrollHeight-f.clientHeight;d===0?v.current=!0:d===m?g.current=!0:(v.current=!1,g.current=!1)}}:{}}function pe(){let o=0,f=0,d=0;const m=getComputedStyle(document.documentElement).getPropertyValue(`--${b}-react-spring-carousel-item-gutter`),l=getComputedStyle(document.documentElement).getPropertyValue(`--${b}-react-spring-carousel-items-per-slide`),p=getComputedStyle(document.documentElement).getPropertyValue(`--${b}-react-spring-carousel-item-gutter`);return p.includes("px")&&(o=Number(p.replace("px",""))),d=Number(l)||1,m.includes("px")&&(f=Number(m.replace("px",""))),{totalGutterCssVar:o,totalStartEndGutterCssVar:f,itemsPerSlide:d}}function ae({type:o,actionType:f,newActiveItem:d,shouldAnimate:m=!0}){var U,H,te,ue,je,Be,Ge;let l=0,p=R.value.get();if(v.current=!1,g.current=!1,t==="fixed"){const L=a.current;if(o==="prev"&&(a.current=d??a.current-1),o==="next"&&(a.current=d??a.current+1),i&&O==="group"&&D.current>1&&o==="next"){const I=e.length/D.current,G=Math.ceil(I)-1===a.current,Y=Math.ceil(I)===a.current;G&&(g.current=!0),l=-(a.current*y()),Y&&(a.current=0,p=R.value.get()+y()*I,l=0,g.current=!1,v.current=!0)}if(i&&O==="group"&&D.current>1&&o==="prev"){const I=e.length/D.current,G=a.current===0,Y=a.current===-1;l=-(a.current*y()),G&&(v.current=!0),Y&&(v.current=!1,g.current=!0,a.current=I-1,p=R.value.get()-y()*I,l=-y()*I+y())}if(!i&&O==="group"&&D.current>1){const I=e.length/D.current,G=2%I!==0,Y=Math.ceil(I-1)===a.current,be=a.current===0;l=-(a.current*y()),be&&(v.current=!0),Y&&(g.current=!0,G&&(l=-z()))}if(i&&o==="next"&&(O==="slide"||O==="group"&&D.current===1)){const I=((U=e[a.current])==null?void 0:U.id)===e[e.length-1].id,G=A[e.length+a.current].id.includes("repeated-item");I&&(g.current=!0),G&&(a.current=0,p=R.value.get()+y()*e.length,g.current=!1,v.current=!0),l=-(a.current*y())}if(i&&o==="prev"&&(O==="slide"||O==="group"&&D.current===1)){const I=A.findIndex(be=>be.id===e[L].id),G=((H=e[a.current])==null?void 0:H.id)===e[0].id,Y=A[I-1].id.includes("repeated-item");G&&(v.current=!0),Y&&(v.current=!1,g.current=!0,a.current=e.length-1,p=R.value.get()-y()*e.length),l=-(a.current*y())}!i&&O==="slide"&&(((te=e[a.current+1])==null?void 0:te.id)===e[e.length-1].id?g.current=!0:a.current===0?v.current=!0:(v.current=!1,g.current=!1),l=-(a.current*y()),o==="next"&&Math.abs(l)>z()&&(g.current=!0,l=-z())),W({eventName:"onSlideStartChange",sliceActionType:f,slideDirection:o,nextItem:{index:a.current,id:e[a.current].id,startReached:v.current,endReached:g.current}})}if(t==="fluid"){if(o==="prev"&&(a.current=d??a.current-1),o==="next"&&(a.current=d??a.current+1),l=-(a.current*y()),o==="next"&&i){const L=((ue=e[a.current])==null?void 0:ue.id)===e[e.length-1].id,I=A[e.length+a.current].id.includes("repeated-item");L&&(g.current=!0),I&&(a.current=0,p=R.value.get()+y()*e.length,l=0,g.current=!1,v.current=!0)}if(o==="next"&&!i&&(Math.abs(l)>z()?(g.current=!0,l=-z()):(v.current=!1,g.current=!1)),o==="prev"&&!i&&((je=e[a.current])==null?void 0:je.id)===e[0].id&&(v.current=!0),o==="prev"&&i){const L=((Be=e[a.current])==null?void 0:Be.id)===e[0].id,I=(Ge=A[e.length+a.current])==null?void 0:Ge.id.includes("repeated-item");L&&(v.current=!0),I&&(a.current=e.length-1,p=R.value.get()-y()*e.length,l=-(y()*e.length-y()),v.current=!1,g.current=!0)}W({eventName:"onSlideStartChange",sliceActionType:f,slideDirection:o,nextItem:{startReached:v.current,endReached:g.current,index:0,id:""}})}if(t==="freeScroll"){const L=w.current[s==="x"?"scrollLeft":"scrollTop"],I=s==="x"?w.current.scrollWidth-w.current.clientWidth:w.current.scrollHeight-w.current.clientHeight;p=L,o==="prev"&&(l=p-y(),l<0&&(l=0),p-y()<=0&&(v.current=!0),W({eventName:"onSlideStartChange",sliceActionType:f,slideDirection:o,nextItem:{index:0,id:"",startReached:v.current,endReached:!1}})),o==="next"&&(l=p+y(),l>I&&(l=I),p+y()>=I&&(g.current=!0),W({eventName:"onSlideStartChange",sliceActionType:f,slideDirection:o,nextItem:{index:0,id:"",startReached:!1,endReached:g.current}}))}const N=K(p),j=K(l);oe.current=j,ce.start({from:{value:N},to:{value:j},immediate:!m,onRest({finished:L}){L&&t==="fixed"&&W({eventName:"onSlideChangeComplete",sliceActionType:f,slideDirection:o,currentItem:{index:a.current,id:e[a.current].id,startReached:v.current,endReached:g.current}}),L&&t==="fluid"&&W({eventName:"onSlideChangeComplete",sliceActionType:f,slideDirection:o,currentItem:{index:0,id:"",startReached:v.current,endReached:g.current}})}})}function ge(o,f,d=!0){if(!C){ee("Carousel not initialized yet: slideToNextItem");return}if(o==="drag"||t==="fixed"&&i||t==="fixed"&&!i&&!g.current){const m=f??a.current+1;ae({type:"next",actionType:o,newActiveItem:m,shouldAnimate:d})}(t==="fluid"&&i||t==="fluid"&&!i&&!g.current||t==="freeScroll"&&!g.current)&&ae({type:"next",actionType:o,shouldAnimate:d})}function me(o,f,d=!0){if(!C){ee("Carousel not initialized yet: slideToPrevItem");return}if(o==="drag"||t==="fixed"&&i||t==="fixed"&&!i&&!v.current){const m=f??a.current-1;ae({type:"prev",actionType:o,newActiveItem:m,shouldAnimate:d})}(t==="fluid"&&i||t==="fluid"&&!i&&!v.current||t==="freeScroll"&&!v.current)&&ae({type:"prev",actionType:o,shouldAnimate:d})}function ve(o,f=!0){let d=0;typeof o=="string"?d=e.findIndex(m=>m.id===o):d=o,d>a.current&&ge("click",d,f),d<a.current&&me("click",d,f)}function jt({getContainer:o,activeItem:f,updateTotalValue:d}){const m=o();if(!(m instanceof HTMLElement)){console.warn(`Container is not a valid html element: container is ${m}`);return}const l=m.children[f];if(l){const p=m[s==="x"?"scrollWidth":"scrollHeight"]-m.getBoundingClientRect()[s==="x"?"width":"height"],j=l.offsetLeft+l.offsetWidth/2-m.clientWidth/2,U=At(l);if(U.isOut){const H=U.direction==="start"?j<0?0:j:j>p?p:j,te=m[s==="x"?"scrollLeft":"scrollTop"];new ye.Controller({from:{value:te},to:{value:d?d({from:te,to:H,itemOutOfViewport:U}):H},onChange({value:ue}){m[s==="x"?"scrollLeft":"scrollTop"]=ue.value}})}}}const Bt=Nt(o=>{if(!C){ee();return}const f=o.dragging,d=o.offset[s==="x"?0:1],m=o.movement[s==="x"?0:1],l=m>Z.current,p=m<-Z.current,N=o.velocity;f&&(W({...o,eventName:"onDrag",slideActionType:"drag"}),ce.start({value:d,immediate:!0,config:{velocity:N}}),h&&(l||p)&&o.cancel()),o.last&&(l?me("drag"):p?ge("drag"):ce.start({value:oe.current,config:{velocity:N}}))},{enabled:c&&t!=="freeScroll",axis:s,rubberband:!i,...i?{}:{bounds:()=>({right:0,left:-z(),top:-z(),bottom:0})},from:()=>[R.value.get(),R.value.get()]});return E.useEffect(()=>{function o(){document.hidden?(F.current=!0,T(!1)):(F.current=!1,T(!0))}function f(){if(w.current.style.top="0px",w.current.style.left="0px",!(t==="fixed"&&!i||t==="freeScroll"||t==="fluid"))if(t==="fixed"&&O==="group"&&D.current>1){const p=e.length*3/D.current;w.current.style[s==="x"?"left":"top"]=`calc(-${K(y()*p/3)}px)`}else w.current.style[s==="x"?"left":"top"]=`calc(-${K(y()*A.length/3)}px)`}function d(){m(),f(),ce.start({immediate:!0,value:-(a.current*y())})}function m(){const p=w.current.children[0];let N=0;const j=t==="fixed"&&O==="group"&&D.current>1;j?N=K(w.current.getBoundingClientRect()[s==="x"?"width":"height"]):N=K(p.getBoundingClientRect()[s==="x"?"width":"height"]);const{totalGutterCssVar:U,totalStartEndGutterCssVar:H}=pe();return N+=U,j&&(N-=H),Q.current=N,N}function l(){V.current=[];const{itemsPerSlide:p}=pe();if(console.log({_itemsPerSlide:p}),D.current=p,A.length===0&&Re("Init is true but no items are available; carousel will not be initialized"),t==="fixed"&&O==="group"&&e.length%D.current!==0&&V.current.push("When using scrollAmountType='group' and itemsPerSlide={number>1} make sure that itemsPerSlides is divisible by the total quantity of items otherwise the carousel won't initialize."),t==="fluid"&&_!==void 0&&V.current.push('scrollAmountType="group" is not available for slideType="fluid"; please change one of them.'),V.current.length>0){ee();return}m(),f(),Z.current=y()/4,T(!0)}if(typeof r=="function")r().then(p=>{if(p)return l(),u!==void 0&&ve(u,!1),window.addEventListener("resize",d),document.addEventListener("visibilitychange",o),()=>{document.removeEventListener("visibilitychange",o),window.removeEventListener("resize",d)}});else{if(r)return l(),window.addEventListener("resize",d),document.addEventListener("visibilitychange",o),()=>{document.removeEventListener("visibilitychange",o),window.removeEventListener("resize",d)};T(!1)}},[Q,r,t,i,s]),E.useEffect(()=>{u!==void 0&&C&&ve(u,!1)},[C,u]),{carouselFragment:$.jsxs($.Fragment,{children:[$.jsx("style",{id:`carousel-container-${b}`,dangerouslySetInnerHTML:{__html:Lt(`
|
|
2
2
|
:root {
|
|
3
|
-
--${
|
|
4
|
-
--${
|
|
5
|
-
--${
|
|
3
|
+
--${b}-react-spring-carousel-item-gutter: 0px;
|
|
4
|
+
--${b}-react-spring-carousel-start-end-gutter: 0px;
|
|
5
|
+
--${b}-react-spring-carousel-items-per-slide: 1;
|
|
6
6
|
}
|
|
7
|
-
.carousel-${
|
|
7
|
+
.carousel-${b} {
|
|
8
8
|
display: flex;
|
|
9
9
|
overflow: hidden;
|
|
10
10
|
width: 100%;
|
|
11
|
-
height:
|
|
12
|
-
padding: ${s==="x"?`0px var(--${
|
|
11
|
+
height: 100%;
|
|
12
|
+
padding: ${s==="x"?`0px var(--${b}-react-spring-carousel-start-end-gutter)`:`var(--${b}-react-spring-carousel-start-end-gutter) 0px`};
|
|
13
13
|
}
|
|
14
|
-
.carousel-${
|
|
14
|
+
.carousel-${b} .use-spring-carousel-track {
|
|
15
15
|
display: flex;
|
|
16
16
|
width: 100%;
|
|
17
17
|
position: relative;
|
|
18
18
|
flex-direction: ${s==="x"?"row":"column"};
|
|
19
|
-
gap: var(--${
|
|
19
|
+
gap: var(--${b}-react-spring-carousel-item-gutter);
|
|
20
20
|
touch-action: ${c?s==="x"?"pan-y":"pan-x":"auto"};
|
|
21
21
|
overflow-x: ${t==="freeScroll"&&s==="x"?"auto":"initial"};
|
|
22
22
|
overflow-y: ${t==="freeScroll"&&s==="y"?"auto":"initial"};
|
|
23
23
|
}
|
|
24
|
-
.carousel-${
|
|
24
|
+
.carousel-${b} .use-spring-carousel-track::after {
|
|
25
25
|
content: "";
|
|
26
26
|
visibility: hidden;
|
|
27
27
|
display: block;
|
|
28
|
-
width: var(--${
|
|
28
|
+
width: var(--${b}-react-spring-carousel-start-end-gutter);
|
|
29
29
|
flex-shrink: 0;
|
|
30
30
|
}
|
|
31
|
-
.carousel-${
|
|
31
|
+
.carousel-${b} .use-spring-carousel-item {
|
|
32
32
|
position: relative;
|
|
33
33
|
display: flex;
|
|
34
34
|
width: 100%;
|
|
35
35
|
height: 100%;
|
|
36
|
-
${t==="fixed"?`flex: 0 0 calc(100% / var(--${
|
|
36
|
+
${t==="fixed"?`flex: 0 0 calc(100% / var(--${b}-react-spring-carousel-items-per-slide) - calc(var(--${b}-react-spring-carousel-item-gutter) * (var(--${b}-react-spring-carousel-items-per-slide) - 1) / var(--${b}-react-spring-carousel-items-per-slide)));`:""}
|
|
37
37
|
}
|
|
38
|
-
${S?`.carousel-${
|
|
38
|
+
${S?`.carousel-${b} .use-spring-carousel-item {
|
|
39
39
|
position: absolute;
|
|
40
40
|
top: 0;
|
|
41
41
|
left: 0;
|
|
@@ -43,6 +43,6 @@
|
|
|
43
43
|
height: 100%;
|
|
44
44
|
opacity: 0;
|
|
45
45
|
}
|
|
46
|
-
.carousel-${
|
|
46
|
+
.carousel-${b} .use-spring-carousel-item:first-child {
|
|
47
47
|
opacity: 1;
|
|
48
|
-
}`.trim():""}`)}}),$.jsx("div",{className:`use-spring-carousel-container carousel-${
|
|
48
|
+
}`.trim():""}`)}}),$.jsx("div",{className:`use-spring-carousel-container carousel-${b}`,ref:se,"data-carousel-direction":s,children:$.jsx("div",{className:"use-spring-carousel-track",...Bt(),ref:w,...Rt(),children:A.map((o,f)=>$.jsx("div",{className:"use-spring-carousel-item",id:o.id,children:o.renderItem},`${o.id}-${f}`))})})]}),useListenToCustomEvent:$t,slideToNextItem:()=>ge("click"),slideToPrevItem:()=>me("click"),slideToIem:(o,f=!0)=>{if(!C){ee();return}ve(o,f)},handleThumbsContainerScroll:jt,carouselId:b}}B.useSpringCarousel=Vt,Object.defineProperty(B,Symbol.toStringTag,{value:"Module"})});
|