{"version":3,"file":"embla-carousel.js","sources":["src/components/Alignment.ts","src/components/Animation.ts","src/components/Axis.ts","src/components/utils.ts","src/components/Limit.ts","src/components/Counter.ts","src/components/Direction.ts","src/components/EventStore.ts","src/components/Vector1d.ts","src/components/DragHandler.ts","src/components/DragTracker.ts","src/components/PxToPercent.ts","src/components/ScrollBody.ts","src/components/ScrollBounds.ts","src/components/ScrollContain.ts","src/components/ScrollLimit.ts","src/components/ScrollLooper.ts","src/components/ScrollProgress.ts","src/components/ScrollSnap.ts","src/components/ScrollTarget.ts","src/components/ScrollTo.ts","src/components/SlideLooper.ts","src/components/SlidesInView.ts","src/components/SlideSizes.ts","src/components/Translate.ts","src/components/Engine.ts","src/components/EventEmitter.ts","src/components/Options.ts","src/components/OptionsPseudo.ts","src/components/index.ts"],"sourcesContent":["export type AlignmentOptionType = 'start' | 'center' | 'end' | number\n\nexport type AlignmentType = {\n measure: (n: number) => number\n}\n\nexport function Alignment(\n align: AlignmentOptionType,\n viewSize: number,\n): AlignmentType {\n const predefined = { start, center, end }\n\n function start(): number {\n return 0\n }\n\n function center(n: number): number {\n return end(n) / 2\n }\n\n function end(n: number): number {\n return viewSize - n\n }\n\n function percent(): number {\n return viewSize * Number(align)\n }\n\n function measure(n: number): number {\n if (typeof align === 'number') return percent()\n return predefined[align](n)\n }\n\n const self: AlignmentType = {\n measure,\n }\n return self\n}\n","type CallbackType = () => void\n\nexport type AnimationType = {\n start: () => void\n stop: () => void\n proceed: () => void\n}\n\nexport function Animation(callback: FrameRequestCallback): AnimationType {\n let animationFrame = 0\n\n function ifAnimating(active: boolean, cb: CallbackType): CallbackType {\n return (): void => {\n if (active === !!animationFrame) cb()\n }\n }\n\n function start(): void {\n animationFrame = window.requestAnimationFrame(callback)\n }\n\n function stop(): void {\n window.cancelAnimationFrame(animationFrame)\n animationFrame = 0\n }\n\n const self: AnimationType = {\n proceed: ifAnimating(true, start),\n start: ifAnimating(false, start),\n stop: ifAnimating(true, stop),\n }\n return self\n}\n","import { DirectionOptionType } from './Direction'\n\nexport type AxisOptionType = 'x' | 'y'\ntype AxisEdgeType = 'top' | 'right' | 'bottom' | 'left'\n\nexport type AxisType = {\n scroll: AxisOptionType\n cross: AxisOptionType\n startEdge: AxisEdgeType\n endEdge: AxisEdgeType\n measureSize: (rect: DOMRect) => number\n}\n\nexport function Axis(\n axis: AxisOptionType,\n direction: DirectionOptionType,\n): AxisType {\n const scroll = axis === 'y' ? 'y' : 'x'\n const cross = axis === 'y' ? 'x' : 'y'\n const startEdge = getStartEdge()\n const endEdge = getEndEdge()\n\n function measureSize(rect: DOMRect): number {\n const { width, height } = rect\n return scroll === 'x' ? width : height\n }\n\n function getStartEdge(): AxisEdgeType {\n if (scroll === 'y') return 'top'\n return direction === 'rtl' ? 'right' : 'left'\n }\n\n function getEndEdge(): AxisEdgeType {\n if (scroll === 'y') return 'bottom'\n return direction === 'rtl' ? 'left' : 'right'\n }\n\n const self: AxisType = {\n scroll,\n cross,\n startEdge,\n endEdge,\n measureSize,\n }\n return self\n}\n","export function map(\n value: number,\n iStart: number,\n iStop: number,\n oStart: number,\n oStop: number,\n): number {\n return oStart + (oStop - oStart) * ((value - iStart) / (iStop - iStart))\n}\n\nexport function mathAbs(n: number): number {\n return Math.abs(n)\n}\n\nexport function mathSign(n: number): number {\n return !n ? 0 : n / mathAbs(n)\n}\n\nexport function deltaAbs(valueB: number, valueA: number): number {\n return mathAbs(valueB - valueA)\n}\n\nexport function factorAbs(valueB: number, valueA: number): number {\n if (valueB === 0 || valueA === 0) return 0\n if (mathAbs(valueB) <= mathAbs(valueA)) return 0\n const diff = deltaAbs(mathAbs(valueB), mathAbs(valueA))\n return mathAbs(diff / valueB)\n}\n\nexport function roundToDecimals(decimalPoints: number): (n: number) => number {\n const pow = Math.pow(10, decimalPoints)\n return (n: number): number => Math.round(n * pow) / pow\n}\n\nexport function debounce(callback: () => void, time: number): () => void {\n let timeout = 0\n return (): void => {\n window.clearTimeout(timeout)\n timeout = window.setTimeout(callback, time) || 0\n }\n}\n\nexport function arrayGroup(\n array: GenericType[],\n size: number,\n): GenericType[][] {\n const groups = []\n for (let i = 0; i < array.length; i += size) {\n groups.push(array.slice(i, i + size))\n }\n return groups\n}\n\nexport function arrayKeys(array: GenericType[]): number[] {\n return Object.keys(array).map(Number)\n}\n\nexport function arrayLast(array: GenericType[]): GenericType {\n return array[arrayLastIndex(array)]\n}\n\nexport function arrayLastIndex(array: GenericType[]): number {\n return Math.max(0, array.length - 1)\n}\n","import { mathAbs } from './utils'\n\nexport type LimitType = {\n min: number\n max: number\n length: number\n constrain: (n: number) => number\n reachedAny: (n: number) => boolean\n reachedMax: (n: number) => boolean\n reachedMin: (n: number) => boolean\n removeOffset: (n: number) => number\n}\n\nexport function Limit(min: number, max: number): LimitType {\n const length = mathAbs(min - max)\n\n function reachedMin(n: number): boolean {\n return n < min\n }\n\n function reachedMax(n: number): boolean {\n return n > max\n }\n\n function reachedAny(n: number): boolean {\n return reachedMin(n) || reachedMax(n)\n }\n\n function constrain(n: number): number {\n if (!reachedAny(n)) return n\n return reachedMin(n) ? min : max\n }\n\n function removeOffset(n: number): number {\n if (!length) return n\n return n - length * Math.ceil((n - max) / length)\n }\n\n const self: LimitType = {\n length,\n max,\n min,\n constrain,\n reachedAny,\n reachedMax,\n reachedMin,\n removeOffset,\n }\n return self\n}\n","import { Limit } from './Limit'\nimport { mathAbs } from './utils'\n\nexport type CounterType = {\n get: () => number\n set: (n: number) => CounterType\n add: (n: number) => CounterType\n clone: () => CounterType\n min: number\n max: number\n}\n\nexport function Counter(\n max: number,\n start: number,\n loop: boolean,\n): CounterType {\n const { min, constrain } = Limit(0, max)\n const loopEnd = max + 1\n let counter = withinLimit(start)\n\n function withinLimit(n: number): number {\n return !loop ? constrain(n) : mathAbs((loopEnd + n) % loopEnd)\n }\n\n function get(): number {\n return counter\n }\n\n function set(n: number): CounterType {\n counter = withinLimit(n)\n return self\n }\n\n function add(n: number): CounterType {\n return set(get() + n)\n }\n\n function clone(): CounterType {\n return Counter(max, get(), loop)\n }\n\n const self: CounterType = {\n add,\n clone,\n get,\n set,\n min,\n max,\n }\n return self\n}\n","export type DirectionOptionType = 'ltr' | 'rtl'\n\nexport type DirectionType = {\n apply: (n: number) => number\n}\n\nexport function Direction(direction: DirectionOptionType): DirectionType {\n const sign = direction === 'rtl' ? -1 : 1\n\n function apply(n: number): number {\n return n * sign\n }\n\n const self: DirectionType = {\n apply,\n }\n return self\n}\n","type EventNameType = keyof DocumentEventMap | keyof WindowEventMap\ntype EventHandlerType = (evt: any) => void\ntype EventOptionsType = boolean | AddEventListenerOptions | undefined\ntype EventRemoverType = () => void\n\nexport type EventStoreType = {\n add: (\n node: EventTarget,\n type: EventNameType,\n handler: EventHandlerType,\n options?: EventOptionsType,\n ) => EventStoreType\n removeAll: () => EventStoreType\n}\n\nexport function EventStore(): EventStoreType {\n let listeners: EventRemoverType[] = []\n\n function add(\n node: EventTarget,\n type: EventNameType,\n handler: EventHandlerType,\n options: EventOptionsType = false,\n ): EventStoreType {\n node.addEventListener(type, handler, options)\n listeners.push(() => node.removeEventListener(type, handler, options))\n return self\n }\n\n function removeAll(): EventStoreType {\n listeners = listeners.filter((remove) => remove())\n return self\n }\n\n const self: EventStoreType = {\n add,\n removeAll,\n }\n return self\n}\n","export type Vector1DType = {\n get: () => number\n set: (v: Vector1DType | number) => Vector1DType\n add: (v: Vector1DType | number) => Vector1DType\n subtract: (v: Vector1DType | number) => Vector1DType\n multiply: (n: number) => Vector1DType\n divide: (n: number) => Vector1DType\n normalize: () => Vector1DType\n}\n\nexport function Vector1D(value: number): Vector1DType {\n let vector = value\n\n function get(): number {\n return vector\n }\n\n function set(n: Vector1DType | number): Vector1DType {\n vector = readNumber(n)\n return self\n }\n\n function add(n: Vector1DType | number): Vector1DType {\n vector += readNumber(n)\n return self\n }\n\n function subtract(n: Vector1DType | number): Vector1DType {\n vector -= readNumber(n)\n return self\n }\n\n function multiply(n: number): Vector1DType {\n vector *= n\n return self\n }\n\n function divide(n: number): Vector1DType {\n vector /= n\n return self\n }\n\n function normalize(): Vector1DType {\n if (vector !== 0) divide(vector)\n return self\n }\n\n function readNumber(n: Vector1DType | number): number {\n return typeof n === 'number' ? n : n.get()\n }\n\n const self: Vector1DType = {\n add,\n divide,\n get,\n multiply,\n normalize,\n set,\n subtract,\n }\n return self\n}\n","import { AnimationType } from './Animation'\nimport { CounterType } from './Counter'\nimport { DirectionType } from './Direction'\nimport { DragTrackerType, PointerEventType } from './DragTracker'\nimport { EventEmitterType } from './EventEmitter'\nimport { AxisType } from './Axis'\nimport { EventStore } from './EventStore'\nimport { ScrollBodyType } from './ScrollBody'\nimport { ScrollTargetType } from './ScrollTarget'\nimport { ScrollToType } from './ScrollTo'\nimport { Vector1D, Vector1DType } from './Vector1d'\nimport { deltaAbs, factorAbs, mathAbs, mathSign } from './utils'\n\nexport type DragHandlerType = {\n addActivationEvents: () => void\n clickAllowed: () => boolean\n pointerDown: () => boolean\n removeAllEvents: () => void\n}\n\nexport function DragHandler(\n axis: AxisType,\n direction: DirectionType,\n rootNode: HTMLElement,\n target: Vector1DType,\n dragFree: boolean,\n dragTracker: DragTrackerType,\n location: Vector1DType,\n animation: AnimationType,\n scrollTo: ScrollToType,\n scrollBody: ScrollBodyType,\n scrollTarget: ScrollTargetType,\n index: CounterType,\n events: EventEmitterType,\n loop: boolean,\n skipSnaps: boolean,\n): DragHandlerType {\n const { cross: crossAxis } = axis\n const focusNodes = ['INPUT', 'SELECT', 'TEXTAREA']\n const dragStartPoint = Vector1D(0)\n const activationEvents = EventStore()\n const interactionEvents = EventStore()\n const snapForceBoost = { mouse: 300, touch: 400 }\n const freeForceBoost = { mouse: 500, touch: 600 }\n const baseSpeed = dragFree ? 5 : 16\n const baseMass = 1\n const dragThreshold = 20\n\n let startScroll = 0\n let startCross = 0\n let pointerIsDown = false\n let preventScroll = false\n let preventClick = false\n let isMouse = false\n\n function addActivationEvents(): void {\n const node = rootNode\n activationEvents\n .add(node, 'touchmove', () => undefined)\n .add(node, 'touchend', () => undefined)\n .add(node, 'touchstart', down)\n .add(node, 'mousedown', down)\n .add(node, 'touchcancel', up)\n .add(node, 'contextmenu', up)\n .add(node, 'click', click)\n }\n\n function addInteractionEvents(): void {\n const node = !isMouse ? rootNode : document\n interactionEvents\n .add(node, 'touchmove', move)\n .add(node, 'touchend', up)\n .add(node, 'mousemove', move)\n .add(node, 'mouseup', up)\n }\n\n function removeAllEvents(): void {\n activationEvents.removeAll()\n interactionEvents.removeAll()\n }\n\n function isFocusNode(node: Element): boolean {\n const name = node.nodeName || ''\n return focusNodes.indexOf(name) > -1\n }\n\n function forceBoost(): number {\n const boost = dragFree ? freeForceBoost : snapForceBoost\n const type = isMouse ? 'mouse' : 'touch'\n return boost[type]\n }\n\n function allowedForce(force: number, targetChanged: boolean): number {\n const next = index.clone().add(mathSign(force) * -1)\n const isEdge = next.get() === index.min || next.get() === index.max\n const baseForce = scrollTarget.byDistance(force, !dragFree).distance\n\n if (dragFree || mathAbs(force) < dragThreshold) return baseForce\n if (!loop && isEdge) return baseForce * 0.4\n if (skipSnaps && targetChanged) return baseForce * 0.5\n\n return scrollTarget.byIndex(next.get(), 0).distance\n }\n\n function down(evt: PointerEventType): void {\n isMouse = evt.type === 'mousedown'\n if (isMouse && (evt as MouseEvent).button !== 0) return\n\n const isMoving = deltaAbs(target.get(), location.get()) >= 2\n const clearPreventClick = isMouse || !isMoving\n const isNotFocusNode = !isFocusNode(evt.target as Element)\n const preventDefault = isMoving || (isMouse && isNotFocusNode)\n\n pointerIsDown = true\n dragTracker.pointerDown(evt)\n dragStartPoint.set(target)\n target.set(location)\n scrollBody.useBaseMass().useSpeed(80)\n addInteractionEvents()\n startScroll = dragTracker.readPoint(evt)\n startCross = dragTracker.readPoint(evt, crossAxis)\n events.emit('pointerDown')\n\n if (clearPreventClick) preventClick = false\n if (preventDefault) evt.preventDefault()\n }\n\n function move(evt: PointerEventType): void {\n if (!preventScroll && !isMouse) {\n if (!evt.cancelable) return up(evt)\n const lastScroll = dragTracker.readPoint(evt)\n const lastCross = dragTracker.readPoint(evt, crossAxis)\n const diffScroll = deltaAbs(lastScroll, startScroll)\n const diffCross = deltaAbs(lastCross, startCross)\n preventScroll = diffScroll > diffCross\n if (!preventScroll && !preventClick) return up(evt)\n }\n const diff = dragTracker.pointerMove(evt)\n if (!preventClick && diff) preventClick = true\n animation.start()\n target.add(direction.apply(diff))\n evt.preventDefault()\n }\n\n function up(evt: PointerEventType): void {\n const currentLocation = scrollTarget.byDistance(0, false)\n const targetChanged = currentLocation.index !== index.get()\n const rawForce = dragTracker.pointerUp(evt) * forceBoost()\n const force = allowedForce(direction.apply(rawForce), targetChanged)\n const forceFactor = factorAbs(rawForce, force)\n const isMoving = deltaAbs(target.get(), dragStartPoint.get()) >= 0.5\n const isVigorous = targetChanged && forceFactor > 0.75\n const isBelowThreshold = mathAbs(rawForce) < dragThreshold\n const speed = isVigorous ? 10 : baseSpeed\n const mass = isVigorous ? baseMass + 2.5 * forceFactor : baseMass\n\n if (isMoving && !isMouse) preventClick = true\n preventScroll = false\n pointerIsDown = false\n interactionEvents.removeAll()\n scrollBody.useSpeed(isBelowThreshold ? 9 : speed).useMass(mass)\n scrollTo.distance(force, !dragFree)\n isMouse = false\n events.emit('pointerUp')\n }\n\n function click(evt: MouseEvent): void {\n if (preventClick) evt.preventDefault()\n }\n\n function clickAllowed(): boolean {\n return !preventClick\n }\n\n function pointerDown(): boolean {\n return pointerIsDown\n }\n\n const self: DragHandlerType = {\n addActivationEvents,\n clickAllowed,\n pointerDown,\n removeAllEvents,\n }\n return self\n}\n","import { AxisOptionType, AxisType } from './Axis'\nimport { PxToPercentType } from './PxToPercent'\nimport { mathAbs } from './utils'\n\ntype PointerCoordType = keyof Touch | keyof MouseEvent\nexport type PointerEventType = TouchEvent | MouseEvent\n\nexport type DragTrackerType = {\n isTouchEvent: (evt: PointerEventType) => evt is TouchEvent\n pointerDown: (evt: PointerEventType) => number\n pointerMove: (evt: PointerEventType) => number\n pointerUp: (evt: PointerEventType) => number\n readPoint: (evt: PointerEventType, evtAxis?: AxisOptionType) => number\n}\n\nexport function DragTracker(\n axis: AxisType,\n pxToPercent: PxToPercentType,\n): DragTrackerType {\n const logInterval = 170\n\n let startEvent: PointerEventType\n let lastEvent: PointerEventType\n\n function isTouchEvent(evt: PointerEventType): evt is TouchEvent {\n return typeof TouchEvent !== 'undefined' && evt instanceof TouchEvent\n }\n\n function readTime(evt: PointerEventType): number {\n return evt.timeStamp\n }\n\n function readPoint(evt: PointerEventType, evtAxis?: AxisOptionType): number {\n const property = evtAxis || axis.scroll\n const coord: PointerCoordType = `client${property === 'x' ? 'X' : 'Y'}`\n return (isTouchEvent(evt) ? evt.touches[0] : evt)[coord]\n }\n\n function pointerDown(evt: PointerEventType): number {\n startEvent = evt\n lastEvent = evt\n return pxToPercent.measure(readPoint(evt))\n }\n\n function pointerMove(evt: PointerEventType): number {\n const diff = readPoint(evt) - readPoint(lastEvent)\n const expired = readTime(evt) - readTime(startEvent) > logInterval\n\n lastEvent = evt\n if (expired) startEvent = evt\n return pxToPercent.measure(diff)\n }\n\n function pointerUp(evt: PointerEventType): number {\n if (!startEvent || !lastEvent) return 0\n const diffDrag = readPoint(lastEvent) - readPoint(startEvent)\n const diffTime = readTime(evt) - readTime(startEvent)\n const expired = readTime(evt) - readTime(lastEvent) > logInterval\n const force = diffDrag / diffTime\n const isFlick = diffTime && !expired && mathAbs(force) > 0.1\n\n return isFlick ? pxToPercent.measure(force) : 0\n }\n\n const self: DragTrackerType = {\n isTouchEvent,\n pointerDown,\n pointerMove,\n pointerUp,\n readPoint,\n }\n return self\n}\n","export type PxToPercentType = {\n measure: (n: number) => number\n totalPercent: number\n}\n\nexport function PxToPercent(viewInPx: number): PxToPercentType {\n const totalPercent = 100\n\n function measure(n: number): number {\n if (viewInPx === 0) return 0\n return (n / viewInPx) * totalPercent\n }\n\n const self: PxToPercentType = {\n measure,\n totalPercent,\n }\n return self\n}\n","import { map, roundToDecimals, mathSign } from './utils'\nimport { Vector1D, Vector1DType } from './Vector1d'\n\nexport type ScrollBodyType = {\n direction: () => number\n seek: (target: Vector1DType) => ScrollBodyType\n settle: (target: Vector1DType) => boolean\n update: () => void\n useBaseMass: () => ScrollBodyType\n useBaseSpeed: () => ScrollBodyType\n useMass: (n: number) => ScrollBodyType\n useSpeed: (n: number) => ScrollBodyType\n}\n\nexport function ScrollBody(\n location: Vector1DType,\n baseSpeed: number,\n baseMass: number,\n): ScrollBodyType {\n const roundToTwoDecimals = roundToDecimals(2)\n const velocity = Vector1D(0)\n const acceleration = Vector1D(0)\n const attraction = Vector1D(0)\n\n let attractionDirection = 0\n let speed = baseSpeed\n let mass = baseMass\n\n function update(): void {\n velocity.add(acceleration)\n location.add(velocity)\n acceleration.multiply(0)\n }\n\n function applyForce(force: Vector1DType): void {\n force.divide(mass)\n acceleration.add(force)\n }\n\n function seek(target: Vector1DType): ScrollBodyType {\n attraction.set(target).subtract(location)\n const magnitude = map(attraction.get(), 0, 100, 0, speed)\n attractionDirection = mathSign(attraction.get())\n attraction.normalize().multiply(magnitude).subtract(velocity)\n applyForce(attraction)\n return self\n }\n\n function settle(target: Vector1DType): boolean {\n const diff = target.get() - location.get()\n const hasSettled = !roundToTwoDecimals(diff)\n if (hasSettled) location.set(target)\n return hasSettled\n }\n\n function direction(): number {\n return attractionDirection\n }\n\n function useBaseSpeed(): ScrollBodyType {\n return useSpeed(baseSpeed)\n }\n\n function useBaseMass(): ScrollBodyType {\n return useMass(baseMass)\n }\n\n function useSpeed(n: number): ScrollBodyType {\n speed = n\n return self\n }\n\n function useMass(n: number): ScrollBodyType {\n mass = n\n return self\n }\n\n const self: ScrollBodyType = {\n direction,\n seek,\n settle,\n update,\n useBaseMass,\n useBaseSpeed,\n useMass,\n useSpeed,\n }\n return self\n}\n","import { LimitType } from './Limit'\nimport { ScrollBodyType } from './ScrollBody'\nimport { Vector1DType } from './Vector1d'\nimport { mathAbs } from './utils'\n\nexport type ScrollBoundsType = {\n constrain: (pointerDown: boolean) => void\n toggleActive: (active: boolean) => void\n}\n\nexport function ScrollBounds(\n limit: LimitType,\n location: Vector1DType,\n target: Vector1DType,\n scrollBody: ScrollBodyType,\n): ScrollBoundsType {\n const pullBackThreshold = 10\n const edgeOffsetTolerance = 50\n const maxFriction = 0.85\n let disabled = false\n\n function shouldConstrain(): boolean {\n if (disabled) return false\n if (!limit.reachedAny(target.get())) return false\n if (!limit.reachedAny(location.get())) return false\n return true\n }\n\n function constrain(pointerDown: boolean): void {\n if (!shouldConstrain()) return\n const edge = limit.reachedMin(location.get()) ? 'min' : 'max'\n const diffToEdge = mathAbs(limit[edge] - location.get())\n const diffToTarget = target.get() - location.get()\n const friction = Math.min(diffToEdge / edgeOffsetTolerance, maxFriction)\n\n target.subtract(diffToTarget * friction)\n\n if (!pointerDown && mathAbs(diffToTarget) < pullBackThreshold) {\n target.set(limit.constrain(target.get()))\n scrollBody.useSpeed(10).useMass(3)\n }\n }\n\n function toggleActive(active: boolean): void {\n disabled = !active\n }\n\n const self: ScrollBoundsType = {\n constrain,\n toggleActive,\n }\n return self\n}\n","import { Limit, LimitType } from './Limit'\nimport { arrayLast } from './utils'\n\nexport type ScrollContainOptionType = '' | 'trimSnaps' | 'keepSnaps'\n\nexport type ScrollContainType = {\n snapsContained: number[]\n}\n\nexport function ScrollContain(\n viewSize: number,\n contentSize: number,\n snaps: number[],\n snapsAligned: number[],\n containScroll: ScrollContainOptionType,\n): ScrollContainType {\n const scrollBounds = Limit(-contentSize + viewSize, snaps[0])\n const snapsBounded = snapsAligned.map(scrollBounds.constrain)\n const snapsContained = measureContained()\n\n function findDuplicates(): LimitType {\n const startSnap = snapsBounded[0]\n const endSnap = arrayLast(snapsBounded)\n const min = snapsBounded.lastIndexOf(startSnap)\n const max = snapsBounded.indexOf(endSnap) + 1\n return Limit(min, max)\n }\n\n function measureContained(): number[] {\n if (contentSize <= viewSize) return [scrollBounds.max]\n if (containScroll === 'keepSnaps') return snapsBounded\n const { min, max } = findDuplicates()\n return snapsBounded.slice(min, max)\n }\n\n const self: ScrollContainType = {\n snapsContained,\n }\n return self\n}\n","import { Limit, LimitType } from './Limit'\nimport { arrayLast } from './utils'\n\nexport type ScrollLimitType = {\n limit: LimitType\n}\n\nexport function ScrollLimit(\n contentSize: number,\n scrollSnaps: number[],\n loop: boolean,\n): ScrollLimitType {\n const limit = measureLimit()\n\n function measureLimit(): LimitType {\n const startSnap = scrollSnaps[0]\n const endSnap = arrayLast(scrollSnaps)\n const min = loop ? startSnap - contentSize : endSnap\n const max = startSnap\n return Limit(min, max)\n }\n\n const self: ScrollLimitType = {\n limit,\n }\n return self\n}\n","import { Limit, LimitType } from './Limit'\nimport { PxToPercentType } from './PxToPercent'\nimport { Vector1DType } from './Vector1d'\n\nexport type ScrollLooperType = {\n loop: (direction: number) => void\n}\n\nexport function ScrollLooper(\n contentSize: number,\n pxToPercent: PxToPercentType,\n limit: LimitType,\n location: Vector1DType,\n vectors: Vector1DType[],\n): ScrollLooperType {\n const min = limit.min + pxToPercent.measure(0.1)\n const max = limit.max + pxToPercent.measure(0.1)\n const { reachedMin, reachedMax } = Limit(min, max)\n\n function shouldLoop(direction: number): boolean {\n if (direction === 1) return reachedMax(location.get())\n if (direction === -1) return reachedMin(location.get())\n return false\n }\n\n function loop(direction: number): void {\n if (!shouldLoop(direction)) return\n\n const loopDistance = contentSize * (direction * -1)\n vectors.forEach((v) => v.add(loopDistance))\n }\n\n const self: ScrollLooperType = {\n loop,\n }\n return self\n}\n","import { LimitType } from './Limit'\n\nexport type ScrollProgressType = {\n get: (n: number) => number\n}\n\nexport function ScrollProgress(limit: LimitType): ScrollProgressType {\n const { max, length: scrollLength } = limit\n\n function get(n: number): number {\n const currentLocation = n - max\n return currentLocation / -scrollLength\n }\n\n const self: ScrollProgressType = {\n get,\n }\n return self\n}\n","import { AlignmentType } from './Alignment'\nimport { AxisType } from './Axis'\nimport { PxToPercentType } from './PxToPercent'\nimport { arrayLast, arrayGroup, mathAbs } from './utils'\n\nexport type ScrollSnapType = {\n snaps: number[]\n snapsAligned: number[]\n}\n\nexport function ScrollSnap(\n axis: AxisType,\n alignment: AlignmentType,\n pxToPercent: PxToPercentType,\n containerRect: DOMRect,\n slideRects: DOMRect[],\n slidesToScroll: number,\n): ScrollSnapType {\n const { startEdge, endEdge } = axis\n const snaps = measureUnaligned()\n const snapsAligned = measureAligned()\n\n function measureSizes(): number[] {\n return arrayGroup(slideRects, slidesToScroll)\n .map((rects) => arrayLast(rects)[endEdge] - rects[0][startEdge])\n .map(pxToPercent.measure)\n .map(mathAbs)\n }\n\n function measureUnaligned(): number[] {\n return slideRects\n .map((rect) => containerRect[startEdge] - rect[startEdge])\n .map(pxToPercent.measure)\n .map((snap) => -mathAbs(snap))\n }\n\n function measureAligned(): number[] {\n const groupedSnaps = arrayGroup(snaps, slidesToScroll).map((g) => g[0])\n const alignments = measureSizes().map(alignment.measure)\n return groupedSnaps.map((snap, index) => snap + alignments[index])\n }\n\n const self: ScrollSnapType = {\n snaps,\n snapsAligned,\n }\n return self\n}\n","import { LimitType } from './Limit'\nimport { Vector1DType } from './Vector1d'\nimport { mathAbs } from './utils'\n\nexport type TargetType = {\n distance: number\n index: number\n}\n\nexport type ScrollTargetType = {\n byIndex: (target: number, direction: number) => TargetType\n byDistance: (force: number, snap: boolean) => TargetType\n shortcut: (target: number, direction: number) => number\n}\n\nexport function ScrollTarget(\n loop: boolean,\n scrollSnaps: number[],\n contentSize: number,\n limit: LimitType,\n targetVector: Vector1DType,\n): ScrollTargetType {\n const { reachedAny, removeOffset, constrain } = limit\n\n function minDistance(d1: number, d2: number): number {\n return mathAbs(d1) < mathAbs(d2) ? d1 : d2\n }\n\n function findTargetSnap(target: number): TargetType {\n const distance = loop ? removeOffset(target) : constrain(target)\n const ascDiffsToSnaps = scrollSnaps\n .map((scrollSnap) => scrollSnap - distance)\n .map((diffToSnap) => shortcut(diffToSnap, 0))\n .map((diff, i) => ({ diff, index: i }))\n .sort((d1, d2) => mathAbs(d1.diff) - mathAbs(d2.diff))\n\n const { index } = ascDiffsToSnaps[0]\n return { index, distance }\n }\n\n function shortcut(target: number, direction: number): number {\n const t1 = target\n const t2 = target + contentSize\n const t3 = target - contentSize\n\n if (!loop) return t1\n if (!direction) return minDistance(minDistance(t1, t2), t3)\n\n const shortest = minDistance(t1, direction === 1 ? t2 : t3)\n return mathAbs(shortest) * direction\n }\n\n function byIndex(index: number, direction: number): TargetType {\n const diffToSnap = scrollSnaps[index] - targetVector.get()\n const distance = shortcut(diffToSnap, direction)\n return { index, distance }\n }\n\n function byDistance(distance: number, snap: boolean): TargetType {\n const target = targetVector.get() + distance\n const { index, distance: targetSnapDistance } = findTargetSnap(target)\n const reachedBound = !loop && reachedAny(target)\n\n if (!snap || reachedBound) return { index, distance }\n\n const diffToSnap = scrollSnaps[index] - targetSnapDistance\n const snapDistance = distance + shortcut(diffToSnap, 0)\n\n return { index, distance: snapDistance }\n }\n\n const self: ScrollTargetType = {\n byDistance,\n byIndex,\n shortcut,\n }\n return self\n}\n","import { AnimationType } from './Animation'\nimport { CounterType } from './Counter'\nimport { EventEmitterType } from './EventEmitter'\nimport { ScrollTargetType, TargetType } from './ScrollTarget'\nimport { Vector1DType } from './Vector1d'\n\nexport type ScrollToType = {\n distance: (n: number, snap: boolean) => void\n index: (n: number, direction: number) => void\n}\n\nexport function ScrollTo(\n animation: AnimationType,\n indexCurrent: CounterType,\n indexPrevious: CounterType,\n scrollTarget: ScrollTargetType,\n targetVector: Vector1DType,\n events: EventEmitterType,\n): ScrollToType {\n function scrollTo(target: TargetType): void {\n const distanceDiff = target.distance\n const indexDiff = target.index !== indexCurrent.get()\n\n if (distanceDiff) {\n animation.start()\n targetVector.add(distanceDiff)\n }\n if (indexDiff) {\n indexPrevious.set(indexCurrent.get())\n indexCurrent.set(target.index)\n events.emit('select')\n }\n }\n\n function distance(n: number, snap: boolean): void {\n const target = scrollTarget.byDistance(n, snap)\n scrollTo(target)\n }\n\n function index(n: number, direction: number): void {\n const targetIndex = indexCurrent.clone().set(n)\n const target = scrollTarget.byIndex(targetIndex.get(), direction)\n scrollTo(target)\n }\n\n const self: ScrollToType = {\n distance,\n index,\n }\n return self\n}\n","import { AxisType } from './Axis'\nimport { arrayKeys } from './utils'\nimport { SlidesInViewType } from './SlidesInView'\nimport { Vector1DType } from './Vector1d'\n\ntype EdgeType = 'start' | 'end'\n\ntype LoopPointType = {\n point: number\n location: number\n index: number\n getTarget: () => number\n}\n\nexport type SlideLooperType = {\n canLoop: () => boolean\n clear: () => void\n loop: () => void\n loopPoints: LoopPointType[]\n}\n\nexport function SlideLooper(\n axis: AxisType,\n viewSize: number,\n contentSize: number,\n slideSizesWithGaps: number[],\n scrollSnaps: number[],\n slidesInView: SlidesInViewType,\n scrollLocation: Vector1DType,\n slides: HTMLElement[],\n): SlideLooperType {\n const ascItems = arrayKeys(slideSizesWithGaps)\n const descItems = arrayKeys(slideSizesWithGaps).reverse()\n const loopPoints = startPoints().concat(endPoints())\n\n function removeSlideSizes(indexes: number[], from: number): number {\n return indexes.reduce((a: number, i) => {\n return a - slideSizesWithGaps[i]\n }, from)\n }\n\n function slidesInGap(indexes: number[], gap: number): number[] {\n return indexes.reduce((a: number[], i) => {\n const remainingGap = removeSlideSizes(a, gap)\n return remainingGap > 0 ? a.concat([i]) : a\n }, [])\n }\n\n function findLoopPoints(indexes: number[], edge: EdgeType): LoopPointType[] {\n const isStartEdge = edge === 'start'\n const offset = isStartEdge ? -contentSize : contentSize\n const slideBounds = slidesInView.findSlideBounds([offset])\n\n return indexes.map((index) => {\n const initial = isStartEdge ? 0 : -contentSize\n const altered = isStartEdge ? contentSize : 0\n const bounds = slideBounds.filter((b) => b.index === index)[0]\n const point = bounds[isStartEdge ? 'end' : 'start']\n const getTarget = (): number =>\n scrollLocation.get() > point ? initial : altered\n return { point, getTarget, index, location: -1 }\n })\n }\n\n function startPoints(): LoopPointType[] {\n const gap = scrollSnaps[0] - 1\n const indexes = slidesInGap(descItems, gap)\n return findLoopPoints(indexes, 'end')\n }\n\n function endPoints(): LoopPointType[] {\n const gap = viewSize - scrollSnaps[0] - 1\n const indexes = slidesInGap(ascItems, gap)\n return findLoopPoints(indexes, 'start')\n }\n\n function canLoop(): boolean {\n return loopPoints.every(({ index }) => {\n const otherIndexes = ascItems.filter((i) => i !== index)\n return removeSlideSizes(otherIndexes, viewSize) <= 0\n })\n }\n\n function loop(): void {\n loopPoints.forEach((loopPoint) => {\n const { getTarget, location, index } = loopPoint\n const target = getTarget()\n if (target !== location) {\n slides[index].style[axis.startEdge] = `${target}%`\n loopPoint.location = target\n }\n })\n }\n\n function clear(): void {\n loopPoints.forEach(({ index }) => {\n slides[index].style[axis.startEdge] = ''\n })\n }\n\n const self: SlideLooperType = {\n canLoop,\n clear,\n loop,\n loopPoints,\n }\n return self\n}\n","import { LimitType } from './Limit'\n\nexport type SlideBoundType = {\n start: number\n end: number\n index: number\n}\n\nexport type SlidesInViewType = {\n check: (location: number, bounds?: SlideBoundType[]) => number[]\n findSlideBounds: (offsets?: number[], threshold?: number) => SlideBoundType[]\n}\n\nexport function SlidesInView(\n viewSize: number,\n contentSize: number,\n slideSizes: number[],\n snaps: number[],\n limit: LimitType,\n loop: boolean,\n inViewThreshold: number,\n): SlidesInViewType {\n const { removeOffset, constrain } = limit\n const cachedThreshold = Math.min(Math.max(inViewThreshold, 0.01), 0.99)\n const cachedOffsets = loop ? [0, contentSize, -contentSize] : [0]\n const cachedBounds = findSlideBounds(cachedOffsets, cachedThreshold)\n\n function findSlideBounds(\n offsets?: number[],\n threshold?: number,\n ): SlideBoundType[] {\n const slideOffsets = offsets || cachedOffsets\n const slideThreshold = threshold || 0\n const thresholds = slideSizes.map((s) => s * slideThreshold)\n\n return slideOffsets.reduce((list: SlideBoundType[], offset) => {\n const bounds = snaps.map((snap, index) => ({\n start: snap - slideSizes[index] + thresholds[index] + offset,\n end: snap + viewSize - thresholds[index] + offset,\n index,\n }))\n return list.concat(bounds)\n }, [])\n }\n\n function check(location: number, bounds?: SlideBoundType[]): number[] {\n const limitedLocation = loop ? removeOffset(location) : constrain(location)\n const slideBounds = bounds || cachedBounds\n\n return slideBounds.reduce((list: number[], slideBound) => {\n const { index, start, end } = slideBound\n const inList = list.indexOf(index) !== -1\n const inView = start < limitedLocation && end > limitedLocation\n return !inList && inView ? list.concat([index]) : list\n }, [])\n }\n\n const self: SlidesInViewType = {\n check,\n findSlideBounds,\n }\n return self\n}\n","import { AxisType } from './Axis'\nimport { PxToPercentType } from './PxToPercent'\nimport { arrayLast, arrayLastIndex, mathAbs } from './utils'\n\nexport type SlideSizesType = {\n slideSizes: number[]\n slideSizesWithGaps: number[]\n}\n\nexport function SlideSizes(\n axis: AxisType,\n pxToPercent: PxToPercentType,\n slides: HTMLElement[],\n slideRects: DOMRect[],\n loop: boolean,\n): SlideSizesType {\n const { measureSize, startEdge, endEdge } = axis\n const sizesInPx = slideRects.map(measureSize)\n const slideSizes = sizesInPx.map(pxToPercent.measure)\n const slideSizesWithGaps = measureWithGaps()\n\n function measureWithGaps(): number[] {\n return slideRects\n .map((rect, index, rects) => {\n const isLast = index === arrayLastIndex(rects)\n const style = window.getComputedStyle(arrayLast(slides))\n const endGap = parseFloat(style.getPropertyValue(`margin-${endEdge}`))\n if (isLast) return sizesInPx[index] + (loop ? endGap : 0)\n return rects[index + 1][startEdge] - rect[startEdge]\n })\n .map(pxToPercent.measure)\n .map(mathAbs)\n }\n\n const self: SlideSizesType = {\n slideSizes,\n slideSizesWithGaps,\n }\n return self\n}\n","import { AxisType } from './Axis'\nimport { DirectionType } from './Direction'\nimport { Vector1DType } from './Vector1d'\n\nexport type TranslateType = {\n clear: () => void\n to: (vector: Vector1DType) => void\n toggleActive: (active: boolean) => void\n}\n\nexport function Translate(\n axis: AxisType,\n direction: DirectionType,\n container: HTMLElement,\n): TranslateType {\n const translate = axis.scroll === 'x' ? x : y\n const containerStyle = container.style\n let disabled = false\n\n function x(n: number): string {\n return `translate3d(${n}%,0px,0px)`\n }\n\n function y(n: number): string {\n return `translate3d(0px,${n}%,0px)`\n }\n\n function to(target: Vector1DType): void {\n if (disabled) return\n containerStyle.transform = translate(direction.apply(target.get()))\n }\n\n function toggleActive(active: boolean): void {\n disabled = !active\n }\n\n function clear(): void {\n containerStyle.transform = ''\n }\n\n const self: TranslateType = {\n clear,\n to,\n toggleActive,\n }\n return self\n}\n","import { Alignment } from './Alignment'\nimport { Animation, AnimationType } from './Animation'\nimport { Axis, AxisType } from './Axis'\nimport { Counter, CounterType } from './Counter'\nimport { Direction, DirectionType } from './Direction'\nimport { DragHandler, DragHandlerType } from './DragHandler'\nimport { DragTracker } from './DragTracker'\nimport { EventEmitterType } from './EventEmitter'\nimport { EventStore, EventStoreType } from './EventStore'\nimport { LimitType } from './Limit'\nimport { OptionsType } from './Options'\nimport { PxToPercent, PxToPercentType } from './PxToPercent'\nimport { ScrollBody, ScrollBodyType } from './ScrollBody'\nimport { ScrollBounds, ScrollBoundsType } from './ScrollBounds'\nimport { ScrollContain } from './ScrollContain'\nimport { ScrollLimit } from './ScrollLimit'\nimport { ScrollLooper, ScrollLooperType } from './ScrollLooper'\nimport { ScrollProgress, ScrollProgressType } from './ScrollProgress'\nimport { ScrollSnap } from './ScrollSnap'\nimport { ScrollTarget, ScrollTargetType } from './ScrollTarget'\nimport { ScrollTo, ScrollToType } from './ScrollTo'\nimport { SlideLooper, SlideLooperType } from './SlideLooper'\nimport { SlidesInView, SlidesInViewType } from './SlidesInView'\nimport { SlideSizes } from './SlideSizes'\nimport { Translate, TranslateType } from './Translate'\nimport { arrayKeys, arrayLast, arrayLastIndex } from './utils'\nimport { Vector1D, Vector1DType } from './Vector1d'\n\nexport type Engine = {\n axis: AxisType\n direction: DirectionType\n animation: AnimationType\n scrollBounds: ScrollBoundsType\n scrollLooper: ScrollLooperType\n scrollProgress: ScrollProgressType\n index: CounterType\n indexPrevious: CounterType\n limit: LimitType\n location: Vector1DType\n options: OptionsType\n pxToPercent: PxToPercentType\n scrollBody: ScrollBodyType\n dragHandler: DragHandlerType\n eventStore: EventStoreType\n slideLooper: SlideLooperType\n slidesInView: SlidesInViewType\n target: Vector1DType\n translate: TranslateType\n scrollTo: ScrollToType\n scrollTarget: ScrollTargetType\n scrollSnaps: number[]\n slideIndexes: number[]\n containerRect: DOMRect\n slideRects: DOMRect[]\n}\n\nexport function Engine(\n root: HTMLElement,\n container: HTMLElement,\n slides: HTMLElement[],\n options: OptionsType,\n events: EventEmitterType,\n): Engine {\n // Options\n const {\n align,\n axis: scrollAxis,\n direction: contentDirection,\n startIndex,\n inViewThreshold,\n loop,\n speed,\n dragFree,\n slidesToScroll,\n skipSnaps,\n containScroll,\n } = options\n\n // Measurements\n const containerRect = container.getBoundingClientRect()\n const slideRects = slides.map((slide) => slide.getBoundingClientRect())\n const direction = Direction(contentDirection)\n const axis = Axis(scrollAxis, contentDirection)\n const pxToPercent = PxToPercent(axis.measureSize(containerRect))\n const viewSize = pxToPercent.totalPercent\n const alignment = Alignment(align, viewSize)\n const { slideSizes, slideSizesWithGaps } = SlideSizes(\n axis,\n pxToPercent,\n slides,\n slideRects,\n loop,\n )\n const { snaps, snapsAligned } = ScrollSnap(\n axis,\n alignment,\n pxToPercent,\n containerRect,\n slideRects,\n slidesToScroll,\n )\n const contentSize = -arrayLast(snaps) + arrayLast(slideSizesWithGaps)\n const { snapsContained } = ScrollContain(\n viewSize,\n contentSize,\n snaps,\n snapsAligned,\n containScroll,\n )\n\n const contain = !loop && containScroll !== ''\n const scrollSnaps = contain ? snapsContained : snapsAligned\n const { limit } = ScrollLimit(contentSize, scrollSnaps, loop)\n\n // Indexes\n const index = Counter(arrayLastIndex(scrollSnaps), startIndex, loop)\n const indexPrevious = index.clone()\n const slideIndexes = arrayKeys(slides)\n\n // Draw\n const update = (): void => {\n if (!loop) engine.scrollBounds.constrain(engine.dragHandler.pointerDown())\n engine.scrollBody.seek(target).update()\n const settled = engine.scrollBody.settle(target)\n\n if (settled && !engine.dragHandler.pointerDown()) {\n engine.animation.stop()\n events.emit('settle')\n }\n if (!settled) {\n events.emit('scroll')\n }\n if (loop) {\n engine.scrollLooper.loop(engine.scrollBody.direction())\n engine.slideLooper.loop()\n }\n\n engine.translate.to(location)\n engine.animation.proceed()\n }\n\n // Shared\n const animation = Animation(update)\n const startLocation = scrollSnaps[index.get()]\n const location = Vector1D(startLocation)\n const target = Vector1D(startLocation)\n const scrollBody = ScrollBody(location, speed, 1)\n const scrollTarget = ScrollTarget(\n loop,\n scrollSnaps,\n contentSize,\n limit,\n target,\n )\n const scrollTo = ScrollTo(\n animation,\n index,\n indexPrevious,\n scrollTarget,\n target,\n events,\n )\n const slidesInView = SlidesInView(\n viewSize,\n contentSize,\n slideSizes,\n snaps,\n limit,\n loop,\n inViewThreshold,\n )\n\n // DragHandler\n const dragHandler = DragHandler(\n axis,\n direction,\n root,\n target,\n dragFree,\n DragTracker(axis, pxToPercent),\n location,\n animation,\n scrollTo,\n scrollBody,\n scrollTarget,\n index,\n events,\n loop,\n skipSnaps,\n )\n\n // Slider\n const engine: Engine = {\n containerRect,\n slideRects,\n animation,\n axis,\n direction,\n dragHandler,\n eventStore: EventStore(),\n pxToPercent,\n index,\n indexPrevious,\n limit,\n location,\n options,\n scrollBody,\n scrollBounds: ScrollBounds(limit, location, target, scrollBody),\n scrollLooper: ScrollLooper(contentSize, pxToPercent, limit, location, [\n location,\n target,\n ]),\n scrollProgress: ScrollProgress(limit),\n scrollSnaps,\n scrollTarget,\n scrollTo,\n slideLooper: SlideLooper(\n axis,\n viewSize,\n contentSize,\n slideSizesWithGaps,\n scrollSnaps,\n slidesInView,\n location,\n slides,\n ),\n slidesInView,\n slideIndexes,\n target,\n translate: Translate(axis, direction, container),\n }\n return engine\n}\n","type CallbackType = (evt: EmblaEventType) => void\ntype ListenersType = Partial<{ [key in EmblaEventType]: CallbackType[] }>\n\nexport type EmblaEventType =\n | 'init'\n | 'pointerDown'\n | 'pointerUp'\n | 'scroll'\n | 'select'\n | 'settle'\n | 'destroy'\n | 'reInit'\n | 'resize'\n\nexport type EventEmitterType = {\n emit: (evt: EmblaEventType) => EventEmitterType\n on: (evt: EmblaEventType, cb: CallbackType) => EventEmitterType\n off: (evt: EmblaEventType, cb: CallbackType) => EventEmitterType\n}\n\nexport function EventEmitter(): EventEmitterType {\n const listeners: ListenersType = {}\n\n function getListeners(evt: EmblaEventType): CallbackType[] {\n return listeners[evt] || []\n }\n\n function emit(evt: EmblaEventType): EventEmitterType {\n getListeners(evt).forEach((e) => e(evt))\n return self\n }\n\n function on(evt: EmblaEventType, cb: CallbackType): EventEmitterType {\n listeners[evt] = getListeners(evt).concat([cb])\n return self\n }\n\n function off(evt: EmblaEventType, cb: CallbackType): EventEmitterType {\n listeners[evt] = getListeners(evt).filter((e) => e !== cb)\n return self\n }\n\n const self: EventEmitterType = {\n emit,\n off,\n on,\n }\n return self\n}\n","import { AlignmentOptionType } from './Alignment'\nimport { AxisOptionType } from './Axis'\nimport { DirectionOptionType } from './Direction'\nimport { ScrollContainOptionType } from './ScrollContain'\n\nexport type OptionsType = {\n align: AlignmentOptionType\n axis: AxisOptionType\n containScroll: ScrollContainOptionType\n direction: DirectionOptionType\n dragFree: boolean\n draggable: boolean\n inViewThreshold: number\n loop: boolean\n skipSnaps: boolean\n slidesToScroll: number\n speed: number\n startIndex: number\n}\n\nexport const defaultOptions: OptionsType = {\n align: 'center',\n axis: 'x',\n containScroll: '',\n direction: 'ltr',\n dragFree: false,\n draggable: true,\n inViewThreshold: 0,\n loop: false,\n skipSnaps: false,\n slidesToScroll: 1,\n speed: 10,\n startIndex: 0,\n}\n\nexport type EmblaOptionsType = Partial\n","import { EmblaOptionsType } from './Options'\n\nexport type OptionsPseudoType = {\n get: () => EmblaOptionsType\n}\n\nexport function OptionsPseudo(node: HTMLElement): OptionsPseudoType {\n const pseudoString = getComputedStyle(node, ':before').content\n\n function get(): EmblaOptionsType {\n try {\n return JSON.parse(pseudoString.slice(1, -1).replace(/\\\\/g, ''))\n } catch (error) {} // eslint-disable-line no-empty\n return {}\n }\n\n const self: OptionsPseudoType = {\n get,\n }\n return self\n}\n","import { Engine } from './Engine'\nimport { EventEmitter, EventEmitterType } from './EventEmitter'\nimport { defaultOptions, EmblaOptionsType } from './Options'\nimport { OptionsPseudo, OptionsPseudoType } from './OptionsPseudo'\nimport { debounce } from './utils'\n\nexport type EmblaNodesType = {\n root: HTMLElement\n container?: HTMLElement\n slides?: HTMLElement[]\n}\n\ntype EmblaPluginOptionsType = {\n [key: string]: unknown\n}\n\nexport type EmblaPluginType<\n OptionsType extends EmblaPluginOptionsType = EmblaPluginOptionsType,\n> = {\n name: string\n options: OptionsType\n init: (embla: EmblaCarouselType) => void\n destroy: () => void\n [key: string]: unknown\n}\n\nexport type EmblaCarouselType = {\n canScrollNext: () => boolean\n canScrollPrev: () => boolean\n clickAllowed: () => boolean\n containerNode: () => HTMLElement\n internalEngine: () => Engine\n destroy: () => void\n off: EventEmitterType['off']\n on: EventEmitterType['on']\n previousScrollSnap: () => number\n reInit: (options?: EmblaOptionsType, plugins?: EmblaPluginType[]) => void\n rootNode: () => HTMLElement\n scrollNext: (jump?: boolean) => void\n scrollPrev: (jump?: boolean) => void\n scrollProgress: () => number\n scrollSnapList: () => number[]\n scrollTo: (index: number, jump?: boolean) => void\n selectedScrollSnap: () => number\n slideNodes: () => HTMLElement[]\n slidesInView: (target?: boolean) => number[]\n slidesNotInView: (target?: boolean) => number[]\n}\n\nfunction EmblaCarousel(\n nodes: HTMLElement | EmblaNodesType,\n userOptions?: EmblaOptionsType,\n userPlugins?: EmblaPluginType[],\n): EmblaCarouselType {\n const events = EventEmitter()\n const debouncedResize = debounce(resize, 500)\n const reInit = reActivate\n const { on, off } = events\n\n let engine: Engine\n let activated = false\n let optionsBase = Object.assign(\n {},\n defaultOptions,\n EmblaCarousel.globalOptions,\n )\n let options = Object.assign({}, optionsBase)\n let optionsPseudo: OptionsPseudoType\n let plugins: EmblaPluginType[]\n let rootSize = 0\n let root: HTMLElement\n let container: HTMLElement\n let slides: HTMLElement[]\n\n function setupElements(): void {\n const providedContainer = 'container' in nodes && nodes.container\n const providedSlides = 'slides' in nodes && nodes.slides\n\n root = 'root' in nodes ? nodes.root : nodes\n container = providedContainer || root.children[0]\n slides = providedSlides || [].slice.call(container.children)\n optionsPseudo = OptionsPseudo(root)\n }\n\n function activate(\n withOptions?: EmblaOptionsType,\n withPlugins?: EmblaPluginType[],\n ): void {\n setupElements()\n optionsBase = Object.assign({}, optionsBase, withOptions)\n options = Object.assign({}, optionsBase, optionsPseudo.get())\n plugins = Object.assign([], withPlugins)\n engine = Engine(root, container, slides, options, events)\n engine.eventStore.add(window, 'resize', debouncedResize)\n engine.translate.to(engine.location)\n rootSize = engine.axis.measureSize(root.getBoundingClientRect())\n plugins.forEach((plugin) => plugin.init(self))\n\n if (options.loop) {\n if (!engine.slideLooper.canLoop()) {\n deActivate()\n return activate({ loop: false }, withPlugins)\n }\n engine.slideLooper.loop()\n }\n if (options.draggable && container.offsetParent && slides.length) {\n engine.dragHandler.addActivationEvents()\n }\n if (!activated) {\n setTimeout(() => events.emit('init'), 0)\n activated = true\n }\n }\n\n function reActivate(\n withOptions?: EmblaOptionsType,\n withPlugins?: EmblaPluginType[],\n ): void {\n if (!activated) return\n const startIndex = selectedScrollSnap()\n const newOptions = Object.assign({ startIndex }, withOptions)\n deActivate()\n activate(newOptions, withPlugins || plugins)\n events.emit('reInit')\n }\n\n function deActivate(): void {\n engine.dragHandler.removeAllEvents()\n engine.animation.stop()\n engine.eventStore.removeAll()\n engine.translate.clear()\n engine.slideLooper.clear()\n plugins.forEach((plugin) => plugin.destroy())\n }\n\n function destroy(): void {\n if (!activated) return\n deActivate()\n activated = false\n events.emit('destroy')\n }\n\n function resize(): void {\n if (!activated) return\n const size = engine.axis.measureSize(root.getBoundingClientRect())\n if (rootSize !== size) reActivate()\n events.emit('resize')\n }\n\n function slidesInView(target?: boolean): number[] {\n const location = engine[target ? 'target' : 'location'].get()\n const type = options.loop ? 'removeOffset' : 'constrain'\n return engine.slidesInView.check(engine.limit[type](location))\n }\n\n function slidesNotInView(target?: boolean): number[] {\n const inView = slidesInView(target)\n return engine.slideIndexes.filter((index) => inView.indexOf(index) === -1)\n }\n\n function scrollTo(index: number, jump?: boolean, direction?: number): void {\n engine.scrollBody.useBaseMass().useSpeed(jump ? 100 : options.speed)\n if (activated) engine.scrollTo.index(index, direction || 0)\n }\n\n function scrollNext(jump?: boolean): void {\n const next = engine.index.clone().add(1)\n scrollTo(next.get(), jump === true, -1)\n }\n\n function scrollPrev(jump?: boolean): void {\n const prev = engine.index.clone().add(-1)\n scrollTo(prev.get(), jump === true, 1)\n }\n\n function canScrollNext(): boolean {\n const next = engine.index.clone().add(1)\n return next.get() !== selectedScrollSnap()\n }\n\n function canScrollPrev(): boolean {\n const prev = engine.index.clone().add(-1)\n return prev.get() !== selectedScrollSnap()\n }\n\n function scrollSnapList(): number[] {\n return engine.scrollSnaps.map(engine.scrollProgress.get)\n }\n\n function scrollProgress(): number {\n return engine.scrollProgress.get(engine.location.get())\n }\n\n function selectedScrollSnap(): number {\n return engine.index.get()\n }\n\n function previousScrollSnap(): number {\n return engine.indexPrevious.get()\n }\n\n function clickAllowed(): boolean {\n return engine.dragHandler.clickAllowed()\n }\n\n function internalEngine(): Engine {\n return engine\n }\n\n function rootNode(): HTMLElement {\n return root\n }\n\n function containerNode(): HTMLElement {\n return container\n }\n\n function slideNodes(): HTMLElement[] {\n return slides\n }\n\n const self: EmblaCarouselType = {\n canScrollNext,\n canScrollPrev,\n clickAllowed,\n containerNode,\n internalEngine,\n destroy,\n off,\n on,\n previousScrollSnap,\n reInit,\n rootNode,\n scrollNext,\n scrollPrev,\n scrollProgress,\n scrollSnapList,\n scrollTo,\n selectedScrollSnap,\n slideNodes,\n slidesInView,\n slidesNotInView,\n }\n activate(userOptions, userPlugins)\n return self\n}\n\nEmblaCarousel.globalOptions = undefined\n\nexport default EmblaCarousel\n"],"names":["Alignment","align","viewSize","predefined","start","center","end","n","percent","Number","measure","self","Animation","callback","animationFrame","ifAnimating","active","cb","window","requestAnimationFrame","stop","cancelAnimationFrame","proceed","Axis","axis","direction","scroll","cross","startEdge","getStartEdge","endEdge","getEndEdge","measureSize","rect","width","height","map","value","iStart","iStop","oStart","oStop","mathAbs","Math","abs","mathSign","deltaAbs","valueB","valueA","factorAbs","diff","roundToDecimals","decimalPoints","pow","round","debounce","time","timeout","clearTimeout","setTimeout","arrayGroup","array","size","groups","i","length","push","slice","arrayKeys","Object","keys","arrayLast","arrayLastIndex","max","Limit","min","reachedMin","reachedMax","reachedAny","constrain","removeOffset","ceil","Counter","loop","_a","loopEnd","counter","withinLimit","get","set","add","clone","Direction","sign","apply","EventStore","listeners","node","type","handler","options","addEventListener","removeEventListener","removeAll","filter","remove","Vector1D","vector","readNumber","subtract","multiply","divide","normalize","DragHandler","rootNode","target","dragFree","dragTracker","location","animation","scrollTo","scrollBody","scrollTarget","index","events","skipSnaps","crossAxis","focusNodes","dragStartPoint","activationEvents","interactionEvents","snapForceBoost","mouse","touch","freeForceBoost","baseSpeed","baseMass","dragThreshold","startScroll","startCross","pointerIsDown","preventScroll","preventClick","isMouse","addActivationEvents","undefined","down","up","click","addInteractionEvents","document","move","removeAllEvents","isFocusNode","name","nodeName","indexOf","forceBoost","boost","allowedForce","force","targetChanged","next","isEdge","baseForce","byDistance","distance","byIndex","evt","button","isMoving","clearPreventClick","isNotFocusNode","preventDefault","pointerDown","useBaseMass","useSpeed","readPoint","emit","cancelable","lastScroll","lastCross","diffScroll","diffCross","pointerMove","currentLocation","rawForce","pointerUp","forceFactor","isVigorous","isBelowThreshold","speed","mass","useMass","clickAllowed","DragTracker","pxToPercent","logInterval","startEvent","lastEvent","isTouchEvent","TouchEvent","readTime","timeStamp","evtAxis","property","coord","touches","expired","diffDrag","diffTime","isFlick","PxToPercent","viewInPx","totalPercent","ScrollBody","roundToTwoDecimals","velocity","acceleration","attraction","attractionDirection","update","applyForce","seek","magnitude","settle","hasSettled","useBaseSpeed","ScrollBounds","limit","pullBackThreshold","edgeOffsetTolerance","maxFriction","disabled","shouldConstrain","edge","diffToEdge","diffToTarget","friction","toggleActive","ScrollContain","contentSize","snaps","snapsAligned","containScroll","scrollBounds","snapsBounded","snapsContained","measureContained","findDuplicates","startSnap","endSnap","lastIndexOf","ScrollLimit","scrollSnaps","measureLimit","ScrollLooper","vectors","shouldLoop","loopDistance","forEach","v","ScrollProgress","scrollLength","ScrollSnap","alignment","containerRect","slideRects","slidesToScroll","measureUnaligned","measureAligned","measureSizes","rects","snap","groupedSnaps","g","alignments","ScrollTarget","targetVector","minDistance","d1","d2","findTargetSnap","ascDiffsToSnaps","scrollSnap","diffToSnap","shortcut","sort","t1","t2","t3","shortest","targetSnapDistance","reachedBound","snapDistance","ScrollTo","indexCurrent","indexPrevious","distanceDiff","indexDiff","targetIndex","SlideLooper","slideSizesWithGaps","slidesInView","scrollLocation","slides","ascItems","descItems","reverse","loopPoints","startPoints","concat","endPoints","removeSlideSizes","indexes","from","reduce","a","slidesInGap","gap","remainingGap","findLoopPoints","isStartEdge","offset","slideBounds","findSlideBounds","initial","altered","bounds","b","point","getTarget","canLoop","every","otherIndexes","loopPoint","style","clear","SlidesInView","slideSizes","inViewThreshold","cachedThreshold","cachedOffsets","cachedBounds","offsets","threshold","slideOffsets","slideThreshold","thresholds","s","list","check","limitedLocation","slideBound","inList","inView","SlideSizes","sizesInPx","measureWithGaps","isLast","getComputedStyle","endGap","parseFloat","getPropertyValue","Translate","container","translate","x","y","containerStyle","to","transform","Engine","root","scrollAxis","contentDirection","startIndex","getBoundingClientRect","slide","_b","contain","slideIndexes","engine","dragHandler","settled","scrollLooper","slideLooper","startLocation","eventStore","scrollProgress","EventEmitter","getListeners","e","on","off","defaultOptions","draggable","OptionsPseudo","pseudoString","content","JSON","parse","replace","error","EmblaCarousel","nodes","userOptions","userPlugins","debouncedResize","resize","reInit","reActivate","activated","optionsBase","assign","globalOptions","optionsPseudo","plugins","rootSize","setupElements","providedContainer","providedSlides","children","call","activate","withOptions","withPlugins","plugin","init","deActivate","offsetParent","selectedScrollSnap","newOptions","destroy","slidesNotInView","jump","scrollNext","scrollPrev","prev","canScrollNext","canScrollPrev","scrollSnapList","previousScrollSnap","internalEngine","containerNode","slideNodes"],"mappings":";;SAMgBA,UACdC,OACAC;AAEA,MAAMC,UAAU,GAAG;AAAEC,IAAAA,KAAK,OAAP;AAASC,IAAAA,MAAM,QAAf;AAAiBC,IAAAA,GAAG;AAApB,GAAnB;;AAEA,WAASF,KAAT;AACE,WAAO,CAAP;AACD;;AAED,WAASC,MAAT,CAAgBE,CAAhB;AACE,WAAOD,GAAG,CAACC,CAAD,CAAH,GAAS,CAAhB;AACD;;AAED,WAASD,GAAT,CAAaC,CAAb;AACE,WAAOL,QAAQ,GAAGK,CAAlB;AACD;;AAED,WAASC,OAAT;AACE,WAAON,QAAQ,GAAGO,MAAM,CAACR,KAAD,CAAxB;AACD;;AAED,WAASS,OAAT,CAAiBH,CAAjB;AACE,QAAI,OAAON,KAAP,KAAiB,QAArB,EAA+B,OAAOO,OAAO,EAAd;AAC/B,WAAOL,UAAU,CAACF,KAAD,CAAV,CAAkBM,CAAlB,CAAP;AACD;;AAED,MAAMI,IAAI,GAAkB;AAC1BD,IAAAA,OAAO;AADmB,GAA5B;AAGA,SAAOC,IAAP;AACD;;SC7BeC,UAAUC;AACxB,MAAIC,cAAc,GAAG,CAArB;;AAEA,WAASC,WAAT,CAAqBC,MAArB,EAAsCC,EAAtC;AACE,WAAO;AACL,UAAID,MAAM,KAAK,CAAC,CAACF,cAAjB,EAAiCG,EAAE;AACpC,KAFD;AAGD;;AAED,WAASb,KAAT;AACEU,IAAAA,cAAc,GAAGI,MAAM,CAACC,qBAAP,CAA6BN,QAA7B,CAAjB;AACD;;AAED,WAASO,IAAT;AACEF,IAAAA,MAAM,CAACG,oBAAP,CAA4BP,cAA5B;AACAA,IAAAA,cAAc,GAAG,CAAjB;AACD;;AAED,MAAMH,IAAI,GAAkB;AAC1BW,IAAAA,OAAO,EAA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