Socket
Socket
Sign inDemoInstall

embla-carousel

Package Overview
Dependencies
0
Maintainers
1
Versions
219
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 8.0.0-rc17 to 8.0.0-rc18

18

cjs/components/Animations.d.ts
import { EngineType } from './Engine';
import { WindowType } from './utils';
export type AnimationUpdateType = (engine: EngineType) => void;
export type AnimationRenderType = (engine: EngineType, lagFactor: number) => void;
export type AnimationType = {
export type AnimationsUpdateType = (engine: EngineType) => void;
export type AnimationsRenderType = (engine: EngineType, lagOffset: number) => void;
export type AnimationsType = {
init: () => void;
destroy: () => void;
start: () => void;
stop: () => void;
update: () => void;
render: (lagFactor: number) => void;
render: (lagOffset: number) => void;
};
export type AnimationsType = {
start: (engine: EngineType) => void;
stop: (engine: EngineType) => void;
reset: () => void;
window: WindowType;
};
export declare function Animations(ownerWindow: WindowType): AnimationsType;
export declare function Animations(ownerDocument: Document, ownerWindow: WindowType, update: AnimationsType['update'], render: AnimationsType['render']): AnimationsType;
import { EmblaCarouselType } from './EmblaCarousel';
import { AnimationType } from './Animations';
import { AnimationsType } from './Animations';
import { CounterType } from './Counter';

@@ -21,3 +21,3 @@ import { DirectionType } from './Direction';

};
export declare function DragHandler(axis: AxisType, direction: DirectionType, rootNode: HTMLElement, ownerDocument: Document, ownerWindow: WindowType, target: Vector1DType, dragTracker: DragTrackerType, location: Vector1DType, animation: AnimationType, scrollTo: ScrollToType, scrollBody: ScrollBodyType, scrollTarget: ScrollTargetType, index: CounterType, eventHandler: EventHandlerType, percentOfView: PercentOfViewType, dragFree: boolean, dragThreshold: number, skipSnaps: boolean, baseFriction: number, watchDrag: DragHandlerOptionType): DragHandlerType;
export declare function DragHandler(axis: AxisType, direction: DirectionType, rootNode: HTMLElement, ownerDocument: Document, ownerWindow: WindowType, target: Vector1DType, dragTracker: DragTrackerType, location: Vector1DType, animation: AnimationsType, scrollTo: ScrollToType, scrollBody: ScrollBodyType, scrollTarget: ScrollTargetType, index: CounterType, eventHandler: EventHandlerType, percentOfView: PercentOfViewType, dragFree: boolean, dragThreshold: number, skipSnaps: boolean, baseFriction: number, watchDrag: DragHandlerOptionType): DragHandlerType;
export {};
import { EngineType } from './Engine';
import { AnimationsType } from './Animations';
import { EventHandlerType } from './EventHandler';

@@ -31,5 +30,4 @@ import { EmblaOptionsType, OptionsType } from './Options';

declare namespace EmblaCarousel {
var animationRealms: AnimationsType[];
var globalOptions: Partial<OptionsType> | undefined;
}
export default EmblaCarousel;

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

import { AnimationsType } from './Animations';
import { AxisType } from './Axis';

@@ -27,3 +28,2 @@ import { CounterType } from './Counter';

import { Vector1DType } from './Vector1d';
import { AnimationType, AnimationsType } from './Animations';
export type EngineType = {

@@ -35,3 +35,3 @@ ownerDocument: Document;

direction: DirectionType;
animation: AnimationType;
animation: AnimationsType;
scrollBounds: ScrollBoundsType;

@@ -67,2 +67,2 @@ scrollLooper: ScrollLooperType;

};
export declare function Engine(root: HTMLElement, container: HTMLElement, slides: HTMLElement[], ownerDocument: Document, ownerWindow: WindowType, options: OptionsType, eventHandler: EventHandlerType, animations: AnimationsType): EngineType;
export declare function Engine(root: HTMLElement, container: HTMLElement, slides: HTMLElement[], ownerDocument: Document, ownerWindow: WindowType, options: OptionsType, eventHandler: EventHandlerType): EngineType;

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

import { AnimationType } from './Animations';
import { AnimationsType } from './Animations';
import { CounterType } from './Counter';

@@ -10,2 +10,2 @@ import { EventHandlerType } from './EventHandler';

};
export declare function ScrollTo(animation: AnimationType, indexCurrent: CounterType, indexPrevious: CounterType, scrollTarget: ScrollTargetType, targetVector: Vector1DType, eventHandler: EventHandlerType): ScrollToType;
export declare function ScrollTo(animation: AnimationsType, indexCurrent: CounterType, indexPrevious: CounterType, scrollTarget: ScrollTargetType, targetVector: Vector1DType, eventHandler: EventHandlerType): ScrollToType;

@@ -88,2 +88,82 @@ 'use strict';

