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

embla-carousel

Package Overview
Dependencies
Maintainers
1
Versions
235
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

embla-carousel - npm Package Compare versions

Comparing version 4.0.3 to 4.0.4

113

embla-carousel.esm.js

@@ -1010,3 +1010,4 @@ function _extends() {

var axis = params.axis,
containerLocation = params.location;
scrollLocation = params.location,
slidesInView = params.slidesInView;
var contentSize = params.contentSize,

@@ -1021,42 +1022,29 @@ viewSize = params.viewSize,

function subtractItemSizes(indexes, from) {
function removeSlideSizes(indexes, from) {
return indexes.reduce(function (a, i) {
var size = slideSizes[i];
return a - size;
return a - slideSizes[i];
}, from);
}
function loopItemsIn(sizeOfGap, indexes) {
function slidesInGap(indexes, gap) {
return indexes.reduce(function (a, i) {
var gapLeft = subtractItemSizes(a, sizeOfGap);
return gapLeft > 0 ? a.concat([i]) : a;
var remainingGap = removeSlideSizes(a, gap);
return remainingGap > 0 ? a.concat([i]) : a;
}, []);
}
function loopStart(sizeOfGap, indexes, from) {
return indexes.reduce(function (a, i) {
var gapFilled = a + slideSizes[i];
return gapFilled < sizeOfGap ? gapFilled : a;
}, from);
}
function findLoopPoints(indexes, edge) {
var isStartEdge = edge === 'start';
var offset = isStartEdge ? -contentSize : contentSize;
var slideBounds = slidesInView.findSlideBounds(offset);
return indexes.map(function (index) {
var initial = isStartEdge ? 0 : -contentSize;
var altered = isStartEdge ? contentSize : 0;
var bounds = slideBounds.filter(function (b) {
return b.index === index;
})[0];
var point = bounds[isStartEdge ? 'end' : 'start'];
function loopPointFor(indexes, from, direction) {
var slideCount = ascItems.length - 1;
return subtractItemSizes(indexes.map(function (i) {
return (i + direction) % slideCount;
}), from);
}
function loopPointsFor(indexes, from, direction) {
var ascIndexes = indexes.slice().sort(function (a, b) {
return a - b;
});
return ascIndexes.map(function (index, loopIndex) {
var initial = contentSize * (!direction ? 0 : -1);
var offset = contentSize * (!direction ? 1 : 0);
var slidesInSpan = ascIndexes.slice(0, loopIndex);
var point = loopPointFor(slidesInSpan, from, direction);
var getTarget = function getTarget(location) {
return location > point ? initial : offset;
var getTarget = function getTarget() {
return scrollLocation.get() > point ? initial : altered;
};

@@ -1075,5 +1063,4 @@

var gap = scrollSnaps[0] - 1;
var indexes = loopItemsIn(gap, descItems);
var start = loopStart(gap, indexes, 0);
return loopPointsFor(indexes, start, 1);
var indexes = slidesInGap(descItems, gap);
return findLoopPoints(indexes, 'end');
}

@@ -1083,5 +1070,4 @@

var gap = viewSize - scrollSnaps[0] - 1;
var indexes = loopItemsIn(gap, ascItems);
var start = loopStart(contentSize, ascItems, -viewSize);
return loopPointsFor(indexes, -start, 0);
var indexes = slidesInGap(ascItems, gap);
return findLoopPoints(indexes, 'start');
}

@@ -1095,3 +1081,3 @@

});
return subtractItemSizes(otherIndexes, viewSize) <= 0;
return removeSlideSizes(otherIndexes, viewSize) <= 0;
});

@@ -1105,3 +1091,3 @@ }

index = loopPoint.index;
var target = getTarget(containerLocation.get());
var target = getTarget();

@@ -1176,7 +1162,7 @@ if (target !== location) {

var threshold = Math.min(Math.max(inViewThreshold, 0.01), 0.99);
var thresholds = slideSizes.map(function (s) {
return s * threshold;
});
var scrollSnaps = arrayKeys(slideSizes).map(scrollSnap);
var pointsToCheck = concatSlidePoints();
var offsets = loop ? [0, contentSize, -contentSize] : [0];
var slideBounds = offsets.reduce(function (a, loopOffset) {
return a.concat(findSlideBounds(loopOffset, threshold));
}, []);

@@ -1190,10 +1176,6 @@ function scrollSnap(index) {

function concatSlidePoints() {
var offsets = loop ? [0, contentSize, -contentSize] : [0];
return offsets.map(slidePoints).reduce(function (a, b) {
return a.concat(b);
}, []);
}
function slidePoints(offset) {
function findSlideBounds(offset, threshold) {
var thresholds = slideSizes.map(function (s) {
return s * (threshold || 0);
});
return scrollSnaps.map(function (snap, index) {

@@ -1209,6 +1191,6 @@ return {

function check(location) {
return pointsToCheck.reduce(function (list, point) {
var index = point.index,
start = point.start,
end = point.end;
return slideBounds.reduce(function (list, slideBound) {
var index = slideBound.index,
start = slideBound.start,
end = slideBound.end;
var inList = list.indexOf(index) !== -1;

@@ -1221,3 +1203,4 @@ var inView = start < location && end > location;

var self = {
check: check
check: check,
findSlideBounds: findSlideBounds
};

@@ -1390,2 +1373,9 @@ return self;

target: target
});
var slidesInView = SlidesInView({
contentSize: contentSize,
inViewThreshold: inViewThreshold,
loop: loop,
slideSizes: slideSizes,
viewSize: viewSize
}); // DragHandler

@@ -1453,11 +1443,6 @@

slideSizes: slideSizes,
slidesInView: slidesInView,
viewSize: viewSize
}),
slidesInView: SlidesInView({
contentSize: contentSize,
inViewThreshold: inViewThreshold,
loop: loop,
slideSizes: slideSizes,
viewSize: viewSize
}),
slidesInView: slidesInView,
slideIndexes: slideIndexes,

@@ -1464,0 +1449,0 @@ target: target,

@@ -1012,3 +1012,4 @@ 'use strict';

var axis = params.axis,
containerLocation = params.location;
scrollLocation = params.location,
slidesInView = params.slidesInView;
var contentSize = params.contentSize,

@@ -1023,42 +1024,29 @@ viewSize = params.viewSize,

function subtractItemSizes(indexes, from) {
function removeSlideSizes(indexes, from) {
return indexes.reduce(function (a, i) {
var size = slideSizes[i];
return a - size;
return a - slideSizes[i];
}, from);
}
function loopItemsIn(sizeOfGap, indexes) {
function slidesInGap(indexes, gap) {
return indexes.reduce(function (a, i) {
var gapLeft = subtractItemSizes(a, sizeOfGap);
return gapLeft > 0 ? a.concat([i]) : a;
var remainingGap = removeSlideSizes(a, gap);
return remainingGap > 0 ? a.concat([i]) : a;
}, []);
}
function loopStart(sizeOfGap, indexes, from) {
return indexes.reduce(function (a, i) {
var gapFilled = a + slideSizes[i];
return gapFilled < sizeOfGap ? gapFilled : a;
}, from);
}
function findLoopPoints(indexes, edge) {
var isStartEdge = edge === 'start';
var offset = isStartEdge ? -contentSize : contentSize;
var slideBounds = slidesInView.findSlideBounds(offset);
return indexes.map(function (index) {
var initial = isStartEdge ? 0 : -contentSize;
var altered = isStartEdge ? contentSize : 0;
var bounds = slideBounds.filter(function (b) {
return b.index === index;
})[0];
var point = bounds[isStartEdge ? 'end' : 'start'];
function loopPointFor(indexes, from, direction) {
var slideCount = ascItems.length - 1;
return subtractItemSizes(indexes.map(function (i) {
return (i + direction) % slideCount;
}), from);
}
function loopPointsFor(indexes, from, direction) {
var ascIndexes = indexes.slice().sort(function (a, b) {
return a - b;
});
return ascIndexes.map(function (index, loopIndex) {
var initial = contentSize * (!direction ? 0 : -1);
var offset = contentSize * (!direction ? 1 : 0);
var slidesInSpan = ascIndexes.slice(0, loopIndex);
var point = loopPointFor(slidesInSpan, from, direction);
var getTarget = function getTarget(location) {
return location > point ? initial : offset;
var getTarget = function getTarget() {
return scrollLocation.get() > point ? initial : altered;
};

@@ -1077,5 +1065,4 @@

var gap = scrollSnaps[0] - 1;
var indexes = loopItemsIn(gap, descItems);
var start = loopStart(gap, indexes, 0);
return loopPointsFor(indexes, start, 1);
var indexes = slidesInGap(descItems, gap);
return findLoopPoints(indexes, 'end');
}

@@ -1085,5 +1072,4 @@

var gap = viewSize - scrollSnaps[0] - 1;
var indexes = loopItemsIn(gap, ascItems);
var start = loopStart(contentSize, ascItems, -viewSize);
return loopPointsFor(indexes, -start, 0);
var indexes = slidesInGap(ascItems, gap);
return findLoopPoints(indexes, 'start');
}

@@ -1097,3 +1083,3 @@

});
return subtractItemSizes(otherIndexes, viewSize) <= 0;
return removeSlideSizes(otherIndexes, viewSize) <= 0;
});

@@ -1107,3 +1093,3 @@ }

index = loopPoint.index;
var target = getTarget(containerLocation.get());
var target = getTarget();

@@ -1178,7 +1164,7 @@ if (target !== location) {

var threshold = Math.min(Math.max(inViewThreshold, 0.01), 0.99);
var thresholds = slideSizes.map(function (s) {
return s * threshold;
});
var scrollSnaps = arrayKeys(slideSizes).map(scrollSnap);
var pointsToCheck = concatSlidePoints();
var offsets = loop ? [0, contentSize, -contentSize] : [0];
var slideBounds = offsets.reduce(function (a, loopOffset) {
return a.concat(findSlideBounds(loopOffset, threshold));
}, []);

@@ -1192,10 +1178,6 @@ function scrollSnap(index) {

function concatSlidePoints() {
var offsets = loop ? [0, contentSize, -contentSize] : [0];
return offsets.map(slidePoints).reduce(function (a, b) {
return a.concat(b);
}, []);
}
function slidePoints(offset) {
function findSlideBounds(offset, threshold) {
var thresholds = slideSizes.map(function (s) {
return s * (threshold || 0);
});
return scrollSnaps.map(function (snap, index) {

@@ -1211,6 +1193,6 @@ return {

function check(location) {
return pointsToCheck.reduce(function (list, point) {
var index = point.index,
start = point.start,
end = point.end;
return slideBounds.reduce(function (list, slideBound) {
var index = slideBound.index,
start = slideBound.start,
end = slideBound.end;
var inList = list.indexOf(index) !== -1;

@@ -1223,3 +1205,4 @@ var inView = start < location && end > location;

var self = {
check: check
check: check,
findSlideBounds: findSlideBounds
};

@@ -1392,2 +1375,9 @@ return self;

target: target
});
var slidesInView = SlidesInView({
contentSize: contentSize,
inViewThreshold: inViewThreshold,
loop: loop,
slideSizes: slideSizes,
viewSize: viewSize
}); // DragHandler

@@ -1455,11 +1445,6 @@

slideSizes: slideSizes,
slidesInView: slidesInView,
viewSize: viewSize
}),
slidesInView: SlidesInView({
contentSize: contentSize,
inViewThreshold: inViewThreshold,
loop: loop,
slideSizes: slideSizes,
viewSize: viewSize
}),
slidesInView: slidesInView,
slideIndexes: slideIndexes,

@@ -1466,0 +1451,0 @@ target: target,

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

!function(n,e){"object"==typeof exports&&"undefined"!=typeof module?module.exports=e():"function"==typeof define&&define.amd?define(e):(n=n||self).EmblaCarousel=e()}(this,(function(){"use strict";function n(){return(n=Object.assign||function(n){for(var e=1;e<arguments.length;e++){var t=arguments[e];for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&(n[r]=t[r])}return n}).apply(this,arguments)}function e(n){var e=n.viewSize,t=n.align,r={start:function(){return 0},center:function(n){return o(n)/2},end:o};function o(n){return e-n}return{measure:function(n){return"number"==typeof t?e*Number(t):r[t](n)}}}function t(n){var e=n.start,r=n.limit,o=n.loop,i=r.min,a=r.max,c=r[o?"loop":"constrain"],u=c(e);function s(){return u}function l(n){return u=c(n),d}var d={add:function n(e){if(0!==e){var t=e/Math.abs(e);return l(s()+t),n(e+-1*t)}return d},clone:function(){return t({start:s(),limit:r,loop:o})},get:s,max:a,min:i,set:l};return d}function r(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 o(n){var e=r(t(n));function t(n){return 0===n?0:n/Math.abs(n)}var o={get:e.get,set:function(n){var r=t(n.get());return 0!==r&&e.set(r),o}};return o}function i(){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.min,t=n.max,r=Math.abs(e-t);function o(n){return n<e}function i(n){return n>t}function a(n){return o(n)||i(n)}return{constrain:function(n){return a(n)?o(n)?e:t:n},length:r,loop:function(n){return a(n)?o(n)?t:e:n},max:t,min:e,reachedAny:a,reachedMax:i,reachedMin:o,removeOffset:function(n){if(e===t)return n;for(;o(n);)n+=r;for(;i(n);)n-=r;return n}}}function c(n){var e=n.target,t=n.scrollBody,c=n.dragFree,u=n.animation,s=n.axis,l=n.element,d=n.dragTracker,f=n.location,m=n.events,p=n.limit,g=s.scroll,v=s.cross,x=["INPUT","SELECT","TEXTAREA"],h=r(0),S=r(0),y=r(0),w=i(),b=i(),T={mouse:2.5,touch:3.5},M={mouse:5,touch:7},z=c?5:12,A=a({min:p.min-70,max:p.max+70}),D=!1,E=!1,P=!1,I=!1;function C(n){if(!(I="mousedown"===n.type)||0===n.button){var r,o,i=k(e.get(),f.get())>=2,a=I||!i,c=(r=n.target,o=r.nodeName||"",!(x.indexOf(o)>-1)),u=i||I&&c;D=!0,d.pointerDown(n),y.set(e),e.set(f),t.useDefaultMass().useSpeed(80),function(){var n=I?document:l;b.add(n,"touchmove",L).add(n,"touchend",B).add(n,"mousemove",L).add(n,"mouseup",B)}(),h.set(d.readPoint(n,g)),S.set(d.readPoint(n,v)),m.emit("pointerDown"),a&&(P=!1),u&&n.preventDefault()}}function L(t){if(!E&&!I){if(!t.cancelable)return B();var r=d.readPoint(t,g).get(),o=d.readPoint(t,v).get(),i=k(r,h.get()),a=k(o,S.get());if(!(E=i>a)&&!P)return B()}var c=d.pointerMove(t),s=p.reachedAny(f.get()),l=!n.loop&&s?2:1;!P&&c&&(P=!0),u.start(),e.add(c/l),t.preventDefault()}function B(){var r,i,a,u=n.scrollTo,s=d.pointerUp()*(c?M:T)[I?"mouse":"touch"],l=function(t){var r=n.scrollTarget,i=n.index,a=!(r.byDistance(0,!1).index!==i.get())&&Math.abs(t)>4,u=t+f.get();if(a&&!c&&!p.reachedAny(u)){var s=i.clone().add(-1*o(t).get());return r.byIndex(s.get(),0).distance}if(!n.loop&&A.reachedAny(u)){var l=A.reachedMax(u)?"max":"min";return A[l]-e.get()}return r.byDistance(t,!c).distance}(s),g=(r=s,i=l,a=k(Math.abs(r),Math.abs(i)),Math.abs(r)<=Math.abs(i)||0===r||0===i?0:Math.abs(a/r));k(e.get(),y.get())>=.5&&!I&&(P=!0),E=!1,D=!1,b.removeAll(),t.useSpeed(z+z*g),u.distance(l,!c),I=!1,m.emit("pointerUp")}function k(n,e){return Math.abs(n-e)}function O(n){P&&n.preventDefault()}return{addActivationEvents:function(){var n=l;w.add(n,"touchmove",(function(){})).add(n,"touchend",(function(){})).add(n,"touchstart",C).add(n,"mousedown",C).add(n,"touchcancel",B).add(n,"contextmenu",B).add(n,"click",O)},clickAllowed:function(){return!P},pointerDown:function(){return D},removeAllEvents:function(){w.removeAll(),b.removeAll()}}}function u(n){var e=n.axis,t=n.pxToPercent,o=e.scroll,i={x:"clientX",y:"clientY"},a=r(0),c=r(0),u=r(0),s=r(0),l=[],d=(new Date).getTime(),f=!1;function m(n,e){f=!n.touches;var t=i[e],r=f?n[t]:n.touches[0][t];return s.set(r)}return{pointerDown:function(n){var e=m(n,o);return a.set(e),u.set(e),t.measure(a.get())},pointerMove:function(n){var e=m(n,o),r=(new Date).getTime(),i=r-d;return i>=10&&(i>=100&&(l=[]),l.push(e.get()),d=r),c.set(e).subtract(u),u.set(e),t.measure(c.get())},pointerUp:function(){var n=(new Date).getTime()-d,e=u.get(),r=l.slice(-5).map((function(n){return e-n})).sort((function(n,e){return Math.abs(n)<Math.abs(e)?1:-1}))[0];return u.set(n>100||!r?0:r),l=[],t.measure(u.get())},readPoint:m}}function s(n){var e=Math.pow(10,n);return function(n){return Math.round(n*e)/e}}function l(n){return Object.keys(n).map(Number)}function d(n,e){var t=n.classList;t.contains(e)&&t.remove(e)}function f(n,e){var t=n.classList;t.contains(e)||t.add(e)}function m(n){var e=n.location,t=n.speed,i=n.mass,a=s(2),c=r(0),u=r(0),l=r(0),d=o(0),f={speed:t,mass:i};function m(n){return f.speed=n,g}function p(n){return f.mass=n,g}var g={direction:d,location:e,seek:function(n){l.set(n).subtract(e);var t,r,o,i,a,s=l.get(),m=(t=s,r=0,o=100,i=0,a=f.speed,i+(t-r)/(o-r)*(a-i));return d.set(l),l.normalize().multiply(m).subtract(c),function(n){n.divide(f.mass),u.add(n)}(l),g},settle:function(n){var t=n.get()-e.get(),r=!a(t);return r&&e.set(n),r},update:function(){c.add(u),e.add(c),u.multiply(0)},useDefaultMass:function(){return p(i),g},useDefaultSpeed:function(){return m(t),g},useMass:p,useSpeed:m};return g}function p(n){var e=n.limit,t=n.location,r=n.scrollBody,o=n.animation,i=e.min,a=e.max,c=e.reachedMin,u=e.reachedMax,s=!1,l=0;return{constrain:function(n){(function(n){return!s&&!l&&(c(t.get())?n.get()!==i:!!u(t.get())&&n.get()!==a)})(n)&&(l=window.setTimeout((function(){var t=e.constrain(n.get());n.set(t),r.useSpeed(10).useMass(3),o.start(),l=0}),50))},toggleActive:function(n){s=!n}}}function g(n){var e=n.alignment,t=n.contentSize,r=n.viewSize,o=a({min:-t+r,max:0}),i=[e.measure(t)],c=t>r;return{measure:function(n,e){var t=n.map(o.constrain),r=function(n){var e=n[0],t=n[n.length-1];return a({min:n.lastIndexOf(e)+1,max:n.indexOf(t)})}(t),u=r.min,s=r.max;return c?e?t.slice(u-1,s+1):t:i}}}function v(n){var e=n.contentSize,t=n.location,r=n.limit,o=n.pxToPercent,i=a({min:r.min+o.measure(.1),max:r.max+o.measure(.1)}),c=i.reachedMin,u=i.reachedMax;return{loop:function(n,r){if(function(n){return 1===n?u(t.get()):-1===n&&c(t.get())}(r)){var o=e*(-1*r);n.forEach((function(n){return n.add(o)}))}}}}function x(n){var e=n.loop,t=n.limit,r=n.scrollSnaps,o=n.contentSize,i=t.reachedMax,a=t.reachedAny,c=t.removeOffset;function u(n,e){return Math.abs(n)<Math.abs(e)?n:e}function s(n,t){var r=n,i=n+o,a=n-o;if(!e)return r;if(!t)return u(u(r,i),a);var c=u(r,1===t?i:a);return Math.abs(c)*t}return{byDistance:function(t,o){var u=n.target.get()+t,l=function(n){var e=c(n);return{index:r.map((function(n){return n-e})).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:e}}(u),d=function(t,r){if(!(!e&&a(t)))return r;var o=n.index,c=o.min,u=o.max;return i(t)?c:u}(u,l.index),f=!e&&a(u);return!o||f?{index:d,distance:t}:{index:d,distance:t+s(r[d]-l.distance,0)}},byIndex:function(e,t){return{index:e,distance:s(r[e]-n.target.get(),t)}},shortcut:s}}function h(n){var e,t,r,o=n.axis,i=n.location,a=n.contentSize,c=n.viewSize,u=n.slideSizes,s=n.scrollSnaps,d=l(u),f=l(u).reverse(),m=(e=s[0]-1,t=v(e,f),r=x(e,t,0),h(t,r,1)).concat(function(){var n=v(c-s[0]-1,d),e=x(a,d,-c);return h(n,-e,0)}()),p="x"===o.scroll?"left":"top";function g(n,e){return n.reduce((function(n,e){return n-u[e]}),e)}function v(n,e){return e.reduce((function(e,t){return g(e,n)>0?e.concat([t]):e}),[])}function x(n,e,t){return e.reduce((function(e,t){var r=e+u[t];return r<n?r:e}),t)}function h(n,e,t){var r=n.slice().sort((function(n,e){return n-e}));return r.map((function(n,o){var i=a*(t?-1:0),c=a*(t?0:1),u=function(n,e,t){var r=d.length-1;return g(n.map((function(n){return(n+t)%r})),e)}(r.slice(0,o),e,t);return{point:u,getTarget:function(n){return n>u?i:c},index:n,location:-1}}))}return{canLoop:function(){return m.every((function(n){var e=n.index;return g(d.filter((function(n){return n!==e})),c)<=0}))},clear:function(n){m.forEach((function(e){var t=e.index;n[t].style[p]=""}))},loop:function(n){m.forEach((function(e){var t=e.getTarget,r=e.location,o=e.index,a=t(i.get());a!==r&&(n[o].style[p]=a+"%",e.location=a)}))},loopPoints:m}}function S(n){var e=n.scrollTo,t=n.slidesToScroll,r=n.root,o=i(),a=o.removeAll,c=0;function u(n){9===n.keyCode&&(c=(new Date).getTime())}function s(n,i){o.add(n,"focus",(function(){if(!((new Date).getTime()-c>10)){r.scrollLeft=0;var n=Math.floor(i/t);e.index(n,0)}}),!0)}return{addActivationEvents:function(n){o.add(document,"keydown",u,!1),n.forEach(s)},removeAllEvents:a}}function y(n){var e=n.contentSize,t=n.slideSizes,r=n.viewSize,o=n.inViewThreshold,i=n.loop,a=Math.min(Math.max(o,.01),.99),c=t.map((function(n){return n*a})),u=l(t).map((function(n){return t.slice(0,n).reduce((function(n,e){return n-e}),0)})),s=(i?[0,e,-e]:[0]).map(d).reduce((function(n,e){return n.concat(e)}),[]);function d(n){return u.map((function(e,o){return{start:e-t[o]+c[o]+n,end:e+r-c[o]+n,index:o}}))}return{check:function(n){return s.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}),[])}}}function w(n){var e=n.axis,t=n.container,r={x:function(n){return"translate3d("+n+"%,0px,0px)"},y:function(n){return"translate3d(0px,"+n+"%,0px)"}}[e.scroll],o=s(2),i=t.style,a=!1,c=0;return{clear:function(){i.transform="",c=0},to:function(n){if(!a){var e=o(n.get());c!==e&&(getComputedStyle(t).transform,i.transform=r(e),c=e)}},toggleActive:function(n){a=!n}}}function b(n,o,i,s,d){var f,b,T,M,z,A=s.align,D=s.axis,E=s.startIndex,P=s.inViewThreshold,I=s.loop,C=s.speed,L=s.dragFree,B=s.slidesToScroll,k=s.containScroll,O=function(n){var e="y"===n?"y":"x";return{cross:"y"===n?"x":"y",measure:function(n){var t=n.getBoundingClientRect(),r=t.width,o=t.height;return"x"===e?r:o},scroll:e}}(D),F=(f=O.measure(o),{measure:function(n){return n/f*100},totalPercent:100}),N=F.totalPercent,U=i.map(O.measure).map(F.measure),V=l(U),j=function(n,e){for(var t=[],r=0;r<n.length;r+=e)t.push(n.slice(r,r+e));return t}(U,B).map((function(n){return n.reduce((function(n,e){return n+e}))})),H=U.reduce((function(n,e){return n+e}),0),q=e({align:A,viewSize:N}),R=function(n){var e,r=n.snapSizes,o=n.alignment,i=n.loop,c=r.map(o.measure),u=(e=t({limit:a({min:0,max:r.length-1}),start:0,loop:i}),r.map((function(n,t){var r=e.set(t+1).get();return n+c[t]-c[r]})));return{measure:function(n){return u.slice(0,n).reduce((function(n,e){return n-e}),c[0])}}}({snapSizes:j,alignment:q,loop:I}),X=l(j).map(R.measure),G=g({alignment:q,contentSize:H,viewSize:N}),Y=!I&&""!==k,J="trimSnaps"===k,K=G.measure(X,J),Q=Y?K:X,W=t({limit:a({min:0,max:Math.max(0,Q.length-1)}),start:E,loop:I}),Z=W.clone(),$=function(n){var e=n.contentSize,t=n.loop;return{measure:function(n){var r=n[0],o=n[n.length-1];return a({min:t?r-e:o,max:r})}}}({loop:I,contentSize:H}).measure(Q),_=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(){sn.scrollBody.seek(tn).update();var n=sn.scrollBody.settle(tn);if(un.pointerDown()||(I||sn.scrollBounds.constrain(tn),n&&(sn.animation.stop(),d.emit("settle"))),I){var e=sn.scrollBody.direction.get();sn.scrollLooper.loop(rn,e),sn.slideLooper.loop(i)}n||d.emit("scroll"),sn.translate.to(sn.scrollBody.location),sn.animation.proceed()})),nn=Q[W.get()],en=r(nn),tn=r(nn),rn=[en,tn],on=m({location:en,speed:C,mass:1}),an=x({contentSize:H,index:W,limit:$,loop:I,scrollSnaps:Q,target:tn}),cn=function(n){var e=n.index,t=n.scrollTarget,r=n.animation,o=n.indexPrevious,i=n.events,a=n.target;function c(n){var t=n.distance,c=n.index!==e.get();t&&(r.start(),a.add(t)),c&&(o.set(e.get()),e.set(n.index),i.emit("select"))}return{distance:function(n,e){c(t.byDistance(n,e))},index:function(n,r){var o=e.clone().set(n);c(t.byIndex(o.get(),r))}}}({animation:_,events:d,index:W,indexPrevious:Z,scrollTarget:an,target:tn}),un=c({animation:_,axis:O,dragFree:L,dragTracker:u({axis:O,pxToPercent:F}),element:n,events:d,index:W,limit:$,location:en,loop:I,scrollBody:on,scrollTo:cn,scrollTarget:an,target:tn}),sn={animation:_,axis:O,dragHandler:un,pxToPercent:F,index:W,indexPrevious:Z,limit:$,location:en,options:s,scrollBody:on,scrollBounds:p({animation:_,limit:$,location:en,scrollBody:on}),scrollLooper:v({contentSize:H,limit:$,location:en,pxToPercent:F}),scrollProgress:(b={limit:$},T=b.limit,M=T.max,z=T.length,{get:function(n){return(n-M)/-z}}),scrollSnaps:Q,scrollTarget:an,scrollTo:cn,slideFocus:S({root:n,scrollTo:cn,slidesToScroll:B}),slideLooper:h({axis:O,contentSize:H,location:en,scrollSnaps:Q,slideSizes:U,viewSize:N}),slidesInView:y({contentSize:H,inViewThreshold:P,loop:I,slideSizes:U,viewSize:N}),slideIndexes:V,target:tn,translate:w({axis:O,container:o})};return sn}var T={align:"center",axis:"x",containScroll:"",containerSelector:"*",dragFree:!1,draggable:!0,draggableClass:"is-draggable",draggingClass:"is-dragging",inViewThreshold:0,loop:!1,selectedClass:"is-selected",slidesToScroll:1,speed:10,startIndex:0};return function(e,t){var r,o,a,c,u,s,l=function(){var n={destroy:[],pointerDown:[],pointerUp:[],init:[],reInit:[],resize:[],scroll:[],select:[],settle:[]},e={emit:function(t){return n[t].forEach((function(n){return n(t)})),e},off:function(t,r){return n[t]=n[t].filter((function(n){return n!==r})),e},on:function(t,r){return n[t]=n[t].concat([r]),e}};return e}(),m=i(),p=(r=function(){if(h){var n=c.axis.measure(e);y!==n&&E(),l.emit("resize")}},o=500,a={id:0},function(){window.clearTimeout(a.id),a.id=window.setTimeout(r,o)||0}),g=E,v=l.on,x=l.off,h=!1,S=n({},T),y=0;function w(){if(!e)throw new Error("Missing root node 😢");var n,t=S.containerSelector,r=e.querySelector(t);if(!r)throw new Error("Missing container node 😢");n=(u=r).children,s=Array.prototype.slice.call(n)}function M(t){if(w(),S=n(S,t),c=b(e,u,s,S,l),y=c.axis.measure(e),m.add(window,"resize",p),c.translate.to(c.scrollBody.location),S.loop){if(!c.slideLooper.canLoop())return D(),M({loop:!1});c.slideLooper.loop(s)}S.draggable&&s.length&&(c.dragHandler.addActivationEvents(),S.draggableClass&&f(e,S.draggableClass),S.draggingClass&&l.on("pointerDown",z).on("pointerUp",z)),s.length&&c.slideFocus.addActivationEvents(s),S.selectedClass&&(A(),l.on("select",A).on("pointerUp",A)),h||(setTimeout((function(){return l.emit("init")}),0),h=!0)}function z(n){var t=S.draggingClass;"pointerDown"===n?f(e,t):d(e,t)}function A(){var n=S.selectedClass,e=P(!0);I(!0).forEach((function(e){return d(s[e],n)})),e.forEach((function(e){return f(s[e],n)}))}function D(){c.dragHandler.removeAllEvents(),c.slideFocus.removeAllEvents(),c.animation.stop(),m.removeAll(),c.translate.clear(),c.slideLooper.clear(s),d(e,S.draggableClass),s.forEach((function(n){return d(n,S.selectedClass)})),l.off("select",A),l.off("pointerUp",A),l.off("pointerDown",z),l.off("pointerUp",z)}function E(e){if(h){var t=n({startIndex:L()},e);D(),M(t),l.emit("reInit")}}function P(n){var e=c[n?"target":"location"].get(),t=S.loop?"removeOffset":"constrain";return c.slidesInView.check(c.limit[t](e))}function I(n){var e=P(n);return c.slideIndexes.filter((function(n){return-1===e.indexOf(n)}))}function C(n,e){c.scrollBody.useDefaultMass().useDefaultSpeed(),h&&c.scrollTo.index(n,e||0)}function L(){return c.index.get()}return M(t),{canScrollNext:function(){return c.index.clone().add(1).get()!==L()},canScrollPrev:function(){return c.index.clone().add(-1).get()!==L()},clickAllowed:function(){return c.dragHandler.clickAllowed()},containerNode:function(){return u},dangerouslyGetEngine:function(){return c},destroy:function(){h&&(D(),h=!1,l.emit("destroy"))},off:x,on:v,previousScrollSnap:function(){return c.indexPrevious.get()},reInit:g,scrollNext:function(){C(c.index.clone().add(1).get(),-1)},scrollPrev:function(){C(c.index.clone().add(-1).get(),1)},scrollProgress:function(){return c.scrollProgress.get(c.location.get())},scrollSnapList:function(){return c.scrollSnaps.map(c.scrollProgress.get)},scrollTo:C,selectedScrollSnap:L,slideNodes:function(){return s},slidesInView:P,slidesNotInView:I}}}));
!function(n,e){"object"==typeof exports&&"undefined"!=typeof module?module.exports=e():"function"==typeof define&&define.amd?define(e):(n=n||self).EmblaCarousel=e()}(this,(function(){"use strict";function n(){return(n=Object.assign||function(n){for(var e=1;e<arguments.length;e++){var t=arguments[e];for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&(n[r]=t[r])}return n}).apply(this,arguments)}function e(n){var e=n.viewSize,t=n.align,r={start:function(){return 0},center:function(n){return o(n)/2},end:o};function o(n){return e-n}return{measure:function(n){return"number"==typeof t?e*Number(t):r[t](n)}}}function t(n){var e=n.start,r=n.limit,o=n.loop,i=r.min,a=r.max,c=r[o?"loop":"constrain"],u=c(e);function s(){return u}function l(n){return u=c(n),d}var d={add:function n(e){if(0!==e){var t=e/Math.abs(e);return l(s()+t),n(e+-1*t)}return d},clone:function(){return t({start:s(),limit:r,loop:o})},get:s,max:a,min:i,set:l};return d}function r(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 o(n){var e=r(t(n));function t(n){return 0===n?0:n/Math.abs(n)}var o={get:e.get,set:function(n){var r=t(n.get());return 0!==r&&e.set(r),o}};return o}function i(){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.min,t=n.max,r=Math.abs(e-t);function o(n){return n<e}function i(n){return n>t}function a(n){return o(n)||i(n)}return{constrain:function(n){return a(n)?o(n)?e:t:n},length:r,loop:function(n){return a(n)?o(n)?t:e:n},max:t,min:e,reachedAny:a,reachedMax:i,reachedMin:o,removeOffset:function(n){if(e===t)return n;for(;o(n);)n+=r;for(;i(n);)n-=r;return n}}}function c(n){var e=n.target,t=n.scrollBody,c=n.dragFree,u=n.animation,s=n.axis,l=n.element,d=n.dragTracker,f=n.location,m=n.events,p=n.limit,g=s.scroll,v=s.cross,x=["INPUT","SELECT","TEXTAREA"],h=r(0),S=r(0),w=r(0),y=i(),b=i(),T={mouse:2.5,touch:3.5},M={mouse:5,touch:7},z=c?5:12,A=a({min:p.min-70,max:p.max+70}),D=!1,E=!1,P=!1,I=!1;function B(n){if(!(I="mousedown"===n.type)||0===n.button){var r,o,i=k(e.get(),f.get())>=2,a=I||!i,c=(r=n.target,o=r.nodeName||"",!(x.indexOf(o)>-1)),u=i||I&&c;D=!0,d.pointerDown(n),w.set(e),e.set(f),t.useDefaultMass().useSpeed(80),function(){var n=I?document:l;b.add(n,"touchmove",C).add(n,"touchend",L).add(n,"mousemove",C).add(n,"mouseup",L)}(),h.set(d.readPoint(n,g)),S.set(d.readPoint(n,v)),m.emit("pointerDown"),a&&(P=!1),u&&n.preventDefault()}}function C(t){if(!E&&!I){if(!t.cancelable)return L();var r=d.readPoint(t,g).get(),o=d.readPoint(t,v).get(),i=k(r,h.get()),a=k(o,S.get());if(!(E=i>a)&&!P)return L()}var c=d.pointerMove(t),s=p.reachedAny(f.get()),l=!n.loop&&s?2:1;!P&&c&&(P=!0),u.start(),e.add(c/l),t.preventDefault()}function L(){var r,i,a,u=n.scrollTo,s=d.pointerUp()*(c?M:T)[I?"mouse":"touch"],l=function(t){var r=n.scrollTarget,i=n.index,a=!(r.byDistance(0,!1).index!==i.get())&&Math.abs(t)>4,u=t+f.get();if(a&&!c&&!p.reachedAny(u)){var s=i.clone().add(-1*o(t).get());return r.byIndex(s.get(),0).distance}if(!n.loop&&A.reachedAny(u)){var l=A.reachedMax(u)?"max":"min";return A[l]-e.get()}return r.byDistance(t,!c).distance}(s),g=(r=s,i=l,a=k(Math.abs(r),Math.abs(i)),Math.abs(r)<=Math.abs(i)||0===r||0===i?0:Math.abs(a/r));k(e.get(),w.get())>=.5&&!I&&(P=!0),E=!1,D=!1,b.removeAll(),t.useSpeed(z+z*g),u.distance(l,!c),I=!1,m.emit("pointerUp")}function k(n,e){return Math.abs(n-e)}function O(n){P&&n.preventDefault()}return{addActivationEvents:function(){var n=l;y.add(n,"touchmove",(function(){})).add(n,"touchend",(function(){})).add(n,"touchstart",B).add(n,"mousedown",B).add(n,"touchcancel",L).add(n,"contextmenu",L).add(n,"click",O)},clickAllowed:function(){return!P},pointerDown:function(){return D},removeAllEvents:function(){y.removeAll(),b.removeAll()}}}function u(n){var e=n.axis,t=n.pxToPercent,o=e.scroll,i={x:"clientX",y:"clientY"},a=r(0),c=r(0),u=r(0),s=r(0),l=[],d=(new Date).getTime(),f=!1;function m(n,e){f=!n.touches;var t=i[e],r=f?n[t]:n.touches[0][t];return s.set(r)}return{pointerDown:function(n){var e=m(n,o);return a.set(e),u.set(e),t.measure(a.get())},pointerMove:function(n){var e=m(n,o),r=(new Date).getTime(),i=r-d;return i>=10&&(i>=100&&(l=[]),l.push(e.get()),d=r),c.set(e).subtract(u),u.set(e),t.measure(c.get())},pointerUp:function(){var n=(new Date).getTime()-d,e=u.get(),r=l.slice(-5).map((function(n){return e-n})).sort((function(n,e){return Math.abs(n)<Math.abs(e)?1:-1}))[0];return u.set(n>100||!r?0:r),l=[],t.measure(u.get())},readPoint:m}}function s(n){var e=Math.pow(10,n);return function(n){return Math.round(n*e)/e}}function l(n){return Object.keys(n).map(Number)}function d(n,e){var t=n.classList;t.contains(e)&&t.remove(e)}function f(n,e){var t=n.classList;t.contains(e)||t.add(e)}function m(n){var e=n.location,t=n.speed,i=n.mass,a=s(2),c=r(0),u=r(0),l=r(0),d=o(0),f={speed:t,mass:i};function m(n){return f.speed=n,g}function p(n){return f.mass=n,g}var g={direction:d,location:e,seek:function(n){l.set(n).subtract(e);var t,r,o,i,a,s=l.get(),m=(t=s,r=0,o=100,i=0,a=f.speed,i+(t-r)/(o-r)*(a-i));return d.set(l),l.normalize().multiply(m).subtract(c),function(n){n.divide(f.mass),u.add(n)}(l),g},settle:function(n){var t=n.get()-e.get(),r=!a(t);return r&&e.set(n),r},update:function(){c.add(u),e.add(c),u.multiply(0)},useDefaultMass:function(){return p(i),g},useDefaultSpeed:function(){return m(t),g},useMass:p,useSpeed:m};return g}function p(n){var e=n.limit,t=n.location,r=n.scrollBody,o=n.animation,i=e.min,a=e.max,c=e.reachedMin,u=e.reachedMax,s=!1,l=0;return{constrain:function(n){(function(n){return!s&&!l&&(c(t.get())?n.get()!==i:!!u(t.get())&&n.get()!==a)})(n)&&(l=window.setTimeout((function(){var t=e.constrain(n.get());n.set(t),r.useSpeed(10).useMass(3),o.start(),l=0}),50))},toggleActive:function(n){s=!n}}}function g(n){var e=n.alignment,t=n.contentSize,r=n.viewSize,o=a({min:-t+r,max:0}),i=[e.measure(t)],c=t>r;return{measure:function(n,e){var t=n.map(o.constrain),r=function(n){var e=n[0],t=n[n.length-1];return a({min:n.lastIndexOf(e)+1,max:n.indexOf(t)})}(t),u=r.min,s=r.max;return c?e?t.slice(u-1,s+1):t:i}}}function v(n){var e=n.contentSize,t=n.location,r=n.limit,o=n.pxToPercent,i=a({min:r.min+o.measure(.1),max:r.max+o.measure(.1)}),c=i.reachedMin,u=i.reachedMax;return{loop:function(n,r){if(function(n){return 1===n?u(t.get()):-1===n&&c(t.get())}(r)){var o=e*(-1*r);n.forEach((function(n){return n.add(o)}))}}}}function x(n){var e=n.loop,t=n.limit,r=n.scrollSnaps,o=n.contentSize,i=t.reachedMax,a=t.reachedAny,c=t.removeOffset;function u(n,e){return Math.abs(n)<Math.abs(e)?n:e}function s(n,t){var r=n,i=n+o,a=n-o;if(!e)return r;if(!t)return u(u(r,i),a);var c=u(r,1===t?i:a);return Math.abs(c)*t}return{byDistance:function(t,o){var u=n.target.get()+t,l=function(n){var e=c(n);return{index:r.map((function(n){return n-e})).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:e}}(u),d=function(t,r){if(!(!e&&a(t)))return r;var o=n.index,c=o.min,u=o.max;return i(t)?c:u}(u,l.index),f=!e&&a(u);return!o||f?{index:d,distance:t}:{index:d,distance:t+s(r[d]-l.distance,0)}},byIndex:function(e,t){return{index:e,distance:s(r[e]-n.target.get(),t)}},shortcut:s}}function h(n){var e,t=n.axis,r=n.location,o=n.slidesInView,i=n.contentSize,a=n.viewSize,c=n.slideSizes,u=n.scrollSnaps,s=l(c),d=l(c).reverse(),f=(e=u[0]-1,v(g(d,e),"end")).concat(function(){var n=a-u[0]-1;return v(g(s,n),"start")}()),m="x"===t.scroll?"left":"top";function p(n,e){return n.reduce((function(n,e){return n-c[e]}),e)}function g(n,e){return n.reduce((function(n,t){return p(n,e)>0?n.concat([t]):n}),[])}function v(n,e){var t="start"===e,a=t?-i:i,c=o.findSlideBounds(a);return n.map((function(n){var e=t?0:-i,o=t?i:0,a=c.filter((function(e){return e.index===n}))[0][t?"end":"start"];return{point:a,getTarget:function(){return r.get()>a?e:o},index:n,location:-1}}))}return{canLoop:function(){return f.every((function(n){var e=n.index;return p(s.filter((function(n){return n!==e})),a)<=0}))},clear:function(n){f.forEach((function(e){var t=e.index;n[t].style[m]=""}))},loop:function(n){f.forEach((function(e){var t=e.getTarget,r=e.location,o=e.index,i=t();i!==r&&(n[o].style[m]=i+"%",e.location=i)}))},loopPoints:f}}function S(n){var e=n.scrollTo,t=n.slidesToScroll,r=n.root,o=i(),a=o.removeAll,c=0;function u(n){9===n.keyCode&&(c=(new Date).getTime())}function s(n,i){o.add(n,"focus",(function(){if(!((new Date).getTime()-c>10)){r.scrollLeft=0;var n=Math.floor(i/t);e.index(n,0)}}),!0)}return{addActivationEvents:function(n){o.add(document,"keydown",u,!1),n.forEach(s)},removeAllEvents:a}}function w(n){var e=n.axis,t=n.container,r={x:function(n){return"translate3d("+n+"%,0px,0px)"},y:function(n){return"translate3d(0px,"+n+"%,0px)"}}[e.scroll],o=s(2),i=t.style,a=!1,c=0;return{clear:function(){i.transform="",c=0},to:function(n){if(!a){var e=o(n.get());c!==e&&(getComputedStyle(t).transform,i.transform=r(e),c=e)}},toggleActive:function(n){a=!n}}}function y(n,o,i,s,d){var f,y,b,T,M,z=s.align,A=s.axis,D=s.startIndex,E=s.inViewThreshold,P=s.loop,I=s.speed,B=s.dragFree,C=s.slidesToScroll,L=s.containScroll,k=function(n){var e="y"===n?"y":"x";return{cross:"y"===n?"x":"y",measure:function(n){var t=n.getBoundingClientRect(),r=t.width,o=t.height;return"x"===e?r:o},scroll:e}}(A),O=(f=k.measure(o),{measure:function(n){return n/f*100},totalPercent:100}),V=O.totalPercent,F=i.map(k.measure).map(O.measure),N=l(F),U=function(n,e){for(var t=[],r=0;r<n.length;r+=e)t.push(n.slice(r,r+e));return t}(F,C).map((function(n){return n.reduce((function(n,e){return n+e}))})),j=F.reduce((function(n,e){return n+e}),0),H=e({align:z,viewSize:V}),q=function(n){var e,r=n.snapSizes,o=n.alignment,i=n.loop,c=r.map(o.measure),u=(e=t({limit:a({min:0,max:r.length-1}),start:0,loop:i}),r.map((function(n,t){var r=e.set(t+1).get();return n+c[t]-c[r]})));return{measure:function(n){return u.slice(0,n).reduce((function(n,e){return n-e}),c[0])}}}({snapSizes:U,alignment:H,loop:P}),R=l(U).map(q.measure),X=g({alignment:H,contentSize:j,viewSize:V}),G=!P&&""!==L,Y="trimSnaps"===L,J=X.measure(R,Y),K=G?J:R,Q=t({limit:a({min:0,max:Math.max(0,K.length-1)}),start:D,loop:P}),W=Q.clone(),Z=function(n){var e=n.contentSize,t=n.loop;return{measure:function(n){var r=n[0],o=n[n.length-1];return a({min:t?r-e:o,max:r})}}}({loop:P,contentSize:j}).measure(K),$=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(){sn.scrollBody.seek(en).update();var n=sn.scrollBody.settle(en);if(un.pointerDown()||(P||sn.scrollBounds.constrain(en),n&&(sn.animation.stop(),d.emit("settle"))),P){var e=sn.scrollBody.direction.get();sn.scrollLooper.loop(tn,e),sn.slideLooper.loop(i)}n||d.emit("scroll"),sn.translate.to(sn.scrollBody.location),sn.animation.proceed()})),_=K[Q.get()],nn=r(_),en=r(_),tn=[nn,en],rn=m({location:nn,speed:I,mass:1}),on=x({contentSize:j,index:Q,limit:Z,loop:P,scrollSnaps:K,target:en}),an=function(n){var e=n.index,t=n.scrollTarget,r=n.animation,o=n.indexPrevious,i=n.events,a=n.target;function c(n){var t=n.distance,c=n.index!==e.get();t&&(r.start(),a.add(t)),c&&(o.set(e.get()),e.set(n.index),i.emit("select"))}return{distance:function(n,e){c(t.byDistance(n,e))},index:function(n,r){var o=e.clone().set(n);c(t.byIndex(o.get(),r))}}}({animation:$,events:d,index:Q,indexPrevious:W,scrollTarget:on,target:en}),cn=function(n){var e=n.contentSize,t=n.slideSizes,r=n.viewSize,o=n.inViewThreshold,i=n.loop,a=Math.min(Math.max(o,.01),.99),c=l(t).map((function(n){return t.slice(0,n).reduce((function(n,e){return n-e}),0)})),u=(i?[0,e,-e]:[0]).reduce((function(n,e){return n.concat(s(e,a))}),[]);function s(n,e){var o=t.map((function(n){return n*(e||0)}));return c.map((function(e,i){return{start:e-t[i]+o[i]+n,end:e+r-o[i]+n,index:i}}))}return{check:function(n){return u.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:s}}({contentSize:j,inViewThreshold:E,loop:P,slideSizes:F,viewSize:V}),un=c({animation:$,axis:k,dragFree:B,dragTracker:u({axis:k,pxToPercent:O}),element:n,events:d,index:Q,limit:Z,location:nn,loop:P,scrollBody:rn,scrollTo:an,scrollTarget:on,target:en}),sn={animation:$,axis:k,dragHandler:un,pxToPercent:O,index:Q,indexPrevious:W,limit:Z,location:nn,options:s,scrollBody:rn,scrollBounds:p({animation:$,limit:Z,location:nn,scrollBody:rn}),scrollLooper:v({contentSize:j,limit:Z,location:nn,pxToPercent:O}),scrollProgress:(y={limit:Z},b=y.limit,T=b.max,M=b.length,{get:function(n){return(n-T)/-M}}),scrollSnaps:K,scrollTarget:on,scrollTo:an,slideFocus:S({root:n,scrollTo:an,slidesToScroll:C}),slideLooper:h({axis:k,contentSize:j,location:nn,scrollSnaps:K,slideSizes:F,slidesInView:cn,viewSize:V}),slidesInView:cn,slideIndexes:N,target:en,translate:w({axis:k,container:o})};return sn}var b={align:"center",axis:"x",containScroll:"",containerSelector:"*",dragFree:!1,draggable:!0,draggableClass:"is-draggable",draggingClass:"is-dragging",inViewThreshold:0,loop:!1,selectedClass:"is-selected",slidesToScroll:1,speed:10,startIndex:0};return function(e,t){var r,o,a,c,u,s,l=function(){var n={destroy:[],pointerDown:[],pointerUp:[],init:[],reInit:[],resize:[],scroll:[],select:[],settle:[]},e={emit:function(t){return n[t].forEach((function(n){return n(t)})),e},off:function(t,r){return n[t]=n[t].filter((function(n){return n!==r})),e},on:function(t,r){return n[t]=n[t].concat([r]),e}};return e}(),m=i(),p=(r=function(){if(h){var n=c.axis.measure(e);w!==n&&E(),l.emit("resize")}},o=500,a={id:0},function(){window.clearTimeout(a.id),a.id=window.setTimeout(r,o)||0}),g=E,v=l.on,x=l.off,h=!1,S=n({},b),w=0;function T(){if(!e)throw new Error("Missing root node 😢");var n,t=S.containerSelector,r=e.querySelector(t);if(!r)throw new Error("Missing container node 😢");n=(u=r).children,s=Array.prototype.slice.call(n)}function M(t){if(T(),S=n(S,t),c=y(e,u,s,S,l),w=c.axis.measure(e),m.add(window,"resize",p),c.translate.to(c.scrollBody.location),S.loop){if(!c.slideLooper.canLoop())return D(),M({loop:!1});c.slideLooper.loop(s)}S.draggable&&s.length&&(c.dragHandler.addActivationEvents(),S.draggableClass&&f(e,S.draggableClass),S.draggingClass&&l.on("pointerDown",z).on("pointerUp",z)),s.length&&c.slideFocus.addActivationEvents(s),S.selectedClass&&(A(),l.on("select",A).on("pointerUp",A)),h||(setTimeout((function(){return l.emit("init")}),0),h=!0)}function z(n){var t=S.draggingClass;"pointerDown"===n?f(e,t):d(e,t)}function A(){var n=S.selectedClass,e=P(!0);I(!0).forEach((function(e){return d(s[e],n)})),e.forEach((function(e){return f(s[e],n)}))}function D(){c.dragHandler.removeAllEvents(),c.slideFocus.removeAllEvents(),c.animation.stop(),m.removeAll(),c.translate.clear(),c.slideLooper.clear(s),d(e,S.draggableClass),s.forEach((function(n){return d(n,S.selectedClass)})),l.off("select",A),l.off("pointerUp",A),l.off("pointerDown",z),l.off("pointerUp",z)}function E(e){if(h){var t=n({startIndex:C()},e);D(),M(t),l.emit("reInit")}}function P(n){var e=c[n?"target":"location"].get(),t=S.loop?"removeOffset":"constrain";return c.slidesInView.check(c.limit[t](e))}function I(n){var e=P(n);return c.slideIndexes.filter((function(n){return-1===e.indexOf(n)}))}function B(n,e){c.scrollBody.useDefaultMass().useDefaultSpeed(),h&&c.scrollTo.index(n,e||0)}function C(){return c.index.get()}return M(t),{canScrollNext:function(){return c.index.clone().add(1).get()!==C()},canScrollPrev:function(){return c.index.clone().add(-1).get()!==C()},clickAllowed:function(){return c.dragHandler.clickAllowed()},containerNode:function(){return u},dangerouslyGetEngine:function(){return c},destroy:function(){h&&(D(),h=!1,l.emit("destroy"))},off:x,on:v,previousScrollSnap:function(){return c.indexPrevious.get()},reInit:g,scrollNext:function(){B(c.index.clone().add(1).get(),-1)},scrollPrev:function(){B(c.index.clone().add(-1).get(),1)},scrollProgress:function(){return c.scrollProgress.get(c.location.get())},scrollSnapList:function(){return c.scrollSnaps.map(c.scrollProgress.get)},scrollTo:B,selectedScrollSnap:C,slideNodes:function(){return s},slidesInView:P,slidesNotInView:I}}}));
{
"name": "embla-carousel",
"version": "4.0.3",
"version": "4.0.4",
"private": false,

@@ -5,0 +5,0 @@ "author": "David Cetinkaya <david.o.cetinkaya@gmail.com>",

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

var axis = params.axis,
containerLocation = params.location;
scrollLocation = params.location,
slidesInView = params.slidesInView;
var contentSize = params.contentSize,

@@ -1023,42 +1024,29 @@ viewSize = params.viewSize,

function subtractItemSizes(indexes, from) {
function removeSlideSizes(indexes, from) {
return indexes.reduce(function (a, i) {
var size = slideSizes[i];
return a - size;
return a - slideSizes[i];
}, from);
}
function loopItemsIn(sizeOfGap, indexes) {
function slidesInGap(indexes, gap) {
return indexes.reduce(function (a, i) {
var gapLeft = subtractItemSizes(a, sizeOfGap);
return gapLeft > 0 ? a.concat([i]) : a;
var remainingGap = removeSlideSizes(a, gap);
return remainingGap > 0 ? a.concat([i]) : a;
}, []);
}
function loopStart(sizeOfGap, indexes, from) {
return indexes.reduce(function (a, i) {
var gapFilled = a + slideSizes[i];
return gapFilled < sizeOfGap ? gapFilled : a;
}, from);
}
function findLoopPoints(indexes, edge) {
var isStartEdge = edge === 'start';
var offset = isStartEdge ? -contentSize : contentSize;
var slideBounds = slidesInView.findSlideBounds(offset);
return indexes.map(function (index) {
var initial = isStartEdge ? 0 : -contentSize;
var altered = isStartEdge ? contentSize : 0;
var bounds = slideBounds.filter(function (b) {
return b.index === index;
})[0];
var point = bounds[isStartEdge ? 'end' : 'start'];
function loopPointFor(indexes, from, direction) {
var slideCount = ascItems.length - 1;
return subtractItemSizes(indexes.map(function (i) {
return (i + direction) % slideCount;
}), from);
}
function loopPointsFor(indexes, from, direction) {
var ascIndexes = indexes.slice().sort(function (a, b) {
return a - b;
});
return ascIndexes.map(function (index, loopIndex) {
var initial = contentSize * (!direction ? 0 : -1);
var offset = contentSize * (!direction ? 1 : 0);
var slidesInSpan = ascIndexes.slice(0, loopIndex);
var point = loopPointFor(slidesInSpan, from, direction);
var getTarget = function getTarget(location) {
return location > point ? initial : offset;
var getTarget = function getTarget() {
return scrollLocation.get() > point ? initial : altered;
};

@@ -1077,5 +1065,4 @@

var gap = scrollSnaps[0] - 1;
var indexes = loopItemsIn(gap, descItems);
var start = loopStart(gap, indexes, 0);
return loopPointsFor(indexes, start, 1);
var indexes = slidesInGap(descItems, gap);
return findLoopPoints(indexes, 'end');
}

@@ -1085,5 +1072,4 @@

var gap = viewSize - scrollSnaps[0] - 1;
var indexes = loopItemsIn(gap, ascItems);
var start = loopStart(contentSize, ascItems, -viewSize);
return loopPointsFor(indexes, -start, 0);
var indexes = slidesInGap(ascItems, gap);
return findLoopPoints(indexes, 'start');
}

@@ -1097,3 +1083,3 @@

});
return subtractItemSizes(otherIndexes, viewSize) <= 0;
return removeSlideSizes(otherIndexes, viewSize) <= 0;
});

@@ -1107,3 +1093,3 @@ }

index = loopPoint.index;
var target = getTarget(containerLocation.get());
var target = getTarget();

@@ -1178,7 +1164,7 @@ if (target !== location) {

var threshold = Math.min(Math.max(inViewThreshold, 0.01), 0.99);
var thresholds = slideSizes.map(function (s) {
return s * threshold;
});
var scrollSnaps = arrayKeys(slideSizes).map(scrollSnap);
var pointsToCheck = concatSlidePoints();
var offsets = loop ? [0, contentSize, -contentSize] : [0];
var slideBounds = offsets.reduce(function (a, loopOffset) {
return a.concat(findSlideBounds(loopOffset, threshold));
}, []);

@@ -1192,10 +1178,6 @@ function scrollSnap(index) {

function concatSlidePoints() {
var offsets = loop ? [0, contentSize, -contentSize] : [0];
return offsets.map(slidePoints).reduce(function (a, b) {
return a.concat(b);
}, []);
}
function slidePoints(offset) {
function findSlideBounds(offset, threshold) {
var thresholds = slideSizes.map(function (s) {
return s * (threshold || 0);
});
return scrollSnaps.map(function (snap, index) {

@@ -1211,6 +1193,6 @@ return {

function check(location) {
return pointsToCheck.reduce(function (list, point) {
var index = point.index,
start = point.start,
end = point.end;
return slideBounds.reduce(function (list, slideBound) {
var index = slideBound.index,
start = slideBound.start,
end = slideBound.end;
var inList = list.indexOf(index) !== -1;

@@ -1223,3 +1205,4 @@ var inView = start < location && end > location;

var self = {
check: check
check: check,
findSlideBounds: findSlideBounds
};

@@ -1392,2 +1375,9 @@ return self;

target: target
});
var slidesInView = SlidesInView({
contentSize: contentSize,
inViewThreshold: inViewThreshold,
loop: loop,
slideSizes: slideSizes,
viewSize: viewSize
}); // DragHandler

@@ -1455,11 +1445,6 @@

slideSizes: slideSizes,
slidesInView: slidesInView,
viewSize: viewSize
}),
slidesInView: SlidesInView({
contentSize: contentSize,
inViewThreshold: inViewThreshold,
loop: loop,
slideSizes: slideSizes,
viewSize: viewSize
}),
slidesInView: slidesInView,
slideIndexes: slideIndexes,

@@ -1466,0 +1451,0 @@ target: target,

@@ -1016,3 +1016,4 @@ 'use strict';

var axis = params.axis,
containerLocation = params.location;
scrollLocation = params.location,
slidesInView = params.slidesInView;
var contentSize = params.contentSize,

@@ -1027,42 +1028,29 @@ viewSize = params.viewSize,

function subtractItemSizes(indexes, from) {
function removeSlideSizes(indexes, from) {
return indexes.reduce(function (a, i) {
var size = slideSizes[i];
return a - size;
return a - slideSizes[i];
}, from);
}
function loopItemsIn(sizeOfGap, indexes) {
function slidesInGap(indexes, gap) {
return indexes.reduce(function (a, i) {
var gapLeft = subtractItemSizes(a, sizeOfGap);
return gapLeft > 0 ? a.concat([i]) : a;
var remainingGap = removeSlideSizes(a, gap);
return remainingGap > 0 ? a.concat([i]) : a;
}, []);
}
function loopStart(sizeOfGap, indexes, from) {
return indexes.reduce(function (a, i) {
var gapFilled = a + slideSizes[i];
return gapFilled < sizeOfGap ? gapFilled : a;
}, from);
}
function findLoopPoints(indexes, edge) {
var isStartEdge = edge === 'start';
var offset = isStartEdge ? -contentSize : contentSize;
var slideBounds = slidesInView.findSlideBounds(offset);
return indexes.map(function (index) {
var initial = isStartEdge ? 0 : -contentSize;
var altered = isStartEdge ? contentSize : 0;
var bounds = slideBounds.filter(function (b) {
return b.index === index;
})[0];
var point = bounds[isStartEdge ? 'end' : 'start'];
function loopPointFor(indexes, from, direction) {
var slideCount = ascItems.length - 1;
return subtractItemSizes(indexes.map(function (i) {
return (i + direction) % slideCount;
}), from);
}
function loopPointsFor(indexes, from, direction) {
var ascIndexes = indexes.slice().sort(function (a, b) {
return a - b;
});
return ascIndexes.map(function (index, loopIndex) {
var initial = contentSize * (!direction ? 0 : -1);
var offset = contentSize * (!direction ? 1 : 0);
var slidesInSpan = ascIndexes.slice(0, loopIndex);
var point = loopPointFor(slidesInSpan, from, direction);
var getTarget = function getTarget(location) {
return location > point ? initial : offset;
var getTarget = function getTarget() {
return scrollLocation.get() > point ? initial : altered;
};

@@ -1081,5 +1069,4 @@

var gap = scrollSnaps[0] - 1;
var indexes = loopItemsIn(gap, descItems);
var start = loopStart(gap, indexes, 0);
return loopPointsFor(indexes, start, 1);
var indexes = slidesInGap(descItems, gap);
return findLoopPoints(indexes, 'end');
}

@@ -1089,5 +1076,4 @@

var gap = viewSize - scrollSnaps[0] - 1;
var indexes = loopItemsIn(gap, ascItems);
var start = loopStart(contentSize, ascItems, -viewSize);
return loopPointsFor(indexes, -start, 0);
var indexes = slidesInGap(ascItems, gap);
return findLoopPoints(indexes, 'start');
}

@@ -1101,3 +1087,3 @@

});
return subtractItemSizes(otherIndexes, viewSize) <= 0;
return removeSlideSizes(otherIndexes, viewSize) <= 0;
});

@@ -1111,3 +1097,3 @@ }

index = loopPoint.index;
var target = getTarget(containerLocation.get());
var target = getTarget();

@@ -1182,7 +1168,7 @@ if (target !== location) {

var threshold = Math.min(Math.max(inViewThreshold, 0.01), 0.99);
var thresholds = slideSizes.map(function (s) {
return s * threshold;
});
var scrollSnaps = arrayKeys(slideSizes).map(scrollSnap);
var pointsToCheck = concatSlidePoints();
var offsets = loop ? [0, contentSize, -contentSize] : [0];
var slideBounds = offsets.reduce(function (a, loopOffset) {
return a.concat(findSlideBounds(loopOffset, threshold));
}, []);

@@ -1196,10 +1182,6 @@ function scrollSnap(index) {

function concatSlidePoints() {
var offsets = loop ? [0, contentSize, -contentSize] : [0];
return offsets.map(slidePoints).reduce(function (a, b) {
return a.concat(b);
}, []);
}
function slidePoints(offset) {
function findSlideBounds(offset, threshold) {
var thresholds = slideSizes.map(function (s) {
return s * (threshold || 0);
});
return scrollSnaps.map(function (snap, index) {

@@ -1215,6 +1197,6 @@ return {

function check(location) {
return pointsToCheck.reduce(function (list, point) {
var index = point.index,
start = point.start,
end = point.end;
return slideBounds.reduce(function (list, slideBound) {
var index = slideBound.index,
start = slideBound.start,
end = slideBound.end;
var inList = list.indexOf(index) !== -1;

@@ -1227,3 +1209,4 @@ var inView = start < location && end > location;

var self = {
check: check
check: check,
findSlideBounds: findSlideBounds
};

@@ -1396,2 +1379,9 @@ return self;

target: target
});
var slidesInView = SlidesInView({
contentSize: contentSize,
inViewThreshold: inViewThreshold,
loop: loop,
slideSizes: slideSizes,
viewSize: viewSize
}); // DragHandler

@@ -1459,11 +1449,6 @@

slideSizes: slideSizes,
slidesInView: slidesInView,
viewSize: viewSize
}),
slidesInView: SlidesInView({
contentSize: contentSize,
inViewThreshold: inViewThreshold,
loop: loop,
slideSizes: slideSizes,
viewSize: viewSize
}),
slidesInView: slidesInView,
slideIndexes: slideIndexes,

@@ -1470,0 +1455,0 @@ target: target,

import { Axis } from './axis';
import { SlidesInView } from './slidesInView';
import { Vector1D } from './vector1d';

@@ -10,2 +11,3 @@ declare type Params = {

contentSize: number;
slidesInView: SlidesInView;
};

@@ -16,3 +18,3 @@ declare type LoopPoint = {

index: number;
getTarget: (location: number) => number;
getTarget: () => number;
};

@@ -19,0 +21,0 @@ export declare type SlideLooper = {

@@ -8,6 +8,12 @@ declare type Params = {

};
declare type SlideBound = {
start: number;
end: number;
index: number;
};
export declare type SlidesInView = {
check: (location: number) => number[];
findSlideBounds: (offset: number, threshold?: number) => SlideBound[];
};
export declare function SlidesInView(params: Params): SlidesInView;
export {};

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

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