react-spring-carousel 3.0.0-beta-2.0.101 → 3.0.0-beta-2.0.103

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 CHANGED
@@ -1,7 +1,7 @@
1
- import { jsxs as Mt, jsx as tt } from "react/jsx-runtime";
2
- import { useSpringRef as Vt, useSpring as Et } from "@react-spring/web";
3
- import et, { useRef as $, useEffect as U, useState as Rt } from "react";
4
- function jt(e, t, r) {
1
+ import { jsxs as jt, jsx as tt } from "react/jsx-runtime";
2
+ import { useSpringRef as Bt, useSpring as St } from "@react-spring/web";
3
+ import et, { useRef as $, useEffect as U, useState as Ut } from "react";
4
+ function Kt(e, t, r) {
5
5
  return Math.max(t, Math.min(e, r));
6
6
  }
7
7
  const b = {
@@ -21,17 +21,17 @@ const b = {
21
21
  e[0] -= t[0], e[1] -= t[1];
22
22
  }
23
23
  };
24
- function ft(e, t, r) {
24
+ function ht(e, t, r) {
25
25
  return t === 0 || Math.abs(t) === 1 / 0 ? Math.pow(e, r * 5) : e * t * r / (t + r * e);
26
26
  }
27
- function dt(e, t, r, n = 0.15) {
28
- return n === 0 ? jt(e, t, r) : e < t ? -ft(t - e, r - t, n) + t : e > r ? +ft(e - r, r - t, n) + r : e;
27
+ function pt(e, t, r, n = 0.15) {
28
+ return n === 0 ? Kt(e, t, r) : e < t ? -ht(t - e, r - t, n) + t : e > r ? +ht(e - r, r - t, n) + r : e;
29
29
  }
30
- function Bt(e, [t, r], [n, s]) {
30
+ function Gt(e, [t, r], [n, s]) {
31
31
  const [[o, a], [c, f]] = e;
32
- return [dt(t, o, a, n), dt(r, c, f, s)];
32
+ return [pt(t, o, a, n), pt(r, c, f, s)];
33
33
  }
34
- function Ut(e, t) {
34
+ function zt(e, t) {
35
35
  if (typeof e != "object" || e === null) return e;
36
36
  var r = e[Symbol.toPrimitive];
37
37
  if (r !== void 0) {
@@ -41,19 +41,19 @@ function Ut(e, t) {
41
41
  }
42
42
  return (t === "string" ? String : Number)(e);
43
43
  }
44
- function Kt(e) {
45
- var t = Ut(e, "string");
44
+ function Wt(e) {
45
+ var t = zt(e, "string");
46
46
  return typeof t == "symbol" ? t : String(t);
47
47
  }
48
48
  function S(e, t, r) {
49
- return t = Kt(t), t in e ? Object.defineProperty(e, t, {
49
+ return t = Wt(t), t in e ? Object.defineProperty(e, t, {
50
50
  value: r,
51
51
  enumerable: !0,
52
52
  configurable: !0,
53
53
  writable: !0
54
54
  }) : e[t] = r, e;
55
55
  }
56
- function ht(e, t) {
56
+ function mt(e, t) {
57
57
  var r = Object.keys(e);
58
58
  if (Object.getOwnPropertySymbols) {
59
59
  var n = Object.getOwnPropertySymbols(e);
@@ -66,15 +66,15 @@ function ht(e, t) {
66
66
  function p(e) {
67
67
  for (var t = 1; t < arguments.length; t++) {
68
68
  var r = arguments[t] != null ? arguments[t] : {};
69
- t % 2 ? ht(Object(r), !0).forEach(function(n) {
69
+ t % 2 ? mt(Object(r), !0).forEach(function(n) {
70
70
  S(e, n, r[n]);
71
- }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(r)) : ht(Object(r)).forEach(function(n) {
71
+ }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(r)) : mt(Object(r)).forEach(function(n) {
72
72
  Object.defineProperty(e, n, Object.getOwnPropertyDescriptor(r, n));
73
73
  });
74
74
  }
75
75
  return e;
76
76
  }
77
- const Tt = {
77
+ const It = {
78
78
  pointer: {
79
79
  start: "down",
80
80
  change: "move",
@@ -96,63 +96,63 @@ const Tt = {
96
96
  end: "end"
97
97
  }
98
98
  };
99
- function pt(e) {
99
+ function gt(e) {
100
100
  return e ? e[0].toUpperCase() + e.slice(1) : "";
101
101
  }
102
- const Gt = ["enter", "leave"];
103
- function zt(e = !1, t) {
104
- return e && !Gt.includes(t);
102
+ const Yt = ["enter", "leave"];
103
+ function Ft(e = !1, t) {
104
+ return e && !Yt.includes(t);
105
105
  }
106
- function Wt(e, t = "", r = !1) {
107
- const n = Tt[e], s = n && n[t] || t;
108
- return "on" + pt(e) + pt(s) + (zt(r, s) ? "Capture" : "");
106
+ function Ht(e, t = "", r = !1) {
107
+ const n = It[e], s = n && n[t] || t;
108
+ return "on" + gt(e) + gt(s) + (Ft(r, s) ? "Capture" : "");
109
109
  }
110
- const Yt = ["gotpointercapture", "lostpointercapture"];
111
- function Ft(e) {
110
+ const Xt = ["gotpointercapture", "lostpointercapture"];
111
+ function qt(e) {
112
112
  let t = e.substring(2).toLowerCase();
113
113
  const r = !!~t.indexOf("passive");
114
114
  r && (t = t.replace("passive", ""));
115
- const n = Yt.includes(t) ? "capturecapture" : "capture", s = !!~t.indexOf(n);
115
+ const n = Xt.includes(t) ? "capturecapture" : "capture", s = !!~t.indexOf(n);
116
116
  return s && (t = t.replace("capture", "")), {
117
117
  device: t,
118
118
  capture: s,
119
119
  passive: r
120
120
  };
121
121
  }
122
- function Ht(e, t = "") {
123
- const r = Tt[e], n = r && r[t] || t;
122
+ function Jt(e, t = "") {
123
+ const r = It[e], n = r && r[t] || t;
124
124
  return e + n;
125
125
  }
126
126
  function X(e) {
127
127
  return "touches" in e;
128
128
  }
129
- function St(e) {
129
+ function kt(e) {
130
130
  return X(e) ? "touch" : "pointerType" in e ? e.pointerType : "mouse";
131
131
  }
132
- function Xt(e) {
132
+ function Qt(e) {
133
133
  return Array.from(e.touches).filter((t) => {
134
134
  var r, n;
135
135
  return t.target === e.currentTarget || ((r = e.currentTarget) === null || r === void 0 || (n = r.contains) === null || n === void 0 ? void 0 : n.call(r, t.target));
136
136
  });
137
137
  }
138
- function qt(e) {
138
+ function Zt(e) {
139
139
  return e.type === "touchend" || e.type === "touchcancel" ? e.changedTouches : e.targetTouches;
140
140
  }
141
- function It(e) {
142
- return X(e) ? qt(e)[0] : e;
141
+ function Ct(e) {
142
+ return X(e) ? Zt(e)[0] : e;
143
143
  }
144
- function Jt(e) {
145
- return Xt(e).map((t) => t.identifier);
144
+ function te(e) {
145
+ return Qt(e).map((t) => t.identifier);
146
146
  }
147
147
  function rt(e) {
148
- const t = It(e);
148
+ const t = Ct(e);
149
149
  return X(e) ? t.identifier : t.pointerId;
150
150
  }
151
- function mt(e) {
152
- const t = It(e);
151
+ function vt(e) {
152
+ const t = Ct(e);
153
153
  return [t.clientX, t.clientY];
154
154
  }
155
- function Qt(e) {
155
+ function ee(e) {
156
156
  const t = {};
157
157
  if ("buttons" in e && (t.buttons = e.buttons), "shiftKey" in e) {
158
158
  const {
@@ -173,21 +173,21 @@ function Qt(e) {
173
173
  function H(e, ...t) {
174
174
  return typeof e == "function" ? e(...t) : e;
175
175
  }
176
- function Zt() {
176
+ function re() {
177
177
  }
178
- function te(...e) {
179
- return e.length === 0 ? Zt : e.length === 1 ? e[0] : function() {
178
+ function ne(...e) {
179
+ return e.length === 0 ? re : e.length === 1 ? e[0] : function() {
180
180
  let t;
181
181
  for (const r of e)
182
182
  t = r.apply(this, arguments) || t;
183
183
  return t;
184
184
  };
185
185
  }
186
- function gt(e, t) {
186
+ function yt(e, t) {
187
187
  return Object.assign({}, t, e || {});
188
188
  }
189
- const ee = 32;
190
- class re {
189
+ const se = 32;
190
+ class ie {
191
191
  constructor(t, r, n) {
192
192
  this.ctrl = t, this.args = r, this.key = n, this.state || (this.state = {}, this.computeValues([0, 0]), this.computeInitial(), this.init && this.init(), this.reset());
193
193
  }
@@ -244,7 +244,7 @@ class re {
244
244
  } = this;
245
245
  r.args = this.args;
246
246
  let o = 0;
247
- if (t && (r.event = t, n.preventDefault && t.cancelable && r.event.preventDefault(), r.type = t.type, s.touches = this.ctrl.pointerIds.size || this.ctrl.touchIds.size, s.locked = !!document.pointerLockElement, Object.assign(s, Qt(t)), s.down = s.pressed = s.buttons % 2 === 1 || s.touches > 0, o = t.timeStamp - r.timeStamp, r.timeStamp = t.timeStamp, r.elapsedTime = r.timeStamp - r.startTime), r._active) {
247
+ if (t && (r.event = t, n.preventDefault && t.cancelable && r.event.preventDefault(), r.type = t.type, s.touches = this.ctrl.pointerIds.size || this.ctrl.touchIds.size, s.locked = !!document.pointerLockElement, Object.assign(s, ee(t)), s.down = s.pressed = s.buttons % 2 === 1 || s.touches > 0, o = t.timeStamp - r.timeStamp, r.timeStamp = t.timeStamp, r.elapsedTime = r.timeStamp - r.startTime), r._active) {
248
248
  const A = r._delta.map(Math.abs);
249
249
  b.addTo(r._distance, A);
250
250
  }
@@ -263,10 +263,10 @@ class re {
263
263
  this.restrictToAxis && !r._blocked && this.restrictToAxis(m);
264
264
  const I = r.offset, D = r._active && !r._blocked || r.active;
265
265
  D && (r.first = r._active && !r.active, r.last = !r._active && r.active, r.active = s[this.ingKey] = r._active, t && (r.first && ("bounds" in n && (r._bounds = H(n.bounds, r)), this.setup && this.setup()), r.movement = m, this.computeOffset()));
266
- const [O, w] = r.offset, [[x, M], [g, k]] = r._bounds;
267
- r.overflow = [O < x ? -1 : O > M ? 1 : 0, w < g ? -1 : w > k ? 1 : 0], r._movementBound[0] = r.overflow[0] ? r._movementBound[0] === !1 ? r._movement[0] : r._movementBound[0] : !1, r._movementBound[1] = r.overflow[1] ? r._movementBound[1] === !1 ? r._movement[1] : r._movementBound[1] : !1;
268
- const N = r._active ? n.rubberband || [0, 0] : [0, 0];
269
- if (r.offset = Bt(r._bounds, r.offset, N), r.delta = b.sub(r.offset, I), this.computeMovement(), D && (!r.last || o > ee)) {
266
+ const [O, x] = r.offset, [[w, M], [g, k]] = r._bounds;
267
+ r.overflow = [O < w ? -1 : O > M ? 1 : 0, x < g ? -1 : x > k ? 1 : 0], r._movementBound[0] = r.overflow[0] ? r._movementBound[0] === !1 ? r._movement[0] : r._movementBound[0] : !1, r._movementBound[1] = r.overflow[1] ? r._movementBound[1] === !1 ? r._movement[1] : r._movementBound[1] : !1;
268
+ const L = r._active ? n.rubberband || [0, 0] : [0, 0];
269
+ if (r.offset = Gt(r._bounds, r.offset, L), r.delta = b.sub(r.offset, I), this.computeMovement(), D && (!r.last || o > se)) {
270
270
  r.delta = b.sub(r.offset, I);
271
271
  const A = r.delta.map(Math.abs);
272
272
  b.addTo(r.distance, A), r.direction = r.delta.map(Math.sign), r._direction = r._delta.map(Math.sign), !r.first && o > 0 && (r.velocity = [A[0] / o, A[1] / o], r.timeDelta = o);
@@ -284,14 +284,14 @@ class re {
284
284
  this.eventStore.clean(), this.timeoutStore.clean();
285
285
  }
286
286
  }
287
- function ne([e, t], r) {
287
+ function oe([e, t], r) {
288
288
  const n = Math.abs(e), s = Math.abs(t);
289
289
  if (n > s && n > r)
290
290
  return "x";
291
291
  if (s > n && s > r)
292
292
  return "y";
293
293
  }
294
- class se extends re {
294
+ class ae extends ie {
295
295
  constructor(...t) {
296
296
  super(...t), S(this, "aliasKey", "xy");
297
297
  }
@@ -310,8 +310,8 @@ class se extends re {
310
310
  axisIntent(t) {
311
311
  const r = this.state, n = this.config;
312
312
  if (!r.axis && t) {
313
- const s = typeof n.axisThreshold == "object" ? n.axisThreshold[St(t)] : n.axisThreshold;
314
- r.axis = ne(r._movement, s);
313
+ const s = typeof n.axisThreshold == "object" ? n.axisThreshold[kt(t)] : n.axisThreshold;
314
+ r.axis = oe(r._movement, s);
315
315
  }
316
316
  r._blocked = (n.lockDirection || !!n.axis) && !r.axis || !!n.axis && n.axis !== r.axis;
317
317
  }
@@ -327,7 +327,7 @@ class se extends re {
327
327
  }
328
328
  }
329
329
  }
330
- const vt = (e) => e, yt = 0.15, ot = {
330
+ const bt = (e) => e, _t = 0.15, ot = {
331
331
  enabled(e = !0) {
332
332
  return e;
333
333
  },
@@ -343,7 +343,7 @@ const vt = (e) => e, yt = 0.15, ot = {
343
343
  rubberband(e = 0) {
344
344
  switch (e) {
345
345
  case !0:
346
- return [yt, yt];
346
+ return [_t, _t];
347
347
  case !1:
348
348
  return [0, 0];
349
349
  default:
@@ -357,13 +357,13 @@ const vt = (e) => e, yt = 0.15, ot = {
357
357
  transform(e, t, r) {
358
358
  const n = e || r.shared.transform;
359
359
  if (this.hasCustomTransform = !!n, process.env.NODE_ENV === "development") {
360
- const s = n || vt;
360
+ const s = n || bt;
361
361
  return (o) => {
362
362
  const a = s(o);
363
363
  return (!isFinite(a[0]) || !isFinite(a[1])) && console.warn(`[@use-gesture]: config.transform() must produce a valid result, but it was: [${a[0]},${[1]}]`), a;
364
364
  };
365
365
  }
366
- return n || vt;
366
+ return n || bt;
367
367
  },
368
368
  threshold(e) {
369
369
  return b.toVector(e, 0);
@@ -386,13 +386,13 @@ process.env.NODE_ENV === "development" && Object.assign(ot, {
386
386
  return NaN;
387
387
  }
388
388
  });
389
- const ie = 0, K = p(p({}, ot), {}, {
389
+ const ce = 0, K = p(p({}, ot), {}, {
390
390
  axis(e, t, {
391
391
  axis: r
392
392
  }) {
393
393
  if (this.lockDirection = r === "lock", !this.lockDirection) return r;
394
394
  },
395
- axisThreshold(e = ie) {
395
+ axisThreshold(e = ce) {
396
396
  return e;
397
397
  },
398
398
  bounds(e = {}) {
@@ -410,13 +410,13 @@ const ie = 0, K = p(p({}, ot), {}, {
410
410
  } = e;
411
411
  return [[t, r], [n, s]];
412
412
  }
413
- }), bt = {
413
+ }), xt = {
414
414
  ArrowRight: (e, t = 1) => [e * t, 0],
415
415
  ArrowLeft: (e, t = 1) => [-1 * e * t, 0],
416
416
  ArrowUp: (e, t = 1) => [0, -1 * e * t],
417
417
  ArrowDown: (e, t = 1) => [0, e * t]
418
418
  };
419
- class oe extends se {
419
+ class ue extends ae {
420
420
  constructor(...t) {
421
421
  super(...t), S(this, "ingKey", "dragging");
422
422
  }
@@ -453,7 +453,7 @@ class oe extends se {
453
453
  const r = this.config, n = this.state;
454
454
  if (t.buttons != null && (Array.isArray(r.pointerButtons) ? !r.pointerButtons.includes(t.buttons) : r.pointerButtons !== -1 && r.pointerButtons !== t.buttons)) return;
455
455
  const s = this.ctrl.setEventIds(t);
456
- r.pointerCapture && t.target.setPointerCapture(t.pointerId), !(s && s.size > 1 && n._pointerActive) && (this.start(t), this.setupPointer(t), n._pointerId = rt(t), n._pointerActive = !0, this.computeValues(mt(t)), this.computeInitial(), r.preventScrollAxis && St(t) !== "mouse" ? (n._active = !1, this.setupScrollPrevention(t)) : r.delay > 0 ? (this.setupDelayTrigger(t), r.triggerAllEvents && (this.compute(t), this.emit())) : this.startPointerDrag(t));
456
+ r.pointerCapture && t.target.setPointerCapture(t.pointerId), !(s && s.size > 1 && n._pointerActive) && (this.start(t), this.setupPointer(t), n._pointerId = rt(t), n._pointerActive = !0, this.computeValues(vt(t)), this.computeInitial(), r.preventScrollAxis && kt(t) !== "mouse" ? (n._active = !1, this.setupScrollPrevention(t)) : r.delay > 0 ? (this.setupDelayTrigger(t), r.triggerAllEvents && (this.compute(t), this.emit())) : this.startPointerDrag(t));
457
457
  }
458
458
  startPointerDrag(t) {
459
459
  const r = this.state;
@@ -464,7 +464,7 @@ class oe extends se {
464
464
  if (!r._pointerActive) return;
465
465
  const s = rt(t);
466
466
  if (r._pointerId !== void 0 && s !== r._pointerId) return;
467
- const o = mt(t);
467
+ const o = vt(t);
468
468
  if (document.pointerLockElement === t.target ? r._delta = [t.movementX, t.movementY] : (r._delta = b.sub(o, r._values), this.computeValues(o)), b.addTo(r._movement, r._delta), this.compute(t), r._delayed && r.intentional) {
469
469
  this.timeoutStore.remove("dragDelay"), r.active = !1, this.startPointerDrag(t);
470
470
  return;
@@ -500,8 +500,8 @@ class oe extends se {
500
500
  else {
501
501
  const [c, f] = r._delta, [d, u] = r._movement, [_, m] = n.swipe.velocity, [I, D] = n.swipe.distance, O = n.swipe.duration;
502
502
  if (r.elapsedTime < O) {
503
- const w = Math.abs(c / r.timeDelta), x = Math.abs(f / r.timeDelta);
504
- w > _ && Math.abs(d) > I && (r.swipe[0] = Math.sign(c)), x > m && Math.abs(u) > D && (r.swipe[1] = Math.sign(f));
503
+ const x = Math.abs(c / r.timeDelta), w = Math.abs(f / r.timeDelta);
504
+ x > _ && Math.abs(d) > I && (r.swipe[0] = Math.sign(c)), w > m && Math.abs(u) > D && (r.swipe[1] = Math.sign(f));
505
505
  }
506
506
  }
507
507
  this.emit();
@@ -528,7 +528,7 @@ class oe extends se {
528
528
  this.state._preventScroll && t.cancelable && t.preventDefault();
529
529
  }
530
530
  setupScrollPrevention(t) {
531
- this.state._preventScroll = !1, ae(t);
531
+ this.state._preventScroll = !1, le(t);
532
532
  const r = this.eventStore.add(this.sharedConfig.window, "touch", "change", this.preventScroll.bind(this), {
533
533
  passive: !1
534
534
  });
@@ -540,14 +540,14 @@ class oe extends se {
540
540
  }, this.config.delay);
541
541
  }
542
542
  keyDown(t) {
543
- const r = bt[t.key];
543
+ const r = xt[t.key];
544
544
  if (r) {
545
545
  const n = this.state, s = t.shiftKey ? 10 : t.altKey ? 0.1 : 1;
546
546
  this.start(t), n._delta = r(this.config.keyboardDisplacement, s), n._keyboardActive = !0, b.addTo(n._movement, n._delta), this.compute(t), this.emit();
547
547
  }
548
548
  }
549
549
  keyUp(t) {
550
- t.key in bt && (this.state._keyboardActive = !1, this.setActive(), this.compute(t), this.emit());
550
+ t.key in xt && (this.state._keyboardActive = !1, this.setActive(), this.compute(t), this.emit());
551
551
  }
552
552
  bind(t) {
553
553
  const r = this.config.device;
@@ -557,23 +557,23 @@ class oe extends se {
557
557
  });
558
558
  }
559
559
  }
560
- function ae(e) {
560
+ function le(e) {
561
561
  "persist" in e && typeof e.persist == "function" && e.persist();
562
562
  }
563
563
  const G = typeof window < "u" && window.document && window.document.createElement;
564
- function kt() {
564
+ function Dt() {
565
565
  return G && "ontouchstart" in window;
566
566
  }
567
- function ce() {
568
- return kt() || G && window.navigator.maxTouchPoints > 1;
567
+ function fe() {
568
+ return Dt() || G && window.navigator.maxTouchPoints > 1;
569
569
  }
570
- function ue() {
570
+ function de() {
571
571
  return G && "onpointerdown" in window;
572
572
  }
573
- function le() {
573
+ function he() {
574
574
  return G && "exitPointerLock" in window.document;
575
575
  }
576
- function fe() {
576
+ function pe() {
577
577
  try {
578
578
  return "constructor" in GestureEvent;
579
579
  } catch {
@@ -582,16 +582,16 @@ function fe() {
582
582
  }
583
583
  const P = {
584
584
  isBrowser: G,
585
- gesture: fe(),
586
- touch: kt(),
587
- touchscreen: ce(),
588
- pointer: ue(),
589
- pointerLock: le()
590
- }, de = 250, he = 180, pe = 0.5, me = 50, ge = 250, ve = 10, _t = {
585
+ gesture: pe(),
586
+ touch: Dt(),
587
+ touchscreen: fe(),
588
+ pointer: de(),
589
+ pointerLock: he()
590
+ }, me = 250, ge = 180, ve = 0.5, ye = 50, be = 250, _e = 10, wt = {
591
591
  mouse: 0,
592
592
  touch: 0,
593
593
  pen: 8
594
- }, Ct = p(p({}, K), {}, {
594
+ }, $t = p(p({}, K), {}, {
595
595
  device(e, t, {
596
596
  pointer: {
597
597
  touch: r = !1,
@@ -604,7 +604,7 @@ const P = {
604
604
  preventScrollAxis(e, t, {
605
605
  preventScroll: r
606
606
  }) {
607
- if (this.preventScrollDelay = typeof r == "number" ? r : r || r === void 0 && e ? de : void 0, !(!P.touchscreen || r === !1))
607
+ if (this.preventScrollDelay = typeof r == "number" ? r : r || r === void 0 && e ? me : void 0, !(!P.touchscreen || r === !1))
608
608
  return e || (r !== void 0 ? "y" : void 0);
609
609
  },
610
610
  pointerCapture(e, t, {
@@ -625,9 +625,9 @@ const P = {
625
625
  return this.filterTaps = r, this.tapsThreshold = n, o;
626
626
  },
627
627
  swipe({
628
- velocity: e = pe,
629
- distance: t = me,
630
- duration: r = ge
628
+ velocity: e = ve,
629
+ distance: t = ye,
630
+ duration: r = be
631
631
  } = {}) {
632
632
  return {
633
633
  velocity: this.transform(b.toVector(e)),
@@ -638,7 +638,7 @@ const P = {
638
638
  delay(e = 0) {
639
639
  switch (e) {
640
640
  case !0:
641
- return he;
641
+ return ge;
642
642
  case !1:
643
643
  return 0;
644
644
  default:
@@ -646,13 +646,13 @@ const P = {
646
646
  }
647
647
  },
648
648
  axisThreshold(e) {
649
- return e ? p(p({}, _t), e) : _t;
649
+ return e ? p(p({}, wt), e) : wt;
650
650
  },
651
- keyboardDisplacement(e = ve) {
651
+ keyboardDisplacement(e = _e) {
652
652
  return e;
653
653
  }
654
654
  });
655
- process.env.NODE_ENV === "development" && Object.assign(Ct, {
655
+ process.env.NODE_ENV === "development" && Object.assign($t, {
656
656
  useTouch(e) {
657
657
  if (e !== void 0)
658
658
  throw Error("[@use-gesture]: `useTouch` option has been renamed to `pointer.touch`. Use it as in `{ pointer: { touch: true } }`.");
@@ -698,13 +698,13 @@ p(p({}, ot), {}, {
698
698
  angleBounds: n = {}
699
699
  }) {
700
700
  const s = (a) => {
701
- const c = gt(H(r, a), {
701
+ const c = yt(H(r, a), {
702
702
  min: -1 / 0,
703
703
  max: 1 / 0
704
704
  });
705
705
  return [c.min, c.max];
706
706
  }, o = (a) => {
707
- const c = gt(H(n, a), {
707
+ const c = yt(H(n, a), {
708
708
  min: -1 / 0,
709
709
  max: 1 / 0
710
710
  });
@@ -728,25 +728,25 @@ p(p({}, K), {}, {
728
728
  p(p({}, K), {}, {
729
729
  mouseOnly: (e = !0) => e
730
730
  });
731
- const Dt = /* @__PURE__ */ new Map(), it = /* @__PURE__ */ new Map();
732
- function ye(e) {
733
- Dt.set(e.key, e.engine), it.set(e.key, e.resolver);
731
+ const Pt = /* @__PURE__ */ new Map(), it = /* @__PURE__ */ new Map();
732
+ function xe(e) {
733
+ Pt.set(e.key, e.engine), it.set(e.key, e.resolver);
734
734
  }
735
- const be = {
735
+ const we = {
736
736
  key: "drag",
737
- engine: oe,
738
- resolver: Ct
737
+ engine: ue,
738
+ resolver: $t
739
739
  };
740
- function _e(e, t) {
740
+ function Ee(e, t) {
741
741
  if (e == null) return {};
742
742
  var r = {}, n = Object.keys(e), s, o;
743
743
  for (o = 0; o < n.length; o++)
744
744
  s = n[o], !(t.indexOf(s) >= 0) && (r[s] = e[s]);
745
745
  return r;
746
746
  }
747
- function we(e, t) {
747
+ function Te(e, t) {
748
748
  if (e == null) return {};
749
- var r = _e(e, t), n, s;
749
+ var r = Ee(e, t), n, s;
750
750
  if (Object.getOwnPropertySymbols) {
751
751
  var o = Object.getOwnPropertySymbols(e);
752
752
  for (s = 0; s < o.length; s++)
@@ -754,7 +754,7 @@ function we(e, t) {
754
754
  }
755
755
  return r;
756
756
  }
757
- const xe = {
757
+ const Se = {
758
758
  target(e) {
759
759
  if (e)
760
760
  return () => "current" in e ? e.current : e;
@@ -777,7 +777,7 @@ const xe = {
777
777
  transform(e) {
778
778
  return e;
779
779
  }
780
- }, Ee = ["target", "eventOptions", "window", "enabled", "transform"];
780
+ }, Ie = ["target", "eventOptions", "window", "enabled", "transform"];
781
781
  function F(e = {}, t) {
782
782
  const r = {};
783
783
  for (const [n, s] of Object.entries(t))
@@ -798,21 +798,21 @@ function F(e = {}, t) {
798
798
  }
799
799
  return r;
800
800
  }
801
- function Te(e, t, r = {}) {
801
+ function ke(e, t, r = {}) {
802
802
  const n = e, {
803
803
  target: s,
804
804
  eventOptions: o,
805
805
  window: a,
806
806
  enabled: c,
807
807
  transform: f
808
- } = n, d = we(n, Ee);
808
+ } = n, d = Te(n, Ie);
809
809
  if (r.shared = F({
810
810
  target: s,
811
811
  eventOptions: o,
812
812
  window: a,
813
813
  enabled: c,
814
814
  transform: f
815
- }, xe), t) {
815
+ }, Se), t) {
816
816
  const u = it.get(t);
817
817
  r[t] = F(p({
818
818
  shared: r.shared
@@ -832,12 +832,12 @@ function Te(e, t, r = {}) {
832
832
  }
833
833
  return r;
834
834
  }
835
- class $t {
835
+ class Ot {
836
836
  constructor(t, r) {
837
837
  S(this, "_listeners", /* @__PURE__ */ new Set()), this._ctrl = t, this._gestureKey = r;
838
838
  }
839
839
  add(t, r, n, s, o) {
840
- const a = this._listeners, c = Ht(r, n), f = this._gestureKey ? this._ctrl.config[this._gestureKey].eventOptions : {}, d = p(p({}, f), o);
840
+ const a = this._listeners, c = Jt(r, n), f = this._gestureKey ? this._ctrl.config[this._gestureKey].eventOptions : {}, d = p(p({}, f), o);
841
841
  t.addEventListener(c, s, d);
842
842
  const u = () => {
843
843
  t.removeEventListener(c, s, d), a.delete(u);
@@ -848,7 +848,7 @@ class $t {
848
848
  this._listeners.forEach((t) => t()), this._listeners.clear();
849
849
  }
850
850
  }
851
- class Se {
851
+ class Ce {
852
852
  constructor() {
853
853
  S(this, "_timeouts", /* @__PURE__ */ new Map());
854
854
  }
@@ -863,20 +863,20 @@ class Se {
863
863
  this._timeouts.forEach((t) => void window.clearTimeout(t)), this._timeouts.clear();
864
864
  }
865
865
  }
866
- class Ie {
866
+ class De {
867
867
  constructor(t) {
868
- S(this, "gestures", /* @__PURE__ */ new Set()), S(this, "_targetEventStore", new $t(this)), S(this, "gestureEventStores", {}), S(this, "gestureTimeoutStores", {}), S(this, "handlers", {}), S(this, "config", {}), S(this, "pointerIds", /* @__PURE__ */ new Set()), S(this, "touchIds", /* @__PURE__ */ new Set()), S(this, "state", {
868
+ S(this, "gestures", /* @__PURE__ */ new Set()), S(this, "_targetEventStore", new Ot(this)), S(this, "gestureEventStores", {}), S(this, "gestureTimeoutStores", {}), S(this, "handlers", {}), S(this, "config", {}), S(this, "pointerIds", /* @__PURE__ */ new Set()), S(this, "touchIds", /* @__PURE__ */ new Set()), S(this, "state", {
869
869
  shared: {
870
870
  shiftKey: !1,
871
871
  metaKey: !1,
872
872
  ctrlKey: !1,
873
873
  altKey: !1
874
874
  }
875
- }), ke(this, t);
875
+ }), $e(this, t);
876
876
  }
877
877
  setEventIds(t) {
878
878
  if (X(t))
879
- return this.touchIds = new Set(Jt(t)), this.touchIds;
879
+ return this.touchIds = new Set(te(t)), this.touchIds;
880
880
  if ("pointerId" in t)
881
881
  return t.type === "pointerup" || t.type === "pointercancel" ? this.pointerIds.delete(t.pointerId) : t.type === "pointerdown" && this.pointerIds.add(t.pointerId), this.pointerIds;
882
882
  }
@@ -884,7 +884,7 @@ class Ie {
884
884
  this.handlers = t, this.nativeHandlers = r;
885
885
  }
886
886
  applyConfig(t, r) {
887
- this.config = Te(t, r, this.config);
887
+ this.config = ke(t, r, this.config);
888
888
  }
889
889
  clean() {
890
890
  this._targetEventStore.clean();
@@ -900,13 +900,13 @@ class Ie {
900
900
  if (!(r.target && (s = r.target(), !s))) {
901
901
  if (r.enabled) {
902
902
  for (const a of this.gestures) {
903
- const c = this.config[a], f = wt(n, c.eventOptions, !!s);
903
+ const c = this.config[a], f = Et(n, c.eventOptions, !!s);
904
904
  if (c.enabled) {
905
- const d = Dt.get(a);
905
+ const d = Pt.get(a);
906
906
  new d(this, t, a).bind(f);
907
907
  }
908
908
  }
909
- const o = wt(n, r.eventOptions, !!s);
909
+ const o = Et(n, r.eventOptions, !!s);
910
910
  for (const a in this.nativeHandlers)
911
911
  o(a, "", (c) => this.nativeHandlers[a](p(p({}, this.state.shared), {}, {
912
912
  event: c,
@@ -914,14 +914,14 @@ class Ie {
914
914
  })), void 0, !0);
915
915
  }
916
916
  for (const o in n)
917
- n[o] = te(...n[o]);
917
+ n[o] = ne(...n[o]);
918
918
  if (!s) return n;
919
919
  for (const o in n) {
920
920
  const {
921
921
  device: a,
922
922
  capture: c,
923
923
  passive: f
924
- } = Ft(o);
924
+ } = qt(o);
925
925
  this._targetEventStore.add(s, a, "", n[o], {
926
926
  capture: c,
927
927
  passive: f
@@ -931,29 +931,29 @@ class Ie {
931
931
  }
932
932
  }
933
933
  function B(e, t) {
934
- e.gestures.add(t), e.gestureEventStores[t] = new $t(e, t), e.gestureTimeoutStores[t] = new Se();
934
+ e.gestures.add(t), e.gestureEventStores[t] = new Ot(e, t), e.gestureTimeoutStores[t] = new Ce();
935
935
  }
936
- function ke(e, t) {
936
+ function $e(e, t) {
937
937
  t.drag && B(e, "drag"), t.wheel && B(e, "wheel"), t.scroll && B(e, "scroll"), t.move && B(e, "move"), t.pinch && B(e, "pinch"), t.hover && B(e, "hover");
938
938
  }
939
- const wt = (e, t, r) => (n, s, o, a = {}, c = !1) => {
939
+ const Et = (e, t, r) => (n, s, o, a = {}, c = !1) => {
940
940
  var f, d;
941
941
  const u = (f = a.capture) !== null && f !== void 0 ? f : t.capture, _ = (d = a.passive) !== null && d !== void 0 ? d : t.passive;
942
- let m = c ? n : Wt(n, s, u);
942
+ let m = c ? n : Ht(n, s, u);
943
943
  r && _ && (m += "Passive"), e[m] = e[m] || [], e[m].push(o);
944
944
  };
945
- function Ce(e, t = {}, r, n) {
946
- const s = et.useMemo(() => new Ie(e), []);
945
+ function Pe(e, t = {}, r, n) {
946
+ const s = et.useMemo(() => new De(e), []);
947
947
  if (s.applyHandlers(e, n), s.applyConfig(t, r), et.useEffect(s.effect.bind(s)), et.useEffect(() => s.clean.bind(s), []), t.target === void 0)
948
948
  return s.bind.bind(s);
949
949
  }
950
- function De(e, t) {
951
- return ye(be), Ce({
950
+ function Oe(e, t) {
951
+ return xe(we), Pe({
952
952
  drag: e
953
953
  }, t || {}, "drag");
954
954
  }
955
955
  const nt = "RSC::Event";
956
- function $e() {
956
+ function Ae() {
957
957
  const e = $(null);
958
958
  function t(n) {
959
959
  U(() => {
@@ -985,11 +985,11 @@ function $e() {
985
985
  emitEvent: r
986
986
  };
987
987
  }
988
- function Pe(e) {
988
+ function Ne(e) {
989
989
  let t = e.replace(/\/\*[\s\S]*?\*\/|([^:]|^)\/\/.*$/gm, "");
990
990
  return t = t.replace(/[\n\t]+/g, " "), t = t.replace(/\s*([{}:;,])\s*/g, "$1"), t = t.replace(/\s+}/g, "}"), t = t.replace(/{\s+/g, "{"), t = t.replace(/\s+/g, " "), t.trim();
991
991
  }
992
- function Ve({
992
+ function Be({
993
993
  init: e = !0,
994
994
  items: t,
995
995
  withLoop: r = !1,
@@ -1004,14 +1004,26 @@ function Ve({
1004
1004
  slideType: _ = "item",
1005
1005
  initialActiveItem: m = 0
1006
1006
  }) {
1007
- const [I, D] = Rt(!1), O = $(e), w = $(null), x = $(null), M = $(0), g = $(0), k = $(!r), N = $(!1), A = $(0), h = $(0), z = Vt(), q = Et({
1007
+ const [I, D] = Ut(!1), O = $(e), x = $(null), w = $(null), M = $(0), g = $(0), k = $(!r), L = $(!1), A = $(0), h = $(0);
1008
+ function At(i) {
1009
+ if (i === void 0) return 0;
1010
+ if (typeof i == "number")
1011
+ return t[i] ? i : (console.warn(
1012
+ `initialActiveItem: item at index ${i} doesn't exist.`
1013
+ ), 0);
1014
+ const l = t.findIndex((v) => v.id === i);
1015
+ return l < 0 ? (console.warn(
1016
+ `initialActiveItem: item with id "${i}" doesn't exist.`
1017
+ ), 0) : l;
1018
+ }
1019
+ const z = Bt(), q = St({
1008
1020
  value: 0,
1009
1021
  ref: z,
1010
1022
  onChange({ value: i }) {
1011
1023
  const l = a === "x" ? `translate3d(calc(${i.value}px + var(--${n}-offset-modifier)), 0px, 0px)` : `translate3d(0px, calc(${i.value}px + var(--${n}-offset-modifier)), 0px)`;
1012
- x.current.style.transform = l;
1024
+ w.current.style.transform = l;
1013
1025
  }
1014
- }), Pt = r ? [
1026
+ }), Nt = r ? [
1015
1027
  ...t.map((i) => ({
1016
1028
  ...i,
1017
1029
  id: `prev-repeated-item-${i.id}`,
@@ -1023,22 +1035,22 @@ function Ve({
1023
1035
  id: `next-repeated-item-${i.id}`,
1024
1036
  isClonedItem: !0
1025
1037
  }))
1026
- ] : t, { useListenToCustomEvent: at, emitEvent: W } = $e();
1038
+ ] : t, { useListenToCustomEvent: at, emitEvent: W } = Ae();
1027
1039
  function ct() {
1028
1040
  const { totalGutterCssVar: i } = ut();
1029
1041
  return i;
1030
1042
  }
1031
- function Ot() {
1032
- if (w.current) {
1043
+ function Lt() {
1044
+ if (x.current) {
1033
1045
  const l = window.getComputedStyle(
1034
- w.current
1046
+ x.current
1035
1047
  ).getPropertyValue(`--${n}-items-per-slide`).trim();
1036
1048
  return Number(l) || 1;
1037
1049
  }
1038
1050
  return 1;
1039
1051
  }
1040
1052
  function J(i) {
1041
- O.current && (N.current || R({
1053
+ O.current && (L.current || R({
1042
1054
  type: "next",
1043
1055
  toIndex: i,
1044
1056
  actionType: "click"
@@ -1054,126 +1066,131 @@ function Ve({
1054
1066
  function R({
1055
1067
  type: i,
1056
1068
  shouldAnimate: l = !0,
1057
- toIndex: y,
1069
+ toIndex: v,
1058
1070
  actionType: E
1059
1071
  }) {
1060
- var L, j;
1072
+ var j, ft;
1061
1073
  const T = !l;
1062
- k.current = !1, N.current = !1;
1063
- let v = q.value.get(), C = 0;
1064
- if (i === "next" && (h.current += 1), i === "prev" && (h.current === 0 ? h.current = t.length - 1 : h.current -= 1), y !== void 0 && (h.current = y), i === "next") {
1074
+ k.current = !1, L.current = !1;
1075
+ let y = q.value.get(), C = 0;
1076
+ if (i === "next" && (h.current += 1), i === "prev" && (h.current === 0 ? h.current = t.length - 1 : h.current -= 1), v !== void 0 && (h.current = v), i === "next") {
1065
1077
  const V = Z(
1066
1078
  r ? g.current * (t.length * 2) : 0
1067
1079
  );
1068
- C = -(h.current * g.current), r && h.current === t.length && (h.current = 0, v = v + g.current * t.length, C = 0), !r && (Math.abs(C) >= V || h.current === t.length - 1) && (N.current = !0, C = -V);
1080
+ C = -(h.current * g.current), r && h.current === t.length && (h.current = 0, y = y + g.current * t.length, C = 0), !r && (Math.abs(C) >= V || h.current === t.length - 1) && (L.current = !0, C = -V);
1069
1081
  }
1070
- i === "prev" && (C = -(h.current * g.current), h.current === t.length - 1 && (v = v - t.length * g.current), !r && C >= 0 && (k.current = !0, C = 0)), M.current = C, E === "resize" ? (C = -(h.current * g.current), W({
1082
+ i === "prev" && (C = -(h.current * g.current), h.current === t.length - 1 && (y = y - t.length * g.current), !r && C >= 0 && (k.current = !0, C = 0)), M.current = C;
1083
+ const N = r ? h.current % t.length : h.current;
1084
+ E === "resize" ? (C = -(h.current * g.current), W({
1071
1085
  eventName: "onResize",
1072
1086
  sliceActionType: E,
1073
1087
  slideDirection: i,
1074
1088
  currentItem: {
1075
- index: h.current,
1076
- id: ((L = t.at(h.current)) == null ? void 0 : L.id) ?? "",
1089
+ index: N,
1090
+ id: ((j = t.at(N)) == null ? void 0 : j.id) ?? "",
1077
1091
  startReached: k.current,
1078
- endReached: N.current
1092
+ endReached: L.current
1079
1093
  }
1080
1094
  })) : W({
1081
1095
  eventName: "onSlideStartChange",
1082
1096
  sliceActionType: E,
1083
1097
  slideDirection: i,
1084
1098
  nextItem: {
1085
- index: h.current,
1086
- id: ((j = t.at(h.current)) == null ? void 0 : j.id) ?? "",
1099
+ index: N,
1100
+ id: ((ft = t.at(N)) == null ? void 0 : ft.id) ?? "",
1087
1101
  startReached: k.current,
1088
- endReached: N.current
1102
+ endReached: L.current
1089
1103
  }
1090
1104
  }), z.start({
1091
1105
  immediate: T,
1092
1106
  from: {
1093
- value: v
1107
+ value: y
1094
1108
  },
1095
1109
  to: {
1096
1110
  value: C
1097
1111
  },
1098
1112
  onChange({ value: V }) {
1099
1113
  const Y = a === "x" ? `translate3d(calc(${V.value}px + var(--${n}-offset-modifier)), 0px, 0px)` : `translate3d(0px, calc(${V.value}px + var(--${n}-offset-modifier)), 0px)`;
1100
- x.current.style.transform = Y;
1114
+ w.current.style.transform = Y;
1101
1115
  },
1102
1116
  onRest({ finished: V }) {
1103
1117
  var Y;
1104
- V && W({
1105
- eventName: "onSlideChangeComplete",
1106
- sliceActionType: E,
1107
- slideDirection: i,
1108
- currentItem: {
1109
- index: h.current,
1110
- id: ((Y = t.at(h.current)) == null ? void 0 : Y.id) ?? "",
1111
- startReached: k.current,
1112
- endReached: N.current
1113
- }
1114
- });
1118
+ if (V) {
1119
+ const dt = r ? h.current % t.length : h.current;
1120
+ W({
1121
+ eventName: "onSlideChangeComplete",
1122
+ sliceActionType: E,
1123
+ slideDirection: i,
1124
+ currentItem: {
1125
+ index: dt,
1126
+ id: ((Y = t.at(dt)) == null ? void 0 : Y.id) ?? "",
1127
+ startReached: k.current,
1128
+ endReached: L.current
1129
+ }
1130
+ });
1131
+ }
1115
1132
  }
1116
1133
  });
1117
1134
  }
1118
- function At() {
1119
- const i = x.current;
1135
+ function Mt() {
1136
+ const i = w.current;
1120
1137
  let l = 0;
1121
1138
  return _ === "item" ? l = i.children[0].getBoundingClientRect()[a === "x" ? "width" : "height"] + ct() : l = i.getBoundingClientRect()[a === "x" ? "width" : "height"] + ct(), l;
1122
1139
  }
1123
1140
  function Z(i) {
1124
- const l = x.current;
1141
+ const l = w.current;
1125
1142
  return l[a === "x" ? "scrollWidth" : "scrollHeight"] - l.getBoundingClientRect()[a === "x" ? "width" : "height"] - i;
1126
1143
  }
1127
1144
  function ut() {
1128
1145
  let i = 0, l = 0;
1129
- if (w.current) {
1130
- const y = window.getComputedStyle(
1131
- w.current
1132
- ), E = y.getPropertyValue(`--${n}-start-end-gutter`).trim();
1146
+ if (x.current) {
1147
+ const v = window.getComputedStyle(
1148
+ x.current
1149
+ ), E = v.getPropertyValue(`--${n}-start-end-gutter`).trim();
1133
1150
  E.includes("px") && (i = Number(
1134
1151
  E.replace("px", "")
1135
1152
  ));
1136
- const T = y.getPropertyValue(`--${n}-gutter`).trim();
1153
+ const T = v.getPropertyValue(`--${n}-gutter`).trim();
1137
1154
  T.includes("px") && (l = Number(T.replace("px", "")));
1138
1155
  }
1139
1156
  return { totalStartEndGutterCssVar: i, totalGutterCssVar: l };
1140
1157
  }
1141
1158
  U(() => {
1142
1159
  function i(T) {
1143
- const v = Ot();
1160
+ const y = Lt();
1144
1161
  switch (T) {
1145
1162
  case "start":
1146
1163
  return 0;
1147
1164
  case "middle-start":
1148
- return Math.floor((v - 1) * 0.25);
1165
+ return Math.floor((y - 1) * 0.25);
1149
1166
  case "center":
1150
- return Math.floor((v - 1) * 0.5);
1167
+ return Math.floor((y - 1) * 0.5);
1151
1168
  case "middle-end":
1152
- return Math.floor((v - 1) * 0.75);
1169
+ return Math.floor((y - 1) * 0.75);
1153
1170
  case "end":
1154
- return v - 1;
1171
+ return y - 1;
1155
1172
  default:
1156
1173
  return 0;
1157
1174
  }
1158
1175
  }
1159
1176
  function l() {
1160
- g.current = At(), console.log("scrollAmountValue", g.current), A.current = g.current / 4;
1177
+ g.current = Mt(), console.log("scrollAmountValue", g.current), A.current = g.current / 4;
1161
1178
  const { totalStartEndGutterCssVar: T } = ut();
1162
- let v = 0;
1163
- r && (v = g.current * t.length), v -= g.current * i(c), v -= T / 2, console.log({
1179
+ let y = 0;
1180
+ r && (y = g.current * t.length), y -= g.current * i(c), y -= T / 2, console.log({
1164
1181
  mod1: g.current * t.length,
1165
1182
  mod2: g.current * i(c),
1166
1183
  mod3: T / 2
1167
- }), w.current.style.setProperty(
1184
+ }), x.current.style.setProperty(
1168
1185
  `--${n}-offset-modifier`,
1169
- `${-v}px`
1186
+ `${-y}px`
1170
1187
  );
1171
1188
  }
1172
- function y(T) {
1173
- w.current && (l(), D(!0), T && T());
1189
+ function v(T) {
1190
+ x.current && (l(), D(!0), T && T());
1174
1191
  }
1175
1192
  function E() {
1176
- y(), R({
1193
+ v(), R({
1177
1194
  type: "resize",
1178
1195
  toIndex: h.current,
1179
1196
  shouldAnimate: !1,
@@ -1181,40 +1198,41 @@ function Ve({
1181
1198
  });
1182
1199
  }
1183
1200
  if (e)
1184
- return O.current = !0, y(u), window.addEventListener("resize", E), () => {
1201
+ return O.current = !0, v(u), window.addEventListener("resize", E), () => {
1185
1202
  window.removeEventListener("resize", E);
1186
1203
  };
1187
1204
  }, [e, r, n, a, s, c]), U(() => {
1188
- e && m !== h.current && R({
1205
+ const i = At(m);
1206
+ e && i !== h.current && R({
1189
1207
  type: "next",
1190
- toIndex: m,
1208
+ toIndex: i,
1191
1209
  actionType: "resize",
1192
1210
  shouldAnimate: !1
1193
1211
  });
1194
1212
  }, [e, m]);
1195
- const lt = f, Nt = De(
1213
+ const lt = f, Vt = Oe(
1196
1214
  (i) => {
1197
1215
  if (!O.current)
1198
1216
  return;
1199
- const l = i.dragging, y = i.offset[a === "x" ? 0 : 1], E = i.movement[a === "x" ? 0 : 1], T = E > A.current, v = E < -A.current, C = i.velocity;
1217
+ const l = i.dragging, v = i.offset[a === "x" ? 0 : 1], E = i.movement[a === "x" ? 0 : 1], T = E > A.current, y = E < -A.current, C = i.velocity;
1200
1218
  l && (W({
1201
1219
  ...i,
1202
1220
  eventName: "onDrag",
1203
1221
  slideActionType: "drag"
1204
1222
  }), z.start({
1205
- value: y,
1223
+ value: v,
1206
1224
  immediate: !0,
1207
1225
  config: {
1208
1226
  velocity: C
1209
1227
  },
1210
- onChange({ value: L }) {
1211
- const j = a === "x" ? `translate3d(calc(${L.value}px + var(--${n}-offset-modifier)), 0px, 0px)` : `translate3d(0px, calc(${L.value}px + var(--${n}-offset-modifier)), 0px)`;
1212
- x.current.style.transform = j;
1228
+ onChange({ value: N }) {
1229
+ const j = a === "x" ? `translate3d(calc(${N.value}px + var(--${n}-offset-modifier)), 0px, 0px)` : `translate3d(0px, calc(${N.value}px + var(--${n}-offset-modifier)), 0px)`;
1230
+ w.current.style.transform = j;
1213
1231
  }
1214
- }), d && (T || v) && i.cancel()), i.last && (T ? (R({
1232
+ }), d && (T || y) && i.cancel()), i.last && (T ? (R({
1215
1233
  actionType: "drag",
1216
1234
  type: "prev"
1217
- }), i.cancel()) : v ? (R({
1235
+ }), i.cancel()) : y ? (R({
1218
1236
  actionType: "drag",
1219
1237
  type: "next"
1220
1238
  }), i.cancel()) : (z.start({
@@ -1222,9 +1240,9 @@ function Ve({
1222
1240
  config: {
1223
1241
  velocity: C
1224
1242
  },
1225
- onChange({ value: L }) {
1226
- const j = a === "x" ? `translate3d(calc(${L.value}px + var(--${n}-offset-modifier)), 0px, 0px)` : `translate3d(0px, calc(${L.value}px + var(--${n}-offset-modifier)), 0px)`;
1227
- x.current.style.transform = j;
1243
+ onChange({ value: N }) {
1244
+ const j = a === "x" ? `translate3d(calc(${N.value}px + var(--${n}-offset-modifier)), 0px, 0px)` : `translate3d(0px, calc(${N.value}px + var(--${n}-offset-modifier)), 0px)`;
1245
+ w.current.style.transform = j;
1228
1246
  }
1229
1247
  }), i.cancel()));
1230
1248
  },
@@ -1243,25 +1261,25 @@ function Ve({
1243
1261
  from: () => [q.value.get(), q.value.get()]
1244
1262
  }
1245
1263
  );
1246
- function Lt(i) {
1247
- var l, y;
1248
- return typeof i == "number" ? h.current === i : ((l = t.find((E) => E.id === i)) == null ? void 0 : l.id) === ((y = t[h.current]) == null ? void 0 : y.id);
1264
+ function Rt(i) {
1265
+ var l, v;
1266
+ return typeof i == "number" ? h.current === i : ((l = t.find((E) => E.id === i)) == null ? void 0 : l.id) === ((v = t[h.current]) == null ? void 0 : v.id);
1249
1267
  }
1250
1268
  return {
1251
- carouselFragment: /* @__PURE__ */ Mt(
1269
+ carouselFragment: /* @__PURE__ */ jt(
1252
1270
  "div",
1253
1271
  {
1254
- ref: w,
1272
+ ref: x,
1255
1273
  className: "ReactSpringCarouselContainer",
1256
1274
  "data-part": "Container",
1257
1275
  "data-part-internal": `${n}-Container`,
1258
- ...Nt(),
1276
+ ...Vt(),
1259
1277
  children: [
1260
1278
  /* @__PURE__ */ tt(
1261
1279
  "style",
1262
1280
  {
1263
1281
  dangerouslySetInnerHTML: {
1264
- __html: Pe(`
1282
+ __html: Ne(`
1265
1283
  [data-part-internal="${n}-Container"] {
1266
1284
  display: flex;
1267
1285
  width: 100%;
@@ -1318,14 +1336,14 @@ function Ve({
1318
1336
  /* @__PURE__ */ tt(
1319
1337
  "div",
1320
1338
  {
1321
- ref: x,
1339
+ ref: w,
1322
1340
  className: "ReactSpringCarouselTrack",
1323
1341
  "data-part": "Track",
1324
1342
  "data-part-internal": `${n}-Track`,
1325
1343
  onScroll: () => {
1326
- k.current = !1, N.current = !1;
1344
+ k.current = !1, L.current = !1;
1327
1345
  },
1328
- children: Pt.map((i, l) => /* @__PURE__ */ tt(
1346
+ children: Nt.map((i, l) => /* @__PURE__ */ tt(
1329
1347
  "div",
1330
1348
  {
1331
1349
  className: "ReactSpringCarouselItem",
@@ -1334,9 +1352,9 @@ function Ve({
1334
1352
  "data-id": i.id,
1335
1353
  children: typeof i.renderItem == "function" ? i.renderItem({
1336
1354
  useListenToCustomEvent: at,
1337
- index: { index: l, clonedIndex: l % t.length },
1355
+ index: r ? l % t.length : l,
1338
1356
  isClonedItem: !!i.isClonedItem,
1339
- isActiveItem: Lt
1357
+ isActiveItem: Rt
1340
1358
  }) : i.renderItem
1341
1359
  },
1342
1360
  `${i.id}-${l}`
@@ -1360,7 +1378,7 @@ function Ve({
1360
1378
  i > h.current ? J(i) : Q(i);
1361
1379
  }
1362
1380
  if (typeof i == "string") {
1363
- const l = t.findIndex((y) => y.id === i);
1381
+ const l = t.findIndex((v) => v.id === i);
1364
1382
  if (l < 0) {
1365
1383
  console.warn(
1366
1384
  `The item you're trying to slide doesn't exist. id: ${i}`
@@ -1372,20 +1390,20 @@ function Ve({
1372
1390
  }
1373
1391
  };
1374
1392
  }
1375
- function Oe(e) {
1393
+ function Le(e) {
1376
1394
  let t = 0;
1377
1395
  const r = getComputedStyle(e).getPropertyValue("gap");
1378
1396
  return r.includes("px") && (t = Number(r.replace("px", ""))), t;
1379
1397
  }
1380
- function xt(e) {
1398
+ function Tt(e) {
1381
1399
  return e.scrollWidth - e.clientWidth;
1382
1400
  }
1383
1401
  function st(e) {
1384
- const t = e.children[0], r = Oe(e);
1402
+ const t = e.children[0], r = Le(e);
1385
1403
  return t.getBoundingClientRect().width + r;
1386
1404
  }
1387
- function Re({ container: e, onReach: t }) {
1388
- const r = $("start"), n = $(0), [, s] = Et(() => ({
1405
+ function Ue({ container: e, onReach: t }) {
1406
+ const r = $("start"), n = $(0), [, s] = St(() => ({
1389
1407
  x: 0
1390
1408
  }));
1391
1409
  function o(c) {
@@ -1406,7 +1424,7 @@ function Re({ container: e, onReach: t }) {
1406
1424
  return;
1407
1425
  let f = 0;
1408
1426
  if (c === "next" && (n.current += 1), c === "prev" && (n.current -= 1), f = n.current * st(e.current), c === "next") {
1409
- const d = xt(e.current);
1427
+ const d = Tt(e.current);
1410
1428
  f > d && (r.current = "end", f = d, t && t("end"));
1411
1429
  }
1412
1430
  c === "prev" && f <= 0 && (r.current = "start", n.current = 0, f = 0, t && t("start")), o(f);
@@ -1418,17 +1436,17 @@ function Re({ container: e, onReach: t }) {
1418
1436
  index: k,
1419
1437
  start: I * k,
1420
1438
  end: I * (k + 1)
1421
- })), w = e.current.scrollLeft + D, x = O.find(
1422
- (g) => w >= g.start && w < g.end
1439
+ })), x = e.current.scrollLeft + D, w = O.find(
1440
+ (g) => x >= g.start && x < g.end
1423
1441
  );
1424
- n.current = (x == null ? void 0 : x.index) || 0;
1442
+ n.current = (w == null ? void 0 : w.index) || 0;
1425
1443
  }
1426
1444
  function f() {
1427
1445
  s.stop();
1428
1446
  }
1429
1447
  function d(I) {
1430
1448
  const D = I.target;
1431
- D.scrollLeft === 0 ? (n.current = 0, r.current = "start", t && t("start")) : D.scrollLeft >= xt(D) ? (r.current = "end", t && t("end")) : r.current !== "idle" && (r.current = "idle", t && t("idle"));
1449
+ D.scrollLeft === 0 ? (n.current = 0, r.current = "start", t && t("start")) : D.scrollLeft >= Tt(D) ? (r.current = "end", t && t("end")) : r.current !== "idle" && (r.current = "idle", t && t("idle"));
1432
1450
  }
1433
1451
  let u, _ = 0;
1434
1452
  function m() {
@@ -1461,6 +1479,6 @@ function Re({ container: e, onReach: t }) {
1461
1479
  };
1462
1480
  }
1463
1481
  export {
1464
- Ve as useSpringCarousel,
1465
- Re as useSpringScroll
1482
+ Be as useSpringCarousel,
1483
+ Ue as useSpringScroll
1466
1484
  };