function EventStore() {
let listeners = [];
function add(node, type, handler, options = {
passive: true
}) {
let removeListener;
if ('addEventListener' in node) {
node.addEventListener(type, handler, options);
removeListener = () => node.removeEventListener(type, handler, options);
} else {
const legacyMediaQueryList = node;
legacyMediaQueryList.addListener(handler);
removeListener = () => legacyMediaQueryList.removeListener(handler);
}
listeners.push(removeListener);
return self;
}
function clear() {
listeners = listeners.filter(remove => remove());
}
const self = {
add,
clear
};
return self;
}
function Animations(ownerDocument, ownerWindow, update, render) {
const documentVisibleHandler = EventStore();
const timeStep = 1000 / 60;
let lastTimeStamp = null;
let lag = 0;
let animationFrame = 0;
function init() {
documentVisibleHandler.add(ownerDocument, 'visibilitychange', () => {
if (ownerDocument.hidden) reset();
});
}
function destroy() {
stop();
documentVisibleHandler.clear();
}
function animate(timeStamp) {
if (!lastTimeStamp) lastTimeStamp = timeStamp;
const elapsed = timeStamp - lastTimeStamp;
lastTimeStamp = timeStamp;
lag += elapsed;
while (lag >= timeStep) {
update();
lag -= timeStep;
}
const lagOffset = mathAbs(lag / timeStep);
render(lagOffset);
if (animationFrame) ownerWindow.requestAnimationFrame(animate);
}
function start() {
if (animationFrame) return;
animationFrame = ownerWindow.requestAnimationFrame(animate);
}
function stop() {
ownerWindow.cancelAnimationFrame(animationFrame);
lastTimeStamp = null;
lag = 0;
animationFrame = 0;
}
function reset() {
lastTimeStamp = null;
lag = 0;
}
const self = {
init,
destroy,
start,
stop,
update,
render
};
return self;
}
function Axis(axis, direction) {

@@ -193,29 +273,2 @@ const scroll = axis === 'y' ? 'y' : 'x';

function EventStore() {
let listeners = [];
function add(node, type, handler, options = {
passive: true
}) {
let removeListener;
if ('addEventListener' in node) {
node.addEventListener(type, handler, options);
removeListener = () => node.removeEventListener(type, handler, options);
} else {
const legacyMediaQueryList = node;
legacyMediaQueryList.addListener(handler);
removeListener = () => legacyMediaQueryList.removeListener(handler);
}
listeners.push(removeListener);
return self;
}
function clear() {
listeners = listeners.filter(remove => remove());
}
const self = {
add,
clear
};
return self;
}
function DragHandler(axis, direction, rootNode, ownerDocument, ownerWindow, target, dragTracker, location, animation, scrollTo, scrollBody, scrollTarget, index, eventHandler, percentOfView, dragFree, dragThreshold, skipSnaps, baseFriction, watchDrag) {

@@ -1144,3 +1197,3 @@ const {

function Engine(root, container, slides, ownerDocument, ownerWindow, options, eventHandler, animations) {
function Engine(root, container, slides, ownerDocument, ownerWindow, options, eventHandler) {
// Options

@@ -1240,8 +1293,3 @@ const {

};
const animation = {
start: () => animations.start(engine),
stop: () => animations.stop(engine),
update: () => update(engine),
render: lagOffset => render(engine, lagOffset)
};
const animation = Animations(ownerDocument, ownerWindow, () => update(engine), lagOffset => render(engine, lagOffset));
// Shared

@@ -1304,51 +1352,2 @@ const friction = 0.68;

function Animations(ownerWindow) {
const timeStep = 1000 / 60;
let engines = [];
let lastTimeStamp = null;
let lag = 0;
let animationFrame = 0;
function animate(timeStamp) {
if (!lastTimeStamp) lastTimeStamp = timeStamp;
const elapsed = timeStamp - lastTimeStamp;
lastTimeStamp = timeStamp;
lag += elapsed;
while (lag >= timeStep) {
engines.forEach(({
animation
}) => animation.update());
lag -= timeStep;
}
const lagOffset = mathAbs(lag / timeStep);
engines.forEach(({
animation
}) => animation.render(lagOffset));
if (animationFrame) ownerWindow.requestAnimationFrame(animate);
}
function start(engine) {
if (!engines.includes(engine)) engines.push(engine);
if (animationFrame) return;
animationFrame = ownerWindow.requestAnimationFrame(animate);
}
function stop(engine) {
engines = engines.filter(e => e !== engine);
if (engines.length) return;
ownerWindow.cancelAnimationFrame(animationFrame);
lastTimeStamp = null;
lag = 0;
animationFrame = 0;
}
function reset() {
lastTimeStamp = null;
lag = 0;
}
const self = {
start,
stop,
reset,
window: ownerWindow
};
return self;
}
function EventHandler() {

@@ -1453,8 +1452,4 @@ const listeners = {};

const mediaHandlers = EventStore();
const documentVisibleHandler = EventStore();
const eventHandler = EventHandler();
const {
animationRealms
} = EmblaCarousel;
const {
mergeOptions,

@@ -1488,4 +1483,4 @@ optionsAtMedia,

}
function createEngine(options, animations) {
const engine = Engine(root, container, slides, ownerDocument, ownerWindow, options, eventHandler, animations);
function createEngine(options) {
const engine = Engine(root, container, slides, ownerDocument, ownerWindow, options, eventHandler);
if (options.loop && !engine.slideLooper.canLoop()) {

@@ -1495,3 +1490,3 @@ const optionsWithoutLoop = Object.assign({}, options, {

});
return createEngine(optionsWithoutLoop, animations);
return createEngine(optionsWithoutLoop);
}

@@ -1502,5 +1497,2 @@ return engine;

if (destroyed) return;
const animationRealm = animationRealms.find(a => a.window === ownerWindow);
const animations = animationRealm || Animations(ownerWindow);
if (!animationRealm) animationRealms.push(animations);
optionsBase = mergeOptions(optionsBase, withOptions);

@@ -1510,3 +1502,3 @@ options = optionsAtMedia(optionsBase);

storeElements();
engine = createEngine(options, animations);
engine = createEngine(options);
optionsMediaQueries([optionsBase, ...pluginList.map(({

@@ -1517,2 +1509,3 @@ options

engine.translate.to(engine.location.get());
engine.animation.init();
engine.slidesInView.init();

@@ -1523,5 +1516,2 @@ engine.slideFocus.init();

engine.slidesHandler.init(self);
documentVisibleHandler.add(ownerDocument, 'visibilitychange', () => {
if (ownerDocument.hidden) animations.reset();
});
if (engine.options.loop) engine.slideLooper.loop();

@@ -1541,3 +1531,2 @@ if (container.offsetParent && slides.length) engine.dragHandler.init(self);

engine.dragHandler.destroy();
engine.animation.stop();
engine.eventStore.clear();

@@ -1549,5 +1538,5 @@ engine.translate.clear();

engine.slidesInView.destroy();
engine.animation.destroy();
pluginsHandler.destroy();
mediaHandlers.clear();
documentVisibleHandler.clear();
}

@@ -1642,3 +1631,2 @@ function destroy() {

}
EmblaCarousel.animationRealms = [];
EmblaCarousel.globalOptions = undefined;

@@ -1645,0 +1633,0 @@

{
"name": "embla-carousel",
"version": "8.0.0-rc17",
"author": "David Jerleke",
"description": "A lightweight carousel library with fluid motion and great swipe precision",
"repository": {
"type": "git",
"url": "git+https://github.com/davidjerleke/embla-carousel"
},
"bugs": {
"url": "https://github.com/davidjerleke/embla-carousel/issues"
},
"homepage": "https://www.embla-carousel.com",
"license": "MIT",
"keywords": [
"slider",
"carousel",
"slideshow",
"gallery",
"lightweight",
"touch",
"javascript",
"typescript",
"react",
"vue",
"svelte"
],
"main": "embla-carousel.umd.js",
"unpkg": "embla-carousel.umd.js",
"module": "embla-carousel.esm.js",
"sideEffects": false,
"files": [
"embla-carousel*",
"components/**/*",
"index.d.ts"
],
"devDependencies": {
"@types/jest": "^29.5.6",
"@typescript-eslint/eslint-plugin": "^6.9.0",
"@typescript-eslint/parser": "^6.9.0",
"eslint": "^8.52.0",
"eslint-config-prettier": "^9.0.0",
"eslint-plugin-prettier": "^4.0.0",
"jest": "^29.5.0",
"jest-environment-jsdom": "^29.5.0",
"prettier": "2.8.8",
"rollup": "^4.1.5",
"ts-jest": "^29.1.1",
"typescript": "^5.2.2"
},
"type": "commonjs"
}
"name": "embla-carousel",
"version": "8.0.0-rc18",
"author": "David Jerleke",
"description": "A lightweight carousel library with fluid motion and great swipe precision",
"repository": {
"type": "git",
"url": "git+https://github.com/davidjerleke/embla-carousel"
},
"bugs": {
"url": "https://github.com/davidjerleke/embla-carousel/issues"
},
"homepage": "https://www.embla-carousel.com",
"license": "MIT",
"keywords": [
"slider",
"carousel",
"slideshow",
"gallery",
"lightweight",
"touch",
"javascript",
"typescript",
"react",
"vue",
"svelte"
],
"main": "embla-carousel.umd.js",
"unpkg": "embla-carousel.umd.js",
"module": "embla-carousel.esm.js",
"sideEffects": false,
"files": [
"embla-carousel*",
"components/**/*",
"index.d.ts"
],
"devDependencies": {
"@types/jest": "^29.5.6",
"@typescript-eslint/eslint-plugin": "^6.9.0",
"@typescript-eslint/parser": "^6.9.0",
"eslint": "^8.52.0",
"eslint-config-prettier": "^9.0.0",
"eslint-plugin-prettier": "^4.0.0",
"jest": "^29.5.0",
"jest-environment-jsdom": "^29.5.0",
"prettier": "2.8.8",
"rollup": "^4.1.5",
"ts-jest": "^29.1.1",
"typescript": "^5.2.2"
},
"type": "commonjs"
}
import { EngineType } from './Engine';
import { WindowType } from './utils';
export type AnimationUpdateType = (engine: EngineType) => void;
export type AnimationRenderType = (engine: EngineType, lagFactor: number) => void;
export type AnimationType = {
export type AnimationsUpdateType = (engine: EngineType) => void;
export type AnimationsRenderType = (engine: EngineType, lagOffset: number) => void;
export type AnimationsType = {
init: () => void;
destroy: () => void;
start: () => void;
stop: () => void;
update: () => void;
render: (lagFactor: number) => void;
render: (lagOffset: number) => void;
};
export type AnimationsType = {
start: (engine: EngineType) => void;
stop: (engine: EngineType) => void;
reset: () => void;
window: WindowType;
};
export declare function Animations(ownerWindow: WindowType): AnimationsType;
export declare function Animations(ownerDocument: Document, ownerWindow: WindowType, update: AnimationsType['update'], render: AnimationsType['render']): AnimationsType;
import { EmblaCarouselType } from './EmblaCarousel';
import { AnimationType } from './Animations';
import { AnimationsType } from './Animations';
import { CounterType } from './Counter';

@@ -21,3 +21,3 @@ import { DirectionType } from './Direction';

};
export declare function DragHandler(axis: AxisType, direction: DirectionType, rootNode: HTMLElement, ownerDocument: Document, ownerWindow: WindowType, target: Vector1DType, dragTracker: DragTrackerType, location: Vector1DType, animation: AnimationType, scrollTo: ScrollToType, scrollBody: ScrollBodyType, scrollTarget: ScrollTargetType, index: CounterType, eventHandler: EventHandlerType, percentOfView: PercentOfViewType, dragFree: boolean, dragThreshold: number, skipSnaps: boolean, baseFriction: number, watchDrag: DragHandlerOptionType): DragHandlerType;
export declare function DragHandler(axis: AxisType, direction: DirectionType, rootNode: HTMLElement, ownerDocument: Document, ownerWindow: WindowType, target: Vector1DType, dragTracker: DragTrackerType, location: Vector1DType, animation: AnimationsType, scrollTo: ScrollToType, scrollBody: ScrollBodyType, scrollTarget: ScrollTargetType, index: CounterType, eventHandler: EventHandlerType, percentOfView: PercentOfViewType, dragFree: boolean, dragThreshold: number, skipSnaps: boolean, baseFriction: number, watchDrag: DragHandlerOptionType): DragHandlerType;
export {};
import { EngineType } from './Engine';
import { AnimationsType } from './Animations';
import { EventHandlerType } from './EventHandler';

@@ -31,5 +30,4 @@ import { EmblaOptionsType, OptionsType } from './Options';

declare namespace EmblaCarousel {
var animationRealms: AnimationsType[];
var globalOptions: Partial<OptionsType> | undefined;
}
export default EmblaCarousel;

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

import { AnimationsType } from './Animations';
import { AxisType } from './Axis';

@@ -27,3 +28,2 @@ import { CounterType } from './Counter';

import { Vector1DType } from './Vector1d';
import { AnimationType, AnimationsType } from './Animations';
export type EngineType = {

@@ -35,3 +35,3 @@ ownerDocument: Document;

direction: DirectionType;
animation: AnimationType;
animation: AnimationsType;
scrollBounds: ScrollBoundsType;

@@ -67,2 +67,2 @@ scrollLooper: ScrollLooperType;

};
export declare function Engine(root: HTMLElement, container: HTMLElement, slides: HTMLElement[], ownerDocument: Document, ownerWindow: WindowType, options: OptionsType, eventHandler: EventHandlerType, animations: AnimationsType): EngineType;
export declare function Engine(root: HTMLElement, container: HTMLElement, slides: HTMLElement[], ownerDocument: Document, ownerWindow: WindowType, options: OptionsType, eventHandler: EventHandlerType): EngineType;

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

import { AnimationType } from './Animations';
import { AnimationsType } from './Animations';
import { CounterType } from './Counter';

@@ -10,2 +10,2 @@ import { EventHandlerType } from './EventHandler';

};
export declare function ScrollTo(animation: AnimationType, indexCurrent: CounterType, indexPrevious: CounterType, scrollTarget: ScrollTargetType, targetVector: Vector1DType, eventHandler: EventHandlerType): ScrollToType;
export declare function ScrollTo(animation: AnimationsType, indexCurrent: CounterType, indexPrevious: CounterType, scrollTarget: ScrollTargetType, targetVector: Vector1DType, eventHandler: EventHandlerType): ScrollToType;

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

!function(n,t){"object"==typeof exports&&"undefined"!=typeof module?module.exports=t():"function"==typeof define&&define.amd?define(t):(n="undefined"!=typeof globalThis?globalThis:n||self).EmblaCarousel=t()}(this,(function(){"use strict";function n(n){return"number"==typeof n}function t(n){return"string"==typeof n}function e(n){return"boolean"==typeof n}function r(n){return"[object Object]"===Object.prototype.toString.call(n)}function o(n){return Math.abs(n)}function i(n){return Math.sign(n)}function c(n,t){return o(n-t)}function u(n){return f(n).map(Number)}function s(n){return n[a(n)]}function a(n){return Math.max(0,n.length-1)}function l(n,t){return t===a(n)}function d(n,t=0){return Array.from(Array(n),((n,e)=>t+e))}function f(n){return Object.keys(n)}function p(n,t){return[n,t].reduce(((n,t)=>(f(t).forEach((e=>{const o=n[e],i=t[e],c=r(o)&&r(i);n[e]=c?p(o,i):i})),n)),{})}function m(n,t){return void 0!==t.MouseEvent&&n instanceof t.MouseEvent}function g(n=0,t=0){const e=o(n-t);function r(t){return t<n}function i(n){return n>t}function c(n){return r(n)||i(n)}return{length:e,max:t,min:n,constrain:function(e){return c(e)?r(e)?n:t:e},reachedAny:c,reachedMax:i,reachedMin:r,removeOffset:function(n){return e?n-e*Math.ceil((n-t)/e):n}}}function h(n,t,e){const{constrain:r}=g(0,n),i=n+1;let c=u(t);function u(n){return e?o((i+n)%i):r(n)}function s(){return c}function a(){return h(n,s(),e)}const l={get:s,set:function(n){return c=u(n),l},add:function(n){return a().set(s()+n)},clone:a};return l}function x(){let n=[];const t={add:function(e,r,o,i={passive:!0}){let c;if("addEventListener"in e)e.addEventListener(r,o,i),c=()=>e.removeEventListener(r,o,i);else{const n=e;n.addListener(o),c=()=>n.removeListener(o)}return n.push(c),t},clear:function(){n=n.filter((n=>n()))}};return t}function y(n,t,r,u,s,a,l,d,f,p,h,y,v,b,w,S,E,L,D,I){const{cross:A}=n,M=["INPUT","SELECT","TEXTAREA"],T={passive:!1},O=x(),F=x(),P=g(50,225).constrain(w.measure(20)),z={mouse:300,touch:400},H={mouse:500,touch:600},k=S?43:25;let V=!1,R=0,B=0,N=!1,C=!1,j=!1,G=!1;function q(n){const e=l.readPoint(n),r=l.readPoint(n,A),o=c(e,R),i=c(r,B);if(!C&&!G){if(!n.cancelable)return U(n);if(C=o>i,!C)return U(n)}const u=l.pointerMove(n);o>E&&(j=!0),h.useFriction(.3).useDuration(1),f.start(),a.add(t.apply(u)),n.preventDefault()}function U(n){const e=y.byDistance(0,!1).index!==v.get(),r=l.pointerUp(n)*(S?H:z)[G?"mouse":"touch"],u=function(n,t){const e=v.add(-1*i(n)),r=y.byDistance(n,!S).distance;return S||o(n)<P?r:L&&t?.5*r:y.byIndex(e.get(),0).distance}(t.apply(r),e),s=function(n,t){if(0===n||0===t)return 0;if(o(n)<=o(t))return 0;const e=c(o(n),o(t));return o(e/n)}(r,u),a=k-10*s,d=D+s/50;C=!1,N=!1,F.clear(),h.useDuration(a).useFriction(d),p.distance(u,!S),G=!1,b.emit("pointerUp")}function W(n){j&&(n.stopPropagation(),n.preventDefault())}return{init:function(n){if(!I)return;function t(t){(e(I)||I(n,t))&&function(n){const t=m(n,s);if(G=t,t&&0!==n.button)return;if(function(n){const t=n.nodeName||"";return M.includes(t)}(n.target))return;j=S&&t&&!n.buttons&&V,V=c(a.get(),d.get())>=2,N=!0,l.pointerDown(n),h.useFriction(0).useDuration(0),a.set(d),function(){const n=G?u:r;F.add(n,"touchmove",q,T).add(n,"touchend",U).add(n,"mousemove",q,T).add(n,"mouseup",U)}(),R=l.readPoint(n),B=l.readPoint(n,A),b.emit("pointerDown")}(t)}const o=r;O.add(o,"dragstart",(n=>n.preventDefault()),T).add(o,"touchmove",(()=>{}),T).add(o,"touchend",(()=>{})).add(o,"touchstart",t).add(o,"mousedown",t).add(o,"touchcancel",U).add(o,"contextmenu",U).add(o,"click",W,!0)},pointerDown:function(){return N},destroy:function(){O.clear(),F.clear()}}}function v(n,t){let e,r;function i(n){return n.timeStamp}function c(e,r){const o="client"+("x"===(r||n.scroll)?"X":"Y");return(m(e,t)?e:e.touches[0])[o]}return{pointerDown:function(n){return e=n,r=n,c(n)},pointerMove:function(n){const t=c(n)-c(r),o=i(n)-i(e)>170;return r=n,o&&(e=n),t},pointerUp:function(n){if(!e||!r)return 0;const t=c(r)-c(e),u=i(n)-i(e),s=i(n)-i(r)>170,a=t/u;return u&&!s&&o(a)>.1?a:0},readPoint:c}}function b(n,t,r,i,c,u,s){let a,l,d=[],f=!1;function p(n){return c.measureSize(s.measure(n))}return{init:function(c){if(!u)return;l=p(n),d=i.map(p),a=new ResizeObserver((s=>{f||(e(u)||u(c,s))&&function(e){for(const u of e){const e=u.target===n,s=i.indexOf(u.target),a=e?l:d[s];if(o(p(e?n:i[s])-a)>=.5){r.requestAnimationFrame((()=>{c.reInit(),t.emit("resize")}));break}}}(s)})),[n].concat(i).forEach((n=>a.observe(n)))},destroy:function(){a&&a.disconnect(),f=!0}}}function w(n,t,e,r,i){const c=i.measure(10),u=i.measure(50),s=g(.1,.99);let a=!1;return{constrain:function(i){if(a||!n.reachedAny(e.get())||!n.reachedAny(t.get()))return;const l=n.reachedMin(t.get())?"min":"max",d=o(n[l]-t.get()),f=e.get()-t.get(),p=s.constrain(d/u);e.subtract(f*p),!i&&o(f)<c&&(e.set(n.constrain(e.get())),r.useDuration(25).useBaseFriction())},toggleActive:function(n){a=!n}}}function S(n,t,e,r){const o=t.min+.1,i=t.max+.1,{reachedMin:c,reachedMax:u}=g(o,i);return{loop:function(t){if(!function(n){return 1===n?u(e.get()):-1===n&&c(e.get())}(t))return;const o=n*(-1*t);r.forEach((n=>n.add(o)))}}}function E(n,t,e,r,c){const{reachedAny:u,removeOffset:a,constrain:l}=r;function d(n){return n.concat().sort(((n,t)=>o(n)-o(t)))[0]}function f(t,r){const o=[t,t+e,t-e];if(!n)return o[0];if(!r)return d(o);const c=o.filter((n=>i(n)===r));return c.length?d(c):s(o)-e}return{byDistance:function(e,r){const i=c.get()+e,{index:s,distance:d}=function(e){const r=n?a(e):l(e),i=t.map((n=>n-r)).map((n=>f(n,0))).map(((n,t)=>({diff:n,index:t}))).sort(((n,t)=>o(n.diff)-o(t.diff))),{index:c}=i[0];return{index:c,distance:r}}(i),p=!n&&u(i);return!r||p?{index:s,distance:e}:{index:s,distance:e+f(t[s]-d,0)}},byIndex:function(n,e){return{index:n,distance:f(t[n]-c.get(),e)}},shortcut:f}}function L(t){let e=t;function r(t){return n(t)?t:t.get()}return{get:function(){return e},set:function(n){e=r(n)},add:function(n){e+=r(n)},subtract:function(n){e-=r(n)}}}function D(n,t,e){const r="x"===n.scroll?function(n){return`translate3d(${n}px,0px,0px)`}:function(n){return`translate3d(0px,${n}px,0px)`},o=e.style;let i=!1;return{clear:function(){i||(o.transform="",e.getAttribute("style")||e.removeAttribute("style"))},to:function(n){i||(o.transform=r(t.apply(n)))},toggleActive:function(n){i=!n}}}function I(n,t,e,r,o,i,c,s,a,l){const d=.5,f=u(i),p=u(i).reverse(),m=function(){const n=s[0];return x(h(p,n),r,!1)}().concat(function(){const n=e-s[0]-1;return x(h(f,n),-r,!0)}());function g(n,t){return n.reduce(((n,t)=>n-i[t]),t)}function h(n,t){return n.reduce(((n,e)=>g(n,t)>0?n.concat([e]):n),[])}function x(i,u,s){const f=function(n){return c.map(((t,r)=>({start:t-o[r]+d+n,end:t+e-d+n})))}(u);return i.map((e=>{const o=s?0:-r,i=s?r:0,c=s?"end":"start",u=f[e][c];return{index:e,loopPoint:u,slideLocation:L(-1),translate:D(n,t,l[e]),target:()=>a.get()>u?o:i}}))}return{canLoop:function(){return m.every((({index:n})=>g(f.filter((t=>t!==n)),e)<=.1))},clear:function(){m.forEach((n=>n.translate.clear()))},loop:function(){m.forEach((n=>{const{target:t,translate:e,slideLocation:r}=n,o=t();o!==r.get()&&(e.to(o),r.set(o))}))},loopPoints:m}}function A(n,t,r){let o,i=!1;return{init:function(c){r&&(o=new MutationObserver((n=>{i||(e(r)||r(c,n))&&function(n){for(const e of n)if("childList"===e.type){c.reInit(),t.emit("slidesChanged");break}}(n)})),o.observe(n,{childList:!0}))},destroy:function(){o&&o.disconnect(),i=!0}}}function M(n,t,e,r){const o={};let i,c=null,u=null,s=!1;return{init:function(){i=new IntersectionObserver((n=>{s||(n.forEach((n=>{const e=t.indexOf(n.target);o[e]=n})),c=null,u=null,e.emit("slidesInView"))}),{root:n.parentElement,threshold:r}),t.forEach((n=>i.observe(n)))},destroy:function(){i&&i.disconnect(),s=!0},get:function(n=!0){if(n&&c)return c;if(!n&&u)return u;const t=function(n){return f(o).reduce(((t,e)=>{const r=parseInt(e),{isIntersecting:i}=o[r];return(n&&i||!n&&!i)&&t.push(r),t}),[])}(n);return n&&(c=t),n||(u=t),t}}}function T(t,e,r,i,c,l,d,f,p,m){const{startEdge:g,endEdge:h}=t,x=n(i);return{groupSlides:function(n){return x?function(n,t){return u(n).filter((n=>n%t==0)).map((e=>n.slice(e,e+t)))}(n,i):function(n){return n.length?u(n).reduce(((t,i)=>{const u=s(t)||0,x=0===u,y=i===a(n),v=l[g]-d[u][g],b=l[g]-d[i][h],w=!c&&x?e.apply(f):0;return o(b-(!c&&y?e.apply(p):0)-(v+w))>r+m&&t.push(i),y&&t.push(n.length),t}),[]).map(((t,e,r)=>{const o=Math.max(r[e-1]||0);return n.slice(o,t)})):[]}(n)}}}function O(e,r,c,f,p,m,O,F){const{align:P,axis:z,direction:H,startIndex:k,loop:V,duration:R,dragFree:B,dragThreshold:N,inViewThreshold:C,slidesToScroll:j,skipSnaps:G,containScroll:q,watchResize:U,watchSlides:W,watchDrag:$}=m,Q={measure:function(n){const{offsetTop:t,offsetLeft:e,offsetWidth:r,offsetHeight:o}=n;return{top:t,right:e+r,bottom:t+o,left:e,width:r,height:o}}},X=Q.measure(r),Y=c.map(Q.measure),J=function(n){const t="rtl"===n?-1:1;return{apply:function(n){return n*t}}}(H),K=function(n,t){const e="y"===n?"y":"x";return{scroll:e,cross:"y"===n?"x":"y",startEdge:"y"===e?"top":"rtl"===t?"right":"left",endEdge:"y"===e?"bottom":"rtl"===t?"left":"right",measureSize:function(n){const{width:t,height:r}=n;return"x"===e?t:r}}}(z,H),Z=K.measureSize(X),_=function(n){return{measure:function(t){return n*(t/100)}}}(Z),nn=function(n,e){const r={start:function(){return 0},center:function(n){return o(n)/2},end:o};function o(n){return e-n}return{measure:function(o,i){return t(n)?r[n](o):n(e,o,i)}}}(P,Z),tn=!V&&!!q,en=V||!!q,{slideSizes:rn,slideSizesWithGaps:on,startGap:cn,endGap:un}=function(n,t,e,r,i,c){const{measureSize:u,startEdge:a,endEdge:d}=n,f=e[0]&&i,p=function(){if(!f)return 0;const n=e[0];return o(t[a]-n[a])}(),m=function(){if(!f)return 0;const n=c.getComputedStyle(s(r));return parseFloat(n.getPropertyValue(`margin-${d}`))}(),g=e.map(u),h=e.map(((n,t,e)=>{const r=!t,o=l(e,t);return r?g[t]+p:o?g[t]+m:e[t+1][a]-n[a]})).map(o);return{slideSizes:g,slideSizesWithGaps:h,startGap:p,endGap:m}}(K,X,Y,c,en,p),sn=T(K,J,Z,j,V,X,Y,cn,un,2),{snaps:an,snapsAligned:ln}=function(n,t,e,r,i){const{startEdge:c,endEdge:u}=n,{groupSlides:a}=i,l=a(r).map((n=>s(n)[u]-n[0][c])).map(o).map(t.measure),d=r.map((n=>e[c]-n[c])).map((n=>-o(n))),f=a(d).map((n=>n[0])).map(((n,t)=>n+l[t]));return{snaps:d,snapsAligned:f}}(K,nn,X,Y,sn),dn=-s(an)+s(on),{snapsContained:fn,scrollContainLimit:pn}=function(n,t,e,r,o){const i=g(-t+n,0),c=e.map(((n,t)=>{const r=!t,o=l(e,t);return r?i.max:o?i.min:i.constrain(n)})).map((n=>parseFloat(n.toFixed(3)))),u=function(){const n=c[0],t=s(c);return g(c.lastIndexOf(n),c.indexOf(t)+1)}();return{snapsContained:function(){if(t<=n+o)return[i.max];if("keepSnaps"===r)return c;const{min:e,max:s}=u;return c.slice(e,s)}(),scrollContainLimit:u}}(Z,dn,ln,q,2),mn=tn?fn:ln,{limit:gn}=function(n,t,e){const r=t[0];return{limit:g(e?r-n:s(t),r)}}(dn,mn,V),hn=h(a(mn),k,V),xn=hn.clone(),yn=u(c),vn={start:()=>F.start(Pn),stop:()=>F.stop(Pn),update:()=>(({dragHandler:n,scrollBody:t,scrollBounds:e,options:{loop:r}})=>{r||e.constrain(n.pointerDown()),t.seek()})(Pn),render:n=>(({scrollBody:n,translate:t,location:e,offsetLocation:r,scrollLooper:o,slideLooper:i,dragHandler:c,animation:u,eventHandler:s,options:{loop:a}},l)=>{const d=n.velocity(),f=n.settled();f&&!c.pointerDown()&&(u.stop(),s.emit("settle")),f||s.emit("scroll"),r.set(e.get()-d+d*l),a&&(o.loop(n.direction()),i.loop()),t.to(r.get())})(Pn,n)},bn=mn[hn.get()],wn=L(bn),Sn=L(bn),En=L(bn),Ln=function(n,t,e,r,c){let u=0,s=0,a=r,l=c,d=n.get(),f=0;function p(n){return a=n,g}function m(n){return l=n,g}const g={direction:function(){return s},duration:function(){return a},velocity:function(){return u},seek:function(){const t=e.get()-n.get();let r=0;return a?(u+=t/a,u*=l,d+=u,n.add(u),r=d-f):(u=0,n.set(e),r=t),s=i(r),f=d,g},settled:function(){return o(e.get()-t.get())<.001},useBaseFriction:function(){return m(c)},useBaseDuration:function(){return p(r)},useFriction:m,useDuration:p};return g}(wn,Sn,En,R,.68),Dn=E(V,mn,dn,gn,En),In=function(n,t,e,r,o,i){function c(r){const c=r.distance,u=r.index!==t.get();o.add(c),c&&n.start(),u&&(e.set(t.get()),t.set(r.index),i.emit("select"))}return{distance:function(n,t){c(r.byDistance(n,t))},index:function(n,e){const o=t.clone().set(n);c(r.byIndex(o.get(),e))}}}(vn,hn,xn,Dn,En,O),An=function(n){const{max:t,length:e}=n;return{get:function(n){return e?(n-t)/-e:0}}}(gn),Mn=x(),Tn=M(r,c,O,C),{slideRegistry:On}=function(n,t,e,r,o,i){const{groupSlides:c}=o,{min:u,max:f}=r;return{slideRegistry:function(){const r=c(i),o=!n||"keepSnaps"===t;return 1===e.length?[i]:o?r:r.slice(u,f).map(((n,t,e)=>{const r=!t,o=l(e,t);return r?d(s(e[0])+1):o?d(a(i)-s(e)[0]+1,s(e)[0]):n}))}()}}(tn,q,mn,pn,sn,yn),Fn=function(t,e,r,o,i,c){let u=0;function s(n){"Tab"===n.code&&(u=(new Date).getTime())}function a(s){c.add(s,"focus",(()=>{if((new Date).getTime()-u>10)return;t.scrollLeft=0;const c=e.indexOf(s),a=r.findIndex((n=>n.includes(c)));n(a)&&(i.useDuration(0),o.index(a,0))}),{passive:!0,capture:!0})}return{init:function(){c.add(document,"keydown",s,!1),e.forEach(a)}}}(e,c,On,In,Ln,Mn),Pn={ownerDocument:f,ownerWindow:p,eventHandler:O,containerRect:X,slideRects:Y,animation:vn,axis:K,direction:J,dragHandler:y(K,J,e,f,p,En,v(K,p),wn,vn,In,Ln,Dn,hn,O,_,B,N,G,.68,$),eventStore:Mn,percentOfView:_,index:hn,indexPrevious:xn,limit:gn,location:wn,offsetLocation:Sn,options:m,resizeHandler:b(r,O,p,c,K,U,Q),scrollBody:Ln,scrollBounds:w(gn,wn,En,Ln,_),scrollLooper:S(dn,gn,Sn,[wn,Sn,En]),scrollProgress:An,scrollSnapList:mn.map(An.get),scrollSnaps:mn,scrollTarget:Dn,scrollTo:In,slideLooper:I(K,J,Z,dn,rn,on,an,mn,Sn,c),slideFocus:Fn,slidesHandler:A(r,O,W),slidesInView:Tn,slideIndexes:yn,slideRegistry:On,slidesToScroll:sn,target:En,translate:D(K,J,r)};return Pn}const F={align:"center",axis:"x",container:null,slides:null,containScroll:"trimSnaps",direction:"ltr",slidesToScroll:1,inViewThreshold:0,breakpoints:{},dragFree:!1,dragThreshold:10,loop:!1,skipSnaps:!1,duration:25,startIndex:0,active:!0,watchDrag:!0,watchResize:!0,watchSlides:!0};function P(n){function t(n,t){return p(n,t||{})}const e={mergeOptions:t,optionsAtMedia:function(e){const r=e.breakpoints||{},o=f(r).filter((t=>n.matchMedia(t).matches)).map((n=>r[n])).reduce(((n,e)=>t(n,e)),{});return t(e,o)},optionsMediaQueries:function(t){return t.map((n=>f(n.breakpoints||{}))).reduce(((n,t)=>n.concat(t)),[]).map(n.matchMedia)}};return e}function z(n,e,r){const i=n.ownerDocument,c=i.defaultView,u=P(c),s=function(n){let t=[];return{init:function(e,r){return t=r.filter((({options:t})=>!1!==n.optionsAtMedia(t).active)),t.forEach((t=>t.init(e,n))),r.reduce(((n,t)=>Object.assign(n,{[t.name]:t})),{})},destroy:function(){t=t.filter((n=>n.destroy()))}}}(u),a=x(),l=x(),d=function(){const n={};let t;function e(t){return n[t]||[]}const r={init:function(n){t=n},emit:function(n){return e(n).forEach((e=>e(t,n))),r},off:function(t,o){return n[t]=e(t).filter((n=>n!==o)),r},on:function(t,o){return n[t]=e(t).concat([o]),r}};return r}(),{animationRealms:f}=z,{mergeOptions:p,optionsAtMedia:m,optionsMediaQueries:g}=u,{on:h,off:y,emit:v}=d,b=k;let w,S,E,L,D=!1,I=p(F,z.globalOptions),A=p(I),M=[];function T(t,e){const r=O(n,E,L,i,c,t,d,e);if(t.loop&&!r.slideLooper.canLoop()){return T(Object.assign({},t,{loop:!1}),e)}return r}function H(e,r){if(D)return;const u=f.find((n=>n.window===c)),d=u||function(n){const t=1e3/60;let e=[],r=null,i=0,c=0;function u(s){r||(r=s);const a=s-r;for(r=s,i+=a;i>=t;)e.forEach((({animation:n})=>n.update())),i-=t;const l=o(i/t);e.forEach((({animation:n})=>n.render(l))),c&&n.requestAnimationFrame(u)}return{start:function(t){e.includes(t)||e.push(t),c||(c=n.requestAnimationFrame(u))},stop:function(t){e=e.filter((n=>n!==t)),e.length||(n.cancelAnimationFrame(c),r=null,i=0,c=0)},reset:function(){r=null,i=0},window:n}}(c);u||f.push(d),I=p(I,e),A=m(I),M=r||M,function(){const{container:e,slides:r}=A,o=t(e)?n.querySelector(e):e;E=o||n.children[0];const i=t(r)?E.querySelectorAll(r):r;L=[].slice.call(i||E.children)}(),w=T(A,d),g([I,...M.map((({options:n})=>n))]).forEach((n=>a.add(n,"change",k))),A.active&&(w.translate.to(w.location.get()),w.slidesInView.init(),w.slideFocus.init(),w.eventHandler.init(N),w.resizeHandler.init(N),w.slidesHandler.init(N),l.add(i,"visibilitychange",(()=>{i.hidden&&d.reset()})),w.options.loop&&w.slideLooper.loop(),E.offsetParent&&L.length&&w.dragHandler.init(N),S=s.init(N,M))}function k(n,t){const e=B();V(),H(p({startIndex:e},n),t),d.emit("reInit")}function V(){w.dragHandler.destroy(),w.animation.stop(),w.eventStore.clear(),w.translate.clear(),w.slideLooper.clear(),w.resizeHandler.destroy(),w.slidesHandler.destroy(),w.slidesInView.destroy(),s.destroy(),a.clear(),l.clear()}function R(n,t,e){A.active&&!D&&(w.scrollBody.useBaseFriction().useDuration(!0===t?0:A.duration),w.scrollTo.index(n,e||0))}function B(){return w.index.get()}const N={canScrollNext:function(){return w.index.add(1).get()!==B()},canScrollPrev:function(){return w.index.add(-1).get()!==B()},containerNode:function(){return E},internalEngine:function(){return w},destroy:function(){D||(D=!0,a.clear(),V(),d.emit("destroy"))},off:y,on:h,emit:v,plugins:function(){return S},previousScrollSnap:function(){return w.indexPrevious.get()},reInit:b,rootNode:function(){return n},scrollNext:function(n){R(w.index.add(1).get(),n,-1)},scrollPrev:function(n){R(w.index.add(-1).get(),n,1)},scrollProgress:function(){return w.scrollProgress.get(w.location.get())},scrollSnapList:function(){return w.scrollSnapList},scrollTo:R,selectedScrollSnap:B,slideNodes:function(){return L},slidesInView:function(){return w.slidesInView.get()},slidesNotInView:function(){return w.slidesInView.get(!1)}};return H(e,r),setTimeout((()=>d.emit("init")),0),N}return z.animationRealms=[],z.globalOptions=void 0,z}));
!function(n,t){"object"==typeof exports&&"undefined"!=typeof module?module.exports=t():"function"==typeof define&&define.amd?define(t):(n="undefined"!=typeof globalThis?globalThis:n||self).EmblaCarousel=t()}(this,(function(){"use strict";function n(n){return"number"==typeof n}function t(n){return"string"==typeof n}function e(n){return"boolean"==typeof n}function r(n){return"[object Object]"===Object.prototype.toString.call(n)}function o(n){return Math.abs(n)}function i(n){return Math.sign(n)}function c(n,t){return o(n-t)}function u(n){return f(n).map(Number)}function s(n){return n[a(n)]}function a(n){return Math.max(0,n.length-1)}function l(n,t){return t===a(n)}function d(n,t=0){return Array.from(Array(n),((n,e)=>t+e))}function f(n){return Object.keys(n)}function p(n,t){return[n,t].reduce(((n,t)=>(f(t).forEach((e=>{const o=n[e],i=t[e],c=r(o)&&r(i);n[e]=c?p(o,i):i})),n)),{})}function m(n,t){return void 0!==t.MouseEvent&&n instanceof t.MouseEvent}function g(){let n=[];const t={add:function(e,r,o,i={passive:!0}){let c;if("addEventListener"in e)e.addEventListener(r,o,i),c=()=>e.removeEventListener(r,o,i);else{const n=e;n.addListener(o),c=()=>n.removeListener(o)}return n.push(c),t},clear:function(){n=n.filter((n=>n()))}};return t}function h(n,t,e,r){const i=g(),c=1e3/60;let u=null,s=0,a=0;function l(n){u||(u=n);const i=n-u;for(u=n,s+=i;s>=c;)e(),s-=c;const d=o(s/c);r(d),a&&t.requestAnimationFrame(l)}function d(){t.cancelAnimationFrame(a),u=null,s=0,a=0}return{init:function(){i.add(n,"visibilitychange",(()=>{n.hidden&&(u=null,s=0)}))},destroy:function(){d(),i.clear()},start:function(){a||(a=t.requestAnimationFrame(l))},stop:d,update:e,render:r}}function x(n=0,t=0){const e=o(n-t);function r(t){return t<n}function i(n){return n>t}function c(n){return r(n)||i(n)}return{length:e,max:t,min:n,constrain:function(e){return c(e)?r(e)?n:t:e},reachedAny:c,reachedMax:i,reachedMin:r,removeOffset:function(n){return e?n-e*Math.ceil((n-t)/e):n}}}function y(n,t,e){const{constrain:r}=x(0,n),i=n+1;let c=u(t);function u(n){return e?o((i+n)%i):r(n)}function s(){return c}function a(){return y(n,s(),e)}const l={get:s,set:function(n){return c=u(n),l},add:function(n){return a().set(s()+n)},clone:a};return l}function v(n,t,r,u,s,a,l,d,f,p,h,y,v,b,S,w,E,L,D,I){const{cross:A}=n,M=["INPUT","SELECT","TEXTAREA"],T={passive:!1},O=g(),F=g(),P=x(50,225).constrain(S.measure(20)),z={mouse:300,touch:400},H={mouse:500,touch:600},k=w?43:25;let V=!1,B=0,N=0,R=!1,C=!1,j=!1,G=!1;function q(n){const e=l.readPoint(n),r=l.readPoint(n,A),o=c(e,B),i=c(r,N);if(!C&&!G){if(!n.cancelable)return U(n);if(C=o>i,!C)return U(n)}const u=l.pointerMove(n);o>E&&(j=!0),h.useFriction(.3).useDuration(1),f.start(),a.add(t.apply(u)),n.preventDefault()}function U(n){const e=y.byDistance(0,!1).index!==v.get(),r=l.pointerUp(n)*(w?H:z)[G?"mouse":"touch"],u=function(n,t){const e=v.add(-1*i(n)),r=y.byDistance(n,!w).distance;return w||o(n)<P?r:L&&t?.5*r:y.byIndex(e.get(),0).distance}(t.apply(r),e),s=function(n,t){if(0===n||0===t)return 0;if(o(n)<=o(t))return 0;const e=c(o(n),o(t));return o(e/n)}(r,u),a=k-10*s,d=D+s/50;C=!1,R=!1,F.clear(),h.useDuration(a).useFriction(d),p.distance(u,!w),G=!1,b.emit("pointerUp")}function W(n){j&&(n.stopPropagation(),n.preventDefault())}return{init:function(n){if(!I)return;function t(t){(e(I)||I(n,t))&&function(n){const t=m(n,s);if(G=t,t&&0!==n.button)return;if(function(n){const t=n.nodeName||"";return M.includes(t)}(n.target))return;j=w&&t&&!n.buttons&&V,V=c(a.get(),d.get())>=2,R=!0,l.pointerDown(n),h.useFriction(0).useDuration(0),a.set(d),function(){const n=G?u:r;F.add(n,"touchmove",q,T).add(n,"touchend",U).add(n,"mousemove",q,T).add(n,"mouseup",U)}(),B=l.readPoint(n),N=l.readPoint(n,A),b.emit("pointerDown")}(t)}const o=r;O.add(o,"dragstart",(n=>n.preventDefault()),T).add(o,"touchmove",(()=>{}),T).add(o,"touchend",(()=>{})).add(o,"touchstart",t).add(o,"mousedown",t).add(o,"touchcancel",U).add(o,"contextmenu",U).add(o,"click",W,!0)},pointerDown:function(){return R},destroy:function(){O.clear(),F.clear()}}}function b(n,t){let e,r;function i(n){return n.timeStamp}function c(e,r){const o="client"+("x"===(r||n.scroll)?"X":"Y");return(m(e,t)?e:e.touches[0])[o]}return{pointerDown:function(n){return e=n,r=n,c(n)},pointerMove:function(n){const t=c(n)-c(r),o=i(n)-i(e)>170;return r=n,o&&(e=n),t},pointerUp:function(n){if(!e||!r)return 0;const t=c(r)-c(e),u=i(n)-i(e),s=i(n)-i(r)>170,a=t/u;return u&&!s&&o(a)>.1?a:0},readPoint:c}}function S(n,t,r,i,c,u,s){let a,l,d=[],f=!1;function p(n){return c.measureSize(s.measure(n))}return{init:function(c){if(!u)return;l=p(n),d=i.map(p),a=new ResizeObserver((s=>{f||(e(u)||u(c,s))&&function(e){for(const u of e){const e=u.target===n,s=i.indexOf(u.target),a=e?l:d[s];if(o(p(e?n:i[s])-a)>=.5){r.requestAnimationFrame((()=>{c.reInit(),t.emit("resize")}));break}}}(s)})),[n].concat(i).forEach((n=>a.observe(n)))},destroy:function(){a&&a.disconnect(),f=!0}}}function w(n,t,e,r,i){const c=i.measure(10),u=i.measure(50),s=x(.1,.99);let a=!1;return{constrain:function(i){if(a||!n.reachedAny(e.get())||!n.reachedAny(t.get()))return;const l=n.reachedMin(t.get())?"min":"max",d=o(n[l]-t.get()),f=e.get()-t.get(),p=s.constrain(d/u);e.subtract(f*p),!i&&o(f)<c&&(e.set(n.constrain(e.get())),r.useDuration(25).useBaseFriction())},toggleActive:function(n){a=!n}}}function E(n,t,e,r){const o=t.min+.1,i=t.max+.1,{reachedMin:c,reachedMax:u}=x(o,i);return{loop:function(t){if(!function(n){return 1===n?u(e.get()):-1===n&&c(e.get())}(t))return;const o=n*(-1*t);r.forEach((n=>n.add(o)))}}}function L(n,t,e,r,c){const{reachedAny:u,removeOffset:a,constrain:l}=r;function d(n){return n.concat().sort(((n,t)=>o(n)-o(t)))[0]}function f(t,r){const o=[t,t+e,t-e];if(!n)return o[0];if(!r)return d(o);const c=o.filter((n=>i(n)===r));return c.length?d(c):s(o)-e}return{byDistance:function(e,r){const i=c.get()+e,{index:s,distance:d}=function(e){const r=n?a(e):l(e),i=t.map((n=>n-r)).map((n=>f(n,0))).map(((n,t)=>({diff:n,index:t}))).sort(((n,t)=>o(n.diff)-o(t.diff))),{index:c}=i[0];return{index:c,distance:r}}(i),p=!n&&u(i);return!r||p?{index:s,distance:e}:{index:s,distance:e+f(t[s]-d,0)}},byIndex:function(n,e){return{index:n,distance:f(t[n]-c.get(),e)}},shortcut:f}}function D(t){let e=t;function r(t){return n(t)?t:t.get()}return{get:function(){return e},set:function(n){e=r(n)},add:function(n){e+=r(n)},subtract:function(n){e-=r(n)}}}function I(n,t,e){const r="x"===n.scroll?function(n){return`translate3d(${n}px,0px,0px)`}:function(n){return`translate3d(0px,${n}px,0px)`},o=e.style;let i=!1;return{clear:function(){i||(o.transform="",e.getAttribute("style")||e.removeAttribute("style"))},to:function(n){i||(o.transform=r(t.apply(n)))},toggleActive:function(n){i=!n}}}function A(n,t,e,r,o,i,c,s,a,l){const d=.5,f=u(i),p=u(i).reverse(),m=function(){const n=s[0];return x(h(p,n),r,!1)}().concat(function(){const n=e-s[0]-1;return x(h(f,n),-r,!0)}());function g(n,t){return n.reduce(((n,t)=>n-i[t]),t)}function h(n,t){return n.reduce(((n,e)=>g(n,t)>0?n.concat([e]):n),[])}function x(i,u,s){const f=function(n){return c.map(((t,r)=>({start:t-o[r]+d+n,end:t+e-d+n})))}(u);return i.map((e=>{const o=s?0:-r,i=s?r:0,c=s?"end":"start",u=f[e][c];return{index:e,loopPoint:u,slideLocation:D(-1),translate:I(n,t,l[e]),target:()=>a.get()>u?o:i}}))}return{canLoop:function(){return m.every((({index:n})=>g(f.filter((t=>t!==n)),e)<=.1))},clear:function(){m.forEach((n=>n.translate.clear()))},loop:function(){m.forEach((n=>{const{target:t,translate:e,slideLocation:r}=n,o=t();o!==r.get()&&(e.to(o),r.set(o))}))},loopPoints:m}}function M(n,t,r){let o,i=!1;return{init:function(c){r&&(o=new MutationObserver((n=>{i||(e(r)||r(c,n))&&function(n){for(const e of n)if("childList"===e.type){c.reInit(),t.emit("slidesChanged");break}}(n)})),o.observe(n,{childList:!0}))},destroy:function(){o&&o.disconnect(),i=!0}}}function T(n,t,e,r){const o={};let i,c=null,u=null,s=!1;return{init:function(){i=new IntersectionObserver((n=>{s||(n.forEach((n=>{const e=t.indexOf(n.target);o[e]=n})),c=null,u=null,e.emit("slidesInView"))}),{root:n.parentElement,threshold:r}),t.forEach((n=>i.observe(n)))},destroy:function(){i&&i.disconnect(),s=!0},get:function(n=!0){if(n&&c)return c;if(!n&&u)return u;const t=function(n){return f(o).reduce(((t,e)=>{const r=parseInt(e),{isIntersecting:i}=o[r];return(n&&i||!n&&!i)&&t.push(r),t}),[])}(n);return n&&(c=t),n||(u=t),t}}}function O(t,e,r,i,c,l,d,f,p,m){const{startEdge:g,endEdge:h}=t,x=n(i);return{groupSlides:function(n){return x?function(n,t){return u(n).filter((n=>n%t==0)).map((e=>n.slice(e,e+t)))}(n,i):function(n){return n.length?u(n).reduce(((t,i)=>{const u=s(t)||0,x=0===u,y=i===a(n),v=l[g]-d[u][g],b=l[g]-d[i][h],S=!c&&x?e.apply(f):0;return o(b-(!c&&y?e.apply(p):0)-(v+S))>r+m&&t.push(i),y&&t.push(n.length),t}),[]).map(((t,e,r)=>{const o=Math.max(r[e-1]||0);return n.slice(o,t)})):[]}(n)}}}function F(e,r,c,f,p,m,F){const{align:P,axis:z,direction:H,startIndex:k,loop:V,duration:B,dragFree:N,dragThreshold:R,inViewThreshold:C,slidesToScroll:j,skipSnaps:G,containScroll:q,watchResize:U,watchSlides:W,watchDrag:$}=m,Q={measure:function(n){const{offsetTop:t,offsetLeft:e,offsetWidth:r,offsetHeight:o}=n;return{top:t,right:e+r,bottom:t+o,left:e,width:r,height:o}}},X=Q.measure(r),Y=c.map(Q.measure),J=function(n){const t="rtl"===n?-1:1;return{apply:function(n){return n*t}}}(H),K=function(n,t){const e="y"===n?"y":"x";return{scroll:e,cross:"y"===n?"x":"y",startEdge:"y"===e?"top":"rtl"===t?"right":"left",endEdge:"y"===e?"bottom":"rtl"===t?"left":"right",measureSize:function(n){const{width:t,height:r}=n;return"x"===e?t:r}}}(z,H),Z=K.measureSize(X),_=function(n){return{measure:function(t){return n*(t/100)}}}(Z),nn=function(n,e){const r={start:function(){return 0},center:function(n){return o(n)/2},end:o};function o(n){return e-n}return{measure:function(o,i){return t(n)?r[n](o):n(e,o,i)}}}(P,Z),tn=!V&&!!q,en=V||!!q,{slideSizes:rn,slideSizesWithGaps:on,startGap:cn,endGap:un}=function(n,t,e,r,i,c){const{measureSize:u,startEdge:a,endEdge:d}=n,f=e[0]&&i,p=function(){if(!f)return 0;const n=e[0];return o(t[a]-n[a])}(),m=function(){if(!f)return 0;const n=c.getComputedStyle(s(r));return parseFloat(n.getPropertyValue(`margin-${d}`))}(),g=e.map(u),h=e.map(((n,t,e)=>{const r=!t,o=l(e,t);return r?g[t]+p:o?g[t]+m:e[t+1][a]-n[a]})).map(o);return{slideSizes:g,slideSizesWithGaps:h,startGap:p,endGap:m}}(K,X,Y,c,en,p),sn=O(K,J,Z,j,V,X,Y,cn,un,2),{snaps:an,snapsAligned:ln}=function(n,t,e,r,i){const{startEdge:c,endEdge:u}=n,{groupSlides:a}=i,l=a(r).map((n=>s(n)[u]-n[0][c])).map(o).map(t.measure),d=r.map((n=>e[c]-n[c])).map((n=>-o(n))),f=a(d).map((n=>n[0])).map(((n,t)=>n+l[t]));return{snaps:d,snapsAligned:f}}(K,nn,X,Y,sn),dn=-s(an)+s(on),{snapsContained:fn,scrollContainLimit:pn}=function(n,t,e,r,o){const i=x(-t+n,0),c=e.map(((n,t)=>{const r=!t,o=l(e,t);return r?i.max:o?i.min:i.constrain(n)})).map((n=>parseFloat(n.toFixed(3)))),u=function(){const n=c[0],t=s(c);return x(c.lastIndexOf(n),c.indexOf(t)+1)}();return{snapsContained:function(){if(t<=n+o)return[i.max];if("keepSnaps"===r)return c;const{min:e,max:s}=u;return c.slice(e,s)}(),scrollContainLimit:u}}(Z,dn,ln,q,2),mn=tn?fn:ln,{limit:gn}=function(n,t,e){const r=t[0];return{limit:x(e?r-n:s(t),r)}}(dn,mn,V),hn=y(a(mn),k,V),xn=hn.clone(),yn=u(c),vn=h(f,p,(()=>(({dragHandler:n,scrollBody:t,scrollBounds:e,options:{loop:r}})=>{r||e.constrain(n.pointerDown()),t.seek()})(Pn)),(n=>(({scrollBody:n,translate:t,location:e,offsetLocation:r,scrollLooper:o,slideLooper:i,dragHandler:c,animation:u,eventHandler:s,options:{loop:a}},l)=>{const d=n.velocity(),f=n.settled();f&&!c.pointerDown()&&(u.stop(),s.emit("settle")),f||s.emit("scroll"),r.set(e.get()-d+d*l),a&&(o.loop(n.direction()),i.loop()),t.to(r.get())})(Pn,n))),bn=mn[hn.get()],Sn=D(bn),wn=D(bn),En=D(bn),Ln=function(n,t,e,r,c){let u=0,s=0,a=r,l=c,d=n.get(),f=0;function p(n){return a=n,g}function m(n){return l=n,g}const g={direction:function(){return s},duration:function(){return a},velocity:function(){return u},seek:function(){const t=e.get()-n.get();let r=0;return a?(u+=t/a,u*=l,d+=u,n.add(u),r=d-f):(u=0,n.set(e),r=t),s=i(r),f=d,g},settled:function(){return o(e.get()-t.get())<.001},useBaseFriction:function(){return m(c)},useBaseDuration:function(){return p(r)},useFriction:m,useDuration:p};return g}(Sn,wn,En,B,.68),Dn=L(V,mn,dn,gn,En),In=function(n,t,e,r,o,i){function c(r){const c=r.distance,u=r.index!==t.get();o.add(c),c&&n.start(),u&&(e.set(t.get()),t.set(r.index),i.emit("select"))}return{distance:function(n,t){c(r.byDistance(n,t))},index:function(n,e){const o=t.clone().set(n);c(r.byIndex(o.get(),e))}}}(vn,hn,xn,Dn,En,F),An=function(n){const{max:t,length:e}=n;return{get:function(n){return e?(n-t)/-e:0}}}(gn),Mn=g(),Tn=T(r,c,F,C),{slideRegistry:On}=function(n,t,e,r,o,i){const{groupSlides:c}=o,{min:u,max:f}=r;return{slideRegistry:function(){const r=c(i),o=!n||"keepSnaps"===t;return 1===e.length?[i]:o?r:r.slice(u,f).map(((n,t,e)=>{const r=!t,o=l(e,t);return r?d(s(e[0])+1):o?d(a(i)-s(e)[0]+1,s(e)[0]):n}))}()}}(tn,q,mn,pn,sn,yn),Fn=function(t,e,r,o,i,c){let u=0;function s(n){"Tab"===n.code&&(u=(new Date).getTime())}function a(s){c.add(s,"focus",(()=>{if((new Date).getTime()-u>10)return;t.scrollLeft=0;const c=e.indexOf(s),a=r.findIndex((n=>n.includes(c)));n(a)&&(i.useDuration(0),o.index(a,0))}),{passive:!0,capture:!0})}return{init:function(){c.add(document,"keydown",s,!1),e.forEach(a)}}}(e,c,On,In,Ln,Mn),Pn={ownerDocument:f,ownerWindow:p,eventHandler:F,containerRect:X,slideRects:Y,animation:vn,axis:K,direction:J,dragHandler:v(K,J,e,f,p,En,b(K,p),Sn,vn,In,Ln,Dn,hn,F,_,N,R,G,.68,$),eventStore:Mn,percentOfView:_,index:hn,indexPrevious:xn,limit:gn,location:Sn,offsetLocation:wn,options:m,resizeHandler:S(r,F,p,c,K,U,Q),scrollBody:Ln,scrollBounds:w(gn,Sn,En,Ln,_),scrollLooper:E(dn,gn,wn,[Sn,wn,En]),scrollProgress:An,scrollSnapList:mn.map(An.get),scrollSnaps:mn,scrollTarget:Dn,scrollTo:In,slideLooper:A(K,J,Z,dn,rn,on,an,mn,wn,c),slideFocus:Fn,slidesHandler:M(r,F,W),slidesInView:Tn,slideIndexes:yn,slideRegistry:On,slidesToScroll:sn,target:En,translate:I(K,J,r)};return Pn}const P={align:"center",axis:"x",container:null,slides:null,containScroll:"trimSnaps",direction:"ltr",slidesToScroll:1,inViewThreshold:0,breakpoints:{},dragFree:!1,dragThreshold:10,loop:!1,skipSnaps:!1,duration:25,startIndex:0,active:!0,watchDrag:!0,watchResize:!0,watchSlides:!0};function z(n){function t(n,t){return p(n,t||{})}const e={mergeOptions:t,optionsAtMedia:function(e){const r=e.breakpoints||{},o=f(r).filter((t=>n.matchMedia(t).matches)).map((n=>r[n])).reduce(((n,e)=>t(n,e)),{});return t(e,o)},optionsMediaQueries:function(t){return t.map((n=>f(n.breakpoints||{}))).reduce(((n,t)=>n.concat(t)),[]).map(n.matchMedia)}};return e}function H(n,e,r){const o=n.ownerDocument,i=o.defaultView,c=z(i),u=function(n){let t=[];return{init:function(e,r){return t=r.filter((({options:t})=>!1!==n.optionsAtMedia(t).active)),t.forEach((t=>t.init(e,n))),r.reduce(((n,t)=>Object.assign(n,{[t.name]:t})),{})},destroy:function(){t=t.filter((n=>n.destroy()))}}}(c),s=g(),a=function(){const n={};let t;function e(t){return n[t]||[]}const r={init:function(n){t=n},emit:function(n){return e(n).forEach((e=>e(t,n))),r},off:function(t,o){return n[t]=e(t).filter((n=>n!==o)),r},on:function(t,o){return n[t]=e(t).concat([o]),r}};return r}(),{mergeOptions:l,optionsAtMedia:d,optionsMediaQueries:f}=c,{on:p,off:m,emit:h}=a,x=M;let y,v,b,S,w=!1,E=l(P,H.globalOptions),L=l(E),D=[];function I(t){const e=F(n,b,S,o,i,t,a);if(t.loop&&!e.slideLooper.canLoop()){return I(Object.assign({},t,{loop:!1}))}return e}function A(e,r){w||(E=l(E,e),L=d(E),D=r||D,function(){const{container:e,slides:r}=L,o=t(e)?n.querySelector(e):e;b=o||n.children[0];const i=t(r)?b.querySelectorAll(r):r;S=[].slice.call(i||b.children)}(),y=I(L),f([E,...D.map((({options:n})=>n))]).forEach((n=>s.add(n,"change",M))),L.active&&(y.translate.to(y.location.get()),y.animation.init(),y.slidesInView.init(),y.slideFocus.init(),y.eventHandler.init(V),y.resizeHandler.init(V),y.slidesHandler.init(V),y.options.loop&&y.slideLooper.loop(),b.offsetParent&&S.length&&y.dragHandler.init(V),v=u.init(V,D)))}function M(n,t){const e=k();T(),A(l({startIndex:e},n),t),a.emit("reInit")}function T(){y.dragHandler.destroy(),y.eventStore.clear(),y.translate.clear(),y.slideLooper.clear(),y.resizeHandler.destroy(),y.slidesHandler.destroy(),y.slidesInView.destroy(),y.animation.destroy(),u.destroy(),s.clear()}function O(n,t,e){L.active&&!w&&(y.scrollBody.useBaseFriction().useDuration(!0===t?0:L.duration),y.scrollTo.index(n,e||0))}function k(){return y.index.get()}const V={canScrollNext:function(){return y.index.add(1).get()!==k()},canScrollPrev:function(){return y.index.add(-1).get()!==k()},containerNode:function(){return b},internalEngine:function(){return y},destroy:function(){w||(w=!0,s.clear(),T(),a.emit("destroy"))},off:m,on:p,emit:h,plugins:function(){return v},previousScrollSnap:function(){return y.indexPrevious.get()},reInit:x,rootNode:function(){return n},scrollNext:function(n){O(y.index.add(1).get(),n,-1)},scrollPrev:function(n){O(y.index.add(-1).get(),n,1)},scrollProgress:function(){return y.scrollProgress.get(y.location.get())},scrollSnapList:function(){return y.scrollSnapList},scrollTo:O,selectedScrollSnap:k,slideNodes:function(){return S},slidesInView:function(){return y.slidesInView.get()},slidesNotInView:function(){return y.slidesInView.get(!1)}};return A(e,r),setTimeout((()=>a.emit("init")),0),V}return H.globalOptions=void 0,H}));
import { EngineType } from './Engine';
import { WindowType } from './utils';
export type AnimationUpdateType = (engine: EngineType) => void;
export type AnimationRenderType = (engine: EngineType, lagFactor: number) => void;
export type AnimationType = {
export type AnimationsUpdateType = (engine: EngineType) => void;
export type AnimationsRenderType = (engine: EngineType, lagOffset: number) => void;
export type AnimationsType = {
init: () => void;
destroy: () => void;
start: () => void;
stop: () => void;
update: () => void;
render: (lagFactor: number) => void;
render: (lagOffset: number) => void;
};
export type AnimationsType = {
start: (engine: EngineType) => void;
stop: (engine: EngineType) => void;
reset: () => void;
window: WindowType;
};
export declare function Animations(ownerWindow: WindowType): AnimationsType;
export declare function Animations(ownerDocument: Document, ownerWindow: WindowType, update: AnimationsType['update'], render: AnimationsType['render']): AnimationsType;
import { EmblaCarouselType } from './EmblaCarousel';
import { AnimationType } from './Animations';
import { AnimationsType } from './Animations';
import { CounterType } from './Counter';

@@ -21,3 +21,3 @@ import { DirectionType } from './Direction';

};
export declare function DragHandler(axis: AxisType, direction: DirectionType, rootNode: HTMLElement, ownerDocument: Document, ownerWindow: WindowType, target: Vector1DType, dragTracker: DragTrackerType, location: Vector1DType, animation: AnimationType, scrollTo: ScrollToType, scrollBody: ScrollBodyType, scrollTarget: ScrollTargetType, index: CounterType, eventHandler: EventHandlerType, percentOfView: PercentOfViewType, dragFree: boolean, dragThreshold: number, skipSnaps: boolean, baseFriction: number, watchDrag: DragHandlerOptionType): DragHandlerType;
export declare function DragHandler(axis: AxisType, direction: DirectionType, rootNode: HTMLElement, ownerDocument: Document, ownerWindow: WindowType, target: Vector1DType, dragTracker: DragTrackerType, location: Vector1DType, animation: AnimationsType, scrollTo: ScrollToType, scrollBody: ScrollBodyType, scrollTarget: ScrollTargetType, index: CounterType, eventHandler: EventHandlerType, percentOfView: PercentOfViewType, dragFree: boolean, dragThreshold: number, skipSnaps: boolean, baseFriction: number, watchDrag: DragHandlerOptionType): DragHandlerType;
export {};
import { EngineType } from './Engine';
import { AnimationsType } from './Animations';
import { EventHandlerType } from './EventHandler';

@@ -31,5 +30,4 @@ import { EmblaOptionsType, OptionsType } from './Options';

declare namespace EmblaCarousel {
var animationRealms: AnimationsType[];
var globalOptions: Partial<OptionsType> | undefined;
}
export default EmblaCarousel;

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

import { AnimationsType } from './Animations';
import { AxisType } from './Axis';

@@ -27,3 +28,2 @@ import { CounterType } from './Counter';

import { Vector1DType } from './Vector1d';
import { AnimationType, AnimationsType } from './Animations';
export type EngineType = {

@@ -35,3 +35,3 @@ ownerDocument: Document;

direction: DirectionType;
animation: AnimationType;
animation: AnimationsType;
scrollBounds: ScrollBoundsType;

@@ -67,2 +67,2 @@ scrollLooper: ScrollLooperType;

};
export declare function Engine(root: HTMLElement, container: HTMLElement, slides: HTMLElement[], ownerDocument: Document, ownerWindow: WindowType, options: OptionsType, eventHandler: EventHandlerType, animations: AnimationsType): EngineType;
export declare function Engine(root: HTMLElement, container: HTMLElement, slides: HTMLElement[], ownerDocument: Document, ownerWindow: WindowType, options: OptionsType, eventHandler: EventHandlerType): EngineType;

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

import { AnimationType } from './Animations';
import { AnimationsType } from './Animations';
import { CounterType } from './Counter';

@@ -10,2 +10,2 @@ import { EventHandlerType } from './EventHandler';

};
export declare function ScrollTo(animation: AnimationType, indexCurrent: CounterType, indexPrevious: CounterType, scrollTarget: ScrollTargetType, targetVector: Vector1DType, eventHandler: EventHandlerType): ScrollToType;
export declare function ScrollTo(animation: AnimationsType, indexCurrent: CounterType, indexPrevious: CounterType, scrollTarget: ScrollTargetType, targetVector: Vector1DType, eventHandler: EventHandlerType): ScrollToType;

@@ -86,2 +86,82 @@ function isNumber(subject) {

function EventStore() {
let listeners = [];
function add(node, type, handler, options = {
passive: true
}) {
let removeListener;
if ('addEventListener' in node) {
node.addEventListener(type, handler, options);
removeListener = () => node.removeEventListener(type, handler, options);
} else {
const legacyMediaQueryList = node;
legacyMediaQueryList.addListener(handler);
removeListener = () => legacyMediaQueryList.removeListener(handler);
}
listeners.push(removeListener);
return self;
}
function clear() {
listeners = listeners.filter(remove => remove());
}
const self = {
add,
clear
};
return self;
}
function Animations(ownerDocument, ownerWindow, update, render) {
const documentVisibleHandler = EventStore();
const timeStep = 1000 / 60;
let lastTimeStamp = null;
let lag = 0;
let animationFrame = 0;
function init() {
documentVisibleHandler.add(ownerDocument, 'visibilitychange', () => {
if (ownerDocument.hidden) reset();
});
}
function destroy() {
stop();
documentVisibleHandler.clear();
}
function animate(timeStamp) {
if (!lastTimeStamp) lastTimeStamp = timeStamp;
const elapsed = timeStamp - lastTimeStamp;
lastTimeStamp = timeStamp;
lag += elapsed;
while (lag >= timeStep) {
update();
lag -= timeStep;
}
const lagOffset = mathAbs(lag / timeStep);
render(lagOffset);
if (animationFrame) ownerWindow.requestAnimationFrame(animate);
}
function start() {
if (animationFrame) return;
animationFrame = ownerWindow.requestAnimationFrame(animate);
}
function stop() {
ownerWindow.cancelAnimationFrame(animationFrame);
lastTimeStamp = null;
lag = 0;
animationFrame = 0;
}
function reset() {
lastTimeStamp = null;
lag = 0;
}
const self = {
init,
destroy,
start,
stop,
update,
render
};
return self;
}
function Axis(axis, direction) {

@@ -191,29 +271,2 @@ const scroll = axis === 'y' ? 'y' : 'x';

function EventStore() {
let listeners = [];
function add(node, type, handler, options = {
passive: true
}) {
let removeListener;
if ('addEventListener' in node) {
node.addEventListener(type, handler, options);
removeListener = () => node.removeEventListener(type, handler, options);
} else {
const legacyMediaQueryList = node;
legacyMediaQueryList.addListener(handler);
removeListener = () => legacyMediaQueryList.removeListener(handler);
}
listeners.push(removeListener);
return self;
}
function clear() {
listeners = listeners.filter(remove => remove());
}
const self = {
add,
clear
};
return self;
}
function DragHandler(axis, direction, rootNode, ownerDocument, ownerWindow, target, dragTracker, location, animation, scrollTo, scrollBody, scrollTarget, index, eventHandler, percentOfView, dragFree, dragThreshold, skipSnaps, baseFriction, watchDrag) {

@@ -1142,3 +1195,3 @@ const {

function Engine(root, container, slides, ownerDocument, ownerWindow, options, eventHandler, animations) {
function Engine(root, container, slides, ownerDocument, ownerWindow, options, eventHandler) {
// Options

@@ -1238,8 +1291,3 @@ const {

};
const animation = {
start: () => animations.start(engine),
stop: () => animations.stop(engine),
update: () => update(engine),
render: lagOffset => render(engine, lagOffset)
};
const animation = Animations(ownerDocument, ownerWindow, () => update(engine), lagOffset => render(engine, lagOffset));
// Shared

@@ -1302,51 +1350,2 @@ const friction = 0.68;

function Animations(ownerWindow) {
const timeStep = 1000 / 60;
let engines = [];
let lastTimeStamp = null;
let lag = 0;
let animationFrame = 0;
function animate(timeStamp) {
if (!lastTimeStamp) lastTimeStamp = timeStamp;
const elapsed = timeStamp - lastTimeStamp;
lastTimeStamp = timeStamp;
lag += elapsed;
while (lag >= timeStep) {
engines.forEach(({
animation
}) => animation.update());
lag -= timeStep;
}
const lagOffset = mathAbs(lag / timeStep);
engines.forEach(({
animation
}) => animation.render(lagOffset));
if (animationFrame) ownerWindow.requestAnimationFrame(animate);
}
function start(engine) {
if (!engines.includes(engine)) engines.push(engine);
if (animationFrame) return;
animationFrame = ownerWindow.requestAnimationFrame(animate);
}
function stop(engine) {
engines = engines.filter(e => e !== engine);
if (engines.length) return;
ownerWindow.cancelAnimationFrame(animationFrame);
lastTimeStamp = null;
lag = 0;
animationFrame = 0;
}
function reset() {
lastTimeStamp = null;
lag = 0;
}
const self = {
start,
stop,
reset,
window: ownerWindow
};
return self;
}
function EventHandler() {

@@ -1451,8 +1450,4 @@ const listeners = {};

const mediaHandlers = EventStore();
const documentVisibleHandler = EventStore();
const eventHandler = EventHandler();
const {
animationRealms
} = EmblaCarousel;
const {
mergeOptions,

@@ -1486,4 +1481,4 @@ optionsAtMedia,

}
function createEngine(options, animations) {
const engine = Engine(root, container, slides, ownerDocument, ownerWindow, options, eventHandler, animations);
function createEngine(options) {
const engine = Engine(root, container, slides, ownerDocument, ownerWindow, options, eventHandler);
if (options.loop && !engine.slideLooper.canLoop()) {

@@ -1493,3 +1488,3 @@ const optionsWithoutLoop = Object.assign({}, options, {

});
return createEngine(optionsWithoutLoop, animations);
return createEngine(optionsWithoutLoop);
}

@@ -1500,5 +1495,2 @@ return engine;

if (destroyed) return;
const animationRealm = animationRealms.find(a => a.window === ownerWindow);
const animations = animationRealm || Animations(ownerWindow);
if (!animationRealm) animationRealms.push(animations);
optionsBase = mergeOptions(optionsBase, withOptions);

@@ -1508,3 +1500,3 @@ options = optionsAtMedia(optionsBase);

storeElements();
engine = createEngine(options, animations);
engine = createEngine(options);
optionsMediaQueries([optionsBase, ...pluginList.map(({

@@ -1515,2 +1507,3 @@ options

engine.translate.to(engine.location.get());
engine.animation.init();
engine.slidesInView.init();

@@ -1521,5 +1514,2 @@ engine.slideFocus.init();

engine.slidesHandler.init(self);
documentVisibleHandler.add(ownerDocument, 'visibilitychange', () => {
if (ownerDocument.hidden) animations.reset();
});
if (engine.options.loop) engine.slideLooper.loop();

@@ -1539,3 +1529,2 @@ if (container.offsetParent && slides.length) engine.dragHandler.init(self);

engine.dragHandler.destroy();
engine.animation.stop();
engine.eventStore.clear();

@@ -1547,5 +1536,5 @@ engine.translate.clear();

engine.slidesInView.destroy();
engine.animation.destroy();
pluginsHandler.destroy();
mediaHandlers.clear();
documentVisibleHandler.clear();
}

@@ -1640,3 +1629,2 @@ function destroy() {

}
EmblaCarousel.animationRealms = [];
EmblaCarousel.globalOptions = undefined;

@@ -1643,0 +1631,0 @@

{
"name": "embla-carousel",
"version": "8.0.0-rc17",
"author": "David Jerleke",
"description": "A lightweight carousel library with fluid motion and great swipe precision",
"repository": {
"type": "git",
"url": "git+https://github.com/davidjerleke/embla-carousel"
},
"bugs": {
"url": "https://github.com/davidjerleke/embla-carousel/issues"
},
"homepage": "https://www.embla-carousel.com",
"license": "MIT",
"keywords": [
"slider",
"carousel",
"slideshow",
"gallery",
"lightweight",
"touch",
"javascript",
"typescript",
"react",
"vue",
"svelte"
],
"main": "embla-carousel.umd.js",
"unpkg": "embla-carousel.umd.js",
"module": "embla-carousel.esm.js",
"sideEffects": false,
"files": [
"embla-carousel*",
"components/**/*",
"index.d.ts"
],
"devDependencies": {
"@types/jest": "^29.5.6",
"@typescript-eslint/eslint-plugin": "^6.9.0",
"@typescript-eslint/parser": "^6.9.0",
"eslint": "^8.52.0",
"eslint-config-prettier": "^9.0.0",
"eslint-plugin-prettier": "^4.0.0",
"jest": "^29.5.0",
"jest-environment-jsdom": "^29.5.0",
"prettier": "2.8.8",
"rollup": "^4.1.5",
"ts-jest": "^29.1.1",
"typescript": "^5.2.2"
},
"type": "module"
}
"name": "embla-carousel",
"version": "8.0.0-rc18",
"author": "David Jerleke",
"description": "A lightweight carousel library with fluid motion and great swipe precision",
"repository": {
"type": "git",
"url": "git+https://github.com/davidjerleke/embla-carousel"
},
"bugs": {
"url": "https://github.com/davidjerleke/embla-carousel/issues"
},
"homepage": "https://www.embla-carousel.com",
"license": "MIT",
"keywords": [
"slider",
"carousel",
"slideshow",
"gallery",
"lightweight",
"touch",
"javascript",
"typescript",
"react",
"vue",
"svelte"
],
"main": "embla-carousel.umd.js",
"unpkg": "embla-carousel.umd.js",
"module": "embla-carousel.esm.js",
"sideEffects": false,
"files": [
"embla-carousel*",
"components/**/*",
"index.d.ts"
],
"devDependencies": {
"@types/jest": "^29.5.6",
"@typescript-eslint/eslint-plugin": "^6.9.0",
"@typescript-eslint/parser": "^6.9.0",
"eslint": "^8.52.0",
"eslint-config-prettier": "^9.0.0",
"eslint-plugin-prettier": "^4.0.0",
"jest": "^29.5.0",
"jest-environment-jsdom": "^29.5.0",
"prettier": "2.8.8",
"rollup": "^4.1.5",
"ts-jest": "^29.1.1",
"typescript": "^5.2.2"
},
"type": "module"
}
{
"name": "embla-carousel",
"version": "8.0.0-rc17",
"version": "8.0.0-rc18",
"author": "David Jerleke",

@@ -42,3 +42,3 @@ "description": "A lightweight carousel library with fluid motion and great swipe precision",

"build": "rollup --bundleConfigAsCjs -c",
"start": "rollup --bundleConfigAsCjs -c --watch",
"start": "rollup --bundleConfigAsCjs -c --watch --environment BUILD:development",
"eslint:report": "eslint \"src/**/*.{js,tsx,ts}\""

@@ -45,0 +45,0 @@ },

@@ -96,2 +96,4 @@ <br />

<img src="https://avatars2.githubusercontent.com/u/91487491?s=120&v=4" title="hamidrezahanafi" width="50" height="50" style="max-width: 100%" />
</a><a href="https://github.com/zaaakher">
<img src="https://avatars2.githubusercontent.com/u/46135573?s=120&v=4" title="zaaakher" width="50" height="50" style="max-width: 100%" />
</a><a href="https://github.com/wopian">

@@ -98,0 +100,0 @@ <img src="https://avatars2.githubusercontent.com/u/3440094?s=120&v=4" title="wopian" width="50" height="50" style="max-width: 100%" />

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

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc