react-spring-carousel 3.0.0-beta080 → 3.0.0-beta082

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,12 +1,1658 @@
1
- import { useSpringCarousel as n, useSpringCarouselContext as p } from "./index.es3.js";
2
- import { useTransitionCarousel as a, useTransitionCarouselContext as m } from "./index.es4.js";
3
- import "./useThumbsModule-08e90459.js";
4
- import "react";
5
- import "@react-spring/web";
6
- import "./use-gesture-react.esm-9eb8841a.js";
1
+ import cr, { useRef as O, useEffect as ne, createContext as lr, useCallback as br, useContext as sr, useState as Tr } from "react";
2
+ import { useSpring as fr, config as Oe, useIsomorphicLayoutEffect as Er, useTransition as Rr, a as Ir } from "@react-spring/web";
3
+ import { useDrag as dr } from "@use-gesture/react";
4
+ import _r from "resize-observer-polyfill";
5
+ import Re from "screenfull";
6
+ var J = {}, wr = {
7
+ get exports() {
8
+ return J;
9
+ },
10
+ set exports(i) {
11
+ J = i;
12
+ }
13
+ }, Ye = {};
14
+ /**
15
+ * @license React
16
+ * react-jsx-runtime.production.min.js
17
+ *
18
+ * Copyright (c) Facebook, Inc. and its affiliates.
19
+ *
20
+ * This source code is licensed under the MIT license found in the
21
+ * LICENSE file in the root directory of this source tree.
22
+ */
23
+ var ar;
24
+ function Cr() {
25
+ if (ar)
26
+ return Ye;
27
+ ar = 1;
28
+ var i = cr, h = Symbol.for("react.element"), p = Symbol.for("react.fragment"), D = Object.prototype.hasOwnProperty, V = i.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner, y = { key: !0, ref: !0, __self: !0, __source: !0 };
29
+ function _(s, f, d) {
30
+ var M, A = {}, I = null, c = null;
31
+ d !== void 0 && (I = "" + d), f.key !== void 0 && (I = "" + f.key), f.ref !== void 0 && (c = f.ref);
32
+ for (M in f)
33
+ D.call(f, M) && !y.hasOwnProperty(M) && (A[M] = f[M]);
34
+ if (s && s.defaultProps)
35
+ for (M in f = s.defaultProps, f)
36
+ A[M] === void 0 && (A[M] = f[M]);
37
+ return { $$typeof: h, type: s, key: I, ref: c, props: A, _owner: V.current };
38
+ }
39
+ return Ye.Fragment = p, Ye.jsx = _, Ye.jsxs = _, Ye;
40
+ }
41
+ var Ue = {};
42
+ /**
43
+ * @license React
44
+ * react-jsx-runtime.development.js
45
+ *
46
+ * Copyright (c) Facebook, Inc. and its affiliates.
47
+ *
48
+ * This source code is licensed under the MIT license found in the
49
+ * LICENSE file in the root directory of this source tree.
50
+ */
51
+ var ur;
52
+ function Pr() {
53
+ return ur || (ur = 1, process.env.NODE_ENV !== "production" && function() {
54
+ var i = cr, h = Symbol.for("react.element"), p = Symbol.for("react.portal"), D = Symbol.for("react.fragment"), V = Symbol.for("react.strict_mode"), y = Symbol.for("react.profiler"), _ = Symbol.for("react.provider"), s = Symbol.for("react.context"), f = Symbol.for("react.forward_ref"), d = Symbol.for("react.suspense"), M = Symbol.for("react.suspense_list"), A = Symbol.for("react.memo"), I = Symbol.for("react.lazy"), c = Symbol.for("react.offscreen"), B = Symbol.iterator, b = "@@iterator";
55
+ function ie(e) {
56
+ if (e === null || typeof e != "object")
57
+ return null;
58
+ var t = B && e[B] || e[b];
59
+ return typeof t == "function" ? t : null;
60
+ }
61
+ var j = i.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED;
62
+ function $(e) {
63
+ {
64
+ for (var t = arguments.length, n = new Array(t > 1 ? t - 1 : 0), l = 1; l < t; l++)
65
+ n[l - 1] = arguments[l];
66
+ Ie("error", e, n);
67
+ }
68
+ }
69
+ function Ie(e, t, n) {
70
+ {
71
+ var l = j.ReactDebugCurrentFrame, x = l.getStackAddendum();
72
+ x !== "" && (t += "%s", n = n.concat([x]));
73
+ var R = n.map(function(m) {
74
+ return String(m);
75
+ });
76
+ R.unshift("Warning: " + t), Function.prototype.apply.call(console[e], console, R);
77
+ }
78
+ }
79
+ var X = !1, se = !1, ee = !1, z = !1, fe = !1, de;
80
+ de = Symbol.for("react.module.reference");
81
+ function Y(e) {
82
+ return !!(typeof e == "string" || typeof e == "function" || e === D || e === y || fe || e === V || e === d || e === M || z || e === c || X || se || ee || typeof e == "object" && e !== null && (e.$$typeof === I || e.$$typeof === A || e.$$typeof === _ || e.$$typeof === s || e.$$typeof === f || // This needs to include all possible module reference object
83
+ // types supported by any Flight configuration anywhere since
84
+ // we don't know which Flight build this will end up being used
85
+ // with.
86
+ e.$$typeof === de || e.getModuleId !== void 0));
87
+ }
88
+ function C(e, t, n) {
89
+ var l = e.displayName;
90
+ if (l)
91
+ return l;
92
+ var x = t.displayName || t.name || "";
93
+ return x !== "" ? n + "(" + x + ")" : n;
94
+ }
95
+ function T(e) {
96
+ return e.displayName || "Context";
97
+ }
98
+ function g(e) {
99
+ if (e == null)
100
+ return null;
101
+ if (typeof e.tag == "number" && $("Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue."), typeof e == "function")
102
+ return e.displayName || e.name || null;
103
+ if (typeof e == "string")
104
+ return e;
105
+ switch (e) {
106
+ case D:
107
+ return "Fragment";
108
+ case p:
109
+ return "Portal";
110
+ case y:
111
+ return "Profiler";
112
+ case V:
113
+ return "StrictMode";
114
+ case d:
115
+ return "Suspense";
116
+ case M:
117
+ return "SuspenseList";
118
+ }
119
+ if (typeof e == "object")
120
+ switch (e.$$typeof) {
121
+ case s:
122
+ var t = e;
123
+ return T(t) + ".Consumer";
124
+ case _:
125
+ var n = e;
126
+ return T(n._context) + ".Provider";
127
+ case f:
128
+ return C(e, e.render, "ForwardRef");
129
+ case A:
130
+ var l = e.displayName || null;
131
+ return l !== null ? l : g(e.type) || "Memo";
132
+ case I: {
133
+ var x = e, R = x._payload, m = x._init;
134
+ try {
135
+ return g(m(R));
136
+ } catch {
137
+ return null;
138
+ }
139
+ }
140
+ }
141
+ return null;
142
+ }
143
+ var P = Object.assign, K = 0, ve, me, u, E, k, te, q;
144
+ function je() {
145
+ }
146
+ je.__reactDisabledLog = !0;
147
+ function we() {
148
+ {
149
+ if (K === 0) {
150
+ ve = console.log, me = console.info, u = console.warn, E = console.error, k = console.group, te = console.groupCollapsed, q = console.groupEnd;
151
+ var e = {
152
+ configurable: !0,
153
+ enumerable: !0,
154
+ value: je,
155
+ writable: !0
156
+ };
157
+ Object.defineProperties(console, {
158
+ info: e,
159
+ log: e,
160
+ warn: e,
161
+ error: e,
162
+ group: e,
163
+ groupCollapsed: e,
164
+ groupEnd: e
165
+ });
166
+ }
167
+ K++;
168
+ }
169
+ }
170
+ function oe() {
171
+ {
172
+ if (K--, K === 0) {
173
+ var e = {
174
+ configurable: !0,
175
+ enumerable: !0,
176
+ writable: !0
177
+ };
178
+ Object.defineProperties(console, {
179
+ log: P({}, e, {
180
+ value: ve
181
+ }),
182
+ info: P({}, e, {
183
+ value: me
184
+ }),
185
+ warn: P({}, e, {
186
+ value: u
187
+ }),
188
+ error: P({}, e, {
189
+ value: E
190
+ }),
191
+ group: P({}, e, {
192
+ value: k
193
+ }),
194
+ groupCollapsed: P({}, e, {
195
+ value: te
196
+ }),
197
+ groupEnd: P({}, e, {
198
+ value: q
199
+ })
200
+ });
201
+ }
202
+ K < 0 && $("disabledDepth fell below zero. This is a bug in React. Please file an issue.");
203
+ }
204
+ }
205
+ var U = j.ReactCurrentDispatcher, he;
206
+ function ae(e, t, n) {
207
+ {
208
+ if (he === void 0)
209
+ try {
210
+ throw Error();
211
+ } catch (x) {
212
+ var l = x.stack.trim().match(/\n( *(at )?)/);
213
+ he = l && l[1] || "";
214
+ }
215
+ return `
216
+ ` + he + e;
217
+ }
218
+ }
219
+ var $e = !1, Ce;
220
+ {
221
+ var Ae = typeof WeakMap == "function" ? WeakMap : Map;
222
+ Ce = new Ae();
223
+ }
224
+ function De(e, t) {
225
+ if (!e || $e)
226
+ return "";
227
+ {
228
+ var n = Ce.get(e);
229
+ if (n !== void 0)
230
+ return n;
231
+ }
232
+ var l;
233
+ $e = !0;
234
+ var x = Error.prepareStackTrace;
235
+ Error.prepareStackTrace = void 0;
236
+ var R;
237
+ R = U.current, U.current = null, we();
238
+ try {
239
+ if (t) {
240
+ var m = function() {
241
+ throw Error();
242
+ };
243
+ if (Object.defineProperty(m.prototype, "props", {
244
+ set: function() {
245
+ throw Error();
246
+ }
247
+ }), typeof Reflect == "object" && Reflect.construct) {
248
+ try {
249
+ Reflect.construct(m, []);
250
+ } catch (le) {
251
+ l = le;
252
+ }
253
+ Reflect.construct(e, [], m);
254
+ } else {
255
+ try {
256
+ m.call();
257
+ } catch (le) {
258
+ l = le;
259
+ }
260
+ e.call(m.prototype);
261
+ }
262
+ } else {
263
+ try {
264
+ throw Error();
265
+ } catch (le) {
266
+ l = le;
267
+ }
268
+ e();
269
+ }
270
+ } catch (le) {
271
+ if (le && l && typeof le.stack == "string") {
272
+ for (var v = le.stack.split(`
273
+ `), H = l.stack.split(`
274
+ `), W = v.length - 1, S = H.length - 1; W >= 1 && S >= 0 && v[W] !== H[S]; )
275
+ S--;
276
+ for (; W >= 1 && S >= 0; W--, S--)
277
+ if (v[W] !== H[S]) {
278
+ if (W !== 1 || S !== 1)
279
+ do
280
+ if (W--, S--, S < 0 || v[W] !== H[S]) {
281
+ var G = `
282
+ ` + v[W].replace(" at new ", " at ");
283
+ return e.displayName && G.includes("<anonymous>") && (G = G.replace("<anonymous>", e.displayName)), typeof e == "function" && Ce.set(e, G), G;
284
+ }
285
+ while (W >= 1 && S >= 0);
286
+ break;
287
+ }
288
+ }
289
+ } finally {
290
+ $e = !1, U.current = R, oe(), Error.prepareStackTrace = x;
291
+ }
292
+ var ke = e ? e.displayName || e.name : "", or = ke ? ae(ke) : "";
293
+ return typeof e == "function" && Ce.set(e, or), or;
294
+ }
295
+ function Be(e, t, n) {
296
+ return De(e, !1);
297
+ }
298
+ function Ke(e) {
299
+ var t = e.prototype;
300
+ return !!(t && t.isReactComponent);
301
+ }
302
+ function F(e, t, n) {
303
+ if (e == null)
304
+ return "";
305
+ if (typeof e == "function")
306
+ return De(e, Ke(e));
307
+ if (typeof e == "string")
308
+ return ae(e);
309
+ switch (e) {
310
+ case d:
311
+ return ae("Suspense");
312
+ case M:
313
+ return ae("SuspenseList");
314
+ }
315
+ if (typeof e == "object")
316
+ switch (e.$$typeof) {
317
+ case f:
318
+ return Be(e.render);
319
+ case A:
320
+ return F(e.type, t, n);
321
+ case I: {
322
+ var l = e, x = l._payload, R = l._init;
323
+ try {
324
+ return F(R(x), t, n);
325
+ } catch {
326
+ }
327
+ }
328
+ }
329
+ return "";
330
+ }
331
+ var re = Object.prototype.hasOwnProperty, N = {}, qe = j.ReactDebugCurrentFrame;
332
+ function pe(e) {
333
+ if (e) {
334
+ var t = e._owner, n = F(e.type, e._source, t ? t.type : null);
335
+ qe.setExtraStackFrame(n);
336
+ } else
337
+ qe.setExtraStackFrame(null);
338
+ }
339
+ function Me(e, t, n, l, x) {
340
+ {
341
+ var R = Function.call.bind(re);
342
+ for (var m in e)
343
+ if (R(e, m)) {
344
+ var v = void 0;
345
+ try {
346
+ if (typeof e[m] != "function") {
347
+ var H = Error((l || "React class") + ": " + n + " type `" + m + "` is invalid; it must be a function, usually from the `prop-types` package, but received `" + typeof e[m] + "`.This often happens because of typos such as `PropTypes.function` instead of `PropTypes.func`.");
348
+ throw H.name = "Invariant Violation", H;
349
+ }
350
+ v = e[m](t, m, l, n, null, "SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED");
351
+ } catch (W) {
352
+ v = W;
353
+ }
354
+ v && !(v instanceof Error) && (pe(x), $("%s: type specification of %s `%s` is invalid; the type checker function must return `null` or an `Error` but returned a %s. You may have forgotten to pass an argument to the type checker creator (arrayOf, instanceOf, objectOf, oneOf, oneOfType, and shape all require an argument).", l || "React class", n, m, typeof v), pe(null)), v instanceof Error && !(v.message in N) && (N[v.message] = !0, pe(x), $("Failed %s type: %s", n, v.message), pe(null));
355
+ }
356
+ }
357
+ }
358
+ var Pe = Array.isArray;
359
+ function Z(e) {
360
+ return Pe(e);
361
+ }
362
+ function _e(e) {
363
+ {
364
+ var t = typeof Symbol == "function" && Symbol.toStringTag, n = t && e[Symbol.toStringTag] || e.constructor.name || "Object";
365
+ return n;
366
+ }
367
+ }
368
+ function ge(e) {
369
+ try {
370
+ return ue(e), !1;
371
+ } catch {
372
+ return !0;
373
+ }
374
+ }
375
+ function ue(e) {
376
+ return "" + e;
377
+ }
378
+ function Le(e) {
379
+ if (ge(e))
380
+ return $("The provided key is an unsupported type %s. This value must be coerced to a string before before using it here.", _e(e)), ue(e);
381
+ }
382
+ var ye = j.ReactCurrentOwner, tr = {
383
+ key: !0,
384
+ ref: !0,
385
+ __self: !0,
386
+ __source: !0
387
+ }, He, Je, xe;
388
+ xe = {};
389
+ function Ze(e) {
390
+ if (re.call(e, "ref")) {
391
+ var t = Object.getOwnPropertyDescriptor(e, "ref").get;
392
+ if (t && t.isReactWarning)
393
+ return !1;
394
+ }
395
+ return e.ref !== void 0;
396
+ }
397
+ function be(e) {
398
+ if (re.call(e, "key")) {
399
+ var t = Object.getOwnPropertyDescriptor(e, "key").get;
400
+ if (t && t.isReactWarning)
401
+ return !1;
402
+ }
403
+ return e.key !== void 0;
404
+ }
405
+ function Ne(e, t) {
406
+ if (typeof e.ref == "string" && ye.current && t && ye.current.stateNode !== t) {
407
+ var n = g(ye.current.type);
408
+ xe[n] || ($('Component "%s" contains the string ref "%s". Support for string refs will be removed in a future major release. This case cannot be automatically converted to an arrow function. We ask you to manually fix this case by using useRef() or createRef() instead. Learn more about using refs safely here: https://reactjs.org/link/strict-mode-string-ref', g(ye.current.type), e.ref), xe[n] = !0);
409
+ }
410
+ }
411
+ function We(e, t) {
412
+ {
413
+ var n = function() {
414
+ He || (He = !0, $("%s: `key` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://reactjs.org/link/special-props)", t));
415
+ };
416
+ n.isReactWarning = !0, Object.defineProperty(e, "key", {
417
+ get: n,
418
+ configurable: !0
419
+ });
420
+ }
421
+ }
422
+ function Se(e, t) {
423
+ {
424
+ var n = function() {
425
+ Je || (Je = !0, $("%s: `ref` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://reactjs.org/link/special-props)", t));
426
+ };
427
+ n.isReactWarning = !0, Object.defineProperty(e, "ref", {
428
+ get: n,
429
+ configurable: !0
430
+ });
431
+ }
432
+ }
433
+ var Ve = function(e, t, n, l, x, R, m) {
434
+ var v = {
435
+ // This tag allows us to uniquely identify this as a React Element
436
+ $$typeof: h,
437
+ // Built-in properties that belong on the element
438
+ type: e,
439
+ key: t,
440
+ ref: n,
441
+ props: m,
442
+ // Record the component responsible for creating this element.
443
+ _owner: R
444
+ };
445
+ return v._store = {}, Object.defineProperty(v._store, "validated", {
446
+ configurable: !1,
447
+ enumerable: !1,
448
+ writable: !0,
449
+ value: !1
450
+ }), Object.defineProperty(v, "_self", {
451
+ configurable: !1,
452
+ enumerable: !1,
453
+ writable: !1,
454
+ value: l
455
+ }), Object.defineProperty(v, "_source", {
456
+ configurable: !1,
457
+ enumerable: !1,
458
+ writable: !1,
459
+ value: x
460
+ }), Object.freeze && (Object.freeze(v.props), Object.freeze(v)), v;
461
+ };
462
+ function Qe(e, t, n, l, x) {
463
+ {
464
+ var R, m = {}, v = null, H = null;
465
+ n !== void 0 && (Le(n), v = "" + n), be(t) && (Le(t.key), v = "" + t.key), Ze(t) && (H = t.ref, Ne(t, x));
466
+ for (R in t)
467
+ re.call(t, R) && !tr.hasOwnProperty(R) && (m[R] = t[R]);
468
+ if (e && e.defaultProps) {
469
+ var W = e.defaultProps;
470
+ for (R in W)
471
+ m[R] === void 0 && (m[R] = W[R]);
472
+ }
473
+ if (v || H) {
474
+ var S = typeof e == "function" ? e.displayName || e.name || "Unknown" : e;
475
+ v && We(m, S), H && Se(m, S);
476
+ }
477
+ return Ve(e, v, H, x, l, ye.current, m);
478
+ }
479
+ }
480
+ var L = j.ReactCurrentOwner, ze = j.ReactDebugCurrentFrame;
481
+ function Te(e) {
482
+ if (e) {
483
+ var t = e._owner, n = F(e.type, e._source, t ? t.type : null);
484
+ ze.setExtraStackFrame(n);
485
+ } else
486
+ ze.setExtraStackFrame(null);
487
+ }
488
+ var r;
489
+ r = !1;
490
+ function o(e) {
491
+ return typeof e == "object" && e !== null && e.$$typeof === h;
492
+ }
493
+ function a() {
494
+ {
495
+ if (L.current) {
496
+ var e = g(L.current.type);
497
+ if (e)
498
+ return `
499
+
500
+ Check the render method of \`` + e + "`.";
501
+ }
502
+ return "";
503
+ }
504
+ }
505
+ function w(e) {
506
+ {
507
+ if (e !== void 0) {
508
+ var t = e.fileName.replace(/^.*[\\\/]/, ""), n = e.lineNumber;
509
+ return `
510
+
511
+ Check your code at ` + t + ":" + n + ".";
512
+ }
513
+ return "";
514
+ }
515
+ }
516
+ var Q = {};
517
+ function Ee(e) {
518
+ {
519
+ var t = a();
520
+ if (!t) {
521
+ var n = typeof e == "string" ? e : e.displayName || e.name;
522
+ n && (t = `
523
+
524
+ Check the top-level render call using <` + n + ">.");
525
+ }
526
+ return t;
527
+ }
528
+ }
529
+ function ce(e, t) {
530
+ {
531
+ if (!e._store || e._store.validated || e.key != null)
532
+ return;
533
+ e._store.validated = !0;
534
+ var n = Ee(t);
535
+ if (Q[n])
536
+ return;
537
+ Q[n] = !0;
538
+ var l = "";
539
+ e && e._owner && e._owner !== L.current && (l = " It was passed a child from " + g(e._owner.type) + "."), Te(e), $('Each child in a list should have a unique "key" prop.%s%s See https://reactjs.org/link/warning-keys for more information.', n, l), Te(null);
540
+ }
541
+ }
542
+ function Xe(e, t) {
543
+ {
544
+ if (typeof e != "object")
545
+ return;
546
+ if (Z(e))
547
+ for (var n = 0; n < e.length; n++) {
548
+ var l = e[n];
549
+ o(l) && ce(l, t);
550
+ }
551
+ else if (o(e))
552
+ e._store && (e._store.validated = !0);
553
+ else if (e) {
554
+ var x = ie(e);
555
+ if (typeof x == "function" && x !== e.entries)
556
+ for (var R = x.call(e), m; !(m = R.next()).done; )
557
+ o(m.value) && ce(m.value, t);
558
+ }
559
+ }
560
+ }
561
+ function nr(e) {
562
+ {
563
+ var t = e.type;
564
+ if (t == null || typeof t == "string")
565
+ return;
566
+ var n;
567
+ if (typeof t == "function")
568
+ n = t.propTypes;
569
+ else if (typeof t == "object" && (t.$$typeof === f || // Note: Memo only checks outer props here.
570
+ // Inner props are checked in the reconciler.
571
+ t.$$typeof === A))
572
+ n = t.propTypes;
573
+ else
574
+ return;
575
+ if (n) {
576
+ var l = g(t);
577
+ Me(n, e.props, "prop", l, e);
578
+ } else if (t.PropTypes !== void 0 && !r) {
579
+ r = !0;
580
+ var x = g(t);
581
+ $("Component %s declared `PropTypes` instead of `propTypes`. Did you misspell the property assignment?", x || "Unknown");
582
+ }
583
+ typeof t.getDefaultProps == "function" && !t.getDefaultProps.isReactClassApproved && $("getDefaultProps is only used on classic React.createClass definitions. Use a static property named `defaultProps` instead.");
584
+ }
585
+ }
586
+ function hr(e) {
587
+ {
588
+ for (var t = Object.keys(e.props), n = 0; n < t.length; n++) {
589
+ var l = t[n];
590
+ if (l !== "children" && l !== "key") {
591
+ Te(e), $("Invalid prop `%s` supplied to `React.Fragment`. React.Fragment can only have `key` and `children` props.", l), Te(null);
592
+ break;
593
+ }
594
+ }
595
+ e.ref !== null && (Te(e), $("Invalid attribute `ref` supplied to `React.Fragment`."), Te(null));
596
+ }
597
+ }
598
+ function ir(e, t, n, l, x, R) {
599
+ {
600
+ var m = Y(e);
601
+ if (!m) {
602
+ var v = "";
603
+ (e === void 0 || typeof e == "object" && e !== null && Object.keys(e).length === 0) && (v += " You likely forgot to export your component from the file it's defined in, or you might have mixed up default and named imports.");
604
+ var H = w(x);
605
+ H ? v += H : v += a();
606
+ var W;
607
+ e === null ? W = "null" : Z(e) ? W = "array" : e !== void 0 && e.$$typeof === h ? (W = "<" + (g(e.type) || "Unknown") + " />", v = " Did you accidentally export a JSX literal instead of a component?") : W = typeof e, $("React.jsx: type is invalid -- expected a string (for built-in components) or a class/function (for composite components) but got: %s.%s", W, v);
608
+ }
609
+ var S = Qe(e, t, n, x, R);
610
+ if (S == null)
611
+ return S;
612
+ if (m) {
613
+ var G = t.children;
614
+ if (G !== void 0)
615
+ if (l)
616
+ if (Z(G)) {
617
+ for (var ke = 0; ke < G.length; ke++)
618
+ Xe(G[ke], e);
619
+ Object.freeze && Object.freeze(G);
620
+ } else
621
+ $("React.jsx: Static children should always be an array. You are likely explicitly calling React.jsxs or React.jsxDEV. Use the Babel transform instead.");
622
+ else
623
+ Xe(G, e);
624
+ }
625
+ return e === D ? hr(S) : nr(S), S;
626
+ }
627
+ }
628
+ function pr(e, t, n) {
629
+ return ir(e, t, n, !0);
630
+ }
631
+ function gr(e, t, n) {
632
+ return ir(e, t, n, !1);
633
+ }
634
+ var yr = gr, xr = pr;
635
+ Ue.Fragment = D, Ue.jsx = yr, Ue.jsxs = xr;
636
+ }()), Ue;
637
+ }
638
+ (function(i) {
639
+ process.env.NODE_ENV === "production" ? i.exports = Cr() : i.exports = Pr();
640
+ })(wr);
641
+ const Ge = "RSC::Event";
642
+ function vr() {
643
+ const i = O(null);
644
+ function h(D) {
645
+ ne(() => {
646
+ i.current || (i.current = document.createElement("div"));
647
+ function V(y) {
648
+ D(y.detail);
649
+ }
650
+ if (i.current)
651
+ return i.current.addEventListener(Ge, V, !1), () => {
652
+ var y;
653
+ (y = i.current) == null || y.removeEventListener(Ge, V, !1);
654
+ };
655
+ }, [D]);
656
+ }
657
+ function p(D) {
658
+ if (i.current) {
659
+ const V = new CustomEvent(Ge, {
660
+ detail: D
661
+ });
662
+ i.current.dispatchEvent(V);
663
+ }
664
+ }
665
+ return {
666
+ useListenToCustomEvent: h,
667
+ emitEvent: p
668
+ };
669
+ }
670
+ function kr(i) {
671
+ const h = i.getBoundingClientRect();
672
+ return h.top >= 0 && h.left >= 0 && h.bottom <= (window.innerHeight || document.documentElement.clientHeight) && h.right <= (window.innerWidth || document.documentElement.clientWidth);
673
+ }
674
+ function mr({
675
+ thumbsSlideAxis: i = "x",
676
+ withThumbs: h = !1,
677
+ prepareThumbsData: p,
678
+ items: D,
679
+ renderThumbFnProps: V
680
+ }) {
681
+ const y = O(null), [_, s] = fr(() => ({
682
+ val: 0
683
+ }));
684
+ function f() {
685
+ var I;
686
+ return Math.round(
687
+ Number((I = y.current) == null ? void 0 : I[i === "x" ? "scrollWidth" : "scrollHeight"]) - y.current.getBoundingClientRect()[i === "x" ? "width" : "height"]
688
+ );
689
+ }
690
+ function d(I) {
691
+ var b;
692
+ function c() {
693
+ return y.current ? y.current.querySelector(
694
+ `#thumb-item-${D[I].id}`
695
+ ) : null;
696
+ }
697
+ const B = c();
698
+ if (B && y.current && !kr(B)) {
699
+ const ie = B.offsetLeft, j = ie > f() ? f() : ie;
700
+ s.start({
701
+ from: {
702
+ val: ((b = y.current) == null ? void 0 : b[i === "x" ? "scrollLeft" : "scrollTop"]) ?? 0
703
+ },
704
+ to: {
705
+ val: j
706
+ },
707
+ onChange: ({ value: $ }) => {
708
+ y.current && (y.current[i === "x" ? "scrollLeft" : "scrollTop"] = Math.abs(
709
+ $.val
710
+ ));
711
+ }
712
+ });
713
+ }
714
+ }
715
+ function M() {
716
+ function I(c) {
717
+ return c.map((B) => ({
718
+ id: B.id,
719
+ renderThumb: B.renderThumb
720
+ }));
721
+ }
722
+ return p ? p(I(D)) : I(D);
723
+ }
724
+ return {
725
+ thumbsFragment: h ? /* @__PURE__ */ J.jsx(
726
+ "div",
727
+ {
728
+ className: "use-spring-carousel-thumbs-wrapper",
729
+ ref: y,
730
+ onWheel: () => _.val.stop(),
731
+ style: {
732
+ display: "flex",
733
+ flex: "1",
734
+ position: "relative",
735
+ width: "100%",
736
+ height: "100%",
737
+ flexDirection: i === "x" ? "row" : "column",
738
+ ...i === "x" ? { overflowX: "auto" } : {
739
+ overflowY: "auto",
740
+ maxHeight: "100%"
741
+ }
742
+ },
743
+ children: M().map(({ id: I, renderThumb: c }) => {
744
+ const B = `thumb-item-${I}`;
745
+ return /* @__PURE__ */ J.jsx("div", { id: B, className: "thumb-item", children: typeof c == "function" ? c(V) : c }, B);
746
+ })
747
+ }
748
+ ) : null,
749
+ handleScroll: d
750
+ };
751
+ }
752
+ function Fr({
753
+ mainCarouselWrapperRef: i,
754
+ onFullScreenChange: h,
755
+ handleResize: p
756
+ }) {
757
+ const D = O(!1);
758
+ ne(() => {
759
+ function f() {
760
+ document.fullscreenElement && (V(!0), h(!0), p && p()), document.fullscreenElement || (V(!1), h(!1), p && p());
761
+ }
762
+ if (Re.isEnabled)
763
+ return Re.on("change", f), () => {
764
+ Re.isEnabled && Re.off("change", f);
765
+ };
766
+ }, []);
767
+ function V(f) {
768
+ D.current = f;
769
+ }
770
+ function y() {
771
+ return D.current;
772
+ }
773
+ function _(f) {
774
+ Re.isEnabled && Re.request(f || i.current);
775
+ }
776
+ function s() {
777
+ Re.isEnabled && Re.exit();
778
+ }
779
+ return {
780
+ enterFullscreen: _,
781
+ exitFullscreen: s,
782
+ getIsFullscreen: y
783
+ };
784
+ }
785
+ function Nr({
786
+ items: i,
787
+ init: h = !0,
788
+ withThumbs: p,
789
+ thumbsSlideAxis: D = "x",
790
+ itemsPerSlide: V = 1,
791
+ slideType: y = "fixed",
792
+ gutter: _ = 0,
793
+ withLoop: s = !1,
794
+ startEndGutter: f = 0,
795
+ carouselSlideAxis: d = "x",
796
+ disableGestures: M = !1,
797
+ draggingSlideTreshold: A,
798
+ slideWhenThresholdIsReached: I = !1,
799
+ freeScroll: c,
800
+ enableFreeScrollDrag: B,
801
+ initialStartingPosition: b,
802
+ prepareThumbsData: ie,
803
+ initialActiveItem: j = 0,
804
+ animateWhenActiveItemChange: $ = !0,
805
+ getControllerRef: Ie
806
+ }) {
807
+ const X = V > i.length ? i.length : V, se = O(!1), ee = O(A ?? 0), z = O("initial"), fe = O("initial"), de = O("initial"), Y = O(j), C = O(j === 0), T = O(y === "fixed" && j === i.length - 1), g = O(null), P = O(null), K = O(!0), ve = O(0), me = O(0), u = O(0), E = O(s), k = O(y), te = O(c), q = O(!1), we = br(() => s ? [
808
+ ...i.map((r) => ({
809
+ ...r,
810
+ id: `prev-repeated-item-${r.id}`
811
+ })),
812
+ ...i,
813
+ ...i.map((r) => ({
814
+ ...r,
815
+ id: `next-repeated-item-${r.id}`
816
+ }))
817
+ ] : [...i], [i, s])(), [oe, U] = fr(
818
+ () => ({
819
+ val: 0,
820
+ pause: !h,
821
+ onChange: ({ value: r }) => {
822
+ c && g.current ? (d === "x" ? g.current.scrollLeft = Math.abs(r.val) : g.current.scrollTop = Math.abs(r.val), xe()) : P.current && (d === "x" ? P.current.style.transform = `translate3d(${r.val}px, 0px,0px)` : P.current.style.transform = `translate3d(0px,${r.val}px,0px)`);
823
+ }
824
+ }),
825
+ [c]
826
+ ), { emitEvent: he, useListenToCustomEvent: ae } = vr(), { thumbsFragment: $e, handleScroll: Ce } = mr({
827
+ withThumbs: !!p,
828
+ thumbsSlideAxis: D,
829
+ prepareThumbsData: ie,
830
+ items: i,
831
+ renderThumbFnProps: {
832
+ getIsActiveItem: Ve,
833
+ getIsPrevItem: Se,
834
+ useListenToCustomEvent: ae,
835
+ getIsNextItem: We
836
+ }
837
+ }), { enterFullscreen: Ae, exitFullscreen: De, getIsFullscreen: Be } = Fr({
838
+ mainCarouselWrapperRef: g,
839
+ handleResize: () => Pe(),
840
+ onFullScreenChange: (r) => {
841
+ he({
842
+ eventName: "onFullscreenChange",
843
+ isFullscreen: r
844
+ });
845
+ }
846
+ });
847
+ function Ke(r) {
848
+ return y === "fixed" && !c ? {
849
+ marginRight: `${r ? 0 : _}px`,
850
+ flex: `1 0 calc(100% / ${X} - ${_ * (X - 1) / X}px)`
851
+ } : {
852
+ marginRight: `${r ? 0 : _}px`
853
+ };
854
+ }
855
+ function F() {
856
+ var o;
857
+ const r = (o = g.current) == null ? void 0 : o.querySelector(".use-spring-carousel-item");
858
+ if (!r)
859
+ throw Error("No carousel items available!");
860
+ return r.getBoundingClientRect()[d === "x" ? "width" : "height"] + _;
861
+ }
862
+ function re({ from: r, to: o, nextActiveItem: a, immediate: w = !1, slideMode: Q }) {
863
+ fe.current = Q, typeof a == "number" && (c || (Y.current = a), he({
864
+ eventName: "onSlideStartChange",
865
+ slideActionType: z.current,
866
+ slideMode: fe.current,
867
+ nextItem: {
868
+ startReached: C.current,
869
+ endReached: T.current,
870
+ index: c ? -1 : Y.current,
871
+ id: c ? "" : i[Y.current].id
872
+ }
873
+ })), u.current = o, U.start({
874
+ immediate: w,
875
+ from: {
876
+ val: r
877
+ },
878
+ to: {
879
+ val: o
880
+ },
881
+ config: {
882
+ ...Oe.default,
883
+ velocity: oe.val.velocity
884
+ },
885
+ onRest(Ee) {
886
+ !w && Ee.finished && he({
887
+ eventName: "onSlideChange",
888
+ slideActionType: z.current,
889
+ slideMode: fe.current,
890
+ currentItem: {
891
+ startReached: C.current,
892
+ endReached: T.current,
893
+ index: c ? -1 : Y.current,
894
+ id: c ? "" : i[Y.current].id
895
+ }
896
+ });
897
+ }
898
+ }), p && !w && Ce(Y.current);
899
+ }
900
+ function N() {
901
+ var r;
902
+ return s ? F() * i.length : Math.round(
903
+ Number(
904
+ (r = P.current) == null ? void 0 : r[d === "x" ? "scrollWidth" : "scrollHeight"]
905
+ ) - P.current.getBoundingClientRect()[d === "x" ? "width" : "height"] - f * 2
906
+ );
907
+ }
908
+ function qe() {
909
+ const r = `calc(100% - ${f * 2}px)`;
910
+ return {
911
+ width: d === "x" ? r : "100%",
912
+ height: d === "y" ? r : "100%"
913
+ };
914
+ }
915
+ function pe() {
916
+ var o;
917
+ const r = (o = P.current) == null ? void 0 : o.querySelector(".use-spring-carousel-item");
918
+ if (!r)
919
+ throw Error("No carousel items available!");
920
+ return r.getBoundingClientRect()[d === "x" ? "width" : "height"] + _;
921
+ }
922
+ function Me(r) {
923
+ const o = d === "x" ? "left" : "top", a = P.current;
924
+ a && (s ? (a.style.top = "0px", a.style.left = "0px", a.style[o] = `-${r - f}px`, C.current = !1, T.current = !1) : (a.style.left = "0px", a.style.top = "0px"));
925
+ }
926
+ function Pe(r = !1) {
927
+ if (P.current && r && (P.current.style.transform = "translate3d(0px, 0px,0px)", P.current.style.left = "0", P.current.style.top = "0"), y === "fixed" && Me(
928
+ b === "center" ? pe() * i.length - F() * Math.round((X - 1) / 2) : b === "end" ? pe() * i.length - F() * Math.round(X - 1) : pe() * i.length
929
+ ), y === "fluid") {
930
+ if (T.current && N() !== Math.abs(u.current) && !s) {
931
+ const o = -N();
932
+ u.current = o, U.start({
933
+ immediate: !0,
934
+ val: u.current
935
+ });
936
+ return;
937
+ }
938
+ if (Math.abs(u.current) > 0 && N() !== Math.abs(u.current) && !s && !c && de.current === "backward") {
939
+ const o = ve.current - N(), a = u.current + o;
940
+ return U.start({
941
+ immediate: !0,
942
+ val: a
943
+ }), () => {
944
+ u.current = a;
945
+ };
946
+ }
947
+ return;
948
+ }
949
+ if (!c && y === "fixed") {
950
+ const o = -(F() * Y.current);
951
+ if (Math.abs(o) > N() && !s) {
952
+ const a = -N();
953
+ T.current = !0, u.current = a, U.start({
954
+ immediate: !0,
955
+ val: u.current
956
+ });
957
+ } else
958
+ u.current = o, U.start({
959
+ immediate: !0,
960
+ val: o
961
+ });
962
+ setTimeout(() => {
963
+ se.current = !1;
964
+ }, 0);
965
+ }
966
+ }
967
+ function Z() {
968
+ return c && g.current ? g.current[d === "x" ? "scrollLeft" : "scrollTop"] : oe.val.get();
969
+ }
970
+ function _e(r, o) {
971
+ if (c && r === "next") {
972
+ const a = u.current + F();
973
+ return a > N() ? N() : a;
974
+ }
975
+ if (c && r === "prev") {
976
+ const a = u.current - F();
977
+ return a < 0 ? 0 : a;
978
+ }
979
+ return r === "next" ? typeof o == "number" ? -(o * F()) : u.current - F() : typeof o == "number" ? -(o * F()) : u.current + F();
980
+ }
981
+ function ge({ type: r, index: o, immediate: a }) {
982
+ if (!h || q.current || C.current && !s)
983
+ return;
984
+ T.current && (de.current = "backward"), z.current = "prev", T.current = !1;
985
+ const w = typeof o == "number" ? o : Y.current - 1;
986
+ if (c && xe(), !s) {
987
+ const Q = c ? _e("prev", o) - F() / 3 < 0 : _e("prev", o) + F() / 3 > 0;
988
+ if (C.current)
989
+ return;
990
+ if (Q) {
991
+ C.current = !0, T.current = !1, re({
992
+ slideMode: r,
993
+ from: Z(),
994
+ to: 0,
995
+ nextActiveItem: 0,
996
+ immediate: a
997
+ });
998
+ return;
999
+ }
1000
+ }
1001
+ if (s && (C.current || w < 0)) {
1002
+ C.current = !1, T.current = !0, re({
1003
+ slideMode: r,
1004
+ from: Z() - F() * i.length,
1005
+ to: -(F() * i.length) + F(),
1006
+ nextActiveItem: i.length - 1,
1007
+ immediate: a
1008
+ });
1009
+ return;
1010
+ }
1011
+ w === 0 && (C.current = !0), (w === i.length - 1 || w === -1) && (T.current = !0), re({
1012
+ slideMode: r,
1013
+ from: Z(),
1014
+ to: _e("prev", o),
1015
+ nextActiveItem: w,
1016
+ immediate: a
1017
+ });
1018
+ }
1019
+ function ue({ type: r, index: o, immediate: a }) {
1020
+ if (!h || q.current || T.current && !s)
1021
+ return;
1022
+ C.current && (de.current = "forward"), z.current = "next", C.current = !1;
1023
+ const w = o || Y.current + 1;
1024
+ if (c && xe(), !s) {
1025
+ const Q = Math.abs(_e("next", o)) > N() - F() / 3;
1026
+ if (T.current)
1027
+ return;
1028
+ if (Q) {
1029
+ C.current = !1, T.current = !0, re({
1030
+ slideMode: r,
1031
+ from: Z(),
1032
+ to: c ? N() : -N(),
1033
+ nextActiveItem: w,
1034
+ immediate: a
1035
+ });
1036
+ return;
1037
+ }
1038
+ }
1039
+ if (s && (T.current || w > i.length - 1)) {
1040
+ T.current = !1, C.current = !0, re({
1041
+ slideMode: r,
1042
+ from: Z() + F() * i.length,
1043
+ to: 0,
1044
+ nextActiveItem: 0,
1045
+ immediate: a
1046
+ });
1047
+ return;
1048
+ }
1049
+ w === 0 && (C.current = !0), w === i.length - 1 && (T.current = !0), re({
1050
+ slideMode: r,
1051
+ from: Z(),
1052
+ to: _e("next", o),
1053
+ nextActiveItem: w,
1054
+ immediate: a
1055
+ });
1056
+ }
1057
+ function Le() {
1058
+ A ? ee.current = A : ee.current = Math.floor(F() / 2 / 2);
1059
+ }
1060
+ function ye() {
1061
+ !K.current && P.current && (ve.current = N(), E.current = s, k.current = y, te.current = c, me.current = window.innerWidth, u.current = 0, Ne({ id: 0, immediate: !0, shouldReset: !0 }), Le(), Pe());
1062
+ }
1063
+ const He = dr(
1064
+ (r) => {
1065
+ const o = r.dragging, a = r.offset[d === "x" ? 0 : 1], w = r.movement[d === "x" ? 0 : 1], Q = r.direction[d === "x" ? 0 : 1], Ee = w > ee.current, ce = w < -ee.current, Xe = N();
1066
+ if (o) {
1067
+ if (Q > 0 ? z.current = "prev" : z.current = "next", he({
1068
+ ...r,
1069
+ eventName: "onDrag",
1070
+ slideActionType: z.current
1071
+ }), c) {
1072
+ if (a > 0) {
1073
+ U.start({
1074
+ from: {
1075
+ val: Z()
1076
+ },
1077
+ to: {
1078
+ val: 0
1079
+ },
1080
+ config: {
1081
+ velocity: r.velocity,
1082
+ friction: 50,
1083
+ tension: 1e3
1084
+ }
1085
+ }), r.cancel();
1086
+ return;
1087
+ }
1088
+ U.start({
1089
+ from: {
1090
+ val: Z()
1091
+ },
1092
+ to: {
1093
+ val: -a
1094
+ },
1095
+ config: {
1096
+ velocity: r.velocity,
1097
+ friction: 50,
1098
+ tension: 1e3
1099
+ }
1100
+ });
1101
+ return;
1102
+ }
1103
+ U.start({
1104
+ val: a,
1105
+ config: {
1106
+ velocity: r.velocity,
1107
+ friction: 50,
1108
+ tension: 1e3
1109
+ }
1110
+ }), I && ce ? (ue({ type: "drag" }), r.cancel()) : I && Ee && (ge({ type: "drag" }), r.cancel()), Xe - Math.abs(a) < -(F() * 2) && r.cancel();
1111
+ return;
1112
+ }
1113
+ if (r.last && c && a > 0) {
1114
+ U.start({
1115
+ from: {
1116
+ val: Z()
1117
+ },
1118
+ to: {
1119
+ val: 0
1120
+ },
1121
+ config: {
1122
+ velocity: r.velocity,
1123
+ friction: 50,
1124
+ tension: 1e3
1125
+ }
1126
+ });
1127
+ return;
1128
+ }
1129
+ r.last && !r.canceled && c && (z.current === "prev" && ge({ type: "drag" }), z.current === "next" && ue({ type: "drag" })), r.last && !r.canceled && !c && (ce ? !s && T.current ? U.start({
1130
+ val: -N(),
1131
+ config: {
1132
+ ...Oe.default,
1133
+ velocity: r.velocity
1134
+ }
1135
+ }) : ue({ type: "drag" }) : Ee ? !s && C.current ? U.start({
1136
+ val: 0,
1137
+ config: {
1138
+ ...Oe.default,
1139
+ velocity: r.velocity
1140
+ }
1141
+ }) : ge({ type: "drag" }) : U.start({
1142
+ val: u.current,
1143
+ config: {
1144
+ ...Oe.default,
1145
+ velocity: r.velocity
1146
+ }
1147
+ })), r.last && r.canceled && U.start({
1148
+ val: u.current,
1149
+ config: {
1150
+ ...Oe.default,
1151
+ velocity: r.velocity
1152
+ }
1153
+ });
1154
+ },
1155
+ {
1156
+ enabled: h && !M && !c || !!c && !!B,
1157
+ axis: d,
1158
+ from: () => c && g.current ? [
1159
+ -g.current.scrollLeft,
1160
+ -g.current.scrollTop
1161
+ ] : d === "x" ? [oe.val.get(), oe.val.get()] : [oe.val.get(), oe.val.get()]
1162
+ }
1163
+ );
1164
+ function Je() {
1165
+ return c ? d === "x" ? {
1166
+ overflowX: "auto"
1167
+ } : {
1168
+ overflowY: "auto"
1169
+ } : {};
1170
+ }
1171
+ function xe() {
1172
+ g.current && (u.current = g.current[d === "x" ? "scrollLeft" : "scrollTop"], g.current[d === "x" ? "scrollLeft" : "scrollTop"] === 0 && (C.current = !0, T.current = !1), g.current[d === "x" ? "scrollLeft" : "scrollTop"] > 0 && g.current[d === "x" ? "scrollLeft" : "scrollTop"] < N() && (C.current = !1, T.current = !1), g.current[d === "x" ? "scrollLeft" : "scrollTop"] === N() && (C.current = !1, T.current = !0));
1173
+ }
1174
+ function Ze() {
1175
+ return c ? {
1176
+ onWheel() {
1177
+ oe.val.stop(), xe();
1178
+ }
1179
+ } : {};
1180
+ }
1181
+ function be(r, o) {
1182
+ let a = 0;
1183
+ if (typeof r == "string" ? a = i.findIndex((w) => w.id === r) : a = r, a < 0 || a >= i.length) {
1184
+ if (o)
1185
+ throw new Error(o);
1186
+ console.error(`The item doesn't exist; check that the id provided - ${r} - is correct.`), a = -1;
1187
+ }
1188
+ return a;
1189
+ }
1190
+ function Ne({ id: r, immediate: o, shouldReset: a, type: w }) {
1191
+ if (!h || q.current)
1192
+ return;
1193
+ C.current = !1, T.current = !1;
1194
+ const Q = be(
1195
+ r,
1196
+ "The item you want to slide to doesn't exist; check the provided id."
1197
+ );
1198
+ if (Q === Y.current && !a)
1199
+ return;
1200
+ const Ee = be(i[Y.current].id), ce = be(i[Q].id);
1201
+ ce > Ee ? ue({
1202
+ type: w || a ? "initial" : "click",
1203
+ index: ce,
1204
+ immediate: o
1205
+ }) : ge({
1206
+ type: w || a ? "initial" : "click",
1207
+ index: ce,
1208
+ immediate: o
1209
+ });
1210
+ }
1211
+ function We(r) {
1212
+ const o = be(r, "The item doesn't exist; check the provided id."), a = Y.current;
1213
+ return s && a === i.length - 1 ? o === 0 : o === a + 1;
1214
+ }
1215
+ function Se(r) {
1216
+ const o = be(r, "The item doesn't exist; check the provided id."), a = Y.current;
1217
+ return s && a === 0 ? o === i.length - 1 : o === a - 1;
1218
+ }
1219
+ function Ve(r) {
1220
+ return be(r, "The item you want to check doesn't exist; check the provided id.") === Y.current;
1221
+ }
1222
+ function Qe() {
1223
+ return M ? "unset" : d === "x" ? "pan-y" : "pan-x";
1224
+ }
1225
+ const L = c ? {
1226
+ useListenToCustomEvent: ae,
1227
+ enterFullscreen: Ae,
1228
+ exitFullscreen: De,
1229
+ getIsFullscreen: Be,
1230
+ slideToPrevItem: (r = !0) => {
1231
+ ge({
1232
+ type: "click",
1233
+ immediate: !r
1234
+ });
1235
+ },
1236
+ slideToNextItem: (r = !0) => {
1237
+ ue({
1238
+ type: "click",
1239
+ immediate: !r
1240
+ });
1241
+ }
1242
+ } : {
1243
+ useListenToCustomEvent: ae,
1244
+ enterFullscreen: Ae,
1245
+ exitFullscreen: De,
1246
+ getIsFullscreen: Be,
1247
+ slideToPrevItem: (r = !0) => {
1248
+ ge({
1249
+ type: "click",
1250
+ immediate: !r
1251
+ });
1252
+ },
1253
+ slideToNextItem: (r = !0) => {
1254
+ ue({
1255
+ type: "click",
1256
+ immediate: !r
1257
+ });
1258
+ },
1259
+ slideToItem: (r, o = !0) => {
1260
+ Ne({ id: r, immediate: !o });
1261
+ },
1262
+ getIsNextItem: We,
1263
+ getIsPrevItem: Se,
1264
+ getIsActiveItem: Ve
1265
+ };
1266
+ Er(() => {
1267
+ P.current && h && (se.current = !0, ye());
1268
+ }, [h]), ne(() => {
1269
+ Y.current !== j && Ne({
1270
+ id: j,
1271
+ immediate: !$
1272
+ });
1273
+ }, [j]), ne(() => {
1274
+ if (h) {
1275
+ if (j > i.length - 1)
1276
+ throw new Error(
1277
+ `initialActiveItem (${j}) is greater than the total quantity available items (${i.length}).`
1278
+ );
1279
+ X > i.length && console.warn(
1280
+ `itemsPerSlide (${X}) is greater than the total quantity available items (${i.length}). Fallback to ${i.length})`
1281
+ );
1282
+ }
1283
+ }, [j, i.length, X, h]), ne(() => {
1284
+ me.current = window.innerWidth;
1285
+ }, []), ne(() => {
1286
+ h && (se.current = !0, ye());
1287
+ }, [b, X, f, _, h, s]), ne(() => {
1288
+ if (!h)
1289
+ return;
1290
+ function r() {
1291
+ document.hidden ? q.current = !0 : q.current = !1;
1292
+ }
1293
+ return document.addEventListener("visibilitychange", r), () => {
1294
+ document.removeEventListener("visibilitychange", r);
1295
+ };
1296
+ }, [h]), ne(() => {
1297
+ if (g.current) {
1298
+ let r;
1299
+ const o = new _r(() => {
1300
+ if (K.current) {
1301
+ K.current = !1;
1302
+ return;
1303
+ }
1304
+ if (!q.current && !se.current) {
1305
+ me.current = window.innerWidth;
1306
+ const a = Pe();
1307
+ window.clearTimeout(r), r = setTimeout(() => {
1308
+ ve.current = N(), typeof a == "function" && a();
1309
+ }, 100);
1310
+ }
1311
+ });
1312
+ return o.observe(g.current), () => {
1313
+ o.disconnect();
1314
+ };
1315
+ }
1316
+ }, [Pe, N]), ne(() => {
1317
+ Ie && Ie({
1318
+ slideToNextItem: L.slideToNextItem,
1319
+ slideToPrevItem: L.slideToPrevItem,
1320
+ slideToItem: L == null ? void 0 : L.slideToItem
1321
+ });
1322
+ }, [Ie, L.slideToItem, L.slideToNextItem, L.slideToPrevItem]);
1323
+ const ze = /* @__PURE__ */ J.jsx(er.Provider, { value: L, children: $e }), Te = /* @__PURE__ */ J.jsx(er.Provider, { value: L, children: /* @__PURE__ */ J.jsx(
1324
+ "div",
1325
+ {
1326
+ className: "use-spring-carousel-main-wrapper",
1327
+ ref: g,
1328
+ ...Ze(),
1329
+ style: {
1330
+ display: "flex",
1331
+ position: "relative",
1332
+ width: "100%",
1333
+ height: "100%",
1334
+ ...Je()
1335
+ },
1336
+ children: /* @__PURE__ */ J.jsxs(
1337
+ "div",
1338
+ {
1339
+ className: "use-spring-carousel-track-wrapper",
1340
+ ref: P,
1341
+ ...He(),
1342
+ style: {
1343
+ position: "relative",
1344
+ display: "flex",
1345
+ flexDirection: d === "x" ? "row" : "column",
1346
+ touchAction: Qe(),
1347
+ ...qe()
1348
+ },
1349
+ children: [
1350
+ (c || !s) && f ? /* @__PURE__ */ J.jsx(
1351
+ "div",
1352
+ {
1353
+ style: {
1354
+ flexShrink: 0,
1355
+ width: f
1356
+ }
1357
+ }
1358
+ ) : null,
1359
+ we.map((r, o) => /* @__PURE__ */ J.jsx(
1360
+ "div",
1361
+ {
1362
+ className: "use-spring-carousel-item",
1363
+ "data-testid": "use-spring-carousel-item-wrapper",
1364
+ style: {
1365
+ display: "flex",
1366
+ position: "relative",
1367
+ flex: "1",
1368
+ ...Ke(
1369
+ o === we.findIndex(
1370
+ (a) => a.id === we[we.length - 1].id
1371
+ )
1372
+ )
1373
+ },
1374
+ children: typeof r.renderItem == "function" ? r.renderItem({
1375
+ getIsActiveItem: Ve,
1376
+ getIsNextItem: We,
1377
+ getIsPrevItem: Se,
1378
+ useListenToCustomEvent: ae
1379
+ }) : r.renderItem
1380
+ },
1381
+ `${r.id}-${o}`
1382
+ )),
1383
+ (c || !s) && f ? /* @__PURE__ */ J.jsx(
1384
+ "div",
1385
+ {
1386
+ style: {
1387
+ flexShrink: 0,
1388
+ width: f
1389
+ }
1390
+ }
1391
+ ) : null
1392
+ ]
1393
+ }
1394
+ )
1395
+ }
1396
+ ) });
1397
+ return { ...L, carouselFragment: Te, thumbsFragment: ze };
1398
+ }
1399
+ const er = lr(void 0);
1400
+ function Wr() {
1401
+ const i = sr(er);
1402
+ if (!i)
1403
+ throw new Error("useSpringCarouselContext must be used within the carousel.");
1404
+ return i;
1405
+ }
1406
+ const Fe = {
1407
+ initial: {
1408
+ opacity: 1,
1409
+ position: "relative"
1410
+ },
1411
+ from: {
1412
+ opacity: 0,
1413
+ position: "relative"
1414
+ },
1415
+ enter: {
1416
+ position: "relative",
1417
+ opacity: 1
1418
+ },
1419
+ leave: {
1420
+ opacity: 1,
1421
+ position: "absolute"
1422
+ }
1423
+ };
1424
+ function Sr({
1425
+ init: i = !0,
1426
+ disableGestures: h = !1,
1427
+ items: p,
1428
+ springConfig: D = Oe.default,
1429
+ exitBeforeEnter: V = !1,
1430
+ trail: y,
1431
+ withLoop: _ = !1,
1432
+ activeItem: s,
1433
+ toPrevItemSpringProps: f = Fe,
1434
+ toNextItemSpringProps: d = Fe,
1435
+ draggingSlideTreshold: M = 50,
1436
+ thumbsSlideAxis: A = "x"
1437
+ }) {
1438
+ const I = O("next"), c = O("initial"), B = O(null), [b, ie] = Tr(s ?? 0), { emitEvent: j, useListenToCustomEvent: $ } = vr(), { handleScroll: Ie, thumbsFragment: X } = mr({
1439
+ thumbsSlideAxis: A,
1440
+ items: p,
1441
+ renderThumbFnProps: {
1442
+ getIsNextItem: T,
1443
+ getIsPrevItem: g,
1444
+ useListenToCustomEvent: $,
1445
+ activeItem: {
1446
+ index: b,
1447
+ id: p[b].id
1448
+ }
1449
+ }
1450
+ });
1451
+ function se() {
1452
+ return I.current === "prev" ? {
1453
+ initial: {
1454
+ ...f.initial
1455
+ },
1456
+ from: {
1457
+ ...f.from
1458
+ },
1459
+ enter: {
1460
+ ...f.enter
1461
+ },
1462
+ leave: {
1463
+ ...f.leave
1464
+ }
1465
+ } : I.current === "next" ? {
1466
+ initial: {
1467
+ ...d.initial
1468
+ },
1469
+ from: {
1470
+ ...d.from
1471
+ },
1472
+ enter: {
1473
+ ...d.enter
1474
+ },
1475
+ leave: {
1476
+ ...d.leave
1477
+ }
1478
+ } : {
1479
+ initial: {
1480
+ ...Fe.initial
1481
+ },
1482
+ from: {
1483
+ ...Fe.from
1484
+ },
1485
+ enter: {
1486
+ ...Fe.enter
1487
+ },
1488
+ leave: {
1489
+ ...Fe.leave
1490
+ }
1491
+ };
1492
+ }
1493
+ ne(() => {
1494
+ typeof s == "number" && s !== b && ie(s);
1495
+ }, [s]);
1496
+ function ee({ to: u, slideType: E, slideMode: k }) {
1497
+ I.current = E, c.current = k, j({
1498
+ eventName: "onSlideStartChange",
1499
+ slideActionType: I.current,
1500
+ slideMode: c.current,
1501
+ nextItem: {
1502
+ index: u,
1503
+ id: p[u].id,
1504
+ startReached: u === 0,
1505
+ endReached: u === p.length - 1
1506
+ }
1507
+ }), ie(u), Ie(b);
1508
+ }
1509
+ function z(u) {
1510
+ if (!i)
1511
+ return;
1512
+ const E = b === 0;
1513
+ !_ && E || ee(_ && E ? {
1514
+ to: p.length - 1,
1515
+ slideType: "prev",
1516
+ slideMode: u
1517
+ } : {
1518
+ to: b - 1,
1519
+ slideType: "prev",
1520
+ slideMode: u
1521
+ });
1522
+ }
1523
+ function fe(u) {
1524
+ if (!i)
1525
+ return;
1526
+ const E = b === p.length - 1;
1527
+ !_ && E || ee(_ && E ? {
1528
+ to: 0,
1529
+ slideType: "next",
1530
+ slideMode: u
1531
+ } : {
1532
+ to: b + 1,
1533
+ slideType: "next",
1534
+ slideMode: u
1535
+ });
1536
+ }
1537
+ const de = Rr(b, {
1538
+ config: D,
1539
+ key: null,
1540
+ trail: y,
1541
+ exitBeforeEnter: V,
1542
+ ...se(),
1543
+ onRest(u, E, k) {
1544
+ u.finished && k === b && j({
1545
+ eventName: "onSlideChange",
1546
+ slideActionType: I.current,
1547
+ slideMode: c.current,
1548
+ currentItem: {
1549
+ index: b,
1550
+ id: p[b].id,
1551
+ startReached: b === 0,
1552
+ endReached: b === p.length - 1
1553
+ }
1554
+ });
1555
+ }
1556
+ }), Y = dr(
1557
+ ({ last: u, movement: [E] }) => {
1558
+ if (u) {
1559
+ const k = E > M, te = E < -M, q = b === 0, je = b === p.length - 1;
1560
+ if (te) {
1561
+ if (!_ && je)
1562
+ return;
1563
+ j({
1564
+ eventName: "onLeftSwipe"
1565
+ }), fe("swipe");
1566
+ } else if (k) {
1567
+ if (!_ && q)
1568
+ return;
1569
+ j({
1570
+ eventName: "onRightSwipe"
1571
+ }), z("swipe");
1572
+ }
1573
+ }
1574
+ },
1575
+ {
1576
+ enabled: !h
1577
+ }
1578
+ );
1579
+ function C(u, E) {
1580
+ let k = 0;
1581
+ if (typeof u == "string" ? k = p.findIndex((te) => te.id === u) : k = u, k < 0 || k >= p.length) {
1582
+ if (E)
1583
+ throw new Error(E);
1584
+ console.error(`The item doesn't exist; check that the id provided - ${u} - is correct.`), k = -1;
1585
+ }
1586
+ return k;
1587
+ }
1588
+ function T(u) {
1589
+ const E = C(u, "The item doesn't exist; check the provided id."), k = b;
1590
+ return _ && k === p.length - 1 ? E === 0 : E === k + 1;
1591
+ }
1592
+ function g(u) {
1593
+ const E = C(u, "The item doesn't exist; check the provided id."), k = b;
1594
+ return _ && k === 0 ? E === p.length - 1 : E === k - 1;
1595
+ }
1596
+ const P = de((u, E, k, te) => {
1597
+ const q = p[E].renderItem;
1598
+ return /* @__PURE__ */ J.jsx(
1599
+ Ir.div,
1600
+ {
1601
+ id: `use-transition-carousel-item-${te}`,
1602
+ className: "use-transition-carousel-item",
1603
+ style: {
1604
+ ...u,
1605
+ flex: "1 0 100%",
1606
+ width: "100%",
1607
+ height: "100%"
1608
+ },
1609
+ children: typeof q == "function" ? q({
1610
+ useListenToCustomEvent: $,
1611
+ getIsNextItem: T,
1612
+ getIsPrevItem: g,
1613
+ activeItem: {
1614
+ index: b,
1615
+ id: p[b].id
1616
+ }
1617
+ }) : q
1618
+ }
1619
+ );
1620
+ }), K = {
1621
+ useListenToCustomEvent: $,
1622
+ slideToPrevItem: () => z("click"),
1623
+ slideToNextItem: () => fe("click")
1624
+ }, ve = /* @__PURE__ */ J.jsx(rr.Provider, { value: K, children: X }), me = /* @__PURE__ */ J.jsx(rr.Provider, { value: K, children: /* @__PURE__ */ J.jsx(
1625
+ "div",
1626
+ {
1627
+ ref: B,
1628
+ ...Y(),
1629
+ style: {
1630
+ display: "flex",
1631
+ position: "relative",
1632
+ width: "100%",
1633
+ height: "100%",
1634
+ overflow: "hidden"
1635
+ },
1636
+ children: P
1637
+ }
1638
+ ) });
1639
+ return {
1640
+ ...K,
1641
+ carouselFragment: me,
1642
+ thumbsFragment: ve
1643
+ };
1644
+ }
1645
+ const rr = lr(void 0);
1646
+ function Vr() {
1647
+ const i = sr(rr);
1648
+ if (!i)
1649
+ throw new Error("useTransitionCarouselContext must be used within the carousel.");
1650
+ return i;
1651
+ }
7
1652
  export {
8
- n as useSpringCarousel,
9
- p as useSpringCarouselContext,
10
- a as useTransitionCarousel,
11
- m as useTransitionCarouselContext
1653
+ Nr as useSpringCarousel,
1654
+ Wr as useSpringCarouselContext,
1655
+ Sr as useTransitionCarousel,
1656
+ Vr as useTransitionCarouselContext
12
1657
  };
1658
+ //# sourceMappingURL=index.es.js.map