Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

embla-carousel-react

Package Overview
Dependencies
Maintainers
1
Versions
121
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

embla-carousel-react - npm Package Compare versions

Comparing version 6.0.2 to 6.1.0

340

embla-carousel-react.esm.js

@@ -92,3 +92,3 @@ import { useState, useRef, useMemo, useEffect } from 'react';

function Axis(axis, contentDirection) {
function Axis(axis, direction) {
var scroll = axis === 'y' ? 'y' : 'x';

@@ -107,3 +107,3 @@ var cross = axis === 'y' ? 'x' : 'y';

if (scroll === 'y') return 'top';
return contentDirection === 'rtl' ? 'right' : 'left';
return direction === 'rtl' ? 'right' : 'left';
}

@@ -113,3 +113,3 @@

if (scroll === 'y') return 'bottom';
return contentDirection === 'rtl' ? 'left' : 'right';
return direction === 'rtl' ? 'left' : 'right';
}

@@ -127,4 +127,64 @@

function map(value, iStart, iStop, oStart, oStop) {
return oStart + (oStop - oStart) * ((value - iStart) / (iStop - iStart));
}
function mathAbs(n) {
return Math.abs(n);
}
function mathSign(n) {
return !n ? 0 : n / mathAbs(n);
}
function deltaAbs(valueB, valueA) {
return mathAbs(valueB - valueA);
}
function factorAbs(valueB, valueA) {
if (valueB === 0 || valueA === 0) return 0;
if (mathAbs(valueB) <= mathAbs(valueA)) return 0;
var diff = deltaAbs(mathAbs(valueB), mathAbs(valueA));
return mathAbs(diff / valueB);
}
function roundToDecimals(decimalPoints) {
var pow = Math.pow(10, decimalPoints);
return function (n) {
return Math.round(n * pow) / pow;
};
}
function debounce(callback, time) {
var timeout = 0;
return function () {
window.clearTimeout(timeout);
timeout = window.setTimeout(callback, time) || 0;
};
}
function arrayGroup(array, size) {
var groups = [];
for (var i = 0; i < array.length; i += size) {
groups.push(array.slice(i, i + size));
}
return groups;
}
function arrayKeys(array) {
return Object.keys(array).map(Number);
}
function arrayLast(array) {
return array[arrayLastIndex(array)];
}
function arrayLastIndex(array) {
return Math.max(0, array.length - 1);
}
function Limit(min, max) {
var length = Math.abs(min - max);
var length = mathAbs(min - max);

@@ -154,6 +214,6 @@ function reachedMin(n) {

var self = {
constrain: constrain,
length: length,
max: max,
min: min,
constrain: constrain,
reachedAny: reachedAny,

@@ -176,3 +236,3 @@ reachedMax: reachedMax,

function withinLimit(n) {
return !loop ? constrain(n) : Math.abs((loopEnd + n) % loopEnd);
return !loop ? constrain(n) : mathAbs((loopEnd + n) % loopEnd);
}

@@ -211,3 +271,3 @@

function applyTo(n) {
function apply(n) {
return n * sign;

@@ -217,3 +277,3 @@ }

var self = {
applyTo: applyTo
apply: apply
};

@@ -305,64 +365,5 @@ return self;

function map(value, iStart, iStop, oStart, oStop) {
return oStart + (oStop - oStart) * ((value - iStart) / (iStop - iStart));
}
function mathSign(n) {
return !n ? 0 : n / Math.abs(n);
}
function deltaAbs(valueB, valueA) {
return Math.abs(valueB - valueA);
}
function factorAbs(valueB, valueA) {
if (valueB === 0 || valueA === 0) return 0;
if (Math.abs(valueB) <= Math.abs(valueA)) return 0;
var diff = deltaAbs(Math.abs(valueB), Math.abs(valueA));
return Math.abs(diff / valueB);
}
function roundToDecimals(decimalPoints) {
var pow = Math.pow(10, decimalPoints);
return function (n) {
return Math.round(n * pow) / pow;
};
}
function debounce(callback, time) {
var timeout = 0;
return function () {
window.clearTimeout(timeout);
timeout = window.setTimeout(callback, time) || 0;
};
}
function groupArray(array, size) {
var groups = [];
for (var i = 0; i < array.length; i += size) {
groups.push(array.slice(i, i + size));
}
return groups;
}
function arrayKeys(array) {
return Object.keys(array).map(Number);
}
function arrayLast(array) {
return array[lastIndex(array)];
}
function lastIndex(array) {
return Math.max(0, array.length - 1);
}
function DragHandler(axis, direction, rootNode, target, dragFree, dragTracker, location, animation, scrollTo, scrollBody, scrollTarget, index, events, loop, skipSnaps) {
var scrollAxis = axis.scroll,
crossAxis = axis.cross;
var crossAxis = axis.cross;
var focusNodes = ['INPUT', 'SELECT', 'TEXTAREA'];
var startScroll = Vector1D(0);
var startCross = Vector1D(0);
var dragStartPoint = Vector1D(0);

@@ -372,8 +373,8 @@ var activationEvents = EventStore();

var snapForceBoost = {
mouse: 2.5,
touch: 3.5
mouse: 300,
touch: 400
};
var freeForceBoost = {
mouse: 5,
touch: 7
mouse: 500,
touch: 600
};

@@ -383,2 +384,4 @@ var baseSpeed = dragFree ? 5 : 16;

var dragThreshold = 20;
var startScroll = 0;
var startCross = 0;
var pointerIsDown = false;

@@ -423,4 +426,4 @@ var preventScroll = false;

var baseForce = scrollTarget.byDistance(force, !dragFree).distance;
if (dragFree || Math.abs(force) < dragThreshold) return baseForce;
if (!loop && isEdge) return baseForce * 0.6;
if (dragFree || mathAbs(force) < dragThreshold) return baseForce;
if (!loop && isEdge) return baseForce * 0.4;
if (skipSnaps && targetChanged) return baseForce * 0.5;

@@ -443,4 +446,4 @@ return scrollTarget.byIndex(next.get(), 0).distance;

addInteractionEvents();
startScroll.set(dragTracker.readPoint(evt, scrollAxis));
startCross.set(dragTracker.readPoint(evt, crossAxis));
startScroll = dragTracker.readPoint(evt);
startCross = dragTracker.readPoint(evt, crossAxis);
events.emit('pointerDown');

@@ -453,9 +456,9 @@ if (clearPreventClick) preventClick = false;

if (!preventScroll && !isMouse) {
if (!evt.cancelable) return up();
var moveScroll = dragTracker.readPoint(evt, scrollAxis).get();
var moveCross = dragTracker.readPoint(evt, crossAxis).get();
var diffScroll = deltaAbs(moveScroll, startScroll.get());
var diffCross = deltaAbs(moveCross, startCross.get());
if (!evt.cancelable) return up(evt);
var lastScroll = dragTracker.readPoint(evt);
var lastCross = dragTracker.readPoint(evt, crossAxis);
var diffScroll = deltaAbs(lastScroll, startScroll);
var diffCross = deltaAbs(lastCross, startCross);
preventScroll = diffScroll > diffCross;
if (!preventScroll && !preventClick) return up();
if (!preventScroll && !preventClick) return up(evt);
}

@@ -466,15 +469,15 @@

animation.start();
target.add(direction.applyTo(diff));
target.add(direction.apply(diff));
evt.preventDefault();
}
function up() {
function up(evt) {
var currentLocation = scrollTarget.byDistance(0, false);
var targetChanged = currentLocation.index !== index.get();
var rawForce = dragTracker.pointerUp() * forceBoost();
var force = allowedForce(direction.applyTo(rawForce), targetChanged);
var rawForce = dragTracker.pointerUp(evt) * forceBoost();
var force = allowedForce(direction.apply(rawForce), targetChanged);
var forceFactor = factorAbs(rawForce, force);
var isMoving = deltaAbs(target.get(), dragStartPoint.get()) >= 0.5;
var isVigorous = targetChanged && forceFactor > 0.75;
var isBelowThreshold = Math.abs(rawForce) < dragThreshold;
var isBelowThreshold = mathAbs(rawForce) < dragThreshold;
var speed = isVigorous ? 10 : baseSpeed;

@@ -514,63 +517,45 @@ var mass = isVigorous ? baseMass + 2.5 * forceFactor : baseMass;

function DragTracker(axis, pxToPercent) {
var scrollAxis = axis.scroll;
var coords = {
x: 'clientX',
y: 'clientY'
};
var startDrag = Vector1D(0);
var diffDrag = Vector1D(0);
var lastDrag = Vector1D(0);
var pointValue = Vector1D(0);
var trackInterval = 10;
var trackLength = 5;
var trackTime = 100;
var trackPoints = [];
var lastMoveTime = new Date().getTime();
var isMouse = false;
var logInterval = 170;
var startEvent;
var lastEvent;
function readPoint(evt, type) {
isMouse = !evt.touches;
var c = coords[type];
var value = isMouse ? evt[c] : evt.touches[0][c];
return pointValue.set(value);
function isTouchEvent(evt) {
return typeof TouchEvent !== 'undefined' && evt instanceof TouchEvent;
}
function readTime(evt) {
return evt.timeStamp;
}
function readPoint(evt, evtAxis) {
var property = evtAxis || axis.scroll;
var coord = "client" + (property === 'x' ? 'X' : 'Y');
return (isTouchEvent(evt) ? evt.touches[0] : evt)[coord];
}
function pointerDown(evt) {
var point = readPoint(evt, scrollAxis);
startDrag.set(point);
lastDrag.set(point);
return pxToPercent.measure(startDrag.get());
startEvent = evt;
lastEvent = evt;
return pxToPercent.measure(readPoint(evt));
}
function pointerMove(evt) {
var point = readPoint(evt, scrollAxis);
var nowTime = new Date().getTime();
var diffTime = nowTime - lastMoveTime;
if (diffTime >= trackInterval) {
if (diffTime >= trackTime) trackPoints = [];
trackPoints.push(point.get());
lastMoveTime = nowTime;
}
diffDrag.set(point).subtract(lastDrag);
lastDrag.set(point);
return pxToPercent.measure(diffDrag.get());
var diff = readPoint(evt) - readPoint(lastEvent);
var expired = readTime(evt) - readTime(startEvent) > logInterval;
lastEvent = evt;
if (expired) startEvent = evt;
return pxToPercent.measure(diff);
}
function pointerUp() {
var nowTime = new Date().getTime();
var diffTime = nowTime - lastMoveTime;
var currentPoint = lastDrag.get();
var force = trackPoints.slice(-trackLength).map(function (trackPoint) {
return currentPoint - trackPoint;
}).sort(function (p1, p2) {
return Math.abs(p1) < Math.abs(p2) ? 1 : -1;
})[0];
lastDrag.set(diffTime > trackTime || !force ? 0 : force);
trackPoints = [];
return pxToPercent.measure(lastDrag.get());
function pointerUp(evt) {
var diffDrag = readPoint(lastEvent) - readPoint(startEvent);
var diffTime = readTime(evt) - readTime(startEvent);
var expired = readTime(evt) - readTime(lastEvent) > logInterval;
var force = diffDrag / diffTime;
var isFlick = diffTime && !expired && mathAbs(force) > 0.1;
return isFlick ? pxToPercent.measure(force) : 0;
}
var self = {
isTouchEvent: isTouchEvent,
pointerDown: pointerDown,

@@ -672,2 +657,4 @@ pointerMove: pointerMove,

var pullBackThreshold = 10;
var edgeOffsetTolerance = 50;
var maxFriction = 0.85;
var disabled = false;

@@ -684,7 +671,9 @@

if (!shouldConstrain()) return;
var friction = pointerDown ? 0.7 : 0.45;
var edge = limit.reachedMin(location.get()) ? 'min' : 'max';
var diffToEdge = mathAbs(limit[edge] - location.get());
var diffToTarget = target.get() - location.get();
var friction = Math.min(diffToEdge / edgeOffsetTolerance, maxFriction);
target.subtract(diffToTarget * friction);
if (!pointerDown && Math.abs(diffToTarget) < pullBackThreshold) {
if (!pointerDown && mathAbs(diffToTarget) < pullBackThreshold) {
target.set(limit.constrain(target.get()));

@@ -803,5 +792,5 @@ scrollBody.useSpeed(10).useMass(3);

function measureSizes() {
return groupArray(slideRects, slidesToScroll).map(function (rects) {
return arrayGroup(slideRects, slidesToScroll).map(function (rects) {
return arrayLast(rects)[endEdge] - rects[0][startEdge];
}).map(pxToPercent.measure).map(Math.abs);
}).map(pxToPercent.measure).map(mathAbs);
}

@@ -813,3 +802,3 @@

}).map(pxToPercent.measure).map(function (snap) {
return -Math.abs(snap);
return -mathAbs(snap);
});

@@ -819,3 +808,3 @@ }

function measureAligned() {
var groupedSnaps = groupArray(snaps, slidesToScroll).map(function (g) {
var groupedSnaps = arrayGroup(snaps, slidesToScroll).map(function (g) {
return g[0];

@@ -842,3 +831,3 @@ });

function minDistance(d1, d2) {
return Math.abs(d1) < Math.abs(d2) ? d1 : d2;
return mathAbs(d1) < mathAbs(d2) ? d1 : d2;
}

@@ -858,3 +847,3 @@

}).sort(function (d1, d2) {
return Math.abs(d1.diff) - Math.abs(d2.diff);
return mathAbs(d1.diff) - mathAbs(d2.diff);
});

@@ -875,3 +864,3 @@ var index = ascDiffsToSnaps[0].index;

var shortest = minDistance(t1, direction === 1 ? t2 : t3);
return Math.abs(shortest) * direction;
return mathAbs(shortest) * direction;
}

@@ -972,3 +961,3 @@

var offset = isStartEdge ? -contentSize : contentSize;
var slideBounds = slidesInView.findSlideBounds(offset);
var slideBounds = slidesInView.findSlideBounds([offset]);
return indexes.map(function (index) {

@@ -982,3 +971,3 @@ var initial = isStartEdge ? 0 : -contentSize;

var getTarget = function getTarget() {
var getTarget = function () {
return scrollLocation.get() > point ? initial : altered;

@@ -1048,23 +1037,30 @@ };

function SlidesInView(viewSize, contentSize, slideSizes, snaps, loop, inViewThreshold) {
var threshold = Math.min(Math.max(inViewThreshold, 0.01), 0.99);
var offsets = loop ? [0, contentSize, -contentSize] : [0];
var slideBounds = offsets.reduce(function (a, offset) {
return a.concat(findSlideBounds(offset, threshold));
}, []);
function SlidesInView(viewSize, contentSize, slideSizes, snaps, limit, loop, inViewThreshold) {
var removeOffset = limit.removeOffset,
constrain = limit.constrain;
var cachedThreshold = Math.min(Math.max(inViewThreshold, 0.01), 0.99);
var cachedOffsets = loop ? [0, contentSize, -contentSize] : [0];
var cachedBounds = findSlideBounds(cachedOffsets, cachedThreshold);
function findSlideBounds(offset, threshold) {
function findSlideBounds(offsets, threshold) {
var slideOffsets = offsets || cachedOffsets;
var slideThreshold = threshold || 0;
var thresholds = slideSizes.map(function (s) {
return s * (threshold || 0);
return s * slideThreshold;
});
return snaps.map(function (snap, index) {
return {
start: snap - slideSizes[index] + thresholds[index] + offset,
end: snap + viewSize - thresholds[index] + offset,
index: index
};
});
return slideOffsets.reduce(function (list, offset) {
var bounds = snaps.map(function (snap, index) {
return {
start: snap - slideSizes[index] + thresholds[index] + offset,
end: snap + viewSize - thresholds[index] + offset,
index: index
};
});
return list.concat(bounds);
}, []);
}
function check(location) {
function check(location, bounds) {
var limitedLocation = loop ? removeOffset(location) : constrain(location);
var slideBounds = bounds || cachedBounds;
return slideBounds.reduce(function (list, slideBound) {

@@ -1075,3 +1071,3 @@ var index = slideBound.index,

var inList = list.indexOf(index) !== -1;
var inView = start < location && end > location;
var inView = start < limitedLocation && end > limitedLocation;
return !inList && inView ? list.concat([index]) : list;

@@ -1098,3 +1094,3 @@ }, []);

return slideRects.map(function (rect, index, rects) {
var isLast = index === lastIndex(rects);
var isLast = index === arrayLastIndex(rects);
var style = window.getComputedStyle(arrayLast(slides));

@@ -1104,3 +1100,3 @@ var endGap = parseFloat(style.getPropertyValue("margin-" + endEdge));

return rects[index + 1][startEdge] - rect[startEdge];
}).map(pxToPercent.measure).map(Math.abs);
}).map(pxToPercent.measure).map(mathAbs);
}

@@ -1116,4 +1112,4 @@

function Translate(axis, direction, container) {
var translate = axis.scroll === 'x' ? x : y;
var containerStyle = container.style;
var translate = axis.scroll === 'x' ? x : y;
var disabled = false;

@@ -1131,3 +1127,3 @@

if (disabled) return;
containerStyle.transform = translate(direction.applyTo(target.get()));
containerStyle.transform = translate(direction.apply(target.get()));
}

@@ -1189,7 +1185,7 @@

var index = Counter(lastIndex(scrollSnaps), startIndex, loop);
var index = Counter(arrayLastIndex(scrollSnaps), startIndex, loop);
var indexPrevious = index.clone();
var slideIndexes = arrayKeys(slides); // Draw
var update = function update() {
var update = function () {
if (!loop) engine.scrollBounds.constrain(engine.dragHandler.pointerDown());

@@ -1225,3 +1221,3 @@ engine.scrollBody.seek(target).update();

var scrollTo = ScrollTo(animation, index, indexPrevious, scrollTarget, target, events);
var slidesInView = SlidesInView(viewSize, contentSize, slideSizes, snaps, loop, inViewThreshold); // DragHandler
var slidesInView = SlidesInView(viewSize, contentSize, slideSizes, snaps, limit, loop, inViewThreshold); // DragHandler

@@ -1231,2 +1227,4 @@ var dragHandler = DragHandler(axis, direction, root, target, dragFree, DragTracker(axis, pxToPercent), location, animation, scrollTo, scrollBody, scrollTarget, index, events, loop, skipSnaps); // Slider

var engine = {
containerRect: containerRect,
slideRects: slideRects,
animation: animation,

@@ -1233,0 +1231,0 @@ axis: axis,

@@ -94,3 +94,3 @@ 'use strict';

function Axis(axis, contentDirection) {
function Axis(axis, direction) {
var scroll = axis === 'y' ? 'y' : 'x';

@@ -109,3 +109,3 @@ var cross = axis === 'y' ? 'x' : 'y';

if (scroll === 'y') return 'top';
return contentDirection === 'rtl' ? 'right' : 'left';
return direction === 'rtl' ? 'right' : 'left';
}

@@ -115,3 +115,3 @@

if (scroll === 'y') return 'bottom';
return contentDirection === 'rtl' ? 'left' : 'right';
return direction === 'rtl' ? 'left' : 'right';
}

@@ -129,4 +129,64 @@

function map(value, iStart, iStop, oStart, oStop) {
return oStart + (oStop - oStart) * ((value - iStart) / (iStop - iStart));
}
function mathAbs(n) {
return Math.abs(n);
}
function mathSign(n) {
return !n ? 0 : n / mathAbs(n);
}
function deltaAbs(valueB, valueA) {
return mathAbs(valueB - valueA);
}
function factorAbs(valueB, valueA) {
if (valueB === 0 || valueA === 0) return 0;
if (mathAbs(valueB) <= mathAbs(valueA)) return 0;
var diff = deltaAbs(mathAbs(valueB), mathAbs(valueA));
return mathAbs(diff / valueB);
}
function roundToDecimals(decimalPoints) {
var pow = Math.pow(10, decimalPoints);
return function (n) {
return Math.round(n * pow) / pow;
};
}
function debounce(callback, time) {
var timeout = 0;
return function () {
window.clearTimeout(timeout);
timeout = window.setTimeout(callback, time) || 0;
};
}
function arrayGroup(array, size) {
var groups = [];
for (var i = 0; i < array.length; i += size) {
groups.push(array.slice(i, i + size));
}
return groups;
}
function arrayKeys(array) {
return Object.keys(array).map(Number);
}
function arrayLast(array) {
return array[arrayLastIndex(array)];
}
function arrayLastIndex(array) {
return Math.max(0, array.length - 1);
}
function Limit(min, max) {
var length = Math.abs(min - max);
var length = mathAbs(min - max);

@@ -156,6 +216,6 @@ function reachedMin(n) {

var self = {
constrain: constrain,
length: length,
max: max,
min: min,
constrain: constrain,
reachedAny: reachedAny,

@@ -178,3 +238,3 @@ reachedMax: reachedMax,

function withinLimit(n) {
return !loop ? constrain(n) : Math.abs((loopEnd + n) % loopEnd);
return !loop ? constrain(n) : mathAbs((loopEnd + n) % loopEnd);
}

@@ -213,3 +273,3 @@

function applyTo(n) {
function apply(n) {
return n * sign;

@@ -219,3 +279,3 @@ }

var self = {
applyTo: applyTo
apply: apply
};

@@ -307,64 +367,5 @@ return self;

function map(value, iStart, iStop, oStart, oStop) {
return oStart + (oStop - oStart) * ((value - iStart) / (iStop - iStart));
}
function mathSign(n) {
return !n ? 0 : n / Math.abs(n);
}
function deltaAbs(valueB, valueA) {
return Math.abs(valueB - valueA);
}
function factorAbs(valueB, valueA) {
if (valueB === 0 || valueA === 0) return 0;
if (Math.abs(valueB) <= Math.abs(valueA)) return 0;
var diff = deltaAbs(Math.abs(valueB), Math.abs(valueA));
return Math.abs(diff / valueB);
}
function roundToDecimals(decimalPoints) {
var pow = Math.pow(10, decimalPoints);
return function (n) {
return Math.round(n * pow) / pow;
};
}
function debounce(callback, time) {
var timeout = 0;
return function () {
window.clearTimeout(timeout);
timeout = window.setTimeout(callback, time) || 0;
};
}
function groupArray(array, size) {
var groups = [];
for (var i = 0; i < array.length; i += size) {
groups.push(array.slice(i, i + size));
}
return groups;
}
function arrayKeys(array) {
return Object.keys(array).map(Number);
}
function arrayLast(array) {
return array[lastIndex(array)];
}
function lastIndex(array) {
return Math.max(0, array.length - 1);
}
function DragHandler(axis, direction, rootNode, target, dragFree, dragTracker, location, animation, scrollTo, scrollBody, scrollTarget, index, events, loop, skipSnaps) {
var scrollAxis = axis.scroll,
crossAxis = axis.cross;
var crossAxis = axis.cross;
var focusNodes = ['INPUT', 'SELECT', 'TEXTAREA'];
var startScroll = Vector1D(0);
var startCross = Vector1D(0);
var dragStartPoint = Vector1D(0);

@@ -374,8 +375,8 @@ var activationEvents = EventStore();

var snapForceBoost = {
mouse: 2.5,
touch: 3.5
mouse: 300,
touch: 400
};
var freeForceBoost = {
mouse: 5,
touch: 7
mouse: 500,
touch: 600
};

@@ -385,2 +386,4 @@ var baseSpeed = dragFree ? 5 : 16;

var dragThreshold = 20;
var startScroll = 0;
var startCross = 0;
var pointerIsDown = false;

@@ -425,4 +428,4 @@ var preventScroll = false;

var baseForce = scrollTarget.byDistance(force, !dragFree).distance;
if (dragFree || Math.abs(force) < dragThreshold) return baseForce;
if (!loop && isEdge) return baseForce * 0.6;
if (dragFree || mathAbs(force) < dragThreshold) return baseForce;
if (!loop && isEdge) return baseForce * 0.4;
if (skipSnaps && targetChanged) return baseForce * 0.5;

@@ -445,4 +448,4 @@ return scrollTarget.byIndex(next.get(), 0).distance;

addInteractionEvents();
startScroll.set(dragTracker.readPoint(evt, scrollAxis));
startCross.set(dragTracker.readPoint(evt, crossAxis));
startScroll = dragTracker.readPoint(evt);
startCross = dragTracker.readPoint(evt, crossAxis);
events.emit('pointerDown');

@@ -455,9 +458,9 @@ if (clearPreventClick) preventClick = false;

if (!preventScroll && !isMouse) {
if (!evt.cancelable) return up();
var moveScroll = dragTracker.readPoint(evt, scrollAxis).get();
var moveCross = dragTracker.readPoint(evt, crossAxis).get();
var diffScroll = deltaAbs(moveScroll, startScroll.get());
var diffCross = deltaAbs(moveCross, startCross.get());
if (!evt.cancelable) return up(evt);
var lastScroll = dragTracker.readPoint(evt);
var lastCross = dragTracker.readPoint(evt, crossAxis);
var diffScroll = deltaAbs(lastScroll, startScroll);
var diffCross = deltaAbs(lastCross, startCross);
preventScroll = diffScroll > diffCross;
if (!preventScroll && !preventClick) return up();
if (!preventScroll && !preventClick) return up(evt);
}

@@ -468,15 +471,15 @@

animation.start();
target.add(direction.applyTo(diff));
target.add(direction.apply(diff));
evt.preventDefault();
}
function up() {
function up(evt) {
var currentLocation = scrollTarget.byDistance(0, false);
var targetChanged = currentLocation.index !== index.get();
var rawForce = dragTracker.pointerUp() * forceBoost();
var force = allowedForce(direction.applyTo(rawForce), targetChanged);
var rawForce = dragTracker.pointerUp(evt) * forceBoost();
var force = allowedForce(direction.apply(rawForce), targetChanged);
var forceFactor = factorAbs(rawForce, force);
var isMoving = deltaAbs(target.get(), dragStartPoint.get()) >= 0.5;
var isVigorous = targetChanged && forceFactor > 0.75;
var isBelowThreshold = Math.abs(rawForce) < dragThreshold;
var isBelowThreshold = mathAbs(rawForce) < dragThreshold;
var speed = isVigorous ? 10 : baseSpeed;

@@ -516,63 +519,45 @@ var mass = isVigorous ? baseMass + 2.5 * forceFactor : baseMass;

function DragTracker(axis, pxToPercent) {
var scrollAxis = axis.scroll;
var coords = {
x: 'clientX',
y: 'clientY'
};
var startDrag = Vector1D(0);
var diffDrag = Vector1D(0);
var lastDrag = Vector1D(0);
var pointValue = Vector1D(0);
var trackInterval = 10;
var trackLength = 5;
var trackTime = 100;
var trackPoints = [];
var lastMoveTime = new Date().getTime();
var isMouse = false;
var logInterval = 170;
var startEvent;
var lastEvent;
function readPoint(evt, type) {
isMouse = !evt.touches;
var c = coords[type];
var value = isMouse ? evt[c] : evt.touches[0][c];
return pointValue.set(value);
function isTouchEvent(evt) {
return typeof TouchEvent !== 'undefined' && evt instanceof TouchEvent;
}
function readTime(evt) {
return evt.timeStamp;
}
function readPoint(evt, evtAxis) {
var property = evtAxis || axis.scroll;
var coord = "client" + (property === 'x' ? 'X' : 'Y');
return (isTouchEvent(evt) ? evt.touches[0] : evt)[coord];
}
function pointerDown(evt) {
var point = readPoint(evt, scrollAxis);
startDrag.set(point);
lastDrag.set(point);
return pxToPercent.measure(startDrag.get());
startEvent = evt;
lastEvent = evt;
return pxToPercent.measure(readPoint(evt));
}
function pointerMove(evt) {
var point = readPoint(evt, scrollAxis);
var nowTime = new Date().getTime();
var diffTime = nowTime - lastMoveTime;
if (diffTime >= trackInterval) {
if (diffTime >= trackTime) trackPoints = [];
trackPoints.push(point.get());
lastMoveTime = nowTime;
}
diffDrag.set(point).subtract(lastDrag);
lastDrag.set(point);
return pxToPercent.measure(diffDrag.get());
var diff = readPoint(evt) - readPoint(lastEvent);
var expired = readTime(evt) - readTime(startEvent) > logInterval;
lastEvent = evt;
if (expired) startEvent = evt;
return pxToPercent.measure(diff);
}
function pointerUp() {
var nowTime = new Date().getTime();
var diffTime = nowTime - lastMoveTime;
var currentPoint = lastDrag.get();
var force = trackPoints.slice(-trackLength).map(function (trackPoint) {
return currentPoint - trackPoint;
}).sort(function (p1, p2) {
return Math.abs(p1) < Math.abs(p2) ? 1 : -1;
})[0];
lastDrag.set(diffTime > trackTime || !force ? 0 : force);
trackPoints = [];
return pxToPercent.measure(lastDrag.get());
function pointerUp(evt) {
var diffDrag = readPoint(lastEvent) - readPoint(startEvent);
var diffTime = readTime(evt) - readTime(startEvent);
var expired = readTime(evt) - readTime(lastEvent) > logInterval;
var force = diffDrag / diffTime;
var isFlick = diffTime && !expired && mathAbs(force) > 0.1;
return isFlick ? pxToPercent.measure(force) : 0;
}
var self = {
isTouchEvent: isTouchEvent,
pointerDown: pointerDown,

@@ -674,2 +659,4 @@ pointerMove: pointerMove,

var pullBackThreshold = 10;
var edgeOffsetTolerance = 50;
var maxFriction = 0.85;
var disabled = false;

@@ -686,7 +673,9 @@

if (!shouldConstrain()) return;
var friction = pointerDown ? 0.7 : 0.45;
var edge = limit.reachedMin(location.get()) ? 'min' : 'max';
var diffToEdge = mathAbs(limit[edge] - location.get());
var diffToTarget = target.get() - location.get();
var friction = Math.min(diffToEdge / edgeOffsetTolerance, maxFriction);
target.subtract(diffToTarget * friction);
if (!pointerDown && Math.abs(diffToTarget) < pullBackThreshold) {
if (!pointerDown && mathAbs(diffToTarget) < pullBackThreshold) {
target.set(limit.constrain(target.get()));

@@ -805,5 +794,5 @@ scrollBody.useSpeed(10).useMass(3);

function measureSizes() {
return groupArray(slideRects, slidesToScroll).map(function (rects) {
return arrayGroup(slideRects, slidesToScroll).map(function (rects) {
return arrayLast(rects)[endEdge] - rects[0][startEdge];
}).map(pxToPercent.measure).map(Math.abs);
}).map(pxToPercent.measure).map(mathAbs);
}

@@ -815,3 +804,3 @@

}).map(pxToPercent.measure).map(function (snap) {
return -Math.abs(snap);
return -mathAbs(snap);
});

@@ -821,3 +810,3 @@ }

function measureAligned() {
var groupedSnaps = groupArray(snaps, slidesToScroll).map(function (g) {
var groupedSnaps = arrayGroup(snaps, slidesToScroll).map(function (g) {
return g[0];

@@ -844,3 +833,3 @@ });

function minDistance(d1, d2) {
return Math.abs(d1) < Math.abs(d2) ? d1 : d2;
return mathAbs(d1) < mathAbs(d2) ? d1 : d2;
}

@@ -860,3 +849,3 @@

}).sort(function (d1, d2) {
return Math.abs(d1.diff) - Math.abs(d2.diff);
return mathAbs(d1.diff) - mathAbs(d2.diff);
});

@@ -877,3 +866,3 @@ var index = ascDiffsToSnaps[0].index;

var shortest = minDistance(t1, direction === 1 ? t2 : t3);
return Math.abs(shortest) * direction;
return mathAbs(shortest) * direction;
}

@@ -974,3 +963,3 @@

var offset = isStartEdge ? -contentSize : contentSize;
var slideBounds = slidesInView.findSlideBounds(offset);
var slideBounds = slidesInView.findSlideBounds([offset]);
return indexes.map(function (index) {

@@ -984,3 +973,3 @@ var initial = isStartEdge ? 0 : -contentSize;

var getTarget = function getTarget() {
var getTarget = function () {
return scrollLocation.get() > point ? initial : altered;

@@ -1050,23 +1039,30 @@ };

function SlidesInView(viewSize, contentSize, slideSizes, snaps, loop, inViewThreshold) {
var threshold = Math.min(Math.max(inViewThreshold, 0.01), 0.99);
var offsets = loop ? [0, contentSize, -contentSize] : [0];
var slideBounds = offsets.reduce(function (a, offset) {
return a.concat(findSlideBounds(offset, threshold));
}, []);
function SlidesInView(viewSize, contentSize, slideSizes, snaps, limit, loop, inViewThreshold) {
var removeOffset = limit.removeOffset,
constrain = limit.constrain;
var cachedThreshold = Math.min(Math.max(inViewThreshold, 0.01), 0.99);
var cachedOffsets = loop ? [0, contentSize, -contentSize] : [0];
var cachedBounds = findSlideBounds(cachedOffsets, cachedThreshold);
function findSlideBounds(offset, threshold) {
function findSlideBounds(offsets, threshold) {
var slideOffsets = offsets || cachedOffsets;
var slideThreshold = threshold || 0;
var thresholds = slideSizes.map(function (s) {
return s * (threshold || 0);
return s * slideThreshold;
});
return snaps.map(function (snap, index) {
return {
start: snap - slideSizes[index] + thresholds[index] + offset,
end: snap + viewSize - thresholds[index] + offset,
index: index
};
});
return slideOffsets.reduce(function (list, offset) {
var bounds = snaps.map(function (snap, index) {
return {
start: snap - slideSizes[index] + thresholds[index] + offset,
end: snap + viewSize - thresholds[index] + offset,
index: index
};
});
return list.concat(bounds);
}, []);
}
function check(location) {
function check(location, bounds) {
var limitedLocation = loop ? removeOffset(location) : constrain(location);
var slideBounds = bounds || cachedBounds;
return slideBounds.reduce(function (list, slideBound) {

@@ -1077,3 +1073,3 @@ var index = slideBound.index,

var inList = list.indexOf(index) !== -1;
var inView = start < location && end > location;
var inView = start < limitedLocation && end > limitedLocation;
return !inList && inView ? list.concat([index]) : list;

@@ -1100,3 +1096,3 @@ }, []);

return slideRects.map(function (rect, index, rects) {
var isLast = index === lastIndex(rects);
var isLast = index === arrayLastIndex(rects);
var style = window.getComputedStyle(arrayLast(slides));

@@ -1106,3 +1102,3 @@ var endGap = parseFloat(style.getPropertyValue("margin-" + endEdge));

return rects[index + 1][startEdge] - rect[startEdge];
}).map(pxToPercent.measure).map(Math.abs);
}).map(pxToPercent.measure).map(mathAbs);
}

@@ -1118,4 +1114,4 @@

function Translate(axis, direction, container) {
var translate = axis.scroll === 'x' ? x : y;
var containerStyle = container.style;
var translate = axis.scroll === 'x' ? x : y;
var disabled = false;

@@ -1133,3 +1129,3 @@

if (disabled) return;
containerStyle.transform = translate(direction.applyTo(target.get()));
containerStyle.transform = translate(direction.apply(target.get()));
}

@@ -1191,7 +1187,7 @@

var index = Counter(lastIndex(scrollSnaps), startIndex, loop);
var index = Counter(arrayLastIndex(scrollSnaps), startIndex, loop);
var indexPrevious = index.clone();
var slideIndexes = arrayKeys(slides); // Draw
var update = function update() {
var update = function () {
if (!loop) engine.scrollBounds.constrain(engine.dragHandler.pointerDown());

@@ -1227,3 +1223,3 @@ engine.scrollBody.seek(target).update();

var scrollTo = ScrollTo(animation, index, indexPrevious, scrollTarget, target, events);
var slidesInView = SlidesInView(viewSize, contentSize, slideSizes, snaps, loop, inViewThreshold); // DragHandler
var slidesInView = SlidesInView(viewSize, contentSize, slideSizes, snaps, limit, loop, inViewThreshold); // DragHandler

@@ -1233,2 +1229,4 @@ var dragHandler = DragHandler(axis, direction, root, target, dragFree, DragTracker(axis, pxToPercent), location, animation, scrollTo, scrollBody, scrollTarget, index, events, loop, skipSnaps); // Slider

var engine = {
containerRect: containerRect,
slideRects: slideRects,
animation: animation,

@@ -1235,0 +1233,0 @@ axis: axis,

@@ -1,1 +0,1 @@

!function(n,e){"object"==typeof exports&&"undefined"!=typeof module?module.exports=e(require("react")):"function"==typeof define&&define.amd?define(["react"],e):(n="undefined"!=typeof globalThis?globalThis:n||self).useEmblaCarousel=e(n.React)}(this,(function(n){"use strict";function e(n,e){return Object.keys(n).length===Object.keys(e).length&&Object.keys(n).every((function(t){return!!Object.prototype.hasOwnProperty.call(e,t)&&n[t]===e[t]}))}function t(n){return n.concat().sort((function(n,e){return n.name>e.name?1:-1})).map((function(n){return n.options}))}function r(n,e){var t={start:function(){return 0},center:function(n){return r(n)/2},end:r};function r(n){return e-n}return{measure:function(r){return"number"==typeof n?e*Number(n):t[n](r)}}}function o(n,e){var t=Math.abs(n-e);function r(e){return e<n}function o(n){return n>e}function i(n){return r(n)||o(n)}return{constrain:function(t){return i(t)?r(t)?n:e:t},length:t,max:e,min:n,reachedAny:i,reachedMax:o,reachedMin:r,removeOffset:function(n){return t?n-t*Math.ceil((n-e)/t):n}}}function i(n,e,t){var r=o(0,n),u=r.min,a=r.constrain,c=n+1,s=f(e);function f(n){return t?Math.abs((c+n)%c):a(n)}function d(){return s}function l(n){return s=f(n),p}var p={add:function(n){return l(d()+n)},clone:function(){return i(n,d(),t)},get:d,set:l,min:u,max:n};return p}function u(){var n=[];var e={add:function(t,r,o,i){return void 0===i&&(i=!1),t.addEventListener(r,o,i),n.push((function(){return t.removeEventListener(r,o,i)})),e},removeAll:function(){return n=n.filter((function(n){return n()})),e}};return e}function a(n){var e=n;function t(n){return e/=n,o}function r(n){return"number"==typeof n?n:n.get()}var o={add:function(n){return e+=r(n),o},divide:t,get:function(){return e},multiply:function(n){return e*=n,o},normalize:function(){return 0!==e&&t(e),o},set:function(n){return e=r(n),o},subtract:function(n){return e-=r(n),o}};return o}function c(n){return n?n/Math.abs(n):0}function s(n,e){return Math.abs(n-e)}function f(n,e){for(var t=[],r=0;r<n.length;r+=e)t.push(n.slice(r,r+e));return t}function d(n){return Object.keys(n).map(Number)}function l(n){return n[p(n)]}function p(n){return Math.max(0,n.length-1)}function m(n,e,t,r,o,i,f,d,l,p,m,g,v,h,x){var b=n.scroll,y=n.cross,M=["INPUT","SELECT","TEXTAREA"],S=a(0),w=a(0),E=a(0),T=u(),A=u(),O={mouse:2.5,touch:3.5},P={mouse:5,touch:7},B=o?5:16,D=!1,I=!1,k=!1,z=!1;function L(n){if(!(z="mousedown"===n.type)||0===n.button){var e,o,u=s(r.get(),f.get())>=2,a=z||!u,c=(e=n.target,o=e.nodeName||"",!(M.indexOf(o)>-1)),d=u||z&&c;D=!0,i.pointerDown(n),E.set(r),r.set(f),p.useBaseMass().useSpeed(80),function(){var n=z?document:t;A.add(n,"touchmove",j).add(n,"touchend",N).add(n,"mousemove",j).add(n,"mouseup",N)}(),S.set(i.readPoint(n,b)),w.set(i.readPoint(n,y)),v.emit("pointerDown"),a&&(k=!1),d&&n.preventDefault()}}function j(n){if(!I&&!z){if(!n.cancelable)return N();var t=i.readPoint(n,b).get(),o=i.readPoint(n,y).get(),u=s(t,S.get()),a=s(o,w.get());if(!(I=u>a)&&!k)return N()}var c=i.pointerMove(n);!k&&c&&(k=!0),d.start(),r.add(e.applyTo(c)),n.preventDefault()}function N(){var n=m.byDistance(0,!1).index!==g.get(),t=i.pointerUp()*(o?P:O)[z?"mouse":"touch"],u=function(n,e){var t=g.clone().add(-1*c(n)),r=t.get()===g.min||t.get()===g.max,i=m.byDistance(n,!o).distance;return o||Math.abs(n)<20?i:!h&&r?.6*i:x&&e?.5*i:m.byIndex(t.get(),0).distance}(e.applyTo(t),n),a=function(n,e){if(0===n||0===e)return 0;if(Math.abs(n)<=Math.abs(e))return 0;var t=s(Math.abs(n),Math.abs(e));return Math.abs(t/n)}(t,u),f=s(r.get(),E.get())>=.5,d=n&&a>.75,b=Math.abs(t)<20,y=d?10:B,M=d?1+2.5*a:1;f&&!z&&(k=!0),I=!1,D=!1,A.removeAll(),p.useSpeed(b?9:y).useMass(M),l.distance(u,!o),z=!1,v.emit("pointerUp")}function C(n){k&&n.preventDefault()}return{addActivationEvents:function(){var n=t;T.add(n,"touchmove",(function(){})).add(n,"touchend",(function(){})).add(n,"touchstart",L).add(n,"mousedown",L).add(n,"touchcancel",N).add(n,"contextmenu",N).add(n,"click",C)},clickAllowed:function(){return!k},pointerDown:function(){return D},removeAllEvents:function(){T.removeAll(),A.removeAll()}}}function g(n,e,t){var r,o,i=(r=2,o=Math.pow(10,r),function(n){return Math.round(n*o)/o}),u=a(0),s=a(0),f=a(0),d=0,l=e,p=t;function m(n){return l=n,v}function g(n){return p=n,v}var v={direction:function(){return d},seek:function(e){f.set(e).subtract(n);var t,r,o,i,a=(t=f.get(),(o=0)+(t-(r=0))/(100-r)*(l-o));return d=c(f.get()),f.normalize().multiply(a).subtract(u),(i=f).divide(p),s.add(i),v},settle:function(e){var t=e.get()-n.get(),r=!i(t);return r&&n.set(e),r},update:function(){u.add(s),n.add(u),s.multiply(0)},useBaseMass:function(){return g(t)},useBaseSpeed:function(){return m(e)},useMass:g,useSpeed:m};return v}function v(n,e,t,r){var o=!1;return{constrain:function(i){if(!o&&n.reachedAny(t.get())&&n.reachedAny(e.get())){var u=i?.7:.45,a=t.get()-e.get();t.subtract(a*u),!i&&Math.abs(a)<10&&(t.set(n.constrain(t.get())),r.useSpeed(10).useMass(3))}},toggleActive:function(n){o=!n}}}function h(n,e,t,r,i){var u=o(-e+n,t[0]),a=r.map(u.constrain);return{snapsContained:function(){if(e<=n)return[u.max];if("keepSnaps"===i)return a;var t=function(){var n=a[0],e=l(a),t=a.lastIndexOf(n),r=a.indexOf(e)+1;return o(t,r)}(),r=t.min,c=t.max;return a.slice(r,c)}()}}function x(n,e,t,r,i){var u=o(t.min+e.measure(.1),t.max+e.measure(.1)),a=u.reachedMin,c=u.reachedMax;return{loop:function(e){if(function(n){return 1===n?c(r.get()):-1===n&&a(r.get())}(e)){var t=n*(-1*e);i.forEach((function(n){return n.add(t)}))}}}}function b(n){var e=n.max,t=n.length;return{get:function(n){return(n-e)/-t}}}function y(n,e,t,r,o,i){var u,a,c=n.startEdge,s=n.endEdge,d=o.map((function(n){return r[c]-n[c]})).map(t.measure).map((function(n){return-Math.abs(n)})),p=(u=f(d,i).map((function(n){return n[0]})),a=f(o,i).map((function(n){return l(n)[s]-n[0][c]})).map(t.measure).map(Math.abs).map(e.measure),u.map((function(n,e){return n+a[e]})));return{snaps:d,snapsAligned:p}}function M(n,e,t,r,o){var i=r.reachedAny,u=r.removeOffset,a=r.constrain;function c(n,e){return Math.abs(n)<Math.abs(e)?n:e}function s(e,r){var o=e,i=e+t,u=e-t;if(!n)return o;if(!r)return c(c(o,i),u);var a=c(o,1===r?i:u);return Math.abs(a)*r}return{byDistance:function(t,r){var c=o.get()+t,f=function(t){var r=n?u(t):a(t);return{index:e.map((function(n){return n-r})).map((function(n){return s(n,0)})).map((function(n,e){return{diff:n,index:e}})).sort((function(n,e){return Math.abs(n.diff)-Math.abs(e.diff)}))[0].index,distance:r}}(c),d=f.index,l=f.distance,p=!n&&i(c);return!r||p?{index:d,distance:t}:{index:d,distance:t+s(e[d]-l,0)}},byIndex:function(n,t){return{index:n,distance:s(e[n]-o.get(),t)}},shortcut:s}}function S(n,e,t,r,o,i,u,a){var c,s=d(r),f=d(r).reverse(),l=(c=o[0]-1,g(m(f,c),"end")).concat(function(){var n=e-o[0]-1;return g(m(s,n),"start")}());function p(n,e){return n.reduce((function(n,e){return n-r[e]}),e)}function m(n,e){return n.reduce((function(n,t){return p(n,e)>0?n.concat([t]):n}),[])}function g(n,e){var r="start"===e,o=r?-t:t,a=i.findSlideBounds(o);return n.map((function(n){var e=r?0:-t,o=r?t:0,i=a.filter((function(e){return e.index===n}))[0][r?"end":"start"];return{point:i,getTarget:function(){return u.get()>i?e:o},index:n,location:-1}}))}return{canLoop:function(){return l.every((function(n){var t=n.index;return p(s.filter((function(n){return n!==t})),e)<=0}))},clear:function(){l.forEach((function(e){var t=e.index;a[t].style[n.startEdge]=""}))},loop:function(){l.forEach((function(e){var t=e.getTarget,r=e.location,o=e.index,i=t();i!==r&&(a[o].style[n.startEdge]=i+"%",e.location=i)}))},loopPoints:l}}function w(n,e,t){var r=t.style,o="x"===n.scroll?function(n){return"translate3d("+n+"%,0px,0px)"}:function(n){return"translate3d(0px,"+n+"%,0px)"},i=!1;return{clear:function(){r.transform=""},to:function(n){i||(r.transform=o(e.applyTo(n.get())))},toggleActive:function(n){i=!n}}}function E(n,e,t,c,s){var f,E=c.align,T=c.axis,A=c.direction,O=c.startIndex,P=c.inViewThreshold,B=c.loop,D=c.speed,I=c.dragFree,k=c.slidesToScroll,z=c.skipSnaps,L=c.containScroll,j=e.getBoundingClientRect(),N=t.map((function(n){return n.getBoundingClientRect()})),C=function(n){var e="rtl"===n?-1:1;return{applyTo:function(n){return n*e}}}(A),R=function(n,e){var t="y"===n?"y":"x";return{scroll:t,cross:"y"===n?"x":"y",startEdge:"y"===t?"top":"rtl"===e?"right":"left",endEdge:"y"===t?"bottom":"rtl"===e?"left":"right",measureSize:function(n){var e=n.width,r=n.height;return"x"===t?e:r}}}(T,A),V=(f=R.measureSize(j),{measure:function(n){return 0===f?0:n/f*100},totalPercent:100}),H=V.totalPercent,F=r(E,H),U=function(n,e,t,r,o){var i=n.measureSize,u=n.startEdge,a=n.endEdge,c=r.map(i);return{slideSizes:c.map(e.measure),slideSizesWithGaps:r.map((function(n,e,r){var i=e===p(r),s=window.getComputedStyle(l(t)),f=parseFloat(s.getPropertyValue("margin-"+a));return i?c[e]+(o?f:0):r[e+1][u]-n[u]})).map(e.measure).map(Math.abs)}}(R,V,t,N,B),q=U.slideSizes,G=U.slideSizesWithGaps,W=y(R,F,V,j,N,k),X=W.snaps,J=W.snapsAligned,Y=-l(X)+l(G),K=h(H,Y,X,J,L).snapsContained,Q=!B&&""!==L?K:J,Z=function(n,e,t){var r,i;return{limit:(r=e[0],i=l(e),o(t?r-n:i,r))}}(Y,Q,B).limit,$=i(p(Q),O,B),_=$.clone(),nn=d(t),en=function(n){var e=0;function t(n,t){return function(){n===!!e&&t()}}function r(){e=window.requestAnimationFrame(n)}return{proceed:t(!0,r),start:t(!1,r),stop:t(!0,(function(){window.cancelAnimationFrame(e),e=0}))}}((function(){B||fn.scrollBounds.constrain(fn.dragHandler.pointerDown()),fn.scrollBody.seek(on).update();var n=fn.scrollBody.settle(on);n&&!fn.dragHandler.pointerDown()&&(fn.animation.stop(),s.emit("settle")),n||s.emit("scroll"),B&&(fn.scrollLooper.loop(fn.scrollBody.direction()),fn.slideLooper.loop()),fn.translate.to(rn),fn.animation.proceed()})),tn=Q[$.get()],rn=a(tn),on=a(tn),un=g(rn,D,1),an=M(B,Q,Y,Z,on),cn=function(n,e,t,r,o,i){function u(r){var u=r.distance,a=r.index!==e.get();u&&(n.start(),o.add(u)),a&&(t.set(e.get()),e.set(r.index),i.emit("select"))}return{distance:function(n,e){u(r.byDistance(n,e))},index:function(n,t){var o=e.clone().set(n);u(r.byIndex(o.get(),t))}}}(en,$,_,an,on,s),sn=function(n,e,t,r,o,i){var u=Math.min(Math.max(i,.01),.99),a=(o?[0,e,-e]:[0]).reduce((function(n,e){return n.concat(c(e,u))}),[]);function c(e,o){var i=t.map((function(n){return n*(o||0)}));return r.map((function(r,o){return{start:r-t[o]+i[o]+e,end:r+n-i[o]+e,index:o}}))}return{check:function(n){return a.reduce((function(e,t){var r=t.index,o=t.start,i=t.end;return-1===e.indexOf(r)&&o<n&&i>n?e.concat([r]):e}),[])},findSlideBounds:c}}(H,Y,q,X,B,P),fn={animation:en,axis:R,direction:C,dragHandler:m(R,C,n,on,I,function(n,e){var t=n.scroll,r={x:"clientX",y:"clientY"},o=a(0),i=a(0),u=a(0),c=a(0),s=[],f=(new Date).getTime(),d=!1;function l(n,e){d=!n.touches;var t=r[e],o=d?n[t]:n.touches[0][t];return c.set(o)}return{pointerDown:function(n){var r=l(n,t);return o.set(r),u.set(r),e.measure(o.get())},pointerMove:function(n){var r=l(n,t),o=(new Date).getTime(),a=o-f;return a>=10&&(a>=100&&(s=[]),s.push(r.get()),f=o),i.set(r).subtract(u),u.set(r),e.measure(i.get())},pointerUp:function(){var n=(new Date).getTime()-f,t=u.get(),r=s.slice(-5).map((function(n){return t-n})).sort((function(n,e){return Math.abs(n)<Math.abs(e)?1:-1}))[0];return u.set(n>100||!r?0:r),s=[],e.measure(u.get())},readPoint:l}}(R,V),rn,en,cn,un,an,$,s,B,z),eventStore:u(),pxToPercent:V,index:$,indexPrevious:_,limit:Z,location:rn,options:c,scrollBody:un,scrollBounds:v(Z,rn,on,un),scrollLooper:x(Y,V,Z,rn,[rn,on]),scrollProgress:b(Z),scrollSnaps:Q,scrollTarget:an,scrollTo:cn,slideLooper:S(R,H,Y,G,Q,sn,rn,t),slidesInView:sn,slideIndexes:nn,target:on,translate:w(R,C,e)};return fn}var T={align:"center",axis:"x",containScroll:"",direction:"ltr",dragFree:!1,draggable:!0,inViewThreshold:0,loop:!1,skipSnaps:!1,slidesToScroll:1,speed:10,startIndex:0};function A(n,e,t){var r,o,i,u,a,c,s,f,d,l=function(){var n={};function e(e){return n[e]||[]}var t={emit:function(n){return e(n).forEach((function(e){return e(n)})),t},off:function(r,o){return n[r]=e(r).filter((function(n){return n!==o})),t},on:function(r,o){return n[r]=e(r).concat([o]),t}};return t}(),p=(r=function(){if(h){var n=u.axis.measureSize(s.getBoundingClientRect());y!==n&&w(),l.emit("resize")}},o=500,i=0,function(){window.clearTimeout(i),i=window.setTimeout(r,o)||0}),m=w,g=l.on,v=l.off,h=!1,x=Object.assign({},T),b=Object.assign({},x),y=0;function M(){var e,t="container"in n&&n.container,r="slides"in n&&n.slides;s="root"in n?n.root:n,f=t||s.children[0],d=r||[].slice.call(f.children),e=getComputedStyle(s,":before").content,a={get:function(){try{return JSON.parse(e.slice(1,-1).replace(/\\/g,""))}catch(n){}return{}}}}function S(n,e){if(M(),x=Object.assign({},x,n),b=Object.assign({},x,a.get()),c=Object.assign([],e),(u=E(s,f,d,b,l)).eventStore.add(window,"resize",p),u.translate.to(u.location),y=u.axis.measureSize(s.getBoundingClientRect()),c.forEach((function(n){return n.init(D)})),b.loop){if(!u.slideLooper.canLoop())return A(),S({loop:!1},e);u.slideLooper.loop()}b.draggable&&f.offsetParent&&d.length&&u.dragHandler.addActivationEvents(),h||(setTimeout((function(){return l.emit("init")}),0),h=!0)}function w(n,e){if(h){var t=B(),r=Object.assign({startIndex:t},n);A(),S(r,e||c),l.emit("reInit")}}function A(){u.dragHandler.removeAllEvents(),u.animation.stop(),u.eventStore.removeAll(),u.translate.clear(),u.slideLooper.clear(),c.forEach((function(n){return n.destroy()}))}function O(n){var e=u[n?"target":"location"].get(),t=b.loop?"removeOffset":"constrain";return u.slidesInView.check(u.limit[t](e))}function P(n,e,t){u.scrollBody.useBaseMass().useSpeed(e?100:b.speed),h&&u.scrollTo.index(n,t||0)}function B(){return u.index.get()}var D={canScrollNext:function(){return u.index.clone().add(1).get()!==B()},canScrollPrev:function(){return u.index.clone().add(-1).get()!==B()},clickAllowed:function(){return u.dragHandler.clickAllowed()},containerNode:function(){return f},internalEngine:function(){return u},destroy:function(){h&&(A(),h=!1,l.emit("destroy"))},off:v,on:g,previousScrollSnap:function(){return u.indexPrevious.get()},reInit:m,rootNode:function(){return s},scrollNext:function(n){P(u.index.clone().add(1).get(),!0===n,-1)},scrollPrev:function(n){P(u.index.clone().add(-1).get(),!0===n,1)},scrollProgress:function(){return u.scrollProgress.get(u.location.get())},scrollSnapList:function(){return u.scrollSnaps.map(u.scrollProgress.get)},scrollTo:P,selectedScrollSnap:B,slideNodes:function(){return d},slidesInView:O,slidesNotInView:function(n){var e=O(n);return u.slideIndexes.filter((function(n){return-1===e.indexOf(n)}))}};return S(e,t),D}return function(r,o){void 0===r&&(r={}),void 0===o&&(o=[]);var i=n.useState(),u=i[0],a=i[1],c=n.useState(),s=c[0],f=c[1],d=n.useRef(r),l=n.useRef(o),p=n.useMemo((function(){return e(d.current,r)||(d.current=r),d.current}),[d,r]),m=n.useMemo((function(){return function(n,r){if(n.length!==r.length)return!1;var o=t(n),i=t(r);return o.every((function(n,t){return e(n,i[t])}))}(l.current,o)||(l.current=o),l.current}),[l,o]);return n.useEffect((function(){if("undefined"!=typeof window&&window.document&&window.document.createElement&&s){var n=A(s,p,m);return a(n),function(){return n.destroy()}}a(void 0)}),[s,p,m,a]),[f,u]}}));
!function(n,e){"object"==typeof exports&&"undefined"!=typeof module?module.exports=e(require("react")):"function"==typeof define&&define.amd?define(["react"],e):(n="undefined"!=typeof globalThis?globalThis:n||self).EmblaCarouselReact=e(n.React)}(this,(function(n){"use strict";function e(n,e){return Object.keys(n).length===Object.keys(e).length&&Object.keys(n).every((function(t){return!!Object.prototype.hasOwnProperty.call(e,t)&&n[t]===e[t]}))}function t(n){return n.concat().sort((function(n,e){return n.name>e.name?1:-1})).map((function(n){return n.options}))}function r(n,e){var t={start:function(){return 0},center:function(n){return r(n)/2},end:r};function r(n){return e-n}return{measure:function(r){return"number"==typeof n?e*Number(n):t[n](r)}}}function o(n){return Math.abs(n)}function i(n){return n?n/o(n):0}function u(n,e){return o(n-e)}function c(n,e){for(var t=[],r=0;r<n.length;r+=e)t.push(n.slice(r,r+e));return t}function a(n){return Object.keys(n).map(Number)}function s(n){return n[f(n)]}function f(n){return Math.max(0,n.length-1)}function d(n,e){var t=o(n-e);function r(e){return e<n}function i(n){return n>e}function u(n){return r(n)||i(n)}return{length:t,max:e,min:n,constrain:function(t){return u(t)?r(t)?n:e:t},reachedAny:u,reachedMax:i,reachedMin:r,removeOffset:function(n){return t?n-t*Math.ceil((n-e)/t):n}}}function l(n,e,t){var r=d(0,n),i=r.min,u=r.constrain,c=n+1,a=s(e);function s(n){return t?o((c+n)%c):u(n)}function f(){return a}function p(n){return a=s(n),m}var m={add:function(n){return p(f()+n)},clone:function(){return l(n,f(),t)},get:f,set:p,min:i,max:n};return m}function p(){var n=[];var e={add:function(t,r,o,i){return void 0===i&&(i=!1),t.addEventListener(r,o,i),n.push((function(){return t.removeEventListener(r,o,i)})),e},removeAll:function(){return n=n.filter((function(n){return n()})),e}};return e}function m(n){var e=n;function t(n){return e/=n,o}function r(n){return"number"==typeof n?n:n.get()}var o={add:function(n){return e+=r(n),o},divide:t,get:function(){return e},multiply:function(n){return e*=n,o},normalize:function(){return 0!==e&&t(e),o},set:function(n){return e=r(n),o},subtract:function(n){return e-=r(n),o}};return o}function v(n,e,t,r,c,a,s,f,d,l,v,g,x,h,y){var S=n.cross,w=["INPUT","SELECT","TEXTAREA"],b=m(0),E=p(),A=p(),M={mouse:300,touch:400},T={mouse:500,touch:600},O=c?5:16,P=0,B=0,I=!1,k=!1,z=!1,D=!1;function L(n){if(!(D="mousedown"===n.type)||0===n.button){var e,o,i=u(r.get(),s.get())>=2,c=D||!i,f=(e=n.target,o=e.nodeName||"",!(w.indexOf(o)>-1)),d=i||D&&f;I=!0,a.pointerDown(n),b.set(r),r.set(s),l.useBaseMass().useSpeed(80),function(){var n=D?document:t;A.add(n,"touchmove",j).add(n,"touchend",N).add(n,"mousemove",j).add(n,"mouseup",N)}(),P=a.readPoint(n),B=a.readPoint(n,S),x.emit("pointerDown"),c&&(z=!1),d&&n.preventDefault()}}function j(n){if(!k&&!D){if(!n.cancelable)return N(n);var t=a.readPoint(n),o=a.readPoint(n,S),i=u(t,P),c=u(o,B);if(!(k=i>c)&&!z)return N(n)}var s=a.pointerMove(n);!z&&s&&(z=!0),f.start(),r.add(e.apply(s)),n.preventDefault()}function N(n){var t=v.byDistance(0,!1).index!==g.get(),s=a.pointerUp(n)*(c?T:M)[D?"mouse":"touch"],f=function(n,e){var t=g.clone().add(-1*i(n)),r=t.get()===g.min||t.get()===g.max,u=v.byDistance(n,!c).distance;return c||o(n)<20?u:!h&&r?.4*u:y&&e?.5*u:v.byIndex(t.get(),0).distance}(e.apply(s),t),p=function(n,e){if(0===n||0===e)return 0;if(o(n)<=o(e))return 0;var t=u(o(n),o(e));return o(t/n)}(s,f),m=u(r.get(),b.get())>=.5,S=t&&p>.75,w=o(s)<20,E=S?10:O,P=S?1+2.5*p:1;m&&!D&&(z=!0),k=!1,I=!1,A.removeAll(),l.useSpeed(w?9:E).useMass(P),d.distance(f,!c),D=!1,x.emit("pointerUp")}function R(n){z&&n.preventDefault()}return{addActivationEvents:function(){var n=t;E.add(n,"touchmove",(function(){})).add(n,"touchend",(function(){})).add(n,"touchstart",L).add(n,"mousedown",L).add(n,"touchcancel",N).add(n,"contextmenu",N).add(n,"click",R)},clickAllowed:function(){return!z},pointerDown:function(){return I},removeAllEvents:function(){E.removeAll(),A.removeAll()}}}function g(n,e,t){var r,o,u=(r=2,o=Math.pow(10,r),function(n){return Math.round(n*o)/o}),c=m(0),a=m(0),s=m(0),f=0,d=e,l=t;function p(n){return d=n,g}function v(n){return l=n,g}var g={direction:function(){return f},seek:function(e){s.set(e).subtract(n);var t,r,o,u,p=(t=s.get(),(o=0)+(t-(r=0))/(100-r)*(d-o));return f=i(s.get()),s.normalize().multiply(p).subtract(c),(u=s).divide(l),a.add(u),g},settle:function(e){var t=e.get()-n.get(),r=!u(t);return r&&n.set(e),r},update:function(){c.add(a),n.add(c),a.multiply(0)},useBaseMass:function(){return v(t)},useBaseSpeed:function(){return p(e)},useMass:v,useSpeed:p};return g}function x(n,e,t,r){var i=!1;return{constrain:function(u){if(!i&&n.reachedAny(t.get())&&n.reachedAny(e.get())){var c=n.reachedMin(e.get())?"min":"max",a=o(n[c]-e.get()),s=t.get()-e.get(),f=Math.min(a/50,.85);t.subtract(s*f),!u&&o(s)<10&&(t.set(n.constrain(t.get())),r.useSpeed(10).useMass(3))}},toggleActive:function(n){i=!n}}}function h(n,e,t,r,o){var i=d(-e+n,t[0]),u=r.map(i.constrain);return{snapsContained:function(){if(e<=n)return[i.max];if("keepSnaps"===o)return u;var t=function(){var n=u[0],e=s(u),t=u.lastIndexOf(n),r=u.indexOf(e)+1;return d(t,r)}(),r=t.min,c=t.max;return u.slice(r,c)}()}}function y(n,e,t,r,o){var i=d(t.min+e.measure(.1),t.max+e.measure(.1)),u=i.reachedMin,c=i.reachedMax;return{loop:function(e){if(function(n){return 1===n?c(r.get()):-1===n&&u(r.get())}(e)){var t=n*(-1*e);o.forEach((function(n){return n.add(t)}))}}}}function S(n){var e=n.max,t=n.length;return{get:function(n){return(n-e)/-t}}}function w(n,e,t,r,i,u){var a,f,d=n.startEdge,l=n.endEdge,p=i.map((function(n){return r[d]-n[d]})).map(t.measure).map((function(n){return-o(n)})),m=(a=c(p,u).map((function(n){return n[0]})),f=c(i,u).map((function(n){return s(n)[l]-n[0][d]})).map(t.measure).map(o).map(e.measure),a.map((function(n,e){return n+f[e]})));return{snaps:p,snapsAligned:m}}function b(n,e,t,r,i){var u=r.reachedAny,c=r.removeOffset,a=r.constrain;function s(n,e){return o(n)<o(e)?n:e}function f(e,r){var i=e,u=e+t,c=e-t;return n?r?o(s(i,1===r?u:c))*r:s(s(i,u),c):i}return{byDistance:function(t,r){var s=i.get()+t,d=function(t){var r=n?c(t):a(t);return{index:e.map((function(n){return n-r})).map((function(n){return f(n,0)})).map((function(n,e){return{diff:n,index:e}})).sort((function(n,e){return o(n.diff)-o(e.diff)}))[0].index,distance:r}}(s),l=d.index,p=d.distance,m=!n&&u(s);return!r||m?{index:l,distance:t}:{index:l,distance:t+f(e[l]-p,0)}},byIndex:function(n,t){return{index:n,distance:f(e[n]-i.get(),t)}},shortcut:f}}function E(n,e,t,r,o,i,u,c){var s,f=a(r),d=a(r).reverse(),l=(s=o[0]-1,v(m(d,s),"end")).concat(function(){var n=e-o[0]-1;return v(m(f,n),"start")}());function p(n,e){return n.reduce((function(n,e){return n-r[e]}),e)}function m(n,e){return n.reduce((function(n,t){return p(n,e)>0?n.concat([t]):n}),[])}function v(n,e){var r="start"===e,o=r?-t:t,c=i.findSlideBounds([o]);return n.map((function(n){var e=r?0:-t,o=r?t:0,i=c.filter((function(e){return e.index===n}))[0][r?"end":"start"];return{point:i,getTarget:function(){return u.get()>i?e:o},index:n,location:-1}}))}return{canLoop:function(){return l.every((function(n){var t=n.index;return p(f.filter((function(n){return n!==t})),e)<=0}))},clear:function(){l.forEach((function(e){var t=e.index;c[t].style[n.startEdge]=""}))},loop:function(){l.forEach((function(e){var t=e.getTarget,r=e.location,o=e.index,i=t();i!==r&&(c[o].style[n.startEdge]=i+"%",e.location=i)}))},loopPoints:l}}function A(n,e,t){var r="x"===n.scroll?function(n){return"translate3d("+n+"%,0px,0px)"}:function(n){return"translate3d(0px,"+n+"%,0px)"},o=t.style,i=!1;return{clear:function(){o.transform=""},to:function(n){i||(o.transform=r(e.apply(n.get())))},toggleActive:function(n){i=!n}}}function M(n,e,t,i,u){var c,M=i.align,T=i.axis,O=i.direction,P=i.startIndex,B=i.inViewThreshold,I=i.loop,k=i.speed,z=i.dragFree,D=i.slidesToScroll,L=i.skipSnaps,j=i.containScroll,N=e.getBoundingClientRect(),R=t.map((function(n){return n.getBoundingClientRect()})),C=function(n){var e="rtl"===n?-1:1;return{apply:function(n){return n*e}}}(O),V=function(n,e){var t="y"===n?"y":"x";return{scroll:t,cross:"y"===n?"x":"y",startEdge:"y"===t?"top":"rtl"===e?"right":"left",endEdge:"y"===t?"bottom":"rtl"===e?"left":"right",measureSize:function(n){var e=n.width,r=n.height;return"x"===t?e:r}}}(T,O),H=(c=V.measureSize(N),{measure:function(n){return 0===c?0:n/c*100},totalPercent:100}),F=H.totalPercent,U=r(M,F),q=function(n,e,t,r,i){var u=n.measureSize,c=n.startEdge,a=n.endEdge,d=r.map(u);return{slideSizes:d.map(e.measure),slideSizesWithGaps:r.map((function(n,e,r){var o=e===f(r),u=window.getComputedStyle(s(t)),l=parseFloat(u.getPropertyValue("margin-"+a));return o?d[e]+(i?l:0):r[e+1][c]-n[c]})).map(e.measure).map(o)}}(V,H,t,R,I),G=q.slideSizes,W=q.slideSizesWithGaps,X=w(V,U,H,N,R,D),J=X.snaps,Y=X.snapsAligned,K=-s(J)+s(W),Q=h(F,K,J,Y,j).snapsContained,Z=!I&&""!==j?Q:Y,$=function(n,e,t){var r,o;return{limit:(r=e[0],o=s(e),d(t?r-n:o,r))}}(K,Z,I).limit,_=l(f(Z),P,I),nn=_.clone(),en=a(t),tn=function(n){var e=0;function t(n,t){return function(){n===!!e&&t()}}function r(){e=window.requestAnimationFrame(n)}return{proceed:t(!0,r),start:t(!1,r),stop:t(!0,(function(){window.cancelAnimationFrame(e),e=0}))}}((function(){I||dn.scrollBounds.constrain(dn.dragHandler.pointerDown()),dn.scrollBody.seek(un).update();var n=dn.scrollBody.settle(un);n&&!dn.dragHandler.pointerDown()&&(dn.animation.stop(),u.emit("settle")),n||u.emit("scroll"),I&&(dn.scrollLooper.loop(dn.scrollBody.direction()),dn.slideLooper.loop()),dn.translate.to(on),dn.animation.proceed()})),rn=Z[_.get()],on=m(rn),un=m(rn),cn=g(on,k,1),an=b(I,Z,K,$,un),sn=function(n,e,t,r,o,i){function u(r){var u=r.distance,c=r.index!==e.get();u&&(n.start(),o.add(u)),c&&(t.set(e.get()),e.set(r.index),i.emit("select"))}return{distance:function(n,e){u(r.byDistance(n,e))},index:function(n,t){var o=e.clone().set(n);u(r.byIndex(o.get(),t))}}}(tn,_,nn,an,un,u),fn=function(n,e,t,r,o,i,u){var c=o.removeOffset,a=o.constrain,s=Math.min(Math.max(u,.01),.99),f=i?[0,e,-e]:[0],d=l(f,s);function l(e,o){var i=e||f,u=o||0,c=t.map((function(n){return n*u}));return i.reduce((function(e,o){var i=r.map((function(e,r){return{start:e-t[r]+c[r]+o,end:e+n-c[r]+o,index:r}}));return e.concat(i)}),[])}return{check:function(n,e){var t=i?c(n):a(n);return(e||d).reduce((function(n,e){var r=e.index,o=e.start,i=e.end;return-1===n.indexOf(r)&&o<t&&i>t?n.concat([r]):n}),[])},findSlideBounds:l}}(F,K,G,J,$,I,B),dn={containerRect:N,slideRects:R,animation:tn,axis:V,direction:C,dragHandler:v(V,C,n,un,z,function(n,e){var t,r;function i(n){return"undefined"!=typeof TouchEvent&&n instanceof TouchEvent}function u(n){return n.timeStamp}function c(e,t){var r="client"+("x"===(t||n.scroll)?"X":"Y");return(i(e)?e.touches[0]:e)[r]}return{isTouchEvent:i,pointerDown:function(n){return t=n,r=n,e.measure(c(n))},pointerMove:function(n){var o=c(n)-c(r),i=u(n)-u(t)>170;return r=n,i&&(t=n),e.measure(o)},pointerUp:function(n){var i=c(r)-c(t),a=u(n)-u(t),s=u(n)-u(r)>170,f=i/a;return a&&!s&&o(f)>.1?e.measure(f):0},readPoint:c}}(V,H),on,tn,sn,cn,an,_,u,I,L),eventStore:p(),pxToPercent:H,index:_,indexPrevious:nn,limit:$,location:on,options:i,scrollBody:cn,scrollBounds:x($,on,un,cn),scrollLooper:y(K,H,$,on,[on,un]),scrollProgress:S($),scrollSnaps:Z,scrollTarget:an,scrollTo:sn,slideLooper:E(V,F,K,W,Z,fn,on,t),slidesInView:fn,slideIndexes:en,target:un,translate:A(V,C,e)};return dn}var T={align:"center",axis:"x",containScroll:"",direction:"ltr",dragFree:!1,draggable:!0,inViewThreshold:0,loop:!1,skipSnaps:!1,slidesToScroll:1,speed:10,startIndex:0};function O(n,e,t){var r,o,i,u,c,a,s,f,d,l=function(){var n={};function e(e){return n[e]||[]}var t={emit:function(n){return e(n).forEach((function(e){return e(n)})),t},off:function(r,o){return n[r]=e(r).filter((function(n){return n!==o})),t},on:function(r,o){return n[r]=e(r).concat([o]),t}};return t}(),p=(r=function(){if(x){var n=u.axis.measureSize(s.getBoundingClientRect());S!==n&&E(),l.emit("resize")}},o=500,i=0,function(){window.clearTimeout(i),i=window.setTimeout(r,o)||0}),m=E,v=l.on,g=l.off,x=!1,h=Object.assign({},T),y=Object.assign({},h),S=0;function w(){var e,t="container"in n&&n.container,r="slides"in n&&n.slides;s="root"in n?n.root:n,f=t||s.children[0],d=r||[].slice.call(f.children),e=getComputedStyle(s,":before").content,c={get:function(){try{return JSON.parse(e.slice(1,-1).replace(/\\/g,""))}catch(n){}return{}}}}function b(n,e){if(w(),h=Object.assign({},h,n),y=Object.assign({},h,c.get()),a=Object.assign([],e),(u=M(s,f,d,y,l)).eventStore.add(window,"resize",p),u.translate.to(u.location),S=u.axis.measureSize(s.getBoundingClientRect()),a.forEach((function(n){return n.init(I)})),y.loop){if(!u.slideLooper.canLoop())return A(),b({loop:!1},e);u.slideLooper.loop()}y.draggable&&f.offsetParent&&d.length&&u.dragHandler.addActivationEvents(),x||(setTimeout((function(){return l.emit("init")}),0),x=!0)}function E(n,e){if(x){var t=B(),r=Object.assign({startIndex:t},n);A(),b(r,e||a),l.emit("reInit")}}function A(){u.dragHandler.removeAllEvents(),u.animation.stop(),u.eventStore.removeAll(),u.translate.clear(),u.slideLooper.clear(),a.forEach((function(n){return n.destroy()}))}function O(n){var e=u[n?"target":"location"].get(),t=y.loop?"removeOffset":"constrain";return u.slidesInView.check(u.limit[t](e))}function P(n,e,t){u.scrollBody.useBaseMass().useSpeed(e?100:y.speed),x&&u.scrollTo.index(n,t||0)}function B(){return u.index.get()}var I={canScrollNext:function(){return u.index.clone().add(1).get()!==B()},canScrollPrev:function(){return u.index.clone().add(-1).get()!==B()},clickAllowed:function(){return u.dragHandler.clickAllowed()},containerNode:function(){return f},internalEngine:function(){return u},destroy:function(){x&&(A(),x=!1,l.emit("destroy"))},off:g,on:v,previousScrollSnap:function(){return u.indexPrevious.get()},reInit:m,rootNode:function(){return s},scrollNext:function(n){P(u.index.clone().add(1).get(),!0===n,-1)},scrollPrev:function(n){P(u.index.clone().add(-1).get(),!0===n,1)},scrollProgress:function(){return u.scrollProgress.get(u.location.get())},scrollSnapList:function(){return u.scrollSnaps.map(u.scrollProgress.get)},scrollTo:P,selectedScrollSnap:B,slideNodes:function(){return d},slidesInView:O,slidesNotInView:function(n){var e=O(n);return u.slideIndexes.filter((function(n){return-1===e.indexOf(n)}))}};return b(e,t),I}return function(r,o){void 0===r&&(r={}),void 0===o&&(o=[]);var i=n.useState(),u=i[0],c=i[1],a=n.useState(),s=a[0],f=a[1],d=n.useRef(r),l=n.useRef(o),p=n.useMemo((function(){return e(d.current,r)||(d.current=r),d.current}),[d,r]),m=n.useMemo((function(){return function(n,r){if(n.length!==r.length)return!1;var o=t(n),i=t(r);return o.every((function(n,t){return e(n,i[t])}))}(l.current,o)||(l.current=o),l.current}),[l,o]);return n.useEffect((function(){if("undefined"!=typeof window&&window.document&&window.document.createElement&&s){var n=O(s,p,m);return c(n),function(){return n.destroy()}}c(void 0)}),[s,p,m,c]),[f,u]}}));
{
"name": "embla-carousel-react",
"version": "6.0.2",
"version": "6.1.0",
"author": "David Cetinkaya",

@@ -44,8 +44,2 @@ "description": "A lightweight carousel library with fluid motion and great swipe precision",

"devDependencies": {
"@babel/core": "^7.13.15",
"@babel/plugin-transform-object-assign": "^7.12.13",
"@babel/preset-env": "^7.13.15",
"@babel/preset-typescript": "^7.13.0",
"@rollup/plugin-babel": "^5.3.0",
"@rollup/plugin-node-resolve": "^11.2.1",
"@types/jest": "^26.0.22",

@@ -61,4 +55,2 @@ "@types/react": "^17.0.2",

"rollup": "^2.45.2",
"rollup-plugin-terser": "^7.0.2",
"rollup-plugin-typescript2": "^0.30.0",
"ts-jest": "^26.5.5",

@@ -68,3 +60,3 @@ "typescript": "^4.2.4"

"dependencies": {
"embla-carousel": "6.0.2"
"embla-carousel": "6.1.0"
},

@@ -71,0 +63,0 @@ "peerDependencies": {

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc